aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-04-10 14:30:45 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-10 14:30:45 -0400
commit06eb4eafbdc0796d741d139a44f1253278da8611 (patch)
treefbdb44317130c371928154c9e6903e699fe2b995 /arch/arm/mach-kirkwood
parent32ed53b83ea5ec26a4dba90e18f5e0ff6c71eb48 (diff)
parentf68e556e23d1a4176b563bcb25d8baf2c5313f91 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'arch/arm/mach-kirkwood')
-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.c151
-rw-r--r--arch/arm/mach-kirkwood/common.c11
-rw-r--r--arch/arm/mach-kirkwood/common.h15
-rw-r--r--arch/arm/mach-kirkwood/cpuidle.c72
-rw-r--r--arch/arm/mach-kirkwood/include/mach/io.h2
7 files changed, 217 insertions, 187 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 fbe6405602ed..1c672d9e6656 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,150 +12,45 @@
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 <mach/kirkwood.h> 18#include <asm/mach/map.h>
33#include <plat/mvsdio.h> 19#include <mach/bridge-regs.h>
34#include "common.h" 20#include "common.h"
35#include "mpp.h"
36 21
37static struct of_device_id kirkwood_dt_match_table[] __initdata = { 22static struct of_device_id kirkwood_dt_match_table[] __initdata = {
38 { .compatible = "simple-bus", }, 23 { .compatible = "simple-bus", },
39 { } 24 { }
40}; 25};
41 26
42struct mtd_partition dreamplug_partitions[] = { 27static void __init kirkwood_dt_init(void)
43 {
44 .name = "u-boot",
45 .size = SZ_512K,
46 .offset = 0,
47 },
48 {
49 .name = "u-boot env",
50 .size = SZ_64K,
51 .offset = SZ_512K + SZ_512K,
52 },
53 {
54 .name = "dtb",
55 .size = SZ_64K,
56 .offset = SZ_512K + SZ_512K + SZ_512K,
57 },
58};
59
60static const struct flash_platform_data dreamplug_spi_slave_data = {
61 .type = "mx25l1606e",
62 .name = "spi_flash",
63 .parts = dreamplug_partitions,
64 .nr_parts = ARRAY_SIZE(dreamplug_partitions),
65};
66
67static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
68 {
69 .modalias = "m25p80",
70 .platform_data = &dreamplug_spi_slave_data,
71 .irq = -1,
72 .max_speed_hz = 50000000,
73 .bus_num = 0,
74 .chip_select = 0,
75 },
76};
77
78static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
79 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
80};
81
82static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
83 .phy_addr = MV643XX_ETH_PHY_ADDR(1),
84};
85
86static struct mv_sata_platform_data dreamplug_sata_data = {
87 .n_ports = 1,
88};
89
90static struct mvsdio_platform_data dreamplug_mvsdio_data = {
91 /* unfortunately the CD signal has not been connected */
92};
93
94static struct gpio_led dreamplug_led_pins[] = {
95 {
96 .name = "dreamplug:blue:bluetooth",
97 .gpio = 47,
98 .active_low = 1,
99 },
100 {
101 .name = "dreamplug:green:wifi",
102 .gpio = 48,
103 .active_low = 1,
104 },
105 {
106 .name = "dreamplug:green:wifi_ap",
107 .gpio = 49,
108 .active_low = 1,
109 },
110};
111
112static struct gpio_led_platform_data dreamplug_led_data = {
113 .leds = dreamplug_led_pins,
114 .num_leds = ARRAY_SIZE(dreamplug_led_pins),
115};
116
117static struct platform_device dreamplug_leds = {
118 .name = "leds-gpio",
119 .id = -1,
120 .dev = {
121 .platform_data = &dreamplug_led_data,
122 }
123};
124
125static unsigned int dreamplug_mpp_config[] __initdata = {
126 MPP0_SPI_SCn,
127 MPP1_SPI_MOSI,
128 MPP2_SPI_SCK,
129 MPP3_SPI_MISO,
130 MPP47_GPIO, /* Bluetooth LED */
131 MPP48_GPIO, /* Wifi LED */
132 MPP49_GPIO, /* Wifi AP LED */
133 0
134};
135
136static void __init dreamplug_init(void)
137{ 28{
29 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
30
138 /* 31 /*
139 * Basic setup. Needs to be called early. 32 * Disable propagation of mbus errors to the CPU local bus,
33 * as this causes mbus errors (which can occur for example
34 * for PCI aborts) to throw CPU aborts, which we're not set
35 * up to deal with.
140 */ 36 */
141 kirkwood_mpp_conf(dreamplug_mpp_config); 37 writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
142 38
143 spi_register_board_info(dreamplug_spi_slave_info, 39 kirkwood_setup_cpu_mbus();
144 ARRAY_SIZE(dreamplug_spi_slave_info));
145 kirkwood_spi_init();
146 40
147 kirkwood_ehci_init(); 41#ifdef CONFIG_CACHE_FEROCEON_L2
148 kirkwood_ge00_init(&dreamplug_ge00_data); 42 kirkwood_l2_init();
149 kirkwood_ge01_init(&dreamplug_ge01_data); 43#endif
150 kirkwood_sata_init(&dreamplug_sata_data);
151 kirkwood_sdio_init(&dreamplug_mvsdio_data);
152 44
153 platform_device_register(&dreamplug_leds); 45 /* internal devices that every board has */
154} 46 kirkwood_wdt_init();
47 kirkwood_xor0_init();
48 kirkwood_xor1_init();
49 kirkwood_crypto_init();
155 50
156static void __init kirkwood_dt_init(void) 51#ifdef CONFIG_KEXEC
157{ 52 kexec_reinit = kirkwood_enable_pcie;
158 kirkwood_init(); 53#endif
159 54
160 if (of_machine_is_compatible("globalscale,dreamplug")) 55 if (of_machine_is_compatible("globalscale,dreamplug"))
161 dreamplug_init(); 56 dreamplug_init();
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 77d4852e19f2..a02cae881f2f 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -279,7 +279,7 @@ void __init kirkwood_crypto_init(void)
279/***************************************************************************** 279/*****************************************************************************
280 * XOR0 280 * XOR0
281 ****************************************************************************/ 281 ****************************************************************************/
282static void __init kirkwood_xor0_init(void) 282void __init kirkwood_xor0_init(void)
283{ 283{
284 kirkwood_clk_ctrl |= CGC_XOR0; 284 kirkwood_clk_ctrl |= CGC_XOR0;
285 285
@@ -291,7 +291,7 @@ static void __init kirkwood_xor0_init(void)
291/***************************************************************************** 291/*****************************************************************************
292 * XOR1 292 * XOR1
293 ****************************************************************************/ 293 ****************************************************************************/
294static void __init kirkwood_xor1_init(void) 294void __init kirkwood_xor1_init(void)
295{ 295{
296 kirkwood_clk_ctrl |= CGC_XOR1; 296 kirkwood_clk_ctrl |= CGC_XOR1;
297 297
@@ -303,7 +303,7 @@ static void __init kirkwood_xor1_init(void)
303/***************************************************************************** 303/*****************************************************************************
304 * Watchdog 304 * Watchdog
305 ****************************************************************************/ 305 ****************************************************************************/
306static void __init kirkwood_wdt_init(void) 306void __init kirkwood_wdt_init(void)
307{ 307{
308 orion_wdt_init(kirkwood_tclk); 308 orion_wdt_init(kirkwood_tclk);
309} 309}
@@ -392,7 +392,7 @@ void __init kirkwood_audio_init(void)
392/* 392/*
393 * Identify device ID and revision. 393 * Identify device ID and revision.
394 */ 394 */
395static char * __init kirkwood_id(void) 395char * __init kirkwood_id(void)
396{ 396{
397 u32 dev, rev; 397 u32 dev, rev;
398 398
@@ -435,7 +435,7 @@ static char * __init kirkwood_id(void)
435 } 435 }
436} 436}
437 437
438static void __init kirkwood_l2_init(void) 438void __init kirkwood_l2_init(void)
439{ 439{
440#ifdef CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH 440#ifdef CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH
441 writel(readl(L2_CONFIG_REG) | L2_WRITETHROUGH, L2_CONFIG_REG); 441 writel(readl(L2_CONFIG_REG) | L2_WRITETHROUGH, L2_CONFIG_REG);
@@ -450,7 +450,6 @@ void __init kirkwood_init(void)
450{ 450{
451 printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n", 451 printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n",
452 kirkwood_id(), kirkwood_tclk); 452 kirkwood_id(), kirkwood_tclk);
453 kirkwood_i2s_data.tclk = kirkwood_tclk;
454 453
455 /* 454 /*
456 * Disable propagation of mbus errors to the CPU local bus, 455 * Disable propagation of mbus errors to the CPU local bus,
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 9071a397136d..fa8e7689c436 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -51,6 +51,21 @@ 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 */
62char *kirkwood_id(void);
63void kirkwood_l2_init(void);
64void kirkwood_wdt_init(void);
65void kirkwood_xor0_init(void);
66void kirkwood_xor1_init(void);
67void kirkwood_crypto_init(void);
68
54extern int kirkwood_tclk; 69extern int kirkwood_tclk;
55extern struct sys_timer kirkwood_timer; 70extern struct sys_timer kirkwood_timer;
56 71
diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/arch/arm/mach-kirkwood/cpuidle.c
index 7088180b018b..0f1710941878 100644
--- a/arch/arm/mach-kirkwood/cpuidle.c
+++ b/arch/arm/mach-kirkwood/cpuidle.c
@@ -20,77 +20,47 @@
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/export.h> 21#include <linux/export.h>
22#include <asm/proc-fns.h> 22#include <asm/proc-fns.h>
23#include <asm/cpuidle.h>
23#include <mach/kirkwood.h> 24#include <mach/kirkwood.h>
24 25
25#define KIRKWOOD_MAX_STATES 2 26#define KIRKWOOD_MAX_STATES 2
26 27
27static struct cpuidle_driver kirkwood_idle_driver = {
28 .name = "kirkwood_idle",
29 .owner = THIS_MODULE,
30};
31
32static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
33
34/* Actual code that puts the SoC in different idle states */ 28/* Actual code that puts the SoC in different idle states */
35static int kirkwood_enter_idle(struct cpuidle_device *dev, 29static int kirkwood_enter_idle(struct cpuidle_device *dev,
36 struct cpuidle_driver *drv, 30 struct cpuidle_driver *drv,
37 int index) 31 int index)
38{ 32{
39 struct timeval before, after; 33 writel(0x7, DDR_OPERATION_BASE);
40 int idle_time; 34 cpu_do_idle();
41
42 local_irq_disable();
43 do_gettimeofday(&before);
44 if (index == 0)
45 /* Wait for interrupt state */
46 cpu_do_idle();
47 else if (index == 1) {
48 /*
49 * Following write will put DDR in self refresh.
50 * Note that we have 256 cycles before DDR puts it
51 * self in self-refresh, so the wait-for-interrupt
52 * call afterwards won't get the DDR from self refresh
53 * mode.
54 */
55 writel(0x7, DDR_OPERATION_BASE);
56 cpu_do_idle();
57 }
58 do_gettimeofday(&after);
59 local_irq_enable();
60 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
61 (after.tv_usec - before.tv_usec);
62
63 /* Update last residency */
64 dev->last_residency = idle_time;
65 35
66 return index; 36 return index;
67} 37}
68 38
39static struct cpuidle_driver kirkwood_idle_driver = {
40 .name = "kirkwood_idle",
41 .owner = THIS_MODULE,
42 .en_core_tk_irqen = 1,
43 .states[0] = ARM_CPUIDLE_WFI_STATE,
44 .states[1] = {
45 .enter = kirkwood_enter_idle,
46 .exit_latency = 10,
47 .target_residency = 100000,
48 .flags = CPUIDLE_FLAG_TIME_VALID,
49 .name = "DDR SR",
50 .desc = "WFI and DDR Self Refresh",
51 },
52 .state_count = KIRKWOOD_MAX_STATES,
53};
54
55static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
56
69/* Initialize CPU idle by registering the idle states */ 57/* Initialize CPU idle by registering the idle states */
70static int kirkwood_init_cpuidle(void) 58static int kirkwood_init_cpuidle(void)
71{ 59{
72 struct cpuidle_device *device; 60 struct cpuidle_device *device;
73 struct cpuidle_driver *driver = &kirkwood_idle_driver;
74 61
75 device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id()); 62 device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
76 device->state_count = KIRKWOOD_MAX_STATES; 63 device->state_count = KIRKWOOD_MAX_STATES;
77 driver->state_count = KIRKWOOD_MAX_STATES;
78
79 /* Wait for interrupt state */
80 driver->states[0].enter = kirkwood_enter_idle;
81 driver->states[0].exit_latency = 1;
82 driver->states[0].target_residency = 10000;
83 driver->states[0].flags = CPUIDLE_FLAG_TIME_VALID;
84 strcpy(driver->states[0].name, "WFI");
85 strcpy(driver->states[0].desc, "Wait for interrupt");
86
87 /* Wait for interrupt and DDR self refresh state */
88 driver->states[1].enter = kirkwood_enter_idle;
89 driver->states[1].exit_latency = 10;
90 driver->states[1].target_residency = 10000;
91 driver->states[1].flags = CPUIDLE_FLAG_TIME_VALID;
92 strcpy(driver->states[1].name, "DDR SR");
93 strcpy(driver->states[1].desc, "WFI and DDR Self Refresh");
94 64
95 cpuidle_register_driver(&kirkwood_idle_driver); 65 cpuidle_register_driver(&kirkwood_idle_driver);
96 if (cpuidle_register_device(device)) { 66 if (cpuidle_register_device(device)) {
diff --git a/arch/arm/mach-kirkwood/include/mach/io.h b/arch/arm/mach-kirkwood/include/mach/io.h
index 49dd0cb5e166..5d0ab61700d2 100644
--- a/arch/arm/mach-kirkwood/include/mach/io.h
+++ b/arch/arm/mach-kirkwood/include/mach/io.h
@@ -20,7 +20,5 @@ static inline void __iomem *__io(unsigned long addr)
20} 20}
21 21
22#define __io(a) __io(a) 22#define __io(a) __io(a)
23#define __mem_pci(a) (a)
24
25 23
26#endif 24#endif