mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/7] generic_memmap_ro/rw: switch to resource
@ 2011-07-29  5:52 Jean-Christophe PLAGNIOL-VILLARD
  2011-07-29  5:52 ` [PATCH 2/7] devinfo: " Jean-Christophe PLAGNIOL-VILLARD
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29  5:52 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/base/driver.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index b5166c8..3efb538 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -263,7 +263,7 @@ int generic_memmap_ro(struct cdev *cdev, void **map, int flags)
 
 	if (flags & PROT_WRITE)
 		return -EACCES;
-	*map = (void *)cdev->dev->map_base;
+	*map = dev_get_mem_region(cdev->dev, 0);
 	return 0;
 }
 
@@ -272,7 +272,8 @@ int generic_memmap_rw(struct cdev *cdev, void **map, int flags)
 	if (!cdev->dev)
 		return -EINVAL;
 
-	*map = (void *)cdev->dev->map_base;
+	*map = dev_get_mem_region(cdev->dev, 0);
+	return 0;
 	return 0;
 }
 
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 2/7] devinfo: switch to resource
  2011-07-29  5:52 [PATCH 1/7] generic_memmap_ro/rw: switch to resource Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29  5:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-07-29  5:52 ` [PATCH 3/7] dm9000: replace DM9000_WIDTH_8/16/32 by IORESOURCE_MEM_8/16/32BIT Jean-Christophe PLAGNIOL-VILLARD
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29  5:52 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/base/driver.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 3efb538..1bb74ee 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -340,6 +340,8 @@ static int do_devinfo(struct command *cmdtp, int argc, char *argv[])
 	struct device_d *dev;
 	struct driver_d *drv;
 	struct param_d *param;
+	int i;
+	struct resource *res;
 
 	if (argc == 1) {
 		printf("devices:\n");
@@ -360,9 +362,17 @@ static int do_devinfo(struct command *cmdtp, int argc, char *argv[])
 			return -1;
 		}
 
-		printf("base  : 0x%08x\nsize  : 0x%08x\ndriver: %s\n\n",
-			dev->map_base, dev->size,
-			dev->driver ? 
+		printf("resources:\n");
+		for (i = 0; i < dev->num_resources; i++) {
+			res = &dev->resource[i];
+			printf("num   : %d\n", i);
+			if (res->name)
+				printf("name  : %s\n", res->name);
+			printf("start : 0x%08x\nsize  : 0x%08x\n",
+			       res->start, res->size);
+		}
+
+		printf("driver: %s\n\n", dev->driver ?
 				dev->driver->name : "none");
 
 		if (dev->driver)
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 3/7] dm9000: replace DM9000_WIDTH_8/16/32 by IORESOURCE_MEM_8/16/32BIT
  2011-07-29  5:52 [PATCH 1/7] generic_memmap_ro/rw: switch to resource Jean-Christophe PLAGNIOL-VILLARD
  2011-07-29  5:52 ` [PATCH 2/7] devinfo: " Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29  5:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-07-29  5:52 ` [PATCH 4/7] dm9000: introduce add_dm9000_device to register dm9000 device Jean-Christophe PLAGNIOL-VILLARD
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29  5:52 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/at91sam9261ek/init.c |    2 +-
 arch/arm/boards/mini2440/mini2440.c  |    2 +-
 arch/arm/boards/pm9261/init.c        |    2 +-
 arch/arm/boards/scb9328/scb9328.c    |    2 +-
 drivers/net/dm9000.c                 |   12 ++++++------
 include/dm9000.h                     |    4 ----
 6 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/arch/arm/boards/at91sam9261ek/init.c b/arch/arm/boards/at91sam9261ek/init.c
index 4009523..812b399 100644
--- a/arch/arm/boards/at91sam9261ek/init.c
+++ b/arch/arm/boards/at91sam9261ek/init.c
@@ -89,7 +89,7 @@ static void ek_add_device_nand(void)
  */
 #if defined(CONFIG_DRIVER_NET_DM9000)
 static struct dm9000_platform_data dm9000_data = {
-	.buswidth	= DM9000_WIDTH_16,
+	.buswidth	= IORESOURCE_MEM_16BIT,
 	.srom		= 0,
 };
 
diff --git a/arch/arm/boards/mini2440/mini2440.c b/arch/arm/boards/mini2440/mini2440.c
index 2d27b00..634e035 100644
--- a/arch/arm/boards/mini2440/mini2440.c
+++ b/arch/arm/boards/mini2440/mini2440.c
@@ -63,7 +63,7 @@ static struct device_d nand_dev = {
  * Area 2: Offset 0x304...0x307
  */
 static struct dm9000_platform_data dm9000_data = {
-	.buswidth = DM9000_WIDTH_16,
+	.buswidth = IORESOURCE_MEM_16BIT,
 	.srom     = 1,
 };
 
diff --git a/arch/arm/boards/pm9261/init.c b/arch/arm/boards/pm9261/init.c
index 1059aec..fa21e24 100644
--- a/arch/arm/boards/pm9261/init.c
+++ b/arch/arm/boards/pm9261/init.c
@@ -89,7 +89,7 @@ static void pm_add_device_nand(void)
  */
 #if defined(CONFIG_DRIVER_NET_DM9000)
 static struct dm9000_platform_data dm9000_data = {
-	.buswidth	= DM9000_WIDTH_16,
+	.buswidth	= IORESOURCE_MEM_16BIT,
 	.srom		= 1,
 };
 
diff --git a/arch/arm/boards/scb9328/scb9328.c b/arch/arm/boards/scb9328/scb9328.c
index d49eaff..47aa8ce 100644
--- a/arch/arm/boards/scb9328/scb9328.c
+++ b/arch/arm/boards/scb9328/scb9328.c
@@ -34,7 +34,7 @@
 #include <led.h>
 
 static struct dm9000_platform_data dm9000_data = {
-	.buswidth = DM9000_WIDTH_16,
+	.buswidth = IORESOURCE_MEM_16BIT,
 	.srom     = 1,
 };
 
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index b867d21..691d877 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -294,16 +294,16 @@ static int dm9000_eth_send (struct eth_device *edev,
 	writeb(DM9000_MWCMD, priv->iobase);
 
 	switch (priv->buswidth) {
-	case DM9000_WIDTH_8:
+	case IORESOURCE_MEM_8BIT:
 		for (i = 0; i < length; i++)
 			writeb(data_ptr[i] & 0xff, priv->iodata);
 		break;
-	case DM9000_WIDTH_16:
+	case IORESOURCE_MEM_16BIT:
 		tmplen = (length + 1) / 2;
 		for (i = 0; i < tmplen; i++)
 			writew(((u16 *)data_ptr)[i], priv->iodata);
 		break;
-	case DM9000_WIDTH_32:
+	case IORESOURCE_MEM_32BIT:
 		tmplen = (length + 3) / 4;
 		for (i = 0; i < tmplen; i++)
 			writel(((u32 *) data_ptr)[i], priv->iodata);
@@ -371,20 +371,20 @@ static int dm9000_eth_rx (struct eth_device *edev)
 	/* Move data from DM9000 */
 	/* Read received packet from RX SRAM */
 	switch (priv->buswidth) {
-	case DM9000_WIDTH_8:
+	case IORESOURCE_MEM_8BIT:
 		RxStatus = readb(priv->iodata) + (readb(priv->iodata) << 8);
 		RxLen = readb(priv->iodata) + (readb(priv->iodata) << 8);
 		for (i = 0; i < RxLen; i++)
 			rdptr[i] = readb(priv->iodata);
 		break;
-	case DM9000_WIDTH_16:
+	case IORESOURCE_MEM_16BIT:
 		RxStatus = readw(priv->iodata);
 		RxLen = readw(priv->iodata);
 		tmplen = (RxLen + 1) / 2;
 		for (i = 0; i < tmplen; i++)
 			((u16 *) rdptr)[i] = readw(priv->iodata);
 		break;
-	case DM9000_WIDTH_32:
+	case IORESOURCE_MEM_32BIT:
 		tmpdata = readl(priv->iodata);
 		RxStatus = tmpdata;
 		RxLen = tmpdata >> 16;
diff --git a/include/dm9000.h b/include/dm9000.h
index 0991ab5..c4618f1 100644
--- a/include/dm9000.h
+++ b/include/dm9000.h
@@ -2,10 +2,6 @@
 #ifndef __DM9000_H__
 #define __DM9000_H__
 
-#define DM9000_WIDTH_8		1
-#define DM9000_WIDTH_16		2
-#define DM9000_WIDTH_32		3
-
 struct dm9000_platform_data {
 	int buswidth;
 	int srom;
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 4/7] dm9000: introduce add_dm9000_device to register dm9000 device
  2011-07-29  5:52 [PATCH 1/7] generic_memmap_ro/rw: switch to resource Jean-Christophe PLAGNIOL-VILLARD
  2011-07-29  5:52 ` [PATCH 2/7] devinfo: " Jean-Christophe PLAGNIOL-VILLARD
  2011-07-29  5:52 ` [PATCH 3/7] dm9000: replace DM9000_WIDTH_8/16/32 by IORESOURCE_MEM_8/16/32BIT Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29  5:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-07-29  5:52 ` [PATCH 5/7] resource: introduce add_usb_ehci_device to register echi device Jean-Christophe PLAGNIOL-VILLARD
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29  5:52 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/at91sam9261ek/init.c |   25 +-------------
 arch/arm/boards/mini2440/mini2440.c  |   24 +-------------
 arch/arm/boards/pm9261/init.c        |   26 ++-------------
 arch/arm/boards/scb9328/scb9328.c    |   25 +-------------
 drivers/base/resource.c              |   57 +++++++++++++++++++++++++++++++--
 drivers/net/dm9000.c                 |    3 +-
 include/dm9000.h                     |    1 -
 include/driver.h                     |   11 ++++++
 8 files changed, 75 insertions(+), 97 deletions(-)

diff --git a/arch/arm/boards/at91sam9261ek/init.c b/arch/arm/boards/at91sam9261ek/init.c
index 812b399..627202f 100644
--- a/arch/arm/boards/at91sam9261ek/init.c
+++ b/arch/arm/boards/at91sam9261ek/init.c
@@ -89,31 +89,9 @@ static void ek_add_device_nand(void)
  */
 #if defined(CONFIG_DRIVER_NET_DM9000)
 static struct dm9000_platform_data dm9000_data = {
-	.buswidth	= IORESOURCE_MEM_16BIT,
 	.srom		= 0,
 };
 
-static struct resource dm9000_resources[] = {
-	[0] = {
-		.start	= AT91_CHIPSELECT_2,
-		.size	= 4,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= AT91_CHIPSELECT_2 + 4,
-		.size	= 4,
-		.flags	= IORESOURCE_MEM,
-	},
-};
-
-static struct device_d dm9000_dev = {
-	.id		= 0,
-	.name		= "dm9000",
-	.num_resources	= ARRAY_SIZE(dm9000_resources),
-	.resource	= dm9000_resources,
-	.platform_data	= &dm9000_data,
-};
-
 /*
  * SMC timings for the DM9000.
  * Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings.
@@ -147,7 +125,8 @@ static void __init ek_add_device_dm9000(void)
 	/* Configure Interrupt pin as input, no pull-up */
 	at91_set_gpio_input(AT91_PIN_PC11, 0);
 
-	register_device(&dm9000_dev);
+	add_dm9000_device(0, AT91_CHIPSELECT_2, AT91_CHIPSELECT_2 + 4,
+			  IORESOURCE_MEM_16BIT, &dm9000_data);
 }
 #else
 static void __init ek_add_device_dm9000(void) {}
diff --git a/arch/arm/boards/mini2440/mini2440.c b/arch/arm/boards/mini2440/mini2440.c
index 634e035..dbf7503 100644
--- a/arch/arm/boards/mini2440/mini2440.c
+++ b/arch/arm/boards/mini2440/mini2440.c
@@ -63,30 +63,9 @@ static struct device_d nand_dev = {
  * Area 2: Offset 0x304...0x307
  */
 static struct dm9000_platform_data dm9000_data = {
-	.buswidth = IORESOURCE_MEM_16BIT,
 	.srom     = 1,
 };
 
-static struct resource dm9000_resources[] = {
-	[0] = {
-		.start	= CS4_BASE + 0x300,
-		.size	= 4,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= CS4_BASE + 0x304,
-		.size	= 4,
-		.flags	= IORESOURCE_MEM,
-	},
-};
-
-static struct device_d dm9000_dev = {
-	.name     = "dm9000",
-	.num_resources	= ARRAY_SIZE(dm9000_resources),
-	.resource	= dm9000_resources,
-	.platform_data = &dm9000_data,
-};
-
 static struct s3c_mci_platform_data mci_data = {
 	.caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz,
 	.voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
@@ -332,7 +311,8 @@ static int mini2440_devices_init(void)
 				   IORESOURCE_MEM_WRITEABLE);
 	armlinux_add_dram(sdram_dev);
 
-	register_device(&dm9000_dev);
+	add_dm9000_device(0, CS4_BASE + 0x300, CS4_BASE + 0x304,
+			  IORESOURCE_MEM_16BIT, &dm9000_data);
 #ifdef CONFIG_NAND
 	/* ----------- add some vital partitions -------- */
 	devfs_del_partition("self_raw");
diff --git a/arch/arm/boards/pm9261/init.c b/arch/arm/boards/pm9261/init.c
index fa21e24..783a404 100644
--- a/arch/arm/boards/pm9261/init.c
+++ b/arch/arm/boards/pm9261/init.c
@@ -89,31 +89,9 @@ static void pm_add_device_nand(void)
  */
 #if defined(CONFIG_DRIVER_NET_DM9000)
 static struct dm9000_platform_data dm9000_data = {
-	.buswidth	= IORESOURCE_MEM_16BIT,
 	.srom		= 1,
 };
 
-static struct resource dm9000_resources[] = {
-	[0] = {
-		.start	= AT91_CHIPSELECT_2,
-		.size	= 4,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= AT91_CHIPSELECT_2 + 4,
-		.size	= 4,
-		.flags	= IORESOURCE_MEM,
-	},
-};
-
-static struct device_d dm9000_dev = {
-	.id		= 0,
-	.name		= "dm9000",
-	.num_resources	= ARRAY_SIZE(dm9000_resources),
-	.resource	= dm9000_resources,
-	.platform_data	= &dm9000_data,
-};
-
 /*
  * SMC timings for the DM9000.
  * Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings.
@@ -141,7 +119,8 @@ static void __init pm_add_device_dm9000(void)
 	/* Configure chip-select 2 (DM9000) */
 	sam9_smc_configure(2, &dm9000_smc_config);
 
-	register_device(&dm9000_dev);
+	add_dm9000_device(0, AT91_CHIPSELECT_2, AT91_CHIPSELECT_2 + 4,
+			  IORESOURCE_MEM_16BIT, &dm9000_data);
 }
 #else
 static void __init ek_add_device_dm9000(void) {}
@@ -151,6 +130,7 @@ static int pm9261_devices_init(void)
 {
 	at91_add_device_sdram(64 * 1024 * 1024);
 	pm_add_device_nand();
+	pm_add_device_dm9000();
 	add_cfi_flash_device(0, AT91_CHIPSELECT_0, 4 * 1024 * 1024, 0);
 
 	devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");
diff --git a/arch/arm/boards/scb9328/scb9328.c b/arch/arm/boards/scb9328/scb9328.c
index 47aa8ce..a610275 100644
--- a/arch/arm/boards/scb9328/scb9328.c
+++ b/arch/arm/boards/scb9328/scb9328.c
@@ -34,31 +34,9 @@
 #include <led.h>
 
 static struct dm9000_platform_data dm9000_data = {
-	.buswidth = IORESOURCE_MEM_16BIT,
 	.srom     = 1,
 };
 
-static struct resource dm9000_resources[] = {
-	[0] = {
-		.start	= 0x16000000,
-		.size	= 4,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= 0x16000004,
-		.size	= 4,
-		.flags	= IORESOURCE_MEM,
-	},
-};
-
-static struct device_d dm9000_dev = {
-	.id		= -1,
-	.name		= "dm9000",
-	.num_resources	= ARRAY_SIZE(dm9000_resources),
-	.resource	= dm9000_resources,
-	.platform_data	= &dm9000_data,
-};
-
 struct gpio_led leds[] = {
 	{
 		.gpio = 32 + 21,
@@ -106,7 +84,8 @@ static int scb9328_devices_init(void)
 	sdram_dev = add_mem_device("ram0", 0x08000000, 16 * 1024 * 1024,
 				   IORESOURCE_MEM_WRITEABLE);
 	armlinux_add_dram(sdram_dev);
-	register_device(&dm9000_dev);
+	add_dm9000_device(-1, 0x16000000, 0x16000004,
+			  IORESOURCE_MEM_16BIT, &dm9000_data);
 
 	devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0");
 	devfs_add_partition("nor0", 0x40000, 0x20000, PARTITION_FIXED, "env0");
diff --git a/drivers/base/resource.c b/drivers/base/resource.c
index f0450d3..98fc68a 100644
--- a/drivers/base/resource.c
+++ b/drivers/base/resource.c
@@ -25,15 +25,25 @@
 #include <driver.h>
 #include <xfuncs.h>
 
-struct device_d *add_generic_device(const char* devname, int id, const char *resname,
-		resource_size_t start, resource_size_t size, unsigned int flags,
-		void *pdata)
+static struct device_d *alloc_device(const char* devname, int id, void *pdata)
 {
 	struct device_d *dev;
 
 	dev = xzalloc(sizeof(*dev));
 	strcpy(dev->name, devname);
 	dev->id = id;
+	dev->platform_data = pdata;
+
+	return dev;
+}
+
+struct device_d *add_generic_device(const char* devname, int id, const char *resname,
+		resource_size_t start, resource_size_t size, unsigned int flags,
+		void *pdata)
+{
+	struct device_d *dev;
+
+	dev = alloc_device(devname, id, pdata);
 	dev->resource = xzalloc(sizeof(struct resource));
 	dev->num_resources = 1;
 	if (resname)
@@ -41,10 +51,49 @@ struct device_d *add_generic_device(const char* devname, int id, const char *res
 	dev->resource[0].start = start;
 	dev->resource[0].size = size;
 	dev->resource[0].flags = flags;
-	dev->platform_data = pdata;
 
 	register_device(dev);
 
 	return dev;
 }
 EXPORT_SYMBOL(add_generic_device);
+
+#ifdef CONFIG_DRIVER_NET_DM9000
+struct device_d *add_dm9000_device(int id, resource_size_t base,
+		resource_size_t data, int flags, void *pdata)
+{
+	struct device_d *dev;
+	resource_size_t size;
+
+	dev = alloc_device("dm9000", id, pdata);
+	dev->resource = xzalloc(sizeof(struct resource) * 2);
+	dev->num_resources = 2;
+
+	switch (flags) {
+	case IORESOURCE_MEM_32BIT:
+		size = 8;
+		break;
+	case IORESOURCE_MEM_16BIT:
+		size = 4;
+		break;
+	case IORESOURCE_MEM_8BIT:
+		size = 2;
+		break;
+	default:
+		printf("dm9000: memory width flag missing\n");
+		return NULL;
+	}
+
+	dev->resource[0].start = base;
+	dev->resource[0].size = size;
+	dev->resource[0].flags = IORESOURCE_MEM | flags;
+	dev->resource[1].start = data;
+	dev->resource[1].size = size;
+	dev->resource[1].flags = IORESOURCE_MEM | flags;
+
+	register_device(dev);
+
+	return dev;
+}
+EXPORT_SYMBOL(add_dm9000_device);
+#endif
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 691d877..be14317 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -500,7 +500,8 @@ static int dm9000_probe(struct device_d *dev)
 	pdata = dev->platform_data;
 
 	priv = edev->priv;
-	priv->buswidth = pdata->buswidth;
+
+	priv->buswidth = dev->resource[0].flags & IORESOURCE_MEM_TYPE_MASK;
 	priv->iodata = dev_request_mem_region(dev, 1);
 	priv->iobase = dev_request_mem_region(dev, 0);
 	priv->srom = pdata->srom;
diff --git a/include/dm9000.h b/include/dm9000.h
index c4618f1..a9a4635 100644
--- a/include/dm9000.h
+++ b/include/dm9000.h
@@ -3,7 +3,6 @@
 #define __DM9000_H__
 
 struct dm9000_platform_data {
-	int buswidth;
 	int srom;
 };
 
diff --git a/include/driver.h b/include/driver.h
index af34803..1f45019 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -227,6 +227,17 @@ static inline struct device_d *add_cfi_flash_device(int id, resource_size_t star
 				  IORESOURCE_MEM | flags, NULL);
 }
 
+#ifdef CONFIG_DRIVER_NET_DM9000
+struct device_d *add_dm9000_device(int id, resource_size_t base,
+		resource_size_t data, int flags, void *pdata);
+#else
+static inline struct device_d *add_dm9000_device(int id, resource_size_t base,
+		resource_size_t data, int flags, void *pdata)
+{
+	return NULL;
+}
+#endif
+
 /* linear list over all available devices
  */
 extern struct list_head device_list;
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 5/7] resource: introduce add_usb_ehci_device to register echi device
  2011-07-29  5:52 [PATCH 1/7] generic_memmap_ro/rw: switch to resource Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 preceding siblings ...)
  2011-07-29  5:52 ` [PATCH 4/7] dm9000: introduce add_dm9000_device to register dm9000 device Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29  5:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-07-29  9:52   ` Sascha Hauer
  2011-07-29  5:52 ` [PATCH 6/7] omap: switch to add_generic_device Jean-Christophe PLAGNIOL-VILLARD
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29  5:52 UTC (permalink / raw)
  To: barebox

pass the hccr and hcor register base via resource

instroduce add_generic_usb_echi_device with hccr = base + 0x100 and
hcor = base + 0x140

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/chumby_falconwing/falconwing.c    |   17 +--------------
 arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c |    8 +------
 arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c |    9 +-------
 arch/arm/boards/freescale-mx25-3-stack/3stack.c   |    9 +-------
 arch/arm/boards/guf-neso/board.c                  |   10 +--------
 arch/arm/boards/omap/board-beagle.c               |   13 +----------
 arch/arm/boards/panda/board.c                     |   18 ++++++----------
 arch/arm/boards/pcm037/pcm037.c                   |   18 +---------------
 arch/arm/boards/pcm038/pcm038.c                   |    9 +-------
 arch/arm/boards/phycard-i.MX27/pca100.c           |   18 +---------------
 drivers/base/resource.c                           |   21 ++++++++++++++++++++
 drivers/usb/host/ehci-hcd.c                       |   22 +++++++++++---------
 include/driver.h                                  |   17 ++++++++++++++++
 13 files changed, 70 insertions(+), 119 deletions(-)

diff --git a/arch/arm/boards/chumby_falconwing/falconwing.c b/arch/arm/boards/chumby_falconwing/falconwing.c
index 7a5f37e..5875955 100644
--- a/arch/arm/boards/chumby_falconwing/falconwing.c
+++ b/arch/arm/boards/chumby_falconwing/falconwing.c
@@ -327,20 +327,6 @@ static int register_persistant_environment(void)
 	return devfs_add_partition("disk0.1", 0, cdev->size, DEVFS_PARTITION_FIXED, "env0");
 }
 
-static struct ehci_platform_data chumby_usb_pdata = {
-	.flags = EHCI_HAS_TT,
-	.hccr_offset = 0x100,
-	.hcor_offset = 0x140,
-};
-
-static struct device_d usb_dev = {
-	.name		= "ehci",
-	.id		= -1,
-	.map_base	= IMX_USB_BASE,
-	.size		= 0x200,
-	.platform_data	= &chumby_usb_pdata,
-};
-
 #define GPIO_USB_HUB_RESET	29
 #define GPIO_USB_HUB_POWER	26
 
@@ -353,7 +339,8 @@ static void falconwing_init_usb(void)
 	gpio_direction_output(GPIO_USB_HUB_RESET, 1);
 
 	imx_usb_phy_enable();
-	register_device(&usb_dev);
+
+	add_generic_usb_ehci_device(-1, IMX_USB_BASE, NULL);
 }
 
 static int falconwing_devices_init(void)
diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
index 6ea4a6e..47d5e12 100644
--- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
+++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
@@ -148,12 +148,6 @@ static void imx25_usb_init(void)
 	writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
 }
 
-static struct device_d usbh2_dev = {
-	.id	  = -1,
-	.name     = "ehci",
-	.map_base = IMX_OTG_BASE + 0x400,
-	.size     = 0x200,
-};
 #endif
 
 static struct fsl_usb2_platform_data usb_pdata = {
@@ -282,7 +276,7 @@ static int eukrea_cpuimx25_devices_init(void)
 
 #ifdef CONFIG_USB
 	imx25_usb_init();
-	register_device(&usbh2_dev);
+	add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
 #endif
 	register_device(&usbotg_dev);
 
diff --git a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
index d1de495..4de3c5a 100644
--- a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
+++ b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
@@ -117,13 +117,6 @@ static void imx35_usb_init(void)
 	tmp = readl(IMX_OTG_BASE + 0x5a8);
 	writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
 }
-
-static struct device_d usbh2_dev = {
-	.id	  = -1,
-	.name     = "ehci",
-	.map_base = IMX_OTG_BASE + 0x400,
-	.size     = 0x200,
-};
 #endif
 
 static struct fsl_usb2_platform_data usb_pdata = {
@@ -181,7 +174,7 @@ static int eukrea_cpuimx35_devices_init(void)
 
 #ifdef CONFIG_USB
 	imx35_usb_init();
-	register_device(&usbh2_dev);
+	add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
 #endif
 #ifdef CONFIG_USB_GADGET
 	/* Workaround ENGcm09152 */
diff --git a/arch/arm/boards/freescale-mx25-3-stack/3stack.c b/arch/arm/boards/freescale-mx25-3-stack/3stack.c
index 6d4bde5..8d9b29d 100644
--- a/arch/arm/boards/freescale-mx25-3-stack/3stack.c
+++ b/arch/arm/boards/freescale-mx25-3-stack/3stack.c
@@ -137,13 +137,6 @@ static void imx25_usb_init(void)
 	tmp = readl(IMX_OTG_BASE + 0x5a8);
 	writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
 }
-
-static struct device_d usbh2_dev = {
-	.id	  = -1,
-	.name     = "ehci",
-	.map_base = IMX_OTG_BASE + 0x400,
-	.size     = 0x200,
-};
 #endif
 
 static struct i2c_board_info i2c_devices[] = {
@@ -207,7 +200,7 @@ static int imx25_devices_init(void)
 	 * the CPLD has to be initialized.
 	 */
 	imx25_usb_init();
-	register_device(&usbh2_dev);
+	add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
 #endif
 
 	imx25_add_fec(&fec_info);
diff --git a/arch/arm/boards/guf-neso/board.c b/arch/arm/boards/guf-neso/board.c
index 4e0ac90..f3a4635 100644
--- a/arch/arm/boards/guf-neso/board.c
+++ b/arch/arm/boards/guf-neso/board.c
@@ -114,14 +114,6 @@ static struct imx_fb_platform_data neso_fb_data = {
 };
 
 #ifdef CONFIG_USB
-
-static struct device_d usbh2_dev = {
-	.id	  = -1,
-	.name     = "ehci",
-	.map_base = IMX_OTG_BASE + 0x400,
-	.size     = 0x200,
-};
-
 static void neso_usbh_init(void)
 {
 	uint32_t temp;
@@ -304,7 +296,7 @@ static int neso_devices_init(void)
 
 #ifdef CONFIG_USB
 	neso_usbh_init();
-	register_device(&usbh2_dev);
+	add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
 #endif
 
 	imx27_add_fec(&fec_info);
diff --git a/arch/arm/boards/omap/board-beagle.c b/arch/arm/boards/omap/board-beagle.c
index 107a009..adf0b94 100644
--- a/arch/arm/boards/omap/board-beagle.c
+++ b/arch/arm/boards/omap/board-beagle.c
@@ -277,16 +277,6 @@ static struct omap_hcd omap_ehci_pdata = {
 
 static struct ehci_platform_data ehci_pdata = {
 	.flags = 0,
-	.hccr_offset = 0x100,
-	.hcor_offset = 0x110,
-};
-
-static struct device_d usbh_dev = {
-	.id	  = -1,
-	.name     = "ehci",
-	.map_base = 0x48064700,
-	.size     = 4 * 1024,
-	.platform_data = &ehci_pdata,
 };
 #endif /* CONFIG_USB_EHCI_OMAP */
 
@@ -324,7 +314,8 @@ static int beagle_devices_init(void)
 
 #ifdef CONFIG_USB_EHCI_OMAP
 	if (ehci_omap_init(&omap_ehci_pdata) >= 0)
-		register_device(&usbh_dev);
+		add_usb_ehci_device(-1, 0x48064700 + 0x100,
+				    0x48064700 + 0x110, &ehci_pdata);
 #endif /* CONFIG_USB_EHCI_OMAP */
 #ifdef CONFIG_GPMC
 	/* WP is made high and WAIT1 active Low */
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index c5b1e5c..9cbc10b 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -67,18 +67,9 @@ static int panda_mmu_init(void)
 device_initcall(panda_mmu_init);
 #endif
 
+#ifdef CONFIG_USB_EHCI
 static struct ehci_platform_data ehci_pdata = {
 	.flags = 0,
-	.hccr_offset = 0x0,
-	.hcor_offset = 0x10,
-};
-
-static struct device_d usbh_dev = {
-	.id	  = -1,
-	.name     = "ehci",
-	.map_base = 0x4a064c00,
-	.size     = 4 * 1024,
-	.platform_data = &ehci_pdata,
 };
 
 static void panda_ehci_init(void)
@@ -111,8 +102,13 @@ static void panda_ehci_init(void)
 	/* enable power to hub */
 	gpio_set_value(GPIO_HUB_POWER, 1);
 
-	register_device(&usbh_dev);
+	add_usb_ehci_device(-1, 0x4a064c00,
+			    0x4a064c00 + 0x10, &ehci_pdata);
 }
+#else
+static void panda_ehci_init(void)
+{}
+#endif
 
 static void __init panda_boardrev_init(void)
 {
diff --git a/arch/arm/boards/pcm037/pcm037.c b/arch/arm/boards/pcm037/pcm037.c
index 6e20d1d..c2d0e8b 100644
--- a/arch/arm/boards/pcm037/pcm037.c
+++ b/arch/arm/boards/pcm037/pcm037.c
@@ -70,20 +70,6 @@ struct imx_nand_platform_data nand_info = {
 };
 
 #ifdef CONFIG_USB
-static struct device_d usbotg_dev = {
-	.id	  = -1,
-	.name     = "ehci",
-	.map_base = IMX_OTG_BASE,
-	.size     = 0x200,
-};
-
-static struct device_d usbh2_dev = {
-	.id	  = -1,
-	.name     = "ehci",
-	.map_base = IMX_OTG_BASE + 0x400,
-	.size     = 0x200,
-};
-
 static void pcm037_usb_init(void)
 {
 	u32 tmp;
@@ -250,8 +236,8 @@ static int imx31_devices_init(void)
 #endif
 #ifdef CONFIG_USB
 	pcm037_usb_init();
-	register_device(&usbotg_dev);
-	register_device(&usbh2_dev);
+	add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL);
+	add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
 #endif
 
 	armlinux_set_bootparams((void *)0x80000100);
diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c
index 2f87b12..02c3dba 100644
--- a/arch/arm/boards/pcm038/pcm038.c
+++ b/arch/arm/boards/pcm038/pcm038.c
@@ -109,13 +109,6 @@ static struct imx_fb_platform_data pcm038_fb_data = {
 };
 
 #ifdef CONFIG_USB
-static struct device_d usbh2_dev = {
-	.id	  = -1,
-	.name     = "ehci",
-	.map_base = IMX_OTG_BASE + 0x400,
-	.size     = 0x200,
-};
-
 static void pcm038_usbh_init(void)
 {
 	uint32_t temp;
@@ -271,7 +264,7 @@ static int pcm038_devices_init(void)
 
 #ifdef CONFIG_USB
 	pcm038_usbh_init();
-	register_device(&usbh2_dev);
+	add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
 #endif
 
 	/* Register the fec device after the PLL re-initialisation
diff --git a/arch/arm/boards/phycard-i.MX27/pca100.c b/arch/arm/boards/phycard-i.MX27/pca100.c
index 63216f5..e557d89 100644
--- a/arch/arm/boards/phycard-i.MX27/pca100.c
+++ b/arch/arm/boards/phycard-i.MX27/pca100.c
@@ -53,20 +53,6 @@ struct imx_nand_platform_data nand_info = {
 };
 
 #ifdef CONFIG_USB
-static struct device_d usbotg_dev = {
-	.id	  = -1,
-	.name     = "ehci",
-	.map_base = IMX_OTG_BASE,
-	.size     = 0x200,
-};
-
-static struct device_d usbh2_dev = {
-	.id	  = -1,
-	.name     = "ehci",
-	.map_base = IMX_OTG_BASE + 0x400,
-	.size     = 0x200,
-};
-
 static void pca100_usb_register(void)
 {
 	mdelay(10);
@@ -77,9 +63,9 @@ static void pca100_usb_register(void)
 	mdelay(10);
 
 	isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x170), 1);
-	register_device(&usbotg_dev);
+	add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL);
 	isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x570), 1);
-	register_device(&usbh2_dev);
+	add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
 }
 #endif
 
diff --git a/drivers/base/resource.c b/drivers/base/resource.c
index 98fc68a..5fc705f 100644
--- a/drivers/base/resource.c
+++ b/drivers/base/resource.c
@@ -97,3 +97,24 @@ struct device_d *add_dm9000_device(int id, resource_size_t base,
 }
 EXPORT_SYMBOL(add_dm9000_device);
 #endif
+
+#ifdef CONFIG_USB_EHCI
+struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
+		resource_size_t hcor, void *pdata)
+{
+	struct device_d *dev;
+
+	dev = alloc_device("ehci", id, pdata);
+	dev->resource = xzalloc(sizeof(struct resource) * 2);
+	dev->num_resources = 2;
+	dev->resource[0].start = hccr;
+	dev->resource[0].flags = IORESOURCE_MEM;
+	dev->resource[1].start = hcor;
+	dev->resource[1].flags = IORESOURCE_MEM;
+
+	register_device(dev);
+
+	return dev;
+}
+EXPORT_SYMBOL(add_usb_ehci_device);
+#endif
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 844dc1d..54856a3 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -900,20 +900,22 @@ static int ehci_probe(struct device_d *dev)
 	host = &ehci->host;
 	dev->priv = ehci;
 
-	if (pdata) {
+	/* default to EHCI_HAS_TT to not change behaviour of boards
+	 * with platform_data
+	 */
+	if (pdata)
 		ehci->flags = pdata->flags;
-		ehci->hccr = (void *)(dev->map_base + pdata->hccr_offset);
-		ehci->hcor = (void *)(dev->map_base + pdata->hcor_offset);
-	}
-	else {
-		/* default to EHCI_HAS_TT to not change behaviour of boards
-		 * with platform_data
-		 */
+	else
 		ehci->flags = EHCI_HAS_TT;
-		ehci->hccr = (void *)(dev->map_base + 0x100);
-		ehci->hcor = (void *)(dev->map_base + 0x140);
+
+	if (dev->num_resources < 2) {
+		printf("echi: need 2 resources base and data");
+		return -ENODEV;
 	}
 
+	ehci->hccr = dev_request_mem_region(dev, 0);
+	ehci->hcor = dev_request_mem_region(dev, 1);
+
 	host->init = ehci_init;
 	host->submit_int_msg = submit_int_msg;
 	host->submit_control_msg = submit_control_msg;
diff --git a/include/driver.h b/include/driver.h
index 1f45019..fecaecc 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -238,6 +238,23 @@ static inline struct device_d *add_dm9000_device(int id, resource_size_t base,
 }
 #endif
 
+#ifdef CONFIG_USB_EHCI
+struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
+		resource_size_t hcor, void *pdata);
+#else
+static inline struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
+		resource_size_t hcor, void *pdata)
+{
+	return NULL;
+}
+#endif
+
+static inline struct device_d *add_generic_usb_ehci_device(int id,
+		resource_size_t base, void *pdata)
+{
+	return add_usb_ehci_device(id, base + 0x100, base + 0x140, pdata);
+}
+
 /* linear list over all available devices
  */
 extern struct list_head device_list;
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 6/7] omap: switch to add_generic_device
  2011-07-29  5:52 [PATCH 1/7] generic_memmap_ro/rw: switch to resource Jean-Christophe PLAGNIOL-VILLARD
                   ` (3 preceding siblings ...)
  2011-07-29  5:52 ` [PATCH 5/7] resource: introduce add_usb_ehci_device to register echi device Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29  5:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-07-29  7:07   ` Franck JULLIEN
  2011-07-29  5:52 ` [PATCH 7/7] fb: switch to "struct resource" Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29  5:52 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/omap/board-beagle.c    |   30 ++++++------------------------
 arch/arm/boards/omap/board-sdp343x.c   |    1 -
 arch/arm/mach-omap/devices-gpmc-nand.c |   13 +++----------
 3 files changed, 9 insertions(+), 35 deletions(-)

diff --git a/arch/arm/boards/omap/board-beagle.c b/arch/arm/boards/omap/board-beagle.c
index adf0b94..8f868ad 100644
--- a/arch/arm/boards/omap/board-beagle.c
+++ b/arch/arm/boards/omap/board-beagle.c
@@ -242,14 +242,6 @@ static struct NS16550_plat serial_plat = {
 	.reg_write = omap_uart_write,
 };
 
-static struct device_d beagle_serial_device = {
-	.id = -1,
-	.name = "serial_ns16550",
-	.map_base = OMAP_UART3_BASE,
-	.size = 1024,
-	.platform_data = (void *)&serial_plat,
-};
-
 /**
  * @brief UART serial port initialization - remember to enable COM clocks in
  * arch
@@ -259,7 +251,8 @@ static struct device_d beagle_serial_device = {
 static int beagle_console_init(void)
 {
 	/* Register the serial port */
-	return register_device(&beagle_serial_device);
+	return !!add_generic_device("serial_ns16550", -1, NULL, OMAP_UART3_BASE, 1024,
+			   IORESOURCE_MEM, &serial_plat);
 }
 console_initcall(beagle_console_init);
 #endif /* CONFIG_DRIVER_SERIAL_NS16550 */
@@ -280,25 +273,12 @@ static struct ehci_platform_data ehci_pdata = {
 };
 #endif /* CONFIG_USB_EHCI_OMAP */
 
-static struct device_d i2c_dev = {
-	.id		= -1,
-	.name		= "i2c-omap",
-	.map_base	= OMAP_I2C1_BASE,
-};
-
 static struct i2c_board_info i2c_devices[] = {
 	{
 		I2C_BOARD_INFO("twl4030", 0x48),
 	},
 };
 
-static struct device_d hsmmc_dev = {
-	.id = -1,
-	.name = "omap-hsmmc",
-	.map_base = 0x4809C000,
-	.size = SZ_4K,
-};
-
 static int beagle_devices_init(void)
 {
 	struct device_d *sdram_dev;
@@ -310,7 +290,8 @@ static int beagle_devices_init(void)
 	armlinux_add_dram(sdram_dev);
 
 	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
-	register_device(&i2c_dev);
+	add_generic_device("i2c-omap", -1, NULL, 0x4809C000, SZ_4K,
+			   IORESOURCE_MEM, NULL);
 
 #ifdef CONFIG_USB_EHCI_OMAP
 	if (ehci_omap_init(&omap_ehci_pdata) >= 0)
@@ -323,7 +304,8 @@ static int beagle_devices_init(void)
 #endif
 	gpmc_generic_nand_devices_init(0, 16, OMAP_ECC_HAMMING_CODE_HW_ROMCODE);
 
-	register_device(&hsmmc_dev);
+	add_generic_device("omap-hsmmc", -1, NULL, OMAP_I2C1_BASE, 0,
+			   IORESOURCE_MEM, NULL);
 
 	armlinux_set_bootparams((void *)0x80000100);
 	armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE);
diff --git a/arch/arm/boards/omap/board-sdp343x.c b/arch/arm/boards/omap/board-sdp343x.c
index 04aa302..360766a 100644
--- a/arch/arm/boards/omap/board-sdp343x.c
+++ b/arch/arm/boards/omap/board-sdp343x.c
@@ -647,7 +647,6 @@ static int sdp3430_flash_init(void)
 static int sdp3430_devices_init(void)
 {
 	struct device_d *sdram_dev;
-	int ret;
 
 	sdram_dev = add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024,
 				   IORESOURCE_MEM_WRITEABLE);
diff --git a/arch/arm/mach-omap/devices-gpmc-nand.c b/arch/arm/mach-omap/devices-gpmc-nand.c
index c2a2b0d..bf409a7 100644
--- a/arch/arm/mach-omap/devices-gpmc-nand.c
+++ b/arch/arm/mach-omap/devices-gpmc-nand.c
@@ -70,15 +70,6 @@ static struct gpmc_nand_platform_data nand_plat = {
 	.priv = (void *)&nand_cfg,
 };
 
-/** NAND device definition */
-static struct device_d gpmc_generic_nand_nand_device = {
-	.id = -1,
-	.name = "gpmc_nand",
-	.map_base = OMAP_GPMC_BASE,
-	.size = 1024 * 4,	/* GPMC size */
-	.platform_data = (void *)&nand_plat,
-};
-
 /**
  * @brief gpmc_generic_nand_devices_init - init generic nand device
  *
@@ -99,5 +90,7 @@ int gpmc_generic_nand_devices_init(int cs, int width,
 
 	/* Configure GPMC CS before register */
 	gpmc_cs_config(nand_plat.cs, &nand_cfg);
-	return register_device(&gpmc_generic_nand_nand_device);
+
+	return !!add_generic_device("gpmc_nand", -1, NULL, OMAP_GPMC_BASE, 1024 * 4,
+			   IORESOURCE_MEM, &nand_plat);
 }
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 7/7] fb: switch to "struct resource"
  2011-07-29  5:52 [PATCH 1/7] generic_memmap_ro/rw: switch to resource Jean-Christophe PLAGNIOL-VILLARD
                   ` (4 preceding siblings ...)
  2011-07-29  5:52 ` [PATCH 6/7] omap: switch to add_generic_device Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29  5:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-07-29 10:22 ` [PATCH 1/7] generic_memmap_ro/rw: switch to resource Marc Kleine-Budde
  2011-07-29 10:57 ` Sascha Hauer
  7 siblings, 0 replies; 15+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29  5:52 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/video/fb.c  |   16 ++++++++++------
 drivers/video/s3c.c |   16 +++++++++-------
 drivers/video/stm.c |    2 +-
 3 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 85db904..0be465f 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -84,9 +84,9 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param,
 	ret = info->fbops->fb_activate_var(info);
 
 	if (!ret) {
-		dev->map_base = (unsigned long)info->screen_base;
+		dev->resource[0].start = (resource_size_t)info->screen_base;
 		info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >> 3);
-		dev->size = info->cdev.size;
+		dev->resource[0].size = info->cdev.size;
 		dev_param_set_generic(dev, param, val);
 	} else
 		info->cdev.size = 0;
@@ -107,15 +107,19 @@ int register_framebuffer(struct fb_info *info)
 	int id = get_free_deviceid("fb");
 	struct device_d *dev;
 
+	dev = &info->dev;
+
 	info->cdev.ops = &fb_ops;
 	info->cdev.name = asprintf("fb%d", id);
 	info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >> 3);
-	info->cdev.dev = &info->dev;
+	info->cdev.dev = dev;
 	info->cdev.priv = info;
-	info->cdev.dev->map_base = (unsigned long)info->screen_base;
-	info->cdev.dev->size = info->cdev.size;
+	dev->resource = xzalloc(sizeof(struct resource));
+	dev->resource[0].start = (resource_size_t)info->screen_base;
+	dev->resource[0].size = info->cdev.size;
+	dev->resource[0].flags = IORESOURCE_MEM;
+	dev->num_resources = 1;
 
-	dev = &info->dev;
 	dev->priv = info;
 	dev->id = id;
 
diff --git a/drivers/video/s3c.c b/drivers/video/s3c.c
index 3715499..d079fde 100644
--- a/drivers/video/s3c.c
+++ b/drivers/video/s3c.c
@@ -331,11 +331,12 @@ static int s3cfb_activate_var(struct fb_info *fb_info)
 static void s3cfb_info(struct device_d *hw_dev)
 {
 	uint32_t con1, addr1, addr2, addr3;
+	struct s3cfb_info *fbi = hw_dev->priv;
 
-	con1 = readl(hw_dev->map_base + LCDCON1);
-	addr1 = readl(hw_dev->map_base + LCDSADDR1);
-	addr2 = readl(hw_dev->map_base + LCDSADDR2);
-	addr3 = readl(hw_dev->map_base + LCDSADDR3);
+	con1 = readl(fbi->base + LCDCON1);
+	addr1 = readl(fbi->base + LCDSADDR1);
+	addr2 = readl(fbi->base + LCDSADDR2);
+	addr3 = readl(fbi->base + LCDSADDR3);
 
 	printf(" Video hardware info:\n");
 	printf("  Video clock is running at %u Hz\n", s3c24xx_get_hclk() / ((GET_CLKVAL(con1) + 1) * 2));
@@ -371,15 +372,16 @@ static int s3cfb_probe(struct device_d *hw_dev)
 	if (! pdata)
 		return -ENODEV;
 
-	writel(0, hw_dev->map_base + LCDCON1);
-	writel(0, hw_dev->map_base + LCDCON5); /* FIXME not 0 for some displays */
+	fbi.base = dev_request_mem_region(hw_dev, 0);
+	writel(0, fbi.base + LCDCON1);
+	writel(0, fbi.base + LCDCON5); /* FIXME not 0 for some displays */
 
 	/* just init */
 	fbi.info.priv = &fbi;
 
 	/* add runtime hardware info */
 	fbi.hw_dev = hw_dev;
-	fbi.base = (void*)hw_dev->map_base;
+	hw_dev->priv = &fbi;
 
 	/* add runtime video info */
 	fbi.info.mode_list = pdata->mode_list;
diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index ee2f026..78acad7 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -488,7 +488,7 @@ static int stmfb_probe(struct device_d *hw_dev)
 
 	/* add runtime hardware info */
 	fbi.hw_dev = hw_dev;
-	fbi.base = (void *)hw_dev->map_base;
+	fbi.base = dev_request_mem_region(hw_dev, 0);
 	fbi.pdata = pdata;
 
 	/* add runtime video info */
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 6/7] omap: switch to add_generic_device
  2011-07-29  5:52 ` [PATCH 6/7] omap: switch to add_generic_device Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29  7:07   ` Franck JULLIEN
  2011-07-29 13:36     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 15+ messages in thread
From: Franck JULLIEN @ 2011-07-29  7:07 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

Hi Jean-Christophe,

2011/7/29 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  arch/arm/boards/omap/board-beagle.c    |   30 ++++++------------------------
>  arch/arm/boards/omap/board-sdp343x.c   |    1 -
>  arch/arm/mach-omap/devices-gpmc-nand.c |   13 +++----------
>  3 files changed, 9 insertions(+), 35 deletions(-)
>
> diff --git a/arch/arm/boards/omap/board-beagle.c b/arch/arm/boards/omap/board-beagle.c
> index adf0b94..8f868ad 100644
> --- a/arch/arm/boards/omap/board-beagle.c
> +++ b/arch/arm/boards/omap/board-beagle.c
> @@ -242,14 +242,6 @@ static struct NS16550_plat serial_plat = {
>        .reg_write = omap_uart_write,
>  };
>
> -static struct device_d beagle_serial_device = {
> -       .id = -1,
> -       .name = "serial_ns16550",
> -       .map_base = OMAP_UART3_BASE,
> -       .size = 1024,
> -       .platform_data = (void *)&serial_plat,
> -};
> -
>  /**
>  * @brief UART serial port initialization - remember to enable COM clocks in
>  * arch
> @@ -259,7 +251,8 @@ static struct device_d beagle_serial_device = {
>  static int beagle_console_init(void)
>  {
>        /* Register the serial port */
> -       return register_device(&beagle_serial_device);
> +       return !!add_generic_device("serial_ns16550", -1, NULL, OMAP_UART3_BASE, 1024,

Is this a double "!" in front of add_generic_device ??

> +                          IORESOURCE_MEM, &serial_plat);
>  }
>  console_initcall(beagle_console_init);
>  #endif /* CONFIG_DRIVER_SERIAL_NS16550 */
> @@ -280,25 +273,12 @@ static struct ehci_platform_data ehci_pdata = {
>  };
>  #endif /* CONFIG_USB_EHCI_OMAP */
>
> -static struct device_d i2c_dev = {
> -       .id             = -1,
> -       .name           = "i2c-omap",
> -       .map_base       = OMAP_I2C1_BASE,
> -};
> -
>  static struct i2c_board_info i2c_devices[] = {
>        {
>                I2C_BOARD_INFO("twl4030", 0x48),
>        },
>  };
>
> -static struct device_d hsmmc_dev = {
> -       .id = -1,
> -       .name = "omap-hsmmc",
> -       .map_base = 0x4809C000,
> -       .size = SZ_4K,
> -};
> -
>  static int beagle_devices_init(void)
>  {
>        struct device_d *sdram_dev;
> @@ -310,7 +290,8 @@ static int beagle_devices_init(void)
>        armlinux_add_dram(sdram_dev);
>
>        i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
> -       register_device(&i2c_dev);
> +       add_generic_device("i2c-omap", -1, NULL, 0x4809C000, SZ_4K,
> +                          IORESOURCE_MEM, NULL);
>
>  #ifdef CONFIG_USB_EHCI_OMAP
>        if (ehci_omap_init(&omap_ehci_pdata) >= 0)
> @@ -323,7 +304,8 @@ static int beagle_devices_init(void)
>  #endif
>        gpmc_generic_nand_devices_init(0, 16, OMAP_ECC_HAMMING_CODE_HW_ROMCODE);
>
> -       register_device(&hsmmc_dev);
> +       add_generic_device("omap-hsmmc", -1, NULL, OMAP_I2C1_BASE, 0,
> +                          IORESOURCE_MEM, NULL);
>
>        armlinux_set_bootparams((void *)0x80000100);
>        armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE);
> diff --git a/arch/arm/boards/omap/board-sdp343x.c b/arch/arm/boards/omap/board-sdp343x.c
> index 04aa302..360766a 100644
> --- a/arch/arm/boards/omap/board-sdp343x.c
> +++ b/arch/arm/boards/omap/board-sdp343x.c
> @@ -647,7 +647,6 @@ static int sdp3430_flash_init(void)
>  static int sdp3430_devices_init(void)
>  {
>        struct device_d *sdram_dev;
> -       int ret;
>
>        sdram_dev = add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024,
>                                   IORESOURCE_MEM_WRITEABLE);
> diff --git a/arch/arm/mach-omap/devices-gpmc-nand.c b/arch/arm/mach-omap/devices-gpmc-nand.c
> index c2a2b0d..bf409a7 100644
> --- a/arch/arm/mach-omap/devices-gpmc-nand.c
> +++ b/arch/arm/mach-omap/devices-gpmc-nand.c
> @@ -70,15 +70,6 @@ static struct gpmc_nand_platform_data nand_plat = {
>        .priv = (void *)&nand_cfg,
>  };
>
> -/** NAND device definition */
> -static struct device_d gpmc_generic_nand_nand_device = {
> -       .id = -1,
> -       .name = "gpmc_nand",
> -       .map_base = OMAP_GPMC_BASE,
> -       .size = 1024 * 4,       /* GPMC size */
> -       .platform_data = (void *)&nand_plat,
> -};
> -
>  /**
>  * @brief gpmc_generic_nand_devices_init - init generic nand device
>  *
> @@ -99,5 +90,7 @@ int gpmc_generic_nand_devices_init(int cs, int width,
>
>        /* Configure GPMC CS before register */
>        gpmc_cs_config(nand_plat.cs, &nand_cfg);
> -       return register_device(&gpmc_generic_nand_nand_device);
> +
> +       return !!add_generic_device("gpmc_nand", -1, NULL, OMAP_GPMC_BASE, 1024 * 4,
> +                          IORESOURCE_MEM, &nand_plat);
>  }
> --
> 1.7.5.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 5/7] resource: introduce add_usb_ehci_device to register echi device
  2011-07-29  5:52 ` [PATCH 5/7] resource: introduce add_usb_ehci_device to register echi device Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29  9:52   ` Sascha Hauer
  2011-07-29 12:17     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 15+ messages in thread
From: Sascha Hauer @ 2011-07-29  9:52 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Jul 29, 2011 at 07:52:55AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> pass the hccr and hcor register base via resource
> 
> instroduce add_generic_usb_echi_device with hccr = base + 0x100 and
> hcor = base + 0x140
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---

Overall this looks better than my i.MX specific patch for ehci. I'll
drop mine.

> 
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index 844dc1d..54856a3 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -900,20 +900,22 @@ static int ehci_probe(struct device_d *dev)
>  	host = &ehci->host;
>  	dev->priv = ehci;
>  
> -	if (pdata) {
> +	/* default to EHCI_HAS_TT to not change behaviour of boards
> +	 * with platform_data
> +	 */

Maybe you can fix this comment on the way: It should be 'without
platform_data'

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/7] generic_memmap_ro/rw: switch to resource
  2011-07-29  5:52 [PATCH 1/7] generic_memmap_ro/rw: switch to resource Jean-Christophe PLAGNIOL-VILLARD
                   ` (5 preceding siblings ...)
  2011-07-29  5:52 ` [PATCH 7/7] fb: switch to "struct resource" Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 10:22 ` Marc Kleine-Budde
  2011-07-29 10:57 ` Sascha Hauer
  7 siblings, 0 replies; 15+ messages in thread
From: Marc Kleine-Budde @ 2011-07-29 10:22 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox


[-- Attachment #1.1: Type: text/plain, Size: 1235 bytes --]

On 07/29/2011 07:52 AM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  drivers/base/driver.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/base/driver.c b/drivers/base/driver.c
> index b5166c8..3efb538 100644
> --- a/drivers/base/driver.c
> +++ b/drivers/base/driver.c
> @@ -263,7 +263,7 @@ int generic_memmap_ro(struct cdev *cdev, void **map, int flags)
>  
>  	if (flags & PROT_WRITE)
>  		return -EACCES;
> -	*map = (void *)cdev->dev->map_base;
> +	*map = dev_get_mem_region(cdev->dev, 0);
>  	return 0;
>  }
>  
> @@ -272,7 +272,8 @@ int generic_memmap_rw(struct cdev *cdev, void **map, int flags)
>  	if (!cdev->dev)
>  		return -EINVAL;
>  
> -	*map = (void *)cdev->dev->map_base;
> +	*map = dev_get_mem_region(cdev->dev, 0);
> +	return 0;
>  	return 0;

one return should be enough
>  }
>  

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/7] generic_memmap_ro/rw: switch to resource
  2011-07-29  5:52 [PATCH 1/7] generic_memmap_ro/rw: switch to resource Jean-Christophe PLAGNIOL-VILLARD
                   ` (6 preceding siblings ...)
  2011-07-29 10:22 ` [PATCH 1/7] generic_memmap_ro/rw: switch to resource Marc Kleine-Budde
@ 2011-07-29 10:57 ` Sascha Hauer
  2011-07-29 13:40   ` Jean-Christophe PLAGNIOL-VILLARD
  7 siblings, 1 reply; 15+ messages in thread
From: Sascha Hauer @ 2011-07-29 10:57 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

Hi J,

Apart from the few comments this looks good and seems to work. Can
you rebase on current next? You'll notice that I alreasy introduced
a helper to register a 16550 serial device.

Thanks
 Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 5/7] resource: introduce add_usb_ehci_device to register echi device
  2011-07-29  9:52   ` Sascha Hauer
@ 2011-07-29 12:17     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 15+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 12:17 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 11:52 Fri 29 Jul     , Sascha Hauer wrote:
> On Fri, Jul 29, 2011 at 07:52:55AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > pass the hccr and hcor register base via resource
> > 
> > instroduce add_generic_usb_echi_device with hccr = base + 0x100 and
> > hcor = base + 0x140
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> 
> Overall this looks better than my i.MX specific patch for ehci. I'll
> drop mine.
> 
> > 
> > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> > index 844dc1d..54856a3 100644
> > --- a/drivers/usb/host/ehci-hcd.c
> > +++ b/drivers/usb/host/ehci-hcd.c
> > @@ -900,20 +900,22 @@ static int ehci_probe(struct device_d *dev)
> >  	host = &ehci->host;
> >  	dev->priv = ehci;
> >  
> > -	if (pdata) {
> > +	/* default to EHCI_HAS_TT to not change behaviour of boards
> > +	 * with platform_data
> > +	 */
> 
> Maybe you can fix this comment on the way: It should be 'without
> platform_data'
ok

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 6/7] omap: switch to add_generic_device
  2011-07-29  7:07   ` Franck JULLIEN
