Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 123642
b: refs/heads/master
c: 0a38133
h: refs/heads/master
v: v3
  • Loading branch information
Catalin Marinas committed Dec 1, 2008
1 parent e4c2d10 commit b9b40da
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 38 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1bbdf637baa708a2f0f46ead56c6c618b7dad7a8
refs/heads/master: 0a3813306f432e8925ff648c84bd488b840e5185
15 changes: 15 additions & 0 deletions trunk/arch/arm/mach-realview/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,21 @@ int realview_flash_register(struct resource *res, u32 num)
return platform_device_register(&realview_flash_device);
}

static struct platform_device realview_eth_device = {
.name = "smc911x",
.id = 0,
.num_resources = 2,
};

int realview_eth_register(const char *name, struct resource *res)
{
if (name)
realview_eth_device.name = name;
realview_eth_device.resource = res;

return platform_device_register(&realview_eth_device);
}

static struct resource realview_i2c_resource = {
.start = REALVIEW_I2C_BASE,
.end = REALVIEW_I2C_BASE + SZ_4K - 1,
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/arm/mach-realview/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@ extern void __iomem *timer3_va_base;
extern void realview_leds_event(led_event_t ledevt);
extern void realview_timer_init(unsigned int timer_irq);
extern int realview_flash_register(struct resource *res, u32 num);
extern int realview_eth_register(const char *name, struct resource *res);

#endif
18 changes: 5 additions & 13 deletions trunk/arch/arm/mach-realview/realview_eb.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,34 +242,26 @@ static struct resource realview_eb_eth_resources[] = {
},
};

static struct platform_device realview_eb_eth_device = {
.id = 0,
.num_resources = ARRAY_SIZE(realview_eb_eth_resources),
.resource = realview_eb_eth_resources,
};

/*
* Detect and register the correct Ethernet device. RealView/EB rev D
* platforms use the newer SMSC LAN9118 Ethernet chip
*/
static int eth_device_register(void)
{
void __iomem *eth_addr = ioremap(REALVIEW_EB_ETH_BASE, SZ_4K);
const char *name = NULL;
u32 idrev;

if (!eth_addr)
return -ENOMEM;

idrev = readl(eth_addr + 0x50);
if ((idrev & 0xFFFF0000) == 0x01180000)
/* SMSC LAN9118 chip present */
realview_eb_eth_device.name = "smc911x";
else
/* SMSC 91C111 chip present */
realview_eb_eth_device.name = "smc91x";
if ((idrev & 0xFFFF0000) != 0x01180000)
/* SMSC LAN9118 not present, use LAN91C111 instead */
name = "smc91x";

iounmap(eth_addr);
return platform_device_register(&realview_eb_eth_device);
return realview_eth_register(name, realview_eb_eth_resources);
}

static void __init gic_init_irq(void)
Expand Down
9 changes: 1 addition & 8 deletions trunk/arch/arm/mach-realview/realview_pb1176.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,6 @@ static struct resource realview_pb1176_smsc911x_resources[] = {
},
};

static struct platform_device realview_pb1176_smsc911x_device = {
.name = "smc911x",
.id = 0,
.num_resources = ARRAY_SIZE(realview_pb1176_smsc911x_resources),
.resource = realview_pb1176_smsc911x_resources,
};

static void __init gic_init_irq(void)
{
/* ARM1176 DevChip GIC, primary */
Expand Down Expand Up @@ -268,7 +261,7 @@ static void __init realview_pb1176_init(void)
clk_register(&realview_clcd_clk);

realview_flash_register(&realview_pb1176_flash_resource, 1);
platform_device_register(&realview_pb1176_smsc911x_device);
realview_eth_register(NULL, realview_pb1176_smsc911x_resources);

for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
struct amba_device *d = amba_devs[i];
Expand Down
9 changes: 1 addition & 8 deletions trunk/arch/arm/mach-realview/realview_pb11mp.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,6 @@ static struct resource realview_pb11mp_smsc911x_resources[] = {
},
};

static struct platform_device realview_pb11mp_smsc911x_device = {
.name = "smc911x",
.id = 0,
.num_resources = ARRAY_SIZE(realview_pb11mp_smsc911x_resources),
.resource = realview_pb11mp_smsc911x_resources,
};

struct resource realview_pb11mp_cf_resources[] = {
[0] = {
.start = REALVIEW_PB11MP_CF_BASE,
Expand Down Expand Up @@ -315,7 +308,7 @@ static void __init realview_pb11mp_init(void)

realview_flash_register(realview_pb11mp_flash_resource,
ARRAY_SIZE(realview_pb11mp_flash_resource));
platform_device_register(&realview_pb11mp_smsc911x_device);
realview_eth_register(NULL, realview_pb11mp_smsc911x_resources);
platform_device_register(&realview_i2c_device);
platform_device_register(&realview_pb11mp_cf_device);

Expand Down
9 changes: 1 addition & 8 deletions trunk/arch/arm/mach-realview/realview_pba8.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,6 @@ static struct resource realview_pba8_smsc911x_resources[] = {
},
};

static struct platform_device realview_pba8_smsc911x_device = {
.name = "smc911x",
.id = 0,
.num_resources = ARRAY_SIZE(realview_pba8_smsc911x_resources),
.resource = realview_pba8_smsc911x_resources,
};

struct resource realview_pba8_cf_resources[] = {
[0] = {
.start = REALVIEW_PBA8_CF_BASE,
Expand Down Expand Up @@ -281,7 +274,7 @@ static void __init realview_pba8_init(void)

realview_flash_register(realview_pba8_flash_resource,
ARRAY_SIZE(realview_pba8_flash_resource));
platform_device_register(&realview_pba8_smsc911x_device);
realview_eth_register(NULL, realview_pba8_smsc911x_resources);
platform_device_register(&realview_i2c_device);
platform_device_register(&realview_pba8_cf_device);

Expand Down

0 comments on commit b9b40da

Please sign in to comment.