diff options
author | Manuel Lauss <manuel.lauss@gmail.com> | 2012-09-13 11:44:39 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2012-10-11 05:11:20 -0400 |
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 0faaab24376e..b4929b94cd7c 100644 --- a/arch/mips/alchemy/Kconfig +++ b/arch/mips/alchemy/Kconfig | |||
@@ -36,25 +36,9 @@ config MIPS_DB1000 | |||
36 | select SYS_SUPPORTS_LITTLE_ENDIAN | 36 | select SYS_SUPPORTS_LITTLE_ENDIAN |
37 | select SYS_HAS_EARLY_PRINTK | 37 | select SYS_HAS_EARLY_PRINTK |
38 | 38 | ||
39 | config MIPS_DB1200 | 39 | config MIPS_DB1235 |
40 | bool "Alchemy DB1200/PB1200 board" | 40 | bool "Alchemy DB1200/PB1200/DB1300/DB1550 boards" |
41 | select ALCHEMY_GPIOINT_AU1000 | 41 | select ARCH_REQUIRE_GPIOLIB |
42 | select DMA_COHERENT | ||
43 | select MIPS_DISABLE_OBSOLETE_IDE | ||
44 | select SYS_SUPPORTS_LITTLE_ENDIAN | ||
45 | select SYS_HAS_EARLY_PRINTK | ||
46 | |||
47 | config MIPS_DB1300 | ||
48 | bool "NetLogic DB1300 board" | ||
49 | select ALCHEMY_GPIOINT_AU1300 | ||
50 | select DMA_COHERENT | ||
51 | select MIPS_DISABLE_OBSOLETE_IDE | ||
52 | select SYS_SUPPORTS_LITTLE_ENDIAN | ||
53 | select SYS_HAS_EARLY_PRINTK | ||
54 | |||
55 | config MIPS_DB1550 | ||
56 | bool "Alchemy DB1550 board" | ||
57 | select ALCHEMY_GPIOINT_AU1000 | ||
58 | select HW_HAS_PCI | 42 | select HW_HAS_PCI |
59 | select DMA_COHERENT | 43 | select DMA_COHERENT |
60 | select MIPS_DISABLE_OBSOLETE_IDE | 44 | select MIPS_DISABLE_OBSOLETE_IDE |
diff --git a/arch/mips/alchemy/Platform b/arch/mips/alchemy/Platform index 7956274de15f..942c5800a684 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 | |||
30 | load-$(CONFIG_MIPS_DB1000) += 0xffffffff80100000 | 30 | load-$(CONFIG_MIPS_DB1000) += 0xffffffff80100000 |
31 | 31 | ||
32 | # | 32 | # |
33 | # AMD Alchemy Db1550 eval board | 33 | # AMD Alchemy Db1200/Pb1200/Db1550/Db1300 eval boards |
34 | # | 34 | # |
35 | platform-$(CONFIG_MIPS_DB1550) += alchemy/devboards/ | 35 | platform-$(CONFIG_MIPS_DB1235) += alchemy/devboards/ |
36 | cflags-$(CONFIG_MIPS_DB1550) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 | 36 | cflags-$(CONFIG_MIPS_DB1235) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 |
37 | load-$(CONFIG_MIPS_DB1550) += 0xffffffff80100000 | 37 | load-$(CONFIG_MIPS_DB1235) += 0xffffffff80100000 |
38 | |||
39 | # | ||
40 | # AMD Alchemy Db1200/Pb1200 eval boards | ||
41 | # | ||
42 | platform-$(CONFIG_MIPS_DB1200) += alchemy/devboards/ | ||
43 | cflags-$(CONFIG_MIPS_DB1200) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 | ||
44 | load-$(CONFIG_MIPS_DB1200) += 0xffffffff80100000 | ||
45 | |||
46 | # | ||
47 | # NetLogic DBAu1300 development platform | ||
48 | # | ||
49 | platform-$(CONFIG_MIPS_DB1300) += alchemy/devboards/ | ||
50 | cflags-$(CONFIG_MIPS_DB1300) += -I$(srctree)/arch/mips/include/asm/mach-db1x00 | ||
51 | load-$(CONFIG_MIPS_DB1300) += 0xffffffff80100000 | ||
52 | 38 | ||
53 | # | 39 | # |
54 | # 4G-Systems MTX-1 "MeshCube" wireless router | 40 | # 4G-Systems MTX-1 "MeshCube" wireless router |
diff --git a/arch/mips/alchemy/devboards/Makefile b/arch/mips/alchemy/devboards/Makefile index c9e747dd9fc2..f8a962498b2f 100644 --- a/arch/mips/alchemy/devboards/Makefile +++ b/arch/mips/alchemy/devboards/Makefile | |||
@@ -8,6 +8,4 @@ obj-$(CONFIG_MIPS_PB1100) += pb1100.o | |||
8 | obj-$(CONFIG_MIPS_PB1500) += pb1500.o | 8 | obj-$(CONFIG_MIPS_PB1500) += pb1500.o |
9 | obj-$(CONFIG_MIPS_PB1550) += pb1550.o | 9 | obj-$(CONFIG_MIPS_PB1550) += pb1550.o |
10 | obj-$(CONFIG_MIPS_DB1000) += db1000.o | 10 | obj-$(CONFIG_MIPS_DB1000) += db1000.o |
11 | obj-$(CONFIG_MIPS_DB1200) += db1200.o | 11 | obj-$(CONFIG_MIPS_DB1235) += db1235.o db1200.o db1300.o db1550.o |
12 | obj-$(CONFIG_MIPS_DB1300) += db1300.o | ||
13 | obj-$(CONFIG_MIPS_DB1550) += db1550.o | ||
diff --git a/arch/mips/alchemy/devboards/db1200.c b/arch/mips/alchemy/devboards/db1200.c index bf2248474fa8..299b7d202bea 100644 --- a/arch/mips/alchemy/devboards/db1200.c +++ b/arch/mips/alchemy/devboards/db1200.c | |||
@@ -45,25 +45,9 @@ | |||
45 | 45 | ||
46 | #include "platform.h" | 46 | #include "platform.h" |
47 | 47 | ||
48 | static const char *board_type_str(void) | 48 | const char *get_system_type(void); |
49 | { | ||
50 | switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) { | ||
51 | case BCSR_WHOAMI_PB1200_DDR1: | ||
52 | case BCSR_WHOAMI_PB1200_DDR2: | ||
53 | return "PB1200"; | ||
54 | case BCSR_WHOAMI_DB1200: | ||
55 | return "DB1200"; | ||
56 | default: | ||
57 | return "(unknown)"; | ||
58 | } | ||
59 | } | ||
60 | 49 | ||
61 | const char *get_system_type(void) | 50 | static int __init db1200_detect_board(void) |
62 | { | ||
63 | return board_type_str(); | ||
64 | } | ||
65 | |||
66 | static int __init detect_board(void) | ||
67 | { | 51 | { |
68 | int bid; | 52 | int bid; |
69 | 53 | ||
@@ -96,19 +80,17 @@ static int __init detect_board(void) | |||
96 | return 1; /* it's neither */ | 80 | return 1; /* it's neither */ |
97 | } | 81 | } |
98 | 82 | ||
99 | void __init board_setup(void) | 83 | int __init db1200_board_setup(void) |
100 | { | 84 | { |
101 | unsigned long freq0, clksrc, div, pfc; | 85 | unsigned long freq0, clksrc, div, pfc; |
102 | unsigned short whoami; | 86 | unsigned short whoami; |
103 | 87 | ||
104 | if (detect_board()) { | 88 | if (db1200_detect_board()) |
105 | printk(KERN_ERR "NOT running on a DB1200/PB1200 board!\n"); | 89 | return -ENODEV; |
106 | return; | ||
107 | } | ||
108 | 90 | ||
109 | whoami = bcsr_read(BCSR_WHOAMI); | 91 | whoami = bcsr_read(BCSR_WHOAMI); |
110 | printk(KERN_INFO "Alchemy/AMD/RMI %s Board, CPLD Rev %d" | 92 | printk(KERN_INFO "Alchemy/AMD/RMI %s Board, CPLD Rev %d" |
111 | " Board-ID %d Daughtercard ID %d\n", board_type_str(), | 93 | " Board-ID %d Daughtercard ID %d\n", get_system_type(), |
112 | (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf); | 94 | (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf); |
113 | 95 | ||
114 | /* SMBus/SPI on PSC0, Audio on PSC1 */ | 96 | /* SMBus/SPI on PSC0, Audio on PSC1 */ |
@@ -138,6 +120,8 @@ void __init board_setup(void) | |||
138 | clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT; | 120 | clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT; |
139 | __raw_writel(clksrc, (void __iomem *)SYS_CLKSRC); | 121 | __raw_writel(clksrc, (void __iomem *)SYS_CLKSRC); |
140 | wmb(); | 122 | wmb(); |
123 | |||
124 | return 0; | ||
141 | } | 125 | } |
142 | 126 | ||
143 | /******************************************************************************/ | 127 | /******************************************************************************/ |
@@ -796,7 +780,7 @@ static int __init pb1200_res_fixup(void) | |||
796 | return 0; | 780 | return 0; |
797 | } | 781 | } |
798 | 782 | ||
799 | static int __init db1200_dev_init(void) | 783 | int __init db1200_dev_setup(void) |
800 | { | 784 | { |
801 | unsigned long pfc; | 785 | unsigned long pfc; |
802 | unsigned short sw; | 786 | unsigned short sw; |
@@ -846,7 +830,7 @@ static int __init db1200_dev_init(void) | |||
846 | gpio_request(215, "otg-vbus"); | 830 | gpio_request(215, "otg-vbus"); |
847 | gpio_direction_output(215, 1); | 831 | gpio_direction_output(215, 1); |
848 | 832 | ||
849 | printk(KERN_INFO "%s device configuration:\n", board_type_str()); | 833 | printk(KERN_INFO "%s device configuration:\n", get_system_type()); |
850 | 834 | ||
851 | sw = bcsr_read(BCSR_SWITCHES); | 835 | sw = bcsr_read(BCSR_SWITCHES); |
852 | if (sw & BCSR_SWITCHES_DIP_8) { | 836 | if (sw & BCSR_SWITCHES_DIP_8) { |
@@ -922,4 +906,3 @@ static int __init db1200_dev_init(void) | |||
922 | 906 | ||
923 | return 0; | 907 | return 0; |
924 | } | 908 | } |
925 | 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 000000000000..15003eb1f840 --- /dev/null +++ b/arch/mips/alchemy/devboards/db1235.c | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | * DB1200/PB1200 / DB1550 / DB1300 board support. | ||
3 | * | ||
4 | * These 4 boards can reliably be supported in a single kernel image. | ||
5 | */ | ||
6 | |||
7 | #include <asm/mach-au1x00/au1000.h> | ||
8 | #include <asm/mach-db1x00/bcsr.h> | ||
9 | |||
10 | int __init db1200_board_setup(void); | ||
11 | int __init db1200_dev_setup(void); | ||
12 | int __init db1300_board_setup(void); | ||
13 | int __init db1300_dev_setup(void); | ||
14 | int __init db1550_board_setup(void); | ||
15 | int __init db1550_dev_setup(void); | ||
16 | int __init db1550_pci_setup(void); | ||
17 | |||
18 | static const char *board_type_str(void) | ||
19 | { | ||
20 | switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) { | ||
21 | case BCSR_WHOAMI_PB1200_DDR1: | ||
22 | case BCSR_WHOAMI_PB1200_DDR2: | ||
23 | return "PB1200"; | ||
24 | case BCSR_WHOAMI_DB1200: | ||
25 | return "DB1200"; | ||
26 | case BCSR_WHOAMI_DB1300: | ||
27 | return "DB1300"; | ||
28 | case BCSR_WHOAMI_DB1550: | ||
29 | return "DB1550"; | ||
30 | default: | ||
31 | return "(unknown)"; | ||
32 | } | ||
33 | } | ||
34 | |||
35 | const char *get_system_type(void) | ||
36 | { | ||
37 | return board_type_str(); | ||
38 | } | ||
39 | |||
40 | void __init board_setup(void) | ||
41 | { | ||
42 | int ret; | ||
43 | |||
44 | switch (alchemy_get_cputype()) { | ||
45 | case ALCHEMY_CPU_AU1550: | ||
46 | ret = db1550_board_setup(); | ||
47 | break; | ||
48 | case ALCHEMY_CPU_AU1200: | ||
49 | ret = db1200_board_setup(); | ||
50 | break; | ||
51 | case ALCHEMY_CPU_AU1300: | ||
52 | ret = db1300_board_setup(); | ||
53 | break; | ||
54 | default: | ||
55 | pr_err("unsupported CPU on board\n"); | ||
56 | ret = -ENODEV; | ||
57 | } | ||
58 | if (ret) | ||
59 | panic("cannot initialize board support\n"); | ||
60 | } | ||
61 | |||
62 | int __init db1235_arch_init(void) | ||
63 | { | ||
64 | if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1550) | ||
65 | return db1550_pci_setup(); | ||
66 | return 0; | ||
67 | } | ||
68 | arch_initcall(db1235_arch_init); | ||
69 | |||
70 | int __init db1235_dev_init(void) | ||
71 | { | ||
72 | switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) { | ||
73 | case BCSR_WHOAMI_PB1200_DDR1: | ||
74 | case BCSR_WHOAMI_PB1200_DDR2: | ||
75 | case BCSR_WHOAMI_DB1200: | ||
76 | return db1200_dev_setup(); | ||
77 | case BCSR_WHOAMI_DB1300: | ||
78 | return db1300_dev_setup(); | ||
79 | case BCSR_WHOAMI_DB1550: | ||
80 | return db1550_dev_setup(); | ||
81 | } | ||
82 | return 0; | ||
83 | } | ||
84 | device_initcall(db1235_dev_init); | ||
diff --git a/arch/mips/alchemy/devboards/db1300.c b/arch/mips/alchemy/devboards/db1300.c index c56e0246694e..cdf37cbd3d1f 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) | |||
110 | au1300_set_dbdma_gpio(1, AU1300_PIN_FG3AUX); | 110 | au1300_set_dbdma_gpio(1, AU1300_PIN_FG3AUX); |
111 | } | 111 | } |
112 | 112 | ||
113 | char *get_system_type(void) | ||
114 | { | ||
115 | return "DB1300"; | ||
116 | } | ||
117 | |||
118 | /**********************************************************************/ | 113 | /**********************************************************************/ |
119 | 114 | ||
120 | static void au1300_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, | 115 | static void au1300_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, |
@@ -701,7 +696,7 @@ static struct platform_device *db1300_dev[] __initdata = { | |||
701 | &db1300_sndi2s_dev, | 696 | &db1300_sndi2s_dev, |
702 | }; | 697 | }; |
703 | 698 | ||
704 | static int __init db1300_device_init(void) | 699 | int __init db1300_dev_setup(void) |
705 | { | 700 | { |
706 | int swapped, cpldirq; | 701 | int swapped, cpldirq; |
707 | 702 | ||
@@ -758,10 +753,9 @@ static int __init db1300_device_init(void) | |||
758 | 753 | ||
759 | return platform_add_devices(db1300_dev, ARRAY_SIZE(db1300_dev)); | 754 | return platform_add_devices(db1300_dev, ARRAY_SIZE(db1300_dev)); |
760 | } | 755 | } |
761 | device_initcall(db1300_device_init); | ||
762 | 756 | ||
763 | 757 | ||
764 | void __init board_setup(void) | 758 | int __init db1300_board_setup(void) |
765 | { | 759 | { |
766 | unsigned short whoami; | 760 | unsigned short whoami; |
767 | 761 | ||
@@ -779,4 +773,6 @@ void __init board_setup(void) | |||
779 | alchemy_uart_enable(AU1300_UART0_PHYS_ADDR); | 773 | alchemy_uart_enable(AU1300_UART0_PHYS_ADDR); |
780 | alchemy_uart_enable(AU1300_UART1_PHYS_ADDR); | 774 | alchemy_uart_enable(AU1300_UART1_PHYS_ADDR); |
781 | alchemy_uart_enable(AU1300_UART3_PHYS_ADDR); | 775 | alchemy_uart_enable(AU1300_UART3_PHYS_ADDR); |
776 | |||
777 | return 0; | ||
782 | } | 778 | } |
diff --git a/arch/mips/alchemy/devboards/db1550.c b/arch/mips/alchemy/devboards/db1550.c index 9eb79062f46e..7664beed8fa2 100644 --- a/arch/mips/alchemy/devboards/db1550.c +++ b/arch/mips/alchemy/devboards/db1550.c | |||
@@ -26,12 +26,6 @@ | |||
26 | #include <prom.h> | 26 | #include <prom.h> |
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | 28 | ||
29 | |||
30 | const char *get_system_type(void) | ||
31 | { | ||
32 | return "DB1550"; | ||
33 | } | ||
34 | |||
35 | static void __init db1550_hw_setup(void) | 29 | static void __init db1550_hw_setup(void) |
36 | { | 30 | { |
37 | void __iomem *base; | 31 | void __iomem *base; |
@@ -61,7 +55,7 @@ static void __init db1550_hw_setup(void) | |||
61 | alchemy_gpio_direction_output(202, 0); /* green led on */ | 55 | alchemy_gpio_direction_output(202, 0); /* green led on */ |
62 | } | 56 | } |
63 | 57 | ||
64 | void __init board_setup(void) | 58 | int __init db1550_board_setup(void) |
65 | { | 59 | { |
66 | unsigned short whoami; | 60 | unsigned short whoami; |
67 | 61 | ||
@@ -74,6 +68,7 @@ void __init board_setup(void) | |||
74 | (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf); | 68 | (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf); |
75 | 69 | ||
76 | db1550_hw_setup(); | 70 | db1550_hw_setup(); |
71 | return 0; | ||
77 | } | 72 | } |
78 | 73 | ||
79 | /*****************************************************************************/ | 74 | /*****************************************************************************/ |
@@ -430,13 +425,12 @@ static struct platform_device *db1550_devs[] __initdata = { | |||
430 | }; | 425 | }; |
431 | 426 | ||
432 | /* must be arch_initcall; MIPS PCI scans busses in a subsys_initcall */ | 427 | /* must be arch_initcall; MIPS PCI scans busses in a subsys_initcall */ |
433 | static int __init db1550_pci_init(void) | 428 | int __init db1550_pci_setup(void) |
434 | { | 429 | { |
435 | return platform_device_register(&db1550_pci_host_dev); | 430 | return platform_device_register(&db1550_pci_host_dev); |
436 | } | 431 | } |
437 | arch_initcall(db1550_pci_init); | ||
438 | 432 | ||
439 | static int __init db1550_dev_init(void) | 433 | int __init db1550_dev_setup(void) |
440 | { | 434 | { |
441 | int swapped; | 435 | int swapped; |
442 | 436 | ||
@@ -492,4 +486,3 @@ static int __init db1550_dev_init(void) | |||
492 | 486 | ||
493 | return platform_add_devices(db1550_devs, ARRAY_SIZE(db1550_devs)); | 487 | return platform_add_devices(db1550_devs, ARRAY_SIZE(db1550_devs)); |
494 | } | 488 | } |
495 | device_initcall(db1550_dev_init); | ||
diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c index f39042e99d0d..8df86eb94972 100644 --- a/arch/mips/alchemy/devboards/platform.c +++ b/arch/mips/alchemy/devboards/platform.c | |||
@@ -36,11 +36,10 @@ void __init prom_init(void) | |||
36 | 36 | ||
37 | void prom_putchar(unsigned char c) | 37 | void prom_putchar(unsigned char c) |
38 | { | 38 | { |
39 | #ifdef CONFIG_MIPS_DB1300 | 39 | if (alchemy_get_cputype() == ALCHEMY_CPU_AU1300) |
40 | alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c); | 40 | alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c); |
41 | #else | 41 | else |
42 | alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); | 42 | alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); |
43 | #endif | ||
44 | } | 43 | } |
45 | 44 | ||
46 | 45 | ||