Message ID | 20220127003656.330161-12-linus.walleij@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | IXP4xx spring cleaning | expand |
On Thu, Jan 27, 2022 at 01:36:54AM +0100, Linus Walleij wrote: > The new PCI driver does not need any of this stuff, so just > drop it. Please CC me and the iommu list on changes to kernel/dma/. But dropping this hooks is awesome, so: Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Jan 27, 2022 at 1:36 AM Linus Walleij <linus.walleij@linaro.org> wrote: > @@ -381,10 +378,8 @@ config ARCH_IOP32X > config ARCH_IXP4XX > bool "IXP4xx-based" > depends on MMU > - select ARCH_HAS_DMA_SET_COHERENT_MASK > select ARCH_SUPPORTS_BIG_ENDIAN > select CPU_XSCALE > - select DMABOUNCE if PCI > select GENERIC_IRQ_MULTI_HANDLER > select GPIO_IXP4XX > select GPIOLIB Very nice! AFAICT CONFIG_DMABOUNCE is now only used for the sa1111-ohci driver on the SA1100 Assabet's neponset add-on -- the other sa1111 based machines are either not supported by the kernel, or don't need the quirk, while other devices on sa11111 don't have DMA (ps2, ssp, pcmcia) or no driver (audio). Maybe we could change the sa1111-ohci driver to use usb_hcd_setup_local_mem(), which implements a similar method locally, and then kill off dmabounce for good. usb_hcd_setup_local_mem() is used on some pxa machines (csb726 with ohci-sm501 and eseries/tosa with ohci-tmio), though they use it to DMA into a small SRAM (8KB for tmio, 256KB for sm501) rather than a limited section of DRAM. Arnd
On Thu, Jan 27, 2022 at 11:00:54AM +0100, Arnd Bergmann wrote: > Maybe we could change the sa1111-ohci driver to use usb_hcd_setup_local_mem(), > which implements a similar method locally, and then kill off dmabounce for good. > > usb_hcd_setup_local_mem() is used on some pxa machines (csb726 with ohci-sm501 > and eseries/tosa with ohci-tmio), though they use it to DMA into a > small SRAM (8KB > for tmio, 256KB for sm501) rather than a limited section of DRAM. That would be awesome.
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 3a95203236d2..ec0dbaf73a81 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -217,9 +217,6 @@ config ARCH_MAY_HAVE_PC_FDC config ARCH_SUPPORTS_UPROBES def_bool y -config ARCH_HAS_DMA_SET_COHERENT_MASK - bool - config GENERIC_ISA_DMA bool @@ -381,10 +378,8 @@ config ARCH_IOP32X config ARCH_IXP4XX bool "IXP4xx-based" depends on MMU - select ARCH_HAS_DMA_SET_COHERENT_MASK select ARCH_SUPPORTS_BIG_ENDIAN select CPU_XSCALE - select DMABOUNCE if PCI select GENERIC_IRQ_MULTI_HANDLER select GPIO_IXP4XX select GPIOLIB diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index 4e51514ace6d..310e1602fbfc 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -30,7 +30,6 @@ #include <linux/soc/ixp4xx/cpu.h> #include <linux/irqchip/irq-ixp4xx.h> #include <linux/platform_data/timer-ixp4xx.h> -#include <linux/dma-map-ops.h> #include <mach/hardware.h> #include <linux/uaccess.h> #include <asm/page.h> @@ -330,59 +329,3 @@ void ixp4xx_restart(enum reboot_mode mode, const char *cmd) *IXP4XX_OSWE = IXP4XX_WDT_RESET_ENABLE | IXP4XX_WDT_COUNT_ENABLE; } } - -#ifdef CONFIG_PCI -static int ixp4xx_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size) -{ - return (dma_addr + size) > SZ_64M; -} - -static int ixp4xx_platform_notify_remove(struct device *dev) -{ - if (dev_is_pci(dev)) - dmabounce_unregister_dev(dev); - - return 0; -} -#endif - -/* - * Setup DMA mask to 64MB on PCI devices and 4 GB on all other things. - */ -static int ixp4xx_platform_notify(struct device *dev) -{ - dev->dma_mask = &dev->coherent_dma_mask; - -#ifdef CONFIG_PCI - if (dev_is_pci(dev)) { - dev->coherent_dma_mask = DMA_BIT_MASK(28); /* 64 MB */ - dmabounce_register_dev(dev, 2048, 4096, ixp4xx_needs_bounce); - return 0; - } -#endif - - dev->coherent_dma_mask = DMA_BIT_MASK(32); - return 0; -} - -int dma_set_coherent_mask(struct device *dev, u64 mask) -{ - if (dev_is_pci(dev)) - mask &= DMA_BIT_MASK(28); /* 64 MB */ - - if ((mask & DMA_BIT_MASK(28)) == DMA_BIT_MASK(28)) { - dev->coherent_dma_mask = mask; - return 0; - } - - return -EIO; /* device wanted sub-64MB mask */ -} -EXPORT_SYMBOL(dma_set_coherent_mask); - -void __init ixp4xx_init_early(void) -{ - platform_notify = ixp4xx_platform_notify; -#ifdef CONFIG_PCI - platform_notify_remove = ixp4xx_platform_notify_remove; -#endif -} diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index 9478eccd1c8e..559461a826ba 100644 --- a/kernel/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -745,7 +745,6 @@ int dma_set_mask(struct device *dev, u64 mask) } EXPORT_SYMBOL(dma_set_mask); -#ifndef CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK int dma_set_coherent_mask(struct device *dev, u64 mask) { /* @@ -761,7 +760,6 @@ int dma_set_coherent_mask(struct device *dev, u64 mask) return 0; } EXPORT_SYMBOL(dma_set_coherent_mask); -#endif size_t dma_max_mapping_size(struct device *dev) {
The new PCI driver does not need any of this stuff, so just drop it. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- arch/arm/Kconfig | 5 --- arch/arm/mach-ixp4xx/common.c | 57 ----------------------------------- kernel/dma/mapping.c | 2 -- 3 files changed, 64 deletions(-)