@ 2011-07-29 13:36     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 15+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 13:36 UTC (permalink / raw)
  To: Franck JULLIEN; +Cc: barebox

On 09:07 Fri 29 Jul     , Franck JULLIEN wrote:
> Hi Jean-Christophe,
> 
> 2011/7/29 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  arch/arm/boards/omap/board-beagle.c    |   30 ++++++------------------------
> >  arch/arm/boards/omap/board-sdp343x.c   |    1 -
> >  arch/arm/mach-omap/devices-gpmc-nand.c |   13 +++----------
> >  3 files changed, 9 insertions(+), 35 deletions(-)
> >
> > diff --git a/arch/arm/boards/omap/board-beagle.c b/arch/arm/boards/omap/board-beagle.c
> > index adf0b94..8f868ad 100644
> > --- a/arch/arm/boards/omap/board-beagle.c
> > +++ b/arch/arm/boards/omap/board-beagle.c
> > @@ -242,14 +242,6 @@ static struct NS16550_plat serial_plat = {
> >        .reg_write = omap_uart_write,
> >  };
> >
> > -static struct device_d beagle_serial_device = {
> > -       .id = -1,
> > -       .name = "serial_ns16550",
> > -       .map_base = OMAP_UART3_BASE,
> > -       .size = 1024,
> > -       .platform_data = (void *)&serial_plat,
> > -};
> > -
> >  /**
> >  * @brief UART serial port initialization - remember to enable COM clocks in
> >  * arch
> > @@ -259,7 +251,8 @@ static struct device_d beagle_serial_device = {
> >  static int beagle_console_init(void)
> >  {
> >        /* Register the serial port */
> > -       return register_device(&beagle_serial_device);
> > +       return !!add_generic_device("serial_ns16550", -1, NULL, OMAP_UART3_BASE, 1024,
> 
> Is this a double "!" in front of add_generic_device ??
yes 1! only

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/7] generic_memmap_ro/rw: switch to resource
  2011-07-29 10:57 ` Sascha Hauer
@ 2011-07-29 13:40   ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 15+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 13:40 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 12:57 Fri 29 Jul     , Sascha Hauer wrote:
> Hi J,
> 
> Apart from the few comments this looks good and seems to work. Can
> you rebase on current next? You'll notice that I alreasy introduced
> a helper to register a 16550 serial device.
Hi rewrite ns16550 too to drop the read and write except for x86

now we just have to have to specify the memory tipe 8/16/32 bits

and the driver manage

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/7] generic_memmap_ro/rw: switch to resource
  2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 15+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/base/driver.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index b5166c8..3efb538 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -263,7 +263,7 @@ int generic_memmap_ro(struct cdev *cdev, void **map, int flags)
 
 	if (flags & PROT_WRITE)
 		return -EACCES;
-	*map = (void *)cdev->dev->map_base;
+	*map = dev_get_mem_region(cdev->dev, 0);
 	return 0;
 }
 
@@ -272,7 +272,8 @@ int generic_memmap_rw(struct cdev *cdev, void **map, int flags)
 	if (!cdev->dev)
 		return -EINVAL;
 
-	*map = (void *)cdev->dev->map_base;
+	*map = dev_get_mem_region(cdev->dev, 0);
+	return 0;
 	return 0;
 }
 
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-07-29 16:17 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-29  5:52 [PATCH 1/7] generic_memmap_ro/rw: switch to resource Jean-Christophe PLAGNIOL-VILLARD
2011-07-29  5:52 ` [PATCH 2/7] devinfo: " Jean-Christophe PLAGNIOL-VILLARD
2011-07-29  5:52 ` [PATCH 3/7] dm9000: replace DM9000_WIDTH_8/16/32 by IORESOURCE_MEM_8/16/32BIT Jean-Christophe PLAGNIOL-VILLARD
2011-07-29  5:52 ` [PATCH 4/7] dm9000: introduce add_dm9000_device to register dm9000 device Jean-Christophe PLAGNIOL-VILLARD
2011-07-29  5:52 ` [PATCH 5/7] resource: introduce add_usb_ehci_device to register echi device Jean-Christophe PLAGNIOL-VILLARD
2011-07-29  9:52   ` Sascha Hauer
2011-07-29 12:17     ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29  5:52 ` [PATCH 6/7] omap: switch to add_generic_device Jean-Christophe PLAGNIOL-VILLARD
2011-07-29  7:07   ` Franck JULLIEN
2011-07-29 13:36     ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29  5:52 ` [PATCH 7/7] fb: switch to "struct resource" Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 10:22 ` [PATCH 1/7] generic_memmap_ro/rw: switch to resource Marc Kleine-Budde
2011-07-29 10:57 ` Sascha Hauer
2011-07-29 13:40   ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 1/7] generic_memmap_ro/rw: switch to resource Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox