Skip to contentSkip to conversation

device: introduce resource structure

PATCH In review Jean-Christophe PLAGNIOL-VILLARD 3 participants 22 messages Nov 12, 2010 – Jan 27, 2011

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

cover device: introduce resource structure

Hi,

This patch series introduce the device resource structure to be allow to declare more than one resources per device

The following changes since commit b35fbfc237a1916bfddc1be8ea2dc4c0a7426147:

at91: add Ronetix pm9g45 support (2010-11-11 20:43:21 +0800)

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

Jean-Christophe PLAGNIOL-VILLARD (5):
device: introduce resource structure to simplify resource delaration
mem: add multiple resource support arm/setup_memory_tags: add multiple resource support
edb93xx: convert to multiple mem resources
pcm037: convert to multiple mem resources

 Documentation/porting.txt                          |   11 ++-
 arch/arm/boards/a9m2410/a9m2410.c                  |   61 +++++++---
 arch/arm/boards/a9m2440/a9m2440.c                  |   48 ++++++--
 arch/arm/boards/at91sam9261ek/init.c               |   11 ++-
 arch/arm/boards/at91sam9263ek/init.c               |   11 ++-
 arch/arm/boards/chumby_falconwing/falconwing.c     |   37 +++++--
 arch/arm/boards/edb93xx/edb93xx.c                  |  120 ++++++++------------
 arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c  |   37 +++++--
 arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c  |   74 +++++++++---
 arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c  |   37 +++++--
 arch/arm/boards/freescale-mx23-evk/mx23-evk.c      |   28 +++--
 arch/arm/boards/freescale-mx25-3-stack/3stack.c    |   53 ++++++----
 arch/arm/boards/freescale-mx35-3-stack/3stack.c    |   46 ++++++--
 arch/arm/boards/freescale-mx51-pdk/board.c         |   15 ++-
 arch/arm/boards/guf-cupid/board.c                  |   64 ++++++++--
 arch/arm/boards/guf-neso/board.c                   |   26 +++--
 arch/arm/boards/imx21ads/imx21ads.c                |   36 +++++--
 arch/arm/boards/imx27ads/imx27ads.c                |   26 +++--
 arch/arm/boards/mmccpu/init.c                      |   11 ++-
 arch/arm/boards/netx/netx.c                        |   37 +++++--
 arch/arm/boards/nhk8815/setup.c                    |   11 ++-
 arch/arm/boards/omap/board-beagle.c                |   46 ++++++--
 arch/arm/boards/omap/board-omap3evm.c              |   34 ++++--
 arch/arm/boards/omap/board-sdp343x.c               |   26 +++--
 arch/arm/boards/omap/devices-gpmc-nand.c           |   11 ++-
 arch/arm/boards/pcm037/pcm037.c                    |  110 +++++++++++--------
 arch/arm/boards/pcm038/pcm038.c                    |   52 ++++++---
 arch/arm/boards/pcm043/pcm043.c                    |   26 +++--
 arch/arm/boards/phycard-i.MX27/pca100.c            |   37 +++++--
 arch/arm/boards/pm9261/init.c                      |   22 +++-
 arch/arm/boards/pm9263/init.c                      |   11 ++-
 arch/arm/boards/scb9328/scb9328.c                  |   49 ++++++--
 arch/arm/lib/armlinux.c                            |   15 ++-
 arch/arm/mach-at91/at91sam9260_devices.c           |  114 +++++++++++++++----
 arch/arm/mach-at91/at91sam9261_devices.c           |   70 +++++++++---
 arch/arm/mach-at91/at91sam9263_devices.c           |   81 ++++++++++---
 arch/arm/mach-at91/at91sam9g45_devices.c           |   92 ++++++++++++----
 arch/arm/mach-imx/devices.c                        |    4 +-
 arch/arm/mach-imx/iim.c                            |   17 ++-
 arch/arm/mach-imx/imx25.c                          |   42 ++++++-
 arch/arm/mach-nomadik/8815.c                       |   37 +++++--
 arch/blackfin/boards/ipe337/ipe337.c               |   48 ++++++--
 arch/m68k/boards/kp_ukd_r1_num/kp_ukd_r1_num.c     |  102 ++++++++++++----
 arch/m68k/boards/phycore_mcf54xx/phyCore_MCF54xx.c |   72 ++++++++----
 arch/ppc/boards/pcm030/pcm030.c                    |   61 ++++++++---
 arch/sandbox/board/hostfile.c                      |    4 +-
 arch/sandbox/mach-sandbox/include/mach/hostfile.h  |   10 ++-
 arch/sandbox/os/common.c                           |    4 +-
 arch/x86/boards/x86_generic/generic_pc.c           |   32 ++++--
 commands/mem.c                                     |   36 ++++---
 common/startup.c                                   |   13 ++-
 drivers/ata/bios.c                                 |    4 +-
 drivers/ata/disk_drive.c                           |   13 +-
 drivers/i2c/busses/i2c-imx.c                       |   22 ++--
 drivers/i2c/busses/i2c-omap.c                      |    4 +-
 drivers/mci/imx-esdhc.c                            |    2 +-
 drivers/mci/imx.c                                  |    3 +-
 drivers/mci/mci-core.c                             |    4 +-
 drivers/mci/s3c.c                                  |  106 ++++++++++--------
 drivers/mci/stm378x.c                              |   79 ++++++++-----
 drivers/mtd/nand/atmel_nand.c                      |    2 +-
 drivers/mtd/nand/nand_imx.c                        |    2 +-
 drivers/mtd/nand/nand_omap_gpmc.c                  |   13 ++-
 drivers/mtd/nand/nand_s3c2410.c                    |    4 +-
 drivers/net/cs8900.c                               |    2 +-
 drivers/net/fec_imx.c                              |    2 +-
 drivers/net/fec_mpc5200.c                          |    2 +-
 drivers/net/macb.c                                 |    2 +-
 drivers/net/smc91111.c                             |    2 +-
 drivers/net/smc911x.c                              |    9 +-
 drivers/nor/cfi_flash.c                            |   31 +++--
 drivers/serial/amba-pl011.c                        |   32 +++---
 drivers/serial/atmel.c                             |   29 +++---
 drivers/serial/serial_imx.c                        |    2 +-
 drivers/serial/serial_mpc5xxx.c                    |   20 ++--
 drivers/serial/serial_netx.c                       |   34 +++---
 drivers/serial/serial_ns16550.c                    |   12 +-
 drivers/serial/serial_pl010.c                      |   15 ++-
 drivers/serial/serial_s3c24x0.c                    |   36 +++---
 drivers/serial/stm-serial.c                        |   44 ++++----
 drivers/spi/imx_spi.c                              |    2 +-
 drivers/usb/gadget/fsl_udc.c                       |    2 +-
 drivers/usb/host/ehci-hcd.c                        |    9 +-
 drivers/video/fb.c                                 |    4 +-
 drivers/video/imx-ipu-fb.c                         |    2 +-
 drivers/video/imx.c                                |    2 +-
 fs/devfs.c                                         |    2 +-
 fs/fs.c                                            |   14 ++-
 include/driver.h                                   |   48 ++++++--
 include/linux/ioport.h                             |  115 +++++++++++++++++++
 lib/driver.c                                       |    7 +-
 91 files changed, 1946 insertions(+), 871 deletions(-)
 create mode 100644 include/linux/ioport.h

Best Regards,
J.

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

#1 lore raw

PATCH 1/5 device: introduce resource structure to simplify resource delaration

introdude also some helper to manager them

and add multi resource per device support

ram device: use resource structure instead of memory_platform_data

---
 Documentation/porting.txt                          |   11 ++-
 arch/arm/boards/a9m2410/a9m2410.c                  |   61 ++++++++---
 arch/arm/boards/a9m2440/a9m2440.c                  |   48 ++++++--
 arch/arm/boards/at91sam9261ek/init.c               |   11 ++-
 arch/arm/boards/at91sam9263ek/init.c               |   11 ++-
 arch/arm/boards/chumby_falconwing/falconwing.c     |   37 +++++--
 arch/arm/boards/edb93xx/edb93xx.c                  |   82 +++++++++-----
 arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c  |   37 +++++--
 arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c  |   74 ++++++++++---
 arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c  |   37 +++++--
 arch/arm/boards/freescale-mx23-evk/mx23-evk.c      |   28 ++++--
 arch/arm/boards/freescale-mx25-3-stack/3stack.c    |   53 ++++++----
 arch/arm/boards/freescale-mx35-3-stack/3stack.c    |   46 ++++++--
 arch/arm/boards/freescale-mx51-pdk/board.c         |   15 ++-
 arch/arm/boards/guf-cupid/board.c                  |   64 +++++++++---
 arch/arm/boards/guf-neso/board.c                   |   26 +++--
 arch/arm/boards/imx21ads/imx21ads.c                |   36 +++++--
 arch/arm/boards/imx27ads/imx27ads.c                |   26 +++--
 arch/arm/boards/mmccpu/init.c                      |   11 ++-
 arch/arm/boards/netx/netx.c                        |   37 +++++--
 arch/arm/boards/nhk8815/setup.c                    |   11 ++-
 arch/arm/boards/omap/board-beagle.c                |   46 ++++++--
 arch/arm/boards/omap/board-omap3evm.c              |   34 ++++--
 arch/arm/boards/omap/board-sdp343x.c               |   26 +++--
 arch/arm/boards/omap/devices-gpmc-nand.c           |   11 ++-
 arch/arm/boards/pcm037/pcm037.c                    |   89 +++++++++++-----
 arch/arm/boards/pcm038/pcm038.c                    |   52 ++++++---
 arch/arm/boards/pcm043/pcm043.c                    |   26 +++--
 arch/arm/boards/phycard-i.MX27/pca100.c            |   37 +++++--
 arch/arm/boards/pm9261/init.c                      |   22 +++-
 arch/arm/boards/pm9263/init.c                      |   11 ++-
 arch/arm/boards/scb9328/scb9328.c                  |   49 ++++++---
 arch/arm/lib/armlinux.c                            |    4 +-
 arch/arm/mach-at91/at91sam9260_devices.c           |  114 +++++++++++++++----
 arch/arm/mach-at91/at91sam9261_devices.c           |   70 +++++++++---
 arch/arm/mach-at91/at91sam9263_devices.c           |   81 +++++++++++---
 arch/arm/mach-at91/at91sam9g45_devices.c           |   92 ++++++++++++----
 arch/arm/mach-imx/devices.c                        |    4 +-
 arch/arm/mach-imx/iim.c                            |   17 ++-
 arch/arm/mach-imx/imx25.c                          |   42 ++++++--
 arch/arm/mach-nomadik/8815.c                       |   37 +++++--
 arch/blackfin/boards/ipe337/ipe337.c               |   48 ++++++--
 arch/m68k/boards/kp_ukd_r1_num/kp_ukd_r1_num.c     |  102 +++++++++++++-----
 arch/m68k/boards/phycore_mcf54xx/phyCore_MCF54xx.c |   72 +++++++++----
 arch/ppc/boards/pcm030/pcm030.c                    |   61 ++++++++---
 arch/sandbox/board/hostfile.c                      |    4 +-
 arch/sandbox/mach-sandbox/include/mach/hostfile.h  |   10 ++-
 arch/sandbox/os/common.c                           |    4 +-
 arch/x86/boards/x86_generic/generic_pc.c           |   32 ++++--
 commands/mem.c                                     |   21 ++--
 common/startup.c                                   |   13 ++-
 drivers/ata/bios.c                                 |    4 +-
 drivers/ata/disk_drive.c                           |   13 ++-
 drivers/i2c/busses/i2c-imx.c                       |   22 ++--
 drivers/i2c/busses/i2c-omap.c                      |    4 +-
 drivers/mci/imx-esdhc.c                            |    2 +-
 drivers/mci/imx.c                                  |    3 +-
 drivers/mci/mci-core.c                             |    4 +-
 drivers/mci/s3c.c                                  |  106 ++++++++++--------
 drivers/mci/stm378x.c                              |   79 ++++++++------
 drivers/mtd/nand/atmel_nand.c                      |    2 +-
 drivers/mtd/nand/nand_imx.c                        |    2 +-
 drivers/mtd/nand/nand_omap_gpmc.c                  |   13 ++-
 drivers/mtd/nand/nand_s3c2410.c                    |    4 +-
 drivers/net/cs8900.c                               |    2 +-
 drivers/net/fec_imx.c                              |    2 +-
 drivers/net/fec_mpc5200.c                          |    2 +-
 drivers/net/macb.c                                 |    2 +-
 drivers/net/smc91111.c                             |    2 +-
 drivers/net/smc911x.c                              |    9 +-
 drivers/nor/cfi_flash.c                            |   31 +++---
 drivers/serial/amba-pl011.c                        |   32 +++---
 drivers/serial/atmel.c                             |   29 +++---
 drivers/serial/serial_imx.c                        |    2 +-
 drivers/serial/serial_mpc5xxx.c                    |   20 ++--
 drivers/serial/serial_netx.c                       |   34 +++---
 drivers/serial/serial_ns16550.c                    |   12 +-
 drivers/serial/serial_pl010.c                      |   15 ++-
 drivers/serial/serial_s3c24x0.c                    |   36 +++---
 drivers/serial/stm-serial.c                        |   44 ++++----
 drivers/spi/imx_spi.c                              |    2 +-
 drivers/usb/gadget/fsl_udc.c                       |    2 +-
 drivers/usb/host/ehci-hcd.c                        |    9 +-
 drivers/video/fb.c                                 |    4 +-
 drivers/video/imx-ipu-fb.c                         |    2 +-
 drivers/video/imx.c                                |    2 +-
 fs/devfs.c                                         |    2 +-
 fs/fs.c                                            |   14 ++-
 include/driver.h                                   |   48 +++++++--
 include/linux/ioport.h                             |  115 ++++++++++++++++++++
 lib/driver.c                                       |    7 +-
 91 files changed, 1931 insertions(+), 801 deletions(-)
 create mode 100644 include/linux/ioport.h
Documentation/porting.txt +9 -2
index ccfe598..abf9089 100644
@@ -32,10 +32,17 @@ extra-y += barebox.lds
   To see anything you have to at least register a console. In scb9328.c this
   looks like this:
 
+	static struct resource scb9328_serial_resources[] = {
+		[0] = {
+			.start	= IMX_UART1_BASE,
+			.size	= 4096,
+		},
+}	;
+
 	static struct device_d scb9328_serial_device = {
 		.name     = "imx_serial",
-		.map_base = IMX_UART1_BASE,
-		.size     = 4096,
+		.num_resources	= ARRAY_SIZE(scb9328_serial_resources),
+		.resource	= scb9328_serial_resources,
 	};
 
 	static int scb9328_console_init(void)
arch/arm/boards/a9m2410/a9m2410.c +43 -18

123 lines not on this page · raw message

arch/arm/boards/a9m2440/a9m2440.c +36 -12

98 lines not on this page · raw message

arch/arm/boards/at91sam9261ek/init.c +9 -2
index 576a022..31f18ec 100644
@@ -88,6 +88,13 @@ static void ek_add_device_nand(void)
  * DM9000 ethernet device
  */
 #if defined(CONFIG_DRIVER_NET_DM9000)
+static struct resource dm9000_dev_resources[] = {
+	[0] = {
+		.start	= AT91_CHIPSELECT_2,
+		.size	= 8,
+	},
+};
+
 static struct dm9000_platform_data dm9000_data = {
 	.iobase		= AT91_CHIPSELECT_2,
 	.iodata		= AT91_CHIPSELECT_2 + 4,
@@ -98,8 +105,8 @@ static struct dm9000_platform_data dm9000_data = {
 static struct device_d dm9000_dev = {
 	.id		= 0,
 	.name		= "dm9000",
-	.map_base	= AT91_CHIPSELECT_2,
-	.size		= 8,
+	.num_resources	= ARRAY_SIZE(dm9000_dev_resources),
+	.resource	= dm9000_dev_resources,
 	.platform_data	= &dm9000_data,
 };
 
arch/arm/boards/at91sam9263ek/init.c +9 -2
index 8448866..66172c4 100644
@@ -87,11 +87,18 @@ static void ek_add_device_nand(void)
 	at91_add_device_nand(&nand_pdata);
 }
 
+static struct resource cfi_dev_resources[] = {
+	[0] = {
+		.start	= AT91_CHIPSELECT_0,
+		.size	= 8 * 1024 * 1024,
+	},
+};
+
 static struct device_d cfi_dev = {
 	.id		= -1,
 	.name		= "cfi_flash",
-	.map_base	= AT91_CHIPSELECT_0,
-	.size		= 8 * 1024 * 1024,
+	.num_resources	= ARRAY_SIZE(cfi_dev_resources),
+	.resource	= cfi_dev_resources,
 };
 
 static struct at91_ether_platform_data macb_pdata = {
arch/arm/boards/chumby_falconwing/falconwing.c +27 -10
index 952a384..8daec47 100644
@@ -29,16 +29,19 @@
 #include <mach/clock.h>
 #include <mach/mci.h>
 
-static struct memory_platform_data ram_pdata = {
-	.name = "ram0",
-	.flags = DEVFS_RDWR,
+static struct resource sdram_dev_resources[] = {
+	[0] = {
+		.name	= "ram0",
+		.start	= IMX_MEMORY_BASE,
+		.size	= 64 * 1024 * 1024,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 static struct device_d sdram_dev = {
 	.name     = "mem",
-	.map_base = IMX_MEMORY_BASE,
-	.size     = 64 * 1024 * 1024,
-	.platform_data = &ram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
 
 static struct stm_mci_platform_data mci_pdata = {
@@ -46,9 +49,16 @@ static struct stm_mci_platform_data mci_pdata = {
 	.voltages = MMC_VDD_32_33 | MMC_VDD_33_34,	/* fixed to 3.3 V */
 };
 
+static struct resource mci_dev_resources[] = {
+	[0] = {
+		.start	= IMX_SSP1_BASE,
+	},
+};
+
 static struct device_d mci_dev = {
 	.name     = "stm_mci",
-	.map_base = IMX_SSP1_BASE,
+	.num_resources	= ARRAY_SIZE(mci_dev_resources),
+	.resource	= mci_dev_resources,
 	.platform_data = &mci_pdata,
 };
 
@@ -271,7 +281,7 @@ static int falconwing_devices_init(void)
 	register_device(&mci_dev);
 
 	armlinux_add_dram(&sdram_dev);
-	armlinux_set_bootparams((void*)(sdram_dev.map_base + 0x100));
+	armlinux_set_bootparams((void*)(dev_resource_get_start(&sdram_dev) + 0x100));
 	armlinux_set_architecture(MACH_TYPE_CHUMBY);
 
 	rc = register_persistant_environment();
@@ -283,10 +293,17 @@ static int falconwing_devices_init(void)
 
 device_initcall(falconwing_devices_init);
 
+static struct resource falconwing_serial_resources[] = {
+	[0] = {
+		.start	= IMX_DBGUART_BASE,
+		.size	= 8192,
+	},
+};
+
 static struct device_d falconwing_serial_device = {
 	.name     = "stm_serial",
-	.map_base = IMX_DBGUART_BASE,
-	.size     = 8192,
+	.num_resources	= ARRAY_SIZE(falconwing_serial_resources),
+	.resource	= falconwing_serial_resources,
 };
 
 static int falconwing_console_init(void)
arch/arm/boards/edb93xx/edb93xx.c +54 -28

133 lines not on this page · raw message

arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +27 -10
index 3048c3f..1c5c31d 100644
@@ -89,17 +89,20 @@ static struct fec_platform_data fec_info = {
 	.phy_addr	= 1,
 };
 
-static struct memory_platform_data sdram_pdata = {
-	.name	= "ram0",
-	.flags	= DEVFS_RDWR,
+static struct resource sdram0_dev_resources[] = {
+	[0] = {
+		.name	= "ram0",
+		.start	= IMX_SDRAM_CS0,
+		.size	= 64 * 1024 * 1024,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 static struct device_d sdram0_dev = {
 	.id	  = -1,
 	.name     = "mem",
-	.map_base = IMX_SDRAM_CS0,
-	.size     = 64 * 1024 * 1024,
-	.platform_data = &sdram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram0_dev_resources),
+	.resource	= sdram0_dev_resources,
 };
 
 struct imx_nand_platform_data nand_info = {
@@ -155,14 +158,28 @@ static void imx25_usb_init(void)
 	writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
 }
 
+static struct resource usbh2_dev_resources[] = {
+	[0] = {
+		.start	= IMX_OTG_BASE + 0x400,
+		.size	= 0x200,
+	},
+};
+
 static struct device_d usbh2_dev = {
 	.id	  = -1,
 	.name     = "ehci",
-	.map_base = IMX_OTG_BASE + 0x400,
-	.size     = 0x200,
+	.num_resources	= ARRAY_SIZE(usbh2_dev_resources),
+	.resource	= usbh2_dev_resources,
 };
 #endif
 
+static struct resource usbotg_dev_resources[] = {
+	[0] = {
+		.start	= IMX_OTG_BASE,
+		.size	= 0x200,
+	},
+};
+
 static struct fsl_usb2_platform_data usb_pdata = {
 	.operating_mode	= FSL_USB2_DR_DEVICE,
 	.phy_mode	= FSL_USB2_PHY_UTMI,
@@ -170,8 +187,8 @@ static struct fsl_usb2_platform_data usb_pdata = {
 
 static struct device_d usbotg_dev = {
 	.name     = "fsl-udc",
-	.map_base = IMX_OTG_BASE,
-	.size     = 0x200,
+	.num_resources	= ARRAY_SIZE(usbotg_dev_resources),
+	.resource	= usbotg_dev_resources,
 	.platform_data = &usb_pdata,
 };
 
arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c +56 -18

127 lines not on this page · raw message

arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c +27 -10
index 07f320b..2e1ddd3 100644
@@ -61,17 +61,20 @@ static struct fec_platform_data fec_info = {
 	.phy_addr	= 0x1F,
 };
 
-static struct memory_platform_data sdram_pdata = {
-	.name	= "ram0",
-	.flags	= DEVFS_RDWR,
+static struct resource sdram_dev_resources[] = {
+	[0] = {
+		.name	= "ram0",
+		.start	= IMX_SDRAM_CS0,
+		.size	= 128 * 1024 * 1024,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 static struct device_d sdram_dev = {
 	.id		= -1,
 	.name		= "mem",
-	.map_base	= IMX_SDRAM_CS0,
-	.size		= 128 * 1024 * 1024,
-	.platform_data	= &sdram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
 
 struct imx_nand_platform_data nand_info = {
@@ -131,14 +134,28 @@ static void imx35_usb_init(void)
 	writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
 }
 
+static struct resource usbh2_dev_resources[] = {
+	[0] = {
+		.start	= IMX_OTG_BASE + 0x400,
+		.size	= 0x200,
+	},
+};
+
 static struct device_d usbh2_dev = {
 	.id	  = -1,
 	.name     = "ehci",
-	.map_base = IMX_OTG_BASE + 0x400,
-	.size     = 0x200,
+	.num_resources	= ARRAY_SIZE(usbh2_dev_resources),
+	.resource	= usbh2_dev_resources,
 };
 #endif
 
+static struct resource usbotg_dev_resources[] = {
+	[0] = {
+		.start	= IMX_OTG_BASE,
+		.size	= 0x200,
+	},
+};
+
 static struct fsl_usb2_platform_data usb_pdata = {
 	.operating_mode	= FSL_USB2_DR_DEVICE,
 	.phy_mode	= FSL_USB2_PHY_UTMI,
@@ -146,9 +163,9 @@ static struct fsl_usb2_platform_data usb_pdata = {
 
 static struct device_d usbotg_dev = {
 	.name     = "fsl-udc",
-	.map_base = IMX_OTG_BASE,
-	.size     = 0x200,
 	.platform_data = &usb_pdata,
+	.num_resources	= ARRAY_SIZE(usbotg_dev_resources),
+	.resource	= usbotg_dev_resources,
 };
 
 #ifdef CONFIG_MMU
arch/arm/boards/freescale-mx23-evk/mx23-evk.c +19 -9
index 1ce72be..64b39b2 100644
@@ -25,16 +25,19 @@
 #include <generated/mach-types.h>
 #include <mach/imx-regs.h>
 
-static struct memory_platform_data ram_pdata = {
-	.name = "ram0",
-	.flags = DEVFS_RDWR,
+static struct resource sdram_dev_resources[] = {
+	[0] = {
+		.name	= "ram0",
+		.start	= IMX_MEMORY_BASE,
+		.size	= 32 * 1024 * 1024,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 static struct device_d sdram_dev = {
 	.name     = "mem",
-	.map_base = IMX_MEMORY_BASE,
-	.size     = 32 * 1024 * 1024,
-	.platform_data = &ram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
 
 static int mx23_evk_devices_init(void)
@@ -42,7 +45,7 @@ static int mx23_evk_devices_init(void)
 	register_device(&sdram_dev);
 
 	armlinux_add_dram(&sdram_dev);
-	armlinux_set_bootparams((void*)(sdram_dev.map_base + 0x100));
+	armlinux_set_bootparams((void*)(dev_resource_get_start(&sdram_dev) + 0x100));
 	armlinux_set_architecture(MACH_TYPE_MX23EVK);
 
 	return 0;
@@ -50,10 +53,17 @@ static int mx23_evk_devices_init(void)
 
 device_initcall(mx23_evk_devices_init);
 
+static struct resource mx23_evk_serial_dev_resources[] = {
+	[0] = {
+		.start	= IMX_DBGUART_BASE,
+		.size	= 8192,
+	},
+};
+
 static struct device_d mx23_evk_serial_device = {
 	.name     = "stm_serial",
-	.map_base = IMX_DBGUART_BASE,
-	.size     = 8192,
+	.num_resources	= ARRAY_SIZE(mx23_evk_serial_dev_resources),
+	.resource	= mx23_evk_serial_dev_resources,
 };
 
 static int mx23_evk_console_init(void)
arch/arm/boards/freescale-mx25-3-stack/3stack.c +33 -20

80 lines not on this page · raw message

arch/arm/boards/freescale-mx35-3-stack/3stack.c +35 -11

84 lines not on this page · raw message

arch/arm/boards/freescale-mx51-pdk/board.c +9 -6
index ff779ca..158b657 100644
@@ -41,17 +41,20 @@
 #include <mach/iomux-mx51.h>
 #include <mach/devices-imx51.h>
 
-static struct memory_platform_data ram_pdata = {
-	.name = "ram0",
-	.flags = DEVFS_RDWR,
+static struct resource sdram_dev_resources[] = {
+	[0] = {
+		.name	= "ram0",
+		.start	= 0x90000000,
+		.size	= 512 * 1024 * 1024,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 static struct device_d sdram_dev = {
 	.id       = -1,
 	.name     = "mem",
-	.map_base = 0x90000000,
-	.size     = 512 * 1024 * 1024,
-	.platform_data = &ram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
 
 static struct fec_platform_data fec_info = {
arch/arm/boards/guf-cupid/board.c +51 -13

113 lines not on this page · raw message

arch/arm/boards/guf-neso/board.c +18 -8
index d371dd6..5fdc1de 100644
@@ -54,17 +54,20 @@
 #define LCD_POWER_GPIO (GPIO_PORTF + 18)
 #define BACKLIGHT_POWER_GPIO (GPIO_PORTE + 5)
 
-static struct memory_platform_data ram_pdata = {
-	.name = "ram0",
-	.flags = DEVFS_RDWR,
+static struct resource sdram_dev_resources[] = {
+	[0] = {
+		.name 	= "ram0",
+		.start	= 0xa0000000,
+		.size	= 128 * 1024 * 1024,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 static struct device_d sdram_dev = {
 	.id	  = -1,
 	.name     = "mem",
-	.map_base = 0xa0000000,
-	.size     = 128 * 1024 * 1024,
-	.platform_data = &ram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
 
 static struct fec_platform_data fec_info = {
@@ -128,11 +131,18 @@ static struct imx_fb_platform_data neso_fb_data = {
 
 #ifdef CONFIG_USB
 
+static struct resource usbh2_dev_resources[] = {
+	[0] = {
+		.start	= IMX_OTG_BASE + 0x400,
+		.size	= 0x200,
+	},
+};
+
 static struct device_d usbh2_dev = {
 	.id	  = -1,
 	.name     = "ehci",
-	.map_base = IMX_OTG_BASE + 0x400,
-	.size     = 0x200,
+	.num_resources	= ARRAY_SIZE(usbh2_dev_resources),
+	.resource	= usbh2_dev_resources,
 };
 
 static void neso_usbh_init(void)
arch/arm/boards/imx21ads/imx21ads.c +27 -9
index 3942581..37768b5 100644
@@ -41,24 +41,35 @@
 #define MX21ADS_IO_REG    0xCC800000
 #define MX21ADS_IO_LCDON  (1 << 9)
 
+static struct resource cfi_dev_resources[] = {
+	[0] = {
+		.start	= 0xC8000000,
+		.size	= 32 * 1024 * 1024,
+	},
+};
+
 static struct device_d cfi_dev = {
 	.id	  = -1,
 	.name     = "cfi_flash",
-	.map_base = 0xC8000000,
-	.size     = 32 * 1024 * 1024,
+	.num_resources	= ARRAY_SIZE(cfi_dev_resources),
+	.resource	= cfi_dev_resources,
 };
 
-static struct memory_platform_data ram_pdata = {
-	.name = "ram0",
-	.flags = DEVFS_RDWR,
+
+static struct resource sdram_dev_resources[] = {
+	[0] = {
+		.name	= "ram0",
+		.start	= 0xc0000000,
+		.size	= 64 * 1024 * 1024,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 static struct device_d sdram_dev = {
 	.id	  = -1,
 	.name     = "mem",
-	.map_base = 0xc0000000,
-	.size     = 64 * 1024 * 1024,
-	.platform_data = &ram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
 
 struct imx_nand_platform_data nand_info = {
@@ -66,10 +77,17 @@ struct imx_nand_platform_data nand_info = {
 	.hw_ecc = 1,
 };
 
+static struct resource cs8900_dev_resources[] = {
+	[0] = {
+		.start	= IMX_CS1_BASE,
+	},
+};
+
 static struct device_d cs8900_dev = {
 	.id	  = -1,
 	.name     = "cs8900",
-	.map_base = IMX_CS1_BASE,
+	.num_resources	= ARRAY_SIZE(cs8900_dev_resources),
+	.resource	= cs8900_dev_resources,
 	// IRQ is connected to UART3_RTS
 };
 
arch/arm/boards/imx27ads/imx27ads.c +18 -8
index 0d433c1..2b3572a 100644
@@ -34,24 +34,34 @@
 #include <mach/iomux-mx27.h>
 #include <mach/devices-imx27.h>
 
+static struct resource cfi_dev_resources[] = {
+	[0] = {
+		.start	= 0xC0000000,
+		.size	= 32 * 1024 * 1024,
+	},
+};
+
 static struct device_d cfi_dev = {
 	.id	  = -1,
 	.name     = "cfi_flash",
-	.map_base = 0xC0000000,
-	.size     = 32 * 1024 * 1024,
+	.num_resources	= ARRAY_SIZE(cfi_dev_resources),
+	.resource	= cfi_dev_resources,
 };
 
-static struct memory_platform_data ram_pdata = {
-	.name = "ram0",
-	.flags = DEVFS_RDWR,
+static struct resource sdram_dev_resources[] = {
+	[0] = {
+		.name	= "ram0",
+		.start	= 0xa0000000,
+		.size	= 128 * 1024 * 1024,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 static struct device_d sdram_dev = {
 	.id	  = -1,
 	.name     = "mem",
-	.map_base = 0xa0000000,
-	.size     = 128 * 1024 * 1024,
-	.platform_data = &ram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
 
 static struct fec_platform_data fec_info = {
arch/arm/boards/mmccpu/init.c +9 -2
index 7cba01c..8d18f7c 100644
@@ -37,11 +37,18 @@
 #include <mach/gpio.h>
 #include <mach/io.h>
 
+static struct resource cfi_dev_resources[] = {
+	[0] = {
+		.start	= AT91_CHIPSELECT_0,
+		.size	= 0,	/* zero means autodetect size */
+	},
+};
+
 static struct device_d cfi_dev = {
 	.id		= -1,
 	.name		= "cfi_flash",
-	.map_base	= AT91_CHIPSELECT_0,
-	.size		= 0,	/* zero means autodetect size */
+	.num_resources	= ARRAY_SIZE(cfi_dev_resources),
+	.resource	= cfi_dev_resources,
 };
 
 static struct at91_ether_platform_data macb_pdata = {
arch/arm/boards/netx/netx.c +27 -10
index c735d26..5f7e58a 100644
@@ -30,24 +30,34 @@
 #include <generated/mach-types.h>
 #include <mach/netx-eth.h>
 
+static struct resource cfi_dev_resources[] = {
+	[0] = {
+		.start	= 0xC0000000,
+		.size	= 32 * 1024 * 1024,
+	},
+};
+
 static struct device_d cfi_dev = {
 	.id	  = -1,
 	.name     = "cfi_flash",
-	.map_base = 0xC0000000,
-	.size     = 32 * 1024 * 1024,
+	.num_resources	= ARRAY_SIZE(cfi_dev_resources),
+	.resource	= cfi_dev_resources,
 };
 
-static struct memory_platform_data ram_pdata = {
-	.name = "ram0",
-	.flags = DEVFS_RDWR,
+static struct resource sdram_dev_resources[] = {
+	[0] = {
+		.name	= "ram0",
+		.start	= 0x80000000,
+		.size	= 64 * 1024 * 1024,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 static struct device_d sdram_dev = {
 	.id	  = -1,
 	.name     = "mem",
-	.map_base = 0x80000000,
-	.size     = 64 * 1024 * 1024,
-	.platform_data = &ram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
 
 struct netx_eth_platform_data eth0_data = {
@@ -92,11 +102,18 @@ static int netx_devices_init(void) {
 
 device_initcall(netx_devices_init);
 
+static struct resource netx_serial_resources[] = {
+	[0] = {
+		.start	= NETX_PA_UART0,
+		.size	= 0x40,
+	},
+};
+
 static struct device_d netx_serial_device = {
 	.id	  = -1,
 	.name     = "netx_serial",
-	.map_base = NETX_PA_UART0,
-	.size     = 0x40,
+	.num_resources	= ARRAY_SIZE(netx_serial_resources),
+	.resource	= netx_serial_resources,
 };
 
 static int netx_console_init(void)
arch/arm/boards/nhk8815/setup.c +9 -2
index 9cb0fd0..9d5e45d 100644
@@ -33,11 +33,18 @@
 #include <mach/nand.h>
 #include <mach/fsmc.h>
 
+static struct resource network_dev_resources[] = {
+	[0] = {
+		.start	= 0x34000300,
+		.size	= 16,
+	},
+};
+
 static struct device_d nhk8815_network_dev = {
 	.id = -1,
 	.name = "smc91c111",
-	.map_base = 0x34000300,
-	.size = 16,
+	.num_resources	= ARRAY_SIZE(network_dev_resources),
+	.resource	= network_dev_resources,
 };
 
 static int nhk8815_nand_init(void)
arch/arm/boards/omap/board-beagle.c +35 -11

82 lines not on this page · raw message

arch/arm/boards/omap/board-omap3evm.c +22 -12
index c37f151..b8b71de 100644
@@ -217,15 +217,22 @@ static struct NS16550_plat serial_plat = {
 	.reg_write	= omap_uart_write,
 };
 
-static struct device_d omap3evm_serial_device = {
-	.id		= -1,
-	.name		= "serial_ns16550",
+static struct resource omap3evm_serial_resources[] = {
+	[0] = {
 #if defined(CONFIG_OMAP3EVM_UART1)
-	.map_base	= OMAP_UART1_BASE,
+		.start	= OMAP_UART1_BASE,
 #elif defined(CONFIG_OMAP3EVM_UART3)
-	.map_base	= OMAP_UART3_BASE,
+		.start	= OMAP_UART3_BASE,
 #endif
-	.size		= 1024,
+		.size	= 1024,
+	},
+};
+
+static struct device_d omap3evm_serial_device = {
+	.id		= -1,
+	.name		= "serial_ns16550",
+	.num_resources	= ARRAY_SIZE(omap3evm_serial_resources),
+	.resource	= omap3evm_serial_resources,
 	.platform_data	= (void *)&serial_plat,
 };
 
@@ -241,17 +248,20 @@ static int omap3evm_init_console(void)
 console_initcall(omap3evm_init_console);
 #endif /* CONFIG_DRIVER_SERIAL_NS16550 */
 
-static struct memory_platform_data sram_pdata = {
-	.name	= "ram0",
-	.flags	= DEVFS_RDWR,
+static struct resource sdram_dev_resources[] = {
+	[0] = {
+		.name	= "ram0",
+		.start	= 0x80000000,
+		.size	= 128 * 1024 * 1024,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 static struct device_d sdram_dev = {
 	.id		= -1,
 	.name		= "mem",
-	.map_base	= 0x80000000,
-	.size		= 128 * 1024 * 1024,
-	.platform_data	= &sram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
 
 static int omap3evm_init_devices(void)
arch/arm/boards/omap/board-sdp343x.c +18 -8
index f7615b4..984b3e5 100644
@@ -609,11 +609,18 @@ static struct NS16550_plat serial_plat = {
 	.reg_write = omap_uart_write,
 };
 
+static struct resource sdp3430_serial_resources[] = {
+	[0] = {
+		.start	= OMAP_UART3_BASE,
+		.size	= 1024,
+	},
+};
+
 static struct device_d sdp3430_serial_device = {
 	.id = -1,
 	.name = "serial_ns16550",
-	.map_base = OMAP_UART3_BASE,
-	.size = 1024,
+	.num_resources	= ARRAY_SIZE(sdp3430_serial_resources),
+	.resource	= sdp3430_serial_resources,
 	.platform_data = (void *)&serial_plat,
 };
 
@@ -641,17 +648,20 @@ static int sdp3430_flash_init(void)
 	return 0;
 }
 
-static struct memory_platform_data ram_pdata = {
-	.name = "ram0",
-	.flags = DEVFS_RDWR,
+static struct resource sdram_dev_resources[] = {
+	[0] = {
+		.name	= "ram0",
+		.start	= 0x80000000,
+		.size	= 128 * 1024 * 1024,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 struct device_d sdram_dev = {
 	.id = -1,
 	.name = "mem",
-	.map_base = 0x80000000,
-	.size = 128 * 1024 * 1024,
-	.platform_data = &ram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
 
 /*-----------------------Generic Devices Initialization ---------------------*/
arch/arm/boards/omap/devices-gpmc-nand.c +9 -2
index 4369aa0..0292944 100644
@@ -71,11 +71,18 @@ static struct gpmc_nand_platform_data nand_plat = {
 };
 
 /** NAND device definition */
+static struct resource gpmc_generic_nand_resources[] = {
+	[0] = {
+		.start	= OMAP_GPMC_BASE,
+		.size	= 1024 * 4,	/* GPMC size */
+	},
+};
+
 static struct device_d gpmc_generic_nand_nand_device = {
 	.id = -1,
 	.name = "gpmc_nand",
-	.map_base = OMAP_GPMC_BASE,
-	.size = 1024 * 4,	/* GPMC size */
+	.num_resources	= ARRAY_SIZE(gpmc_generic_nand_resources),
+	.resource	= gpmc_generic_nand_resources,
 	.platform_data = (void *)&nand_plat,
 };
 
arch/arm/boards/pcm037/pcm037.c +63 -26

154 lines not on this page · raw message

arch/arm/boards/pcm038/pcm038.c +36 -16

84 lines not on this page · raw message

arch/arm/boards/pcm043/pcm043.c +18 -8
index 2191bc8..cf92ad0 100644
@@ -49,28 +49,38 @@
  * Up to 32MiB NOR type flash, connected to
  * CS line 0, data width is 16 bit
  */
+static struct resource cfi_dev_resources[] = {
+	[0] = {
+		.start	= IMX_CS0_BASE,
+		.size	= 32 * 1024 * 1024,	/* area size */
+	},
+};
+
 static struct device_d cfi_dev = {
 	.id	  = -1,
 	.name     = "cfi_flash",
-	.map_base = IMX_CS0_BASE,
-	.size     = 32 * 1024 * 1024,	/* area size */
+	.num_resources	= ARRAY_SIZE(cfi_dev_resources),
+	.resource	= cfi_dev_resources,
 };
 
 static struct fec_platform_data fec_info = {
 	.xcv_type = MII100,
 };
 
-static struct memory_platform_data ram_pdata = {
-	.name = "ram0",
-	.flags = DEVFS_RDWR,
+static struct resource sdram0_dev_resources[] = {
+	[0] = {
+		.name	= "ram0",
+		.start	= IMX_SDRAM_CS0,
+		.size	= 128 * 1024 * 1024,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 static struct device_d sdram0_dev = {
 	.id	  = -1,
 	.name     = "mem",
-	.map_base = IMX_SDRAM_CS0,
-	.size     = 128 * 1024 * 1024,
-	.platform_data = &ram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram0_dev_resources),
+	.resource	= sdram0_dev_resources,
 };
 
 struct imx_nand_platform_data nand_info = {
arch/arm/boards/phycard-i.MX27/pca100.c +27 -10
index 32f7e74..b6432ff 100644
@@ -41,17 +41,20 @@
 #include <mach/iomux-mx27.h>
 #include <mach/devices-imx27.h>
 
-static struct memory_platform_data ram_pdata = {
-	.name = "ram0",
-	.flags = DEVFS_RDWR,
+static struct resource sdram_dev_resources[] = {
+	[0] = {
+		.name	= "ram0",
+		.start	= 0xa0000000,
+		.size	= 128 * 1024 * 1024,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 static struct device_d sdram_dev = {
 	.id	  = -1,
 	.name     = "mem",
-	.map_base = 0xa0000000,
-	.size     = 128 * 1024 * 1024,
-	.platform_data = &ram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
 
 static struct fec_platform_data fec_info = {
@@ -66,11 +69,18 @@ struct imx_nand_platform_data nand_info = {
 };
 
 #ifdef CONFIG_USB
+static struct resource usbh2_dev_resources[] = {
+	[0] = {
+		.start	= IMX_OTG_BASE + 0x400,
+		.size	= 0x00000200,
+	},
+};
+
 static struct device_d usbh2_dev = {
 	.id	  = -1,
 	.name     = "ehci",
-	.map_base = IMX_OTG_BASE + 0x400,
-	.size     = 0x200,
+	.num_resources	= ARRAY_SIZE(usbh2_dev_resources),
+	.resource	= usbh2_dev_resources,
 };
 
 static void pca100_usbh_init(void)
@@ -217,11 +227,18 @@ static int pca100_devices_init(void)
 
 device_initcall(pca100_devices_init);
 
+static struct resource pca100_serial_resources[] = {
+	[0] = {
+		.start	= IMX_UART1_BASE,
+		.size	= 4096,
+	},
+};
+
 static struct device_d pca100_serial_device = {
 	.id	  = -1,
 	.name     = "imx_serial",
-	.map_base = IMX_UART1_BASE,
-	.size     = 4096,
+	.num_resources	= ARRAY_SIZE(pca100_serial_resources),
+	.resource	= pca100_serial_resources,
 };
 
 static int pca100_console_init(void)
arch/arm/boards/pm9261/init.c +18 -4
index 6fb14f7..0c8b0ae 100644
@@ -88,6 +88,13 @@ static void pm_add_device_nand(void)
  * DM9000 ethernet device
  */
 #if defined(CONFIG_DRIVER_NET_DM9000)
+static struct resource dm9000_dev_resources[] = {
+	[0] = {
+		.start	= AT91_CHIPSELECT_2,
+		.size	= 8,
+	},
+};
+
 static struct dm9000_platform_data dm9000_data = {
 	.iobase		= AT91_CHIPSELECT_2,
 	.iodata		= AT91_CHIPSELECT_2 + 4,
@@ -98,8 +105,8 @@ static struct dm9000_platform_data dm9000_data = {
 static struct device_d dm9000_dev = {
 	.id		= 0,
 	.name		= "dm9000",
-	.map_base	= AT91_CHIPSELECT_2,
-	.size		= 8,
+	.num_resources	= ARRAY_SIZE(dm9000_dev_resources),
+	.resource	= dm9000_dev_resources,
 	.platform_data	= &dm9000_data,
 };
 
@@ -136,11 +143,18 @@ static void __init pm_add_device_dm9000(void)
 static void __init ek_add_device_dm9000(void) {}
 #endif /* CONFIG_DRIVER_NET_DM9000 */
 
+static struct resource cfi_dev_resources[] = {
+	[0] = {
+		.start	= AT91_CHIPSELECT_0,
+		.size	= 4 * 1024 * 1024,
+	},
+};
+
 static struct device_d cfi_dev = {
 	.id		= 0,
 	.name		= "cfi_flash",
-	.map_base	= AT91_CHIPSELECT_0,
-	.size		= 4 * 1024 * 1024,
+	.num_resources	= ARRAY_SIZE(cfi_dev_resources),
+	.resource	= cfi_dev_resources,
 };
 
 static int pm9261_devices_init(void)
arch/arm/boards/pm9263/init.c +9 -2
index abe8def..ff4f6f6 100644
@@ -86,11 +86,18 @@ static void pm_add_device_nand(void)
 	at91_add_device_nand(&nand_pdata);
 }
 
+static struct resource cfi_dev_resources[] = {
+	[0] = {
+		.start	= AT91_CHIPSELECT_0,
+		.size	= 4 * 1024 * 1024,
+	},
+};
+
 static struct device_d cfi_dev = {
 	.id	  = -1,
 	.name     = "cfi_flash",
-	.map_base = AT91_CHIPSELECT_0,
-	.size     = 4 * 1024 * 1024,
+	.num_resources	= ARRAY_SIZE(cfi_dev_resources),
+	.resource	= cfi_dev_resources,
 };
 
 static struct at91_ether_platform_data macb_pdata = {
arch/arm/boards/scb9328/scb9328.c +36 -13

83 lines not on this page · raw message

arch/arm/lib/armlinux.c +2 -2
index f826da6..d1f8281 100644
@@ -78,8 +78,8 @@ static void setup_memory_tags(void)
 		params->hdr.tag = ATAG_MEM;
 		params->hdr.size = tag_size(tag_mem32);
 
-		params->u.mem.start = mem->dev->map_base;
-		params->u.mem.size = mem->dev->size;
+		params->u.mem.start = dev_resource_get_start(mem->dev);
+		params->u.mem.size = dev_resource_get_size(mem->dev);
 
 		params = tag_next(params);
 	}
arch/arm/mach-at91/at91sam9260_devices.c +90 -24

209 lines not on this page · raw message

arch/arm/mach-at91/at91sam9261_devices.c +54 -16

129 lines not on this page · raw message

arch/arm/mach-at91/at91sam9263_devices.c +63 -18

149 lines not on this page · raw message

arch/arm/mach-at91/at91sam9g45_devices.c +72 -20

169 lines not on this page · raw message

arch/arm/mach-imx/devices.c +2 -2
index 11cf2a4..e89f8bb 100644
@@ -9,8 +9,8 @@ static struct device_d *imx_add_device(char *name, int id, void *base, int size,
 	dev = xzalloc(sizeof(*dev));
 	strcpy(dev->name,name);
 	dev->id = id;
-	dev->map_base = (unsigned long)base;
-	dev->size = size;
+	dev_resource_set_start(dev, (unsigned long)base);
+	dev_resource_set_size(dev, (unsigned long)size);
 	dev->platform_data = pdata;
 
 	register_device(dev);
arch/arm/mach-imx/iim.c +12 -5
index 0774ebb..ce3dc7a 100644
@@ -89,18 +89,22 @@ static ssize_t imx_iim_read(struct cdev *cdev, void *buf, size_t count,
 
 	size = min((ulong)count, dev->size - offset);
 	if (explicit_sense) {
+		resource_size_t map_base = dev_resource_get_start(dev->parent);
+
 		for (i = 0; i < size; i++) {
 			int row_val;
 
-			row_val = do_fuse_sense(dev->parent->map_base,
-				dev->id, (offset+i)*4);
+			row_val = do_fuse_sense(map_base, dev->id,
+						(offset+i)*4);
 			if (row_val < 0)
 				return row_val;
 			((u8 *)buf)[i] = (u8)row_val;
 		}
 	} else {
+		resource_size_t map_base = dev_resource_get_start(dev);
+
 		for (i = 0; i < size; i++)
-			((u8 *)buf)[i] = ((u8 *)dev->map_base)[(offset+i)*4];
+			((u8 *)buf)[i] = ((u8 *)map_base)[(offset+i)*4];
 	}
 
 	return size;
@@ -186,9 +190,10 @@ static ssize_t imx_iim_write(struct cdev *cdev, const void *buf, size_t count,
 #ifdef CONFIG_IMX_IIM_FUSE_BLOW
 	if (blow_enable) {
 		for (i = 0; i < size; i++) {
+			resource_size_t map_base = dev_resource_get_start(dev-parent);
 			int ret;
 
-			ret = do_fuse_blow(dev->parent->map_base, dev->id,
+			ret = do_fuse_blow(map_base, dev->id,
 					(offset+i)*4, ((u8 *)buf)[i]);
 			if (ret < 0)
 				return ret;
@@ -196,8 +201,10 @@ static ssize_t imx_iim_write(struct cdev *cdev, const void *buf, size_t count,
 	} else
 #endif /* CONFIG_IMX_IIM_FUSE_BLOW */
 	{
+		resource_size_t map_base = dev_resource_get_start(dev);
+	
 		for (i = 0; i < size; i++)
-			((u8 *)dev->map_base)[(offset+i)*4] = ((u8 *)buf)[i];
+			((u8 *)map_base)[(offset+i)*4] = ((u8 *)buf)[i];
 	}
 
 	return size;
arch/arm/mach-imx/imx25.c +35 -7

70 lines not on this page · raw message

arch/arm/mach-nomadik/8815.c +27 -10
index 5844c68..74bbb94 100644
@@ -31,37 +31,54 @@ static struct clk st8815_clk_48 = {
        .rate = 48 * 1000 * 1000,
 };
 
-static struct memory_platform_data ram_pdata = {
-	.name = "ram0",
-	.flags = DEVFS_RDWR,
+static struct resource sdram_dev_resources[] = {
+	[0] = {
+		.name	= "ram0",
+		.start	= 0x00000000,
+		.flags	= DEVFS_RDWR,
+	},
 };
 
 static struct device_d sdram_dev = {
 	.id = -1,
 	.name = "mem",
-	.map_base = 0x00000000,
-	.platform_data = &ram_pdata,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
 
 void st8815_add_device_sdram(u32 size)
 {
-	sdram_dev.size = size;
+	dev_resource_set_size(&sdram_dev, size);
 	register_device(&sdram_dev);
 	armlinux_add_dram(&sdram_dev);
 }
 
+static struct resource uart0_serial_resources[] = {
+	[0] = {
+		.start	= NOMADIK_UART0_BASE,
+		.size	= 4096,
+	},
+};
+
 static struct device_d uart0_serial_device = {
 	.id = 0,
 	.name = "uart-pl011",
-	.map_base = NOMADIK_UART0_BASE,
-	.size = 4096,
+	.num_resources	= ARRAY_SIZE(uart0_serial_resources),
+	.resource	= uart0_serial_resources,
+};
+
+static struct resource uart1_serial_resources[] = {
+	[0] = {
+		.start	= NOMADIK_UART1_BASE,
+		.size	= 4096,
+	},
 };
 
 static struct device_d uart1_serial_device = {
 	.id = 1,
 	.name = "uart-pl011",
-	.map_base = NOMADIK_UART1_BASE,
-	.size = 4096,
+	.num_resources	= ARRAY_SIZE(uart1_serial_resources),
+	.resource	= uart1_serial_resources,
 };
 
 void st8815_register_uart(unsigned id)
arch/blackfin/boards/ipe337/ipe337.c +36 -12

78 lines not on this page · raw message

arch/m68k/boards/kp_ukd_r1_num/kp_ukd_r1_num.c +76 -26

16 lines not on this page · raw message

arch/m68k/boards/phycore_mcf54xx/phyCore_MCF54xx.c +50 -22

72 lines not on this page · raw message

arch/ppc/boards/pcm030/pcm030.c +46 -15

61 lines not on this page · raw message

arch/sandbox/board/hostfile.c +2 -2
index 38a52a8..30581c7 100644

Lines of this file are not shown. View the raw message.

arch/sandbox/mach-sandbox/include/mach/hostfile.h +8 -2
index f7aca7c..bd89e48 100644

Lines of this file are not shown. View the raw message.

arch/sandbox/os/common.c +2 -2
index 287be0d..c814751 100644

Lines of this file are not shown. View the raw message.

arch/x86/boards/x86_generic/generic_pc.c +21 -11
index b9c31aa..9b5fc4e 100644

Lines of this file are not shown. View the raw message.

commands/mem.c +12 -9
index 73bf915..05956ab 100644

Lines of this file are not shown. View the raw message.

common/startup.c +8 -5
index 84a59c5..b8852ef 100644

Lines of this file are not shown. View the raw message.

drivers/ata/bios.c +2 -2
index 51e2425..7601de2 100644

Lines of this file are not shown. View the raw message.

drivers/ata/disk_drive.c +7 -6
index a54429a..78640b2 100644

Lines of this file are not shown. View the raw message.

drivers/i2c/busses/i2c-imx.c +11 -11
index 266cb52..e69c827 100644

Lines of this file are not shown. View the raw message.

drivers/i2c/busses/i2c-omap.c +2 -2
index 8e7a8b5..2c48bba 100644

Lines of this file are not shown. View the raw message.

drivers/mci/imx-esdhc.c +1 -1
index 63cd059..38ea57f 100644

Lines of this file are not shown. View the raw message.

drivers/mci/imx.c +2 -1
index 8525692..af7090d 100644

Lines of this file are not shown. View the raw message.

drivers/mci/mci-core.c +2 -2
index a8aa486..ae78ddc 100644

Lines of this file are not shown. View the raw message.

drivers/mci/s3c.c +60 -46

106 lines not on this page · raw message

drivers/mci/stm378x.c +47 -32

79 lines not on this page · raw message

drivers/mtd/nand/atmel_nand.c +1 -1
index e8f85fc..b6b72ad 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/nand/nand_imx.c +1 -1
index 63ba188..dbd9d01 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/nand/nand_omap_gpmc.c +10 -3
index 7c9bc32..e65c053 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/nand/nand_s3c2410.c +2 -2
index b989583..c487f9c 100644

Lines of this file are not shown. View the raw message.

drivers/net/cs8900.c +1 -1
index 8120877..6701eb0 100644

Lines of this file are not shown. View the raw message.

drivers/net/fec_imx.c +1 -1
index 9c8de77..e6aa792 100644

Lines of this file are not shown. View the raw message.

drivers/net/fec_mpc5200.c +1 -1
index 8b2cb4d..bebc05e 100644

Lines of this file are not shown. View the raw message.

drivers/net/macb.c +1 -1
index df3b6af..34e77d2 100644

Lines of this file are not shown. View the raw message.

drivers/net/smc91111.c +1 -1
index 605a7d8..3f28211 100644

Lines of this file are not shown. View the raw message.

drivers/net/smc911x.c +5 -4
index b559590..1339469 100644

Lines of this file are not shown. View the raw message.

drivers/nor/cfi_flash.c +18 -13
index fa5e5ee..78db1d8 100644

Lines of this file are not shown. View the raw message.

drivers/serial/amba-pl011.c +16 -16
index bc9b0de..d44f903 100644

Lines of this file are not shown. View the raw message.

drivers/serial/atmel.c +15 -14
index b99ec4d..7a35c73 100644

Lines of this file are not shown. View the raw message.

drivers/serial/serial_imx.c +1 -1
index a7562f9..fb881fc 100644

Lines of this file are not shown. View the raw message.

drivers/serial/serial_mpc5xxx.c +10 -10
index 2509708..e3652ca 100644

Lines of this file are not shown. View the raw message.

drivers/serial/serial_netx.c +17 -17
index 7c09519..9358e3b 100644

Lines of this file are not shown. View the raw message.

drivers/serial/serial_ns16550.c +6 -6
index 290619f..21f862e 100644

Lines of this file are not shown. View the raw message.

drivers/serial/serial_pl010.c +10 -5
index 1a6366f..746eaf3 100644

Lines of this file are not shown. View the raw message.

drivers/serial/serial_s3c24x0.c +18 -18
index fedddd3..f0e96ba 100644

Lines of this file are not shown. View the raw message.

drivers/serial/stm-serial.c +23 -21

44 lines not on this page · raw message

drivers/spi/imx_spi.c +1 -1
index 2ad1bfa..b37516e 100644

Lines of this file are not shown. View the raw message.

drivers/usb/gadget/fsl_udc.c +1 -1
index 48fd0b5..6ea5818 100644

Lines of this file are not shown. View the raw message.

drivers/usb/host/ehci-hcd.c +5 -4
index 802c548..630d2c7 100644

Lines of this file are not shown. View the raw message.

drivers/video/fb.c +2 -2
index f9a425e..ce01ca6 100644

Lines of this file are not shown. View the raw message.

drivers/video/imx-ipu-fb.c +1 -1
index c38082d..aec2f4c 100644

Lines of this file are not shown. View the raw message.

drivers/video/imx.c +1 -1
index ac51858..5b1fd9d 100644

Lines of this file are not shown. View the raw message.

fs/devfs.c +1 -1
index 7019c8d..8b8e96e 100644

Lines of this file are not shown. View the raw message.

fs/fs.c +9 -5
index 3b5f284..74d654b 100644

Lines of this file are not shown. View the raw message.

include/driver.h +38 -10

48 lines not on this page · raw message

include/linux/ioport.h new file +115 -0

115 lines not on this page · raw message

lib/driver.c +4 -3
index ff92e44..a383e9b 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 7 lines
1.7.1


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

Part of the diff is not shown here. View the raw message.

maintainer
#2 lore raw

Re: [PATCH 1/5] device: introduce resource structure to simplify resource delaration

Hi J,

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

introdude also some helper to manager them

and add multi resource per device support

ram device: use resource structure instead of memory_platform_data

You shouldn't use a resource_size_t type to access registers. This will lead to problems when we start to support 64bit resource sizes. Instead we should introduce a

#define resource_size_to_iomem(size) (void __force __iomem *)(size)

macro which does the conversion to a void __iomem * type. In a more advanced version this could also spit a warning when the resource start is bigger than a pointer type. As an additional plus we'll get rid of some sparse warnings where map_base is used for readl/writel.

arch/arm/mach-imx/devices.c static struct device_d *imx_add_device(char *name, int id, void *base, int size, · line 14

Quoted 13 lines
arch/arm/mach-imx/devices.c +2 -2
index 11cf2a4..e89f8bb 100644
@@ -9,8 +9,8 @@ static struct device_d *imx_add_device(char *name, int id, void *base, int size,
 	dev = xzalloc(sizeof(*dev));
 	strcpy(dev->name,name);
 	dev->id = id;
-	dev->map_base = (unsigned long)base;
-	dev->size = size;
+	dev_resource_set_start(dev, (unsigned long)base);
+	dev_resource_set_size(dev, (unsigned long)size);
 	dev->platform_data = pdata;

Should be a cast to resource_size_t.

Quoted 27 lines
include/driver.h +3 -5
index b9edca0..c7dce1e 100644
@@ -24,6 +24,7 @@
 #define DRIVER_H
 
 #include <linux/list.h>
+#include <linux/ioport.h>
 
 #define MAX_DRIVER_NAME		32
 #define FORMAT_DRIVER_MANE_ID	"%s%d"
@@ -70,11 +71,8 @@ struct device_d {
 	 * something like eth0 or nor0. */
 	int id;
 
-	resource_size_t size;
-
-	/*! For devices which are directly mapped into memory, i.e. NOR
-	 * Flash or SDRAM. */
-	resource_size_t map_base;
+	struct resource *resource;
+	int num_resources;
 
 	void *platform_data; /*! board specific information about this device */
 

include/driver.h static inline const char *dev_name(const struct device_d *dev) · line 185

Quoted 4 lines
include/driver.h +1 -0
@@ -184,6 +182,41 @@ static inline const char *dev_name(const struct device_d *dev)
 	return dev_id(dev);
 }
 
+/* ressource helper */

s/ressource/resource/

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
#3 lore raw

Re: [PATCH 1/5] device: introduce resource structure to simplify resource delaration

Quoted 7 lines · Sascha Hauer

Hi J,

Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD

introdude also some helper to manager them

and add multi resource per device support

Quoted 7 lines
Quoted 3 lines

ram device: use resource structure instead of memory_platform_data

You shouldn't use a resource_size_t type to access registers. This will lead to problems when we start to support 64bit resource sizes

no as resource_size_t is 64 bit aware

Quoted 8 lines

. Instead we should introduce a

#define resource_size_to_iomem(size) (void __force __iomem *)(size)

macro which does the conversion to a void __iomem * type. In a more advanced version this could also spit a warning when the resource start is bigger than a pointer type. As an additional plus we'll get rid of some sparse warnings where map_base is used for readl/writel.

we do not do in the kernel and do see the advantage here for the ressource in mind it's in the drivers we need to do it
if necessary

Quoted 17 lines
Quoted 7 lines
arch/arm/mach-imx/devices.c +0 -0
index 11cf2a4..e89f8bb 100644

arch/arm/mach-imx/devices.c static struct device_d *imx_add_device(char *name, int id, void *base, int size, · line 14

Quoted 8 lines
arch/arm/mach-imx/devices.c +2 -2
@@ -9,8 +9,8 @@ static struct device_d *imx_add_device(char *name, int id, void *base, int size,
 	dev = xzalloc(sizeof(*dev));
 	strcpy(dev->name,name);
 	dev->id = id;
-	dev->map_base = (unsigned long)base;
-	dev->size = size;
+	dev_resource_set_start(dev, (unsigned long)base);
+	dev_resource_set_size(dev, (unsigned long)size);
 	dev->platform_data = pdata;

Should be a cast to resource_size_t.

yeah

Best Regards,
J.

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

maintainer
#4 lore raw

Re: [PATCH 1/5] device: introduce resource structure to simplify resource delaration

Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines · Sascha Hauer

Hi J,

Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD

introdude also some helper to manager them

and add multi resource per device support

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

ram device: use resource structure instead of memory_platform_data

You shouldn't use a resource_size_t type to access registers. This will lead to problems when we start to support 64bit resource sizes

no as resource_size_t is 64 bit aware

And exactly this is the problem. void * is usually only 32bit on arm. This will lead to compiler warnings and sparse isn't happy about unsigned long in readl/writel anyway.

Quoted 11 lines
Quoted 8 lines

. Instead we should introduce a

#define resource_size_to_iomem(size) (void __force __iomem *)(size)

macro which does the conversion to a void __iomem * type. In a more advanced version this could also spit a warning when the resource start is bigger than a pointer type. As an additional plus we'll get rid of some sparse warnings where map_base is used for readl/writel.

we do not do in the kernel and do see the advantage here for the ressource in mind it's in the drivers we need to do it
if necessary

resource_size_t is never passed to readl/writel in the kernel.

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
#5 lore raw

Re: [PATCH 1/5] device: introduce resource structure to simplify resource delaration

Quoted 14 lines · Sascha Hauer
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines · Sascha Hauer

Hi J,

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

introdude also some helper to manager them

and add multi resource per device support

ram device: use resource structure instead of memory_platform_data

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

You shouldn't use a resource_size_t type to access registers. This will lead to problems when we start to support 64bit resource sizes

no as resource_size_t is 64 bit aware

And exactly this is the problem. void * is usually only 32bit on arm. This will lead to compiler warnings and sparse isn't happy about unsigned long in readl/writel anyway.

IIRC on arm resource_size_t is never 64bit at least on the current ARMvx

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

. Instead we should introduce a

#define resource_size_to_iomem(size) (void __force __iomem *)(size)

macro which does the conversion to a void __iomem * type. In a more advanced version this could also spit a warning when the resource start is bigger than a pointer type. As an additional plus we'll get rid of some sparse warnings where map_base is used for readl/writel.

Quoted 5 lines
Quoted 3 lines

we do not do in the kernel and do see the advantage here for the ressource in mind it's in the drivers we need to do it
if necessary

resource_size_t is never passed to readl/writel in the kernel.

yeah but the resources are cast in the drivers

Best Regards,
J.

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

#6 lore raw

Re: [PATCH 1/5] device: introduce resource structure to simplify resource delaration

Quoted 33 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 14 lines · Sascha Hauer
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines · Sascha Hauer

Hi J,

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

introdude also some helper to manager them

and add multi resource per device support

ram device: use resource structure instead of memory_platform_data

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

You shouldn't use a resource_size_t type to access registers. This will lead to problems when we start to support 64bit resource sizes

no as resource_size_t is 64 bit aware

And exactly this is the problem. void * is usually only 32bit on arm. This will lead to compiler warnings and sparse isn't happy about unsigned long in readl/writel anyway.

IIRC on arm resource_size_t is never 64bit at least on the current ARMvx

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

. Instead we should introduce a

#define resource_size_to_iomem(size) (void __force __iomem *)(size)

macro which does the conversion to a void __iomem * type. In a more advanced version this could also spit a warning when the resource start is bigger than a pointer type. As an additional plus we'll get rid of some sparse warnings where map_base is used for readl/writel.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

we do not do in the kernel and do see the advantage here for the ressource in mind it's in the drivers we need to do it
if necessary

resource_size_t is never passed to readl/writel in the kernel.

yeah but the resources are cast in the drivers

I check on x86 and void is 4 byte on 32bit and 8bytes on 64bit

Best Regards,
J.

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

#7 lore raw

Re: [PATCH 1/5] device: introduce resource structure to simplify resource delaration

Quoted 34 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 33 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 14 lines · Sascha Hauer
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines · Sascha Hauer

Hi J,

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

introdude also some helper to manager them

and add multi resource per device support

ram device: use resource structure instead of memory_platform_data

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

You shouldn't use a resource_size_t type to access registers. This will lead to problems when we start to support 64bit resource sizes

no as resource_size_t is 64 bit aware

And exactly this is the problem. void * is usually only 32bit on arm. This will lead to compiler warnings and sparse isn't happy about unsigned long in readl/writel anyway.

IIRC on arm resource_size_t is never 64bit at least on the current ARMvx

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

. Instead we should introduce a

#define resource_size_to_iomem(size) (void __force __iomem *)(size)

macro which does the conversion to a void __iomem * type. In a more advanced version this could also spit a warning when the resource start is bigger than a pointer type. As an additional plus we'll get rid of some sparse warnings where map_base is used for readl/writel.

Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

we do not do in the kernel and do see the advantage here for the ressource in mind it's in the drivers we need to do it
if necessary

resource_size_t is never passed to readl/writel in the kernel.

yeah but the resources are cast in the drivers

I check on x86 and void is 4 byte on 32bit and 8bytes on 64bit

I check on x86 and void* is 4 byte on 32bit and 8bytes on 64bit

Best Regards,
J.

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

maintainer
#8 lore raw

Re: [PATCH 1/5] device: introduce resource structure to simplify resource delaration

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 16 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 14 lines · Sascha Hauer
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines · Sascha Hauer

Hi J,

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

introdude also some helper to manager them

and add multi resource per device support

ram device: use resource structure instead of memory_platform_data

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

You shouldn't use a resource_size_t type to access registers. This will lead to problems when we start to support 64bit resource sizes

no as resource_size_t is 64 bit aware

And exactly this is the problem. void * is usually only 32bit on arm. This will lead to compiler warnings and sparse isn't happy about unsigned long in readl/writel anyway.

IIRC on arm resource_size_t is never 64bit at least on the current ARMvx

Think of MMC/SD cards > 4G.

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
#9 lore raw

Re: [PATCH 1/5] device: introduce resource structure to simplify resource delaration

Quoted 19 lines · Sascha Hauer
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 17 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 16 lines · Sascha Hauer
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 14 lines · Sascha Hauer

Hi J,

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

introdude also some helper to manager them

and add multi resource per device support

ram device: use resource structure instead of memory_platform_data

You shouldn't use a resource_size_t type to access registers. This will lead to problems when we start to support 64bit resource sizes

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line

no as resource_size_t is 64 bit aware

And exactly this is the problem. void * is usually only 32bit on arm. This will lead to compiler warnings and sparse isn't happy about unsigned long in readl/writel anyway.

IIRC on arm resource_size_t is never 64bit at least on the current ARMvx

Think of MMC/SD cards > 4G.

ok but I do not see the import on the ressource for the drivers?

as it's runtime probed

Best Regards,
J.

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

maintainer
#10 lore raw

Re: [PATCH 1/5] device: introduce resource structure to simplify resource delaration

Quoted 22 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 21 lines · Sascha Hauer
Quoted 20 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 19 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 18 lines · Sascha Hauer
Quoted 16 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines · Sascha Hauer

Hi J,

Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD

introdude also some helper to manager them

and add multi resource per device support

Quoted 7 lines
Quoted 3 lines

ram device: use resource structure instead of memory_platform_data

You shouldn't use a resource_size_t type to access registers. This will lead to problems when we start to support 64bit resource sizes

no as resource_size_t is 64 bit aware

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

And exactly this is the problem. void * is usually only 32bit on arm. This will lead to compiler warnings and sparse isn't happy about unsigned long in readl/writel anyway.

IIRC on arm resource_size_t is never 64bit at least on the current ARMvx

Think of MMC/SD cards > 4G.

ok but I do not see the import on the ressource for the drivers?

Look at this excerpt from your patch:

@@ -675,10 +686,11 @@ static int mci_request(struct mci_host *mci_pdata, struct mci_cmd *cmd,

 {
        struct device_d *hw_dev = mci_pdata->hw_dev;
        int rc;

+ resource_size_t map_base = dev_resource_get_start(hw_dev);

        /* enable clock */

- writel(readl(hw_dev->map_base + SDICON) | SDICON_CLKEN,
- hw_dev->map_base + SDICON);
+ writel(readl(map_base + SDICON) | SDICON_CLKEN,
+ map_base + SDICON);

        if ((cmd->resp_type == 0) || (data == NULL))
                rc = s3c_mci_std_cmds(hw_dev, cmd);

You pass map_base which is of type resource_size_t to writel. Sparse will barf when the address is not a void __iomem *. Also, resource_size_t may be 64bit which is then implicitely casted to void *.

This is why it should look like this:

@@ -675,10 +686,11 @@ static int mci_request(struct mci_host *mci_pdata, struct mci_cmd *cmd,

 {
        struct device_d *hw_dev = mci_pdata->hw_dev;
        int rc;

+ void __iomem *map_base = TO_IOMEM(dev_resource_get_start(hw_dev));

        /* enable clock */

- writel(readl(hw_dev->map_base + SDICON) | SDICON_CLKEN,
- hw_dev->map_base + SDICON);
+ writel(readl(map_base + SDICON) | SDICON_CLKEN,
+ map_base + SDICON);

        if ((cmd->resp_type == 0) || (data == NULL))
                rc = s3c_mci_std_cmds(hw_dev, cmd);

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
maintainer
#11 lore raw

Re: [PATCH 1/5] device: introduce resource structure to simplify resource delaration

In reply to Jean-Christophe PLAGNIOL-VILLARD

Hi J,

Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD

introdude also some helper to manager them

and add multi resource per device support

ram device: use resource structure instead of memory_platform_data

I would like to split this up a bit more.

First patch could be adding include/linux/ioport.h. Then you can add users for the resources, like for example some drivers you care of, just enough to see how resources can be used. When we agree on this we can convert the bulk of the drivers step by step. Getting rid of dev->map_base would be the last step, but shouldn't be done in such a huge patch.

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
#12 lore raw

PATCH 2/5 mem: add multiple resource support

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 commands/mem.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)
commands/mem.c +13 -8
index 05956ab..d35c8c0 100644
@@ -589,18 +589,23 @@ static struct file_operations memops = {
 
 static int mem_probe(struct device_d *dev)
 {
-	struct resource *res = &dev->resource[0];
+	int i;
+	struct resource *res;
 	struct cdev *cdev;
 
-	cdev = xzalloc(sizeof (*cdev));
-	dev->priv = cdev;
+	for (i = 0; i < dev->num_resources; i++) {
+		res = &dev->resource[i];
 
-	cdev->name = (char*)res->name;
-	cdev->size = res->size;
-	cdev->ops = &memops;
-	cdev->dev = dev;
+		cdev = xzalloc(sizeof (*cdev));
+		dev->priv = cdev;
 
-	devfs_create(cdev);
+		cdev->name = (char*)res->name;
+		cdev->size = res->size;
+		cdev->ops = &memops;
+		cdev->dev = dev;
+
+		devfs_create(cdev);
+	}
 
 	return 0;
 }
Signature · 7 lines
1.7.1


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

PATCH 3/5 arm/setup_memory_tags: add multiple resource support

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/lib/armlinux.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
arch/arm/lib/armlinux.c +10 -5
index d1f8281..b74c5e8 100644
@@ -73,15 +73,20 @@ static LIST_HEAD(memory_list);
 static void setup_memory_tags(void)
 {
 	struct arm_memory *mem;
+	struct resource *res;
+	int i;
 
 	list_for_each_entry(mem, &memory_list, list) {
-		params->hdr.tag = ATAG_MEM;
-		params->hdr.size = tag_size(tag_mem32);
+		for (i = 0; i < mem->dev->num_resources; i++) {
+			res = &mem->dev->resource[i];
+			params->hdr.tag = ATAG_MEM;
+			params->hdr.size = tag_size(tag_mem32);
 
-		params->u.mem.start = dev_resource_get_start(mem->dev);
-		params->u.mem.size = dev_resource_get_size(mem->dev);
+			params->u.mem.start = res->start;
+			params->u.mem.size = res->size;
 
-		params = tag_next(params);
+			params = tag_next(params);
+		}
 	}
 }
 
Signature · 7 lines
1.7.1


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

PATCH 4/5 edb93xx: convert to multiple mem resources

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/boards/edb93xx/edb93xx.c |   68 +++++-------------------------------
 1 files changed, 10 insertions(+), 58 deletions(-)
arch/arm/boards/edb93xx/edb93xx.c +10 -58
index 36cbb51..01ff2b5 100644
@@ -52,75 +52,45 @@ static struct device_d cfi_dev = {
 	.resource	= cfi_dev_resources,
 };
 
-static struct resource sdram0_dev_resources[] = {
+static struct resource sdram_dev_resources[] = {
 	[0] = {
 		.name	= "ram0",
 		.start	= CONFIG_EP93XX_SDRAM_BANK0_BASE,
 		.size	= CONFIG_EP93XX_SDRAM_BANK0_SIZE,
 		.flags = DEVFS_RDWR,
 	},
-};
-
-static struct device_d sdram0_dev = {
-	.id	  = -1,
-	.name     = "mem",
-	.num_resources	= ARRAY_SIZE(sdram0_dev_resources),
-	.resource	= sdram0_dev_resources,
-};
-
 #if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 2)
-static struct resource sdram1_dev_resources[] = {
-	[0] = {
+	[1] = {
 		.name	= "ram1",
 		.start	= CONFIG_EP93XX_SDRAM_BANK1_BASE,
 		.size	= CONFIG_EP93XX_SDRAM_BANK1_SIZE,
 		.flags	= DEVFS_RDWR,
 	},
-};
-
-static struct device_d sdram1_dev = {
-	.id	  = -1,
-	.name     = "mem",
-	.num_resources	= ARRAY_SIZE(sdram1_dev_resources),
-	.resource	= sdram1_dev_resources,
-};
 #endif
-
 #if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 3)
-static struct resource sdram2_dev_resources[] = {
-	[0] = {
+	[2] = {
 		.name	= "ram2",
 		.start	= CONFIG_EP93XX_SDRAM_BANK2_BASE,
 		.size	= CONFIG_EP93XX_SDRAM_BANK2_SIZE,
 		.flags	= DEVFS_RDWR,
 	},
-};
-
-static struct device_d sdram2_dev = {
-	.id	  = -1,
-	.name     = "mem",
-	.num_resources	= ARRAY_SIZE(sdram2_dev_resources),
-	.resource	= sdram2_dev_resources,
-};
 #endif
-
 #if (CONFIG_EP93XX_SDRAM_NUM_BANKS == 4)
-static struct resource sdram3_dev_resources[] = {
-	[0] = {
+	[3] = {
 		.name	= "ram3",
 		.start	= CONFIG_EP93XX_SDRAM_BANK3_BASE,
 		.size	= CONFIG_EP93XX_SDRAM_BANK3_SIZE,
 		.flags	= DEVFS_RDWR,
 	},
+#endif
 };
 
-static struct device_d sdram3_dev = {
+static struct device_d sdram_dev = {
 	.id	  = -1,
 	.name     = "mem",
-	.num_resources	= ARRAY_SIZE(sdram3_dev_resources),
-	.resource	= sdram3_dev_resources,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
-#endif
 
 static struct device_d eth_dev = {
 	.id	  = -1,
@@ -140,27 +110,9 @@ static int ep93xx_devices_init(void)
 
 	protect_file("/dev/env0", 1);
 
-	register_device(&sdram0_dev);
-#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 2)
-	register_device(&sdram1_dev);
-#endif
-#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 3)
-	register_device(&sdram2_dev);
-#endif
-#if (CONFIG_EP93XX_SDRAM_NUM_BANKS == 4)
-	register_device(&sdram3_dev);
-#endif
+	register_device(&sdram_dev);
 
-	armlinux_add_dram(&sdram0_dev);
-#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 2)
-	armlinux_add_dram(&sdram1_dev);
-#endif
-#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >= 3)
-	armlinux_add_dram(&sdram2_dev);
-#endif
-#if (CONFIG_EP93XX_SDRAM_NUM_BANKS == 4)
-	armlinux_add_dram(&sdram3_dev);
-#endif
+	armlinux_add_dram(&sdram_dev);
 
 	register_device(&eth_dev);
 
Signature · 7 lines
1.7.1


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

PATCH 5/5 pcm037: convert to multiple mem resources

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/boards/pcm037/pcm037.c |   45 ++++++++++++--------------------------
 1 files changed, 14 insertions(+), 31 deletions(-)
arch/arm/boards/pcm037/pcm037.c +14 -31
index 38725a2..a1783af 100644
@@ -102,46 +102,35 @@ static struct device_d network_dev = {
 #define SDRAM0	256
 #endif
 
-static struct resource sdram0_dev_resources[] = {
-	[0] = {
-		.name	= "ram0",
-		.start	= IMX_SDRAM_CS0,
-		.size	= SDRAM0 * 1024 * 1024,	/* fix size */
-		.flags	= DEVFS_RDWR,
-	},
-};
-
-static struct device_d sdram0_dev = {
-	.id	  = -1,
-	.name     = "mem",
-	.num_resources	= ARRAY_SIZE(sdram0_dev_resources),
-	.resource	= sdram0_dev_resources,
-};
-
-#ifndef CONFIG_PCM037_SDRAM_BANK1_NONE
-
 #if defined CONFIG_PCM037_SDRAM_BANK1_128MB
 #define SDRAM1	128
 #elif defined CONFIG_PCM037_SDRAM_BANK1_256MB
 #define SDRAM1	256
 #endif
 
-static struct resource sdram1_dev_resources[] = {
+static struct resource sdram_dev_resources[] = {
 	[0] = {
+		.name	= "ram0",
+		.start	= IMX_SDRAM_CS0,
+		.size	= SDRAM0 * 1024 * 1024,	/* fix size */
+		.flags	= DEVFS_RDWR,
+	},
+#ifndef CONFIG_PCM037_SDRAM_BANK1_NONE
+	[1] = {
 		.name	= "ram1",
 		.start	= IMX_SDRAM_CS1,
 		.size	= SDRAM1 * 1024 * 1024,	/* fix size */
 		.flags	= DEVFS_RDWR,
 	},
+#endif
 };
 
-static struct device_d sdram1_dev = {
+static struct device_d sdram_dev = {
 	.id	  = -1,
 	.name     = "mem",
-	.num_resources	= ARRAY_SIZE(sdram1_dev_resources),
-	.resource	= sdram1_dev_resources,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
-#endif
 
 struct imx_nand_platform_data nand_info = {
 	.width = 1,
@@ -328,20 +317,14 @@ static int imx31_devices_init(void)
 	imx31_add_nand(&nand_info);
 	register_device(&network_dev);
 
-	register_device(&sdram0_dev);
-#ifndef CONFIG_PCM037_SDRAM_BANK1_NONE
-	register_device(&sdram1_dev);
-#endif
+	register_device(&sdram_dev);
 #ifdef CONFIG_USB
 	pcm037_usb_init();
 	register_device(&usbotg_dev);
 	register_device(&usbh2_dev);
 #endif
 
-	armlinux_add_dram(&sdram0_dev);
-#ifndef CONFIG_PCM037_SDRAM_BANK1_NONE
-	armlinux_add_dram(&sdram1_dev);
-#endif
+	armlinux_add_dram(&sdram_dev);
 	armlinux_set_bootparams((void *)0x80000100);
 	armlinux_set_architecture(MACH_TYPE_PCM037);
 
Signature · 7 lines
1.7.1


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

PATCH 1/2 mem: multiple resource support allow exclude a resource

In reply to Jean-Christophe PLAGNIOL-VILLARD

introduce DEVFS_MEM_BAREBOX_ONLY for this purpose

---
 arch/arm/lib/armlinux.c |    4 ++++
 include/driver.h        |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/lib/armlinux.c +4 -0
index b74c5e8..55d1401 100644
@@ -79,6 +79,10 @@ static void setup_memory_tags(void)
 	list_for_each_entry(mem, &memory_list, list) {
 		for (i = 0; i < mem->dev->num_resources; i++) {
 			res = &mem->dev->resource[i];
+
+			if (res->flags & DEVFS_MEM_BAREBOX_ONLY)
+				break;
+
 			params->hdr.tag = ATAG_MEM;
 			params->hdr.size = tag_size(tag_mem32);
 
include/driver.h +1 -0
index c7dce1e..e98455c 100644
@@ -354,6 +354,7 @@ ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, ulong offse
 #define DEVFS_PARTITION_READONLY	(1 << 1)
 #define DEVFS_IS_PARTITION		(1 << 2)
 #define DEVFS_RDWR			(1 << 3)
+#define DEVFS_MEM_BAREBOX_ONLY		(1 << 4)
 
 int devfs_add_partition(const char *devname, unsigned long offset, size_t size,
 		int flags, const char *name);
Signature · 7 lines
1.7.1


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

Re: [PATCH 1/2] mem: multiple resource support allow exclude a resource

Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD

introduce DEVFS_MEM_BAREBOX_ONLY for this purpose

---
 arch/arm/lib/armlinux.c |    4 ++++
 include/driver.h        |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/lib/armlinux.c +0 -0
index b74c5e8..55d1401 100644

arch/arm/lib/armlinux.c static void setup_memory_tags(void) · line 84

Quoted 6 lines
arch/arm/lib/armlinux.c +3 -0
@@ -79,6 +79,10 @@ static void setup_memory_tags(void)
 	list_for_each_entry(mem, &memory_list, list) {
 		for (i = 0; i < mem->dev->num_resources; i++) {
 			res = &mem->dev->resource[i];
+
+			if (res->flags & DEVFS_MEM_BAREBOX_ONLY)
+				break;

Shouldn't this be a 'continue'?

include/driver.h ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, ulong offse · line 357

Quoted 13 lines
arch/arm/lib/armlinux.c +1 -0
+
 			params->hdr.tag = ATAG_MEM;
 			params->hdr.size = tag_size(tag_mem32);
 
include/driver.h +1 -0
index c7dce1e..e98455c 100644
@@ -354,6 +354,7 @@ ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, ulong offse
 #define DEVFS_PARTITION_READONLY	(1 << 1)
 #define DEVFS_IS_PARTITION		(1 << 2)
 #define DEVFS_RDWR			(1 << 3)
+#define DEVFS_MEM_BAREBOX_ONLY		(1 << 4)

I realize this when looking at this patch: You should abuse the flags field in a resource pass custom bits. The only flags in a resource should be the ones defined in include/linux/ioport.h.
With DEVFS_RDWR you are lucky, there is a IORESOURCE_MEM_WRITEABLE flag which can be used for this purpose. There is no correspondent flag for DEVFS_MEM_BAREBOX_ONLY though.

Overall I'm not very happy with the multiple-resources-to-mem-driver approach. If you are concerned with the overhead of multiple statically allocated devices we could introduce a add_memory_device(char *name, void *start, size_t size, unsigned long flags) function which dynamically allocates a device.

I'm also not convinced that these few multiple statically allocated devices introduce an overhead at all, I mean most boards only have SDRAM (one device) and maybe an SRAM (second device).

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
#18 lore raw

Re: [PATCH 1/2] mem: multiple resource support allow exclude a resource

Quoted 9 lines · Sascha Hauer
Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD

introduce DEVFS_MEM_BAREBOX_ONLY for this purpose

---
 arch/arm/lib/armlinux.c |    4 ++++
 include/driver.h        |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)
Quoted 13 lines

arch/arm/lib/armlinux.c static void setup_memory_tags(void) · line 84

Quoted 11 lines
arch/arm/lib/armlinux.c +3 -0
index b74c5e8..55d1401 100644
@@ -79,6 +79,10 @@ static void setup_memory_tags(void)
 	list_for_each_entry(mem, &memory_list, list) {
 		for (i = 0; i < mem->dev->num_resources; i++) {
 			res = &mem->dev->resource[i];
+
+			if (res->flags & DEVFS_MEM_BAREBOX_ONLY)
+				break;

Shouldn't this be a 'continue'?

yeap

Quoted 5 lines
Quoted 5 lines
arch/arm/lib/armlinux.c +1 -0
+
 			params->hdr.tag = ATAG_MEM;
 			params->hdr.size = tag_size(tag_mem32);
 
Quoted 16 lines

include/driver.h ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, ulong offse · line 357

Quoted 9 lines
include/driver.h +1 -0
index c7dce1e..e98455c 100644
@@ -354,6 +354,7 @@ ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, ulong offse
 #define DEVFS_PARTITION_READONLY	(1 << 1)
 #define DEVFS_IS_PARTITION		(1 << 2)
 #define DEVFS_RDWR			(1 << 3)
+#define DEVFS_MEM_BAREBOX_ONLY		(1 << 4)

I realize this when looking at this patch: You should abuse the flags field in a resource pass custom bits. The only flags in a resource should be the ones defined in include/linux/ioport.h.
With DEVFS_RDWR you are lucky, there is a IORESOURCE_MEM_WRITEABLE flag which can be used for this purpose. There is no correspondent flag for DEVFS_MEM_BAREBOX_ONLY though.

ok I'll update

Quoted 10 lines

Overall I'm not very happy with the multiple-resources-to-mem-driver approach. If you are concerned with the overhead of multiple statically allocated devices we could introduce a add_memory_device(char *name, void *start, size_t size, unsigned long flags) function which dynamically allocates a device.

I'm also not convinced that these few multiple statically allocated devices introduce an overhead at all, I mean most boards only have SDRAM (one device) and maybe an SRAM (second device).

no preference just want to avoid multiple device but if u prefer I let it as is

Best Regards,
J.

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

#19 lore raw
In reply to Jean-Christophe PLAGNIOL-VILLARD

Hi,

update version + two patches against current next

The following changes since commit f90e136aa22ab13a3a8a321ae00e013d489a9f81:

Merge branch 'master' into next (2010-11-17 10:23:56 +0100)

are available in the git repository at:

git://git.jcrosoft.org/barebox.git mem

Jean-Christophe PLAGNIOL-VILLARD (7):
device: introduce resource structure to simplify resource delaration
mem: add multiple resource support
arm/setup_memory_tags: add multiple resource support
edb93xx: convert to multiple mem resources
pcm037: convert to multiple mem resources
mem: multiple resource support allow exclude a resource
mem: convert to DEVFS_MEM_BAREBOX_ONLY for freescale-mx25-3-stack/pcm037/pvm038

 Documentation/porting.txt                         |   11 ++-
 arch/arm/boards/a9m2410/a9m2410.c                 |   61 +++++++---
 arch/arm/boards/a9m2440/a9m2440.c                 |   48 ++++++--
 arch/arm/boards/at91sam9261ek/init.c              |   11 ++-
 arch/arm/boards/at91sam9263ek/init.c              |   11 ++-
 arch/arm/boards/chumby_falconwing/falconwing.c    |   37 +++++--
 arch/arm/boards/edb93xx/edb93xx.c                 |  120 ++++++++------------
 arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c |   37 +++++--
 arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c |   74 ++++++++++---
 arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c |   37 +++++--
 arch/arm/boards/freescale-mx23-evk/mx23-evk.c     |   28 +++--
 arch/arm/boards/freescale-mx25-3-stack/3stack.c   |   54 +++++-----
 arch/arm/boards/freescale-mx35-3-stack/3stack.c   |   46 ++++++--
 arch/arm/boards/freescale-mx51-pdk/board.c        |   15 ++-
 arch/arm/boards/guf-cupid/board.c                 |   64 +++++++++--
 arch/arm/boards/guf-neso/board.c                  |   26 +++--
 arch/arm/boards/imx21ads/imx21ads.c               |   36 +++++--
 arch/arm/boards/imx27ads/imx27ads.c               |   26 +++--
 arch/arm/boards/mini2440/mini2440.c               |   58 +++++++---
 arch/arm/boards/mmccpu/init.c                     |   11 ++-
 arch/arm/boards/netx/netx.c                       |   37 +++++--
 arch/arm/boards/nhk8815/setup.c                   |   11 ++-
 arch/arm/boards/omap/board-beagle.c               |   46 ++++++--
 arch/arm/boards/omap/board-omap3evm.c             |   34 ++++--
 arch/arm/boards/omap/board-sdp343x.c              |   26 +++--
 arch/arm/boards/omap/devices-gpmc-nand.c          |   11 ++-
 arch/arm/boards/pcm037/pcm037.c                   |  123 +++++++++++----------
 arch/arm/boards/pcm038/pcm038.c                   |   57 ++++++----
 arch/arm/boards/pcm043/pcm043.c                   |   26 +++--
 arch/arm/boards/phycard-i.MX27/pca100.c           |   37 +++++--
 arch/arm/boards/pm9261/init.c                     |   22 +++-
 arch/arm/boards/pm9263/init.c                     |   11 ++-
 arch/arm/boards/scb9328/scb9328.c                 |   49 ++++++--
 arch/arm/lib/armlinux.c                           |   19 +++-
 arch/arm/mach-at91/at91sam9260_devices.c          |  114 +++++++++++++++----
 arch/arm/mach-at91/at91sam9261_devices.c          |   70 +++++++++---
 arch/arm/mach-at91/at91sam9263_devices.c          |   81 +++++++++++---
 arch/arm/mach-at91/at91sam9g45_devices.c          |   92 ++++++++++++----
 arch/arm/mach-imx/devices.c                       |    4 +-
 arch/arm/mach-imx/iim.c                           |   17 ++-
 arch/arm/mach-imx/imx25.c                         |   42 ++++++-
 arch/arm/mach-nomadik/8815.c                      |   37 +++++--
 arch/blackfin/boards/ipe337/ipe337.c              |   48 ++++++--
 arch/ppc/boards/pcm030/pcm030.c                   |   61 ++++++++---
 arch/sandbox/board/hostfile.c                     |    4 +-
 arch/sandbox/mach-sandbox/include/mach/hostfile.h |   10 ++-
 arch/sandbox/os/common.c                          |    4 +-
 arch/x86/boards/x86_generic/generic_pc.c          |   47 ++++++---
 commands/mem.c                                    |   36 ++++---
 common/startup.c                                  |   13 ++-
 drivers/ata/bios.c                                |    4 +-
 drivers/ata/disk_drive.c                          |   13 +-
 drivers/i2c/busses/i2c-imx.c                      |   22 ++--
 drivers/i2c/busses/i2c-omap.c                     |    4 +-
 drivers/mci/imx-esdhc.c                           |    2 +-
 drivers/mci/imx.c                                 |    3 +-
 drivers/mci/mci-core.c                            |    4 +-
 drivers/mci/s3c.c                                 |  106 ++++++++++--------
 drivers/mci/stm378x.c                             |   79 ++++++++------
 drivers/mtd/nand/atmel_nand.c                     |    2 +-
 drivers/mtd/nand/nand_imx.c                       |    2 +-
 drivers/mtd/nand/nand_omap_gpmc.c                 |   13 ++-
 drivers/mtd/nand/nand_s3c2410.c                   |    4 +-
 drivers/net/cs8900.c                              |    2 +-
 drivers/net/fec_imx.c                             |    2 +-
 drivers/net/fec_mpc5200.c                         |    2 +-
 drivers/net/macb.c                                |    2 +-
 drivers/net/smc91111.c                            |    2 +-
 drivers/net/smc911x.c                             |    9 +-
 drivers/nor/cfi_flash.c                           |   31 +++--
 drivers/serial/amba-pl011.c                       |   32 +++---
 drivers/serial/atmel.c                            |   29 +++---
 drivers/serial/serial_imx.c                       |    2 +-
 drivers/serial/serial_mpc5xxx.c                   |   20 ++--
 drivers/serial/serial_netx.c                      |   34 +++---
 drivers/serial/serial_ns16550.c                   |   12 +-
 drivers/serial/serial_pl010.c                     |   15 ++-
 drivers/serial/serial_s3c24x0.c                   |   36 +++---
 drivers/serial/stm-serial.c                       |   44 ++++----
 drivers/spi/imx_spi.c                             |    2 +-
 drivers/usb/gadget/fsl_udc.c                      |    2 +-
 drivers/usb/host/ehci-hcd.c                       |    9 +-
 drivers/video/fb.c                                |    4 +-
 drivers/video/imx-ipu-fb.c                        |    2 +-
 drivers/video/imx.c                               |    2 +-
 fs/devfs.c                                        |    2 +-
 fs/fs.c                                           |   14 ++-
 include/driver.h                                  |   49 +++++++--
 include/linux/ioport.h                            |  115 +++++++++++++++++++
 lib/driver.c                                      |    7 +-
 90 files changed, 1873 insertions(+), 867 deletions(-)
 create mode 100644 include/linux/ioport.h

Best Regards,
J.

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

#20 lore raw

PATCH 2/2 mem: convert to DEVFS_MEM_BAREBOX_ONLY for freescale-mx25-3-stack/pcm037/pvm038

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/boards/freescale-mx25-3-stack/3stack.c |   35 ++++++++---------------
 arch/arm/boards/pcm037/pcm037.c                 |   33 +++++++--------------
 arch/arm/boards/pcm038/pcm038.c                 |   23 ++++-----------
 3 files changed, 29 insertions(+), 62 deletions(-)
arch/arm/boards/freescale-mx25-3-stack/3stack.c +12 -23
index cb9ce79..434bd7f 100644
@@ -113,8 +113,14 @@ static struct fec_platform_data fec_info = {
 	.phy_addr	= 1,
 };
 
-static struct resource sdram0_dev_resources[] = {
+static struct resource sdram_dev_resources[] = {
 	[0] = {
+		.name	= "sram0",
+		.start	= 0x78000000,
+		.size	= 128 * 1024,
+		.flags	= DEVFS_RDWR | DEVFS_MEM_BAREBOX_ONLY,
+	},
+	[1] = {
 		.name	= "ram0",
 		.start	= IMX_SDRAM_CS0,
 #if defined CONFIG_FREESCALE_MX25_3STACK_SDRAM_64MB_DDR2
@@ -128,27 +134,11 @@ static struct resource sdram0_dev_resources[] = {
 	},
 };
 
-static struct device_d sdram0_dev = {
-	.id	  = -1,
-	.name     = "mem",
-	.num_resources	= ARRAY_SIZE(sdram0_dev_resources),
-	.resource	= sdram0_dev_resources,
-};
-
-static struct resource sram0_dev_resources[] = {
-	[0] = {
-		.name	= "sram0",
-		.start	= 0x78000000,
-		.size	= 128 * 1024,
-		.flags	= DEVFS_RDWR,
-	},
-};
-
-static struct device_d sram0_dev = {
+static struct device_d sdram_dev = {
 	.id	  = -1,
 	.name     = "mem",
-	.num_resources	= ARRAY_SIZE(sram0_dev_resources),
-	.resource	= sram0_dev_resources,
+	.num_resources	= ARRAY_SIZE(sdram_dev_resources),
+	.resource	= sdram_dev_resources,
 };
 
 struct imx_nand_platform_data nand_info = {
@@ -266,13 +256,12 @@ static int imx25_devices_init(void)
 	devfs_add_partition("nand0", 0x40000, 0x20000, PARTITION_FIXED, "env_raw");
 	dev_add_bb_dev("env_raw", "env0");
 
-	register_device(&sdram0_dev);
-	register_device(&sram0_dev);
+	register_device(&sdram_dev);
 
 	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
 	imx25_add_i2c0(NULL);
 
-	armlinux_add_dram(&sdram0_dev);
+	armlinux_add_dram(&sdram_dev);
 	armlinux_set_bootparams((void *)0x80000100);
 	armlinux_set_architecture(MACH_TYPE_MX25_3DS);
 	armlinux_set_serial(imx_uid());
arch/arm/boards/pcm037/pcm037.c +11 -22
index a1783af..1045950 100644
@@ -58,26 +58,6 @@ static struct device_d cfi_dev = {
 };
 
 /*
- * up to 2MiB static RAM type memory, connected
- * to CS4, data width is 16 bit
- */
-static struct resource sram_dev_resources[] = {
-	[0] = {
-		.name	= "sram0",
-		.start	= IMX_CS4_BASE,
-		.size	= IMX_CS4_RANGE,	/* area size */
-		.flags	= DEVFS_RDWR,
-	},
-};
-
-static struct device_d sram_dev = {
-	.id	  = -1,
-	.name     = "mem",
-	.num_resources	= ARRAY_SIZE(sram_dev_resources),
-	.resource	= sram_dev_resources,
-};
-
-/*
  * SMSC 9217 network controller
  * connected to CS line 1 and interrupt line
  * GPIO3, data width is 16 bit
@@ -109,14 +89,24 @@ static struct device_d network_dev = {
 #endif
 
 static struct resource sdram_dev_resources[] = {
+/*
+ * up to 2MiB static RAM type memory, connected
+ * to CS4, data width is 16 bit
+ */
 	[0] = {
+		.name	= "sram0",
+		.start	= IMX_CS4_BASE,
+		.size	= IMX_CS4_RANGE,	/* area size */
+		.flags	= DEVFS_RDWR | DEVFS_MEM_BAREBOX_ONLY,
+	},
+	[1] = {
 		.name	= "ram0",
 		.start	= IMX_SDRAM_CS0,
 		.size	= SDRAM0 * 1024 * 1024,	/* fix size */
 		.flags	= DEVFS_RDWR,
 	},
 #ifndef CONFIG_PCM037_SDRAM_BANK1_NONE
-	[1] = {
+	[2] = {
 		.name	= "ram1",
 		.start	= IMX_SDRAM_CS1,
 		.size	= SDRAM1 * 1024 * 1024,	/* fix size */
@@ -313,7 +303,6 @@ static int imx31_devices_init(void)
 
 	protect_file("/dev/env0", 1);
 
-	register_device(&sram_dev);
 	imx31_add_nand(&nand_info);
 	register_device(&network_dev);
 
arch/arm/boards/pcm038/pcm038.c +6 -17
index 1306f27..401b161 100644
@@ -63,6 +63,12 @@ static struct device_d cfi_dev = {
 
 static struct resource sdram_dev_resources[] = {
 	[0] = {
+		.name	= "sram0",
+		.start	= 0xc8000000,
+		.size	= 512 * 1024, /* Can be up to 2MiB */
+		.flags	= DEVFS_RDWR | DEVFS_MEM_BAREBOX_ONLY,
+	},
+	[1] = {
 		.name 	= "ram0",
 		.start	= 0xa0000000,
 		.size	= 128 * 1024 * 1024,
@@ -77,22 +83,6 @@ static struct device_d sdram_dev = {
 	.resource	= sdram_dev_resources,
 };
 
-static struct resource sram_dev_resources[] = {
-	[0] = {
-		.name	= "sram0",
-		.start	= 0xc8000000,
-		.size	= 512 * 1024, /* Can be up to 2MiB */
-		.flags	= DEVFS_RDWR,
-	},
-};
-
-static struct device_d sram_dev = {
-	.id	  = -1,
-	.name     = "mem",
-	.num_resources	= ARRAY_SIZE(sram_dev_resources),
-	.resource	= sram_dev_resources,
-};
-
 static struct fec_platform_data fec_info = {
 	.xcv_type = MII100,
 	.phy_addr = 1,
@@ -320,7 +310,6 @@ static int pcm038_devices_init(void)
 	register_device(&cfi_dev);
 	imx27_add_nand(&nand_info);
 	register_device(&sdram_dev);
-	register_device(&sram_dev);
 	imx27_add_fb(&pcm038_fb_data);
 
 #ifdef CONFIG_USB
Signature · 7 lines
1.7.1


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

Re: [PATCH 2/2] mem: convert to DEVFS_MEM_BAREBOX_ONLY for freescale-mx25-3-stack/pcm037/pvm038

Hi Jean-Christophe,

Quoted 12 lines · Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/boards/freescale-mx25-3-stack/3stack.c |   35 ++++++++---------------
 arch/arm/boards/pcm037/pcm037.c                 |   33 +++++++--------------
 arch/arm/boards/pcm038/pcm038.c                 |   23 ++++-----------
 3 files changed, 29 insertions(+), 62 deletions(-)
arch/arm/boards/freescale-mx25-3-stack/3stack.c +0 -0
index cb9ce79..434bd7f 100644

arch/arm/boards/freescale-mx25-3-stack/3stack.c static struct fec_platform_data fec_info = { · line 116

Quoted 5 lines
arch/arm/boards/freescale-mx25-3-stack/3stack.c +1 -1
@@ -113,8 +113,14 @@ static struct fec_platform_data fec_info = {
 	.phy_addr	= 1,
 };
 
-static struct resource sdram0_dev_resources[] = {
+static struct resource sdram_dev_resources[] = {

I guess mem_dev_resources or ram_dev_resources are better names for this struct now, since the "sram0" is not SDRAM.

arch/arm/boards/freescale-mx25-3-stack/3stack.c static struct fec_platform_data fec_info = { · line 126

Quoted 10 lines
arch/arm/boards/freescale-mx25-3-stack/3stack.c +6 -0
 	[0] = {
+		.name	= "sram0",
+		.start	= 0x78000000,
+		.size	= 128 * 1024,
+		.flags	= DEVFS_RDWR | DEVFS_MEM_BAREBOX_ONLY,
+	},
+	[1] = {
 		.name	= "ram0",
 		.start	= IMX_SDRAM_CS0,
 #if defined CONFIG_FREESCALE_MX25_3STACK_SDRAM_64MB_DDR2

[snip]

baruch

Signature · 8 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.2.679.5364, http://www.tkos.co.il -

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