diff options
author | Steve Glendinning <steve.glendinning@smsc.com> | 2009-03-20 10:16:29 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-03-20 12:26:33 -0400 |
commit | eaeed5d31d8ded02fa0a4b608f57418cc0e65b07 (patch) | |
tree | 6b00f9d1a6f912da78e9c7d0e526ff85c54f0a36 /arch/sh/boards | |
parent | 3bf509230a626d11cba0e0145f552918092f586d (diff) |
sh: add support for SMSC Polaris platform
Polaris is an SMSC reference platform with a SH7709S CPU and LAN9118
ethernet controller. This patch adds support for it.
Updated following feedback from Nobuhiro Iwamatsu.
Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Reviewed-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards')
-rw-r--r-- | arch/sh/boards/Kconfig | 7 | ||||
-rw-r--r-- | arch/sh/boards/Makefile | 1 | ||||
-rw-r--r-- | arch/sh/boards/board-polaris.c | 149 |
3 files changed, 157 insertions, 0 deletions
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig index 48c043bf45ca..dcc1af8a2cfe 100644 --- a/arch/sh/boards/Kconfig +++ b/arch/sh/boards/Kconfig | |||
@@ -261,6 +261,13 @@ config SH_CAYMAN | |||
261 | depends on CPU_SUBTYPE_SH5_101 || CPU_SUBTYPE_SH5_103 | 261 | depends on CPU_SUBTYPE_SH5_101 || CPU_SUBTYPE_SH5_103 |
262 | select SYS_SUPPORTS_PCI | 262 | select SYS_SUPPORTS_PCI |
263 | 263 | ||
264 | config SH_POLARIS | ||
265 | bool "SMSC Polaris" | ||
266 | select CPU_HAS_IPR_IRQ | ||
267 | depends on CPU_SUBTYPE_SH7709 | ||
268 | help | ||
269 | Select if configuring for an SMSC Polaris development board | ||
270 | |||
264 | endmenu | 271 | endmenu |
265 | 272 | ||
266 | source "arch/sh/boards/mach-r2d/Kconfig" | 273 | source "arch/sh/boards/mach-r2d/Kconfig" |
diff --git a/arch/sh/boards/Makefile b/arch/sh/boards/Makefile index d0daebce8b38..7baa21090231 100644 --- a/arch/sh/boards/Makefile +++ b/arch/sh/boards/Makefile | |||
@@ -8,3 +8,4 @@ obj-$(CONFIG_SH_URQUELL) += board-urquell.o | |||
8 | obj-$(CONFIG_SH_SHMIN) += board-shmin.o | 8 | obj-$(CONFIG_SH_SHMIN) += board-shmin.o |
9 | obj-$(CONFIG_SH_EDOSK7760) += board-edosk7760.o | 9 | obj-$(CONFIG_SH_EDOSK7760) += board-edosk7760.o |
10 | obj-$(CONFIG_SH_ESPT) += board-espt.o | 10 | obj-$(CONFIG_SH_ESPT) += board-espt.o |
11 | obj-$(CONFIG_SH_POLARIS) += board-polaris.o | ||
diff --git a/arch/sh/boards/board-polaris.c b/arch/sh/boards/board-polaris.c new file mode 100644 index 000000000000..62607eb51004 --- /dev/null +++ b/arch/sh/boards/board-polaris.c | |||
@@ -0,0 +1,149 @@ | |||
1 | /* | ||
2 | * June 2006 steve.glendinning@smsc.com | ||
3 | * | ||
4 | * Polaris-specific resource declaration | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #include <linux/init.h> | ||
9 | #include <linux/interrupt.h> | ||
10 | #include <linux/irq.h> | ||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/smsc911x.h> | ||
13 | #include <linux/io.h> | ||
14 | #include <asm/irq.h> | ||
15 | #include <asm/machvec.h> | ||
16 | #include <asm/heartbeat.h> | ||
17 | #include <cpu/gpio.h> | ||
18 | #include <mach-se/mach/se.h> | ||
19 | |||
20 | #define BCR2 (0xFFFFFF62) | ||
21 | #define WCR2 (0xFFFFFF66) | ||
22 | #define AREA5_WAIT_CTRL (0x1C00) | ||
23 | #define WAIT_STATES_10 (0x7) | ||
24 | |||
25 | static struct resource smsc911x_resources[] = { | ||
26 | [0] = { | ||
27 | .name = "smsc911x-memory", | ||
28 | .start = PA_EXT5, | ||
29 | .end = PA_EXT5 + 0x1fff, | ||
30 | .flags = IORESOURCE_MEM, | ||
31 | }, | ||
32 | [1] = { | ||
33 | .name = "smsc911x-irq", | ||
34 | .start = IRQ0_IRQ, | ||
35 | .end = IRQ0_IRQ, | ||
36 | .flags = IORESOURCE_IRQ, | ||
37 | }, | ||
38 | }; | ||
39 | |||
40 | static struct smsc911x_platform_config smsc911x_config = { | ||
41 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | ||
42 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, | ||
43 | .flags = SMSC911X_USE_32BIT, | ||
44 | .phy_interface = PHY_INTERFACE_MODE_MII, | ||
45 | }; | ||
46 | |||
47 | static struct platform_device smsc911x_device = { | ||
48 | .name = "smsc911x", | ||
49 | .id = 0, | ||
50 | .num_resources = ARRAY_SIZE(smsc911x_resources), | ||
51 | .resource = smsc911x_resources, | ||
52 | .dev = { | ||
53 | .platform_data = &smsc911x_config, | ||
54 | }, | ||
55 | }; | ||
56 | |||
57 | static unsigned char heartbeat_bit_pos[] = { 0, 1, 2, 3 }; | ||
58 | |||
59 | static struct heartbeat_data heartbeat_data = { | ||
60 | .bit_pos = heartbeat_bit_pos, | ||
61 | .nr_bits = ARRAY_SIZE(heartbeat_bit_pos), | ||
62 | .regsize = 8, | ||
63 | }; | ||
64 | |||
65 | static struct resource heartbeat_resources[] = { | ||
66 | [0] = { | ||
67 | .start = PORT_PCDR, | ||
68 | .end = PORT_PCDR, | ||
69 | .flags = IORESOURCE_MEM, | ||
70 | }, | ||
71 | }; | ||
72 | |||
73 | static struct platform_device heartbeat_device = { | ||
74 | .name = "heartbeat", | ||
75 | .id = -1, | ||
76 | .dev = { | ||
77 | .platform_data = &heartbeat_data, | ||
78 | }, | ||
79 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
80 | .resource = heartbeat_resources, | ||
81 | }; | ||
82 | |||
83 | static struct platform_device *polaris_devices[] __initdata = { | ||
84 | &smsc911x_device, | ||
85 | &heartbeat_device, | ||
86 | }; | ||
87 | |||
88 | static int __init polaris_initialise(void) | ||
89 | { | ||
90 | u16 wcr, bcr_mask; | ||
91 | |||
92 | printk(KERN_INFO "Configuring Polaris external bus\n"); | ||
93 | |||
94 | /* Configure area 5 with 2 wait states */ | ||
95 | wcr = ctrl_inw(WCR2); | ||
96 | wcr &= (~AREA5_WAIT_CTRL); | ||
97 | wcr |= (WAIT_STATES_10 << 10); | ||
98 | ctrl_outw(wcr, WCR2); | ||
99 | |||
100 | /* Configure area 5 for 32-bit access */ | ||
101 | bcr_mask = ctrl_inw(BCR2); | ||
102 | bcr_mask |= 1 << 10; | ||
103 | ctrl_outw(bcr_mask, BCR2); | ||
104 | |||
105 | return platform_add_devices(polaris_devices, | ||
106 | ARRAY_SIZE(polaris_devices)); | ||
107 | } | ||
108 | arch_initcall(polaris_initialise); | ||
109 | |||
110 | static struct ipr_data ipr_irq_table[] = { | ||
111 | /* External IRQs */ | ||
112 | { IRQ0_IRQ, 0, 0, 1, }, /* IRQ0 */ | ||
113 | { IRQ1_IRQ, 0, 4, 1, }, /* IRQ1 */ | ||
114 | }; | ||
115 | |||
116 | static unsigned long ipr_offsets[] = { | ||
117 | INTC_IPRC | ||
118 | }; | ||
119 | |||
120 | static struct ipr_desc ipr_irq_desc = { | ||
121 | .ipr_offsets = ipr_offsets, | ||
122 | .nr_offsets = ARRAY_SIZE(ipr_offsets), | ||
123 | |||
124 | .ipr_data = ipr_irq_table, | ||
125 | .nr_irqs = ARRAY_SIZE(ipr_irq_table), | ||
126 | .chip = { | ||
127 | .name = "sh7709-ext", | ||
128 | }, | ||
129 | }; | ||
130 | |||
131 | static void __init init_polaris_irq(void) | ||
132 | { | ||
133 | /* Disable all interrupts */ | ||
134 | ctrl_outw(0, BCR_ILCRA); | ||
135 | ctrl_outw(0, BCR_ILCRB); | ||
136 | ctrl_outw(0, BCR_ILCRC); | ||
137 | ctrl_outw(0, BCR_ILCRD); | ||
138 | ctrl_outw(0, BCR_ILCRE); | ||
139 | ctrl_outw(0, BCR_ILCRF); | ||
140 | ctrl_outw(0, BCR_ILCRG); | ||
141 | |||
142 | register_ipr_controller(&ipr_irq_desc); | ||
143 | } | ||
144 | |||
145 | static struct sh_machine_vector mv_polaris __initmv = { | ||
146 | .mv_name = "Polaris", | ||
147 | .mv_nr_irqs = 61, | ||
148 | .mv_init_irq = init_polaris_irq, | ||
149 | }; | ||