diff options
author | Manuel Lauss <manuel.lauss@gmail.com> | 2012-09-13 17:44:39 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2012-10-11 11:11:20 +0200 |
commit | bd8510df881f63a9e7768824cf0e33c4702dcde1 (patch) | |
tree | 00264a638b54403bc3693637c848f1bdee144c05 /arch/mips/alchemy | |
parent | 748e787eb6de610c4427594923ef8ca1f5431b74 (diff) |
MIPS: Alchemy: Single kernel for DB1200/1300/1550
Combine support for the DB1200/PB1200, DB1300 and DB1550 boards into
a single kernel image.
defconfig-generated image verified on DB1200, DB1300 and DB1550.
Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/4335/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/alchemy')
-rw-r--r-- | arch/mips/alchemy/Kconfig | 22 | ||||
-rw-r--r-- | arch/mips/alchemy/Platform | 22 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/Makefile | 4 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/db1200.c | 37 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/db1235.c | 84 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/db1300.c | 12 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/db1550.c | 15 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/platform.c | 9 |
8 files changed, 114 insertions, 91 deletions
diff --git a/arch/mips/alchemy/Kconfig b/arch/mips/alchemy/Kconfig index 0faaab24376..b4929b94cd7 100644 --- a/arch/mips/alchemy/Kconfig +++ b/arch/mips/alchemy/Kconfig @@ -36,25 +36,9 @@ config MIPS_DB1000 select SYS_SUPPORTS_LITTLE_ENDIAN select SYS_HAS_EARLY_PRINTK -config MIPS_DB1200 - bool "Alchemy DB1200/PB1200 board" - select ALCHEMY_GPIOINT_AU1000 - select DMA_COHERENT - select MIPS_DISABLE_OBSOLETE_IDE - select SYS_SUPPORTS_LITTLE_ENDIAN - select SYS_HAS_EARLY_PRINTK - -config MIPS_DB1300 - bool "NetLogic DB1300 board" - select ALCHEMY_GPIOINT_AU1300 - select DMA_COHERENT - select MIPS_DISABLE_OBSOLETE_IDE - select SYS_SUPPORTS_LITTLE_ENDIAN - select SYS_HAS_EARLY_PRINTK - -config MIPS_DB1550 - bool "Alchemy DB1550 board" - select ALCHEMY_GPIOINT_AU1000 +config MIPS_DB1235 + bool "Alchemy DB1200/PB1200/DB1300/DB1550 boards" + select ARCH_REQUIRE_GPIOLIB select HW_HAS_PCI select DMA_COHERENT select MIPS_DISABLE_OBSOLETE_IDE diff --git a/arch/mips/alchemy/Platform b/arch/mips/alchemy/Platform index 7956274de15..942c5800a68 100644 --- a/arch/mips/alchemy/Platform +++ b/arch/mips/alchemy/Platform @@ -30,25 +30,11 @@ cflags-$(CONFIG_MIPS_DB1000) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 load-$(CONFIG_MIPS_DB1000) += 0xffffffff80100000 # -# AMD Alchemy Db1550 eval board +# AMD Alchemy Db1200/Pb1200/Db1550/Db1300 eval boards # -platform-$(CONFIG_MIPS_DB1550) += alchemy/devboards/ -cflags-$(CONFIG_MIPS_DB1550) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 -load-$(CONFIG_MIPS_DB1550) += 0xffffffff80100000 - -# -# AMD Alchemy Db1200/Pb1200 eval boards -# -platform-$(CONFIG_MIPS_DB1200) += alchemy/devboards/ -cflags-$(CONFIG_MIPS_DB1200) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 -load-$(CONFIG_MIPS_DB1200) += 0xffffffff80100000 - -# -# NetLogic DBAu1300 development platform -# -platform-$(CONFIG_MIPS_DB1300) += alchemy/devboards/ -cflags-$(CONFIG_MIPS_DB1300) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 -load-$(CONFIG_MIPS_DB1300) += 0xffffffff80100000 +platform-$(CONFIG_MIPS_DB1235) += alchemy/devboards/ +cflags-$(CONFIG_MIPS_DB1235) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 +load-$(CONFIG_MIPS_DB1235) += 0xffffffff80100000 # # 4G-Systems MTX-1 "MeshCube" wireless router diff --git a/arch/mips/alchemy/devboards/Makefile b/arch/mips/alchemy/devboards/Makefile index c9e747dd9fc..f8a962498b2 100644 --- a/arch/mips/alchemy/devboards/Makefile +++ b/arch/mips/alchemy/devboards/Makefile @@ -8,6 +8,4 @@ obj-$(CONFIG_MIPS_PB1100) += pb1100.o obj-$(CONFIG_MIPS_PB1500) += pb1500.o obj-$(CONFIG_MIPS_PB1550) += pb1550.o obj-$(CONFIG_MIPS_DB1000) += db1000.o -obj-$(CONFIG_MIPS_DB1200) += db1200.o -obj-$(CONFIG_MIPS_DB1300) += db1300.o -obj-$(CONFIG_MIPS_DB1550) += db1550.o +obj-$(CONFIG_MIPS_DB1235) += db1235.o db1200.o db1300.o db1550.o diff --git a/arch/mips/alchemy/devboards/db1200.c b/arch/mips/alchemy/devboards/db1200.c index bf2248474fa..299b7d202be 100644 --- a/arch/mips/alchemy/devboards/db1200.c +++ b/arch/mips/alchemy/devboards/db1200.c @@ -45,25 +45,9 @@ #include "platform.h" -static const char *board_type_str(void) -{ - switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) { - case BCSR_WHOAMI_PB1200_DDR1: - case BCSR_WHOAMI_PB1200_DDR2: - return "PB1200"; - case BCSR_WHOAMI_DB1200: - return "DB1200"; - default: - return "(unknown)"; - } -} +const char *get_system_type(void); -const char *get_system_type(void) -{ - return board_type_str(); -} - -static int __init detect_board(void) +static int __init db1200_detect_board(void) { int bid; @@ -96,19 +80,17 @@ static int __init detect_board(void) return 1; /* it's neither */ } -void __init board_setup(void) +int __init db1200_board_setup(void) { unsigned long freq0, clksrc, div, pfc; unsigned short whoami; - if (detect_board()) { - printk(KERN_ERR "NOT running on a DB1200/PB1200 board!\n"); - return; - } + if (db1200_detect_board()) + return -ENODEV; whoami = bcsr_read(BCSR_WHOAMI); printk(KERN_INFO "Alchemy/AMD/RMI %s Board, CPLD Rev %d" - " Board-ID %d Daughtercard ID %d\n", board_type_str(), + " Board-ID %d Daughtercard ID %d\n", get_system_type(), (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf); /* SMBus/SPI on PSC0, Audio on PSC1 */ @@ -138,6 +120,8 @@ void __init board_setup(void) clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT; __raw_writel(clksrc, (void __iomem *)SYS_CLKSRC); wmb(); + + return 0; } /******************************************************************************/ @@ -796,7 +780,7 @@ static int __init pb1200_res_fixup(void) return 0; } -static int __init db1200_dev_init(void) +int __init db1200_dev_setup(void) { unsigned long pfc; unsigned short sw; @@ -846,7 +830,7 @@ static int __init db1200_dev_init(void) gpio_request(215, "otg-vbus"); gpio_direction_output(215, 1); - printk(KERN_INFO "%s device configuration:\n", board_type_str()); + printk(KERN_INFO "%s device configuration:\n", get_system_type()); sw = bcsr_read(BCSR_SWITCHES); if (sw & BCSR_SWITCHES_DIP_8) { @@ -922,4 +906,3 @@ static int __init db1200_dev_init(void) return 0; } -device_initcall(db1200_dev_init); diff --git a/arch/mips/alchemy/devboards/db1235.c b/arch/mips/alchemy/devboards/db1235.c new file mode 100644 index 00000000000..15003eb1f84 --- /dev/null +++ b/arch/mips/alchemy/devboards/db1235.c @@ -0,0 +1,84 @@ +/* + * DB1200/PB1200 / DB1550 / DB1300 board support. + * + * These 4 boards can reliably be supported in a single kernel image. + */ + +#include <asm/mach-au1x00/au1000.h> +#include <asm/mach-db1x00/bcsr.h> + +int __init db1200_board_setup(void); +int __init db1200_dev_setup(void); +int __init db1300_board_setup(void); +int __init db1300_dev_setup(void); +int __init db1550_board_setup(void); +int __init db1550_dev_setup(void); +int __init db1550_pci_setup(void); + +static const char *board_type_str(void) +{ + switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) { + case BCSR_WHOAMI_PB1200_DDR1: + case BCSR_WHOAMI_PB1200_DDR2: + return "PB1200"; + case BCSR_WHOAMI_DB1200: + return "DB1200"; + case BCSR_WHOAMI_DB1300: + return "DB1300"; + case BCSR_WHOAMI_DB1550: + return "DB1550"; + default: + return "(unknown)"; + } +} + +const char *get_system_type(void) +{ + return board_type_str(); +} + +void __init board_setup(void) +{ + int ret; + + switch (alchemy_get_cputype()) { + case ALCHEMY_CPU_AU1550: + ret = db1550_board_setup(); + break; + case ALCHEMY_CPU_AU1200: + ret = db1200_board_setup(); + break; + case ALCHEMY_CPU_AU1300: + ret = db1300_board_setup(); + break; + default: + pr_err("unsupported CPU on board\n"); + ret = -ENODEV; + } + if (ret) + panic("cannot initialize board support\n"); +} + +int __init db1235_arch_init(void) +{ + if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1550) + return db1550_pci_setup(); + return 0; +} +arch_initcall(db1235_arch_init); + +int __init db1235_dev_init(void) +{ + switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) { + case BCSR_WHOAMI_PB1200_DDR1: + case BCSR_WHOAMI_PB1200_DDR2: + case BCSR_WHOAMI_DB1200: + return db1200_dev_setup(); + case BCSR_WHOAMI_DB1300: + return db1300_dev_setup(); + case BCSR_WHOAMI_DB1550: + return db1550_dev_setup(); + } + return 0; +} +device_initcall(db1235_dev_init); diff --git a/arch/mips/alchemy/devboards/db1300.c b/arch/mips/alchemy/devboards/db1300.c index c56e0246694..cdf37cbd3d1 100644 --- a/arch/mips/alchemy/devboards/db1300.c +++ b/arch/mips/alchemy/devboards/db1300.c @@ -110,11 +110,6 @@ static void __init db1300_gpio_config(void) au1300_set_dbdma_gpio(1, AU1300_PIN_FG3AUX); } -char *get_system_type(void) -{ - return "DB1300"; -} - /**********************************************************************/ static void au1300_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, @@ -701,7 +696,7 @@ static struct platform_device *db1300_dev[] __initdata = { &db1300_sndi2s_dev, }; -static int __init db1300_device_init(void) +int __init db1300_dev_setup(void) { int swapped, cpldirq; @@ -758,10 +753,9 @@ static int __init db1300_device_init(void) return platform_add_devices(db1300_dev, ARRAY_SIZE(db1300_dev)); } -device_initcall(db1300_device_init); -void __init board_setup(void) +int __init db1300_board_setup(void) { unsigned short whoami; @@ -779,4 +773,6 @@ void __init board_setup(void) alchemy_uart_enable(AU1300_UART0_PHYS_ADDR); alchemy_uart_enable(AU1300_UART1_PHYS_ADDR); alchemy_uart_enable(AU1300_UART3_PHYS_ADDR); + + return 0; } diff --git a/arch/mips/alchemy/devboards/db1550.c b/arch/mips/alchemy/devboards/db1550.c index 9eb79062f46..7664beed8fa 100644 --- a/arch/mips/alchemy/devboards/db1550.c +++ b/arch/mips/alchemy/devboards/db1550.c @@ -26,12 +26,6 @@ #include <prom.h> #include "platform.h" - -const char *get_system_type(void) -{ - return "DB1550"; -} - static void __init db1550_hw_setup(void) { void __iomem *base; @@ -61,7 +55,7 @@ static void __init db1550_hw_setup(void) alchemy_gpio_direction_output(202, 0); /* green led on */ } -void __init board_setup(void) +int __init db1550_board_setup(void) { unsigned short whoami; @@ -74,6 +68,7 @@ void __init board_setup(void) (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf); db1550_hw_setup(); + return 0; } /*****************************************************************************/ @@ -430,13 +425,12 @@ static struct platform_device *db1550_devs[] __initdata = { }; /* must be arch_initcall; MIPS PCI scans busses in a subsys_initcall */ -static int __init db1550_pci_init(void) +int __init db1550_pci_setup(void) { return platform_device_register(&db1550_pci_host_dev); } -arch_initcall(db1550_pci_init); -static int __init db1550_dev_init(void) +int __init db1550_dev_setup(void) { int swapped; @@ -492,4 +486,3 @@ static int __init db1550_dev_init(void) return platform_add_devices(db1550_devs, ARRAY_SIZE(db1550_devs)); } -device_initcall(db1550_dev_init); diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c index f39042e99d0..8df86eb9497 100644 --- a/arch/mips/alchemy/devboards/platform.c +++ b/arch/mips/alchemy/devboards/platform.c @@ -36,11 +36,10 @@ void __init prom_init(void) void prom_putchar(unsigned char c) { -#ifdef CONFIG_MIPS_DB1300 - alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c); -#else - alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); -#endif + if (alchemy_get_cputype() == ALCHEMY_CPU_AU1300) + alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c); + else + alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); } |