Skip to contentSkip to conversation

more device rework

PATCH In review Jean-Christophe PLAGNIOL-VILLARD 2 participants 16 messages Jul 24, 2011 – Jul 26, 2011

Subsystems (19)
lore
Share & tools
lore
#0 lore raw

cover more device rework

Hi,

the folling patch series continue to switch the device/driver

this reduce the code of 744 lignes and 188 bytes since v2011.07.0

this superseed the previous patch has some errors was found

The following changes since commit 522af7074a333508d8b73c25abd1d051d8672e5c:

armlinux: mem tag switch to "struct resource" (2011-07-20 08:25:45 +0200)

are available in the git repository at:
git://uboot.jcrosoft.org/barebox.git resource

Jean-Christophe PLAGNIOL-VILLARD (12):
drivers/bus: move to drivers/base
drivers: move resource generic management to driver/base/resource.c
resource: introduce add_generic_device to register simple device
at91: switch to add_generic_device
imx/devices: switch to add_generic_device
resource: introduce add_cfi_device to register simple cfi device
versatile: switch to add_generic_device
nomadik: switch to add_generic_device
mci: switch to "struct resource"
ata/bios: convert to struct resource
i2c: convert to struct resource
nand: convert to struct resource

 arch/arm/boards/at91rm9200ek/init.c               |   17 +--
 arch/arm/boards/at91sam9263ek/init.c              |   17 +--
 arch/arm/boards/edb93xx/edb93xx.c                 |    9 +-
 arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c |   19 +--
 arch/arm/boards/freescale-mx35-3-stack/3stack.c   |    9 +-
 arch/arm/boards/imx21ads/imx21ads.c               |    9 +-
 arch/arm/boards/imx27ads/imx27ads.c               |    9 +-
 arch/arm/boards/mmccpu/init.c                     |   16 +--
 arch/arm/boards/netx/netx.c                       |    9 +-
 arch/arm/boards/nhk8815/setup.c                   |   18 +--
 arch/arm/boards/pcm037/pcm037.c                   |   17 +--
 arch/arm/boards/pcm038/pcm038.c                   |    9 +-
 arch/arm/boards/pcm043/pcm043.c                   |   17 +--
 arch/arm/boards/pm9261/init.c                     |   10 +-
 arch/arm/boards/pm9263/init.c                     |   17 +--
 arch/arm/boards/scb9328/scb9328.c                 |   10 +-
 arch/arm/boards/versatile/versatilepb.c           |   19 +--
 arch/arm/mach-at91/at91rm9200_devices.c           |  144 +++------------
 arch/arm/mach-at91/at91sam9260_devices.c          |  209 ++++-----------------
 arch/arm/mach-at91/at91sam9261_devices.c          |  130 +++----------
 arch/arm/mach-at91/at91sam9263_devices.c          |  177 ++++--------------
 arch/arm/mach-at91/at91sam9g45_devices.c          |  197 ++++----------------
 arch/arm/mach-imx/devices.c                       |   19 +--
 arch/arm/mach-nomadik/8815.c                      |   42 +----
 arch/arm/mach-versatile/core.c                    |   48 ++----
 arch/blackfin/boards/ipe337/ipe337.c              |    9 +-
 arch/nios2/boards/generic/generic.c               |    9 +-
 arch/ppc/boards/pcm030/pcm030.c                   |    9 +-
 common/Makefile                                   |    1 -
 drivers/Makefile                                  |    1 +
 drivers/ata/bios.c                                |    2 +-
 drivers/base/Makefile                             |    3 +
 {lib => drivers/base}/driver.c                    |    0
 lib/bus.c => drivers/base/platform.c              |    0
 common/mem.c => drivers/base/resource.c           |   16 +-
 drivers/i2c/busses/i2c-imx.c                      |    6 +-
 drivers/i2c/busses/i2c-omap.c                     |    3 +-
 drivers/mci/mci-core.c                            |    4 +-
 drivers/mci/mxs.c                                 |    4 +-
 drivers/mci/omap_hsmmc.c                          |    2 +-
 drivers/mci/s3c.c                                 |  105 ++++++-----
 drivers/mtd/nand/nand_omap_gpmc.c                 |   10 +-
 drivers/mtd/nand/nand_s3c2410.c                   |    4 +-
 include/driver.h                                  |   23 ++-
 lib/Makefile                                      |    2 -
 45 files changed, 333 insertions(+), 1077 deletions(-)
 create mode 100644 drivers/base/Makefile
 rename {lib => drivers/base}/driver.c (100%)
 rename lib/bus.c => drivers/base/platform.c (100%)
 rename common/mem.c => drivers/base/resource.c (76%)

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

PATCH v2 3/12 resource: introduce add_generic_device to register simple device

---
 drivers/base/resource.c |   16 ++++++++++------
 include/driver.h        |   16 ++++++++++++++--
 2 files changed, 24 insertions(+), 8 deletions(-)
drivers/base/resource.c +10 -6
index 7b0020b..f0450d3 100644
@@ -25,22 +25,26 @@
 #include <driver.h>
 #include <xfuncs.h>
 
-struct device_d *add_mem_device(const char *name, resource_size_t start,
-		resource_size_t size, unsigned int flags)
+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 = xzalloc(sizeof(*dev));
-	strcpy(dev->name, "mem");
-	dev->id = -1;
+	strcpy(dev->name, devname);
+	dev->id = id;
 	dev->resource = xzalloc(sizeof(struct resource));
 	dev->num_resources = 1;
-	dev->resource[0].name = xstrdup(name);
+	if (resname)
+		dev->resource[0].name = xstrdup(resname);
 	dev->resource[0].start = start;
 	dev->resource[0].size = size;
-	dev->resource[0].flags = IORESOURCE_MEM | flags;
+	dev->resource[0].flags = flags;
+	dev->platform_data = pdata;
 
 	register_device(dev);
 
 	return dev;
 }
+EXPORT_SYMBOL(add_generic_device);
include/driver.h +14 -2
index 11c42fe..738cfae 100644
@@ -203,10 +203,22 @@ static inline void __iomem *dev_request_mem_region(struct device_d *dev, int num
 }
 
 /*
+ * register a generic device
+ * with only one resource
+ */
+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);
+
+/*
  * register a memory device
  */
-struct device_d *add_mem_device(const char *name, resource_size_t start,
-		resource_size_t size, unsigned int flags);
+static inline struct device_d *add_mem_device(const char *name, resource_size_t start,
+		resource_size_t size, unsigned int flags)
+{
+	return add_generic_device("mem", -1, name, start, size,
+				  IORESOURCE_MEM | flags, NULL);
+}
 
 /* linear list over all available devices
  */
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 1/12 drivers/bus: move to drivers/base

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 drivers/Makefile                     |    1 +
 drivers/base/Makefile                |    2 ++
 {lib => drivers/base}/driver.c       |    0
 lib/bus.c => drivers/base/platform.c |    0
 lib/Makefile                         |    2 --
 5 files changed, 3 insertions(+), 2 deletions(-)
 create mode 100644 drivers/base/Makefile
 rename {lib => drivers/base}/driver.c (100%)
 rename lib/bus.c => drivers/base/platform.c (100%)
