Skip to content

Commit 06a64f9

Browse files
Sergei Shtylyovdavem330
authored andcommitted
SH7619: fix Ether support
The 'sh_eth' driver's probe will crash as the platform code is hopelessly behind the platform data -- it passes PHY ID instead of 'struct sh_eth_plat_data *'. Strangely, both commit d88a3ea (SH7619 add ethernet controler support) that added the platform code and commit 71557a3 ([netdrvr] sh_eth: Add SH7619 support) were done in about the same time, yet the latter one added 'struct sh_eth_plat_data' and the platform code didn't ever get updated... Add the proper platform data and fix off-by-one memory resource end error, while at it... Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ea857f2 commit 06a64f9

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎arch/sh/kernel/cpu/sh2/setup-sh7619.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/init.h>
1313
#include <linux/serial.h>
1414
#include <linux/serial_sci.h>
15+
#include <linux/sh_eth.h>
1516
#include <linux/sh_timer.h>
1617
#include <linux/io.h>
1718

@@ -110,10 +111,17 @@ static struct platform_device scif2_device = {
110111
},
111112
};
112113

114+
static struct sh_eth_plat_data eth_platform_data = {
115+
.phy = 1,
116+
.edmac_endian = EDMAC_LITTLE_ENDIAN,
117+
.register_type = SH_ETH_REG_FAST_SH3_SH2,
118+
.phy_interace = PHY_INTERFACE_MODE_MII,
119+
};
120+
113121
static struct resource eth_resources[] = {
114122
[0] = {
115123
.start = 0xfb000000,
116-
.end = 0xfb0001c8,
124+
.end = 0xfb0001c7,
117125
.flags = IORESOURCE_MEM,
118126
},
119127
[1] = {
@@ -127,7 +135,7 @@ static struct platform_device eth_device = {
127135
.name = "sh7619-ether",
128136
.id = -1,
129137
.dev = {
130-
.platform_data = (void *)1,
138+
.platform_data = &eth_platform_data,
131139
},
132140
.num_resources = ARRAY_SIZE(eth_resources),
133141
.resource = eth_resources,

0 commit comments

Comments
 (0)