Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 251833
b: refs/heads/master
c: 21b4273
h: refs/heads/master
i:
  251831: 2f8e277
v: v3
  • Loading branch information
Mike Rapoport authored and Tony Lindgren committed Apr 20, 2011
1 parent 6333053 commit e629a20
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 428 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: f0949f73a75093fb86d6554101bd79046633a297
refs/heads/master: 21b42731e6ab1ccbbe9ad1b639c5d78eecad8432
84 changes: 13 additions & 71 deletions trunk/arch/arm/mach-omap2/board-cm-t35.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,86 +66,28 @@

#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
#include <linux/smsc911x.h>
#include <plat/gpmc-smsc911x.h>

static struct smsc911x_platform_config cm_t35_smsc911x_config = {
.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
.irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
.flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
.phy_interface = PHY_INTERFACE_MODE_MII,
};

static struct resource cm_t35_smsc911x_resources[] = {
{
.flags = IORESOURCE_MEM,
},
{
.start = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
.end = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
},
};

static struct platform_device cm_t35_smsc911x_device = {
.name = "smsc911x",
static struct omap_smsc911x_platform_data cm_t35_smsc911x_cfg = {
.id = 0,
.num_resources = ARRAY_SIZE(cm_t35_smsc911x_resources),
.resource = cm_t35_smsc911x_resources,
.dev = {
.platform_data = &cm_t35_smsc911x_config,
},
};

static struct resource sb_t35_smsc911x_resources[] = {
{
.flags = IORESOURCE_MEM,
},
{
.start = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
.end = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
},
.cs = CM_T35_SMSC911X_CS,
.gpio_irq = CM_T35_SMSC911X_GPIO,
.gpio_reset = -EINVAL,
.flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
};

static struct platform_device sb_t35_smsc911x_device = {
.name = "smsc911x",
static struct omap_smsc911x_platform_data sb_t35_smsc911x_cfg = {
.id = 1,
.num_resources = ARRAY_SIZE(sb_t35_smsc911x_resources),
.resource = sb_t35_smsc911x_resources,
.dev = {
.platform_data = &cm_t35_smsc911x_config,
},
.cs = SB_T35_SMSC911X_CS,
.gpio_irq = SB_T35_SMSC911X_GPIO,
.gpio_reset = -EINVAL,
.flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
};

static void __init cm_t35_init_smsc911x(struct platform_device *dev,
int cs, int irq_gpio)
{
unsigned long cs_mem_base;

if (gpmc_cs_request(cs, SZ_16M, &cs_mem_base) < 0) {
pr_err("CM-T35: Failed request for GPMC mem for smsc911x\n");
return;
}

dev->resource[0].start = cs_mem_base + 0x0;
dev->resource[0].end = cs_mem_base + 0xff;

if ((gpio_request(irq_gpio, "ETH IRQ") == 0) &&
(gpio_direction_input(irq_gpio) == 0)) {
gpio_export(irq_gpio, 0);
} else {
pr_err("CM-T35: could not obtain gpio for SMSC911X IRQ\n");
return;
}

platform_device_register(dev);
}

static void __init cm_t35_init_ethernet(void)
{
cm_t35_init_smsc911x(&cm_t35_smsc911x_device,
CM_T35_SMSC911X_CS, CM_T35_SMSC911X_GPIO);
cm_t35_init_smsc911x(&sb_t35_smsc911x_device,
SB_T35_SMSC911X_CS, SB_T35_SMSC911X_GPIO);
gpmc_smsc911x_init(&cm_t35_smsc911x_cfg);
gpmc_smsc911x_init(&sb_t35_smsc911x_cfg);
}
#else
static inline void __init cm_t35_init_ethernet(void) { return; }
Expand Down
53 changes: 7 additions & 46 deletions trunk/arch/arm/mach-omap2/board-igep0020.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,57 +192,18 @@ static void __init igep2_flash_init(void) {}
#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)

#include <linux/smsc911x.h>
#include <plat/gpmc-smsc911x.h>

static struct smsc911x_platform_config igep2_smsc911x_config = {
.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
.irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
.flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS ,
.phy_interface = PHY_INTERFACE_MODE_MII,
};

static struct resource igep2_smsc911x_resources[] = {
{
.flags = IORESOURCE_MEM,
},
{
.start = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
.end = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
},
};

static struct platform_device igep2_smsc911x_device = {
.name = "smsc911x",
.id = 0,
.num_resources = ARRAY_SIZE(igep2_smsc911x_resources),
.resource = igep2_smsc911x_resources,
.dev = {
.platform_data = &igep2_smsc911x_config,
},
static struct omap_smsc911x_platform_data smsc911x_cfg = {
.cs = IGEP2_SMSC911X_CS,
.gpio_irq = IGEP2_SMSC911X_GPIO,
.gpio_reset = -EINVAL,
.flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
};

static inline void __init igep2_init_smsc911x(void)
{
unsigned long cs_mem_base;

if (gpmc_cs_request(IGEP2_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
pr_err("IGEP v2: Failed request for GPMC mem for smsc911x\n");
gpmc_cs_free(IGEP2_SMSC911X_CS);
return;
}

igep2_smsc911x_resources[0].start = cs_mem_base + 0x0;
igep2_smsc911x_resources[0].end = cs_mem_base + 0xff;

if ((gpio_request(IGEP2_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
(gpio_direction_input(IGEP2_SMSC911X_GPIO) == 0)) {
gpio_export(IGEP2_SMSC911X_GPIO, 0);
} else {
pr_err("IGEP v2: Could not obtain gpio for for SMSC911X IRQ\n");
return;
}

platform_device_register(&igep2_smsc911x_device);
gpmc_smsc911x_init(&smsc911x_cfg);
}

#else
Expand Down
65 changes: 9 additions & 56 deletions trunk/arch/arm/mach-omap2/board-ldp.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

#include <asm/delay.h>
#include <plat/usb.h>
#include <plat/gpmc-smsc911x.h>

#include "board-flash.h"
#include "mux.h"
Expand All @@ -54,36 +55,6 @@
#define DEBUG_BASE 0x08000000
#define LDP_ETHR_START DEBUG_BASE

static struct resource ldp_smsc911x_resources[] = {
[0] = {
.start = LDP_ETHR_START,
.end = LDP_ETHR_START + SZ_4K,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 0,
.end = 0,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
},
};

static struct smsc911x_platform_config ldp_smsc911x_config = {
.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
.irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
.flags = SMSC911X_USE_32BIT,
.phy_interface = PHY_INTERFACE_MODE_MII,
};

static struct platform_device ldp_smsc911x_device = {
.name = "smsc911x",
.id = -1,
.num_resources = ARRAY_SIZE(ldp_smsc911x_resources),
.resource = ldp_smsc911x_resources,
.dev = {
.platform_data = &ldp_smsc911x_config,
},
};

static uint32_t board_keymap[] = {
KEY(0, 0, KEY_1),
KEY(1, 0, KEY_2),
Expand Down Expand Up @@ -246,33 +217,16 @@ static struct spi_board_info ldp_spi_board_info[] __initdata = {
},
};

static struct omap_smsc911x_platform_data smsc911x_cfg = {
.cs = LDP_SMSC911X_CS,
.gpio_irq = LDP_SMSC911X_GPIO,
.gpio_reset = -EINVAL,
.flags = SMSC911X_USE_32BIT,
};

static inline void __init ldp_init_smsc911x(void)
{
int eth_cs;
unsigned long cs_mem_base;
int eth_gpio = 0;

eth_cs = LDP_SMSC911X_CS;

if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n");
return;
}

ldp_smsc911x_resources[0].start = cs_mem_base + 0x0;
ldp_smsc911x_resources[0].end = cs_mem_base + 0xff;
udelay(100);

eth_gpio = LDP_SMSC911X_GPIO;

ldp_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);

if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
eth_gpio);
return;
}
gpio_direction_input(eth_gpio);
gpmc_smsc911x_init(&smsc911x_cfg);
}

static struct platform_device ldp_lcd_device = {
Expand Down Expand Up @@ -389,7 +343,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
};

static struct platform_device *ldp_devices[] __initdata = {
&ldp_smsc911x_device,
&ldp_lcd_device,
&ldp_gpio_keys_device,
};
Expand Down
71 changes: 11 additions & 60 deletions trunk/arch/arm/mach-omap2/board-omap3evm.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,49 +101,20 @@ static void __init omap3_evm_get_revision(void)
}

#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
static struct resource omap3evm_smsc911x_resources[] = {
[0] = {
.start = OMAP3EVM_ETHR_START,
.end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1),
.flags = IORESOURCE_MEM,
},
[1] = {
.start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
.end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
.flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW),
},
};
#include <plat/gpmc-smsc911x.h>

