9
0
Fork 0

dm9200: use "struct resource" instead of platform_data

drop iobase and iodata in favor of resources

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2011-07-16 18:27:41 +08:00
parent 3230114800
commit 23c7b4c4f0
6 changed files with 47 additions and 21 deletions

View File

@ -89,8 +89,6 @@ static void ek_add_device_nand(void)
*/
#if defined(CONFIG_DRIVER_NET_DM9000)
static struct dm9000_platform_data dm9000_data = {
.iobase = AT91_CHIPSELECT_2,
.iodata = AT91_CHIPSELECT_2 + 4,
.buswidth = DM9000_WIDTH_16,
.srom = 0,
};
@ -98,7 +96,11 @@ static struct dm9000_platform_data dm9000_data = {
static struct resource dm9000_resources[] = {
[0] = {
.start = AT91_CHIPSELECT_2,
.size = 8,
.size = 4,
},
[1] = {
.start = AT91_CHIPSELECT_2 + 4,
.size = 4,
},
};

View File

@ -75,16 +75,25 @@ static struct device_d nand_dev = {
* Area 2: Offset 0x304...0x307
*/
static struct dm9000_platform_data dm9000_data = {
.iobase = CS4_BASE + 0x300,
.iodata = CS4_BASE + 0x304,
.buswidth = DM9000_WIDTH_16,
.srom = 1,
};
static struct resource dm9000_resources[] = {
[0] = {
.start = CS4_BASE + 0x300,
.size = 4,
},
[1] = {
.start = CS4_BASE + 0x304,
.size = 4,
},
};
static struct device_d dm9000_dev = {
.name = "dm9000",
.map_base = CS4_BASE + 0x300,
.size = 8,
.num_resources = ARRAY_SIZE(dm9000_resources),
.resource = dm9000_resources,
.platform_data = &dm9000_data,
};

View File

@ -89,8 +89,6 @@ static void pm_add_device_nand(void)
*/
#if defined(CONFIG_DRIVER_NET_DM9000)
static struct dm9000_platform_data dm9000_data = {
.iobase = AT91_CHIPSELECT_2,
.iodata = AT91_CHIPSELECT_2 + 4,
.buswidth = DM9000_WIDTH_16,
.srom = 1,
};
@ -98,7 +96,11 @@ static struct dm9000_platform_data dm9000_data = {
static struct resource dm9000_resources[] = {
[0] = {
.start = AT91_CHIPSELECT_2,
.size = 8,
.size = 4,
},
[1] = {
.start = AT91_CHIPSELECT_2 + 4,
.size = 4,
},
};

View File

@ -55,18 +55,27 @@ static struct device_d sdram_dev = {
};
static struct dm9000_platform_data dm9000_data = {
.iobase = 0x16000000,
.iodata = 0x16000004,
.buswidth = DM9000_WIDTH_16,
.srom = 1,
};
static struct resource dm9000_resources[] = {
[0] = {
.start = 0x16000000,
.size = 4,
},
[1] = {
.start = 0x16000004,
.size = 4,
},
};
static struct device_d dm9000_dev = {
.id = -1,
.name = "dm9000",
.map_base = 0x16000000,
.size = 8,
.platform_data = &dm9000_data,
.id = -1,
.name = "dm9000",
.num_resources = ARRAY_SIZE(dm9000_resources),
.resource = dm9000_resources,
.platform_data = &dm9000_data,
};
struct gpio_led leds[] = {

View File

@ -491,12 +491,18 @@ static int dm9000_probe(struct device_d *dev)
printf("dm9000: no platform_data\n");
return -ENODEV;
}
if (dev->num_resources < 2) {
printf("dm9000: need 2 resources base and data");
return -ENODEV;
}
pdata = dev->platform_data;
priv = edev->priv;
priv->buswidth = pdata->buswidth;
priv->iodata = (void *)pdata->iodata;
priv->iobase = (void *)pdata->iobase;
priv->iodata = (void __iomem *)dev->resource[1].start;
priv->iobase = (void __iomem *)dev->resource[0].start;
priv->srom = pdata->srom;
edev->init = dm9000_init_dev;

View File

@ -7,8 +7,6 @@
#define DM9000_WIDTH_32 3
struct dm9000_platform_data {
unsigned long iobase;
unsigned long iodata;
int buswidth;
int srom;
};