drivers/Makefile +1 -0
index 92b22bd..16b3bb1 100644
@@ -1,3 +1,4 @@
+obj-y	+= base/
 obj-y	+= net/
 obj-y	+= serial/
 obj-y	+= mtd/
drivers/base/Makefile new file +2 -0
new file mode 100644
index 0000000..2d94723
@@ -0,0 +1,2 @@
+obj-y	+= driver.o
+obj-y	+= platform.o
drivers/base/driver.c renamed from lib/driver.c +0 -0
similarity index 100%
rename from lib/driver.c
rename to drivers/base/driver.c
drivers/base/platform.c renamed from lib/bus.c +0 -0
similarity index 100%
rename from lib/bus.c
rename to drivers/base/platform.c
lib/Makefile +0 -2
index 8b986d2..d96cfe7 100644
@@ -5,8 +5,6 @@ obj-y			+= string.o
 obj-y			+= vsprintf.o
 obj-y			+= div64.o
 obj-y			+= misc.o
-obj-y			+= driver.o
-obj-y			+= bus.o
 obj-y			+= parameter.o
 obj-y			+= xfuncs.o
 obj-y			+= getopt.o
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 2/12 drivers: move resource generic management to driver/base/resource.c

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 common/Makefile                         |    1 -
 drivers/base/Makefile                   |    1 +
 common/mem.c => drivers/base/resource.c |    0
 3 files changed, 1 insertions(+), 1 deletions(-)
 rename common/mem.c => drivers/base/resource.c (100%)
common/Makefile +0 -1
index 27aebae..9fed2ae 100644
@@ -9,7 +9,6 @@ obj-$(CONFIG_POLLER)		+= poller.o
 obj-$(CONFIG_BLOCK)		+= block.o
 
 obj-y += memory.o
-obj-y += mem.o
 obj-$(CONFIG_MALLOC_DLMALLOC) += dlmalloc.o
 obj-$(CONFIG_MALLOC_DUMMY) += dummy_malloc.o
 obj-y += clock.o
drivers/base/Makefile +1 -0
index 2d94723..957ca5a 100644
@@ -1,2 +1,3 @@
 obj-y	+= driver.o
 obj-y	+= platform.o
+obj-y	+= resource.o
drivers/base/resource.c renamed from common/mem.c +0 -0
similarity index 100%
rename from common/mem.c
rename to drivers/base/resource.c
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH v2 4/12 at91: switch to add_generic_device

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/boards/at91rm9200ek/init.c      |   18 +--
 arch/arm/boards/at91sam9263ek/init.c     |   18 +---
 arch/arm/boards/mmccpu/init.c            |   17 +--
 arch/arm/boards/pm9261/init.c            |   11 +--
 arch/arm/boards/pm9263/init.c            |   18 +---
 arch/arm/mach-at91/at91rm9200_devices.c  |  144 ++++-----------------
 arch/arm/mach-at91/at91sam9260_devices.c |  209 ++++++------------------------
 arch/arm/mach-at91/at91sam9261_devices.c |  130 ++++---------------
 arch/arm/mach-at91/at91sam9263_devices.c |  177 +++++--------------------
 arch/arm/mach-at91/at91sam9g45_devices.c |  197 ++++++----------------------
 10 files changed, 177 insertions(+), 762 deletions(-)
arch/arm/boards/at91rm9200ek/init.c +3 -15
index 2b16980..3ef41a2 100644
@@ -34,20 +34,6 @@
 #include <mach/gpio.h>
 #include <mach/io.h>
 
-static struct resource cfi_resources[] = {
-	[0] = {
-		.start	= AT91_CHIPSELECT_0,
-		.flags	= IORESOURCE_MEM,
-	},
-};
-
-static struct device_d cfi_dev = {
-	.id		= 0,
-	.name		= "cfi_flash",
-	.num_resources	= ARRAY_SIZE(cfi_resources),
-	.resource	= cfi_resources,
-};
-
 static struct at91_ether_platform_data ether_pdata = {
 	.flags = AT91SAM_ETHER_RMII,
 	.phy_addr = 0,
@@ -63,7 +49,9 @@ static int at91rm9200ek_devices_init(void)
 
 	at91_add_device_sdram(64 * 1024 * 1024);
 	at91_add_device_eth(&ether_pdata);
-	register_device(&cfi_dev);
+
+	add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 0,
+			   IORESOURCE_MEM, NULL);
 
 #if defined(CONFIG_DRIVER_CFI) || defined(CONFIG_DRIVER_CFI_OLD)
 	devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");
arch/arm/boards/at91sam9263ek/init.c +2 -16
index af8a1e1..655d46a 100644
@@ -87,21 +87,6 @@ static void ek_add_device_nand(void)
 	at91_add_device_nand(&nand_pdata);
 }
 
-static struct resource cfi_resources[] = {
-	[0] = {
-		.start	= AT91_CHIPSELECT_0,
-		.size	= 8 * 1024 * 1024,
-		.flags	= IORESOURCE_MEM,
-	},
-};
-
-static struct device_d cfi_dev = {
-	.id		= -1,
-	.name		= "cfi_flash",
-	.num_resources	= ARRAY_SIZE(cfi_resources),
-	.resource	= cfi_resources,
-};
-
 static struct at91_ether_platform_data macb_pdata = {
 	.flags = AT91SAM_ETHER_RMII,
 	.phy_addr = 0,
@@ -135,7 +120,8 @@ static int at91sam9263ek_devices_init(void)
 	at91_add_device_sdram(64 * 1024 * 1024);
 	ek_add_device_nand();
 	at91_add_device_eth(&macb_pdata);
-	register_device(&cfi_dev);
+	add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 8 * 1024 * 1024,
+			   IORESOURCE_MEM, NULL);
 	ek_add_device_mci();
 
 #if defined(CONFIG_DRIVER_CFI) || defined(CONFIG_DRIVER_CFI_OLD)
arch/arm/boards/mmccpu/init.c +2 -15
index 8cc5f2c..85a18e0 100644
@@ -37,20 +37,6 @@
 #include <mach/gpio.h>
 #include <mach/io.h>
 
-static struct resource cfi_resources[] = {
-	[0] = {
-		.start	= AT91_CHIPSELECT_0,
-		.flags	= IORESOURCE_MEM,
-	},
-};
-
-static struct device_d cfi_dev = {
-	.id		= -1,
-	.name		= "cfi_flash",
-	.num_resources	= ARRAY_SIZE(cfi_resources),
-	.resource	= cfi_resources,
-};
-
 static struct at91_ether_platform_data macb_pdata = {
 	.flags		= AT91SAM_ETHER_MII | AT91SAM_ETHER_FORCE_LINK,
 	.phy_addr	= 4,
@@ -68,7 +54,8 @@ static int mmccpu_devices_init(void)
 
 	at91_add_device_sdram(128 * 1024 * 1024);
 	at91_add_device_eth(&macb_pdata);
-	register_device(&cfi_dev);
+	add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 0,
+			   IORESOURCE_MEM, NULL);
 
 	devfs_add_partition("nor0", 0x00000, 256 * 1024, PARTITION_FIXED, "self0");
 	devfs_add_partition("nor0", 0x40000, 128 * 1024, PARTITION_FIXED, "env0");
