From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 07/10 v2] dm9200: use "struct resource" instead of platform_data
Date: Mon, 18 Jul 2011 14:54:35 +0200 [thread overview]
Message-ID: <1310993678-7563-7-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1310993678-7563-1-git-send-email-plagnioj@jcrosoft.com>
drop iobase and iodata in favor of resources
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/at91sam9261ek/init.c | 8 +++++---
arch/arm/boards/mini2440/mini2440.c | 17 +++++++++++++----
arch/arm/boards/pm9261/init.c | 8 +++++---
arch/arm/boards/scb9328/scb9328.c | 23 ++++++++++++++++-------
drivers/net/dm9000.c | 10 ++++++++--
include/dm9000.h | 2 --
6 files changed, 47 insertions(+), 21 deletions(-)
diff --git a/arch/arm/boards/at91sam9261ek/init.c b/arch/arm/boards/at91sam9261ek/init.c
index 3def38e..4e52ab8 100644
--- a/arch/arm/boards/at91sam9261ek/init.c
+++ b/arch/arm/boards/at91sam9261ek/init.c
@@ -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,
},
};
diff --git a/arch/arm/boards/mini2440/mini2440.c b/arch/arm/boards/mini2440/mini2440.c
index dcc7c3f..b487082 100644
--- a/arch/arm/boards/mini2440/mini2440.c
+++ b/arch/arm/boards/mini2440/mini2440.c
@@ -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,
};
diff --git a/arch/arm/boards/pm9261/init.c b/arch/arm/boards/pm9261/init.c
index af92835..4811c73 100644
--- a/arch/arm/boards/pm9261/init.c
+++ b/arch/arm/boards/pm9261/init.c
@@ -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,
},
};
diff --git a/arch/arm/boards/scb9328/scb9328.c b/arch/arm/boards/scb9328/scb9328.c
index a98d9fe..69d0589 100644
--- a/arch/arm/boards/scb9328/scb9328.c
+++ b/arch/arm/boards/scb9328/scb9328.c
@@ -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[] = {
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index c8d8517..708801d 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -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;
diff --git a/include/dm9000.h b/include/dm9000.h
index b4a04b1..0991ab5 100644
--- a/include/dm9000.h
+++ b/include/dm9000.h
@@ -7,8 +7,6 @@
#define DM9000_WIDTH_32 3
struct dm9000_platform_data {
- unsigned long iobase;
- unsigned long iodata;
int buswidth;
int srom;
};
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2011-07-18 13:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-18 12:54 [PATCH 01/10 v2] device: introduce resource structure to simplify resource declaration Jean-Christophe PLAGNIOL-VILLARD
2011-07-18 12:54 ` [PATCH 02/10] at91: switch to all resource declaration to "struct resource" Jean-Christophe PLAGNIOL-VILLARD
2011-07-18 12:54 ` [PATCH 03/10] at91/serial: switch " Jean-Christophe PLAGNIOL-VILLARD
2011-07-18 12:54 ` [PATCH 04/10] macb: " Jean-Christophe PLAGNIOL-VILLARD
2011-07-18 12:54 ` [PATCH 05/10] atmel_mci: " Jean-Christophe PLAGNIOL-VILLARD
2011-07-18 12:54 ` [PATCH 06/10] atmel_nand: " Jean-Christophe PLAGNIOL-VILLARD
2011-07-18 12:54 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2011-07-18 12:54 ` [PATCH 08/10] nomadik: switch to all resource declaration " Jean-Christophe PLAGNIOL-VILLARD
2011-07-18 12:54 ` [PATCH 09/10] nomadik_nand: use "struct resource" instead of platform_data Jean-Christophe PLAGNIOL-VILLARD
2011-07-18 12:54 ` [PATCH 10/10] amba-pl011: switch to "struct resource" Jean-Christophe PLAGNIOL-VILLARD
2011-07-18 20:48 ` [PATCH 01/10 v2] device: introduce resource structure to simplify resource declaration Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1310993678-7563-7-git-send-email-plagnioj@jcrosoft.com \
--to=plagnioj@jcrosoft.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox