resources work
Subsystems (18)
PATCH v2 1/1 resources work
Hi all,
Some resources related work in this series:
- add missing IORESOURCE_MEM flag to resources created by the wrapper in register_device
- add helper to register memory devices
- drop struct memory_platform_data
- switch all of the memory to new helper
- get rid of some map_base in the core
- convert the majority of i.MX devices to struct resource
The following changes since commit 7530c82c3d295c2e93f440dc2ee6440a72e41c3a:
startup.c: make DEBUG_LL output more useful (2011-07-18 23:04:18 +0200)
are available in the git repository at:
git://uboot.jcrosoft.org/barebox.git resource
Jean-Christophe PLAGNIOL-VILLARD (1):
mem: replace DEVFS_RDWR by IORESOURCE_MEM_WRITEABLE
Sascha Hauer (15):
register_device: Add IORESOURCE_MEM flag
device: Add a dev_request_mem_region function add a add_mem_device function mem_read/write: use resources
nand i.MX: convert to struct resource video i.MX: convert to struct resource serial i.MX: convert to struct resource i2c i.MX: convert to struct resource mci i.MX: convert to struct resource net i.MX fec: convert to struct resource mci i.MX esdhc: convert to struct resource spi i.MX: convert to struct resource video i.MX ipu: convert to struct resource i.MX devices: convert to struct resource
cfi: convert to struct resource
arch/arm/boards/a9m2410/a9m2410.c | 35 +++----- arch/arm/boards/a9m2440/a9m2440.c | 22 +---- arch/arm/boards/chumby_falconwing/falconwing.c | 21 +---- arch/arm/boards/edb93xx/edb93xx.c | 91 ++++----------------- arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 20 +---- arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c | 19 +---- arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c | 20 +---- arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c | 20 +---- arch/arm/boards/freescale-mx23-evk/mx23-evk.c | 20 +---- arch/arm/boards/freescale-mx25-3-stack/3stack.c | 48 +++-------- arch/arm/boards/freescale-mx35-3-stack/3stack.c | 19 +---- arch/arm/boards/freescale-mx51-pdk/board.c | 19 +---- arch/arm/boards/guf-cupid/board.c | 19 +---- arch/arm/boards/guf-neso/board.c | 19 +---- arch/arm/boards/imx21ads/imx21ads.c | 19 +---- arch/arm/boards/imx27ads/imx27ads.c | 21 +---- arch/arm/boards/karo-tx25/board.c | 54 +++---------- arch/arm/boards/karo-tx28/tx28.c | 22 +---- arch/arm/boards/mini2440/mini2440.c | 24 ++---- arch/arm/boards/netx/netx.c | 21 ++---- arch/arm/boards/omap/board-beagle.c | 28 ++----- arch/arm/boards/omap/board-omap3evm.c | 30 ++----- arch/arm/boards/omap/board-sdp343x.c | 30 ++----- arch/arm/boards/panda/board.c | 20 +---- arch/arm/boards/pcm037/pcm037.c | 67 +++------------ arch/arm/boards/pcm038/pcm038.c | 35 ++------- arch/arm/boards/pcm043/pcm043.c | 20 +---- arch/arm/boards/pcm049/board.c | 36 ++------- arch/arm/boards/phycard-i.MX27/pca100.c | 19 +---- arch/arm/boards/scb9328/scb9328.c | 19 +---- arch/arm/mach-at91/at91rm9200_devices.c | 27 +----- arch/arm/mach-at91/at91sam9260_devices.c | 27 +----- arch/arm/mach-at91/at91sam9261_devices.c | 27 +----- arch/arm/mach-at91/at91sam9263_devices.c | 27 +----- arch/arm/mach-at91/at91sam9g45_devices.c | 27 +----- arch/arm/mach-imx/devices.c | 7 +- arch/arm/mach-nomadik/8815.c | 27 +----- arch/arm/mach-versatile/core.c | 20 +---- arch/blackfin/boards/ipe337/ipe337.c | 16 +--- arch/nios2/boards/generic/generic.c | 16 +--- arch/ppc/boards/pcm030/pcm030.c | 16 +--- arch/x86/boards/x86_generic/generic_pc.c | 16 +--- commands/mem.c | 32 ++------ common/Makefile | 1 + common/startup.c | 16 +--- drivers/i2c/busses/i2c-imx.c | 28 ++++--- drivers/mci/imx-esdhc.c | 2 +- drivers/mci/imx.c | 2 +- drivers/mtd/nand/nand_imx.c | 2 +- drivers/net/fec_imx.c | 2 +- drivers/nor/cfi_flash.c | 36 ++++----- drivers/serial/serial_imx.c | 2 +- drivers/spi/imx_spi.c | 2 +- drivers/video/imx-ipu-fb.c | 2 +- drivers/video/imx.c | 2 +- fs/fs.c | 5 +- include/driver.h | 26 +++++-- lib/driver.c | 18 ++++ 58 files changed, 342 insertions(+), 946 deletions(-)
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/16 register_device: Add IORESOURCE_MEM flag
From: Sascha Hauer <[email protected]>
--- lib/driver.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
lib/driver.c +1 -0
@@ -116,6 +116,7 @@ int register_device(struct device_d *new_device) new_device->resource =xzalloc (sizeof (struct resource )); new_device->resource[0 ].start = new_device->map_base; new_device->resource[0 ].size = new_device->size; + new_device->resource[0 ].flags =IORESOURCE_MEM ; new_device->num_resources =1 ; }else if (new_device->resource) { new_device->map_base = new_device->resource[0 ].start;
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/16 device: Add a dev_request_mem_region function
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
We might want to add real resource tracking later. Also The first resource may not be a IORESOURCE_MEM at all. For these reasons introduce a wrapper function for driver so that they do not have to fiddle with resources directly.
--- include/driver.h | 14 ++++++++++++++ lib/driver.c | 17 +++++++++++++++++ 2 files changed, 31 insertions(+), 0 deletions(-)
include/driver.h +14 -0
@@ -188,6 +188,20 @@ static inline const char *dev_name(const struct device_d *dev)return dev_id (dev); } +/* +* get register base 'num' for a device +*/ +void __iomem *dev_get_mem_region (struct device_d *dev,int num); + +/* +* exlusively request register base 'num' for a device +*/ +static inline void __iomem *dev_request_mem_region (struct device_d *dev,int num) +{ +/* no resource tracking yet */ +return dev_get_mem_region (dev, num); +} +/* linear list over all available devices */ extern struct list_head device_list;
lib/driver.c +17 -0
@@ -233,6 +233,23 @@ int register_driver(struct driver_d *drv) }EXPORT_SYMBOL (register_driver); +void __iomem *dev_get_mem_region (struct device_d *dev,int num) +{ +int i, n =0 ; + +for (i =0 ; i < dev->num_resources; i++) { +struct resource *res = &dev->resource[i]; +if (resource_type (res) ==IORESOURCE_MEM ) { +if (n == num) +return (void __force __iomem *)res->start; + n++; + } + } + +return NULL ; +} +EXPORT_SYMBOL (dev_get_mem_region); +int dev_protect (struct device_d *dev,size_t count,unsigned long offset,int prot) {printf ("%s: currently broken\n" , __func__);
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/16 mem: replace DEVFS_RDWR by IORESOURCE_MEM_WRITEABLE
In reply to Jean-Christophe PLAGNIOL-VILLARDwe keep struct memory_platform_data for now on we will switch off the memories resources to struct resource
--- arch/arm/boards/a9m2410/a9m2410.c | 2 +- arch/arm/boards/a9m2440/a9m2440.c | 2 +- arch/arm/boards/chumby_falconwing/falconwing.c | 2 +- arch/arm/boards/edb93xx/edb93xx.c | 8 ++++---- arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 2 +- arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c | 2 +- arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c | 2 +- arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c | 2 +- arch/arm/boards/freescale-mx23-evk/mx23-evk.c | 2 +- arch/arm/boards/freescale-mx25-3-stack/3stack.c | 4 ++-- arch/arm/boards/freescale-mx35-3-stack/3stack.c | 2 +- arch/arm/boards/freescale-mx51-pdk/board.c | 2 +- arch/arm/boards/guf-cupid/board.c | 2 +- arch/arm/boards/guf-neso/board.c | 2 +- arch/arm/boards/imx21ads/imx21ads.c | 2 +- arch/arm/boards/imx27ads/imx27ads.c | 2 +- arch/arm/boards/karo-tx25/board.c | 6 +++--- arch/arm/boards/karo-tx28/tx28.c | 2 +- arch/arm/boards/mini2440/mini2440.c | 2 +- arch/arm/boards/netx/netx.c | 2 +- arch/arm/boards/omap/board-beagle.c | 2 +- arch/arm/boards/omap/board-omap3evm.c | 2 +- arch/arm/boards/omap/board-sdp343x.c | 2 +- arch/arm/boards/panda/board.c | 2 +- arch/arm/boards/pcm037/pcm037.c | 6 +++--- arch/arm/boards/pcm038/pcm038.c | 4 ++-- arch/arm/boards/pcm043/pcm043.c | 2 +- arch/arm/boards/pcm049/board.c | 4 ++-- arch/arm/boards/phycard-i.MX27/pca100.c | 2 +- arch/arm/boards/scb9328/scb9328.c | 2 +- arch/arm/mach-at91/at91rm9200_devices.c | 2 +- arch/arm/mach-at91/at91sam9260_devices.c | 2 +- arch/arm/mach-at91/at91sam9261_devices.c | 2 +- arch/arm/mach-at91/at91sam9263_devices.c | 2 +- arch/arm/mach-at91/at91sam9g45_devices.c | 2 +- arch/arm/mach-nomadik/8815.c | 2 +- arch/arm/mach-versatile/core.c | 2 +- arch/blackfin/boards/ipe337/ipe337.c | 2 +- arch/nios2/boards/generic/generic.c | 2 +- arch/ppc/boards/pcm030/pcm030.c | 2 +- arch/x86/boards/x86_generic/generic_pc.c | 2 +- commands/mem.c | 2 +- include/driver.h | 1 - 43 files changed, 52 insertions(+), 53 deletions(-)
arch/arm/boards/a9m2410/a9m2410.c +1 -1
@@ -37,7 +37,7 @@static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/a9m2440/a9m2440.c +1 -1
@@ -40,7 +40,7 @@static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/chumby_falconwing/falconwing.c +1 -1
@@ -36,7 +36,7 @@static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/edb93xx/edb93xx.c +4 -4
@@ -47,7 +47,7 @@ static struct device_d cfi_dev = {static struct memory_platform_data ram_dev_pdata0 = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram0_dev = {
@@ -61,7 +61,7 @@ static struct device_d sdram0_dev = {#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >=2 )static struct memory_platform_data ram_dev_pdata1 = { .name ="ram1" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , }; static struct device_d sdram1_dev = {
@@ -76,7 +76,7 @@ static struct device_d sdram1_dev = {#if (CONFIG_EP93XX_SDRAM_NUM_BANKS >=3 )static struct memory_platform_data ram_dev_pdata2 = { .name ="ram2" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , }; static struct device_d sdram2_dev = {
@@ -91,7 +91,7 @@ static struct device_d sdram2_dev = {#if (CONFIG_EP93XX_SDRAM_NUM_BANKS ==4 )static struct memory_platform_data ram_dev_pdata3 = { .name ="ram3" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , }; static struct device_d sdram3_dev = {
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +1 -1
@@ -92,7 +92,7 @@ static struct fec_platform_data fec_info = {static struct memory_platform_data sdram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram0_dev = {
arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c +1 -1
@@ -65,7 +65,7 @@ static struct device_d cfi_dev1 = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };#if definedCONFIG_EUKREA_CPUIMX27_SDRAM_256MB
arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c +1 -1
@@ -63,7 +63,7 @@ static struct fec_platform_data fec_info = {static struct memory_platform_data sdram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c +1 -1
@@ -44,7 +44,7 @@static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/freescale-mx23-evk/mx23-evk.c +1 -1
@@ -27,7 +27,7 @@static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/freescale-mx25-3-stack/3stack.c +2 -2
@@ -115,7 +115,7 @@ static struct fec_platform_data fec_info = {static struct memory_platform_data sdram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram0_dev = {
@@ -134,7 +134,7 @@ static struct device_d sdram0_dev = {static struct memory_platform_data sram_pdata = { .name ="sram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sram0_dev = {
arch/arm/boards/freescale-mx35-3-stack/3stack.c +1 -1
@@ -73,7 +73,7 @@ static struct fec_platform_data fec_info = {static struct memory_platform_data sdram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/freescale-mx51-pdk/board.c +1 -1
@@ -43,7 +43,7 @@static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/guf-cupid/board.c +1 -1
@@ -57,7 +57,7 @@ static struct device_d fec_dev = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram0_dev = {
arch/arm/boards/guf-neso/board.c +1 -1
@@ -56,7 +56,7 @@static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/imx21ads/imx21ads.c +1 -1
@@ -50,7 +50,7 @@ static struct device_d cfi_dev = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/imx27ads/imx27ads.c +1 -1
@@ -43,7 +43,7 @@ static struct device_d cfi_dev = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/karo-tx25/board.c +3 -3
@@ -47,7 +47,7 @@ static struct fec_platform_data fec_info = {static struct memory_platform_data sdram0_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram0_dev = {
@@ -60,7 +60,7 @@ static struct device_d sdram0_dev = {static struct memory_platform_data sdram1_pdata = { .name ="ram1" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram1_dev = {
@@ -73,7 +73,7 @@ static struct device_d sdram1_dev = {static struct memory_platform_data sram_pdata = { .name ="sram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sram0_dev = {
arch/arm/boards/karo-tx28/tx28.c +1 -1
@@ -25,7 +25,7 @@static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/mini2440/mini2440.c +1 -1
@@ -46,7 +46,7 @@static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/netx/netx.c +1 -1
@@ -39,7 +39,7 @@ static struct device_d cfi_dev = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/omap/board-beagle.c +1 -1
@@ -266,7 +266,7 @@ console_initcall(beagle_console_init);static struct memory_platform_data sram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/omap/board-omap3evm.c +1 -1
@@ -243,7 +243,7 @@ console_initcall(omap3evm_init_console);static struct memory_platform_data sram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/omap/board-sdp343x.c +1 -1
@@ -643,7 +643,7 @@ static int sdp3430_flash_init(void)static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };struct device_d sdram_dev = {
arch/arm/boards/panda/board.c +1 -1
@@ -54,7 +54,7 @@ console_initcall(panda_console_init);static struct memory_platform_data sram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/pcm037/pcm037.c +3 -3
@@ -56,7 +56,7 @@ static struct device_d cfi_dev = {*/ static struct memory_platform_data sram_dev_pdata0 = { .name ="sram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sram_dev = {
@@ -87,7 +87,7 @@ static struct device_d network_dev = {static struct memory_platform_data ram_dev_pdata0 = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram0_dev = {
@@ -108,7 +108,7 @@ static struct device_d sdram0_dev = {static struct memory_platform_data ram_dev_pdata1 = { .name ="ram1" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram1_dev = {
arch/arm/boards/pcm038/pcm038.c +2 -2
@@ -56,7 +56,7 @@ static struct device_d cfi_dev = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
@@ -69,7 +69,7 @@ static struct device_d sdram_dev = {static struct memory_platform_data sram_pdata = { .name ="sram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sram_dev = {
arch/arm/boards/pcm043/pcm043.c +1 -1
@@ -63,7 +63,7 @@ static struct fec_platform_data fec_info = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram0_dev = {
arch/arm/boards/pcm049/board.c +2 -2
@@ -65,7 +65,7 @@ console_initcall(pcm049_console_init);static struct memory_platform_data sram_pdata = { .name ="sram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sram_dev = {
@@ -78,7 +78,7 @@ static struct device_d sram_dev = {static struct memory_platform_data sdram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/phycard-i.MX27/pca100.c +1 -1
@@ -43,7 +43,7 @@static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/boards/scb9328/scb9328.c +1 -1
@@ -43,7 +43,7 @@ static struct device_d cfi_dev = {static struct memory_platform_data sdram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/mach-at91/at91rm9200_devices.c +1 -1
@@ -28,7 +28,7 @@ static struct resource sdram_dev_resources[] = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/mach-at91/at91sam9260_devices.c +1 -1
@@ -29,7 +29,7 @@ static struct resource sdram_dev_resources[] = {static struct memory_platform_data sram_pdata = { .name ="sram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/mach-at91/at91sam9261_devices.c +1 -1
@@ -29,7 +29,7 @@ static struct resource sdram_dev_resources[] = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/mach-at91/at91sam9263_devices.c +1 -1
@@ -29,7 +29,7 @@ static struct resource sdram_dev_resources[] = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/mach-at91/at91sam9g45_devices.c +1 -1
@@ -29,7 +29,7 @@ static struct resource sdram_dev_resources[] = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/arm/mach-nomadik/8815.c +1 -1
@@ -33,7 +33,7 @@ static struct clk st8815_clk_48 = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct resource sdram_dev_resources[] = {
arch/arm/mach-versatile/core.c +1 -1
@@ -44,7 +44,7 @@static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/blackfin/boards/ipe337/ipe337.c +1 -1
@@ -14,7 +14,7 @@ static struct device_d cfi_dev = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
arch/nios2/boards/generic/generic.c +1 -1
@@ -23,7 +23,7 @@ static struct device_d mac_dev = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d ram_dev = {
arch/ppc/boards/pcm030/pcm030.c +1 -1
@@ -46,7 +46,7 @@ struct device_d cfi_dev = {static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };struct device_d sdram_dev = {
arch/x86/boards/x86_generic/generic_pc.c +1 -1
@@ -32,7 +32,7 @@static struct memory_platform_data ram_pdata = { .name ="ram0" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d sdram_dev = {
commands/mem.c +1 -1
@@ -612,7 +612,7 @@ static struct driver_d mem_drv = {static struct memory_platform_data mem_dev_pdata = { .name ="mem" , - .flags =DEVFS_RDWR , + .flags =IORESOURCE_MEM_WRITEABLE , };static struct device_d mem_dev = {
include/driver.h +0 -1
@@ -344,7 +344,6 @@ int cdev_erase(struct cdev *cdev, size_t count, unsigned long offset);#define DEVFS_PARTITION_FIXED (1 << 0)#define DEVFS_PARTITION_READONLY (1 << 1)#define DEVFS_IS_PARTITION (1 << 2) -#define DEVFS_RDWR (1 << 3)int devfs_add_partition (const char *devname,unsigned long offset,size_t size,int flags,const char *name);
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/16 add a add_mem_device function
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
Add a helper function for boards to register their memory devices. This makes the board code smaller and also helps getting rid of map_base and struct memory_platform_data.
And switch all of the memory to it
--- arch/arm/boards/a9m2410/a9m2410.c | 35 +++----- arch/arm/boards/a9m2440/a9m2440.c | 22 +---- arch/arm/boards/chumby_falconwing/falconwing.c | 21 +---- arch/arm/boards/edb93xx/edb93xx.c | 91 ++++----------------- arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 20 +---- arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c | 19 +---- arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c | 20 +---- arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c | 20 +---- arch/arm/boards/freescale-mx23-evk/mx23-evk.c | 20 +---- arch/arm/boards/freescale-mx25-3-stack/3stack.c | 48 +++-------- arch/arm/boards/freescale-mx35-3-stack/3stack.c | 19 +---- arch/arm/boards/freescale-mx51-pdk/board.c | 19 +---- arch/arm/boards/guf-cupid/board.c | 19 +---- arch/arm/boards/guf-neso/board.c | 19 +---- arch/arm/boards/imx21ads/imx21ads.c | 19 +---- arch/arm/boards/imx27ads/imx27ads.c | 21 +---- arch/arm/boards/karo-tx25/board.c | 54 +++---------- arch/arm/boards/karo-tx28/tx28.c | 22 +---- arch/arm/boards/mini2440/mini2440.c | 24 ++---- arch/arm/boards/netx/netx.c | 21 ++---- arch/arm/boards/omap/board-beagle.c | 28 ++----- arch/arm/boards/omap/board-omap3evm.c | 30 ++----- arch/arm/boards/omap/board-sdp343x.c | 30 ++----- arch/arm/boards/panda/board.c | 20 +---- arch/arm/boards/pcm037/pcm037.c | 67 +++------------ arch/arm/boards/pcm038/pcm038.c | 35 ++------- arch/arm/boards/pcm043/pcm043.c | 20 +---- arch/arm/boards/pcm049/board.c | 36 ++------- arch/arm/boards/phycard-i.MX27/pca100.c | 19 +---- arch/arm/boards/scb9328/scb9328.c | 19 +---- arch/arm/mach-at91/at91rm9200_devices.c | 27 +----- arch/arm/mach-at91/at91sam9260_devices.c | 27 +----- arch/arm/mach-at91/at91sam9261_devices.c | 27 +----- arch/arm/mach-at91/at91sam9263_devices.c | 27 +----- arch/arm/mach-at91/at91sam9g45_devices.c | 27 +----- arch/arm/mach-nomadik/8815.c | 27 +----- arch/arm/mach-versatile/core.c | 20 +---- arch/blackfin/boards/ipe337/ipe337.c | 16 +--- arch/nios2/boards/generic/generic.c | 16 +--- arch/ppc/boards/pcm030/pcm030.c | 16 +--- arch/x86/boards/x86_generic/generic_pc.c | 16 +--- commands/mem.c | 32 ++------ common/Makefile | 1 + common/startup.c | 16 +--- include/driver.h | 11 ++- 45 files changed, 261 insertions(+), 902 deletions(-)
arch/arm/boards/a9m2410/a9m2410.c +13 -22
@@ -35,18 +35,6 @@#include <mach/s3c24x0-iomap.h> #include <mach/s3c24x0-nand.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="ram" , - .map_base =CS6_BASE , - .platform_data = &ram_pdata, -}; -// {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0}, static struct s3c24x0_nand_platform_data nand_info = { .nand_timing =CALC_NFCONF_TIMING (A9M2410_TACLS ,A9M2410_TWRPH0 ,A9M2410_TWRPH1 )
@@ -74,6 +62,8 @@ static struct device_d network_dev = {static int a9m2410_devices_init (void ) {uint32_t reg; +resource_size_t size =0 ; +struct device_d *sdram_dev;/* * detect the current memory size
@@ -83,25 +73,25 @@ static int a9m2410_devices_init(void)switch (reg &=0x7 ) {case 0 : - sdram_dev.size =32 *1024 *1024 ; + size =32 *1024 *1024 ;break ;case 1 : - sdram_dev.size =64 *1024 *1024 ; + size =64 *1024 *1024 ;break ;case 2 : - sdram_dev.size =128 *1024 *1024 ; + size =128 *1024 *1024 ;break ;case 4 : - sdram_dev.size =2 *1024 *1024 ; + size =2 *1024 *1024 ;break ;case 5 : - sdram_dev.size =4 *1024 *1024 ; + size =4 *1024 *1024 ;break ;case 6 : - sdram_dev.size =8 *1024 *1024 ; + size =8 *1024 *1024 ;break ;case 7 : - sdram_dev.size =16 *1024 *1024 ; + size =16 *1024 *1024 ;break ; }
@@ -152,7 +142,8 @@ static int a9m2410_devices_init(void)/* ----------- the devices the boot loader should work with -------- */ register_device (&nand_dev); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,CS6_BASE , size, +IORESOURCE_MEM_WRITEABLE );register_device (&network_dev);#ifdef CONFIG_NAND
@@ -164,8 +155,8 @@ static int a9m2410_devices_init(void)dev_add_bb_dev ("env_raw" ,"env0" );#endif -armlinux_add_dram (&sdram_dev); -armlinux_set_bootparams ((void *)sdram_dev.map_base +0x100 ); +armlinux_add_dram (sdram_dev); +armlinux_set_bootparams (dev_get_mem_region (sdram_dev,0 ) +0x100 );armlinux_set_architecture (MACH_TYPE_A9M2410 );return 0 ;
arch/arm/boards/a9m2440/a9m2440.c +5 -17
@@ -38,18 +38,6 @@#include "baseboards.h" -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =CS6_BASE , - .platform_data = &ram_pdata, -}; -static struct s3c24x0_nand_platform_data nand_info = { .nand_timing =CALC_NFCONF_TIMING (A9M2440_TACLS ,A9M2440_TWRPH0 ,A9M2440_TWRPH1 ) };
@@ -106,6 +94,7 @@ static void a9m2440_disable_second_sdram_bank(void)static int a9m2440_devices_init (void ) {uint32_t reg; +struct device_d *sdram_dev;/* * The special SDRAM setup code for this machine will always enable
@@ -136,8 +125,6 @@ static int a9m2440_devices_init(void)break ; } - sdram_dev.size =s3c24x0_get_memory_size (); -/* ----------- configure the access to the outer space ---------- */ reg =readl (BWSCON );
@@ -159,7 +146,8 @@ static int a9m2440_devices_init(void)/* ----------- the devices the boot loader should work with -------- */ register_device (&nand_dev); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,CS6_BASE ,s3c24x0_get_memory_size (), +IORESOURCE_MEM_WRITEABLE );register_device (&network_dev);#ifdef CONFIG_NAND
@@ -170,8 +158,8 @@ static int a9m2440_devices_init(void)devfs_add_partition ("nand0" ,0x40000 ,0x20000 ,PARTITION_FIXED ,"env_raw" );dev_add_bb_dev ("env_raw" ,"env0" );#endif -armlinux_add_dram (&sdram_dev); -armlinux_set_bootparams ((void *)sdram_dev.map_base +0x100 ); +armlinux_add_dram (sdram_dev); +armlinux_set_bootparams (dev_get_mem_region (sdram_dev,0 ) +0x100 );armlinux_set_architecture (MACH_TYPE_A9M2440 );return 0 ;
arch/arm/boards/chumby_falconwing/falconwing.c +5 -16
@@ -34,19 +34,6 @@#include <mach/fb.h> #include <mach/usb.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_MEMORY_BASE , - .size =64 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct mxs_mci_platform_data mci_pdata = { .caps =MMC_MODE_4BIT |MMC_MODE_HS | MMC_MODE_HS_52MHz, .voltages =MMC_VDD_32_33 |MMC_VDD_33_34 ,/* fixed to 3.3 V */
@@ -372,12 +359,14 @@ static void falconwing_init_usb(void)static int falconwing_devices_init (void ) {int i, rc; +struct device_d *sdram_dev;/* initizalize gpios */ for (i =0 ; i <ARRAY_SIZE (pad_setup); i++)imx_gpio_mode (pad_setup[i]); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,IMX_MEMORY_BASE ,64 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE );imx_set_ioclk (480000000 );/* enable IOCLK to run at the PLL frequency */ /* run the SSP unit clock at 100,000 kHz */ imx_set_sspclk (0 ,100000000 ,1 );
@@ -386,8 +375,8 @@ static int falconwing_devices_init(void)falconwing_init_usb (); -armlinux_add_dram (&sdram_dev); -armlinux_set_bootparams ((void *)(sdram_dev.map_base +0x100 )); +armlinux_add_dram (sdram_dev); +armlinux_set_bootparams (dev_get_mem_region (sdram_dev,0 ) +0x100 );armlinux_set_architecture (MACH_TYPE_CHUMBY ); rc =register_persistant_environment ();
arch/arm/boards/edb93xx/edb93xx.c +18 -73
114 lines not on this page · raw message
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +5 -15
@@ -90,19 +90,6 @@ static struct fec_platform_data fec_info = { .phy_addr = 1, }; -static struct memory_platform_data sdram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram0_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_SDRAM_CS0 , - .size =64 *1024 *1024 , - .platform_data = &sdram_pdata, -}; -struct imx_nand_platform_data nand_info = { .width =1 , .hw_ecc =1 ,
@@ -255,6 +242,8 @@ static struct pad_desc eukrea_cpuimx25_pads[] = {static int eukrea_cpuimx25_devices_init (void ) { +struct device_d *sdram_dev; +eukrea_cpuimx25_mmu_init (); mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads,
@@ -275,7 +264,9 @@ static int eukrea_cpuimx25_devices_init(void) PARTITION_FIXED, "env_raw");dev_add_bb_dev ("env_raw" ,"env0" ); -register_device (&sdram0_dev); + sdram_dev =add_mem_device ("ram0" ,IMX_SDRAM_CS0 ,64 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);/* enable LCD */ gpio_direction_output (26 ,1 );
@@ -295,7 +286,6 @@ static int eukrea_cpuimx25_devices_init(void)#endif register_device (&usbotg_dev); -armlinux_add_dram (&sdram0_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_EUKREA_CPUIMX25 );
arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c +4 -15
@@ -63,25 +63,12 @@ static struct device_d cfi_dev1 = { };#endif -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; -#if definedCONFIG_EUKREA_CPUIMX27_SDRAM_256MB #define SDRAM0 256#elif definedCONFIG_EUKREA_CPUIMX27_SDRAM_128MB #define SDRAM0 128#endif -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xa0000000 , - .size =SDRAM0 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , .phy_addr =1 ,
@@ -197,6 +184,7 @@ static struct device_d imxfb_dev = {static int eukrea_cpuimx27_devices_init (void ) { +struct device_d *sdram_dev;char *envdev ="no" ;int i;
@@ -271,7 +259,9 @@ static int eukrea_cpuimx27_devices_init(void)register_device (&cfi_dev1);#endif imx27_add_nand (&nand_info); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0xa0000000 ,SDRAM0 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);PCCR0 |=PCCR0_I2C1_EN ;i2c_register_board_info (0 , i2c_devices,ARRAY_SIZE (i2c_devices));
@@ -292,7 +282,6 @@ static int eukrea_cpuimx27_devices_init(void)gpio_set_value (GPIO_PORTA |25 ,1 );#endif -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0xa0000100 );armlinux_set_architecture (MACH_TYPE_CPUIMX27 );
arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c +5 -15
@@ -61,19 +61,6 @@ static struct fec_platform_data fec_info = { .phy_addr = 0x1F, }; -static struct memory_platform_data sdram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_SDRAM_CS0 , - .size =128 *1024 *1024 , - .platform_data = &sdram_pdata, -}; -struct imx_nand_platform_data nand_info = { .width =1 , .hw_ecc =1 ,
@@ -173,6 +160,8 @@ postcore_initcall(eukrea_cpuimx35_mmu_init);static int eukrea_cpuimx35_devices_init (void ) { +struct device_d *sdram_dev; +imx35_add_nand (&nand_info);devfs_add_partition ("nand0" ,0x00000 ,0x40000 ,PARTITION_FIXED ,"self_raw" );
@@ -182,7 +171,9 @@ static int eukrea_cpuimx35_devices_init(void)imx35_add_fec (&fec_info); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,IMX_SDRAM_CS0 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx35_add_fb (&ipu_fb_data);imx35_add_i2c0 (NULL );
@@ -198,7 +189,6 @@ static int eukrea_cpuimx35_devices_init(void)writel (tmp | (1 <<23 ),IMX_OTG_BASE +0x608 );register_device (&usbotg_dev);#endif -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_EUKREA_CPUIMX35 );
arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c +5 -15
@@ -42,19 +42,6 @@#include <mach/iomux-mx51.h> #include <mach/devices-imx51.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x90000000 , - .size =256 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , };
@@ -132,9 +119,13 @@ static void eukrea_cpuimx51_mmu_init(void)static int eukrea_cpuimx51_devices_init (void ) { +struct device_d *sdram_dev; +eukrea_cpuimx51_mmu_init (); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0x90000000 ,256 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx51_add_fec (&fec_info);#ifdef CONFIG_MCI_IMX_ESDHC imx51_add_mmc0 (NULL );
@@ -150,7 +141,6 @@ static int eukrea_cpuimx51_devices_init(void)gpio_set_value (GPIO_LAN8700_RESET ,1 );gpio_direction_output (GPIO_LCD_BL ,0 ); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x90000100 );armlinux_set_architecture (MACH_TYPE_EUKREA_CPUIMX51SD );
arch/arm/boards/freescale-mx23-evk/mx23-evk.c +5 -15
@@ -25,24 +25,14 @@#include <generated/mach-types.h> #include <mach/imx-regs.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .name ="mem" , - .map_base =IMX_MEMORY_BASE , - .size =32 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static int mx23_evk_devices_init (void ) { -register_device (&sdram_dev); +struct device_d *sdram_dev; -armlinux_add_dram (&sdram_dev); -armlinux_set_bootparams ((void *)(sdram_dev.map_base +0x100 )); + sdram_dev =add_mem_device ("ram0" ,IMX_MEMORY_BASE ,32 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); +armlinux_set_bootparams (dev_get_mem_region (sdram_dev,0 ) +0x100 );armlinux_set_architecture (MACH_TYPE_MX23EVK );return 0 ;
arch/arm/boards/freescale-mx25-3-stack/3stack.c +13 -35
70 lines not on this page · raw message
arch/arm/boards/freescale-mx35-3-stack/3stack.c +4 -15
@@ -71,19 +71,6 @@ static struct fec_platform_data fec_info = { .phy_addr = 0x1F, }; -static struct memory_platform_data sdram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_SDRAM_CS0 , - .size =128 *1024 *1024 , - .platform_data = &sdram_pdata, -}; -struct imx_nand_platform_data nand_info = { .hw_ecc =1 , .flash_bbt =1 ,
@@ -165,6 +152,7 @@ static void set_board_rev(int rev)static int f3s_devices_init (void ) {uint32_t reg; +struct device_d *sdram_dev;/* CS0: Nor Flash */ writel (0x0000cf03 ,CSCR_U (0 ));
@@ -209,10 +197,11 @@ static int f3s_devices_init(void)imx35_add_mmc0 (NULL ); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,IMX_SDRAM_CS0 ,124 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx35_add_fb (&ipu_fb_data); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_MX35_3DS );
arch/arm/boards/freescale-mx51-pdk/board.c +4 -15
@@ -41,19 +41,6 @@#include <mach/iomux-mx51.h> #include <mach/devices-imx51.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x90000000 , - .size =512 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , };
@@ -242,9 +229,12 @@ static void babbage_power_init(void)static int f3s_devices_init (void ) { +struct device_d *sdram_dev;babbage_mmu_init (); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0x90000000 ,512 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx51_add_fec (&fec_info);imx51_add_mmc0 (NULL );
@@ -254,7 +244,6 @@ static int f3s_devices_init(void)babbage_power_init (); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x90000100 );armlinux_set_architecture (MACH_TYPE_MX51_BABBAGE );
arch/arm/boards/guf-cupid/board.c +4 -15
@@ -55,19 +55,6 @@ static struct device_d fec_dev = { .platform_data = &fec_info, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram0_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_SDRAM_CS0 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -struct imx_nand_platform_data nand_info = { .width =1 , .hw_ecc =1 ,
@@ -158,6 +145,7 @@ postcore_initcall(cupid_mmu_init);static int cupid_devices_init (void ) {uint32_t reg; +struct device_d *sdram_dev;gpio_direction_output (GPIO_LCD_ENABLE ,0 );gpio_direction_output (GPIO_LCD_BACKLIGHT ,0 );
@@ -177,11 +165,12 @@ static int cupid_devices_init(void)devfs_add_partition ("nand0" ,0x40000 ,0x80000 ,PARTITION_FIXED ,"env_raw" );dev_add_bb_dev ("env_raw" ,"env0" ); -register_device (&sdram0_dev); + sdram_dev =add_mem_device ("ram0" ,IMX_SDRAM_CS0 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);register_device (&imx_ipu_fb_dev);register_device (&esdhc_dev); -armlinux_add_dram (&sdram0_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_GUF_CUPID );
arch/arm/boards/guf-neso/board.c +4 -15
@@ -54,19 +54,6 @@#define LCD_POWER_GPIO (GPIO_PORTF + 18)#define BACKLIGHT_POWER_GPIO (GPIO_PORTE + 5) -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xa0000000 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , .phy_addr =31 ,
@@ -178,6 +165,7 @@ static void neso_mmu_init(void)static int neso_devices_init (void ) {int i; +struct device_d *sdram_dev;unsigned int mode[] = {/* UART1 */
@@ -309,7 +297,9 @@ static int neso_devices_init(void)imx_gpio_mode (mode[i]);imx27_add_nand (&nand_info); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0xa0000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx27_add_fb (&neso_fb_data);#ifdef CONFIG_USB
@@ -325,7 +315,6 @@ static int neso_devices_init(void)devfs_add_partition ("nand0" ,0x40000 ,0x80000 ,PARTITION_FIXED ,"env_raw" );dev_add_bb_dev ("env_raw" ,"env0" ); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0xa0000100 );armlinux_set_architecture (MACH_TYPE_NESO );
arch/arm/boards/imx21ads/imx21ads.c +4 -15
@@ -48,19 +48,6 @@ static struct device_d cfi_dev = { .size = 32 * 1024 * 1024, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xc0000000 , - .size =64 *1024 *1024 , - .platform_data = &ram_pdata, -}; -struct imx_nand_platform_data nand_info = { .width =1 , .hw_ecc =1 ,
@@ -145,6 +132,7 @@ core_initcall(imx21ads_timing_init);static int mx21ads_devices_init (void ) {int i; +struct device_d *sdram_dev;unsigned int mode[] = {PA5_PF_LSCLK ,PA6_PF_LD0 ,
@@ -184,12 +172,13 @@ static int mx21ads_devices_init(void)imx_gpio_mode (mode[i]);register_device (&cfi_dev); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0xc0000000 ,64 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx21_add_nand (&nand_info);register_device (&cs8900_dev);imx21_add_fb (&imx_fb_data); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0xc0000100 );armlinux_set_architecture (MACH_TYPE_MX21ADS );
arch/arm/boards/imx27ads/imx27ads.c +5 -16
@@ -41,19 +41,6 @@ static struct device_d cfi_dev = { .size = 32 * 1024 * 1024, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xa0000000 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , .phy_addr =1 ,
@@ -97,6 +84,7 @@ core_initcall(imx27ads_timing_init);static int mx27ads_devices_init (void ) {int i; +struct device_d *sdram_dev;unsigned int mode[] = {PD0_AIN_FEC_TXD0 ,PD1_AIN_FEC_TXD1 ,
@@ -127,14 +115,15 @@ static int mx27ads_devices_init(void)imx_gpio_mode (mode[i]);register_device (&cfi_dev); -register_device (&sdram_dev); -imx27_add_fec (&fec_info); + sdram_dev =add_mem_device ("ram0" ,0xa0000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); +imx27_add_fec (&fec_info);devfs_add_partition ("nor0" ,0x00000 ,0x20000 ,PARTITION_FIXED ,"self0" );devfs_add_partition ("nor0" ,0x20000 ,0x20000 ,PARTITION_FIXED ,"env0" );protect_file ("/dev/env0" ,1 ); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0xa0000100 );armlinux_set_architecture (MACH_TYPE_MX27ADS );
arch/arm/boards/karo-tx25/board.c +10 -44
73 lines not on this page · raw message
arch/arm/boards/karo-tx28/tx28.c +5 -17
@@ -23,19 +23,6 @@#include <mach/imx-regs.h> #include <asm/mmu.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_MEMORY_BASE , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -/* setup the CPU card internal signals */ static const uint32_t tx28_pad_setup[] = {/* NAND interface */
@@ -103,15 +90,16 @@ postcore_initcall(tx28_mmu_init);static int tx28_devices_init (void ) {int i; +struct device_d *sdram_dev;/* initizalize gpios */ for (i =0 ; i <ARRAY_SIZE (tx28_pad_setup); i++)imx_gpio_mode (tx28_pad_setup[i]); -register_device (&sdram_dev); - -armlinux_add_dram (&sdram_dev); -armlinux_set_bootparams ((void *)(sdram_dev.map_base +0x100 )); + sdram_dev =add_mem_device ("ram0" ,IMX_MEMORY_BASE ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); +armlinux_set_bootparams (dev_get_mem_region (sdram_dev,0 ) +0x100 );armlinux_set_architecture (MACH_TYPE_TX28 );base_board_init ();
arch/arm/boards/mini2440/mini2440.c +7 -17
@@ -44,18 +44,6 @@#include <mach/mci.h> #include <mach/fb.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =CS6_BASE , - .platform_data = &ram_pdata, -}; -static struct s3c24x0_nand_platform_data nand_info = { .nand_timing =CALC_NFCONF_TIMING (A9M2440_TACLS ,A9M2440_TWRPH0 ,A9M2440_TWRPH1 ), .flash_bbt =1 ,/* same as the kernel */
@@ -316,8 +304,7 @@ static int mini2440_devices_init(void) {uint32_t reg;int i; - - sdram_dev.size =s3c24x0_get_memory_size (); +struct device_d *sdram_dev;/* ----------- configure the access to the outer space ---------- */ for (i =0 ; i <ARRAY_SIZE (pin_usage); i++)
@@ -338,7 +325,11 @@ static int mini2440_devices_init(void)writel (reg,MISCCR );register_device (&nand_dev); -register_device (&sdram_dev); + + sdram_dev =add_mem_device ("ram0" ,CS6_BASE ,s3c24x0_get_memory_size (), +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); +register_device (&dm9000_dev);#ifdef CONFIG_NAND /* ----------- add some vital partitions -------- */
@@ -352,8 +343,7 @@ static int mini2440_devices_init(void)#endif register_device (&mci_dev);register_device (&s3cfb_dev); -armlinux_add_dram (&sdram_dev); -armlinux_set_bootparams ((void *)sdram_dev.map_base +0x100 ); +armlinux_set_bootparams (dev_get_mem_region (sdram_dev,0 ) +0x100 );armlinux_set_architecture (MACH_TYPE_MINI2440 );return 0 ;
arch/arm/boards/netx/netx.c +6 -15
@@ -37,19 +37,6 @@ static struct device_d cfi_dev = { .size = 32 * 1024 * 1024, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x80000000 , - .size =64 *1024 *1024 , - .platform_data = &ram_pdata, -}; -struct netx_eth_platform_data eth0_data = { .xcno =0 , };
@@ -71,8 +58,13 @@ static struct device_d netx_eth_dev1 = { };static int netx_devices_init (void ) { +struct device_d *sdram_dev; +register_device (&cfi_dev); -register_device (&sdram_dev); + + sdram_dev =add_mem_device ("ram0" ,0x80000000 ,64 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);register_device (&netx_eth_dev0);register_device (&netx_eth_dev1);
@@ -83,7 +75,6 @@ static int netx_devices_init(void) {protect_file ("/dev/env0" ,1 ); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_NXDB500 );
arch/arm/boards/omap/board-beagle.c +8 -20
@@ -264,19 +264,6 @@ static int beagle_console_init(void)console_initcall (beagle_console_init);#endif /* CONFIG_DRIVER_SERIAL_NS16550 */ -static struct memory_platform_data sram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x80000000 , - .size =128 *1024 *1024 , - .platform_data = &sram_pdata, -}; -#ifdef CONFIG_USB_EHCI_OMAP static struct omap_hcd omap_ehci_pdata = { .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
@@ -324,11 +311,13 @@ static struct device_d hsmmc_dev = {static int beagle_devices_init (void ) { -int ret; +struct device_d *sdram_dev; - ret =register_device (&sdram_dev); -if (ret) - goto failed; + sdram_dev =add_mem_device ("ram0" ,0x80000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +if (!sdram_dev) +return -EIO ; +armlinux_add_dram (sdram_dev);i2c_register_board_info (0 , i2c_devices,ARRAY_SIZE (i2c_devices));register_device (&i2c_dev);
@@ -345,11 +334,10 @@ static int beagle_devices_init(void)register_device (&hsmmc_dev); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_OMAP3_BEAGLE ); -failed: -return ret; + +return 0 ; }device_initcall (beagle_devices_init);
arch/arm/boards/omap/board-omap3evm.c +8 -22
@@ -58,6 +58,7 @@#include <mach/control.h> #include <mach/omap3-mux.h> #include <mach/gpmc.h> +#include <errno.h> #include "board.h"
@@ -241,26 +242,15 @@ 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 =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x80000000 , - .size =128 *1024 *1024 , - .platform_data = &sram_pdata, -}; -static int omap3evm_init_devices (void ) { -int ret; +struct device_d *sdram_dev; - ret =register_device (&sdram_dev); -if (ret) - goto failed; + sdram_dev =add_mem_device ("ram0" ,0x80000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +if (!sdram_dev) +return -EIO ; +armlinux_add_dram (sdram_dev);#ifdef CONFIG_GPMC /*
@@ -268,10 +258,6 @@ static int omap3evm_init_devices(void)*/ gpmc_generic_init (0x10 );#endif - -armlinux_add_dram (&sdram_dev); - -failed: -return ret; +return 0 ; }device_initcall (omap3evm_init_devices);
arch/arm/boards/omap/board-sdp343x.c +8 -22
@@ -61,6 +61,7 @@#include <mach/control.h> #include <mach/omap3-mux.h> #include <mach/gpmc.h> +#include <errno.h> #include "board.h" /******************** Board Boot Time *******************/
@@ -641,34 +642,19 @@ static int sdp3430_flash_init(void)return 0 ; } -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x80000000 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -/*-----------------------Generic Devices Initialization ---------------------*/ static int sdp3430_devices_init (void ) { +struct device_d *sdram_dev;int ret; - ret =register_device (&sdram_dev); -if (ret) - goto failed; - ret =sdp3430_flash_init (); -if (ret) - goto failed; -armlinux_add_dram (&sdram_dev); -failed: -return ret; + sdram_dev =add_mem_device ("ram0" ,0x80000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +if (!sdram_dev) +return -EIO ; +armlinux_add_dram (sdram_dev); +return sdp3430_flash_init (); }device_initcall (sdp3430_devices_init);
arch/arm/boards/panda/board.c +5 -15
@@ -52,19 +52,6 @@ static int panda_console_init(void) }console_initcall (panda_console_init); -static struct memory_platform_data sram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x80000000 , - .size =SZ_1G , - .platform_data = &sram_pdata, -}; -#ifdef CONFIG_MMU static int panda_mmu_init (void ) {
@@ -145,6 +132,8 @@ static struct device_d hsmmc_dev = {static int panda_devices_init (void ) { +struct device_d *sdram_dev; +panda_boardrev_init ();if (gpio_get_value (182 )) {
@@ -171,11 +160,12 @@ static int panda_devices_init(void)sr32 (OMAP44XX_SCRM_ALTCLKSRC ,2 ,2 ,0x3 ); } -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0x80000000 ,SZ_1G , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);register_device (&hsmmc_dev);panda_ehci_init (); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_OMAP4_PANDA );
arch/arm/boards/pcm037/pcm037.c +14 -53
107 lines not on this page · raw message
arch/arm/boards/pcm038/pcm038.c +6 -29
@@ -54,32 +54,6 @@ static struct device_d cfi_dev = { .size = 32 * 1024 * 1024, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xa0000000 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; - -static struct memory_platform_data sram_pdata = { - .name ="sram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xc8000000 , - .size =512 *1024 ,/* Can be up to 2MiB */ - .platform_data = &sram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , .phy_addr =1 ,
@@ -191,6 +165,7 @@ static int pcm038_devices_init(void) {int i;char *envdev; +struct device_d *sdram_dev;unsigned int mode[] = {PD0_AIN_FEC_TXD0 ,
@@ -294,8 +269,11 @@ static int pcm038_devices_init(void)register_device (&cfi_dev);imx27_add_nand (&nand_info); -register_device (&sdram_dev); -register_device (&sram_dev); + sdram_dev =add_mem_device ("ram0" ,0xa0000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); +add_mem_device ("ram0" ,0xc8000000 ,512 *1024 ,/* Can be up to 2MiB */ +IORESOURCE_MEM_WRITEABLE );imx27_add_fb (&pcm038_fb_data);#ifdef CONFIG_USB
@@ -330,7 +308,6 @@ static int pcm038_devices_init(void)printf ("Using environment in %s Flash\n" , envdev); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0xa0000100 );armlinux_set_architecture (MACH_TYPE_PCM038 );
arch/arm/boards/pcm043/pcm043.c +5 -15
@@ -61,19 +61,6 @@ static struct fec_platform_data fec_info = { .xcv_type = MII100, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram0_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_SDRAM_CS0 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -struct imx_nand_platform_data nand_info = { .width =1 , .hw_ecc =1 ,
@@ -149,6 +136,7 @@ struct gpio_led led0 = {static int imx35_devices_init (void ) { +struct device_d *sdram_dev;uint32_t reg;/* CS0: Nor Flash */
@@ -189,10 +177,12 @@ static int imx35_devices_init(void) } } -register_device (&sdram0_dev); + + sdram_dev =add_mem_device ("ram0" ,IMX_SDRAM_CS0 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx35_add_fb (&ipu_fb_data); -armlinux_add_dram (&sdram0_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_PCM043 );
arch/arm/boards/pcm049/board.c +7 -29
@@ -63,32 +63,6 @@ static int pcm049_console_init(void) }console_initcall (pcm049_console_init); -static struct memory_platform_data sram_pdata = { - .name ="sram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x40300000 , - .size =48 *1024 , - .platform_data = &sram_pdata, -}; - -static struct memory_platform_data sdram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x80000000 , - .size =SZ_512M , - .platform_data = &sdram_pdata, -}; -#ifdef CONFIG_MMU static int pcm049_mmu_init (void ) {
@@ -141,8 +115,13 @@ static void pcm049_network_init(void)static int pcm049_devices_init (void ) { -register_device (&sdram_dev); -register_device (&sram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,0x80000000 ,SZ_512M , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); +add_mem_device ("ram0" ,0x40300000 ,48 *1024 , +IORESOURCE_MEM_WRITEABLE );register_device (&hsmmc_dev);gpmc_generic_init (0x10 );
@@ -160,7 +139,6 @@ static int pcm049_devices_init(void)dev_add_bb_dev ("env_raw" ,"env0" );#endif -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_PCM049 );
arch/arm/boards/phycard-i.MX27/pca100.c +4 -15
@@ -41,19 +41,6 @@#include <mach/iomux-mx27.h> #include <mach/devices-imx27.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xa0000000 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , .phy_addr =1 ,
@@ -150,6 +137,7 @@ static int pca100_devices_init(void) {int i;struct device_d *nand; +struct device_d *sdram_dev;unsigned int mode[] = {PD0_AIN_FEC_TXD0 ,
@@ -224,7 +212,9 @@ static int pca100_devices_init(void)imx_gpio_mode (mode[i]);imx27_add_nand (&nand_info); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0xa0000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx27_add_fec (&fec_info);imx27_add_mmc0 (NULL );
@@ -241,7 +231,6 @@ static int pca100_devices_init(void)devfs_add_partition ("nand0" ,0x40000 ,0x20000 ,PARTITION_FIXED ,"env_raw" );dev_add_bb_dev ("env_raw" ,"env0" ); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0xa0000100 );armlinux_set_architecture (2149 );
arch/arm/boards/scb9328/scb9328.c +4 -15
@@ -41,19 +41,6 @@ static struct device_d cfi_dev = { .size = 16 * 1024 * 1024, }; -static struct memory_platform_data sdram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x08000000 , - .size =16 *1024 *1024 , - .platform_data = &sdram_pdata, -}; -static struct dm9000_platform_data dm9000_data = { .buswidth =DM9000_WIDTH_16 , .srom =1 ,
@@ -93,6 +80,7 @@ struct gpio_led leds[] = {static int scb9328_devices_init (void ) {int i; +struct device_d *sdram_dev;imx_gpio_mode (PA23_PF_CS5 );imx_gpio_mode (GPIO_PORTB |GPIO_GPIO |GPIO_OUT |21 );
@@ -121,14 +109,15 @@ static int scb9328_devices_init(void)CS5L =0x00000D03 ;register_device (&cfi_dev); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0x08000000 ,16 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);register_device (&dm9000_dev);devfs_add_partition ("nor0" ,0x00000 ,0x40000 ,PARTITION_FIXED ,"self0" );devfs_add_partition ("nor0" ,0x40000 ,0x20000 ,PARTITION_FIXED ,"env0" );protect_file ("/dev/env0" ,1 ); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x08000100 );armlinux_set_architecture (MACH_TYPE_SCB9328 );
arch/arm/mach-at91/at91rm9200_devices.c +5 -22
@@ -20,30 +20,13 @@#include "generic.h" -static struct resource sdram_dev_resources[] = { - [0 ] = { - .start =AT91_CHIPSELECT_1 , - }, -}; - -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .num_resources =ARRAY_SIZE (sdram_dev_resources), - .resource = sdram_dev_resources, - .platform_data = &ram_pdata, -}; -void at91_add_device_sdram (u32 size) { - sdram_dev_resources[0 ].size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,AT91_CHIPSELECT_1 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }/* --------------------------------------------------------------------
arch/arm/mach-at91/at91sam9260_devices.c +5 -22
@@ -21,30 +21,13 @@#include "generic.h" -static struct resource sdram_dev_resources[] = { - [0 ] = { - .start =AT91_CHIPSELECT_1 , - }, -}; - -static struct memory_platform_data sram_pdata = { - .name ="sram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .num_resources =ARRAY_SIZE (sdram_dev_resources), - .resource = sdram_dev_resources, - .platform_data = &sram_pdata, -}; -void at91_add_device_sdram (u32 size) { - sdram_dev_resources[0 ].size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,AT91_CHIPSELECT_1 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }#if defined(CONFIG_DRIVER_NET_MACB )
arch/arm/mach-at91/at91sam9261_devices.c +5 -22
@@ -21,30 +21,13 @@#include "generic.h" -static struct resource sdram_dev_resources[] = { - [0 ] = { - .start =AT91_CHIPSELECT_1 , - }, -}; - -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .num_resources =ARRAY_SIZE (sdram_dev_resources), - .resource = sdram_dev_resources, - .platform_data = &ram_pdata, -}; -void at91_add_device_sdram (u32 size) { - sdram_dev_resources[0 ].size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,AT91_CHIPSELECT_1 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }#if defined(CONFIG_NAND_ATMEL )
arch/arm/mach-at91/at91sam9263_devices.c +5 -22
@@ -21,30 +21,13 @@#include "generic.h" -static struct resource sdram_dev_resources[] = { - [0 ] = { - .start =AT91_CHIPSELECT_1 , - }, -}; - -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .num_resources =ARRAY_SIZE (sdram_dev_resources), - .resource = sdram_dev_resources, - .platform_data = &ram_pdata, -}; -void at91_add_device_sdram (u32 size) { - sdram_dev_resources[0 ].size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,AT91_CHIPSELECT_1 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }#if defined(CONFIG_DRIVER_NET_MACB )
arch/arm/mach-at91/at91sam9g45_devices.c +5 -22
@@ -21,30 +21,13 @@#include "generic.h" -static struct resource sdram_dev_resources[] = { - [0 ] = { - .start =AT91_CHIPSELECT_6 , - }, -}; - -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .num_resources =ARRAY_SIZE (sdram_dev_resources), - .resource = sdram_dev_resources, - .platform_data = &ram_pdata, -}; -void at91_add_device_sdram (u32 size) { - sdram_dev_resources[0 ].size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,AT91_CHIPSELECT_6 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }#if defined(CONFIG_DRIVER_NET_MACB )
arch/arm/mach-nomadik/8815.c +5 -22
@@ -31,30 +31,13 @@ static struct clk st8815_clk_48 = { .rate = 48 * 1000 * 1000, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct resource sdram_dev_resources[] = { - [0 ] = { - .start =0x00000000 , - }, -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .num_resources =ARRAY_SIZE (sdram_dev_resources), - .resource = sdram_dev_resources, - .platform_data = &ram_pdata, -}; -void st8815_add_device_sdram (u32 size) { - sdram_dev_resources[0 ].size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,0x00000000 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }static struct resource uart0_serial_resources[] = {
arch/arm/mach-versatile/core.c +5 -15
@@ -42,23 +42,13 @@#include <mach/platform.h> #include <mach/init.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x00000000 , - .platform_data = &ram_pdata, -}; -void versatile_add_sdram (u32 size) { - sdram_dev.size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,0x00000000 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }static struct device_d uart0_serial_device = {
arch/blackfin/boards/ipe337/ipe337.c +2 -14
@@ -12,19 +12,6 @@ static struct device_d cfi_dev = { .size = 32 * 1024 * 1024, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x0 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct device_d smc911x_dev = { .id =-1 , .name ="smc911x" ,
@@ -34,7 +21,8 @@ static struct device_d smc911x_dev = {static int ipe337_devices_init (void ) {register_device (&cfi_dev); -register_device (&sdram_dev); +add_mem_device ("ram0" ,0x0 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE );/* Reset smc911x */ *pFIO0_DIR = (1 <<12 );
arch/nios2/boards/generic/generic.c +2 -14
@@ -21,19 +21,6 @@ static struct device_d mac_dev = { .platform_data = &phy_address, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d ram_dev = { - .id =-1 , - .name ="mem" , - .map_base =NIOS_SOPC_MEMORY_BASE , - .size =NIOS_SOPC_MEMORY_SIZE , - .platform_data = &ram_pdata, -}; -static struct device_d altera_serial_device = { .id =-1 , .name ="altera_serial" ,
@@ -51,7 +38,8 @@ static struct device_d epcs_flash_device = {static int generic_devices_init (void ) {register_device (&cfi_dev); -register_device (&ram_dev); +add_mem_device ("ram0" ,NIOS_SOPC_MEMORY_BASE ,NIOS_SOPC_MEMORY_SIZE , +IORESOURCE_MEM_WRITEABLE );register_device (&mac_dev);/*register_device(&epcs_flash_device);*/
arch/ppc/boards/pcm030/pcm030.c +2 -14
@@ -44,19 +44,6 @@ struct device_d cfi_dev = { .size = 16 * 1024 * 1024, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x0 , - .size =64 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct mpc5xxx_fec_platform_data fec_info = { .xcv_type =MII100 , };
@@ -71,7 +58,8 @@ struct device_d eth_dev = {static int devices_init (void ) {register_device (&cfi_dev); -register_device (&sdram_dev); +add_mem_device ("ram0" ,0x0 ,64 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE );register_device (ð_dev);devfs_add_partition ("nor0" ,0x00f00000 ,0x40000 ,PARTITION_FIXED ,"self0" );
arch/x86/boards/x86_generic/generic_pc.c +2 -14
@@ -30,19 +30,6 @@#include <asm/syslib.h> #include <ns16550.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .size =16 *1024 *1024 , - .map_base =0 , - .platform_data = &ram_pdata, -}; -static struct device_d bios_disk_dev = { .id =-1 , .name ="biosdrive" ,
@@ -70,7 +57,8 @@ static int devices_init(void) sdram_dev.size =bios_get_memsize ();/* extended memory only */ sdram_dev.size <<=10 ; -register_device (&sdram_dev); +add_mem_device ("ram0" ,0x0 ,16 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE );register_device (&bios_disk_dev);if (pers_env_size !=PATCH_AREA_PERS_SIZE_UNUSED ) {
commands/mem.c +8 -24
@@ -1,14 +1,12 @@/* -* (C) Copyright 2000 -* Wolfgang Denk, DENX Software Engineering, [email protected]. +* Copyright (c) 2011 Sascha Hauer <[email protected]>, Pengutronix * * See file CREDITS for list of people who contributed to this * project. * -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License, or (at your option) any later version. +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,7 +15,7 @@* * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * MA 02111-1307 USA */
@@ -589,14 +587,13 @@ static struct file_operations memops = {static int mem_probe (struct device_d *dev) { -struct memory_platform_data *pdata = dev->platform_data;struct cdev *cdev; cdev =xzalloc (sizeof (*cdev)); dev->priv = cdev; - cdev->name = pdata->name; - cdev->size = dev->size; + cdev->name = (char *)dev->resource[0 ].name; + cdev->size = (unsigned long )dev->resource[0 ].size; cdev->ops = &memops; cdev->dev = dev;
@@ -610,19 +607,6 @@ static struct driver_d mem_drv = { .probe = mem_probe, }; -static struct memory_platform_data mem_dev_pdata = { - .name ="mem" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d mem_dev = { - .id =-1 , - .name ="mem" , - .map_base =0 , - .size = ~0 ,/* FIXME: should be 0x100000000, ahem... */ - .platform_data = &mem_dev_pdata, -}; -static int mem_init (void ) { rw_buf =malloc (RW_BUF_SIZE );
@@ -631,8 +615,8 @@ static int mem_init(void)return -1 ; } +add_mem_device ("mem" ,0 , ~0 ,IORESOURCE_MEM_WRITEABLE );register_driver (&mem_drv); -register_device (&mem_dev);return 0 ; }
common/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-$(CONFIG_POLLER) += poller.o obj-$(CONFIG_BLOCK) += block.o obj-y += memory.o +obj-y += mem.o obj-$(CONFIG_MALLOC_DLMALLOC) += dlmalloc.o obj-$(CONFIG_MALLOC_DUMMY) += dummy_malloc.o obj-y += clock.o
common/startup.c +3 -13
@@ -82,21 +82,11 @@ void early_init (void)#ifdef CONFIG_DEFAULT_ENVIRONMENT #include <generated/barebox_default_env.h> -static struct memory_platform_data default_env_platform_data = { - .name ="defaultenv" , -}; - -static struct device_d default_env_dev = { - .id =-1 , - .name ="mem" , - .platform_data = &default_env_platform_data, -}; -static int register_default_env (void ) { - default_env_dev.map_base = (unsigned long )default_environment; - default_env_dev.size =sizeof (default_environment); -register_device (&default_env_dev); +add_mem_device ("defaultenv" , (unsigned long )default_environment, +sizeof (default_environment), +IORESOURCE_MEM_WRITEABLE );return 0 ; }
include/driver.h +6 -5
@@ -202,6 +202,12 @@ static inline void __iomem *dev_request_mem_region(struct device_d *dev, int numreturn dev_get_mem_region (dev, num); } +/* +* register a memory device +*/ +struct device_d *add_mem_device (const char *name,resource_size_t start, +resource_size_t size,unsigned int flags); +/* linear list over all available devices */ extern struct list_head device_list;
@@ -349,10 +355,5 @@ int devfs_add_partition(const char *devname, unsigned long offset, size_t size, int flags, const char *name);int devfs_del_partition (const char *name); -struct memory_platform_data { -char *name; -unsigned int flags; -}; -#endif /* DRIVER_H */
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerRe: [PATCH 04/16] add a add_mem_device function
Quoted 17 lines · Jean-Christophe PLAGNIOL-VILLARD
From: Sascha Hauer <[email protected]>
Add a helper function for boards to register their memory devices. This makes the board code smaller and also helps getting rid of
map_baseand structmemory_platform_data.And switch all of the memory to it
Signed-off-by Sascha Hauer <[email protected]>Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>---
common/Makefile +0
-0
common/Makefile obj-$(CONFIG_POLLER) += poller.o · line 12
Quoted 4 lines
common/Makefile +1
-0@@ -9,6 +9,7 @@ obj-$(CONFIG_POLLER) += poller.o obj-$(CONFIG_BLOCK) += block.o obj-y += memory.o +obj-y += mem.o
Seems you forgot to git add common/mem.c.
I think the previous patch can be squashed into this one. Other than that the series looks good.
Thanks
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
Re: [PATCH 04/16] add a add_mem_device function
Quoted 20 lines · Sascha Hauer
Quoted 19 lines · Jean-Christophe PLAGNIOL-VILLARD
From: Sascha Hauer <[email protected]>
Add a helper function for boards to register their memory devices. This makes the board code smaller and also helps getting rid of
map_baseand structmemory_platform_data.And switch all of the memory to it
Signed-off-by Sascha Hauer <[email protected]>Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>---
common/Makefile +0
-0@@ -9,6 +9,7 @@ obj-$(CONFIG_POLLER) += poller.o obj-$(CONFIG_BLOCK) += block.o
Quoted 7 lines
common/Makefile obj-$(CONFIG_POLLER) += poller.o · line 12
Quoted 2 lines
common/Makefile +1
-0obj-y += memory.o +obj-y += mem.oSeems you forgot to git add
common/mem.c.I think the previous patch can be squashed into this one. Other than that the series looks good.
I see I resend the v3 with it
no we need to new helpper in common otherwise the xload config will not compile
the git is update you can pull it with the v3 of it inside
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 4/16 add a add_mem_device function
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
Add a helper function for boards to register their memory devices. This makes the board code smaller and also helps getting rid of map_base and struct memory_platform_data.
And switch all of the memory to it
---
v3:
forget to add common/mem.c
Best Regards,
J.
arch/arm/boards/a9m2410/a9m2410.c | 35 +++----- arch/arm/boards/a9m2440/a9m2440.c | 22 +---- arch/arm/boards/chumby_falconwing/falconwing.c | 21 +---- arch/arm/boards/edb93xx/edb93xx.c | 91 ++++----------------- arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 20 +---- arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c | 19 +---- arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c | 20 +---- arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c | 20 +---- arch/arm/boards/freescale-mx23-evk/mx23-evk.c | 20 +---- arch/arm/boards/freescale-mx25-3-stack/3stack.c | 48 +++-------- arch/arm/boards/freescale-mx35-3-stack/3stack.c | 19 +---- arch/arm/boards/freescale-mx51-pdk/board.c | 19 +---- arch/arm/boards/guf-cupid/board.c | 19 +---- arch/arm/boards/guf-neso/board.c | 19 +---- arch/arm/boards/imx21ads/imx21ads.c | 19 +---- arch/arm/boards/imx27ads/imx27ads.c | 21 +---- arch/arm/boards/karo-tx25/board.c | 54 +++---------- arch/arm/boards/karo-tx28/tx28.c | 22 +---- arch/arm/boards/mini2440/mini2440.c | 24 ++---- arch/arm/boards/netx/netx.c | 21 ++---- arch/arm/boards/omap/board-beagle.c | 28 ++----- arch/arm/boards/omap/board-omap3evm.c | 30 ++----- arch/arm/boards/omap/board-sdp343x.c | 30 ++----- arch/arm/boards/panda/board.c | 20 +---- arch/arm/boards/pcm037/pcm037.c | 67 +++------------ arch/arm/boards/pcm038/pcm038.c | 35 ++------- arch/arm/boards/pcm043/pcm043.c | 20 +---- arch/arm/boards/pcm049/board.c | 36 ++------- arch/arm/boards/phycard-i.MX27/pca100.c | 19 +---- arch/arm/boards/scb9328/scb9328.c | 19 +---- arch/arm/mach-at91/at91rm9200_devices.c | 27 +----- arch/arm/mach-at91/at91sam9260_devices.c | 27 +----- arch/arm/mach-at91/at91sam9261_devices.c | 27 +----- arch/arm/mach-at91/at91sam9263_devices.c | 27 +----- arch/arm/mach-at91/at91sam9g45_devices.c | 27 +----- arch/arm/mach-nomadik/8815.c | 27 +----- arch/arm/mach-versatile/core.c | 20 +---- arch/blackfin/boards/ipe337/ipe337.c | 16 +--- arch/nios2/boards/generic/generic.c | 16 +--- arch/ppc/boards/pcm030/pcm030.c | 16 +--- arch/x86/boards/x86_generic/generic_pc.c | 16 +--- commands/mem.c | 32 ++------ common/Makefile | 1 + common/mem.c | 46 +++++++++++ common/startup.c | 16 +--- include/driver.h | 11 ++- 46 files changed, 307 insertions(+), 902 deletions(-) create mode 100644 common/mem.c
arch/arm/boards/a9m2410/a9m2410.c +13 -22
@@ -35,18 +35,6 @@#include <mach/s3c24x0-iomap.h> #include <mach/s3c24x0-nand.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="ram" , - .map_base =CS6_BASE , - .platform_data = &ram_pdata, -}; -// {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0}, static struct s3c24x0_nand_platform_data nand_info = { .nand_timing =CALC_NFCONF_TIMING (A9M2410_TACLS ,A9M2410_TWRPH0 ,A9M2410_TWRPH1 )
@@ -74,6 +62,8 @@ static struct device_d network_dev = {static int a9m2410_devices_init (void ) {uint32_t reg; +resource_size_t size =0 ; +struct device_d *sdram_dev;/* * detect the current memory size
@@ -83,25 +73,25 @@ static int a9m2410_devices_init(void)switch (reg &=0x7 ) {case 0 : - sdram_dev.size =32 *1024 *1024 ; + size =32 *1024 *1024 ;break ;case 1 : - sdram_dev.size =64 *1024 *1024 ; + size =64 *1024 *1024 ;break ;case 2 : - sdram_dev.size =128 *1024 *1024 ; + size =128 *1024 *1024 ;break ;case 4 : - sdram_dev.size =2 *1024 *1024 ; + size =2 *1024 *1024 ;break ;case 5 : - sdram_dev.size =4 *1024 *1024 ; + size =4 *1024 *1024 ;break ;case 6 : - sdram_dev.size =8 *1024 *1024 ; + size =8 *1024 *1024 ;break ;case 7 : - sdram_dev.size =16 *1024 *1024 ; + size =16 *1024 *1024 ;break ; }
@@ -152,7 +142,8 @@ static int a9m2410_devices_init(void)/* ----------- the devices the boot loader should work with -------- */ register_device (&nand_dev); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,CS6_BASE , size, +IORESOURCE_MEM_WRITEABLE );register_device (&network_dev);#ifdef CONFIG_NAND
@@ -164,8 +155,8 @@ static int a9m2410_devices_init(void)dev_add_bb_dev ("env_raw" ,"env0" );#endif -armlinux_add_dram (&sdram_dev); -armlinux_set_bootparams ((void *)sdram_dev.map_base +0x100 ); +armlinux_add_dram (sdram_dev); +armlinux_set_bootparams (dev_get_mem_region (sdram_dev,0 ) +0x100 );armlinux_set_architecture (MACH_TYPE_A9M2410 );return 0 ;
arch/arm/boards/a9m2440/a9m2440.c +5 -17
@@ -38,18 +38,6 @@#include "baseboards.h" -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =CS6_BASE , - .platform_data = &ram_pdata, -}; -static struct s3c24x0_nand_platform_data nand_info = { .nand_timing =CALC_NFCONF_TIMING (A9M2440_TACLS ,A9M2440_TWRPH0 ,A9M2440_TWRPH1 ) };
@@ -106,6 +94,7 @@ static void a9m2440_disable_second_sdram_bank(void)static int a9m2440_devices_init (void ) {uint32_t reg; +struct device_d *sdram_dev;/* * The special SDRAM setup code for this machine will always enable
@@ -136,8 +125,6 @@ static int a9m2440_devices_init(void)break ; } - sdram_dev.size =s3c24x0_get_memory_size (); -/* ----------- configure the access to the outer space ---------- */ reg =readl (BWSCON );
@@ -159,7 +146,8 @@ static int a9m2440_devices_init(void)/* ----------- the devices the boot loader should work with -------- */ register_device (&nand_dev); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,CS6_BASE ,s3c24x0_get_memory_size (), +IORESOURCE_MEM_WRITEABLE );register_device (&network_dev);#ifdef CONFIG_NAND
@@ -170,8 +158,8 @@ static int a9m2440_devices_init(void)devfs_add_partition ("nand0" ,0x40000 ,0x20000 ,PARTITION_FIXED ,"env_raw" );dev_add_bb_dev ("env_raw" ,"env0" );#endif -armlinux_add_dram (&sdram_dev); -armlinux_set_bootparams ((void *)sdram_dev.map_base +0x100 ); +armlinux_add_dram (sdram_dev); +armlinux_set_bootparams (dev_get_mem_region (sdram_dev,0 ) +0x100 );armlinux_set_architecture (MACH_TYPE_A9M2440 );return 0 ;
arch/arm/boards/chumby_falconwing/falconwing.c +5 -16
@@ -34,19 +34,6 @@#include <mach/fb.h> #include <mach/usb.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_MEMORY_BASE , - .size =64 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct mxs_mci_platform_data mci_pdata = { .caps =MMC_MODE_4BIT |MMC_MODE_HS | MMC_MODE_HS_52MHz, .voltages =MMC_VDD_32_33 |MMC_VDD_33_34 ,/* fixed to 3.3 V */
@@ -372,12 +359,14 @@ static void falconwing_init_usb(void)static int falconwing_devices_init (void ) {int i, rc; +struct device_d *sdram_dev;/* initizalize gpios */ for (i =0 ; i <ARRAY_SIZE (pad_setup); i++)imx_gpio_mode (pad_setup[i]); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,IMX_MEMORY_BASE ,64 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE );imx_set_ioclk (480000000 );/* enable IOCLK to run at the PLL frequency */ /* run the SSP unit clock at 100,000 kHz */ imx_set_sspclk (0 ,100000000 ,1 );
@@ -386,8 +375,8 @@ static int falconwing_devices_init(void)falconwing_init_usb (); -armlinux_add_dram (&sdram_dev); -armlinux_set_bootparams ((void *)(sdram_dev.map_base +0x100 )); +armlinux_add_dram (sdram_dev); +armlinux_set_bootparams (dev_get_mem_region (sdram_dev,0 ) +0x100 );armlinux_set_architecture (MACH_TYPE_CHUMBY ); rc =register_persistant_environment ();
arch/arm/boards/edb93xx/edb93xx.c +18 -73
114 lines not on this page · raw message
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +5 -15
@@ -90,19 +90,6 @@ static struct fec_platform_data fec_info = { .phy_addr = 1, }; -static struct memory_platform_data sdram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram0_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_SDRAM_CS0 , - .size =64 *1024 *1024 , - .platform_data = &sdram_pdata, -}; -struct imx_nand_platform_data nand_info = { .width =1 , .hw_ecc =1 ,
@@ -255,6 +242,8 @@ static struct pad_desc eukrea_cpuimx25_pads[] = {static int eukrea_cpuimx25_devices_init (void ) { +struct device_d *sdram_dev; +eukrea_cpuimx25_mmu_init (); mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads,
@@ -275,7 +264,9 @@ static int eukrea_cpuimx25_devices_init(void) PARTITION_FIXED, "env_raw");dev_add_bb_dev ("env_raw" ,"env0" ); -register_device (&sdram0_dev); + sdram_dev =add_mem_device ("ram0" ,IMX_SDRAM_CS0 ,64 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);/* enable LCD */ gpio_direction_output (26 ,1 );
@@ -295,7 +286,6 @@ static int eukrea_cpuimx25_devices_init(void)#endif register_device (&usbotg_dev); -armlinux_add_dram (&sdram0_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_EUKREA_CPUIMX25 );
arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c +4 -15
@@ -63,25 +63,12 @@ static struct device_d cfi_dev1 = { };#endif -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; -#if definedCONFIG_EUKREA_CPUIMX27_SDRAM_256MB #define SDRAM0 256#elif definedCONFIG_EUKREA_CPUIMX27_SDRAM_128MB #define SDRAM0 128#endif -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xa0000000 , - .size =SDRAM0 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , .phy_addr =1 ,
@@ -197,6 +184,7 @@ static struct device_d imxfb_dev = {static int eukrea_cpuimx27_devices_init (void ) { +struct device_d *sdram_dev;char *envdev ="no" ;int i;
@@ -271,7 +259,9 @@ static int eukrea_cpuimx27_devices_init(void)register_device (&cfi_dev1);#endif imx27_add_nand (&nand_info); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0xa0000000 ,SDRAM0 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);PCCR0 |=PCCR0_I2C1_EN ;i2c_register_board_info (0 , i2c_devices,ARRAY_SIZE (i2c_devices));
@@ -292,7 +282,6 @@ static int eukrea_cpuimx27_devices_init(void)gpio_set_value (GPIO_PORTA |25 ,1 );#endif -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0xa0000100 );armlinux_set_architecture (MACH_TYPE_CPUIMX27 );
arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c +5 -15
@@ -61,19 +61,6 @@ static struct fec_platform_data fec_info = { .phy_addr = 0x1F, }; -static struct memory_platform_data sdram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_SDRAM_CS0 , - .size =128 *1024 *1024 , - .platform_data = &sdram_pdata, -}; -struct imx_nand_platform_data nand_info = { .width =1 , .hw_ecc =1 ,
@@ -173,6 +160,8 @@ postcore_initcall(eukrea_cpuimx35_mmu_init);static int eukrea_cpuimx35_devices_init (void ) { +struct device_d *sdram_dev; +imx35_add_nand (&nand_info);devfs_add_partition ("nand0" ,0x00000 ,0x40000 ,PARTITION_FIXED ,"self_raw" );
@@ -182,7 +171,9 @@ static int eukrea_cpuimx35_devices_init(void)imx35_add_fec (&fec_info); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,IMX_SDRAM_CS0 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx35_add_fb (&ipu_fb_data);imx35_add_i2c0 (NULL );
@@ -198,7 +189,6 @@ static int eukrea_cpuimx35_devices_init(void)writel (tmp | (1 <<23 ),IMX_OTG_BASE +0x608 );register_device (&usbotg_dev);#endif -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_EUKREA_CPUIMX35 );
arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c +5 -15
@@ -42,19 +42,6 @@#include <mach/iomux-mx51.h> #include <mach/devices-imx51.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x90000000 , - .size =256 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , };
@@ -132,9 +119,13 @@ static void eukrea_cpuimx51_mmu_init(void)static int eukrea_cpuimx51_devices_init (void ) { +struct device_d *sdram_dev; +eukrea_cpuimx51_mmu_init (); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0x90000000 ,256 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx51_add_fec (&fec_info);#ifdef CONFIG_MCI_IMX_ESDHC imx51_add_mmc0 (NULL );
@@ -150,7 +141,6 @@ static int eukrea_cpuimx51_devices_init(void)gpio_set_value (GPIO_LAN8700_RESET ,1 );gpio_direction_output (GPIO_LCD_BL ,0 ); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x90000100 );armlinux_set_architecture (MACH_TYPE_EUKREA_CPUIMX51SD );
arch/arm/boards/freescale-mx23-evk/mx23-evk.c +5 -15
@@ -25,24 +25,14 @@#include <generated/mach-types.h> #include <mach/imx-regs.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .name ="mem" , - .map_base =IMX_MEMORY_BASE , - .size =32 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static int mx23_evk_devices_init (void ) { -register_device (&sdram_dev); +struct device_d *sdram_dev; -armlinux_add_dram (&sdram_dev); -armlinux_set_bootparams ((void *)(sdram_dev.map_base +0x100 )); + sdram_dev =add_mem_device ("ram0" ,IMX_MEMORY_BASE ,32 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); +armlinux_set_bootparams (dev_get_mem_region (sdram_dev,0 ) +0x100 );armlinux_set_architecture (MACH_TYPE_MX23EVK );return 0 ;
arch/arm/boards/freescale-mx25-3-stack/3stack.c +13 -35
70 lines not on this page · raw message
arch/arm/boards/freescale-mx35-3-stack/3stack.c +4 -15
@@ -71,19 +71,6 @@ static struct fec_platform_data fec_info = { .phy_addr = 0x1F, }; -static struct memory_platform_data sdram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_SDRAM_CS0 , - .size =128 *1024 *1024 , - .platform_data = &sdram_pdata, -}; -struct imx_nand_platform_data nand_info = { .hw_ecc =1 , .flash_bbt =1 ,
@@ -165,6 +152,7 @@ static void set_board_rev(int rev)static int f3s_devices_init (void ) {uint32_t reg; +struct device_d *sdram_dev;/* CS0: Nor Flash */ writel (0x0000cf03 ,CSCR_U (0 ));
@@ -209,10 +197,11 @@ static int f3s_devices_init(void)imx35_add_mmc0 (NULL ); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,IMX_SDRAM_CS0 ,124 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx35_add_fb (&ipu_fb_data); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_MX35_3DS );
arch/arm/boards/freescale-mx51-pdk/board.c +4 -15
@@ -41,19 +41,6 @@#include <mach/iomux-mx51.h> #include <mach/devices-imx51.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x90000000 , - .size =512 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , };
@@ -242,9 +229,12 @@ static void babbage_power_init(void)static int f3s_devices_init (void ) { +struct device_d *sdram_dev;babbage_mmu_init (); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0x90000000 ,512 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx51_add_fec (&fec_info);imx51_add_mmc0 (NULL );
@@ -254,7 +244,6 @@ static int f3s_devices_init(void)babbage_power_init (); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x90000100 );armlinux_set_architecture (MACH_TYPE_MX51_BABBAGE );
arch/arm/boards/guf-cupid/board.c +4 -15
@@ -55,19 +55,6 @@ static struct device_d fec_dev = { .platform_data = &fec_info, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram0_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_SDRAM_CS0 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -struct imx_nand_platform_data nand_info = { .width =1 , .hw_ecc =1 ,
@@ -158,6 +145,7 @@ postcore_initcall(cupid_mmu_init);static int cupid_devices_init (void ) {uint32_t reg; +struct device_d *sdram_dev;gpio_direction_output (GPIO_LCD_ENABLE ,0 );gpio_direction_output (GPIO_LCD_BACKLIGHT ,0 );
@@ -177,11 +165,12 @@ static int cupid_devices_init(void)devfs_add_partition ("nand0" ,0x40000 ,0x80000 ,PARTITION_FIXED ,"env_raw" );dev_add_bb_dev ("env_raw" ,"env0" ); -register_device (&sdram0_dev); + sdram_dev =add_mem_device ("ram0" ,IMX_SDRAM_CS0 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);register_device (&imx_ipu_fb_dev);register_device (&esdhc_dev); -armlinux_add_dram (&sdram0_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_GUF_CUPID );
arch/arm/boards/guf-neso/board.c +4 -15
@@ -54,19 +54,6 @@#define LCD_POWER_GPIO (GPIO_PORTF + 18)#define BACKLIGHT_POWER_GPIO (GPIO_PORTE + 5) -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xa0000000 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , .phy_addr =31 ,
@@ -178,6 +165,7 @@ static void neso_mmu_init(void)static int neso_devices_init (void ) {int i; +struct device_d *sdram_dev;unsigned int mode[] = {/* UART1 */
@@ -309,7 +297,9 @@ static int neso_devices_init(void)imx_gpio_mode (mode[i]);imx27_add_nand (&nand_info); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0xa0000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx27_add_fb (&neso_fb_data);#ifdef CONFIG_USB
@@ -325,7 +315,6 @@ static int neso_devices_init(void)devfs_add_partition ("nand0" ,0x40000 ,0x80000 ,PARTITION_FIXED ,"env_raw" );dev_add_bb_dev ("env_raw" ,"env0" ); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0xa0000100 );armlinux_set_architecture (MACH_TYPE_NESO );
arch/arm/boards/imx21ads/imx21ads.c +4 -15
@@ -48,19 +48,6 @@ static struct device_d cfi_dev = { .size = 32 * 1024 * 1024, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xc0000000 , - .size =64 *1024 *1024 , - .platform_data = &ram_pdata, -}; -struct imx_nand_platform_data nand_info = { .width =1 , .hw_ecc =1 ,
@@ -145,6 +132,7 @@ core_initcall(imx21ads_timing_init);static int mx21ads_devices_init (void ) {int i; +struct device_d *sdram_dev;unsigned int mode[] = {PA5_PF_LSCLK ,PA6_PF_LD0 ,
@@ -184,12 +172,13 @@ static int mx21ads_devices_init(void)imx_gpio_mode (mode[i]);register_device (&cfi_dev); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0xc0000000 ,64 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx21_add_nand (&nand_info);register_device (&cs8900_dev);imx21_add_fb (&imx_fb_data); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0xc0000100 );armlinux_set_architecture (MACH_TYPE_MX21ADS );
arch/arm/boards/imx27ads/imx27ads.c +5 -16
@@ -41,19 +41,6 @@ static struct device_d cfi_dev = { .size = 32 * 1024 * 1024, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xa0000000 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , .phy_addr =1 ,
@@ -97,6 +84,7 @@ core_initcall(imx27ads_timing_init);static int mx27ads_devices_init (void ) {int i; +struct device_d *sdram_dev;unsigned int mode[] = {PD0_AIN_FEC_TXD0 ,PD1_AIN_FEC_TXD1 ,
@@ -127,14 +115,15 @@ static int mx27ads_devices_init(void)imx_gpio_mode (mode[i]);register_device (&cfi_dev); -register_device (&sdram_dev); -imx27_add_fec (&fec_info); + sdram_dev =add_mem_device ("ram0" ,0xa0000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); +imx27_add_fec (&fec_info);devfs_add_partition ("nor0" ,0x00000 ,0x20000 ,PARTITION_FIXED ,"self0" );devfs_add_partition ("nor0" ,0x20000 ,0x20000 ,PARTITION_FIXED ,"env0" );protect_file ("/dev/env0" ,1 ); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0xa0000100 );armlinux_set_architecture (MACH_TYPE_MX27ADS );
arch/arm/boards/karo-tx25/board.c +10 -44
73 lines not on this page · raw message
arch/arm/boards/karo-tx28/tx28.c +5 -17
@@ -23,19 +23,6 @@#include <mach/imx-regs.h> #include <asm/mmu.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_MEMORY_BASE , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -/* setup the CPU card internal signals */ static const uint32_t tx28_pad_setup[] = {/* NAND interface */
@@ -103,15 +90,16 @@ postcore_initcall(tx28_mmu_init);static int tx28_devices_init (void ) {int i; +struct device_d *sdram_dev;/* initizalize gpios */ for (i =0 ; i <ARRAY_SIZE (tx28_pad_setup); i++)imx_gpio_mode (tx28_pad_setup[i]); -register_device (&sdram_dev); - -armlinux_add_dram (&sdram_dev); -armlinux_set_bootparams ((void *)(sdram_dev.map_base +0x100 )); + sdram_dev =add_mem_device ("ram0" ,IMX_MEMORY_BASE ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); +armlinux_set_bootparams (dev_get_mem_region (sdram_dev,0 ) +0x100 );armlinux_set_architecture (MACH_TYPE_TX28 );base_board_init ();
arch/arm/boards/mini2440/mini2440.c +7 -17
@@ -44,18 +44,6 @@#include <mach/mci.h> #include <mach/fb.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =CS6_BASE , - .platform_data = &ram_pdata, -}; -static struct s3c24x0_nand_platform_data nand_info = { .nand_timing =CALC_NFCONF_TIMING (A9M2440_TACLS ,A9M2440_TWRPH0 ,A9M2440_TWRPH1 ), .flash_bbt =1 ,/* same as the kernel */
@@ -316,8 +304,7 @@ static int mini2440_devices_init(void) {uint32_t reg;int i; - - sdram_dev.size =s3c24x0_get_memory_size (); +struct device_d *sdram_dev;/* ----------- configure the access to the outer space ---------- */ for (i =0 ; i <ARRAY_SIZE (pin_usage); i++)
@@ -338,7 +325,11 @@ static int mini2440_devices_init(void)writel (reg,MISCCR );register_device (&nand_dev); -register_device (&sdram_dev); + + sdram_dev =add_mem_device ("ram0" ,CS6_BASE ,s3c24x0_get_memory_size (), +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); +register_device (&dm9000_dev);#ifdef CONFIG_NAND /* ----------- add some vital partitions -------- */
@@ -352,8 +343,7 @@ static int mini2440_devices_init(void)#endif register_device (&mci_dev);register_device (&s3cfb_dev); -armlinux_add_dram (&sdram_dev); -armlinux_set_bootparams ((void *)sdram_dev.map_base +0x100 ); +armlinux_set_bootparams (dev_get_mem_region (sdram_dev,0 ) +0x100 );armlinux_set_architecture (MACH_TYPE_MINI2440 );return 0 ;
arch/arm/boards/netx/netx.c +6 -15
@@ -37,19 +37,6 @@ static struct device_d cfi_dev = { .size = 32 * 1024 * 1024, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x80000000 , - .size =64 *1024 *1024 , - .platform_data = &ram_pdata, -}; -struct netx_eth_platform_data eth0_data = { .xcno =0 , };
@@ -71,8 +58,13 @@ static struct device_d netx_eth_dev1 = { };static int netx_devices_init (void ) { +struct device_d *sdram_dev; +register_device (&cfi_dev); -register_device (&sdram_dev); + + sdram_dev =add_mem_device ("ram0" ,0x80000000 ,64 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);register_device (&netx_eth_dev0);register_device (&netx_eth_dev1);
@@ -83,7 +75,6 @@ static int netx_devices_init(void) {protect_file ("/dev/env0" ,1 ); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_NXDB500 );
arch/arm/boards/omap/board-beagle.c +8 -20
@@ -264,19 +264,6 @@ static int beagle_console_init(void)console_initcall (beagle_console_init);#endif /* CONFIG_DRIVER_SERIAL_NS16550 */ -static struct memory_platform_data sram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x80000000 , - .size =128 *1024 *1024 , - .platform_data = &sram_pdata, -}; -#ifdef CONFIG_USB_EHCI_OMAP static struct omap_hcd omap_ehci_pdata = { .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
@@ -324,11 +311,13 @@ static struct device_d hsmmc_dev = {static int beagle_devices_init (void ) { -int ret; +struct device_d *sdram_dev; - ret =register_device (&sdram_dev); -if (ret) - goto failed; + sdram_dev =add_mem_device ("ram0" ,0x80000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +if (!sdram_dev) +return -EIO ; +armlinux_add_dram (sdram_dev);i2c_register_board_info (0 , i2c_devices,ARRAY_SIZE (i2c_devices));register_device (&i2c_dev);
@@ -345,11 +334,10 @@ static int beagle_devices_init(void)register_device (&hsmmc_dev); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_OMAP3_BEAGLE ); -failed: -return ret; + +return 0 ; }device_initcall (beagle_devices_init);
arch/arm/boards/omap/board-omap3evm.c +8 -22
@@ -58,6 +58,7 @@#include <mach/control.h> #include <mach/omap3-mux.h> #include <mach/gpmc.h> +#include <errno.h> #include "board.h"
@@ -241,26 +242,15 @@ 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 =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x80000000 , - .size =128 *1024 *1024 , - .platform_data = &sram_pdata, -}; -static int omap3evm_init_devices (void ) { -int ret; +struct device_d *sdram_dev; - ret =register_device (&sdram_dev); -if (ret) - goto failed; + sdram_dev =add_mem_device ("ram0" ,0x80000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +if (!sdram_dev) +return -EIO ; +armlinux_add_dram (sdram_dev);#ifdef CONFIG_GPMC /*
@@ -268,10 +258,6 @@ static int omap3evm_init_devices(void)*/ gpmc_generic_init (0x10 );#endif - -armlinux_add_dram (&sdram_dev); - -failed: -return ret; +return 0 ; }device_initcall (omap3evm_init_devices);
arch/arm/boards/omap/board-sdp343x.c +8 -22
@@ -61,6 +61,7 @@#include <mach/control.h> #include <mach/omap3-mux.h> #include <mach/gpmc.h> +#include <errno.h> #include "board.h" /******************** Board Boot Time *******************/
@@ -641,34 +642,19 @@ static int sdp3430_flash_init(void)return 0 ; } -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x80000000 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -/*-----------------------Generic Devices Initialization ---------------------*/ static int sdp3430_devices_init (void ) { +struct device_d *sdram_dev;int ret; - ret =register_device (&sdram_dev); -if (ret) - goto failed; - ret =sdp3430_flash_init (); -if (ret) - goto failed; -armlinux_add_dram (&sdram_dev); -failed: -return ret; + sdram_dev =add_mem_device ("ram0" ,0x80000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +if (!sdram_dev) +return -EIO ; +armlinux_add_dram (sdram_dev); +return sdp3430_flash_init (); }device_initcall (sdp3430_devices_init);
arch/arm/boards/panda/board.c +5 -15
@@ -52,19 +52,6 @@ static int panda_console_init(void) }console_initcall (panda_console_init); -static struct memory_platform_data sram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x80000000 , - .size =SZ_1G , - .platform_data = &sram_pdata, -}; -#ifdef CONFIG_MMU static int panda_mmu_init (void ) {
@@ -145,6 +132,8 @@ static struct device_d hsmmc_dev = {static int panda_devices_init (void ) { +struct device_d *sdram_dev; +panda_boardrev_init ();if (gpio_get_value (182 )) {
@@ -171,11 +160,12 @@ static int panda_devices_init(void)sr32 (OMAP44XX_SCRM_ALTCLKSRC ,2 ,2 ,0x3 ); } -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0x80000000 ,SZ_1G , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);register_device (&hsmmc_dev);panda_ehci_init (); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_OMAP4_PANDA );
arch/arm/boards/pcm037/pcm037.c +14 -53
107 lines not on this page · raw message
arch/arm/boards/pcm038/pcm038.c +6 -29
@@ -54,32 +54,6 @@ static struct device_d cfi_dev = { .size = 32 * 1024 * 1024, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xa0000000 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; - -static struct memory_platform_data sram_pdata = { - .name ="sram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xc8000000 , - .size =512 *1024 ,/* Can be up to 2MiB */ - .platform_data = &sram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , .phy_addr =1 ,
@@ -191,6 +165,7 @@ static int pcm038_devices_init(void) {int i;char *envdev; +struct device_d *sdram_dev;unsigned int mode[] = {PD0_AIN_FEC_TXD0 ,
@@ -294,8 +269,11 @@ static int pcm038_devices_init(void)register_device (&cfi_dev);imx27_add_nand (&nand_info); -register_device (&sdram_dev); -register_device (&sram_dev); + sdram_dev =add_mem_device ("ram0" ,0xa0000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); +add_mem_device ("ram0" ,0xc8000000 ,512 *1024 ,/* Can be up to 2MiB */ +IORESOURCE_MEM_WRITEABLE );imx27_add_fb (&pcm038_fb_data);#ifdef CONFIG_USB
@@ -330,7 +308,6 @@ static int pcm038_devices_init(void)printf ("Using environment in %s Flash\n" , envdev); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0xa0000100 );armlinux_set_architecture (MACH_TYPE_PCM038 );
arch/arm/boards/pcm043/pcm043.c +5 -15
@@ -61,19 +61,6 @@ static struct fec_platform_data fec_info = { .xcv_type = MII100, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram0_dev = { - .id =-1 , - .name ="mem" , - .map_base =IMX_SDRAM_CS0 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -struct imx_nand_platform_data nand_info = { .width =1 , .hw_ecc =1 ,
@@ -149,6 +136,7 @@ struct gpio_led led0 = {static int imx35_devices_init (void ) { +struct device_d *sdram_dev;uint32_t reg;/* CS0: Nor Flash */
@@ -189,10 +177,12 @@ static int imx35_devices_init(void) } } -register_device (&sdram0_dev); + + sdram_dev =add_mem_device ("ram0" ,IMX_SDRAM_CS0 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx35_add_fb (&ipu_fb_data); -armlinux_add_dram (&sdram0_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_PCM043 );
arch/arm/boards/pcm049/board.c +7 -29
@@ -63,32 +63,6 @@ static int pcm049_console_init(void) }console_initcall (pcm049_console_init); -static struct memory_platform_data sram_pdata = { - .name ="sram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x40300000 , - .size =48 *1024 , - .platform_data = &sram_pdata, -}; - -static struct memory_platform_data sdram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x80000000 , - .size =SZ_512M , - .platform_data = &sdram_pdata, -}; -#ifdef CONFIG_MMU static int pcm049_mmu_init (void ) {
@@ -141,8 +115,13 @@ static void pcm049_network_init(void)static int pcm049_devices_init (void ) { -register_device (&sdram_dev); -register_device (&sram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,0x80000000 ,SZ_512M , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); +add_mem_device ("ram0" ,0x40300000 ,48 *1024 , +IORESOURCE_MEM_WRITEABLE );register_device (&hsmmc_dev);gpmc_generic_init (0x10 );
@@ -160,7 +139,6 @@ static int pcm049_devices_init(void)dev_add_bb_dev ("env_raw" ,"env0" );#endif -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x80000100 );armlinux_set_architecture (MACH_TYPE_PCM049 );
arch/arm/boards/phycard-i.MX27/pca100.c +4 -15
@@ -41,19 +41,6 @@#include <mach/iomux-mx27.h> #include <mach/devices-imx27.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0xa0000000 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct fec_platform_data fec_info = { .xcv_type =MII100 , .phy_addr =1 ,
@@ -150,6 +137,7 @@ static int pca100_devices_init(void) {int i;struct device_d *nand; +struct device_d *sdram_dev;unsigned int mode[] = {PD0_AIN_FEC_TXD0 ,
@@ -224,7 +212,9 @@ static int pca100_devices_init(void)imx_gpio_mode (mode[i]);imx27_add_nand (&nand_info); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0xa0000000 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);imx27_add_fec (&fec_info);imx27_add_mmc0 (NULL );
@@ -241,7 +231,6 @@ static int pca100_devices_init(void)devfs_add_partition ("nand0" ,0x40000 ,0x20000 ,PARTITION_FIXED ,"env_raw" );dev_add_bb_dev ("env_raw" ,"env0" ); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0xa0000100 );armlinux_set_architecture (2149 );
arch/arm/boards/scb9328/scb9328.c +4 -15
@@ -41,19 +41,6 @@ static struct device_d cfi_dev = { .size = 16 * 1024 * 1024, }; -static struct memory_platform_data sdram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x08000000 , - .size =16 *1024 *1024 , - .platform_data = &sdram_pdata, -}; -static struct dm9000_platform_data dm9000_data = { .buswidth =DM9000_WIDTH_16 , .srom =1 ,
@@ -93,6 +80,7 @@ struct gpio_led leds[] = {static int scb9328_devices_init (void ) {int i; +struct device_d *sdram_dev;imx_gpio_mode (PA23_PF_CS5 );imx_gpio_mode (GPIO_PORTB |GPIO_GPIO |GPIO_OUT |21 );
@@ -121,14 +109,15 @@ static int scb9328_devices_init(void)CS5L =0x00000D03 ;register_device (&cfi_dev); -register_device (&sdram_dev); + sdram_dev =add_mem_device ("ram0" ,0x08000000 ,16 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev);register_device (&dm9000_dev);devfs_add_partition ("nor0" ,0x00000 ,0x40000 ,PARTITION_FIXED ,"self0" );devfs_add_partition ("nor0" ,0x40000 ,0x20000 ,PARTITION_FIXED ,"env0" );protect_file ("/dev/env0" ,1 ); -armlinux_add_dram (&sdram_dev);armlinux_set_bootparams ((void *)0x08000100 );armlinux_set_architecture (MACH_TYPE_SCB9328 );
arch/arm/mach-at91/at91rm9200_devices.c +5 -22
@@ -20,30 +20,13 @@#include "generic.h" -static struct resource sdram_dev_resources[] = { - [0 ] = { - .start =AT91_CHIPSELECT_1 , - }, -}; - -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .num_resources =ARRAY_SIZE (sdram_dev_resources), - .resource = sdram_dev_resources, - .platform_data = &ram_pdata, -}; -void at91_add_device_sdram (u32 size) { - sdram_dev_resources[0 ].size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,AT91_CHIPSELECT_1 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }/* --------------------------------------------------------------------
arch/arm/mach-at91/at91sam9260_devices.c +5 -22
@@ -21,30 +21,13 @@#include "generic.h" -static struct resource sdram_dev_resources[] = { - [0 ] = { - .start =AT91_CHIPSELECT_1 , - }, -}; - -static struct memory_platform_data sram_pdata = { - .name ="sram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .num_resources =ARRAY_SIZE (sdram_dev_resources), - .resource = sdram_dev_resources, - .platform_data = &sram_pdata, -}; -void at91_add_device_sdram (u32 size) { - sdram_dev_resources[0 ].size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,AT91_CHIPSELECT_1 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }#if defined(CONFIG_DRIVER_NET_MACB )
arch/arm/mach-at91/at91sam9261_devices.c +5 -22
@@ -21,30 +21,13 @@#include "generic.h" -static struct resource sdram_dev_resources[] = { - [0 ] = { - .start =AT91_CHIPSELECT_1 , - }, -}; - -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .num_resources =ARRAY_SIZE (sdram_dev_resources), - .resource = sdram_dev_resources, - .platform_data = &ram_pdata, -}; -void at91_add_device_sdram (u32 size) { - sdram_dev_resources[0 ].size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,AT91_CHIPSELECT_1 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }#if defined(CONFIG_NAND_ATMEL )
arch/arm/mach-at91/at91sam9263_devices.c +5 -22
@@ -21,30 +21,13 @@#include "generic.h" -static struct resource sdram_dev_resources[] = { - [0 ] = { - .start =AT91_CHIPSELECT_1 , - }, -}; - -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .num_resources =ARRAY_SIZE (sdram_dev_resources), - .resource = sdram_dev_resources, - .platform_data = &ram_pdata, -}; -void at91_add_device_sdram (u32 size) { - sdram_dev_resources[0 ].size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,AT91_CHIPSELECT_1 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }#if defined(CONFIG_DRIVER_NET_MACB )
arch/arm/mach-at91/at91sam9g45_devices.c +5 -22
@@ -21,30 +21,13 @@#include "generic.h" -static struct resource sdram_dev_resources[] = { - [0 ] = { - .start =AT91_CHIPSELECT_6 , - }, -}; - -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .num_resources =ARRAY_SIZE (sdram_dev_resources), - .resource = sdram_dev_resources, - .platform_data = &ram_pdata, -}; -void at91_add_device_sdram (u32 size) { - sdram_dev_resources[0 ].size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,AT91_CHIPSELECT_6 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }#if defined(CONFIG_DRIVER_NET_MACB )
arch/arm/mach-nomadik/8815.c +5 -22
@@ -31,30 +31,13 @@ static struct clk st8815_clk_48 = { .rate = 48 * 1000 * 1000, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct resource sdram_dev_resources[] = { - [0 ] = { - .start =0x00000000 , - }, -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .num_resources =ARRAY_SIZE (sdram_dev_resources), - .resource = sdram_dev_resources, - .platform_data = &ram_pdata, -}; -void st8815_add_device_sdram (u32 size) { - sdram_dev_resources[0 ].size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,0x00000000 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }static struct resource uart0_serial_resources[] = {
arch/arm/mach-versatile/core.c +5 -15
@@ -42,23 +42,13 @@#include <mach/platform.h> #include <mach/init.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x00000000 , - .platform_data = &ram_pdata, -}; -void versatile_add_sdram (u32 size) { - sdram_dev.size = size; -register_device (&sdram_dev); -armlinux_add_dram (&sdram_dev); +struct device_d *sdram_dev; + + sdram_dev =add_mem_device ("ram0" ,0x00000000 , size, +IORESOURCE_MEM_WRITEABLE ); +armlinux_add_dram (sdram_dev); }static struct device_d uart0_serial_device = {
arch/blackfin/boards/ipe337/ipe337.c +2 -14
@@ -12,19 +12,6 @@ static struct device_d cfi_dev = { .size = 32 * 1024 * 1024, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x0 , - .size =128 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct device_d smc911x_dev = { .id =-1 , .name ="smc911x" ,
@@ -34,7 +21,8 @@ static struct device_d smc911x_dev = {static int ipe337_devices_init (void ) {register_device (&cfi_dev); -register_device (&sdram_dev); +add_mem_device ("ram0" ,0x0 ,128 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE );/* Reset smc911x */ *pFIO0_DIR = (1 <<12 );
arch/nios2/boards/generic/generic.c +2 -14
@@ -21,19 +21,6 @@ static struct device_d mac_dev = { .platform_data = &phy_address, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d ram_dev = { - .id =-1 , - .name ="mem" , - .map_base =NIOS_SOPC_MEMORY_BASE , - .size =NIOS_SOPC_MEMORY_SIZE , - .platform_data = &ram_pdata, -}; -static struct device_d altera_serial_device = { .id =-1 , .name ="altera_serial" ,
@@ -51,7 +38,8 @@ static struct device_d epcs_flash_device = {static int generic_devices_init (void ) {register_device (&cfi_dev); -register_device (&ram_dev); +add_mem_device ("ram0" ,NIOS_SOPC_MEMORY_BASE ,NIOS_SOPC_MEMORY_SIZE , +IORESOURCE_MEM_WRITEABLE );register_device (&mac_dev);/*register_device(&epcs_flash_device);*/
arch/ppc/boards/pcm030/pcm030.c +2 -14
@@ -44,19 +44,6 @@ struct device_d cfi_dev = { .size = 16 * 1024 * 1024, }; -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .map_base =0x0 , - .size =64 *1024 *1024 , - .platform_data = &ram_pdata, -}; -static struct mpc5xxx_fec_platform_data fec_info = { .xcv_type =MII100 , };
@@ -71,7 +58,8 @@ struct device_d eth_dev = {static int devices_init (void ) {register_device (&cfi_dev); -register_device (&sdram_dev); +add_mem_device ("ram0" ,0x0 ,64 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE );register_device (ð_dev);devfs_add_partition ("nor0" ,0x00f00000 ,0x40000 ,PARTITION_FIXED ,"self0" );
arch/x86/boards/x86_generic/generic_pc.c +2 -14
@@ -30,19 +30,6 @@#include <asm/syslib.h> #include <ns16550.h> -static struct memory_platform_data ram_pdata = { - .name ="ram0" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d sdram_dev = { - .id =-1 , - .name ="mem" , - .size =16 *1024 *1024 , - .map_base =0 , - .platform_data = &ram_pdata, -}; -static struct device_d bios_disk_dev = { .id =-1 , .name ="biosdrive" ,
@@ -70,7 +57,8 @@ static int devices_init(void) sdram_dev.size =bios_get_memsize ();/* extended memory only */ sdram_dev.size <<=10 ; -register_device (&sdram_dev); +add_mem_device ("ram0" ,0x0 ,16 *1024 *1024 , +IORESOURCE_MEM_WRITEABLE );register_device (&bios_disk_dev);if (pers_env_size !=PATCH_AREA_PERS_SIZE_UNUSED ) {
commands/mem.c +8 -24
@@ -1,14 +1,12 @@/* -* (C) Copyright 2000 -* Wolfgang Denk, DENX Software Engineering, [email protected]. +* Copyright (c) 2011 Sascha Hauer <[email protected]>, Pengutronix * * See file CREDITS for list of people who contributed to this * project. * -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License, or (at your option) any later version. +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,7 +15,7 @@* * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * MA 02111-1307 USA */
@@ -589,14 +587,13 @@ static struct file_operations memops = {static int mem_probe (struct device_d *dev) { -struct memory_platform_data *pdata = dev->platform_data;struct cdev *cdev; cdev =xzalloc (sizeof (*cdev)); dev->priv = cdev; - cdev->name = pdata->name; - cdev->size = dev->size; + cdev->name = (char *)dev->resource[0 ].name; + cdev->size = (unsigned long )dev->resource[0 ].size; cdev->ops = &memops; cdev->dev = dev;
@@ -610,19 +607,6 @@ static struct driver_d mem_drv = { .probe = mem_probe, }; -static struct memory_platform_data mem_dev_pdata = { - .name ="mem" , - .flags =IORESOURCE_MEM_WRITEABLE , -}; - -static struct device_d mem_dev = { - .id =-1 , - .name ="mem" , - .map_base =0 , - .size = ~0 ,/* FIXME: should be 0x100000000, ahem... */ - .platform_data = &mem_dev_pdata, -}; -static int mem_init (void ) { rw_buf =malloc (RW_BUF_SIZE );
@@ -631,8 +615,8 @@ static int mem_init(void)return -1 ; } +add_mem_device ("mem" ,0 , ~0 ,IORESOURCE_MEM_WRITEABLE );register_driver (&mem_drv); -register_device (&mem_dev);return 0 ; }
common/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-$(CONFIG_POLLER) += poller.o obj-$(CONFIG_BLOCK) += block.o obj-y += memory.o +obj-y += mem.o obj-$(CONFIG_MALLOC_DLMALLOC) += dlmalloc.o obj-$(CONFIG_MALLOC_DUMMY) += dummy_malloc.o obj-y += clock.o
common/mem.c new file +46 -0
46 lines not on this page · raw message
common/startup.c +3 -13
@@ -82,21 +82,11 @@ void early_init (void)#ifdef CONFIG_DEFAULT_ENVIRONMENT #include <generated/barebox_default_env.h> -static struct memory_platform_data default_env_platform_data = { - .name ="defaultenv" , -}; - -static struct device_d default_env_dev = { - .id =-1 , - .name ="mem" , - .platform_data = &default_env_platform_data, -}; -static int register_default_env (void ) { - default_env_dev.map_base = (unsigned long )default_environment; - default_env_dev.size =sizeof (default_environment); -register_device (&default_env_dev); +add_mem_device ("defaultenv" , (unsigned long )default_environment, +sizeof (default_environment), +IORESOURCE_MEM_WRITEABLE );return 0 ; }
include/driver.h +6 -5
@@ -202,6 +202,12 @@ static inline void __iomem *dev_request_mem_region(struct device_d *dev, int numreturn dev_get_mem_region (dev, num); } +/* +* register a memory device +*/ +struct device_d *add_mem_device (const char *name,resource_size_t start, +resource_size_t size,unsigned int flags); +/* linear list over all available devices */ extern struct list_head device_list;
@@ -349,10 +355,5 @@ int devfs_add_partition(const char *devname, unsigned long offset, size_t size, int flags, const char *name);int devfs_del_partition (const char *name); -struct memory_platform_data { -char *name; -unsigned int flags; -}; -#endif /* DRIVER_H */
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/16 mem_read/write: use resources
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
--- fs/fs.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
fs/fs.c +2 -3
@@ -1048,8 +1048,7 @@ ssize_t mem_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong dev = cdev->dev; size =min ((ulong )count, dev->size - offset); -debug ("mem_read: dev->map_base: %p size: %d offset: %d\n" ,dev->map_base, size, offset); -memcpy_sz (buf, (void *)(dev->map_base + offset), size, flags &O_RWSIZE_MASK ); +memcpy_sz (buf,dev_get_mem_region (dev,0 ) + offset, size, flags &O_RWSIZE_MASK );return size; }EXPORT_SYMBOL (mem_read);
@@ -1064,7 +1063,7 @@ ssize_t mem_write(struct cdev *cdev, const void *buf, size_t count, ulong offset dev = cdev->dev; size =min ((ulong )count, dev->size - offset); -memcpy_sz ((void *)(dev->map_base + offset), buf, size, flags &O_RWSIZE_MASK ); +memcpy_sz (dev_get_mem_region (dev,0 ) + offset, buf, size, flags &O_RWSIZE_MASK );return size; }EXPORT_SYMBOL (mem_write);
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 6/16 nand i.MX: convert to struct resource
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
--- drivers/mtd/nand/nand_imx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/nand_imx.c +1 -1
@@ -1034,7 +1034,7 @@ static int __init imxnd_probe(struct device_d *dev)return -ENOMEM ; host->data_buf = (uint8_t *)(host +1 ); - host->base = (void __iomem *)dev->map_base; + host->base =dev_request_mem_region (dev,0 ); host->main_area0 = host->base;
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 7/16 video i.MX: convert to struct resource
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
--- drivers/video/imx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/imx.c +1 -1
@@ -547,7 +547,7 @@ static int imxfb_probe(struct device_d *dev) info = &fbi->info; fbi->mode = pdata->mode; - fbi->regs = (void *)dev->map_base; + fbi->regs =dev_request_mem_region (dev,0 ); fbi->pcr = pdata->mode->pcr; fbi->pwmr = pdata->pwmr; fbi->lscr1 = pdata->lscr1;
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 8/16 serial i.MX: convert to struct resource
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
--- drivers/serial/serial_imx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/serial/serial_imx.c +1 -1
@@ -322,7 +322,7 @@ static int imx_serial_probe(struct device_d *dev) priv =xmalloc (sizeof (*priv)); cdev = &priv->cdev; - priv->regs = (void __force __iomem *)dev->map_base; + priv->regs =dev_request_mem_region (dev,0 ); dev->type_data = cdev; cdev->dev = dev; cdev->f_caps =CONSOLE_STDIN |CONSOLE_STDOUT |CONSOLE_STDERR ;
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 9/16 i2c i.MX: convert to struct resource
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
--- drivers/i2c/busses/i2c-imx.c | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-)
drivers/i2c/busses/i2c-imx.c +17 -11
@@ -102,6 +102,7 @@ static u16 i2c_clk_div[50][2] = { };struct imx_i2c_struct { +void __iomem *base;struct i2c_adapter adapter;unsigned int disable_delay;int stopped;
@@ -140,7 +141,8 @@ static inline void i2c_imx_dump_reg(struct i2c_adapter *adapter)static int i2c_imx_bus_busy (struct i2c_adapter *adapter,int for_busy) { -unsigned long base = adapter->dev->map_base; +struct imx_i2c_struct *i2c_imx =to_imx_i2c_struct (adapter); +void __iomem *base = i2c_imx->base;uint64_t start;unsigned int temp;
@@ -164,7 +166,8 @@ static int i2c_imx_bus_busy(struct i2c_adapter *adapter, int for_busy)static int i2c_imx_trx_complete (struct i2c_adapter *adapter) { -unsigned long base = adapter->dev->map_base; +struct imx_i2c_struct *i2c_imx =to_imx_i2c_struct (adapter); +void __iomem *base = i2c_imx->base;uint64_t start; start =get_time_ns ();
@@ -185,7 +188,8 @@ static int i2c_imx_trx_complete(struct i2c_adapter *adapter)static int i2c_imx_acked (struct i2c_adapter *adapter) { -unsigned long base = adapter->dev->map_base; +struct imx_i2c_struct *i2c_imx =to_imx_i2c_struct (adapter); +void __iomem *base = i2c_imx->base;uint64_t start; start =get_time_ns ();
@@ -206,7 +210,7 @@ static int i2c_imx_acked(struct i2c_adapter *adapter)static int i2c_imx_start (struct i2c_adapter *adapter) {struct imx_i2c_struct *i2c_imx =to_imx_i2c_struct (adapter); -unsigned long base = adapter->dev->map_base; +void __iomem *base = i2c_imx->base;unsigned int temp =0 ;int result;
@@ -238,7 +242,7 @@ static int i2c_imx_start(struct i2c_adapter *adapter)static void i2c_imx_stop (struct i2c_adapter *adapter) {struct imx_i2c_struct *i2c_imx =to_imx_i2c_struct (adapter); -unsigned long base = adapter->dev->map_base; +void __iomem *base = i2c_imx->base;unsigned int temp =0 ;if (!i2c_imx->stopped) {
@@ -306,7 +310,8 @@ static void i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,static int i2c_imx_write (struct i2c_adapter *adapter,struct i2c_msg *msgs) { -unsigned long base = adapter->dev->map_base; +struct imx_i2c_struct *i2c_imx =to_imx_i2c_struct (adapter); +void __iomem *base = i2c_imx->base;int i, result; dev_dbg(adapter->dev,
@@ -343,7 +348,7 @@ static int i2c_imx_write(struct i2c_adapter *adapter, struct i2c_msg *msgs)static int i2c_imx_read (struct i2c_adapter *adapter,struct i2c_msg *msgs) {struct imx_i2c_struct *i2c_imx =to_imx_i2c_struct (adapter); -unsigned long base = adapter->dev->map_base; +void __iomem *base = i2c_imx->base;int i, result;unsigned int temp;
@@ -411,7 +416,8 @@ static int i2c_imx_read(struct i2c_adapter *adapter, struct i2c_msg *msgs)static int i2c_imx_xfer (struct i2c_adapter *adapter,struct i2c_msg *msgs,int num) { -unsigned long base = adapter->dev->map_base; +struct imx_i2c_struct *i2c_imx =to_imx_i2c_struct (adapter); +void __iomem *base = i2c_imx->base;unsigned int i, temp;int result;
@@ -453,7 +459,6 @@ static int __init i2c_imx_probe(struct device_d *pdev) {struct imx_i2c_struct *i2c_imx;struct i2c_platform_data *pdata; -unsigned long base = pdev->map_base;int ret; pdata = pdev->platform_data;
@@ -464,6 +469,7 @@ static int __init i2c_imx_probe(struct device_d *pdev) i2c_imx->adapter.master_xfer = i2c_imx_xfer; i2c_imx->adapter.nr = pdev->id; i2c_imx->adapter.dev = pdev; + i2c_imx->base =dev_request_mem_region (pdev,0 );/* Set up clock divider */ if (pdata && pdata->bitrate)
@@ -472,8 +478,8 @@ static int __init i2c_imx_probe(struct device_d *pdev)i2c_imx_set_clk (i2c_imx,IMX_I2C_BIT_RATE );/* Set up chip registers to defaults */ -writeb (0 , base +IMX_I2C_I2CR ); -writeb (0 , base +IMX_I2C_I2SR ); +writeb (0 , i2c_imx->base +IMX_I2C_I2CR ); +writeb (0 , i2c_imx->base +IMX_I2C_I2SR );/* Add I2C adapter */ ret =i2c_add_numbered_adapter (&i2c_imx->adapter);
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 10/16 mci i.MX: convert to struct resource
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
--- drivers/mci/imx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mci/imx.c +1 -1
@@ -493,7 +493,7 @@ static int mxcmci_probe(struct device_d *dev) host->mci.init = mxcmci_init; host->mci.host_caps =MMC_MODE_4BIT ; - host->base = (struct mxcmci_regs *)dev->map_base; + host->base =dev_request_mem_region (dev,0 ); host->mci.voltages =MMC_VDD_32_33 |MMC_VDD_33_34 ;
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 11/16 net i.MX fec: convert to struct resource
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
--- drivers/net/fec_imx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/fec_imx.c +1 -1
@@ -613,7 +613,7 @@ static int fec_probe(struct device_d *dev) edev->get_ethaddr = fec_get_hwaddr; edev->set_ethaddr = fec_set_hwaddr; - fec->regs = (void *)dev->map_base; + fec->regs =dev_request_mem_region (dev,0 );/* Reset chip. */ writel (FEC_ECNTRL_RESET , fec->regs +FEC_ECNTRL );
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 12/16 mci i.MX esdhc: convert to struct resource
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
--- drivers/mci/imx-esdhc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mci/imx-esdhc.c +1 -1
@@ -457,7 +457,7 @@ static int fsl_esdhc_probe(struct device_d *dev) mci = &host->mci; host->dev = dev; - host->regs = (struct fsl_esdhc *)dev->map_base; + host->regs =dev_request_mem_region (dev,0 );/* First reset the eSDHC controller */ ret =esdhc_reset (host->regs);
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 13/16 spi i.MX: convert to struct resource
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
--- drivers/spi/imx_spi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/imx_spi.c +1 -1
@@ -379,7 +379,7 @@ static int imx_spi_probe(struct device_d *dev) imx->chipselect = spi_imx_devtype_data[version].chipselect; imx->xchg_single = spi_imx_devtype_data[version].xchg_single; imx->init = spi_imx_devtype_data[version].init; - imx->regs = (void __iomem *)dev->map_base; + imx->regs =dev_request_mem_region (dev,0 ); imx->init (imx);
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 14/16 video i.MX ipu: convert to struct resource
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
--- drivers/video/imx-ipu-fb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/imx-ipu-fb.c +1 -1
@@ -858,7 +858,7 @@ static int imxfb_probe(struct device_d *dev) fbi =xzalloc (sizeof (*fbi)); info = &fbi->info; - fbi->regs = (void *)dev->map_base; + fbi->regs =dev_request_mem_region (dev,0 ); fbi->dev = dev; info->priv = fbi; info->fbops = &imxfb_ops;
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 15/16 i.MX devices: convert to struct resource
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
--- arch/arm/mach-imx/devices.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-imx/devices.c +5 -2
@@ -9,8 +9,11 @@ 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 =xzalloc (sizeof (struct resource )); + dev->resource[0 ].start = (resource_size_t )base; + dev->resource[0 ].size = size; + dev->resource[0 ].flags =IORESOURCE_MEM ; + dev->num_resources =1 ; dev->platform_data = pdata;register_device (dev);
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 16/16 cfi: convert to struct resource
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
This is the non invasive approach. All this type casting shows this driver should be really cleaned up (or retired)
--- drivers/nor/cfi_flash.c | 36 +++++++++++++++++------------------- 1 files changed, 17 insertions(+), 19 deletions(-)
drivers/nor/cfi_flash.c +17 -19
@@ -283,7 +283,7 @@ static int flash_detect_cfi (struct flash_info *info, struct cfi_qry *qry)/* * The following code cannot be run from FLASH! */ -static ulong flash_get_size (struct flash_info *info,ulong base) +static ulong flash_get_size (struct flash_info *info) {int i, j;flash_sect_t sect_cnt;
@@ -295,6 +295,7 @@ static ulong flash_get_size (struct flash_info *info, ulong base)int erase_region_count;int cur_offset =0 ;struct cfi_qry qry; +unsigned long base = (unsigned long )info->base;memset (&qry,0 ,sizeof (qry));
@@ -464,8 +465,9 @@ static int __cfi_erase(struct cdev *cdev, size_t count, unsigned long offset,debug ("%s: erase 0x%08lx (size %d)\n" , __func__, offset, count); - start =find_sector (finfo, cdev->dev->map_base + offset); - end =find_sector (finfo, cdev->dev->map_base + offset + count -1 ); + start =find_sector (finfo, (unsigned long )finfo->base + offset); + end =find_sector (finfo, (unsigned long )finfo->base + offset + + count -1 );if (verbose)init_progression_bar (end - start);
@@ -633,11 +635,11 @@ static int cfi_protect(struct cdev *cdev, size_t count, unsigned long offset, inint i, ret =0 ;const char *action = (prot?"protect" :"unprotect" ); -printf ("%s: %s 0x%08lx (size %d)\n" , __FUNCTION__, - action, cdev->dev->map_base + offset, count); +printf ("%s: %s 0x%p (size %d)\n" , __func__, + action, finfo->base + offset, count); - start =find_sector (finfo, cdev->dev->map_base + offset); - end =find_sector (finfo, cdev->dev->map_base + offset + count -1 ); + start =find_sector (finfo, (unsigned long )finfo->base + offset); + end =find_sector (finfo, (unsigned long )finfo->base + offset + count -1 );for (i = start; i <= end; i++) { ret =flash_real_protect (finfo, i, prot);
@@ -654,10 +656,10 @@ static ssize_t cfi_write(struct cdev *cdev, const void *buf, size_t count, unsigstruct flash_info *finfo = (struct flash_info *)cdev->priv;int ret; -debug ("cfi_write: buf=0x%p addr=0x%08lx count=0x%08x\n" ,buf, cdev->dev->map_base + offset, count); +debug ("cfi_write: buf=0x%p addr=0x%08lx count=0x%08x\n" ,buf, finfo->base + offset, count); - ret =write_buff (finfo, buf, cdev->dev->map_base + offset, count); -return ret ==0 ? count :-1 ; + ret =write_buff (finfo, buf, (unsigned long )finfo->base + offset, count); +return ret ==0 ? count :-1 ; }static void cfi_info (struct device_d * dev)
@@ -978,18 +980,11 @@ static int cfi_probe (struct device_d *dev) dev->priv = (void *)info; -printf ("cfi_probe: %s base: 0x%08x size: 0x%08x\n" , dev->name, dev->map_base, dev->size); -/* Init: no FLASHes known */ info->flash_id =FLASH_UNKNOWN ; info->cmd_reset =FLASH_CMD_RESET ; - info->size =flash_get_size (info, dev->map_base); - info->base = (void __iomem *)dev->map_base; - -if (dev->size ==0 ) { -printf ("cfi_probe: size : 0x%08lx\n" , info->size); - dev->size = info->size; - } + info->base =dev_request_mem_region (dev,0 ); + info->size =flash_get_size (info);if (info->flash_id ==FLASH_UNKNOWN ) { printf ("## Unknown FLASH on Bank at 0x%08x - Size = 0x%08lx = %ld MB\n",
@@ -997,6 +992,9 @@ static int cfi_probe (struct device_d *dev)return -ENODEV ; } +dev_info (dev,"found cfi flash at %p, size %ld\n" , + info->base, info->size); + info->cdev.name =asprintf ("nor%d" , dev->id); info->cdev.size = info->size; info->cdev.dev = dev;
Signature · 7 lines
1.7.5.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox