aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2011-03-08 03:00:00 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-03-17 03:52:41 -0400
commit984f6cfd21babd70302592641bd01b574e25ee83 (patch)
tree11c0b681b8281c54d09c0d38d1709ab347d1c642 /arch/sh/boards
parent1d2a1959fe534279cf37aba20b08c24c20840e52 (diff)
sh: add GETHER's platform_device in board-sh7757lcr
This patch also modifies for ETHER's platform_device. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/board-sh7757lcr.c93
1 files changed, 93 insertions, 0 deletions
diff --git a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c
index 80e502c86625..a9e33569ad38 100644
--- a/arch/sh/boards/board-sh7757lcr.c
+++ b/arch/sh/boards/board-sh7757lcr.c
@@ -47,6 +47,17 @@ static struct platform_device heartbeat_device = {
47}; 47};
48 48
49/* Fast Ethernet */ 49/* Fast Ethernet */
50#define GBECONT 0xffc10100
51#define GBECONT_RMII1 BIT(17)
52#define GBECONT_RMII0 BIT(16)
53static void sh7757_eth_set_mdio_gate(unsigned long addr)
54{
55 if ((addr & 0x00000fff) < 0x0800)
56 writel(readl(GBECONT) | GBECONT_RMII0, GBECONT);
57 else
58 writel(readl(GBECONT) | GBECONT_RMII1, GBECONT);
59}
60
50static struct resource sh_eth0_resources[] = { 61static struct resource sh_eth0_resources[] = {
51 { 62 {
52 .start = 0xfef00000, 63 .start = 0xfef00000,
@@ -62,6 +73,8 @@ static struct resource sh_eth0_resources[] = {
62static struct sh_eth_plat_data sh7757_eth0_pdata = { 73static struct sh_eth_plat_data sh7757_eth0_pdata = {
63 .phy = 1, 74 .phy = 1,
64 .edmac_endian = EDMAC_LITTLE_ENDIAN, 75 .edmac_endian = EDMAC_LITTLE_ENDIAN,
76 .register_type = SH_ETH_REG_FAST_SH4,
77 .set_mdio_gate = sh7757_eth_set_mdio_gate,
65}; 78};
66 79
67static struct platform_device sh7757_eth0_device = { 80static struct platform_device sh7757_eth0_device = {
@@ -89,6 +102,8 @@ static struct resource sh_eth1_resources[] = {
89static struct sh_eth_plat_data sh7757_eth1_pdata = { 102static struct sh_eth_plat_data sh7757_eth1_pdata = {
90 .phy = 1, 103 .phy = 1,
91 .edmac_endian = EDMAC_LITTLE_ENDIAN, 104 .edmac_endian = EDMAC_LITTLE_ENDIAN,
105 .register_type = SH_ETH_REG_FAST_SH4,
106 .set_mdio_gate = sh7757_eth_set_mdio_gate,
92}; 107};
93 108
94static struct platform_device sh7757_eth1_device = { 109static struct platform_device sh7757_eth1_device = {
@@ -101,6 +116,82 @@ static struct platform_device sh7757_eth1_device = {
101 }, 116 },
102}; 117};
103 118
119static void sh7757_eth_giga_set_mdio_gate(unsigned long addr)
120{
121 if ((addr & 0x00000fff) < 0x0800) {
122 gpio_set_value(GPIO_PTT4, 1);
123 writel(readl(GBECONT) & ~GBECONT_RMII0, GBECONT);
124 } else {
125 gpio_set_value(GPIO_PTT4, 0);
126 writel(readl(GBECONT) & ~GBECONT_RMII1, GBECONT);
127 }
128}
129
130static struct resource sh_eth_giga0_resources[] = {
131 {
132 .start = 0xfee00000,
133 .end = 0xfee007ff,
134 .flags = IORESOURCE_MEM,
135 }, {
136 /* TSU */
137 .start = 0xfee01800,
138 .end = 0xfee01fff,
139 .flags = IORESOURCE_MEM,
140 }, {
141 .start = 315,
142 .end = 315,
143 .flags = IORESOURCE_IRQ,
144 },
145};
146
147static struct sh_eth_plat_data sh7757_eth_giga0_pdata = {
148 .phy = 18,
149 .edmac_endian = EDMAC_LITTLE_ENDIAN,
150 .register_type = SH_ETH_REG_GIGABIT,
151 .set_mdio_gate = sh7757_eth_giga_set_mdio_gate,
152 .phy_interface = PHY_INTERFACE_MODE_RGMII_ID,
153};
154
155static struct platform_device sh7757_eth_giga0_device = {
156 .name = "sh-eth",
157 .resource = sh_eth_giga0_resources,
158 .id = 2,
159 .num_resources = ARRAY_SIZE(sh_eth_giga0_resources),
160 .dev = {
161 .platform_data = &sh7757_eth_giga0_pdata,
162 },
163};
164
165static struct resource sh_eth_giga1_resources[] = {
166 {
167 .start = 0xfee00800,
168 .end = 0xfee00fff,
169 .flags = IORESOURCE_MEM,
170 }, {
171 .start = 316,
172 .end = 316,
173 .flags = IORESOURCE_IRQ,
174 },
175};
176
177static struct sh_eth_plat_data sh7757_eth_giga1_pdata = {
178 .phy = 19,
179 .edmac_endian = EDMAC_LITTLE_ENDIAN,
180 .register_type = SH_ETH_REG_GIGABIT,
181 .set_mdio_gate = sh7757_eth_giga_set_mdio_gate,
182 .phy_interface = PHY_INTERFACE_MODE_RGMII_ID,
183};
184
185static struct platform_device sh7757_eth_giga1_device = {
186 .name = "sh-eth",
187 .resource = sh_eth_giga1_resources,
188 .id = 3,
189 .num_resources = ARRAY_SIZE(sh_eth_giga1_resources),
190 .dev = {
191 .platform_data = &sh7757_eth_giga1_pdata,
192 },
193};
194
104/* SH_MMCIF */ 195/* SH_MMCIF */
105static struct resource sh_mmcif_resources[] = { 196static struct resource sh_mmcif_resources[] = {
106 [0] = { 197 [0] = {
@@ -173,6 +264,8 @@ static struct platform_device *sh7757lcr_devices[] __initdata = {
173 &heartbeat_device, 264 &heartbeat_device,
174 &sh7757_eth0_device, 265 &sh7757_eth0_device,
175 &sh7757_eth1_device, 266 &sh7757_eth1_device,
267 &sh7757_eth_giga0_device,
268 &sh7757_eth_giga1_device,
176 &sh_mmcif_device, 269 &sh_mmcif_device,
177 &sdhi_device, 270 &sdhi_device,
178}; 271};