aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorJason Cooper <jason@lakedaemon.net>2012-03-14 20:52:31 -0400
committerJason Cooper <jason@lakedaemon.net>2012-03-16 00:28:42 -0400
commit6fa6b8781fbd5e6cd5e313c5e3bdd73b426d8f30 (patch)
tree3f0e8b4e7b0c6b655f5f431a43116a365c171dff /arch/arm
parent2b45e05f51a79c2818523c923dfe008b8b2f4227 (diff)
ARM: kirkwood: fdt: facilitate new boards during fdt migration
Move all dreamplug-specific code out of board-dt.c and into board-dreamplug.c. This way new boards that are added during the conversion to fdt don't clutter up board-dt.c. Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-kirkwood/Makefile1
-rw-r--r--arch/arm/mach-kirkwood/board-dreamplug.c152
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c133
-rw-r--r--arch/arm/mach-kirkwood/common.h8
4 files changed, 162 insertions, 132 deletions
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index acbc5e1db06f..e299a9576bf0 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -21,3 +21,4 @@ obj-$(CONFIG_MACH_T5325) += t5325-setup.o
21 21
22obj-$(CONFIG_CPU_IDLE) += cpuidle.o 22obj-$(CONFIG_CPU_IDLE) += cpuidle.o
23obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o 23obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
24obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
diff --git a/arch/arm/mach-kirkwood/board-dreamplug.c b/arch/arm/mach-kirkwood/board-dreamplug.c
new file mode 100644
index 000000000000..985453994dd3
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-dreamplug.c
@@ -0,0 +1,152 @@
1/*
2 * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
3 *
4 * arch/arm/mach-kirkwood/board-dreamplug.c
5 *
6 * Marvell DreamPlug Reference Board Init for drivers not converted to
7 * flattened device tree yet.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/mtd/partitions.h>
18#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h>
20#include <linux/of.h>
21#include <linux/of_address.h>
22#include <linux/of_fdt.h>
23#include <linux/of_irq.h>
24#include <linux/of_platform.h>
25#include <linux/gpio.h>
26#include <linux/leds.h>
27#include <linux/mtd/physmap.h>
28#include <linux/spi/flash.h>
29#include <linux/spi/spi.h>
30#include <linux/spi/orion_spi.h>
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
34#include <mach/kirkwood.h>
35#include <mach/bridge-regs.h>
36#include <plat/mvsdio.h>
37#include "common.h"
38#include "mpp.h"
39
40struct mtd_partition dreamplug_partitions[] = {
41 {
42 .name = "u-boot",
43 .size = SZ_512K,
44 .offset = 0,
45 },
46 {
47 .name = "u-boot env",
48 .size = SZ_64K,
49 .offset = SZ_512K + SZ_512K,
50 },
51 {
52 .name = "dtb",
53 .size = SZ_64K,
54 .offset = SZ_512K + SZ_512K + SZ_512K,
55 },
56};
57
58static const struct flash_platform_data dreamplug_spi_slave_data = {
59 .type = "mx25l1606e",
60 .name = "spi_flash",
61 .parts = dreamplug_partitions,
62 .nr_parts = ARRAY_SIZE(dreamplug_partitions),
63};
64
65static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
66 {
67 .modalias = "m25p80",
68 .platform_data = &dreamplug_spi_slave_data,
69 .irq = -1,
70 .max_speed_hz = 50000000,
71 .bus_num = 0,
72 .chip_select = 0,
73 },
74};
75
76static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
77 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
78};
79
80static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
81 .phy_addr = MV643XX_ETH_PHY_ADDR(1),
82};
83
84static struct mv_sata_platform_data dreamplug_sata_data = {
85 .n_ports = 1,
86};
87
88static struct mvsdio_platform_data dreamplug_mvsdio_data = {
89 /* unfortunately the CD signal has not been connected */
90};
91
92static struct gpio_led dreamplug_led_pins[] = {
93 {
94 .name = "dreamplug:blue:bluetooth",
95 .gpio = 47,
96 .active_low = 1,
97 },
98 {
99 .name = "dreamplug:green:wifi",
100 .gpio = 48,
101 .active_low = 1,
102 },
103 {
104 .name = "dreamplug:green:wifi_ap",
105 .gpio = 49,
106 .active_low = 1,
107 },
108};
109
110static struct gpio_led_platform_data dreamplug_led_data = {
111 .leds = dreamplug_led_pins,
112 .num_leds = ARRAY_SIZE(dreamplug_led_pins),
113};
114
115static struct platform_device dreamplug_leds = {
116 .name = "leds-gpio",
117 .id = -1,
118 .dev = {
119 .platform_data = &dreamplug_led_data,
120 }
121};
122
123static unsigned int dreamplug_mpp_config[] __initdata = {
124 MPP0_SPI_SCn,
125 MPP1_SPI_MOSI,
126 MPP2_SPI_SCK,
127 MPP3_SPI_MISO,
128 MPP47_GPIO, /* Bluetooth LED */
129 MPP48_GPIO, /* Wifi LED */
130 MPP49_GPIO, /* Wifi AP LED */
131 0
132};
133
134void __init dreamplug_init(void)
135{
136 /*
137 * Basic setup. Needs to be called early.
138 */
139 kirkwood_mpp_conf(dreamplug_mpp_config);
140
141 spi_register_board_info(dreamplug_spi_slave_info,
142 ARRAY_SIZE(dreamplug_spi_slave_info));
143 kirkwood_spi_init();
144
145 kirkwood_ehci_init();
146 kirkwood_ge00_init(&dreamplug_ge00_data);
147 kirkwood_ge01_init(&dreamplug_ge01_data);
148 kirkwood_sata_init(&dreamplug_sata_data);
149 kirkwood_sdio_init(&dreamplug_mvsdio_data);
150
151 platform_device_register(&dreamplug_leds);
152}
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 9bd35ac730b3..975ad0148652 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * arch/arm/mach-kirkwood/board-dt.c 4 * arch/arm/mach-kirkwood/board-dt.c
5 * 5 *
6 * Marvell DreamPlug Reference Board Setup 6 * Flattened Device Tree board initialization
7 * 7 *
8 * This file is licensed under the terms of the GNU General Public 8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
@@ -12,149 +12,18 @@
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/mtd/partitions.h>
17#include <linux/ata_platform.h>
18#include <linux/mv643xx_eth.h>
19#include <linux/of.h> 15#include <linux/of.h>
20#include <linux/of_address.h>
21#include <linux/of_fdt.h>
22#include <linux/of_irq.h>
23#include <linux/of_platform.h> 16#include <linux/of_platform.h>
24#include <linux/gpio.h>
25#include <linux/leds.h>
26#include <linux/mtd/physmap.h>
27#include <linux/spi/flash.h>
28#include <linux/spi/spi.h>
29#include <linux/spi/orion_spi.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 18#include <asm/mach/map.h>
33#include <mach/kirkwood.h>
34#include <mach/bridge-regs.h> 19#include <mach/bridge-regs.h>
35#include <plat/mvsdio.h>
36#include "common.h" 20#include "common.h"
37#include "mpp.h"
38 21
39static struct of_device_id kirkwood_dt_match_table[] __initdata = { 22static struct of_device_id kirkwood_dt_match_table[] __initdata = {
40 { .compatible = "simple-bus", }, 23 { .compatible = "simple-bus", },
41 { } 24 { }
42}; 25};
43 26
44struct mtd_partition dreamplug_partitions[] = {
45 {
46 .name = "u-boot",
47 .size = SZ_512K,
48 .offset = 0,
49 },
50 {
51 .name = "u-boot env",
52 .size = SZ_64K,
53 .offset = SZ_512K + SZ_512K,
54 },
55 {
56 .name = "dtb",
57 .size = SZ_64K,
58 .offset = SZ_512K + SZ_512K + SZ_512K,
59 },
60};
61
62static const struct flash_platform_data dreamplug_spi_slave_data = {
63 .type = "mx25l1606e",
64 .name = "spi_flash",
65 .parts = dreamplug_partitions,
66 .nr_parts = ARRAY_SIZE(dreamplug_partitions),
67};
68
69static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
70 {
71 .modalias = "m25p80",
72 .platform_data = &dreamplug_spi_slave_data,
73 .irq = -1,
74 .max_speed_hz = 50000000,
75 .bus_num = 0,
76 .chip_select = 0,
77 },
78};
79
80static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
81 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
82};
83
84static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
85 .phy_addr = MV643XX_ETH_PHY_ADDR(1),
86};
87
88static struct mv_sata_platform_data dreamplug_sata_data = {
89 .n_ports = 1,
90};
91
92static struct mvsdio_platform_data dreamplug_mvsdio_data = {
93 /* unfortunately the CD signal has not been connected */
94};
95
96static struct gpio_led dreamplug_led_pins[] = {
97 {
98 .name = "dreamplug:blue:bluetooth",
99 .gpio = 47,
100 .active_low = 1,
101 },
102 {
103 .name = "dreamplug:green:wifi",
104 .gpio = 48,
105 .active_low = 1,
106 },
107 {
108 .name = "dreamplug:green:wifi_ap",
109 .gpio = 49,
110 .active_low = 1,
111 },
112};
113
114static struct gpio_led_platform_data dreamplug_led_data = {
115 .leds = dreamplug_led_pins,
116 .num_leds = ARRAY_SIZE(dreamplug_led_pins),
117};
118
119static struct platform_device dreamplug_leds = {
120 .name = "leds-gpio",
121 .id = -1,
122 .dev = {
123 .platform_data = &dreamplug_led_data,
124 }
125};
126
127static unsigned int dreamplug_mpp_config[] __initdata = {
128 MPP0_SPI_SCn,
129 MPP1_SPI_MOSI,
130 MPP2_SPI_SCK,
131 MPP3_SPI_MISO,
132 MPP47_GPIO, /* Bluetooth LED */
133 MPP48_GPIO, /* Wifi LED */
134 MPP49_GPIO, /* Wifi AP LED */
135 0
136};
137
138static void __init dreamplug_init(void)
139{
140 /*
141 * Basic setup. Needs to be called early.
142 */
143 kirkwood_mpp_conf(dreamplug_mpp_config);
144
145 spi_register_board_info(dreamplug_spi_slave_info,
146 ARRAY_SIZE(dreamplug_spi_slave_info));
147 kirkwood_spi_init();
148
149 kirkwood_ehci_init();
150 kirkwood_ge00_init(&dreamplug_ge00_data);
151 kirkwood_ge01_init(&dreamplug_ge01_data);
152 kirkwood_sata_init(&dreamplug_sata_data);
153 kirkwood_sdio_init(&dreamplug_mvsdio_data);
154
155 platform_device_register(&dreamplug_leds);
156}
157
158static void __init kirkwood_dt_init(void) 27static void __init kirkwood_dt_init(void)
159{ 28{
160 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk); 29 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index c38244724fdc..473757818e02 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -51,6 +51,14 @@ void kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts, int (*dev
51void kirkwood_audio_init(void); 51void kirkwood_audio_init(void);
52void kirkwood_restart(char, const char *); 52void kirkwood_restart(char, const char *);
53 53
54/* board init functions for boards not fully converted to fdt */
55#ifdef CONFIG_MACH_DREAMPLUG_DT
56void dreamplug_init(void);
57#else
58static inline void dreamplug_init(void) {};
59#endif
60
61/* early init functions not converted to fdt yet */
54char *kirkwood_id(void); 62char *kirkwood_id(void);
55void kirkwood_l2_init(void); 63void kirkwood_l2_init(void);
56void kirkwood_rtc_init(void); 64void kirkwood_rtc_init(void);