From d7e3528eed85b51ddca2f281d2d4e7d687f28d60 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 31 May 2016 14:05:27 -0700 Subject: [PATCH 1/3] irqchip: bcm2835: Avoid arch/arm-specific handle_IRQ With commit 76ba59f8366f genirq: Add irq_domain-aware core IRQ handler architecture-specific irq handlers are no longer necessary. Update the bcm2835 irq driver to use the core irq handler. As a bonus, this allows the driver to support arm64 as well. Signed-off-by: Eric Anholt Acked-by: Stephen Warren Link: https://lkml.kernel.org/r/1464728727-16300-1-git-send-email-eric@anholt.net [jac reworded commit message for clarity] Signed-off-by: Jason Cooper --- drivers/irqchip/irq-bcm2835.c | 3 +-- drivers/irqchip/irq-bcm2836.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c index bf9cc5f2e839..44d7c38dde47 100644 --- a/drivers/irqchip/irq-bcm2835.c +++ b/drivers/irqchip/irq-bcm2835.c @@ -52,7 +52,6 @@ #include #include -#include /* Put the bank and irq (32 bits) into the hwirq */ #define MAKE_HWIRQ(b, n) ((b << 5) | (n)) @@ -242,7 +241,7 @@ static void __exception_irq_entry bcm2835_handle_irq( u32 hwirq; while ((hwirq = get_next_armctrl_hwirq()) != ~0) - handle_IRQ(irq_linear_revmap(intc.domain, hwirq), regs); + handle_domain_irq(intc.domain, hwirq, regs); } static void bcm2836_chained_handle_irq(struct irq_desc *desc) diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c index 72ff1d5c5de6..27875982657e 100644 --- a/drivers/irqchip/irq-bcm2836.c +++ b/drivers/irqchip/irq-bcm2836.c @@ -180,7 +180,7 @@ __exception_irq_entry bcm2836_arm_irqchip_handle_irq(struct pt_regs *regs) } else if (stat) { u32 hwirq = ffs(stat) - 1; - handle_IRQ(irq_linear_revmap(intc.domain, hwirq), regs); + handle_domain_irq(intc.domain, hwirq, regs); } } From 1a9a0536d8ad0ad804758f1f2ce1f2dc0c5e053a Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Fri, 3 Jun 2016 08:18:22 +0200 Subject: [PATCH 2/3] arm64: Allow for different DMA and CPU bus offsets On arm64, all SoCs we supported so far either have an IOMMU or have bus addresses equal to CPU addresses. However, with the Raspberry Pi 3 coming up, this is no longer true. To allow DMA to work with an AArch64 kernel on those devices, let's allow devices to have DMA offsets again. Signed-off-by: Alexander Graf Acked-by: Arnd Bergmann Acked-by: Catalin Marinas Signed-off-by: Eric Anholt --- arch/arm64/include/asm/dma-mapping.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index 7dbea6c070ec..ccea82c2b089 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h @@ -66,12 +66,16 @@ static inline bool is_device_dma_coherent(struct device *dev) static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) { - return (dma_addr_t)paddr; + dma_addr_t dev_addr = (dma_addr_t)paddr; + + return dev_addr - ((dma_addr_t)dev->dma_pfn_offset << PAGE_SHIFT); } static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr) { - return (phys_addr_t)dev_addr; + phys_addr_t paddr = (phys_addr_t)dev_addr; + + return paddr + ((phys_addr_t)dev->dma_pfn_offset << PAGE_SHIFT); } static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) @@ -86,5 +90,14 @@ static inline void dma_mark_clean(void *addr, size_t size) { } +/* Override for dma_max_pfn() */ +static inline unsigned long dma_max_pfn(struct device *dev) +{ + dma_addr_t dma_max = (dma_addr_t)*dev->dma_mask; + + return (ulong)dma_to_phys(dev, dma_max) >> PAGE_SHIFT; +} +#define dma_max_pfn(dev) dma_max_pfn(dev) + #endif /* __KERNEL__ */ #endif /* __ASM_DMA_MAPPING_H */ From 628d30d1ccb897fee54a6f7312561cf2f6f72f09 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 3 Jun 2016 08:18:23 +0200 Subject: [PATCH 3/3] arm64: Add platform selection for BCM2835. Signed-off-by: Eric Anholt [ kraxel: copy some selects from arm to arm64 ] Signed-off-by: Gerd Hoffmann Acked-by: Catalin Marinas --- arch/arm64/Kconfig.platforms | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 7ef1d05859ae..ea88402eb724 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -13,6 +13,19 @@ config ARCH_ALPINE This enables support for the Annapurna Labs Alpine Soc family. +config ARCH_BCM2835 + bool "Broadcom BCM2835 family" + select ARCH_REQUIRE_GPIOLIB + select CLKSRC_OF + select PINCTRL + select PINCTRL_BCM2835 + select ARM_AMBA + select ARM_TIMER_SP804 + select HAVE_ARM_ARCH_TIMER + help + This enables support for the Broadcom BCM2837 SoC. + This SoC is used in the Raspberry Pi 3 device. + config ARCH_BCM_IPROC bool "Broadcom iProc SoC Family" select COMMON_CLK_IPROC