static struct smsc911x_platform_config smsc911x_config = {
.phy_interface = PHY_INTERFACE_MODE_MII,
.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
.irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
.flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS),
};

static struct platform_device omap3evm_smsc911x_device = {
.name = "smsc911x",
.id = -1,
.num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources),
.resource = &omap3evm_smsc911x_resources[0],
.dev = {
.platform_data = &smsc911x_config,
},
static struct omap_smsc911x_platform_data smsc911x_cfg = {
.cs = OMAP3EVM_SMSC911X_CS,
.gpio_irq = OMAP3EVM_ETHR_GPIO_IRQ,
.gpio_reset = -EINVAL,
.flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
};

static inline void __init omap3evm_init_smsc911x(void)
{
int eth_cs, eth_rst;
struct clk *l3ck;
unsigned int rate;

if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1)
eth_rst = OMAP3EVM_GEN1_ETHR_GPIO_RST;
else
eth_rst = OMAP3EVM_GEN2_ETHR_GPIO_RST;

eth_cs = OMAP3EVM_SMSC911X_CS;

l3ck = clk_get(NULL, "l3_ck");
if (IS_ERR(l3ck))
rate = 100000000;
Expand All @@ -152,33 +123,13 @@ static inline void __init omap3evm_init_smsc911x(void)

/* Configure ethernet controller reset gpio */
if (cpu_is_omap3430()) {
if (gpio_request(eth_rst, "SMSC911x gpio") < 0) {
pr_err(KERN_ERR "Failed to request %d for smsc911x\n",
eth_rst);
return;
}

if (gpio_direction_output(eth_rst, 1) < 0) {
pr_err(KERN_ERR "Failed to set direction of %d for" \
" smsc911x\n", eth_rst);
return;
}
/* reset pulse to ethernet controller*/
usleep_range(150, 220);
gpio_set_value(eth_rst, 0);
usleep_range(150, 220);
gpio_set_value(eth_rst, 1);
usleep_range(1, 2);
}

if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) {
printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
OMAP3EVM_ETHR_GPIO_IRQ);
return;
if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1)
smsc911x_cfg.gpio_reset = OMAP3EVM_GEN1_ETHR_GPIO_RST;
else
smsc911x_cfg.gpio_reset = OMAP3EVM_GEN2_ETHR_GPIO_RST;
}

gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ);
platform_device_register(&omap3evm_smsc911x_device);
gpmc_smsc911x_init(&smsc911x_cfg);
}

#else
Expand Down
Loading

0 comments on commit e629a20

Please sign in to comment.