arch/arm/boards/pm9261/init.c +2 -9
index ad4fa9d..38e4350 100644
@@ -147,19 +147,12 @@ static void __init pm_add_device_dm9000(void)
 static void __init ek_add_device_dm9000(void) {}
 #endif /* CONFIG_DRIVER_NET_DM9000 */
 
-static struct device_d cfi_dev = {
-	.id		= 0,
-	.name		= "cfi_flash",
-	.map_base	= AT91_CHIPSELECT_0,
-	.size		= 4 * 1024 * 1024,
-};
-
 static int pm9261_devices_init(void)
 {
 	at91_add_device_sdram(64 * 1024 * 1024);
 	pm_add_device_nand();
-	register_device(&cfi_dev);
-	pm_add_device_dm9000();
+	add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 4 * 1024 * 1024,
+			   IORESOURCE_MEM, NULL);
 
 	devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");
 	devfs_add_partition("nor0", 0x40000, 0x10000, PARTITION_FIXED, "env0");
arch/arm/boards/pm9263/init.c +2 -16
index e21e8e3..9f86d67 100644
@@ -86,21 +86,6 @@ static void pm_add_device_nand(void)
 	at91_add_device_nand(&nand_pdata);
 }
 
-static struct resource cfi_resources[] = {
-	[0] = {
-		.start	= AT91_CHIPSELECT_0,
-		.size	= 4 * 1024 * 1024,
-		.flags	= IORESOURCE_MEM,
-	},
-};
-
-static struct device_d cfi_dev = {
-	.id	  = -1,
-	.name     = "cfi_flash",
-	.num_resources	= ARRAY_SIZE(cfi_resources),
-	.resource	= cfi_resources,
-};
-
 static struct at91_ether_platform_data macb_pdata = {
 	.flags = AT91SAM_ETHER_RMII,
 	.phy_addr = 0,
@@ -119,7 +104,8 @@ static int pm9263_devices_init(void)
 	at91_add_device_sdram(64 * 1024 * 1024);
 	pm_add_device_nand();
 	at91_add_device_eth(&macb_pdata);
-	register_device(&cfi_dev);
+	add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 4 * 1024 * 1024,
+			   IORESOURCE_MEM, NULL);
 
 	devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0");
 	devfs_add_partition("nor0", 0x40000, 0x10000, PARTITION_FIXED, "env0");
arch/arm/mach-at91/at91rm9200_devices.c +26 -118

222 lines not on this page · raw message

arch/arm/mach-at91/at91sam9260_devices.c +38 -171

317 lines not on this page · raw message

arch/arm/mach-at91/at91sam9261_devices.c +27 -103

199 lines not on this page · raw message

arch/arm/mach-at91/at91sam9263_devices.c +36 -141

273 lines not on this page · raw message

arch/arm/mach-at91/at91sam9g45_devices.c +39 -158

302 lines not on this page · raw message

Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH 6/12 resource: introduce add_cfi_device to register simple cfi device

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/boards/at91rm9200ek/init.c               |    3 +--
 arch/arm/boards/at91sam9263ek/init.c              |    3 +--
 arch/arm/boards/edb93xx/edb93xx.c                 |    9 +--------
 arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c |   19 ++-----------------
 arch/arm/boards/freescale-mx35-3-stack/3stack.c   |    9 +--------
 arch/arm/boards/imx21ads/imx21ads.c               |    9 +--------
 arch/arm/boards/imx27ads/imx27ads.c               |    9 +--------
 arch/arm/boards/mmccpu/init.c                     |    3 +--
 arch/arm/boards/netx/netx.c                       |    9 +--------
 arch/arm/boards/pcm037/pcm037.c                   |   17 +++++------------
 arch/arm/boards/pcm038/pcm038.c                   |    9 +--------
 arch/arm/boards/pcm043/pcm043.c                   |   17 +++++------------
 arch/arm/boards/pm9261/init.c                     |    3 +--
 arch/arm/boards/pm9263/init.c                     |    3 +--
 arch/arm/boards/scb9328/scb9328.c                 |   10 +---------
 arch/arm/boards/versatile/versatilepb.c           |    9 +--------
 arch/blackfin/boards/ipe337/ipe337.c              |    9 +--------
 arch/nios2/boards/generic/generic.c               |    9 +--------
 arch/ppc/boards/pcm030/pcm030.c                   |    9 +--------
 include/driver.h                                  |    7 +++++++
 20 files changed, 35 insertions(+), 140 deletions(-)
arch/arm/boards/at91rm9200ek/init.c +1 -2
index 3ef41a2..9b58996 100644
@@ -50,8 +50,7 @@ static int at91rm9200ek_devices_init(void)
 	at91_add_device_sdram(64 * 1024 * 1024);
 	at91_add_device_eth(&ether_pdata);
 
-	add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 0,
-			   IORESOURCE_MEM, NULL);
+	add_cfi_flash_device(0, AT91_CHIPSELECT_0, 0, 0);
 
 #if defined(CONFIG_DRIVER_CFI) || defined(CONFIG_DRIVER_CFI_OLD)
 	devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");
arch/arm/boards/at91sam9263ek/init.c +1 -2
index 655d46a..036a1c4 100644
@@ -120,8 +120,7 @@ static int at91sam9263ek_devices_init(void)
 	at91_add_device_sdram(64 * 1024 * 1024);
 	ek_add_device_nand();
 	at91_add_device_eth(&macb_pdata);
-	add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 8 * 1024 * 1024,
-			   IORESOURCE_MEM, NULL);
+	add_cfi_flash_device(0, AT91_CHIPSELECT_0, 8 * 1024 * 1024, 0);
 	ek_add_device_mci();
 
 #if defined(CONFIG_DRIVER_CFI) || defined(CONFIG_DRIVER_CFI_OLD)
arch/arm/boards/edb93xx/edb93xx.c +1 -8
index 49a01d6..b169db6 100644
@@ -38,13 +38,6 @@
  * Up to 32MiB NOR type flash, connected to
  * CS line 6, data width is 16 bit
  */
-static struct device_d cfi_dev = {
-	.id	  = -1,
-	.name     = "cfi_flash",
-	.map_base = 0x60000000,
-	.size     = EDB93XX_CFI_FLASH_SIZE,
-};
-
 static struct device_d eth_dev = {
 	.id	  = -1,
 	.name     = "ep93xx_eth",
@@ -54,7 +47,7 @@ static int ep93xx_devices_init(void)
 {
 	struct device_d *sdram_dev;
 
-	register_device(&cfi_dev);
+	add_cfi_flash_device(-1, 0x60000000, EDB93XX_CFI_FLASH_SIZE, 0);
 
 	/*
 	 * Create partitions that should be
arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c +2 -17
index 92424e6..4e69bbc 100644
@@ -48,21 +48,6 @@
 #include <mach/iomux-mx27.h>
 #include <mach/devices-imx27.h>
 
-static struct device_d cfi_dev = {
-	.id	  = -1,
-	.name     = "cfi_flash",
-	.map_base = 0xC0000000,
-	.size     = 32 * 1024 * 1024,
-};
-#ifdef CONFIG_EUKREA_CPUIMX27_NOR_64MB
-static struct device_d cfi_dev1 = {
-	.id	  = -1,
-	.name     = "cfi_flash",
-	.map_base = 0xC2000000,
-	.size     = 32 * 1024 * 1024,
-};
-#endif
-
 #if defined CONFIG_EUKREA_CPUIMX27_SDRAM_256MB
 #define SDRAM0	256
 #elif defined CONFIG_EUKREA_CPUIMX27_SDRAM_128MB
@@ -254,9 +239,9 @@ static int eukrea_cpuimx27_devices_init(void)
 	for (i = 0; i < ARRAY_SIZE(mode); i++)
 		imx_gpio_mode(mode[i]);
 
-	register_device(&cfi_dev);
+	add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0);
 #ifdef CONFIG_EUKREA_CPUIMX27_NOR_64MB
-	register_device(&cfi_dev1);
+	add_cfi_flash_device(-1, 0xC2000000, 32 * 1024 * 1024, 0);
 #endif
 	imx27_add_nand(&nand_info);
 	sdram_dev = add_mem_device("ram0", 0xa0000000, SDRAM0 * 1024 * 1024,
arch/arm/boards/freescale-mx35-3-stack/3stack.c +1 -8
index b3a03cc..9113650 100644
@@ -59,13 +59,6 @@
 #define MX35PDK_BOARD_REV_1		0
 #define MX35PDK_BOARD_REV_2		1
 
-static struct device_d cfi_dev = {
-	.id		= -1,
-	.name		= "cfi_flash",
-	.map_base	= IMX_CS0_BASE,
-	.size		= 64 * 1024 * 1024,
-};
-
 static struct fec_platform_data fec_info = {
 	.xcv_type	= MII100,
 	.phy_addr	= 0x1F,
@@ -170,7 +163,7 @@ static int f3s_devices_init(void)
 	 * This platform supports NOR and NAND
 	 */
 	imx35_add_nand(&nand_info);
-	register_device(&cfi_dev);
+	add_cfi_flash_device(-1, IMX_CS0_BASE, 64 * 1024 * 1024, 0);
 
 	switch ((reg >> 25) & 0x3) {
 	case 0x01:		/* NAND is the source */
arch/arm/boards/imx21ads/imx21ads.c +1 -8
index ab47a8d..854f7ab 100644
@@ -41,13 +41,6 @@
 #define MX21ADS_IO_REG    0xCC800000
 #define MX21ADS_IO_LCDON  (1 << 9)
 
-static struct device_d cfi_dev = {
-	.id	  = -1,
-	.name     = "cfi_flash",
-	.map_base = 0xC8000000,
-	.size     = 32 * 1024 * 1024,
-};
-
 struct imx_nand_platform_data nand_info = {
 	.width = 1,
 	.hw_ecc = 1,
@@ -171,7 +164,7 @@ static int mx21ads_devices_init(void)
 	for (i = 0; i < ARRAY_SIZE(mode); i++)
 		imx_gpio_mode(mode[i]);
 
-	register_device(&cfi_dev);
+	add_cfi_flash_device(-1, 0xC8000000, 32 * 1024 * 1024, 0);
 	sdram_dev = add_mem_device("ram0", 0xc0000000, 64 * 1024 * 1024,
 				   IORESOURCE_MEM_WRITEABLE);
 	armlinux_add_dram(sdram_dev);
arch/arm/boards/imx27ads/imx27ads.c +1 -8
index 8aaf3a2..db49aac 100644
@@ -34,13 +34,6 @@
 #include <mach/iomux-mx27.h>
 #include <mach/devices-imx27.h>
 
-static struct device_d cfi_dev = {
-	.id	  = -1,
-	.name     = "cfi_flash",
-	.map_base = 0xC0000000,
-	.size     = 32 * 1024 * 1024,
-};
-
 static struct fec_platform_data fec_info = {
 	.xcv_type = MII100,
 	.phy_addr = 1,
@@ -114,7 +107,7 @@ static int mx27ads_devices_init(void)
 	for (i = 0; i < ARRAY_SIZE(mode); i++)
 		imx_gpio_mode(mode[i]);
 
-	register_device(&cfi_dev);
+	add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0);
 
 	sdram_dev = add_mem_device("ram0", 0xa0000000, 128 * 1024 * 1024,
 				   IORESOURCE_MEM_WRITEABLE);
arch/arm/boards/mmccpu/init.c +1 -2
index 85a18e0..eb6b490 100644
@@ -54,8 +54,7 @@ static int mmccpu_devices_init(void)
 
 	at91_add_device_sdram(128 * 1024 * 1024);
 	at91_add_device_eth(&macb_pdata);
-	add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 0,
-			   IORESOURCE_MEM, NULL);
+	add_cfi_flash_device(0, AT91_CHIPSELECT_0, 0, 0);
 
 	devfs_add_partition("nor0", 0x00000, 256 * 1024, PARTITION_FIXED, "self0");
 	devfs_add_partition("nor0", 0x40000, 128 * 1024, PARTITION_FIXED, "env0");
arch/arm/boards/netx/netx.c +1 -8
index 5e25b94..f3be348 100644
@@ -30,13 +30,6 @@
 #include <generated/mach-types.h>
 #include <mach/netx-eth.h>
 
-static struct device_d cfi_dev = {
-	.id	  = -1,
-	.name     = "cfi_flash",
-	.map_base = 0xC0000000,
-	.size     = 32 * 1024 * 1024,
-};
-
 struct netx_eth_platform_data eth0_data = {
 	.xcno = 0,
 };
@@ -60,7 +53,7 @@ static struct device_d netx_eth_dev1 = {
 static int netx_devices_init(void) {
 	struct device_d *sdram_dev;
 
-	register_device(&cfi_dev);
+	add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0);
 
 	sdram_dev = add_mem_device("ram0", 0x80000000, 64 * 1024 * 1024,
 				   IORESOURCE_MEM_WRITEABLE);
arch/arm/boards/pcm037/pcm037.c +5 -12
index 7895059..6e20d1d 100644
@@ -40,17 +40,6 @@
 #include <mach/devices-imx31.h>
 
 /*
- * Up to 32MiB NOR type flash, connected to
- * CS line 0, data width is 16 bit
- */
-static struct device_d cfi_dev = {
-	.id	  = -1,
-	.name     = "cfi_flash",
-	.map_base = IMX_CS0_BASE,
-	.size     = 32 * 1024 * 1024,	/* area size */
-};
-
-/*
  * SMSC 9217 network controller
  * connected to CS line 1 and interrupt line
  * GPIO3, data width is 16 bit
@@ -227,7 +216,11 @@ static int imx31_devices_init(void)
 	__REG(CSCR_L(5)) = 0x444A0301;
 	__REG(CSCR_A(5)) = 0x44443302;
 
-	register_device(&cfi_dev);
+	/*
+	 * Up to 32MiB NOR type flash, connected to
+	 * CS line 0, data width is 16 bit
+	 */
+	add_cfi_flash_device(-1, IMX_CS0_BASE, 32 * 1024 * 1024, 0);
 
 	/*
 	 * Create partitions that should be
arch/arm/boards/pcm038/pcm038.c +1 -8
index 046fbd5..2f87b12 100644
@@ -47,13 +47,6 @@
 
 #include "pll.h"
 
-static struct device_d cfi_dev = {
-	.id	  = -1,
-	.name     = "cfi_flash",
-	.map_base = 0xC0000000,
-	.size     = 32 * 1024 * 1024,
-};
-
 static struct fec_platform_data fec_info = {
 	.xcv_type = MII100,
 	.phy_addr = 1,
@@ -267,7 +260,7 @@ static int pcm038_devices_init(void)
 	spi_register_board_info(pcm038_spi_board_info, ARRAY_SIZE(pcm038_spi_board_info));
 	imx27_add_spi0(&pcm038_spi_0_data);
 
-	register_device(&cfi_dev);
+	add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0);
 	imx27_add_nand(&nand_info);
 	sdram_dev = add_mem_device("ram0", 0xa0000000, 128 * 1024 * 1024,
 				   IORESOURCE_MEM_WRITEABLE);
arch/arm/boards/pcm043/pcm043.c +5 -12
index 0cfd675..3bd6402 100644
@@ -46,17 +46,6 @@
 #include <mach/iomux-mx35.h>
 #include <mach/devices-imx35.h>
 
-/*
- * Up to 32MiB NOR type flash, connected to
- * CS line 0, data width is 16 bit
- */
-static struct device_d cfi_dev = {
-	.id	  = -1,
-	.name     = "cfi_flash",
-	.map_base = IMX_CS0_BASE,
-	.size     = 32 * 1024 * 1024,	/* area size */
-};
-
 static struct fec_platform_data fec_info = {
 	.xcv_type = MII100,
 };
@@ -158,7 +147,11 @@ static int imx35_devices_init(void)
 	 * This platform supports NOR and NAND
 	 */
 	imx35_add_nand(&nand_info);
-	register_device(&cfi_dev);
+	/*
+	 * Up to 32MiB NOR type flash, connected to
+	 * CS line 0, data width is 16 bit
+	 */
+	add_cfi_flash_device(-1, IMX_CS0_BASE, 32 * 1024 * 1024, 0);
 
 	if ((reg & 0xc00) == 0x800) {   /* reset mode: external boot */
 		switch ( (reg >> 25) & 0x3) {
arch/arm/boards/pm9261/init.c +1 -2
index 38e4350..1059aec 100644
@@ -151,8 +151,7 @@ static int pm9261_devices_init(void)
 {
 	at91_add_device_sdram(64 * 1024 * 1024);
 	pm_add_device_nand();
-	add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 4 * 1024 * 1024,
-			   IORESOURCE_MEM, NULL);
+	add_cfi_flash_device(0, AT91_CHIPSELECT_0, 4 * 1024 * 1024, 0);
 
 	devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");
 	devfs_add_partition("nor0", 0x40000, 0x10000, PARTITION_FIXED, "env0");
arch/arm/boards/pm9263/init.c +1 -2
index 9f86d67..418b804 100644
@@ -104,8 +104,7 @@ static int pm9263_devices_init(void)
 	at91_add_device_sdram(64 * 1024 * 1024);
 	pm_add_device_nand();
 	at91_add_device_eth(&macb_pdata);
-	add_generic_device("cfi_flash", 0, NULL, AT91_CHIPSELECT_0, 4 * 1024 * 1024,
-			   IORESOURCE_MEM, NULL);
+	add_cfi_flash_device(0, AT91_CHIPSELECT_0, 4 * 1024 * 1024, 0);
 
 	devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0");
 	devfs_add_partition("nor0", 0x40000, 0x10000, PARTITION_FIXED, "env0");
arch/arm/boards/scb9328/scb9328.c +1 -9
index 2fe8236..d49eaff 100644
@@ -33,14 +33,6 @@
 #include <dm9000.h>
 #include <led.h>
 
-static struct device_d cfi_dev = {
-	.id	  = -1,
-	.name     = "cfi_flash",
-
-	.map_base = 0x10000000,
-	.size     = 16 * 1024 * 1024,
-};
-
 static struct dm9000_platform_data dm9000_data = {
 	.buswidth = DM9000_WIDTH_16,
 	.srom     = 1,
@@ -110,7 +102,7 @@ static int scb9328_devices_init(void)
 	CS5U = 0x00008400;
 	CS5L = 0x00000D03;
 
-	register_device(&cfi_dev);
+	add_cfi_flash_device(-1, 0x10000000, 16 * 1024 * 1024, 0);
 	sdram_dev = add_mem_device("ram0", 0x08000000, 16 * 1024 * 1024,
 				   IORESOURCE_MEM_WRITEABLE);
 	armlinux_add_dram(sdram_dev);
arch/arm/boards/versatile/versatilepb.c +1 -8
index 5568f21..830be93 100644
@@ -33,13 +33,6 @@
 #include <partition.h>
 #include <sizes.h>
 
-static struct device_d cfi_dev = {
-	.id		= -1,
-	.name		= "cfi_flash",
-	.map_base	= VERSATILE_FLASH_BASE,
-	.size		= VERSATILE_FLASH_SIZE,
-};
-
 static int vpb_console_init(void)
 {
 	versatile_register_uart(0);
@@ -58,7 +51,7 @@ static int vpb_devices_init(void)
 {
 	versatile_add_sdram(64 * 1024 *1024);
 
-	register_device(&cfi_dev);
+	add_cfi_flash_device(-1, VERSATILE_FLASH_BASE, VERSATILE_FLASH_SIZE, 0);
 	devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");
 	devfs_add_partition("nor0", 0x40000, 0x20000, PARTITION_FIXED, "env0");
 
arch/blackfin/boards/ipe337/ipe337.c +1 -8
index 81a6a6f..4430f3b 100644
@@ -5,13 +5,6 @@
 #include <partition.h>
 #include <fs.h>
 
-static struct device_d cfi_dev = {
-	.id	  = -1,
-	.name     = "cfi_flash",
-	.map_base = 0x20000000,
-	.size     = 32 * 1024 * 1024,
-};
-
 static struct device_d smc911x_dev = {
 	.id	  = -1,
 	.name     = "smc911x",
@@ -20,7 +13,7 @@ static struct device_d smc911x_dev = {
 };
 
 static int ipe337_devices_init(void) {
-	register_device(&cfi_dev);
+	add_cfi_flash_device(-1, 0x20000000, 32 * 1024 * 1024, 0);
 	add_mem_device("ram0", 0x0, 128 * 1024 * 1024,
 		       IORESOURCE_MEM_WRITEABLE);
 
arch/nios2/boards/generic/generic.c +1 -8
index 37adfaa..089715b 100644
@@ -4,13 +4,6 @@
 #include <partition.h>
 #include <fs.h>
 
-static struct device_d cfi_dev = {
-	.id       = -1,
-	.name     = "cfi_flash",
-	.map_base = NIOS_SOPC_FLASH_BASE,
-	.size     = NIOS_SOPC_FLASH_SIZE,
-};
-
 static int phy_address = 1;
 
 static struct device_d mac_dev = {
@@ -37,7 +30,7 @@ static struct device_d epcs_flash_device = {
 
 static int generic_devices_init(void)
 {
-	register_device(&cfi_dev);
+	add_cfi_flash_device(-1, NIOS_SOPC_FLASH_BASE, NIOS_SOPC_FLASH_SIZE, 0);
 	add_mem_device("ram0", NIOS_SOPC_MEMORY_BASE, NIOS_SOPC_MEMORY_SIZE,
 		       IORESOURCE_MEM_WRITEABLE);
 	register_device(&mac_dev);
arch/ppc/boards/pcm030/pcm030.c +1 -8
index 3c23d83..0f09d3e 100644
@@ -37,13 +37,6 @@
 #include <mem_malloc.h>
 #include <reloc.h>
 
-struct device_d cfi_dev = {
-	.id	  = -1,
-	.name     = "cfi_flash",
-	.map_base = 0xff000000,
-	.size     = 16 * 1024 * 1024,
-};
-
 static struct mpc5xxx_fec_platform_data fec_info = {
 	.xcv_type = MII100,
 };
@@ -57,7 +50,7 @@ struct device_d eth_dev = {
 
 static int devices_init (void)
 {
-	register_device(&cfi_dev);
+	add_cfi_flash_device(-1, 0xff000000, 16 * 1024 * 1024, 0);
 	add_mem_device("ram0", 0x0, 64 * 1024 * 1024,
 		       IORESOURCE_MEM_WRITEABLE);
 	register_device(&eth_dev);
include/driver.h +7 -0
index 738cfae..af34803 100644
@@ -220,6 +220,13 @@ static inline struct device_d *add_mem_device(const char *name, resource_size_t
 				  IORESOURCE_MEM | flags, NULL);
 }
 
+static inline struct device_d *add_cfi_flash_device(int id, resource_size_t start,
+		resource_size_t size, unsigned int flags)
+{
+	return add_generic_device("cfi_flash", id, NULL, start, size,
+				  IORESOURCE_MEM | flags, NULL);
+}
+
 /* linear list over all available devices
  */
 extern struct list_head device_list;
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH 7/12 versatile: switch to add_generic_device

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/boards/versatile/versatilepb.c |   10 +-----
 arch/arm/mach-versatile/core.c          |   48 ++++++++-----------------------
 2 files changed, 14 insertions(+), 44 deletions(-)
arch/arm/boards/versatile/versatilepb.c +2 -8
index 830be93..fdd77e5 100644
@@ -40,13 +40,6 @@ static int vpb_console_init(void)
 }
 console_initcall(vpb_console_init);
 
-static struct device_d smc911x_dev = {
-	.id		= -1,
-	.name		= "smc91c111",
-	.map_base	= VERSATILE_ETH_BASE,
-	.size		= 64 * 1024,
-};
-
 static int vpb_devices_init(void)
 {
 	versatile_add_sdram(64 * 1024 *1024);
@@ -55,7 +48,8 @@ static int vpb_devices_init(void)
 	devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");
 	devfs_add_partition("nor0", 0x40000, 0x20000, PARTITION_FIXED, "env0");
 
-	register_device(&smc911x_dev);
+	add_generic_device("smc91c111", -1, NULL, VERSATILE_ETH_BASE, 64 * 1024,
+			   IORESOURCE_MEM, NULL);
 
 	armlinux_set_architecture(MACH_TYPE_VERSATILE_PB);
 	armlinux_set_bootparams((void *)(0x00000100));
arch/arm/mach-versatile/core.c +12 -36

70 lines not on this page · raw message

Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

PATCH 8/12 nomadik: switch to add_generic_device

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/boards/nhk8815/setup.c |   18 +--------------
 arch/arm/mach-nomadik/8815.c    |   42 +++++++-------------------------------
 2 files changed, 10 insertions(+), 50 deletions(-)
arch/arm/boards/nhk8815/setup.c +2 -16
index b7fa50a..da6be93 100644
@@ -33,21 +33,6 @@
 #include <mach/nand.h>
 #include <mach/fsmc.h>
 
-static struct resource nhk8815_network_resources[] = {
-	[0] = {
-		.start	= 0x34000300,
-		.size	= 16,
-		.flags	= IORESOURCE_MEM,
-	},
-};
-
-static struct device_d nhk8815_network_dev = {
-	.id = -1,
-	.name = "smc91c111",
-	.num_resources	= ARRAY_SIZE(nhk8815_network_resources),
-	.resource	= nhk8815_network_resources,
-};
-
 static int nhk8815_nand_init(void)
 {
 	/* FSMC setup for nand chip select (8-bit nand in 8815NHK) */
@@ -104,7 +89,8 @@ static int nhk8815_devices_init(void)
 	writel(0x0000305b, FSMC_BCR(1));
 	writel(0x00033f33, FSMC_BTR(1));
 
-	register_device(&nhk8815_network_dev);
+	add_generic_device("smc91c111", -1, NULL, 0x34000300, 16,
+			   IORESOURCE_MEM, NULL);
 
 	register_device(&nhk8815_nand_device);
 
arch/arm/mach-nomadik/8815.c +8 -34

54 lines not on this page · raw message

Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

PATCH 9/12 mci: switch to "struct resource"

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 drivers/mci/mci-core.c   |    4 +-
 drivers/mci/mxs.c        |    4 +-
 drivers/mci/omap_hsmmc.c |    2 +-
 drivers/mci/s3c.c        |  105 ++++++++++++++++++++++++++--------------------
 4 files changed, 64 insertions(+), 51 deletions(-)
drivers/mci/mci-core.c +2 -2
index 1c16cf1..0611ce6 100644
@@ -1231,8 +1231,8 @@ static int mci_card_probe(struct device_d *mci_dev)
 	p->priv = mci_dev;
 
 	strcpy(disk_dev->name, "disk");
-	disk_dev->size = mci->capacity;
-	disk_dev->map_base = 0;
+	disk_dev->resource[0].size = mci->capacity;
+	disk_dev->resource[0].start = 0;
 	disk_dev->platform_data = p;
 
 	register_device(disk_dev);
drivers/mci/mxs.c +2 -2
index c6ae1cb..a477620 100644
@@ -702,7 +702,7 @@ static int mxs_mci_probe(struct device_d *hw_dev)
 	host->send_cmd = mxs_mci_request,
 	host->set_ios = mxs_mci_set_ios,
 	host->init = mxs_mci_initialize,
-	mxs_mci->regs = (void *)hw_dev->map_base;
+	mxs_mci->regs = dev_request_mem_region(dev, 0);
 
 	/* feed forward the platform specific values */
 	host->voltages = pd->voltages;
@@ -713,7 +713,7 @@ static int mxs_mci_probe(struct device_d *hw_dev)
 #endif
 #ifdef CONFIG_ARCH_IMX28
 	/* one dedicated clock per unit */
-	switch (hw_dev->map_base) {
+	switch (hw_dev->resource[0].start) {
 	case IMX_SSP0_BASE:
 		mxs_mci->index = 0;
 		break;
drivers/mci/omap_hsmmc.c +1 -1
index 0799297..f47f190 100644
@@ -558,7 +558,7 @@ static int omap_mmc_probe(struct device_d *dev)
 	hsmmc->mci.init = mmc_init_setup;
 	hsmmc->mci.host_caps = MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS;
 
-	hsmmc->base = (struct hsmmc *)dev->map_base;
+	hsmmc->base = dev_request_mem_region(dev, 0);
 
 	hsmmc->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
 
drivers/mci/s3c.c +59 -46

329 lines not on this page · raw message

Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

PATCH 10/12 ata/bios: convert to struct resource

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 drivers/ata/bios.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/ata/bios.c +1 -1
index 3f419cc..6e2377c 100644
@@ -257,7 +257,7 @@ static int biosdisk_probe(struct device_d *dev)
 
 		strcpy(drive_dev->name, "biosdisk");
 		drive_dev->id = drive - 0x80;
-		drive_dev->map_base = 0;
+		drive_dev->resource[0].start = 0;
 		drive_dev->platform_data = p;
 
 		register_device(drive_dev);
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#10 lore raw

PATCH 11/12 i2c: convert to struct resource

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 drivers/i2c/busses/i2c-imx.c  |    6 +++---
 drivers/i2c/busses/i2c-omap.c |    3 +--
 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-imx.c +3 -3
index aaed8c4..2d075f7 100644
@@ -113,11 +113,11 @@ struct imx_i2c_struct {
 #ifdef CONFIG_I2C_DEBUG
 static void i2c_imx_dump_reg(struct i2c_adapter *adapter)
 {
-	unsigned long base = adapter->dev->map_base;
+	struct imx_i2c_struct *i2c_imx = to_imx_i2c_struct(adapter);
 	u32 reg_cr, reg_sr;
 
-	reg_cr = readb(base + IMX_I2C_I2CR);
-	reg_sr = readb(base + IMX_I2C_I2SR);
+	reg_cr = readb(i2c_imx->base + IMX_I2C_I2CR);
+	reg_sr = readb(i2c_imx->base + IMX_I2C_I2SR);
 
 	dev_dbg(adapter->dev, "CONTROL:\t"
 		"IEN =%d, IIEN=%d, MSTA=%d, MTX =%d, TXAK=%d, RSTA=%d\n",
drivers/i2c/busses/i2c-omap.c +1 -2
index 8e7a8b5..95c4fdf 100644
@@ -716,7 +716,6 @@ i2c_omap_probe(struct device_d *pdev)
 {
 	struct omap_i2c_struct	*i2c_omap;
 	/* struct i2c_platform_data *pdata; */
-	/* unsigned long base = pdev->map_base; */
 	int r;
 	u32 speed = 0;
 
@@ -732,7 +731,7 @@ i2c_omap_probe(struct device_d *pdev)
 		speed = 100;	/* Defualt speed */
 
 	i2c_omap->speed = speed;
-	i2c_omap->base = (void*)pdev->map_base;
+	i2c_omap->base = dev_request_mem_region(pdev, 0);
 	printf ("I2C probe\n");
 	omap_i2c_unidle(i2c_omap);
 
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#11 lore raw

PATCH v2 5/12 imx/devices: switch to add_generic_device

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/mach-imx/devices.c |   19 +++----------------
 1 files changed, 3 insertions(+), 16 deletions(-)
arch/arm/mach-imx/devices.c +3 -16
index 6503c30..5b062f5 100644
@@ -2,23 +2,10 @@
 #include <driver.h>
 #include <mach/devices.h>
 
-static struct device_d *imx_add_device(char *name, int id, void *base, int size, void *pdata)
+static inline struct device_d *imx_add_device(char *name, int id, void *base, int size, void *pdata)
 {
-	struct device_d *dev;
-
-	dev = xzalloc(sizeof(*dev));
-	strcpy(dev->name,name);
-	dev->id = id;
-	dev->resource = xzalloc(sizeof(struct resource));
-	dev->resource[0].start = (resource_size_t)base;
-	dev->resource[0].size = size;
-	dev->resource[0].flags = IORESOURCE_MEM;
-	dev->num_resources = 1;
-	dev->platform_data = pdata;
-
-	register_device(dev);
-
-	return 0;
+	return add_generic_device(name, id, NULL, (resource_size_t)base, size,
+				  IORESOURCE_MEM, pdata);
 }
 
 struct device_d *imx_add_fec(void *base, struct fec_platform_data *pdata)
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#12 lore raw

PATCH 12/12 nand: convert to struct resource

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 drivers/mtd/nand/nand_omap_gpmc.c |   10 +++++-----
 drivers/mtd/nand/nand_s3c2410.c   |    4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/mtd/nand/nand_omap_gpmc.c +5 -5
index 4a2d561..083aa57 100644
@@ -14,8 +14,8 @@
  * static struct device_d my_nand_device = {
  *	.name = "gpmc_nand",
  *	.id = some identifier you need to show.. e.g. "gpmc_nand0"
- *	.map_base = GPMC base address
- *	.size = GPMC address map size.
+ *	.resource[0].start = GPMC base address
+ *	.resource[0].size = GPMC address map size.
  *	.platform_data = platform data - required - explained below
  * };
  * platform data required:
@@ -97,7 +97,7 @@ struct gpmc_nand_info {
 	void *gpmc_command;
 	void *gpmc_address;
 	void *gpmc_data;
-	unsigned long gpmc_base;
+	void __iomem *gpmc_base;
 	unsigned char wait_mon_mask;
 	uint64_t timeout;
 	unsigned inuse:1;
@@ -672,7 +672,7 @@ static int gpmc_nand_probe(struct device_d *pdev)
 	struct gpmc_nand_platform_data *pdata;
 	struct nand_chip *nand;
 	struct mtd_info *minfo;
-	unsigned long cs_base;
+	void __iomem *cs_base;
 	int err;
 	struct nand_ecclayout *layout, *lsp, *llp;
 
@@ -703,7 +703,7 @@ static int gpmc_nand_probe(struct device_d *pdev)
 	}
 	/* Setup register specific data */
 	oinfo->gpmc_cs = pdata->cs;
-	oinfo->gpmc_base = pdev->map_base;
+	oinfo->gpmc_base = dev_request_mem_region(pdev, 0);
 	cs_base = oinfo->gpmc_base + GPMC_CONFIG1_0 +
 		(pdata->cs * GPMC_CONFIG_CS_SIZE);
 	oinfo->gpmc_command = (void *)(cs_base + GPMC_CS_NAND_COMMAND);
drivers/mtd/nand/nand_s3c2410.c +2 -2
index 88e89cd..0ce20d4 100644
@@ -422,7 +422,7 @@ static int s3c24x0_nand_probe(struct device_d *dev)
 		return -ENOMEM;
 
 	host->dev = dev;
-	host->base = IOMEM(dev->map_base);
+	host->base = dev_request_mem_region(dev, 0);
 
 	/* structures must be linked */
 	chip = &host->nand;
@@ -435,7 +435,7 @@ static int s3c24x0_nand_probe(struct device_d *dev)
 	chip->chip_delay = 50;
 	chip->priv = host;
 
-	chip->IO_ADDR_R = chip->IO_ADDR_W = IOMEM(dev->map_base + NFDATA);
+	chip->IO_ADDR_R = chip->IO_ADDR_W = host->base + NFDATA;
 
 #ifdef CONFIG_CPU_S3C2440
 	chip->read_buf = s3c2440_nand_read_buf;
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#13 lore raw
In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD

Hi,

the folling patch series continue to switch the device/driver

this reduce the code of 744 lignes and 188 bytes since v2011.07.0

Quoted 8 lines

this superseed the previous patch has some errors was found

The following changes since commit 522af7074a333508d8b73c25abd1d051d8672e5c:

armlinux: mem tag switch to "struct resource" (2011-07-20 08:25:45 +0200)

are available in the git repository at:
git://uboot.jcrosoft.org/barebox.git resource

pulled to -next.

That drops the occurances of map_base to 180 ;)

Thanks
Sascha

Quoted 74 lines

Jean-Christophe PLAGNIOL-VILLARD (12):
drivers/bus: move to drivers/base
drivers: move resource generic management to driver/base/resource.c
resource: introduce add_generic_device to register simple device
at91: switch to add_generic_device
imx/devices: switch to add_generic_device
resource: introduce add_cfi_device to register simple cfi device
versatile: switch to add_generic_device
nomadik: switch to add_generic_device
mci: switch to "struct resource"
ata/bios: convert to struct resource
i2c: convert to struct resource
nand: convert to struct resource

 arch/arm/boards/at91rm9200ek/init.c               |   17 +--
 arch/arm/boards/at91sam9263ek/init.c              |   17 +--
 arch/arm/boards/edb93xx/edb93xx.c                 |    9 +-
 arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c |   19 +--
 arch/arm/boards/freescale-mx35-3-stack/3stack.c   |    9 +-
 arch/arm/boards/imx21ads/imx21ads.c               |    9 +-
 arch/arm/boards/imx27ads/imx27ads.c               |    9 +-
 arch/arm/boards/mmccpu/init.c                     |   16 +--
 arch/arm/boards/netx/netx.c                       |    9 +-
 arch/arm/boards/nhk8815/setup.c                   |   18 +--
 arch/arm/boards/pcm037/pcm037.c                   |   17 +--
 arch/arm/boards/pcm038/pcm038.c                   |    9 +-
 arch/arm/boards/pcm043/pcm043.c                   |   17 +--
 arch/arm/boards/pm9261/init.c                     |   10 +-
 arch/arm/boards/pm9263/init.c                     |   17 +--
 arch/arm/boards/scb9328/scb9328.c                 |   10 +-
 arch/arm/boards/versatile/versatilepb.c           |   19 +--
 arch/arm/mach-at91/at91rm9200_devices.c           |  144 +++------------
 arch/arm/mach-at91/at91sam9260_devices.c          |  209 ++++-----------------
 arch/arm/mach-at91/at91sam9261_devices.c          |  130 +++----------
 arch/arm/mach-at91/at91sam9263_devices.c          |  177 ++++--------------
 arch/arm/mach-at91/at91sam9g45_devices.c          |  197 ++++----------------
 arch/arm/mach-imx/devices.c                       |   19 +--
 arch/arm/mach-nomadik/8815.c                      |   42 +----
 arch/arm/mach-versatile/core.c                    |   48 ++----
 arch/blackfin/boards/ipe337/ipe337.c              |    9 +-
 arch/nios2/boards/generic/generic.c               |    9 +-
 arch/ppc/boards/pcm030/pcm030.c                   |    9 +-
 common/Makefile                                   |    1 -
 drivers/Makefile                                  |    1 +
 drivers/ata/bios.c                                |    2 +-
 drivers/base/Makefile                             |    3 +
 {lib => drivers/base}/driver.c                    |    0
 lib/bus.c => drivers/base/platform.c              |    0
 common/mem.c => drivers/base/resource.c           |   16 +-
 drivers/i2c/busses/i2c-imx.c                      |    6 +-
 drivers/i2c/busses/i2c-omap.c                     |    3 +-
 drivers/mci/mci-core.c                            |    4 +-
 drivers/mci/mxs.c                                 |    4 +-
 drivers/mci/omap_hsmmc.c                          |    2 +-
 drivers/mci/s3c.c                                 |  105 ++++++-----
 drivers/mtd/nand/nand_omap_gpmc.c                 |   10 +-
 drivers/mtd/nand/nand_s3c2410.c                   |    4 +-
 include/driver.h                                  |   23 ++-
 lib/Makefile                                      |    2 -
 45 files changed, 333 insertions(+), 1077 deletions(-)
 create mode 100644 drivers/base/Makefile
 rename {lib => drivers/base}/driver.c (100%)
 rename lib/bus.c => drivers/base/platform.c (100%)
 rename common/mem.c => drivers/base/resource.c (76%)

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#14 lore raw
Quoted 11 lines · Sascha Hauer
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD

Hi,

the folling patch series continue to switch the device/driver

this reduce the code of 744 lignes and 188 bytes since v2011.07.0

this superseed the previous patch has some errors was found

The following changes since commit 522af7074a333508d8b73c25abd1d051d8672e5c:

Quoted 8 lines
Quoted 4 lines

armlinux: mem tag switch to "struct resource" (2011-07-20 08:25:45 +0200)

are available in the git repository at:
git://uboot.jcrosoft.org/barebox.git resource

pulled to -next.

That drops the occurances of map_base to 180 ;)

130 to go

can some people help on imx?

I'll send usb and fb soon
that drop 50 more

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

maintainer
#15 lore raw
Quoted 17 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 16 lines · Sascha Hauer
Quoted 14 lines · Jean-Christophe PLAGNIOL-VILLARD

Hi,

the folling patch series continue to switch the device/driver

this reduce the code of 744 lignes and 188 bytes since v2011.07.0

this superseed the previous patch has some errors was found

The following changes since commit 522af7074a333508d8b73c25abd1d051d8672e5c:

armlinux: mem tag switch to "struct resource" (2011-07-20 08:25:45 +0200)

are available in the git repository at:
git://uboot.jcrosoft.org/barebox.git resource

Quoted 6 lines
Quoted 3 lines

pulled to -next.

That drops the occurances of map_base to 180 ;)

130 to go

can some people help on imx?

Yes, I'll convert the rest of i.MX.

Sascha

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox