MIPS: Alchemy: single kernel for all devboards
v2 cover MIPS: Alchemy: single kernel for all devboards
This patchset removes the last hurdles to supporting all DB/PB Develoboards
in a single kernel image. The main issue is that on earlier chips
(Au1000, Au1500, Au1100) some peripherals, notably the USB blocks, aren't fully dma coherent and need manual cache massaging to work properly. For these parts DMA_NONCOHERENT is used.
Newer variants starting with the Au1550 work fine without any additional software intervention and use DMA_COHERENT by default.
The first patch extends the already existing DMA_MAYBE_COHERENT logic to also cover the parts which are already compiled when DMA_NONCOHERENT is enabled. The second patch then uses the "coherentio" variable which DMA_MAYBE_COHERENT exports and sets it based on CPU subtype. The third patch finally unifies support for all Alchemy devboards.
I'm not really sure if patch #1 is even the correct way to do it; however based on my understanding of what DMA_MAYBE_COHERENT is supposed to do I actually thought that it's a logical extension. But I'm not sure and don't have a MALTA board to test it on. Hence the RFC.
v2: new defconfig replacing two oobsolete ones, some function renaming
Thanks,
Manuel Lauss
Manuel Lauss (3):
MIPS: extend DMA_MAYBE_COHERENT logic to DMA_NONCOHERENT use
MIPS: Alchemy: determine cohereny at runtime based on cpu type
MIPS: Alchemy: unify Devboard support.
arch/mips/Kconfig | 1 + arch/mips/alchemy/Kconfig | 22 +- arch/mips/alchemy/Platform | 16 +- arch/mips/alchemy/common/setup.c | 10 + arch/mips/alchemy/devboards/Makefile | 4 +- arch/mips/alchemy/devboards/db1000.c | 47 +--- arch/mips/alchemy/devboards/db1200.c | 9 + arch/mips/alchemy/devboards/db1235.c | 94 -------- arch/mips/alchemy/devboards/db1300.c | 6 +- arch/mips/alchemy/devboards/db1550.c | 10 +- arch/mips/alchemy/devboards/db1xxx.c | 121 ++++++++++ arch/mips/configs/db1000_defconfig | 359 ----------------------------- arch/mips/configs/db1235_defconfig | 434 ----------------------------------- arch/mips/configs/db1xxx_defconfig | 248 ++++++++++++++++++++ arch/mips/include/asm/io.h | 4 +- arch/mips/mm/c-r4k.c | 6 +- arch/mips/mm/cache.c | 4 +- arch/mips/pci/pci-alchemy.c | 5 +- drivers/spi/spi-au1550.c | 9 + 19 files changed, 445 insertions(+), 964 deletions(-) delete mode 100644 arch/mips/alchemy/devboards/db1235.c create mode 100644 arch/mips/alchemy/devboards/db1xxx.c delete mode 100644 arch/mips/configs/db1000_defconfig delete mode 100644 arch/mips/configs/db1235_defconfig create mode 100644 arch/mips/configs/db1xxx_defconfig
Signature · 1 line
1.8.5.5
PATCH v2 1/3 MIPS: extend DMA_MAYBE_COHERENT logic to DMA_NONCOHERENT use
setting DMA_MAYBE_COHERENT gives a platform the opportunity to select use of cache ops at boot.
---
v2: no changes
arch/mips/include/asm/io.h | 4 ++-- arch/mips/mm/c-r4k.c | 6 +++--- arch/mips/mm/cache.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)
arch/mips/include/asm/io.h +2 -2
@@ -584,7 +584,7 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int* * This API used to be exported; it now is for arch code internal use only. */ -#ifdef CONFIG_DMA_NONCOHERENT +#if defined(CONFIG_DMA_NONCOHERENT ) || defined(CONFIG_DMA_MAYBE_COHERENT )extern void (*_dma_cache_wback_inv)(unsigned long start,unsigned long size);extern void (*_dma_cache_wback)(unsigned long start,unsigned long size);
@@ -603,7 +603,7 @@ extern void (*_dma_cache_inv)(unsigned long start, unsigned long size);#define dma_cache_inv (start,size) \ do { (void) (start); (void) (size); } while (0) -#endif /* CONFIG_DMA_NONCOHERENT */ +#endif /* CONFIG_DMA_NONCOHERENT || CONFIG_DMA_MAYBE_COHERENT */ /* * Read a 32-bit register that requires a 64-bit read cycle on the bus.
arch/mips/mm/c-r4k.c +3 -3
@@ -617,7 +617,7 @@ static void r4k_flush_icache_range(unsigned long start, unsigned long end)instruction_hazard (); } -#ifdef CONFIG_DMA_NONCOHERENT +#if defined(CONFIG_DMA_NONCOHERENT ) || defined(CONFIG_DMA_MAYBE_COHERENT )static void r4k_dma_cache_wback_inv (unsigned long addr,unsigned long size) {
@@ -688,7 +688,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)bc_inv (addr, size); __sync(); } -#endif /* CONFIG_DMA_NONCOHERENT */ +#endif /* CONFIG_DMA_NONCOHERENT || CONFIG_DMA_MAYBE_COHERENT */ /* * While we're protected against bad userland addresses we don't care
@@ -1492,7 +1492,7 @@ void r4k_cache_init(void) flush_icache_range = r4k_flush_icache_range; local_flush_icache_range = local_r4k_flush_icache_range; -#if defined(CONFIG_DMA_NONCOHERENT ) +#if defined(CONFIG_DMA_NONCOHERENT ) || defined(CONFIG_DMA_MAYBE_COHERENT )if (coherentio) { _dma_cache_wback_inv = (void *)cache_noop; _dma_cache_wback = (void *)cache_noop;
arch/mips/mm/cache.c +2 -2
@@ -49,7 +49,7 @@ EXPORT_SYMBOL_GPL(local_flush_data_cache_page);EXPORT_SYMBOL (flush_data_cache_page);EXPORT_SYMBOL (flush_icache_all); -#ifdef CONFIG_DMA_NONCOHERENT +#if defined(CONFIG_DMA_NONCOHERENT ) || defined(CONFIG_DMA_MAYBE_COHERENT )/* DMA cache operations. */ void (*_dma_cache_wback_inv)(unsigned long start,unsigned long size);
@@ -58,7 +58,7 @@ void (*_dma_cache_inv)(unsigned long start, unsigned long size);EXPORT_SYMBOL (_dma_cache_wback_inv); -#endif /* CONFIG_DMA_NONCOHERENT */ +#endif /* CONFIG_DMA_NONCOHERENT || CONFIG_DMA_MAYBE_COHERENT */ /* * We could optimize the case where the cache argument is not BCACHE but
Signature · 1 line
1.8.5.5
PATCH v2 2/3 MIPS: Alchemy: determine cohereny at runtime based on cpu type
In reply to Manuel LaussAll Alchemy chips have coherent DMA, but for example the USB or AC97 peripherals on the Au1000/1500/1100 are not.
This patch uses DMA_MAYBE_COHERENT on Alchemy and sets coherentio based on CPU type.
---
v2: no changes
arch/mips/Kconfig | 1 + arch/mips/alchemy/Kconfig | 5 ----- arch/mips/alchemy/common/setup.c | 10 ++++++++++ arch/mips/pci/pci-alchemy.c | 5 ++--- 4 files changed, 13 insertions(+), 8 deletions(-)
arch/mips/Kconfig +1 -0
@@ -62,6 +62,7 @@ config MIPS_ALCHEMY select CEVT_R4K select CSRC_R4K select IRQ_CPU + select DMA_MAYBE_COHERENT # Au1000,1500,1100 aren't, rest is select SYS_HAS_CPU_MIPS32_R1 select SYS_SUPPORTS_32BIT_KERNEL select SYS_SUPPORTS_APM_EMULATION
arch/mips/alchemy/Kconfig +0 -5
@@ -20,7 +20,6 @@ choice config MIPS_MTX1 bool "4G Systems MTX-1 board" - select DMA_NONCOHERENT select HW_HAS_PCI select ALCHEMY_GPIOINT_AU1000 select SYS_SUPPORTS_LITTLE_ENDIAN
@@ -29,7 +28,6 @@ config MIPS_MTX1 config MIPS_DB1000 bool "Alchemy DB1000/DB1500/DB1100 PB1500/1100 boards" select ALCHEMY_GPIOINT_AU1000 - select DMA_NONCOHERENT select HW_HAS_PCI select SYS_SUPPORTS_BIG_ENDIAN select SYS_SUPPORTS_LITTLE_ENDIAN
@@ -39,13 +37,11 @@ config MIPS_DB1235 bool "Alchemy DB1200/PB1200/DB1300/DB1550/PB1550 boards" select ARCH_REQUIRE_GPIOLIB select HW_HAS_PCI - select DMA_COHERENT select SYS_SUPPORTS_LITTLE_ENDIAN select SYS_HAS_EARLY_PRINTK config MIPS_XXS1500 bool "MyCable XXS1500 board" - select DMA_NONCOHERENT select ALCHEMY_GPIOINT_AU1000 select SYS_SUPPORTS_LITTLE_ENDIAN select SYS_HAS_EARLY_PRINTK
@@ -54,7 +50,6 @@ config MIPS_GPR bool "Trapeze ITS GPR board" select ALCHEMY_GPIOINT_AU1000 select HW_HAS_PCI - select DMA_NONCOHERENT select SYS_SUPPORTS_LITTLE_ENDIAN select SYS_HAS_EARLY_PRINTK
arch/mips/alchemy/common/setup.c +10 -0
@@ -30,6 +30,7 @@#include <linux/jiffies.h> #include <linux/module.h> +#include <asm/dma-coherence.h> #include <asm/mipsregs.h> #include <asm/time.h>
@@ -59,6 +60,15 @@ void __init plat_mem_setup(void)/* Clear to obtain best system bus performance */ clear_c0_config (1 <<19 );/* Clear Config[OD] */ + hw_coherentio =0 ; + coherentio =1 ; +switch (alchemy_get_cputype ()) { +case ALCHEMY_CPU_AU1000 : +case ALCHEMY_CPU_AU1500 : +case ALCHEMY_CPU_AU1100 : + coherentio =0 ; + } +board_setup ();/* board specific setup */ /* IO/MEM resources. */
arch/mips/pci/pci-alchemy.c +2 -3
@@ -16,6 +16,7 @@#include <linux/syscore_ops.h> #include <linux/vmalloc.h> +#include <asm/dma-coherence.h> #include <asm/mach-au1x00/au1000.h> #include <asm/tlbmisc.h>
@@ -411,17 +412,15 @@ static int alchemy_pci_probe(struct platform_device *pdev) } ctx->alchemy_pci_ctrl.io_map_base = (unsigned long )virt_io; -#ifdef CONFIG_DMA_NONCOHERENT /* Au1500 revisions older than AD have borked coherent PCI */ if ((alchemy_get_cputype () ==ALCHEMY_CPU_AU1500 ) && - (read_c0_prid () <0x01030202 )) { + (read_c0_prid () <0x01030202 ) && !coherentio) { val =__raw_readl (ctx->regs +PCI_REG_CONFIG ); val |=PCI_CONFIG_NC ;__raw_writel (val, ctx->regs +PCI_REG_CONFIG );wmb ();dev_info (&pdev->dev,"non-coherent PCI on Au1500 AA/AB/AC\n" ); } -#endif if (pd->board_map_irq) ctx->board_map_irq = pd->board_map_irq;
Signature · 1 line
1.8.5.5
PATCH v2 3/3 MIPS: Alchemy: unify Devboard support.
In reply to Manuel LaussThis patch merges support for all DB1xxx and PB1xxx boards into a single image, along with a new single defconfig for them.
Run-tested on DB1300 and DB1500.
---
v2: added a db1xxx_defconfig to replace the 2 obsolete ones.
arch/mips/alchemy/Kconfig | 17 +- arch/mips/alchemy/Platform | 16 +- arch/mips/alchemy/devboards/Makefile | 4 +- arch/mips/alchemy/devboards/db1000.c | 47 +--- arch/mips/alchemy/devboards/db1200.c | 9 + arch/mips/alchemy/devboards/db1235.c | 94 -------- arch/mips/alchemy/devboards/db1300.c | 6 +- arch/mips/alchemy/devboards/db1550.c | 10 +- arch/mips/alchemy/devboards/db1xxx.c | 121 ++++++++++ arch/mips/configs/db1000_defconfig | 359 ----------------------------- arch/mips/configs/db1235_defconfig | 434 ----------------------------------- arch/mips/configs/db1xxx_defconfig | 248 ++++++++++++++++++++ drivers/spi/spi-au1550.c | 9 + 13 files changed, 425 insertions(+), 949 deletions(-) delete mode 100644 arch/mips/alchemy/devboards/db1235.c create mode 100644 arch/mips/alchemy/devboards/db1xxx.c delete mode 100644 arch/mips/configs/db1000_defconfig delete mode 100644 arch/mips/configs/db1235_defconfig create mode 100644 arch/mips/configs/db1xxx_defconfig
arch/mips/alchemy/Kconfig +7 -10
@@ -25,20 +25,17 @@ config MIPS_MTX1 select SYS_SUPPORTS_LITTLE_ENDIAN select SYS_HAS_EARLY_PRINTK -config MIPS_DB1000 - bool "Alchemy DB1000/DB1500/DB1100 PB1500/1100 boards" - select ALCHEMY_GPIOINT_AU1000 - select HW_HAS_PCI - select SYS_SUPPORTS_BIG_ENDIAN - select SYS_SUPPORTS_LITTLE_ENDIAN - select SYS_HAS_EARLY_PRINTK - -config MIPS_DB1235 - bool "Alchemy DB1200/PB1200/DB1300/DB1550/PB1550 boards" +config MIPS_DB1XXX + bool "Alchemy DB1XXX / PB1XXX boards" select ARCH_REQUIRE_GPIOLIB select HW_HAS_PCI select SYS_SUPPORTS_LITTLE_ENDIAN select SYS_HAS_EARLY_PRINTK + help + Select this option if you have one of the following Alchemy + development boards: DB1000 DB1500 DB1100 DB1550 DB1200 DB1300 + PB1500 PB1100 PB1550 PB1200 + Board type is autodetected during boot. config MIPS_XXS1500 bool "MyCable XXS1500 board"
arch/mips/alchemy/Platform +5 -11
@@ -5,18 +5,12 @@ platform-$(CONFIG_MIPS_ALCHEMY) += alchemy/common/ # -# AMD Alchemy Db1000/Db1500/Pb1500/Db1100/Pb1100 eval boards +# AMD Alchemy Db1000/Db1500/Pb1500/Db1100/Pb1100 +# Db1550/Pb1550/Db1200/Pb1200/Db1300 # -platform-$(CONFIG_MIPS_DB1000) += alchemy/devboards/ -cflags-$(CONFIG_MIPS_DB1000) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 -load-$(CONFIG_MIPS_DB1000) += 0xffffffff80100000 - -# -# AMD Alchemy Db1200/Pb1200/Db1550/Pb1550/Db1300 eval boards -# -platform-$(CONFIG_MIPS_DB1235) += alchemy/devboards/ -cflags-$(CONFIG_MIPS_DB1235) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 -load-$(CONFIG_MIPS_DB1235) += 0xffffffff80100000 +platform-$(CONFIG_MIPS_DB1XXX) += alchemy/devboards/ +cflags-$(CONFIG_MIPS_DB1XXX) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 +load-$(CONFIG_MIPS_DB1XXX) += 0xffffffff80100000 # # 4G-Systems MTX-1 "MeshCube" wireless router
arch/mips/alchemy/devboards/Makefile +1 -3
@@ -2,7 +2,5 @@ # Alchemy Develboards # -obj-y += bcsr.o platform.o +obj-y += bcsr.o platform.o db1000.o db1200.o db1300.o db1550.o db1xxx.o obj-$(CONFIG_PM) += pm.o -obj-$(CONFIG_MIPS_DB1000) += db1000.o -obj-$(CONFIG_MIPS_DB1235) += db1235.o db1200.o db1300.o db1550.o
arch/mips/alchemy/devboards/db1000.c +12 -35
82 lines not on this page · raw message
arch/mips/alchemy/devboards/db1200.c +9 -0
@@ -89,6 +89,15 @@ int __init db1200_board_setup(void)return -ENODEV ; whoami =bcsr_read (BCSR_WHOAMI ); +switch (BCSR_WHOAMI_BOARD (whoami)) { +case BCSR_WHOAMI_PB1200_DDR1 : +case BCSR_WHOAMI_PB1200_DDR2 : +case BCSR_WHOAMI_DB1200 : +break ; +default : +return -ENODEV ; + } +printk (KERN_INFO "Alchemy/AMD/RMI %s Board, CPLD Rev %d" " Board-ID %d Daughtercard ID %d\n" ,get_system_type (), (whoami >>4 ) &0xf , (whoami >>8 ) &0xf , whoami &0xf );
arch/mips/alchemy/devboards/db1235.c deleted +0 -94
94 lines not on this page · raw message
arch/mips/alchemy/devboards/db1300.c +5 -1
@@ -759,11 +759,15 @@ int __init db1300_board_setup(void) {unsigned short whoami; -db1300_gpio_config ();bcsr_init (DB1300_BCSR_PHYS_ADDR ,DB1300_BCSR_PHYS_ADDR +DB1300_BCSR_HEXLED_OFS ); whoami =bcsr_read (BCSR_WHOAMI ); +if (BCSR_WHOAMI_BOARD (whoami) !=BCSR_WHOAMI_DB1300 ) +return -ENODEV ; + +db1300_gpio_config (); + printk(KERN_INFO "NetLogic DBAu1300 Development Platform.\n\t" "BoardID %d CPLD Rev %d DaughtercardID %d\n", BCSR_WHOAMI_BOARD(whoami), BCSR_WHOAMI_CPLD(whoami),
arch/mips/alchemy/devboards/db1550.c +8 -2
@@ -62,10 +62,16 @@ int __init db1550_board_setup(void) DB1550_BCSR_PHYS_ADDR + DB1550_BCSR_HEXLED_OFS); whoami =bcsr_read (BCSR_WHOAMI );/* PB1550 hexled offset differs */ -if ((BCSR_WHOAMI_BOARD (whoami) ==BCSR_WHOAMI_PB1550_SDR ) || - (BCSR_WHOAMI_BOARD (whoami) ==BCSR_WHOAMI_PB1550_DDR )) +switch (BCSR_WHOAMI_BOARD (whoami)) { +case BCSR_WHOAMI_PB1550_SDR : +case BCSR_WHOAMI_PB1550_DDR :bcsr_init (PB1550_BCSR_PHYS_ADDR ,PB1550_BCSR_PHYS_ADDR +PB1550_BCSR_HEXLED_OFS ); +case BCSR_WHOAMI_DB1550 : +break ; +default : +return -ENODEV ; + } pr_info("Alchemy/AMD %s Board, CPLD Rev %d Board-ID %d " \ "Daughtercard ID %d\n", get_system_type(),
arch/mips/alchemy/devboards/db1xxx.c new file +121 -0
121 lines not on this page · raw message
arch/mips/configs/db1000_defconfig deleted +0 -359
359 lines not on this page · raw message
arch/mips/configs/db1235_defconfig deleted +0 -434
434 lines not on this page · raw message
arch/mips/configs/db1xxx_defconfig new file +248 -0
248 lines not on this page · raw message
drivers/spi/spi-au1550.c +9 -0
@@ -999,6 +999,15 @@ static int __init au1550_spi_init(void)* create memory device with 8 bits dev_devwidth * needed for proper byte ordering to spi fifo */ +switch (alchemy_get_cputype ()) { +case ALCHEMY_CPU_AU1550 : +case ALCHEMY_CPU_AU1200 : +case ALCHEMY_CPU_AU1300 : +break ; +default : +return -ENODEV ; + } +if (usedma) { ddma_memid =au1xxx_ddma_add_device (&au1550_spi_mem_dbdev);if (!ddma_memid)
Signature · 1 line
1.8.5.5