* [PATCH 01/23] eukrea_cpuimx35: fix warning: 'usbotg_dev' defined but not used
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 1/7] generic_memmap_ro/rw: switch to resource Jean-Christophe PLAGNIOL-VILLARD
` (29 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
index d1de495..7f941cc 100644
--- a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
+++ b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
@@ -126,6 +126,7 @@ static struct device_d usbh2_dev = {
};
#endif
+#ifdef CONFIG_USB_GADGET
static struct fsl_usb2_platform_data usb_pdata = {
.operating_mode = FSL_USB2_DR_DEVICE,
.phy_mode = FSL_USB2_PHY_UTMI,
@@ -137,6 +138,7 @@ static struct device_d usbotg_dev = {
.size = 0x200,
.platform_data = &usb_pdata,
};
+#endif
#ifdef CONFIG_MMU
static int eukrea_cpuimx35_mmu_init(void)
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 1/7] generic_memmap_ro/rw: switch to resource
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 01/23] eukrea_cpuimx35: fix warning: 'usbotg_dev' defined but not used Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 2/7] devinfo: " Jean-Christophe PLAGNIOL-VILLARD
` (28 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/base/driver.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index b5166c8..3efb538 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -263,7 +263,7 @@ int generic_memmap_ro(struct cdev *cdev, void **map, int flags)
if (flags & PROT_WRITE)
return -EACCES;
- *map = (void *)cdev->dev->map_base;
+ *map = dev_get_mem_region(cdev->dev, 0);
return 0;
}
@@ -272,7 +272,8 @@ int generic_memmap_rw(struct cdev *cdev, void **map, int flags)
if (!cdev->dev)
return -EINVAL;
- *map = (void *)cdev->dev->map_base;
+ *map = dev_get_mem_region(cdev->dev, 0);
+ return 0;
return 0;
}
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 2/7] devinfo: switch to resource
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 01/23] eukrea_cpuimx35: fix warning: 'usbotg_dev' defined but not used Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 1/7] generic_memmap_ro/rw: switch to resource Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 02/23] generic_memmap_ro/rw: " Jean-Christophe PLAGNIOL-VILLARD
` (27 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/base/driver.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 3efb538..1bb74ee 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -340,6 +340,8 @@ static int do_devinfo(struct command *cmdtp, int argc, char *argv[])
struct device_d *dev;
struct driver_d *drv;
struct param_d *param;
+ int i;
+ struct resource *res;
if (argc == 1) {
printf("devices:\n");
@@ -360,9 +362,17 @@ static int do_devinfo(struct command *cmdtp, int argc, char *argv[])
return -1;
}
- printf("base : 0x%08x\nsize : 0x%08x\ndriver: %s\n\n",
- dev->map_base, dev->size,
- dev->driver ?
+ printf("resources:\n");
+ for (i = 0; i < dev->num_resources; i++) {
+ res = &dev->resource[i];
+ printf("num : %d\n", i);
+ if (res->name)
+ printf("name : %s\n", res->name);
+ printf("start : 0x%08x\nsize : 0x%08x\n",
+ res->start, res->size);
+ }
+
+ printf("driver: %s\n\n", dev->driver ?
dev->driver->name : "none");
if (dev->driver)
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 02/23] generic_memmap_ro/rw: switch to resource
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (2 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 2/7] devinfo: " Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 03/23] devinfo: " Jean-Christophe PLAGNIOL-VILLARD
` (26 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/base/driver.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 78e9ea9..3069c49 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -263,7 +263,7 @@ int generic_memmap_ro(struct cdev *cdev, void **map, int flags)
if (flags & PROT_WRITE)
return -EACCES;
- *map = (void *)cdev->dev->map_base;
+ *map = dev_get_mem_region(cdev->dev, 0);
return 0;
}
@@ -272,7 +272,7 @@ int generic_memmap_rw(struct cdev *cdev, void **map, int flags)
if (!cdev->dev)
return -EINVAL;
- *map = (void *)cdev->dev->map_base;
+ *map = dev_get_mem_region(cdev->dev, 0);
return 0;
}
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 03/23] devinfo: switch to resource
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (3 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 02/23] generic_memmap_ro/rw: " Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 3/7] dm9000: replace DM9000_WIDTH_8/16/32 by IORESOURCE_MEM_8/16/32BIT Jean-Christophe PLAGNIOL-VILLARD
` (25 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/base/driver.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 3069c49..4ceb346 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -339,6 +339,8 @@ static int do_devinfo(struct command *cmdtp, int argc, char *argv[])
struct device_d *dev;
struct driver_d *drv;
struct param_d *param;
+ int i;
+ struct resource *res;
if (argc == 1) {
printf("devices:\n");
@@ -359,9 +361,17 @@ static int do_devinfo(struct command *cmdtp, int argc, char *argv[])
return -1;
}
- printf("base : 0x%08x\nsize : 0x%08x\ndriver: %s\n\n",
- dev->map_base, dev->size,
- dev->driver ?
+ printf("resources:\n");
+ for (i = 0; i < dev->num_resources; i++) {
+ res = &dev->resource[i];
+ printf("num : %d\n", i);
+ if (res->name)
+ printf("name : %s\n", res->name);
+ printf("start : 0x%08x\nsize : 0x%08x\n",
+ res->start, res->size);
+ }
+
+ printf("driver: %s\n\n", dev->driver ?
dev->driver->name : "none");
if (dev->driver)
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 3/7] dm9000: replace DM9000_WIDTH_8/16/32 by IORESOURCE_MEM_8/16/32BIT
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (4 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 03/23] devinfo: " Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 4/7] dm9000: introduce add_dm9000_device to register dm9000 device Jean-Christophe PLAGNIOL-VILLARD
` (24 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/at91sam9261ek/init.c | 2 +-
arch/arm/boards/mini2440/mini2440.c | 2 +-
arch/arm/boards/pm9261/init.c | 2 +-
arch/arm/boards/scb9328/scb9328.c | 2 +-
drivers/net/dm9000.c | 12 ++++++------
include/dm9000.h | 4 ----
6 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/arch/arm/boards/at91sam9261ek/init.c b/arch/arm/boards/at91sam9261ek/init.c
index 4009523..812b399 100644
--- a/arch/arm/boards/at91sam9261ek/init.c
+++ b/arch/arm/boards/at91sam9261ek/init.c
@@ -89,7 +89,7 @@ static void ek_add_device_nand(void)
*/
#if defined(CONFIG_DRIVER_NET_DM9000)
static struct dm9000_platform_data dm9000_data = {
- .buswidth = DM9000_WIDTH_16,
+ .buswidth = IORESOURCE_MEM_16BIT,
.srom = 0,
};
diff --git a/arch/arm/boards/mini2440/mini2440.c b/arch/arm/boards/mini2440/mini2440.c
index 2d27b00..634e035 100644
--- a/arch/arm/boards/mini2440/mini2440.c
+++ b/arch/arm/boards/mini2440/mini2440.c
@@ -63,7 +63,7 @@ static struct device_d nand_dev = {
* Area 2: Offset 0x304...0x307
*/
static struct dm9000_platform_data dm9000_data = {
- .buswidth = DM9000_WIDTH_16,
+ .buswidth = IORESOURCE_MEM_16BIT,
.srom = 1,
};
diff --git a/arch/arm/boards/pm9261/init.c b/arch/arm/boards/pm9261/init.c
index 1059aec..fa21e24 100644
--- a/arch/arm/boards/pm9261/init.c
+++ b/arch/arm/boards/pm9261/init.c
@@ -89,7 +89,7 @@ static void pm_add_device_nand(void)
*/
#if defined(CONFIG_DRIVER_NET_DM9000)
static struct dm9000_platform_data dm9000_data = {
- .buswidth = DM9000_WIDTH_16,
+ .buswidth = IORESOURCE_MEM_16BIT,
.srom = 1,
};
diff --git a/arch/arm/boards/scb9328/scb9328.c b/arch/arm/boards/scb9328/scb9328.c
index d49eaff..47aa8ce 100644
--- a/arch/arm/boards/scb9328/scb9328.c
+++ b/arch/arm/boards/scb9328/scb9328.c
@@ -34,7 +34,7 @@
#include <led.h>
static struct dm9000_platform_data dm9000_data = {
- .buswidth = DM9000_WIDTH_16,
+ .buswidth = IORESOURCE_MEM_16BIT,
.srom = 1,
};
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index b867d21..691d877 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -294,16 +294,16 @@ static int dm9000_eth_send (struct eth_device *edev,
writeb(DM9000_MWCMD, priv->iobase);
switch (priv->buswidth) {
- case DM9000_WIDTH_8:
+ case IORESOURCE_MEM_8BIT:
for (i = 0; i < length; i++)
writeb(data_ptr[i] & 0xff, priv->iodata);
break;
- case DM9000_WIDTH_16:
+ case IORESOURCE_MEM_16BIT:
tmplen = (length + 1) / 2;
for (i = 0; i < tmplen; i++)
writew(((u16 *)data_ptr)[i], priv->iodata);
break;
- case DM9000_WIDTH_32:
+ case IORESOURCE_MEM_32BIT:
tmplen = (length + 3) / 4;
for (i = 0; i < tmplen; i++)
writel(((u32 *) data_ptr)[i], priv->iodata);
@@ -371,20 +371,20 @@ static int dm9000_eth_rx (struct eth_device *edev)
/* Move data from DM9000 */
/* Read received packet from RX SRAM */
switch (priv->buswidth) {
- case DM9000_WIDTH_8:
+ case IORESOURCE_MEM_8BIT:
RxStatus = readb(priv->iodata) + (readb(priv->iodata) << 8);
RxLen = readb(priv->iodata) + (readb(priv->iodata) << 8);
for (i = 0; i < RxLen; i++)
rdptr[i] = readb(priv->iodata);
break;
- case DM9000_WIDTH_16:
+ case IORESOURCE_MEM_16BIT:
RxStatus = readw(priv->iodata);
RxLen = readw(priv->iodata);
tmplen = (RxLen + 1) / 2;
for (i = 0; i < tmplen; i++)
((u16 *) rdptr)[i] = readw(priv->iodata);
break;
- case DM9000_WIDTH_32:
+ case IORESOURCE_MEM_32BIT:
tmpdata = readl(priv->iodata);
RxStatus = tmpdata;
RxLen = tmpdata >> 16;
diff --git a/include/dm9000.h b/include/dm9000.h
index 0991ab5..c4618f1 100644
--- a/include/dm9000.h
+++ b/include/dm9000.h
@@ -2,10 +2,6 @@
#ifndef __DM9000_H__
#define __DM9000_H__
-#define DM9000_WIDTH_8 1
-#define DM9000_WIDTH_16 2
-#define DM9000_WIDTH_32 3
-
struct dm9000_platform_data {
int buswidth;
int srom;
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 4/7] dm9000: introduce add_dm9000_device to register dm9000 device
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (5 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 3/7] dm9000: replace DM9000_WIDTH_8/16/32 by IORESOURCE_MEM_8/16/32BIT Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 04/23] dm9000: replace DM9000_WIDTH_8/16/32 by IORESOURCE_MEM_8/16/32BIT Jean-Christophe PLAGNIOL-VILLARD
` (23 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/at91sam9261ek/init.c | 25 +-------------
arch/arm/boards/mini2440/mini2440.c | 24 +-------------
arch/arm/boards/pm9261/init.c | 26 ++-------------
arch/arm/boards/scb9328/scb9328.c | 25 +-------------
drivers/base/resource.c | 57 +++++++++++++++++++++++++++++++--
drivers/net/dm9000.c | 3 +-
include/dm9000.h | 1 -
include/driver.h | 11 ++++++
8 files changed, 75 insertions(+), 97 deletions(-)
diff --git a/arch/arm/boards/at91sam9261ek/init.c b/arch/arm/boards/at91sam9261ek/init.c
index 812b399..627202f 100644
--- a/arch/arm/boards/at91sam9261ek/init.c
+++ b/arch/arm/boards/at91sam9261ek/init.c
@@ -89,31 +89,9 @@ static void ek_add_device_nand(void)
*/
#if defined(CONFIG_DRIVER_NET_DM9000)
static struct dm9000_platform_data dm9000_data = {
- .buswidth = IORESOURCE_MEM_16BIT,
.srom = 0,
};
-static struct resource dm9000_resources[] = {
- [0] = {
- .start = AT91_CHIPSELECT_2,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = AT91_CHIPSELECT_2 + 4,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct device_d dm9000_dev = {
- .id = 0,
- .name = "dm9000",
- .num_resources = ARRAY_SIZE(dm9000_resources),
- .resource = dm9000_resources,
- .platform_data = &dm9000_data,
-};
-
/*
* SMC timings for the DM9000.
* Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings.
@@ -147,7 +125,8 @@ static void __init ek_add_device_dm9000(void)
/* Configure Interrupt pin as input, no pull-up */
at91_set_gpio_input(AT91_PIN_PC11, 0);
- register_device(&dm9000_dev);
+ add_dm9000_device(0, AT91_CHIPSELECT_2, AT91_CHIPSELECT_2 + 4,
+ IORESOURCE_MEM_16BIT, &dm9000_data);
}
#else
static void __init ek_add_device_dm9000(void) {}
diff --git a/arch/arm/boards/mini2440/mini2440.c b/arch/arm/boards/mini2440/mini2440.c
index 634e035..dbf7503 100644
--- a/arch/arm/boards/mini2440/mini2440.c
+++ b/arch/arm/boards/mini2440/mini2440.c
@@ -63,30 +63,9 @@ static struct device_d nand_dev = {
* Area 2: Offset 0x304...0x307
*/
static struct dm9000_platform_data dm9000_data = {
- .buswidth = IORESOURCE_MEM_16BIT,
.srom = 1,
};
-static struct resource dm9000_resources[] = {
- [0] = {
- .start = CS4_BASE + 0x300,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = CS4_BASE + 0x304,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct device_d dm9000_dev = {
- .name = "dm9000",
- .num_resources = ARRAY_SIZE(dm9000_resources),
- .resource = dm9000_resources,
- .platform_data = &dm9000_data,
-};
-
static struct s3c_mci_platform_data mci_data = {
.caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz,
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
@@ -332,7 +311,8 @@ static int mini2440_devices_init(void)
IORESOURCE_MEM_WRITEABLE);
armlinux_add_dram(sdram_dev);
- register_device(&dm9000_dev);
+ add_dm9000_device(0, CS4_BASE + 0x300, CS4_BASE + 0x304,
+ IORESOURCE_MEM_16BIT, &dm9000_data);
#ifdef CONFIG_NAND
/* ----------- add some vital partitions -------- */
devfs_del_partition("self_raw");
diff --git a/arch/arm/boards/pm9261/init.c b/arch/arm/boards/pm9261/init.c
index fa21e24..783a404 100644
--- a/arch/arm/boards/pm9261/init.c
+++ b/arch/arm/boards/pm9261/init.c
@@ -89,31 +89,9 @@ static void pm_add_device_nand(void)
*/
#if defined(CONFIG_DRIVER_NET_DM9000)
static struct dm9000_platform_data dm9000_data = {
- .buswidth = IORESOURCE_MEM_16BIT,
.srom = 1,
};
-static struct resource dm9000_resources[] = {
- [0] = {
- .start = AT91_CHIPSELECT_2,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = AT91_CHIPSELECT_2 + 4,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct device_d dm9000_dev = {
- .id = 0,
- .name = "dm9000",
- .num_resources = ARRAY_SIZE(dm9000_resources),
- .resource = dm9000_resources,
- .platform_data = &dm9000_data,
-};
-
/*
* SMC timings for the DM9000.
* Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings.
@@ -141,7 +119,8 @@ static void __init pm_add_device_dm9000(void)
/* Configure chip-select 2 (DM9000) */
sam9_smc_configure(2, &dm9000_smc_config);
- register_device(&dm9000_dev);
+ add_dm9000_device(0, AT91_CHIPSELECT_2, AT91_CHIPSELECT_2 + 4,
+ IORESOURCE_MEM_16BIT, &dm9000_data);
}
#else
static void __init ek_add_device_dm9000(void) {}
@@ -151,6 +130,7 @@ static int pm9261_devices_init(void)
{
at91_add_device_sdram(64 * 1024 * 1024);
pm_add_device_nand();
+ pm_add_device_dm9000();
add_cfi_flash_device(0, AT91_CHIPSELECT_0, 4 * 1024 * 1024, 0);
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");
diff --git a/arch/arm/boards/scb9328/scb9328.c b/arch/arm/boards/scb9328/scb9328.c
index 47aa8ce..a610275 100644
--- a/arch/arm/boards/scb9328/scb9328.c
+++ b/arch/arm/boards/scb9328/scb9328.c
@@ -34,31 +34,9 @@
#include <led.h>
static struct dm9000_platform_data dm9000_data = {
- .buswidth = IORESOURCE_MEM_16BIT,
.srom = 1,
};
-static struct resource dm9000_resources[] = {
- [0] = {
- .start = 0x16000000,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = 0x16000004,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct device_d dm9000_dev = {
- .id = -1,
- .name = "dm9000",
- .num_resources = ARRAY_SIZE(dm9000_resources),
- .resource = dm9000_resources,
- .platform_data = &dm9000_data,
-};
-
struct gpio_led leds[] = {
{
.gpio = 32 + 21,
@@ -106,7 +84,8 @@ static int scb9328_devices_init(void)
sdram_dev = add_mem_device("ram0", 0x08000000, 16 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);
armlinux_add_dram(sdram_dev);
- register_device(&dm9000_dev);
+ add_dm9000_device(-1, 0x16000000, 0x16000004,
+ IORESOURCE_MEM_16BIT, &dm9000_data);
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0");
devfs_add_partition("nor0", 0x40000, 0x20000, PARTITION_FIXED, "env0");
diff --git a/drivers/base/resource.c b/drivers/base/resource.c
index f0450d3..98fc68a 100644
--- a/drivers/base/resource.c
+++ b/drivers/base/resource.c
@@ -25,15 +25,25 @@
#include <driver.h>
#include <xfuncs.h>
-struct device_d *add_generic_device(const char* devname, int id, const char *resname,
- resource_size_t start, resource_size_t size, unsigned int flags,
- void *pdata)
+static struct device_d *alloc_device(const char* devname, int id, void *pdata)
{
struct device_d *dev;
dev = xzalloc(sizeof(*dev));
strcpy(dev->name, devname);
dev->id = id;
+ dev->platform_data = pdata;
+
+ return dev;
+}
+
+struct device_d *add_generic_device(const char* devname, int id, const char *resname,
+ resource_size_t start, resource_size_t size, unsigned int flags,
+ void *pdata)
+{
+ struct device_d *dev;
+
+ dev = alloc_device(devname, id, pdata);
dev->resource = xzalloc(sizeof(struct resource));
dev->num_resources = 1;
if (resname)
@@ -41,10 +51,49 @@ struct device_d *add_generic_device(const char* devname, int id, const char *res
dev->resource[0].start = start;
dev->resource[0].size = size;
dev->resource[0].flags = flags;
- dev->platform_data = pdata;
register_device(dev);
return dev;
}
EXPORT_SYMBOL(add_generic_device);
+
+#ifdef CONFIG_DRIVER_NET_DM9000
+struct device_d *add_dm9000_device(int id, resource_size_t base,
+ resource_size_t data, int flags, void *pdata)
+{
+ struct device_d *dev;
+ resource_size_t size;
+
+ dev = alloc_device("dm9000", id, pdata);
+ dev->resource = xzalloc(sizeof(struct resource) * 2);
+ dev->num_resources = 2;
+
+ switch (flags) {
+ case IORESOURCE_MEM_32BIT:
+ size = 8;
+ break;
+ case IORESOURCE_MEM_16BIT:
+ size = 4;
+ break;
+ case IORESOURCE_MEM_8BIT:
+ size = 2;
+ break;
+ default:
+ printf("dm9000: memory width flag missing\n");
+ return NULL;
+ }
+
+ dev->resource[0].start = base;
+ dev->resource[0].size = size;
+ dev->resource[0].flags = IORESOURCE_MEM | flags;
+ dev->resource[1].start = data;
+ dev->resource[1].size = size;
+ dev->resource[1].flags = IORESOURCE_MEM | flags;
+
+ register_device(dev);
+
+ return dev;
+}
+EXPORT_SYMBOL(add_dm9000_device);
+#endif
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 691d877..be14317 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -500,7 +500,8 @@ static int dm9000_probe(struct device_d *dev)
pdata = dev->platform_data;
priv = edev->priv;
- priv->buswidth = pdata->buswidth;
+
+ priv->buswidth = dev->resource[0].flags & IORESOURCE_MEM_TYPE_MASK;
priv->iodata = dev_request_mem_region(dev, 1);
priv->iobase = dev_request_mem_region(dev, 0);
priv->srom = pdata->srom;
diff --git a/include/dm9000.h b/include/dm9000.h
index c4618f1..a9a4635 100644
--- a/include/dm9000.h
+++ b/include/dm9000.h
@@ -3,7 +3,6 @@
#define __DM9000_H__
struct dm9000_platform_data {
- int buswidth;
int srom;
};
diff --git a/include/driver.h b/include/driver.h
index af34803..1f45019 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -227,6 +227,17 @@ static inline struct device_d *add_cfi_flash_device(int id, resource_size_t star
IORESOURCE_MEM | flags, NULL);
}
+#ifdef CONFIG_DRIVER_NET_DM9000
+struct device_d *add_dm9000_device(int id, resource_size_t base,
+ resource_size_t data, int flags, void *pdata);
+#else
+static inline struct device_d *add_dm9000_device(int id, resource_size_t base,
+ resource_size_t data, int flags, void *pdata)
+{
+ return NULL;
+}
+#endif
+
/* linear list over all available devices
*/
extern struct list_head device_list;
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 04/23] dm9000: replace DM9000_WIDTH_8/16/32 by IORESOURCE_MEM_8/16/32BIT
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (6 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 4/7] dm9000: introduce add_dm9000_device to register dm9000 device Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 05/23] dm9000: introduce add_dm9000_device to register dm9000 device Jean-Christophe PLAGNIOL-VILLARD
` (22 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/at91sam9261ek/init.c | 2 +-
arch/arm/boards/mini2440/mini2440.c | 2 +-
arch/arm/boards/pm9261/init.c | 2 +-
arch/arm/boards/scb9328/scb9328.c | 2 +-
drivers/net/dm9000.c | 12 ++++++------
include/dm9000.h | 4 ----
6 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/arch/arm/boards/at91sam9261ek/init.c b/arch/arm/boards/at91sam9261ek/init.c
index 4009523..812b399 100644
--- a/arch/arm/boards/at91sam9261ek/init.c
+++ b/arch/arm/boards/at91sam9261ek/init.c
@@ -89,7 +89,7 @@ static void ek_add_device_nand(void)
*/
#if defined(CONFIG_DRIVER_NET_DM9000)
static struct dm9000_platform_data dm9000_data = {
- .buswidth = DM9000_WIDTH_16,
+ .buswidth = IORESOURCE_MEM_16BIT,
.srom = 0,
};
diff --git a/arch/arm/boards/mini2440/mini2440.c b/arch/arm/boards/mini2440/mini2440.c
index 2d27b00..634e035 100644
--- a/arch/arm/boards/mini2440/mini2440.c
+++ b/arch/arm/boards/mini2440/mini2440.c
@@ -63,7 +63,7 @@ static struct device_d nand_dev = {
* Area 2: Offset 0x304...0x307
*/
static struct dm9000_platform_data dm9000_data = {
- .buswidth = DM9000_WIDTH_16,
+ .buswidth = IORESOURCE_MEM_16BIT,
.srom = 1,
};
diff --git a/arch/arm/boards/pm9261/init.c b/arch/arm/boards/pm9261/init.c
index 1059aec..fa21e24 100644
--- a/arch/arm/boards/pm9261/init.c
+++ b/arch/arm/boards/pm9261/init.c
@@ -89,7 +89,7 @@ static void pm_add_device_nand(void)
*/
#if defined(CONFIG_DRIVER_NET_DM9000)
static struct dm9000_platform_data dm9000_data = {
- .buswidth = DM9000_WIDTH_16,
+ .buswidth = IORESOURCE_MEM_16BIT,
.srom = 1,
};
diff --git a/arch/arm/boards/scb9328/scb9328.c b/arch/arm/boards/scb9328/scb9328.c
index cf72ef4..4c0ed02 100644
--- a/arch/arm/boards/scb9328/scb9328.c
+++ b/arch/arm/boards/scb9328/scb9328.c
@@ -35,7 +35,7 @@
#include <mach/devices-imx1.h>
static struct dm9000_platform_data dm9000_data = {
- .buswidth = DM9000_WIDTH_16,
+ .buswidth = IORESOURCE_MEM_16BIT,
.srom = 1,
};
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index b867d21..691d877 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -294,16 +294,16 @@ static int dm9000_eth_send (struct eth_device *edev,
writeb(DM9000_MWCMD, priv->iobase);
switch (priv->buswidth) {
- case DM9000_WIDTH_8:
+ case IORESOURCE_MEM_8BIT:
for (i = 0; i < length; i++)
writeb(data_ptr[i] & 0xff, priv->iodata);
break;
- case DM9000_WIDTH_16:
+ case IORESOURCE_MEM_16BIT:
tmplen = (length + 1) / 2;
for (i = 0; i < tmplen; i++)
writew(((u16 *)data_ptr)[i], priv->iodata);
break;
- case DM9000_WIDTH_32:
+ case IORESOURCE_MEM_32BIT:
tmplen = (length + 3) / 4;
for (i = 0; i < tmplen; i++)
writel(((u32 *) data_ptr)[i], priv->iodata);
@@ -371,20 +371,20 @@ static int dm9000_eth_rx (struct eth_device *edev)
/* Move data from DM9000 */
/* Read received packet from RX SRAM */
switch (priv->buswidth) {
- case DM9000_WIDTH_8:
+ case IORESOURCE_MEM_8BIT:
RxStatus = readb(priv->iodata) + (readb(priv->iodata) << 8);
RxLen = readb(priv->iodata) + (readb(priv->iodata) << 8);
for (i = 0; i < RxLen; i++)
rdptr[i] = readb(priv->iodata);
break;
- case DM9000_WIDTH_16:
+ case IORESOURCE_MEM_16BIT:
RxStatus = readw(priv->iodata);
RxLen = readw(priv->iodata);
tmplen = (RxLen + 1) / 2;
for (i = 0; i < tmplen; i++)
((u16 *) rdptr)[i] = readw(priv->iodata);
break;
- case DM9000_WIDTH_32:
+ case IORESOURCE_MEM_32BIT:
tmpdata = readl(priv->iodata);
RxStatus = tmpdata;
RxLen = tmpdata >> 16;
diff --git a/include/dm9000.h b/include/dm9000.h
index 0991ab5..c4618f1 100644
--- a/include/dm9000.h
+++ b/include/dm9000.h
@@ -2,10 +2,6 @@
#ifndef __DM9000_H__
#define __DM9000_H__
-#define DM9000_WIDTH_8 1
-#define DM9000_WIDTH_16 2
-#define DM9000_WIDTH_32 3
-
struct dm9000_platform_data {
int buswidth;
int srom;
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 05/23] dm9000: introduce add_dm9000_device to register dm9000 device
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (7 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 04/23] dm9000: replace DM9000_WIDTH_8/16/32 by IORESOURCE_MEM_8/16/32BIT Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 5/7] resource: introduce add_usb_ehci_device to register echi device Jean-Christophe PLAGNIOL-VILLARD
` (21 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/at91sam9261ek/init.c | 25 +-------------
arch/arm/boards/mini2440/mini2440.c | 24 +-------------
arch/arm/boards/pm9261/init.c | 26 ++-------------
arch/arm/boards/scb9328/scb9328.c | 25 +-------------
drivers/base/resource.c | 57 +++++++++++++++++++++++++++++++--
drivers/net/dm9000.c | 3 +-
include/dm9000.h | 1 -
include/driver.h | 11 ++++++
8 files changed, 75 insertions(+), 97 deletions(-)
diff --git a/arch/arm/boards/at91sam9261ek/init.c b/arch/arm/boards/at91sam9261ek/init.c
index 812b399..627202f 100644
--- a/arch/arm/boards/at91sam9261ek/init.c
+++ b/arch/arm/boards/at91sam9261ek/init.c
@@ -89,31 +89,9 @@ static void ek_add_device_nand(void)
*/
#if defined(CONFIG_DRIVER_NET_DM9000)
static struct dm9000_platform_data dm9000_data = {
- .buswidth = IORESOURCE_MEM_16BIT,
.srom = 0,
};
-static struct resource dm9000_resources[] = {
- [0] = {
- .start = AT91_CHIPSELECT_2,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = AT91_CHIPSELECT_2 + 4,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct device_d dm9000_dev = {
- .id = 0,
- .name = "dm9000",
- .num_resources = ARRAY_SIZE(dm9000_resources),
- .resource = dm9000_resources,
- .platform_data = &dm9000_data,
-};
-
/*
* SMC timings for the DM9000.
* Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings.
@@ -147,7 +125,8 @@ static void __init ek_add_device_dm9000(void)
/* Configure Interrupt pin as input, no pull-up */
at91_set_gpio_input(AT91_PIN_PC11, 0);
- register_device(&dm9000_dev);
+ add_dm9000_device(0, AT91_CHIPSELECT_2, AT91_CHIPSELECT_2 + 4,
+ IORESOURCE_MEM_16BIT, &dm9000_data);
}
#else
static void __init ek_add_device_dm9000(void) {}
diff --git a/arch/arm/boards/mini2440/mini2440.c b/arch/arm/boards/mini2440/mini2440.c
index 634e035..dbf7503 100644
--- a/arch/arm/boards/mini2440/mini2440.c
+++ b/arch/arm/boards/mini2440/mini2440.c
@@ -63,30 +63,9 @@ static struct device_d nand_dev = {
* Area 2: Offset 0x304...0x307
*/
static struct dm9000_platform_data dm9000_data = {
- .buswidth = IORESOURCE_MEM_16BIT,
.srom = 1,
};
-static struct resource dm9000_resources[] = {
- [0] = {
- .start = CS4_BASE + 0x300,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = CS4_BASE + 0x304,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct device_d dm9000_dev = {
- .name = "dm9000",
- .num_resources = ARRAY_SIZE(dm9000_resources),
- .resource = dm9000_resources,
- .platform_data = &dm9000_data,
-};
-
static struct s3c_mci_platform_data mci_data = {
.caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz,
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
@@ -332,7 +311,8 @@ static int mini2440_devices_init(void)
IORESOURCE_MEM_WRITEABLE);
armlinux_add_dram(sdram_dev);
- register_device(&dm9000_dev);
+ add_dm9000_device(0, CS4_BASE + 0x300, CS4_BASE + 0x304,
+ IORESOURCE_MEM_16BIT, &dm9000_data);
#ifdef CONFIG_NAND
/* ----------- add some vital partitions -------- */
devfs_del_partition("self_raw");
diff --git a/arch/arm/boards/pm9261/init.c b/arch/arm/boards/pm9261/init.c
index fa21e24..783a404 100644
--- a/arch/arm/boards/pm9261/init.c
+++ b/arch/arm/boards/pm9261/init.c
@@ -89,31 +89,9 @@ static void pm_add_device_nand(void)
*/
#if defined(CONFIG_DRIVER_NET_DM9000)
static struct dm9000_platform_data dm9000_data = {
- .buswidth = IORESOURCE_MEM_16BIT,
.srom = 1,
};
-static struct resource dm9000_resources[] = {
- [0] = {
- .start = AT91_CHIPSELECT_2,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = AT91_CHIPSELECT_2 + 4,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct device_d dm9000_dev = {
- .id = 0,
- .name = "dm9000",
- .num_resources = ARRAY_SIZE(dm9000_resources),
- .resource = dm9000_resources,
- .platform_data = &dm9000_data,
-};
-
/*
* SMC timings for the DM9000.
* Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings.
@@ -141,7 +119,8 @@ static void __init pm_add_device_dm9000(void)
/* Configure chip-select 2 (DM9000) */
sam9_smc_configure(2, &dm9000_smc_config);
- register_device(&dm9000_dev);
+ add_dm9000_device(0, AT91_CHIPSELECT_2, AT91_CHIPSELECT_2 + 4,
+ IORESOURCE_MEM_16BIT, &dm9000_data);
}
#else
static void __init ek_add_device_dm9000(void) {}
@@ -151,6 +130,7 @@ static int pm9261_devices_init(void)
{
at91_add_device_sdram(64 * 1024 * 1024);
pm_add_device_nand();
+ pm_add_device_dm9000();
add_cfi_flash_device(0, AT91_CHIPSELECT_0, 4 * 1024 * 1024, 0);
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");
diff --git a/arch/arm/boards/scb9328/scb9328.c b/arch/arm/boards/scb9328/scb9328.c
index 4c0ed02..5c52af9 100644
--- a/arch/arm/boards/scb9328/scb9328.c
+++ b/arch/arm/boards/scb9328/scb9328.c
@@ -35,31 +35,9 @@
#include <mach/devices-imx1.h>
static struct dm9000_platform_data dm9000_data = {
- .buswidth = IORESOURCE_MEM_16BIT,
.srom = 1,
};
-static struct resource dm9000_resources[] = {
- [0] = {
- .start = 0x16000000,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = 0x16000004,
- .size = 4,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct device_d dm9000_dev = {
- .id = -1,
- .name = "dm9000",
- .num_resources = ARRAY_SIZE(dm9000_resources),
- .resource = dm9000_resources,
- .platform_data = &dm9000_data,
-};
-
struct gpio_led leds[] = {
{
.gpio = 32 + 21,
@@ -107,7 +85,8 @@ static int scb9328_devices_init(void)
sdram_dev = add_mem_device("ram0", 0x08000000, 16 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);
armlinux_add_dram(sdram_dev);
- register_device(&dm9000_dev);
+ add_dm9000_device(-1, 0x16000000, 0x16000004,
+ IORESOURCE_MEM_16BIT, &dm9000_data);
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0");
devfs_add_partition("nor0", 0x40000, 0x20000, PARTITION_FIXED, "env0");
diff --git a/drivers/base/resource.c b/drivers/base/resource.c
index f0450d3..98fc68a 100644
--- a/drivers/base/resource.c
+++ b/drivers/base/resource.c
@@ -25,15 +25,25 @@
#include <driver.h>
#include <xfuncs.h>
-struct device_d *add_generic_device(const char* devname, int id, const char *resname,
- resource_size_t start, resource_size_t size, unsigned int flags,
- void *pdata)
+static struct device_d *alloc_device(const char* devname, int id, void *pdata)
{
struct device_d *dev;
dev = xzalloc(sizeof(*dev));
strcpy(dev->name, devname);
dev->id = id;
+ dev->platform_data = pdata;
+
+ return dev;
+}
+
+struct device_d *add_generic_device(const char* devname, int id, const char *resname,
+ resource_size_t start, resource_size_t size, unsigned int flags,
+ void *pdata)
+{
+ struct device_d *dev;
+
+ dev = alloc_device(devname, id, pdata);
dev->resource = xzalloc(sizeof(struct resource));
dev->num_resources = 1;
if (resname)
@@ -41,10 +51,49 @@ struct device_d *add_generic_device(const char* devname, int id, const char *res
dev->resource[0].start = start;
dev->resource[0].size = size;
dev->resource[0].flags = flags;
- dev->platform_data = pdata;
register_device(dev);
return dev;
}
EXPORT_SYMBOL(add_generic_device);
+
+#ifdef CONFIG_DRIVER_NET_DM9000
+struct device_d *add_dm9000_device(int id, resource_size_t base,
+ resource_size_t data, int flags, void *pdata)
+{
+ struct device_d *dev;
+ resource_size_t size;
+
+ dev = alloc_device("dm9000", id, pdata);
+ dev->resource = xzalloc(sizeof(struct resource) * 2);
+ dev->num_resources = 2;
+
+ switch (flags) {
+ case IORESOURCE_MEM_32BIT:
+ size = 8;
+ break;
+ case IORESOURCE_MEM_16BIT:
+ size = 4;
+ break;
+ case IORESOURCE_MEM_8BIT:
+ size = 2;
+ break;
+ default:
+ printf("dm9000: memory width flag missing\n");
+ return NULL;
+ }
+
+ dev->resource[0].start = base;
+ dev->resource[0].size = size;
+ dev->resource[0].flags = IORESOURCE_MEM | flags;
+ dev->resource[1].start = data;
+ dev->resource[1].size = size;
+ dev->resource[1].flags = IORESOURCE_MEM | flags;
+
+ register_device(dev);
+
+ return dev;
+}
+EXPORT_SYMBOL(add_dm9000_device);
+#endif
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 691d877..be14317 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -500,7 +500,8 @@ static int dm9000_probe(struct device_d *dev)
pdata = dev->platform_data;
priv = edev->priv;
- priv->buswidth = pdata->buswidth;
+
+ priv->buswidth = dev->resource[0].flags & IORESOURCE_MEM_TYPE_MASK;
priv->iodata = dev_request_mem_region(dev, 1);
priv->iobase = dev_request_mem_region(dev, 0);
priv->srom = pdata->srom;
diff --git a/include/dm9000.h b/include/dm9000.h
index c4618f1..a9a4635 100644
--- a/include/dm9000.h
+++ b/include/dm9000.h
@@ -3,7 +3,6 @@
#define __DM9000_H__
struct dm9000_platform_data {
- int buswidth;
int srom;
};
diff --git a/include/driver.h b/include/driver.h
index 9f00754..38c0bca 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -235,6 +235,17 @@ static inline struct device_d *add_ns16550_device(int id, resource_size_t start,
IORESOURCE_MEM, pdata);
}
+#ifdef CONFIG_DRIVER_NET_DM9000
+struct device_d *add_dm9000_device(int id, resource_size_t base,
+ resource_size_t data, int flags, void *pdata);
+#else
+static inline struct device_d *add_dm9000_device(int id, resource_size_t base,
+ resource_size_t data, int flags, void *pdata)
+{
+ return NULL;
+}
+#endif
+
/* linear list over all available devices
*/
extern struct list_head device_list;
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 5/7] resource: introduce add_usb_ehci_device to register echi device
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (8 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 05/23] dm9000: introduce add_dm9000_device to register dm9000 device Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 6/7] omap: switch to add_generic_device Jean-Christophe PLAGNIOL-VILLARD
` (20 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
pass the hccr and hcor register base via resource
instroduce add_generic_usb_echi_device with hccr = base + 0x100 and
hcor = base + 0x140
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/chumby_falconwing/falconwing.c | 17 +--------------
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 8 +------
arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c | 9 +-------
arch/arm/boards/freescale-mx25-3-stack/3stack.c | 9 +-------
arch/arm/boards/guf-neso/board.c | 10 +--------
arch/arm/boards/omap/board-beagle.c | 13 +----------
arch/arm/boards/panda/board.c | 18 ++++++----------
arch/arm/boards/pcm037/pcm037.c | 18 +---------------
arch/arm/boards/pcm038/pcm038.c | 9 +-------
arch/arm/boards/phycard-i.MX27/pca100.c | 18 +---------------
drivers/base/resource.c | 21 ++++++++++++++++++++
drivers/usb/host/ehci-hcd.c | 22 +++++++++++---------
include/driver.h | 17 ++++++++++++++++
13 files changed, 70 insertions(+), 119 deletions(-)
diff --git a/arch/arm/boards/chumby_falconwing/falconwing.c b/arch/arm/boards/chumby_falconwing/falconwing.c
index 7a5f37e..5875955 100644
--- a/arch/arm/boards/chumby_falconwing/falconwing.c
+++ b/arch/arm/boards/chumby_falconwing/falconwing.c
@@ -327,20 +327,6 @@ static int register_persistant_environment(void)
return devfs_add_partition("disk0.1", 0, cdev->size, DEVFS_PARTITION_FIXED, "env0");
}
-static struct ehci_platform_data chumby_usb_pdata = {
- .flags = EHCI_HAS_TT,
- .hccr_offset = 0x100,
- .hcor_offset = 0x140,
-};
-
-static struct device_d usb_dev = {
- .name = "ehci",
- .id = -1,
- .map_base = IMX_USB_BASE,
- .size = 0x200,
- .platform_data = &chumby_usb_pdata,
-};
-
#define GPIO_USB_HUB_RESET 29
#define GPIO_USB_HUB_POWER 26
@@ -353,7 +339,8 @@ static void falconwing_init_usb(void)
gpio_direction_output(GPIO_USB_HUB_RESET, 1);
imx_usb_phy_enable();
- register_device(&usb_dev);
+
+ add_generic_usb_ehci_device(-1, IMX_USB_BASE, NULL);
}
static int falconwing_devices_init(void)
diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
index 6ea4a6e..47d5e12 100644
--- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
+++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
@@ -148,12 +148,6 @@ static void imx25_usb_init(void)
writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
}
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
#endif
static struct fsl_usb2_platform_data usb_pdata = {
@@ -282,7 +276,7 @@ static int eukrea_cpuimx25_devices_init(void)
#ifdef CONFIG_USB
imx25_usb_init();
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
register_device(&usbotg_dev);
diff --git a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
index d1de495..4de3c5a 100644
--- a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
+++ b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
@@ -117,13 +117,6 @@ static void imx35_usb_init(void)
tmp = readl(IMX_OTG_BASE + 0x5a8);
writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
}
-
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
#endif
static struct fsl_usb2_platform_data usb_pdata = {
@@ -181,7 +174,7 @@ static int eukrea_cpuimx35_devices_init(void)
#ifdef CONFIG_USB
imx35_usb_init();
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
#ifdef CONFIG_USB_GADGET
/* Workaround ENGcm09152 */
diff --git a/arch/arm/boards/freescale-mx25-3-stack/3stack.c b/arch/arm/boards/freescale-mx25-3-stack/3stack.c
index 6d4bde5..8d9b29d 100644
--- a/arch/arm/boards/freescale-mx25-3-stack/3stack.c
+++ b/arch/arm/boards/freescale-mx25-3-stack/3stack.c
@@ -137,13 +137,6 @@ static void imx25_usb_init(void)
tmp = readl(IMX_OTG_BASE + 0x5a8);
writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
}
-
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
#endif
static struct i2c_board_info i2c_devices[] = {
@@ -207,7 +200,7 @@ static int imx25_devices_init(void)
* the CPLD has to be initialized.
*/
imx25_usb_init();
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
imx25_add_fec(&fec_info);
diff --git a/arch/arm/boards/guf-neso/board.c b/arch/arm/boards/guf-neso/board.c
index 4e0ac90..f3a4635 100644
--- a/arch/arm/boards/guf-neso/board.c
+++ b/arch/arm/boards/guf-neso/board.c
@@ -114,14 +114,6 @@ static struct imx_fb_platform_data neso_fb_data = {
};
#ifdef CONFIG_USB
-
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
-
static void neso_usbh_init(void)
{
uint32_t temp;
@@ -304,7 +296,7 @@ static int neso_devices_init(void)
#ifdef CONFIG_USB
neso_usbh_init();
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
imx27_add_fec(&fec_info);
diff --git a/arch/arm/boards/omap/board-beagle.c b/arch/arm/boards/omap/board-beagle.c
index 107a009..adf0b94 100644
--- a/arch/arm/boards/omap/board-beagle.c
+++ b/arch/arm/boards/omap/board-beagle.c
@@ -277,16 +277,6 @@ static struct omap_hcd omap_ehci_pdata = {
static struct ehci_platform_data ehci_pdata = {
.flags = 0,
- .hccr_offset = 0x100,
- .hcor_offset = 0x110,
-};
-
-static struct device_d usbh_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = 0x48064700,
- .size = 4 * 1024,
- .platform_data = &ehci_pdata,
};
#endif /* CONFIG_USB_EHCI_OMAP */
@@ -324,7 +314,8 @@ static int beagle_devices_init(void)
#ifdef CONFIG_USB_EHCI_OMAP
if (ehci_omap_init(&omap_ehci_pdata) >= 0)
- register_device(&usbh_dev);
+ add_usb_ehci_device(-1, 0x48064700 + 0x100,
+ 0x48064700 + 0x110, &ehci_pdata);
#endif /* CONFIG_USB_EHCI_OMAP */
#ifdef CONFIG_GPMC
/* WP is made high and WAIT1 active Low */
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index c5b1e5c..9cbc10b 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -67,18 +67,9 @@ static int panda_mmu_init(void)
device_initcall(panda_mmu_init);
#endif
+#ifdef CONFIG_USB_EHCI
static struct ehci_platform_data ehci_pdata = {
.flags = 0,
- .hccr_offset = 0x0,
- .hcor_offset = 0x10,
-};
-
-static struct device_d usbh_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = 0x4a064c00,
- .size = 4 * 1024,
- .platform_data = &ehci_pdata,
};
static void panda_ehci_init(void)
@@ -111,8 +102,13 @@ static void panda_ehci_init(void)
/* enable power to hub */
gpio_set_value(GPIO_HUB_POWER, 1);
- register_device(&usbh_dev);
+ add_usb_ehci_device(-1, 0x4a064c00,
+ 0x4a064c00 + 0x10, &ehci_pdata);
}
+#else
+static void panda_ehci_init(void)
+{}
+#endif
static void __init panda_boardrev_init(void)
{
diff --git a/arch/arm/boards/pcm037/pcm037.c b/arch/arm/boards/pcm037/pcm037.c
index 6e20d1d..c2d0e8b 100644
--- a/arch/arm/boards/pcm037/pcm037.c
+++ b/arch/arm/boards/pcm037/pcm037.c
@@ -70,20 +70,6 @@ struct imx_nand_platform_data nand_info = {
};
#ifdef CONFIG_USB
-static struct device_d usbotg_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE,
- .size = 0x200,
-};
-
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
-
static void pcm037_usb_init(void)
{
u32 tmp;
@@ -250,8 +236,8 @@ static int imx31_devices_init(void)
#endif
#ifdef CONFIG_USB
pcm037_usb_init();
- register_device(&usbotg_dev);
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
armlinux_set_bootparams((void *)0x80000100);
diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c
index 2f87b12..02c3dba 100644
--- a/arch/arm/boards/pcm038/pcm038.c
+++ b/arch/arm/boards/pcm038/pcm038.c
@@ -109,13 +109,6 @@ static struct imx_fb_platform_data pcm038_fb_data = {
};
#ifdef CONFIG_USB
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
-
static void pcm038_usbh_init(void)
{
uint32_t temp;
@@ -271,7 +264,7 @@ static int pcm038_devices_init(void)
#ifdef CONFIG_USB
pcm038_usbh_init();
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
/* Register the fec device after the PLL re-initialisation
diff --git a/arch/arm/boards/phycard-i.MX27/pca100.c b/arch/arm/boards/phycard-i.MX27/pca100.c
index 63216f5..e557d89 100644
--- a/arch/arm/boards/phycard-i.MX27/pca100.c
+++ b/arch/arm/boards/phycard-i.MX27/pca100.c
@@ -53,20 +53,6 @@ struct imx_nand_platform_data nand_info = {
};
#ifdef CONFIG_USB
-static struct device_d usbotg_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE,
- .size = 0x200,
-};
-
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
-
static void pca100_usb_register(void)
{
mdelay(10);
@@ -77,9 +63,9 @@ static void pca100_usb_register(void)
mdelay(10);
isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x170), 1);
- register_device(&usbotg_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL);
isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x570), 1);
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
}
#endif
diff --git a/drivers/base/resource.c b/drivers/base/resource.c
index 98fc68a..5fc705f 100644
--- a/drivers/base/resource.c
+++ b/drivers/base/resource.c
@@ -97,3 +97,24 @@ struct device_d *add_dm9000_device(int id, resource_size_t base,
}
EXPORT_SYMBOL(add_dm9000_device);
#endif
+
+#ifdef CONFIG_USB_EHCI
+struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
+ resource_size_t hcor, void *pdata)
+{
+ struct device_d *dev;
+
+ dev = alloc_device("ehci", id, pdata);
+ dev->resource = xzalloc(sizeof(struct resource) * 2);
+ dev->num_resources = 2;
+ dev->resource[0].start = hccr;
+ dev->resource[0].flags = IORESOURCE_MEM;
+ dev->resource[1].start = hcor;
+ dev->resource[1].flags = IORESOURCE_MEM;
+
+ register_device(dev);
+
+ return dev;
+}
+EXPORT_SYMBOL(add_usb_ehci_device);
+#endif
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 844dc1d..54856a3 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -900,20 +900,22 @@ static int ehci_probe(struct device_d *dev)
host = &ehci->host;
dev->priv = ehci;
- if (pdata) {
+ /* default to EHCI_HAS_TT to not change behaviour of boards
+ * with platform_data
+ */
+ if (pdata)
ehci->flags = pdata->flags;
- ehci->hccr = (void *)(dev->map_base + pdata->hccr_offset);
- ehci->hcor = (void *)(dev->map_base + pdata->hcor_offset);
- }
- else {
- /* default to EHCI_HAS_TT to not change behaviour of boards
- * with platform_data
- */
+ else
ehci->flags = EHCI_HAS_TT;
- ehci->hccr = (void *)(dev->map_base + 0x100);
- ehci->hcor = (void *)(dev->map_base + 0x140);
+
+ if (dev->num_resources < 2) {
+ printf("echi: need 2 resources base and data");
+ return -ENODEV;
}
+ ehci->hccr = dev_request_mem_region(dev, 0);
+ ehci->hcor = dev_request_mem_region(dev, 1);
+
host->init = ehci_init;
host->submit_int_msg = submit_int_msg;
host->submit_control_msg = submit_control_msg;
diff --git a/include/driver.h b/include/driver.h
index 1f45019..fecaecc 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -238,6 +238,23 @@ static inline struct device_d *add_dm9000_device(int id, resource_size_t base,
}
#endif
+#ifdef CONFIG_USB_EHCI
+struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
+ resource_size_t hcor, void *pdata);
+#else
+static inline struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
+ resource_size_t hcor, void *pdata)
+{
+ return NULL;
+}
+#endif
+
+static inline struct device_d *add_generic_usb_ehci_device(int id,
+ resource_size_t base, void *pdata)
+{
+ return add_usb_ehci_device(id, base + 0x100, base + 0x140, pdata);
+}
+
/* linear list over all available devices
*/
extern struct list_head device_list;
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 6/7] omap: switch to add_generic_device
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (9 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 5/7] resource: introduce add_usb_ehci_device to register echi device Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 06/23] resource: introduce add_usb_ehci_device to register echi device Jean-Christophe PLAGNIOL-VILLARD
` (19 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/omap/board-beagle.c | 30 ++++++------------------------
arch/arm/boards/omap/board-sdp343x.c | 1 -
arch/arm/mach-omap/devices-gpmc-nand.c | 13 +++----------
3 files changed, 9 insertions(+), 35 deletions(-)
diff --git a/arch/arm/boards/omap/board-beagle.c b/arch/arm/boards/omap/board-beagle.c
index adf0b94..8f868ad 100644
--- a/arch/arm/boards/omap/board-beagle.c
+++ b/arch/arm/boards/omap/board-beagle.c
@@ -242,14 +242,6 @@ static struct NS16550_plat serial_plat = {
.reg_write = omap_uart_write,
};
-static struct device_d beagle_serial_device = {
- .id = -1,
- .name = "serial_ns16550",
- .map_base = OMAP_UART3_BASE,
- .size = 1024,
- .platform_data = (void *)&serial_plat,
-};
-
/**
* @brief UART serial port initialization - remember to enable COM clocks in
* arch
@@ -259,7 +251,8 @@ static struct device_d beagle_serial_device = {
static int beagle_console_init(void)
{
/* Register the serial port */
- return register_device(&beagle_serial_device);
+ return !!add_generic_device("serial_ns16550", -1, NULL, OMAP_UART3_BASE, 1024,
+ IORESOURCE_MEM, &serial_plat);
}
console_initcall(beagle_console_init);
#endif /* CONFIG_DRIVER_SERIAL_NS16550 */
@@ -280,25 +273,12 @@ static struct ehci_platform_data ehci_pdata = {
};
#endif /* CONFIG_USB_EHCI_OMAP */
-static struct device_d i2c_dev = {
- .id = -1,
- .name = "i2c-omap",
- .map_base = OMAP_I2C1_BASE,
-};
-
static struct i2c_board_info i2c_devices[] = {
{
I2C_BOARD_INFO("twl4030", 0x48),
},
};
-static struct device_d hsmmc_dev = {
- .id = -1,
- .name = "omap-hsmmc",
- .map_base = 0x4809C000,
- .size = SZ_4K,
-};
-
static int beagle_devices_init(void)
{
struct device_d *sdram_dev;
@@ -310,7 +290,8 @@ static int beagle_devices_init(void)
armlinux_add_dram(sdram_dev);
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
- register_device(&i2c_dev);
+ add_generic_device("i2c-omap", -1, NULL, 0x4809C000, SZ_4K,
+ IORESOURCE_MEM, NULL);
#ifdef CONFIG_USB_EHCI_OMAP
if (ehci_omap_init(&omap_ehci_pdata) >= 0)
@@ -323,7 +304,8 @@ static int beagle_devices_init(void)
#endif
gpmc_generic_nand_devices_init(0, 16, OMAP_ECC_HAMMING_CODE_HW_ROMCODE);
- register_device(&hsmmc_dev);
+ add_generic_device("omap-hsmmc", -1, NULL, OMAP_I2C1_BASE, 0,
+ IORESOURCE_MEM, NULL);
armlinux_set_bootparams((void *)0x80000100);
armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE);
diff --git a/arch/arm/boards/omap/board-sdp343x.c b/arch/arm/boards/omap/board-sdp343x.c
index 04aa302..360766a 100644
--- a/arch/arm/boards/omap/board-sdp343x.c
+++ b/arch/arm/boards/omap/board-sdp343x.c
@@ -647,7 +647,6 @@ static int sdp3430_flash_init(void)
static int sdp3430_devices_init(void)
{
struct device_d *sdram_dev;
- int ret;
sdram_dev = add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);
diff --git a/arch/arm/mach-omap/devices-gpmc-nand.c b/arch/arm/mach-omap/devices-gpmc-nand.c
index c2a2b0d..bf409a7 100644
--- a/arch/arm/mach-omap/devices-gpmc-nand.c
+++ b/arch/arm/mach-omap/devices-gpmc-nand.c
@@ -70,15 +70,6 @@ static struct gpmc_nand_platform_data nand_plat = {
.priv = (void *)&nand_cfg,
};
-/** NAND device definition */
-static struct device_d gpmc_generic_nand_nand_device = {
- .id = -1,
- .name = "gpmc_nand",
- .map_base = OMAP_GPMC_BASE,
- .size = 1024 * 4, /* GPMC size */
- .platform_data = (void *)&nand_plat,
-};
-
/**
* @brief gpmc_generic_nand_devices_init - init generic nand device
*
@@ -99,5 +90,7 @@ int gpmc_generic_nand_devices_init(int cs, int width,
/* Configure GPMC CS before register */
gpmc_cs_config(nand_plat.cs, &nand_cfg);
- return register_device(&gpmc_generic_nand_nand_device);
+
+ return !!add_generic_device("gpmc_nand", -1, NULL, OMAP_GPMC_BASE, 1024 * 4,
+ IORESOURCE_MEM, &nand_plat);
}
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 06/23] resource: introduce add_usb_ehci_device to register echi device
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (10 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 6/7] omap: switch to add_generic_device Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 7/7] fb: switch to "struct resource" Jean-Christophe PLAGNIOL-VILLARD
` (18 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
pass the hccr and hcor register base via resource
instroduce add_generic_usb_echi_device with hccr = base + 0x100 and
hcor = base + 0x140
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/chumby_falconwing/falconwing.c | 17 +--------------
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 8 +------
arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c | 9 +-------
arch/arm/boards/freescale-mx25-3-stack/3stack.c | 9 +-------
arch/arm/boards/guf-neso/board.c | 10 +--------
arch/arm/boards/omap/board-beagle.c | 13 +----------
arch/arm/boards/panda/board.c | 18 ++++++----------
arch/arm/boards/pcm037/pcm037.c | 18 +---------------
arch/arm/boards/pcm038/pcm038.c | 9 +-------
arch/arm/boards/phycard-i.MX27/pca100.c | 18 +---------------
drivers/base/resource.c | 21 ++++++++++++++++++++
drivers/usb/host/ehci-hcd.c | 22 +++++++++++---------
include/driver.h | 17 ++++++++++++++++
13 files changed, 70 insertions(+), 119 deletions(-)
diff --git a/arch/arm/boards/chumby_falconwing/falconwing.c b/arch/arm/boards/chumby_falconwing/falconwing.c
index 7a5f37e..5875955 100644
--- a/arch/arm/boards/chumby_falconwing/falconwing.c
+++ b/arch/arm/boards/chumby_falconwing/falconwing.c
@@ -327,20 +327,6 @@ static int register_persistant_environment(void)
return devfs_add_partition("disk0.1", 0, cdev->size, DEVFS_PARTITION_FIXED, "env0");
}
-static struct ehci_platform_data chumby_usb_pdata = {
- .flags = EHCI_HAS_TT,
- .hccr_offset = 0x100,
- .hcor_offset = 0x140,
-};
-
-static struct device_d usb_dev = {
- .name = "ehci",
- .id = -1,
- .map_base = IMX_USB_BASE,
- .size = 0x200,
- .platform_data = &chumby_usb_pdata,
-};
-
#define GPIO_USB_HUB_RESET 29
#define GPIO_USB_HUB_POWER 26
@@ -353,7 +339,8 @@ static void falconwing_init_usb(void)
gpio_direction_output(GPIO_USB_HUB_RESET, 1);
imx_usb_phy_enable();
- register_device(&usb_dev);
+
+ add_generic_usb_ehci_device(-1, IMX_USB_BASE, NULL);
}
static int falconwing_devices_init(void)
diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
index d797846..ecb5a38 100644
--- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
+++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
@@ -149,12 +149,6 @@ static void imx25_usb_init(void)
writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
}
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
#endif
static struct fsl_usb2_platform_data usb_pdata = {
@@ -284,7 +278,7 @@ static int eukrea_cpuimx25_devices_init(void)
#ifdef CONFIG_USB
imx25_usb_init();
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
register_device(&usbotg_dev);
diff --git a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
index 7f941cc..c1fe144 100644
--- a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
+++ b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
@@ -117,13 +117,6 @@ static void imx35_usb_init(void)
tmp = readl(IMX_OTG_BASE + 0x5a8);
writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
}
-
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
#endif
#ifdef CONFIG_USB_GADGET
@@ -183,7 +176,7 @@ static int eukrea_cpuimx35_devices_init(void)
#ifdef CONFIG_USB
imx35_usb_init();
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
#ifdef CONFIG_USB_GADGET
/* Workaround ENGcm09152 */
diff --git a/arch/arm/boards/freescale-mx25-3-stack/3stack.c b/arch/arm/boards/freescale-mx25-3-stack/3stack.c
index f71cb4b..3902ccf 100644
--- a/arch/arm/boards/freescale-mx25-3-stack/3stack.c
+++ b/arch/arm/boards/freescale-mx25-3-stack/3stack.c
@@ -138,13 +138,6 @@ static void imx25_usb_init(void)
tmp = readl(IMX_OTG_BASE + 0x5a8);
writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
}
-
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
#endif
static struct i2c_board_info i2c_devices[] = {
@@ -208,7 +201,7 @@ static int imx25_devices_init(void)
* the CPLD has to be initialized.
*/
imx25_usb_init();
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
imx25_iim_register_fec_ethaddr();
diff --git a/arch/arm/boards/guf-neso/board.c b/arch/arm/boards/guf-neso/board.c
index 4e0ac90..f3a4635 100644
--- a/arch/arm/boards/guf-neso/board.c
+++ b/arch/arm/boards/guf-neso/board.c
@@ -114,14 +114,6 @@ static struct imx_fb_platform_data neso_fb_data = {
};
#ifdef CONFIG_USB
-
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
-
static void neso_usbh_init(void)
{
uint32_t temp;
@@ -304,7 +296,7 @@ static int neso_devices_init(void)
#ifdef CONFIG_USB
neso_usbh_init();
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
imx27_add_fec(&fec_info);
diff --git a/arch/arm/boards/omap/board-beagle.c b/arch/arm/boards/omap/board-beagle.c
index 191496a..dcf2d72 100644
--- a/arch/arm/boards/omap/board-beagle.c
+++ b/arch/arm/boards/omap/board-beagle.c
@@ -271,16 +271,6 @@ static struct omap_hcd omap_ehci_pdata = {
static struct ehci_platform_data ehci_pdata = {
.flags = 0,
- .hccr_offset = 0x100,
- .hcor_offset = 0x110,
-};
-
-static struct device_d usbh_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = 0x48064700,
- .size = 4 * 1024,
- .platform_data = &ehci_pdata,
};
#endif /* CONFIG_USB_EHCI_OMAP */
@@ -318,7 +308,8 @@ static int beagle_devices_init(void)
#ifdef CONFIG_USB_EHCI_OMAP
if (ehci_omap_init(&omap_ehci_pdata) >= 0)
- register_device(&usbh_dev);
+ add_usb_ehci_device(-1, 0x48064700 + 0x100,
+ 0x48064700 + 0x110, &ehci_pdata);
#endif /* CONFIG_USB_EHCI_OMAP */
#ifdef CONFIG_GPMC
/* WP is made high and WAIT1 active Low */
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index 1c6cf58..de43ca5 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -61,18 +61,9 @@ static int panda_mmu_init(void)
device_initcall(panda_mmu_init);
#endif
+#ifdef CONFIG_USB_EHCI
static struct ehci_platform_data ehci_pdata = {
.flags = 0,
- .hccr_offset = 0x0,
- .hcor_offset = 0x10,
-};
-
-static struct device_d usbh_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = 0x4a064c00,
- .size = 4 * 1024,
- .platform_data = &ehci_pdata,
};
static void panda_ehci_init(void)
@@ -105,8 +96,13 @@ static void panda_ehci_init(void)
/* enable power to hub */
gpio_set_value(GPIO_HUB_POWER, 1);
- register_device(&usbh_dev);
+ add_usb_ehci_device(-1, 0x4a064c00,
+ 0x4a064c00 + 0x10, &ehci_pdata);
}
+#else
+static void panda_ehci_init(void)
+{}
+#endif
static void __init panda_boardrev_init(void)
{
diff --git a/arch/arm/boards/pcm037/pcm037.c b/arch/arm/boards/pcm037/pcm037.c
index 446add8..f4b4444 100644
--- a/arch/arm/boards/pcm037/pcm037.c
+++ b/arch/arm/boards/pcm037/pcm037.c
@@ -58,20 +58,6 @@ struct imx_nand_platform_data nand_info = {
};
#ifdef CONFIG_USB
-static struct device_d usbotg_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE,
- .size = 0x200,
-};
-
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
-
static void pcm037_usb_init(void)
{
u32 tmp;
@@ -245,8 +231,8 @@ static int imx31_devices_init(void)
#endif
#ifdef CONFIG_USB
pcm037_usb_init();
- register_device(&usbotg_dev);
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
armlinux_set_bootparams((void *)0x80000100);
diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c
index 2f87b12..02c3dba 100644
--- a/arch/arm/boards/pcm038/pcm038.c
+++ b/arch/arm/boards/pcm038/pcm038.c
@@ -109,13 +109,6 @@ static struct imx_fb_platform_data pcm038_fb_data = {
};
#ifdef CONFIG_USB
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
-
static void pcm038_usbh_init(void)
{
uint32_t temp;
@@ -271,7 +264,7 @@ static int pcm038_devices_init(void)
#ifdef CONFIG_USB
pcm038_usbh_init();
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
/* Register the fec device after the PLL re-initialisation
diff --git a/arch/arm/boards/phycard-i.MX27/pca100.c b/arch/arm/boards/phycard-i.MX27/pca100.c
index 74af774..9a10a9d 100644
--- a/arch/arm/boards/phycard-i.MX27/pca100.c
+++ b/arch/arm/boards/phycard-i.MX27/pca100.c
@@ -53,20 +53,6 @@ struct imx_nand_platform_data nand_info = {
};
#ifdef CONFIG_USB
-static struct device_d usbotg_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE,
- .size = 0x200,
-};
-
-static struct device_d usbh2_dev = {
- .id = -1,
- .name = "ehci",
- .map_base = IMX_OTG_BASE + 0x400,
- .size = 0x200,
-};
-
static void pca100_usb_register(void)
{
mdelay(10);
@@ -77,9 +63,9 @@ static void pca100_usb_register(void)
mdelay(10);
isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x170), 1);
- register_device(&usbotg_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL);
isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x570), 1);
- register_device(&usbh2_dev);
+ add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
}
#endif
diff --git a/drivers/base/resource.c b/drivers/base/resource.c
index 98fc68a..5fc705f 100644
--- a/drivers/base/resource.c
+++ b/drivers/base/resource.c
@@ -97,3 +97,24 @@ struct device_d *add_dm9000_device(int id, resource_size_t base,
}
EXPORT_SYMBOL(add_dm9000_device);
#endif
+
+#ifdef CONFIG_USB_EHCI
+struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
+ resource_size_t hcor, void *pdata)
+{
+ struct device_d *dev;
+
+ dev = alloc_device("ehci", id, pdata);
+ dev->resource = xzalloc(sizeof(struct resource) * 2);
+ dev->num_resources = 2;
+ dev->resource[0].start = hccr;
+ dev->resource[0].flags = IORESOURCE_MEM;
+ dev->resource[1].start = hcor;
+ dev->resource[1].flags = IORESOURCE_MEM;
+
+ register_device(dev);
+
+ return dev;
+}
+EXPORT_SYMBOL(add_usb_ehci_device);
+#endif
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 844dc1d..60fc181 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -900,20 +900,22 @@ static int ehci_probe(struct device_d *dev)
host = &ehci->host;
dev->priv = ehci;
- if (pdata) {
+ /* default to EHCI_HAS_TT to not change behaviour of boards
+ * without platform_data
+ */
+ if (pdata)
ehci->flags = pdata->flags;
- ehci->hccr = (void *)(dev->map_base + pdata->hccr_offset);
- ehci->hcor = (void *)(dev->map_base + pdata->hcor_offset);
- }
- else {
- /* default to EHCI_HAS_TT to not change behaviour of boards
- * with platform_data
- */
+ else
ehci->flags = EHCI_HAS_TT;
- ehci->hccr = (void *)(dev->map_base + 0x100);
- ehci->hcor = (void *)(dev->map_base + 0x140);
+
+ if (dev->num_resources < 2) {
+ printf("echi: need 2 resources base and data");
+ return -ENODEV;
}
+ ehci->hccr = dev_request_mem_region(dev, 0);
+ ehci->hcor = dev_request_mem_region(dev, 1);
+
host->init = ehci_init;
host->submit_int_msg = submit_int_msg;
host->submit_control_msg = submit_control_msg;
diff --git a/include/driver.h b/include/driver.h
index 38c0bca..baf8d88 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -246,6 +246,23 @@ static inline struct device_d *add_dm9000_device(int id, resource_size_t base,
}
#endif
+#ifdef CONFIG_USB_EHCI
+struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
+ resource_size_t hcor, void *pdata);
+#else
+static inline struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
+ resource_size_t hcor, void *pdata)
+{
+ return NULL;
+}
+#endif
+
+static inline struct device_d *add_generic_usb_ehci_device(int id,
+ resource_size_t base, void *pdata)
+{
+ return add_usb_ehci_device(id, base + 0x100, base + 0x140, pdata);
+}
+
/* linear list over all available devices
*/
extern struct list_head device_list;
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 7/7] fb: switch to "struct resource"
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (11 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 06/23] resource: introduce add_usb_ehci_device to register echi device Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 07/23] omap: switch to add_generic_device Jean-Christophe PLAGNIOL-VILLARD
` (17 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/video/fb.c | 16 ++++++++++------
drivers/video/s3c.c | 16 +++++++++-------
drivers/video/stm.c | 2 +-
3 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 85db904..0be465f 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -84,9 +84,9 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param,
ret = info->fbops->fb_activate_var(info);
if (!ret) {
- dev->map_base = (unsigned long)info->screen_base;
+ dev->resource[0].start = (resource_size_t)info->screen_base;
info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >> 3);
- dev->size = info->cdev.size;
+ dev->resource[0].size = info->cdev.size;
dev_param_set_generic(dev, param, val);
} else
info->cdev.size = 0;
@@ -107,15 +107,19 @@ int register_framebuffer(struct fb_info *info)
int id = get_free_deviceid("fb");
struct device_d *dev;
+ dev = &info->dev;
+
info->cdev.ops = &fb_ops;
info->cdev.name = asprintf("fb%d", id);
info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >> 3);
- info->cdev.dev = &info->dev;
+ info->cdev.dev = dev;
info->cdev.priv = info;
- info->cdev.dev->map_base = (unsigned long)info->screen_base;
- info->cdev.dev->size = info->cdev.size;
+ dev->resource = xzalloc(sizeof(struct resource));
+ dev->resource[0].start = (resource_size_t)info->screen_base;
+ dev->resource[0].size = info->cdev.size;
+ dev->resource[0].flags = IORESOURCE_MEM;
+ dev->num_resources = 1;
- dev = &info->dev;
dev->priv = info;
dev->id = id;
diff --git a/drivers/video/s3c.c b/drivers/video/s3c.c
index 3715499..d079fde 100644
--- a/drivers/video/s3c.c
+++ b/drivers/video/s3c.c
@@ -331,11 +331,12 @@ static int s3cfb_activate_var(struct fb_info *fb_info)
static void s3cfb_info(struct device_d *hw_dev)
{
uint32_t con1, addr1, addr2, addr3;
+ struct s3cfb_info *fbi = hw_dev->priv;
- con1 = readl(hw_dev->map_base + LCDCON1);
- addr1 = readl(hw_dev->map_base + LCDSADDR1);
- addr2 = readl(hw_dev->map_base + LCDSADDR2);
- addr3 = readl(hw_dev->map_base + LCDSADDR3);
+ con1 = readl(fbi->base + LCDCON1);
+ addr1 = readl(fbi->base + LCDSADDR1);
+ addr2 = readl(fbi->base + LCDSADDR2);
+ addr3 = readl(fbi->base + LCDSADDR3);
printf(" Video hardware info:\n");
printf(" Video clock is running at %u Hz\n", s3c24xx_get_hclk() / ((GET_CLKVAL(con1) + 1) * 2));
@@ -371,15 +372,16 @@ static int s3cfb_probe(struct device_d *hw_dev)
if (! pdata)
return -ENODEV;
- writel(0, hw_dev->map_base + LCDCON1);
- writel(0, hw_dev->map_base + LCDCON5); /* FIXME not 0 for some displays */
+ fbi.base = dev_request_mem_region(hw_dev, 0);
+ writel(0, fbi.base + LCDCON1);
+ writel(0, fbi.base + LCDCON5); /* FIXME not 0 for some displays */
/* just init */
fbi.info.priv = &fbi;
/* add runtime hardware info */
fbi.hw_dev = hw_dev;
- fbi.base = (void*)hw_dev->map_base;
+ hw_dev->priv = &fbi;
/* add runtime video info */
fbi.info.mode_list = pdata->mode_list;
diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index ee2f026..78acad7 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -488,7 +488,7 @@ static int stmfb_probe(struct device_d *hw_dev)
/* add runtime hardware info */
fbi.hw_dev = hw_dev;
- fbi.base = (void *)hw_dev->map_base;
+ fbi.base = dev_request_mem_region(hw_dev, 0);
fbi.pdata = pdata;
/* add runtime video info */
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 07/23] omap: switch to add_generic_device
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (12 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 7/7] fb: switch to "struct resource" Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 08/23] fb: switch to "struct resource" Jean-Christophe PLAGNIOL-VILLARD
` (16 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/omap/board-beagle.c | 19 ++++---------------
arch/arm/boards/omap/board-sdp343x.c | 1 -
arch/arm/boards/panda/board.c | 10 ++--------
arch/arm/boards/pcm049/board.c | 20 ++++----------------
arch/arm/mach-omap/devices-gpmc-nand.c | 13 +++----------
5 files changed, 13 insertions(+), 50 deletions(-)
diff --git a/arch/arm/boards/omap/board-beagle.c b/arch/arm/boards/omap/board-beagle.c
index dcf2d72..899c34b 100644
--- a/arch/arm/boards/omap/board-beagle.c
+++ b/arch/arm/boards/omap/board-beagle.c
@@ -274,25 +274,12 @@ static struct ehci_platform_data ehci_pdata = {
};
#endif /* CONFIG_USB_EHCI_OMAP */
-static struct device_d i2c_dev = {
- .id = -1,
- .name = "i2c-omap",
- .map_base = OMAP_I2C1_BASE,
-};
-
static struct i2c_board_info i2c_devices[] = {
{
I2C_BOARD_INFO("twl4030", 0x48),
},
};
-static struct device_d hsmmc_dev = {
- .id = -1,
- .name = "omap-hsmmc",
- .map_base = 0x4809C000,
- .size = SZ_4K,
-};
-
static int beagle_devices_init(void)
{
struct device_d *sdram_dev;
@@ -304,7 +291,8 @@ static int beagle_devices_init(void)
armlinux_add_dram(sdram_dev);
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
- register_device(&i2c_dev);
+ add_generic_device("i2c-omap", -1, NULL, 0x4809C000, SZ_4K,
+ IORESOURCE_MEM, NULL);
#ifdef CONFIG_USB_EHCI_OMAP
if (ehci_omap_init(&omap_ehci_pdata) >= 0)
@@ -317,7 +305,8 @@ static int beagle_devices_init(void)
#endif
gpmc_generic_nand_devices_init(0, 16, OMAP_ECC_HAMMING_CODE_HW_ROMCODE);
- register_device(&hsmmc_dev);
+ add_generic_device("omap-hsmmc", -1, NULL, OMAP_I2C1_BASE, 0,
+ IORESOURCE_MEM, NULL);
armlinux_set_bootparams((void *)0x80000100);
armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE);
diff --git a/arch/arm/boards/omap/board-sdp343x.c b/arch/arm/boards/omap/board-sdp343x.c
index 8e8d952..010fbd7 100644
--- a/arch/arm/boards/omap/board-sdp343x.c
+++ b/arch/arm/boards/omap/board-sdp343x.c
@@ -641,7 +641,6 @@ static int sdp3430_flash_init(void)
static int sdp3430_devices_init(void)
{
struct device_d *sdram_dev;
- int ret;
sdram_dev = add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index de43ca5..4c9d8ee 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -113,13 +113,6 @@ static void __init panda_boardrev_init(void)
pr_info("PandaBoard Revision: %03d\n", board_revision);
}
-static struct device_d hsmmc_dev = {
- .id = -1,
- .name = "omap-hsmmc",
- .map_base = 0x4809C100,
- .size = SZ_4K,
-};
-
static int panda_devices_init(void)
{
struct device_d *sdram_dev;
@@ -153,7 +146,8 @@ static int panda_devices_init(void)
sdram_dev = add_mem_device("ram0", 0x80000000, SZ_1G,
IORESOURCE_MEM_WRITEABLE);
armlinux_add_dram(sdram_dev);
- register_device(&hsmmc_dev);
+ add_generic_device("omap-hsmmc", -1, NULL, 0x4809C100, SZ_4K,
+ IORESOURCE_MEM, NULL);
panda_ehci_init();
armlinux_set_bootparams((void *)0x80000100);
diff --git a/arch/arm/boards/pcm049/board.c b/arch/arm/boards/pcm049/board.c
index 7eae2cf..ec0d0b8 100644
--- a/arch/arm/boards/pcm049/board.c
+++ b/arch/arm/boards/pcm049/board.c
@@ -73,20 +73,6 @@ static int pcm049_mmu_init(void)
device_initcall(pcm049_mmu_init);
#endif
-static struct device_d hsmmc_dev = {
- .id = -1,
- .name = "omap-hsmmc",
- .map_base = 0x4809C100,
- .size = SZ_4K,
-};
-
-static struct device_d smc911x_dev = {
- .id = -1,
- .name = "smc911x",
- .map_base = 0x2C000000,
- .size = 0x4000,
-};
-
static struct gpmc_config net_cfg = {
.cfg = {
0x00001000, /* CONF1 */
@@ -104,7 +90,8 @@ static void pcm049_network_init(void)
{
gpmc_cs_config(5, &net_cfg);
- register_device(&smc911x_dev);
+ add_generic_device("smc911x", -1, NULL, 0x2C000000, 0x4000,
+ IORESOURCE_MEM, NULL);
}
static int pcm049_devices_init(void)
@@ -116,7 +103,8 @@ static int pcm049_devices_init(void)
armlinux_add_dram(sdram_dev);
add_mem_device("ram0", 0x40300000, 48 * 1024,
IORESOURCE_MEM_WRITEABLE);
- register_device(&hsmmc_dev);
+ add_generic_device("omap-hsmmc", -1, NULL, 0x4809C100, SZ_4K,
+ IORESOURCE_MEM, NULL);
gpmc_generic_init(0x10);
diff --git a/arch/arm/mach-omap/devices-gpmc-nand.c b/arch/arm/mach-omap/devices-gpmc-nand.c
index c2a2b0d..bf409a7 100644
--- a/arch/arm/mach-omap/devices-gpmc-nand.c
+++ b/arch/arm/mach-omap/devices-gpmc-nand.c
@@ -70,15 +70,6 @@ static struct gpmc_nand_platform_data nand_plat = {
.priv = (void *)&nand_cfg,
};
-/** NAND device definition */
-static struct device_d gpmc_generic_nand_nand_device = {
- .id = -1,
- .name = "gpmc_nand",
- .map_base = OMAP_GPMC_BASE,
- .size = 1024 * 4, /* GPMC size */
- .platform_data = (void *)&nand_plat,
-};
-
/**
* @brief gpmc_generic_nand_devices_init - init generic nand device
*
@@ -99,5 +90,7 @@ int gpmc_generic_nand_devices_init(int cs, int width,
/* Configure GPMC CS before register */
gpmc_cs_config(nand_plat.cs, &nand_cfg);
- return register_device(&gpmc_generic_nand_nand_device);
+
+ return !!add_generic_device("gpmc_nand", -1, NULL, OMAP_GPMC_BASE, 1024 * 4,
+ IORESOURCE_MEM, &nand_plat);
}
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 08/23] fb: switch to "struct resource"
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (13 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 07/23] omap: switch to add_generic_device Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 09/23] cfi_flash: convert missing map_base Jean-Christophe PLAGNIOL-VILLARD
` (15 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/video/fb.c | 16 ++++++++++------
drivers/video/s3c.c | 16 +++++++++-------
drivers/video/stm.c | 2 +-
3 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 85db904..0be465f 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -84,9 +84,9 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param,
ret = info->fbops->fb_activate_var(info);
if (!ret) {
- dev->map_base = (unsigned long)info->screen_base;
+ dev->resource[0].start = (resource_size_t)info->screen_base;
info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >> 3);
- dev->size = info->cdev.size;
+ dev->resource[0].size = info->cdev.size;
dev_param_set_generic(dev, param, val);
} else
info->cdev.size = 0;
@@ -107,15 +107,19 @@ int register_framebuffer(struct fb_info *info)
int id = get_free_deviceid("fb");
struct device_d *dev;
+ dev = &info->dev;
+
info->cdev.ops = &fb_ops;
info->cdev.name = asprintf("fb%d", id);
info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >> 3);
- info->cdev.dev = &info->dev;
+ info->cdev.dev = dev;
info->cdev.priv = info;
- info->cdev.dev->map_base = (unsigned long)info->screen_base;
- info->cdev.dev->size = info->cdev.size;
+ dev->resource = xzalloc(sizeof(struct resource));
+ dev->resource[0].start = (resource_size_t)info->screen_base;
+ dev->resource[0].size = info->cdev.size;
+ dev->resource[0].flags = IORESOURCE_MEM;
+ dev->num_resources = 1;
- dev = &info->dev;
dev->priv = info;
dev->id = id;
diff --git a/drivers/video/s3c.c b/drivers/video/s3c.c
index 3715499..d079fde 100644
--- a/drivers/video/s3c.c
+++ b/drivers/video/s3c.c
@@ -331,11 +331,12 @@ static int s3cfb_activate_var(struct fb_info *fb_info)
static void s3cfb_info(struct device_d *hw_dev)
{
uint32_t con1, addr1, addr2, addr3;
+ struct s3cfb_info *fbi = hw_dev->priv;
- con1 = readl(hw_dev->map_base + LCDCON1);
- addr1 = readl(hw_dev->map_base + LCDSADDR1);
- addr2 = readl(hw_dev->map_base + LCDSADDR2);
- addr3 = readl(hw_dev->map_base + LCDSADDR3);
+ con1 = readl(fbi->base + LCDCON1);
+ addr1 = readl(fbi->base + LCDSADDR1);
+ addr2 = readl(fbi->base + LCDSADDR2);
+ addr3 = readl(fbi->base + LCDSADDR3);
printf(" Video hardware info:\n");
printf(" Video clock is running at %u Hz\n", s3c24xx_get_hclk() / ((GET_CLKVAL(con1) + 1) * 2));
@@ -371,15 +372,16 @@ static int s3cfb_probe(struct device_d *hw_dev)
if (! pdata)
return -ENODEV;
- writel(0, hw_dev->map_base + LCDCON1);
- writel(0, hw_dev->map_base + LCDCON5); /* FIXME not 0 for some displays */
+ fbi.base = dev_request_mem_region(hw_dev, 0);
+ writel(0, fbi.base + LCDCON1);
+ writel(0, fbi.base + LCDCON5); /* FIXME not 0 for some displays */
/* just init */
fbi.info.priv = &fbi;
/* add runtime hardware info */
fbi.hw_dev = hw_dev;
- fbi.base = (void*)hw_dev->map_base;
+ hw_dev->priv = &fbi;
/* add runtime video info */
fbi.info.mode_list = pdata->mode_list;
diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index ee2f026..78acad7 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -488,7 +488,7 @@ static int stmfb_probe(struct device_d *hw_dev)
/* add runtime hardware info */
fbi.hw_dev = hw_dev;
- fbi.base = (void *)hw_dev->map_base;
+ fbi.base = dev_request_mem_region(hw_dev, 0);
fbi.pdata = pdata;
/* add runtime video info */
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 09/23] cfi_flash: convert missing map_base
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (14 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 08/23] fb: switch to "struct resource" Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 10/23] fsl_udc: switch to resource Jean-Christophe PLAGNIOL-VILLARD
` (14 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/nor/cfi_flash.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
index c995962..461b0e6 100644
--- a/drivers/nor/cfi_flash.c
+++ b/drivers/nor/cfi_flash.c
@@ -988,7 +988,7 @@ static int cfi_probe (struct device_d *dev)
if (info->flash_id == FLASH_UNKNOWN) {
printf ("## Unknown FLASH on Bank at 0x%08x - Size = 0x%08lx = %ld MB\n",
- dev->map_base, info->size, info->size << 20);
+ dev->resource[0].start, info->size, info->size << 20);
return -ENODEV;
}
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 10/23] fsl_udc: switch to resource
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (15 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 09/23] cfi_flash: convert missing map_base Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 11/23] pcm030: switch to resources Jean-Christophe PLAGNIOL-VILLARD
` (13 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/usb/gadget/fsl_udc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/usb/gadget/fsl_udc.c b/drivers/usb/gadget/fsl_udc.c
index 20a5064..c321e8f 100644
--- a/drivers/usb/gadget/fsl_udc.c
+++ b/drivers/usb/gadget/fsl_udc.c
@@ -2239,7 +2239,7 @@ static int fsl_udc_probe(struct device_d *dev)
udc_controller = xzalloc(sizeof(*udc_controller));
udc_controller->stopped = 1;
- dr_regs = (void *)dev->map_base;
+ dr_regs = dev_request_mem_region(dev, 0);
/* Read Device Controller Capability Parameters register */
dccparams = readl(&dr_regs->dccparams);
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 11/23] pcm030: switch to resources
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (16 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 10/23] fsl_udc: switch to resource Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 12/23] ipe337: " Jean-Christophe PLAGNIOL-VILLARD
` (12 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/ppc/boards/pcm030/pcm030.c | 30 ++++++------------------------
1 files changed, 6 insertions(+), 24 deletions(-)
diff --git a/arch/ppc/boards/pcm030/pcm030.c b/arch/ppc/boards/pcm030/pcm030.c
index 0f09d3e..ba59bfe 100644
--- a/arch/ppc/boards/pcm030/pcm030.c
+++ b/arch/ppc/boards/pcm030/pcm030.c
@@ -41,19 +41,13 @@ static struct mpc5xxx_fec_platform_data fec_info = {
.xcv_type = MII100,
};
-struct device_d eth_dev = {
- .id = -1,
- .name = "fec_mpc5xxx",
- .map_base = MPC5XXX_FEC,
- .platform_data = &fec_info,
-};
-
static int devices_init (void)
{
add_cfi_flash_device(-1, 0xff000000, 16 * 1024 * 1024, 0);
add_mem_device("ram0", 0x0, 64 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);
- register_device(ð_dev);
+ add_generic_device("fec_mpc5xxx", -1, NULL, MPC5XXX_FEC, 0,
+ IORESOURCE_MEM, &fec_info);
devfs_add_partition("nor0", 0x00f00000, 0x40000, PARTITION_FIXED, "self0");
devfs_add_partition("nor0", 0x00f60000, 0x20000, PARTITION_FIXED, "env0");
@@ -63,24 +57,12 @@ static int devices_init (void)
device_initcall(devices_init);
-static struct device_d psc3 = {
- .id = -1,
- .name = "mpc5xxx_serial",
- .map_base = MPC5XXX_PSC3,
- .size = 4096,
-};
-
-static struct device_d psc6 = {
- .id = -1,
- .name = "mpc5xxx_serial",
- .map_base = MPC5XXX_PSC6,
- .size = 4096,
-};
-
static int console_init(void)
{
- register_device(&psc3);
- register_device(&psc6);
+ add_generic_device("mpc5xxx_serial", -1, NULL, MPC5XXX_PSC3, 4096,
+ IORESOURCE_MEM, NULL);
+ add_generic_device("mpc5xxx_serial", -1, NULL, MPC5XXX_PSC6, 4096,
+ IORESOURCE_MEM, NULL);
return 0;
}
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 12/23] ipe337: switch to resources
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (17 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 11/23] pcm030: switch to resources Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-29 15:59 ` [PATCH 13/23] s3c/boards: " Jean-Christophe PLAGNIOL-VILLARD
` (11 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/blackfin/boards/ipe337/ipe337.c | 20 ++++----------------
1 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/arch/blackfin/boards/ipe337/ipe337.c b/arch/blackfin/boards/ipe337/ipe337.c
index 4430f3b..ee642d1 100644
--- a/arch/blackfin/boards/ipe337/ipe337.c
+++ b/arch/blackfin/boards/ipe337/ipe337.c
@@ -5,13 +5,6 @@
#include <partition.h>
#include <fs.h>
-static struct device_d smc911x_dev = {
- .id = -1,
- .name = "smc911x",
- .map_base = 0x24000000,
- .size = 4096,
-};
-
static int ipe337_devices_init(void) {
add_cfi_flash_device(-1, 0x20000000, 32 * 1024 * 1024, 0);
add_mem_device("ram0", 0x0, 128 * 1024 * 1024,
@@ -23,7 +16,8 @@ static int ipe337_devices_init(void) {
mdelay(100);
*pFIO0_FLAG_S = (1<<12);
- register_device(&smc911x_dev);
+ add_generic_device("smc911x", -1, NULL, 0x24000000, 4096,
+ IORESOURCE_MEM, NULL);
devfs_add_partition("nor0", 0x00000, 0x20000, PARTITION_FIXED, "self0");
devfs_add_partition("nor0", 0x20000, 0x20000, PARTITION_FIXED, "env0");
@@ -35,16 +29,10 @@ static int ipe337_devices_init(void) {
device_initcall(ipe337_devices_init);
-static struct device_d blackfin_serial_device = {
- .id = -1,
- .name = "blackfin_serial",
- .map_base = 0,
- .size = 4096,
-};
-
static int blackfin_console_init(void)
{
- register_device(&blackfin_serial_device);
+ add_generic_device("blackfin_serial", -1, NULL, 0, 4096,
+ IORESOURCE_MEM, NULL);
return 0;
}
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 13/23] s3c/boards: switch to resources
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (18 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 12/23] ipe337: " Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-29 15:59 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-30 3:17 ` [PATCH 14/23] ns16550: if not specific f_caps defined use default stdin, stdout, stderr Jean-Christophe PLAGNIOL-VILLARD
` (10 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-29 15:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/a9m2410/a9m2410.c | 40 +++++++++-------------------------
arch/arm/boards/a9m2440/a9m2440.c | 40 +++++++++-------------------------
arch/arm/boards/mini2440/mini2440.c | 36 +++++++------------------------
3 files changed, 30 insertions(+), 86 deletions(-)
diff --git a/arch/arm/boards/a9m2410/a9m2410.c b/arch/arm/boards/a9m2410/a9m2410.c
index 54012d9..64fabd2 100644
--- a/arch/arm/boards/a9m2410/a9m2410.c
+++ b/arch/arm/boards/a9m2410/a9m2410.c
@@ -40,25 +40,6 @@ static struct s3c24x0_nand_platform_data nand_info = {
.nand_timing = CALC_NFCONF_TIMING(A9M2410_TACLS, A9M2410_TWRPH0, A9M2410_TWRPH1)
};
-static struct device_d nand_dev = {
- .id = -1,
- .name = "s3c24x0_nand",
- .map_base = S3C24X0_NAND_BASE,
- .platform_data = &nand_info,
-};
-
-/*
- * SMSC 91C111 network controller on the baseboard
- * connected to CS line 1 and interrupt line
- * GPIO3, data width is 32 bit
- */
-static struct device_d network_dev = {
- .id = -1,
- .name = "smc91c111",
- .map_base = CS1_BASE + 0x300,
- .size = 16,
-};
-
static int a9m2410_devices_init(void)
{
uint32_t reg;
@@ -141,10 +122,17 @@ static int a9m2410_devices_init(void)
writel(reg, MISCCR);
/* ----------- the devices the boot loader should work with -------- */
- register_device(&nand_dev);
+ add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0,
+ IORESOURCE_MEM, &nand_info);
sdram_dev = add_mem_device("ram0", CS6_BASE, size,
IORESOURCE_MEM_WRITEABLE);
- register_device(&network_dev);
+ /*
+ * SMSC 91C111 network controller on the baseboard
+ * connected to CS line 1 and interrupt line
+ * GPIO3, data width is 32 bit
+ */
+ add_generic_device("smc91c111", -1, NULL, CS1_BASE + 0x300, 16,
+ IORESOURCE_MEM, NULL);
#ifdef CONFIG_NAND
/* ----------- add some vital partitions -------- */
@@ -171,16 +159,10 @@ void __bare_init nand_boot(void)
}
#endif
-static struct device_d a9m2410_serial_device = {
- .id = -1,
- .name = "s3c24x0_serial",
- .map_base = UART1_BASE,
- .size = UART1_SIZE,
-};
-
static int a9m2410_console_init(void)
{
- register_device(&a9m2410_serial_device);
+ add_generic_device("s3c24x0_serial", -1, NULL, UART1_BASE, UART1_SIZE,
+ IORESOURCE_MEM, NULL);
return 0;
}
diff --git a/arch/arm/boards/a9m2440/a9m2440.c b/arch/arm/boards/a9m2440/a9m2440.c
index 7ea7f1c..d52f4c2 100644
--- a/arch/arm/boards/a9m2440/a9m2440.c
+++ b/arch/arm/boards/a9m2440/a9m2440.c
@@ -42,25 +42,6 @@ static struct s3c24x0_nand_platform_data nand_info = {
.nand_timing = CALC_NFCONF_TIMING(A9M2440_TACLS, A9M2440_TWRPH0, A9M2440_TWRPH1)
};
-static struct device_d nand_dev = {
- .id = -1,
- .name = "s3c24x0_nand",
- .map_base = S3C24X0_NAND_BASE,
- .platform_data = &nand_info,
-};
-
-/*
- * cs8900 network controller onboard
- * Connected to CS line 5 + A24 and interrupt line EINT9,
- * data width is 16 bit
- */
-static struct device_d network_dev = {
- .id = -1,
- .name = "cs8900",
- .map_base = CS5_BASE + (1 << 24) + 0x300,
- .size = 16,
-};
-
static int a9m2440_check_for_ram(uint32_t addr)
{
uint32_t tmp1, tmp2;
@@ -145,10 +126,17 @@ static int a9m2440_devices_init(void)
writel(reg, MISCCR);
/* ----------- the devices the boot loader should work with -------- */
- register_device(&nand_dev);
+ add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0,
+ IORESOURCE_MEM, &nand_info);
sdram_dev = add_mem_device("ram0", CS6_BASE, s3c24x0_get_memory_size(),
IORESOURCE_MEM_WRITEABLE);
- register_device(&network_dev);
+ /*
+ * cs8900 network controller onboard
+ * Connected to CS line 5 + A24 and interrupt line EINT9,
+ * data width is 16 bit
+ */
+ add_generic_device("cs8900", -1, NULL, CS5_BASE + (1 << 24) + 0x300, 16,
+ IORESOURCE_MEM, NULL);
#ifdef CONFIG_NAND
/* ----------- add some vital partitions -------- */
@@ -174,16 +162,10 @@ void __bare_init nand_boot(void)
}
#endif
-static struct device_d a9m2440_serial_device = {
- .id = -1,
- .name = "s3c24x0_serial",
- .map_base = UART1_BASE,
- .size = UART1_SIZE,
-};
-
static int a9m2440_console_init(void)
{
- register_device(&a9m2440_serial_device);
+ add_generic_device("s3c24x0_serial", -1, NULL, UART1_BASE, UART1_SIZE,
+ IORESOURCE_MEM, NULL);
return 0;
}
diff --git a/arch/arm/boards/mini2440/mini2440.c b/arch/arm/boards/mini2440/mini2440.c
index dbf7503..c6b4932 100644
--- a/arch/arm/boards/mini2440/mini2440.c
+++ b/arch/arm/boards/mini2440/mini2440.c
@@ -49,12 +49,6 @@ static struct s3c24x0_nand_platform_data nand_info = {
.flash_bbt = 1, /* same as the kernel */
};
-static struct device_d nand_dev = {
- .name = "s3c24x0_nand",
- .map_base = S3C24X0_NAND_BASE,
- .platform_data = &nand_info,
-};
-
/*
* dm9000 network controller onboard
* Connected to CS line 4 and interrupt line EINT7,
@@ -73,12 +67,6 @@ static struct s3c_mci_platform_data mci_data = {
.detect_invert = 0,
};
-static struct device_d mci_dev = {
- .name = "s3c_mci",
- .map_base = S3C2410_SDI_BASE,
- .platform_data = &mci_data,
-};
-
static struct fb_videomode s3c24x0_fb_modes[] = {
#ifdef CONFIG_MINI2440_VIDEO_N35
{
@@ -144,12 +132,6 @@ static struct s3c_fb_platform_data s3c24x0_fb_data = {
.passive_display = 0,
};
-static struct device_d s3cfb_dev = {
- .name = "s3c_fb",
- .map_base = S3C2410_LCD_BASE,
- .platform_data = &s3c24x0_fb_data,
-};
-
static const unsigned pin_usage[] = {
/* address bus, used by NOR, SDRAM */
GPA1_ADDR16,
@@ -305,7 +287,8 @@ static int mini2440_devices_init(void)
reg |= 0x10000;
writel(reg, MISCCR);
- register_device(&nand_dev);
+ add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0,
+ IORESOURCE_MEM, &nand_info);
sdram_dev = add_mem_device("ram0", CS6_BASE, s3c24x0_get_memory_size(),
IORESOURCE_MEM_WRITEABLE);
@@ -323,8 +306,10 @@ static int mini2440_devices_init(void)
devfs_add_partition("nand0", 0x40000, 0x20000, PARTITION_FIXED, "env_raw");
dev_add_bb_dev("env_raw", "env0");
#endif
- register_device(&mci_dev);
- register_device(&s3cfb_dev);
+ add_generic_device("s3c_mci", 0, NULL, S3C2410_SDI_BASE, 0,
+ IORESOURCE_MEM, &mci_data);
+ add_generic_device("s3c_fb", 0, NULL, S3C2410_LCD_BASE, 0,
+ IORESOURCE_MEM, &s3c24x0_fb_data);
armlinux_set_bootparams(dev_get_mem_region(sdram_dev, 0) + 0x100);
armlinux_set_architecture(MACH_TYPE_MINI2440);
@@ -340,12 +325,6 @@ void __bare_init nand_boot(void)
}
#endif
-static struct device_d mini2440_serial_device = {
- .name = "s3c24x0_serial",
- .map_base = UART1_BASE,
- .size = UART1_SIZE,
-};
-
static int mini2440_console_init(void)
{
/*
@@ -357,7 +336,8 @@ static int mini2440_console_init(void)
s3c_gpio_mode(GPH2_TXD0);
s3c_gpio_mode(GPH3_RXD0);
- register_device(&mini2440_serial_device);
+ add_generic_device("s3c24x0_serial", -1, NULL, UART1_BASE, UART1_SIZE,
+ IORESOURCE_MEM, NULL);
return 0;
}
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 14/23] ns16550: if not specific f_caps defined use default stdin, stdout, stderr
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (19 preceding siblings ...)
2011-07-29 15:59 ` [PATCH 13/23] s3c/boards: " Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-30 3:17 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-30 3:17 ` [PATCH 15/23] edb93xx: switch to resource Jean-Christophe PLAGNIOL-VILLARD
` (9 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-30 3:17 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c | 1 -
arch/arm/boards/omap/board-beagle.c | 1 -
arch/arm/boards/omap/board-omap3evm.c | 1 -
arch/arm/boards/omap/board-sdp343x.c | 1 -
arch/arm/boards/panda/board.c | 1 -
arch/arm/boards/pcm049/board.c | 1 -
arch/x86/boards/x86_generic/generic_pc.c | 1 -
drivers/serial/serial_ns16550.c | 5 ++++-
8 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c
index fa910b9..65cf6d8 100644
--- a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c
+++ b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c
@@ -85,7 +85,6 @@ EXPORT_SYMBOL(quad_uart_write);
static struct NS16550_plat quad_uart_serial_plat = {
.clock = 14745600,
- .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = quad_uart_read,
.reg_write = quad_uart_write,
};
diff --git a/arch/arm/boards/omap/board-beagle.c b/arch/arm/boards/omap/board-beagle.c
index 899c34b..49e95d9 100644
--- a/arch/arm/boards/omap/board-beagle.c
+++ b/arch/arm/boards/omap/board-beagle.c
@@ -237,7 +237,6 @@ void board_init(void)
static struct NS16550_plat serial_plat = {
.clock = 48000000, /* 48MHz (APLL96/2) */
- .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = omap_uart_read,
.reg_write = omap_uart_write,
};
diff --git a/arch/arm/boards/omap/board-omap3evm.c b/arch/arm/boards/omap/board-omap3evm.c
index 071e374..0c243f3 100644
--- a/arch/arm/boards/omap/board-omap3evm.c
+++ b/arch/arm/boards/omap/board-omap3evm.c
@@ -213,7 +213,6 @@ void board_init(void)
static struct NS16550_plat serial_plat = {
.clock = 48000000, /* 48MHz (APLL96/2) */
- .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = omap_uart_read,
.reg_write = omap_uart_write,
};
diff --git a/arch/arm/boards/omap/board-sdp343x.c b/arch/arm/boards/omap/board-sdp343x.c
index 010fbd7..36f226c 100644
--- a/arch/arm/boards/omap/board-sdp343x.c
+++ b/arch/arm/boards/omap/board-sdp343x.c
@@ -605,7 +605,6 @@ static void mux_config(void)
static struct NS16550_plat serial_plat = {
.clock = 48000000, /* 48MHz (APLL96/2) */
- .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = omap_uart_read,
.reg_write = omap_uart_write,
};
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index 4c9d8ee..4164c1f 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -32,7 +32,6 @@ static int board_revision;
static struct NS16550_plat serial_plat = {
.clock = 48000000, /* 48MHz (APLL96/2) */
- .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = omap_uart_read,
.reg_write = omap_uart_write,
};
diff --git a/arch/arm/boards/pcm049/board.c b/arch/arm/boards/pcm049/board.c
index ec0d0b8..d6de29b 100644
--- a/arch/arm/boards/pcm049/board.c
+++ b/arch/arm/boards/pcm049/board.c
@@ -43,7 +43,6 @@
static struct NS16550_plat serial_plat = {
.clock = 48000000, /* 48MHz (APLL96/2) */
- .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = omap_uart_read,
.reg_write = omap_uart_write,
};
diff --git a/arch/x86/boards/x86_generic/generic_pc.c b/arch/x86/boards/x86_generic/generic_pc.c
index d031c52..b35d26f 100644
--- a/arch/x86/boards/x86_generic/generic_pc.c
+++ b/arch/x86/boards/x86_generic/generic_pc.c
@@ -78,7 +78,6 @@ device_initcall(devices_init);
static struct NS16550_plat serial_plat = {
.clock = 1843200,
- .f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = x86_uart_read,
.reg_write = x86_uart_write,
};
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 9a4b4dc..1dea736 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -196,7 +196,10 @@ static int ns16550_probe(struct device_d *dev)
dev->type_data = cdev;
cdev->dev = dev;
- cdev->f_caps = plat->f_caps;
+ if (plat->f_caps)
+ cdev->f_caps = plat->f_caps;
+ else
+ cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = ns16550_tstc;
cdev->putc = ns16550_putc;
cdev->getc = ns16550_getc;
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 15/23] edb93xx: switch to resource
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (20 preceding siblings ...)
2011-07-30 3:17 ` [PATCH 14/23] ns16550: if not specific f_caps defined use default stdin, stdout, stderr Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-30 3:17 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-30 3:17 ` [PATCH 16/23] netx: " Jean-Christophe PLAGNIOL-VILLARD
` (8 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-30 3:17 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/edb93xx/edb93xx.c | 25 +++++++------------------
1 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/arch/arm/boards/edb93xx/edb93xx.c b/arch/arm/boards/edb93xx/edb93xx.c
index b169db6..7f9e647 100644
--- a/arch/arm/boards/edb93xx/edb93xx.c
+++ b/arch/arm/boards/edb93xx/edb93xx.c
@@ -34,15 +34,6 @@
#define DEVCFG_U1EN (1 << 18)
-/*
- * Up to 32MiB NOR type flash, connected to
- * CS line 6, data width is 16 bit
- */
-static struct device_d eth_dev = {
- .id = -1,
- .name = "ep93xx_eth",
-};
-
static int ep93xx_devices_init(void)
{
struct device_d *sdram_dev;
@@ -81,7 +72,11 @@ static int ep93xx_devices_init(void)
armlinux_add_dram(sdram_dev);
#endif
- register_device(ð_dev);
+ /*
+ * Up to 32MiB NOR type flash, connected to
+ * CS line 6, data width is 16 bit
+ */
+ add_generic_device("ep93xx_eth", -1, NULL, 0, 0, IORESOURCE_MEM, NULL);
armlinux_set_bootparams((void *)CONFIG_EP93XX_SDRAM_BANK0_BASE + 0x100);
@@ -92,13 +87,6 @@ static int ep93xx_devices_init(void)
device_initcall(ep93xx_devices_init);
-static struct device_d edb93xx_serial_device = {
- .id = -1,
- .name = "pl010_serial",
- .map_base = UART1_BASE,
- .size = 4096,
-};
-
static int edb93xx_console_init(void)
{
struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE;
@@ -117,7 +105,8 @@ static int edb93xx_console_init(void)
writel(0xAA, &syscon->sysswlock);
writel(value, &syscon->devicecfg);
- register_device(&edb93xx_serial_device);
+ add_generic_device("pl010_serial", -1, NULL, UART1_BASE, 4096,
+ IORESOURCE_MEM, NULL);
return 0;
}
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 16/23] netx: switch to resource
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (21 preceding siblings ...)
2011-07-30 3:17 ` [PATCH 15/23] edb93xx: switch to resource Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-30 3:17 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-30 3:17 ` [PATCH 17/23] fs: " Jean-Christophe PLAGNIOL-VILLARD
` (7 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-30 3:17 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/netx/netx.c | 26 ++++----------------------
1 files changed, 4 insertions(+), 22 deletions(-)
diff --git a/arch/arm/boards/netx/netx.c b/arch/arm/boards/netx/netx.c
index f3be348..65681aa 100644
--- a/arch/arm/boards/netx/netx.c
+++ b/arch/arm/boards/netx/netx.c
@@ -34,22 +34,10 @@ struct netx_eth_platform_data eth0_data = {
.xcno = 0,
};
-static struct device_d netx_eth_dev0 = {
- .id = -1,
- .name = "netx-eth",
- .platform_data = ð0_data,
-};
-
struct netx_eth_platform_data eth1_data = {
.xcno = 1,
};
-static struct device_d netx_eth_dev1 = {
- .id = -1,
- .name = "netx-eth",
- .platform_data = ð1_data,
-};
-
static int netx_devices_init(void) {
struct device_d *sdram_dev;
@@ -58,8 +46,8 @@ static int netx_devices_init(void) {
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);
+ add_generic_device("netx-eth", -1, NULL, 0, 0, IORESOURCE_MEM, ð0_data);
+ add_generic_device("netx-eth", -1, NULL, 0, 0, IORESOURCE_MEM, ð1_data);
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0");
@@ -76,13 +64,6 @@ static int netx_devices_init(void) {
device_initcall(netx_devices_init);
-static struct device_d netx_serial_device = {
- .id = -1,
- .name = "netx_serial",
- .map_base = NETX_PA_UART0,
- .size = 0x40,
-};
-
static int netx_console_init(void)
{
/* configure gpio for serial */
@@ -91,7 +72,8 @@ static int netx_console_init(void)
*(volatile unsigned long *)(0x00100808) = 2;
*(volatile unsigned long *)(0x0010080c) = 2;
- register_device(&netx_serial_device);
+ add_generic_device("netx_serial", -1, NULL, NETX_PA_UART0, 0x40,
+ IORESOURCE_MEM, NULL);
return 0;
}
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 17/23] fs: switch to resource
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (22 preceding siblings ...)
2011-07-30 3:17 ` [PATCH 16/23] netx: " Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-30 3:17 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-30 3:17 ` [PATCH 18/23] ata: " Jean-Christophe PLAGNIOL-VILLARD
` (6 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-30 3:17 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
fs/devfs.c | 4 +++-
fs/fs.c | 8 ++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/devfs.c b/fs/devfs.c
index 07ca16c..66f7ca4 100644
--- a/fs/devfs.c
+++ b/fs/devfs.c
@@ -161,7 +161,9 @@ static int devfs_ioctl(struct device_d *_dev, FILE *f, int request, void *buf)
static int devfs_truncate(struct device_d *dev, FILE *f, ulong size)
{
- if (size > f->dev->size)
+ if (f->dev->num_resources < 1)
+ return -ENOSPC;
+ if (size > f->dev->resource[0].size)
return -ENOSPC;
return 0;
}
diff --git a/fs/fs.c b/fs/fs.c
index bcc6ff4..7d65ec8 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1043,11 +1043,11 @@ ssize_t mem_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong
ulong size;
struct device_d *dev;
- if (!cdev->dev)
+ if (!cdev->dev || cdev->dev->num_resources < 1)
return -1;
dev = cdev->dev;
- size = min((ulong)count, dev->size - offset);
+ size = min((ulong)count, dev->resource[0].size - offset);
memcpy_sz(buf, dev_get_mem_region(dev, 0) + offset, size, flags & O_RWSIZE_MASK);
return size;
}
@@ -1058,11 +1058,11 @@ ssize_t mem_write(struct cdev *cdev, const void *buf, size_t count, ulong offset
ulong size;
struct device_d *dev;
- if (!cdev->dev)
+ if (!cdev->dev || cdev->dev->num_resources < 1)
return -1;
dev = cdev->dev;
- size = min((ulong)count, dev->size - offset);
+ size = min((ulong)count, dev->resource[0].size - offset);
memcpy_sz(dev_get_mem_region(dev, 0) + offset, buf, size, flags & O_RWSIZE_MASK);
return size;
}
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 18/23] ata: switch to resource
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (23 preceding siblings ...)
2011-07-30 3:17 ` [PATCH 17/23] fs: " Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-30 3:17 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-30 3:17 ` [PATCH 19/23] sandbox: " Jean-Christophe PLAGNIOL-VILLARD
` (5 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-30 3:17 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/ata/disk_drive.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/ata/disk_drive.c b/drivers/ata/disk_drive.c
index 2383769..523edfd 100644
--- a/drivers/ata/disk_drive.c
+++ b/drivers/ata/disk_drive.c
@@ -197,7 +197,7 @@ static int disk_probe(struct device_d *dev)
dev_info(dev, "Drive size guessed to %u kiB\n", dev->size / 1024);
}
#endif
- atablk->blk.num_blocks = dev->size / SECTOR_SIZE;
+ atablk->blk.num_blocks = dev->resource[0].size / SECTOR_SIZE;
atablk->blk.ops = &ataops;
atablk->blk.blockbits = 9;
atablk->dev = dev;
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 19/23] sandbox: switch to resource
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (24 preceding siblings ...)
2011-07-30 3:17 ` [PATCH 18/23] ata: " Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-30 3:17 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-30 3:17 ` [PATCH 20/23] imx: switch remaing board " Jean-Christophe PLAGNIOL-VILLARD
` (4 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-30 3:17 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/sandbox/board/hostfile.c | 14 ++------------
arch/sandbox/mach-sandbox/include/mach/hostfile.h | 2 +-
arch/sandbox/os/common.c | 4 ++--
3 files changed, 5 insertions(+), 15 deletions(-)
create mode 100644 arch/sandbox/include/asm/io.h
diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
index b049baa..f5452af 100644
--- a/arch/sandbox/board/hostfile.c
+++ b/arch/sandbox/board/hostfile.c
@@ -102,17 +102,7 @@ device_initcall(hf_init);
int barebox_register_filedev(struct hf_platform_data *hf)
{
- struct device_d *dev;
-
- dev = xzalloc(sizeof(struct device_d));
-
- dev->platform_data = hf;
-
- strcpy(dev->name, "hostfile");
- dev->size = hf->size;
- dev->id = -1;
- dev->map_base = hf->map_base;
-
- return register_device(dev);
+ return !add_generic_device("hostfile", -1, NULL, hf->base, hf->size,
+ IORESOURCE_MEM, hf);
}
diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
new file mode 100644
index 0000000..e69de29
diff --git a/arch/sandbox/mach-sandbox/include/mach/hostfile.h b/arch/sandbox/mach-sandbox/include/mach/hostfile.h
index f7aca7c..7c4e67c 100644
--- a/arch/sandbox/mach-sandbox/include/mach/hostfile.h
+++ b/arch/sandbox/mach-sandbox/include/mach/hostfile.h
@@ -4,7 +4,7 @@
struct hf_platform_data {
int fd;
size_t size;
- unsigned long map_base;
+ unsigned long base;
char *filename;
char *name;
};
diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index dcaf0c8..5074a06 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -236,10 +236,10 @@ static int add_image(char *str, char *name)
hf->name = strdup(name);
if (map) {
- hf->map_base = (unsigned long)mmap(NULL, hf->size,
+ hf->base = (unsigned long)mmap(NULL, hf->size,
PROT_READ | (readonly ? 0 : PROT_WRITE),
MAP_SHARED, fd, 0);
- if ((void *)hf->map_base == MAP_FAILED)
+ if ((void *)hf->base == MAP_FAILED)
printf("warning: mmapping %s failed\n", file);
}
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 20/23] imx: switch remaing board to resource
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (25 preceding siblings ...)
2011-07-30 3:17 ` [PATCH 19/23] sandbox: " Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-30 3:17 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-30 3:17 ` [PATCH 21/23] mci-core: switch " Jean-Christophe PLAGNIOL-VILLARD
` (3 subsequent siblings)
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-30 3:17 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/chumby_falconwing/falconwing.c | 30 ++++------------
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 10 +----
arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c | 21 +----------
arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c | 10 +----
arch/arm/boards/freescale-mx23-evk/mx23-evk.c | 11 ++----
arch/arm/boards/karo-tx28/tx28-stk5.c | 39 +++++---------------
6 files changed, 28 insertions(+), 93 deletions(-)
diff --git a/arch/arm/boards/chumby_falconwing/falconwing.c b/arch/arm/boards/chumby_falconwing/falconwing.c
index 5875955..69c3a61 100644
--- a/arch/arm/boards/chumby_falconwing/falconwing.c
+++ b/arch/arm/boards/chumby_falconwing/falconwing.c
@@ -39,12 +39,6 @@ static struct mxs_mci_platform_data mci_pdata = {
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */
};
-static struct device_d mci_dev = {
- .name = "mxs_mci",
- .map_base = IMX_SSP1_BASE,
- .platform_data = &mci_pdata,
-};
-
#define GPIO_LCD_RESET 50
#define GPIO_LCD_BACKLIGHT 60
@@ -98,13 +92,6 @@ static struct imx_fb_platformdata fb_mode = {
.fixed_screen_size = MAX_FB_SIZE,
};
-static struct device_d ldcif_dev = {
- .name = "stmfb",
- .map_base = IMX_FB_BASE,
- .size = 4096,
- .platform_data = &fb_mode,
-};
-
static const uint32_t pad_setup[] = {
/* may be not required as already done by the bootlet code */
#if 0
@@ -357,8 +344,10 @@ static int falconwing_devices_init(void)
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);
- register_device(&mci_dev);
- register_device(&ldcif_dev);
+ add_generic_device("mxs_mci", 0, NULL, IMX_SSP1_BASE, 0,
+ IORESOURCE_MEM, &mci_pdata);
+ add_generic_device("stmfb", 0, NULL, IMX_FB_BASE, 4096,
+ IORESOURCE_MEM, &fb_mode);
falconwing_init_usb();
@@ -375,15 +364,12 @@ static int falconwing_devices_init(void)
device_initcall(falconwing_devices_init);
-static struct device_d falconwing_serial_device = {
- .name = "stm_serial",
- .map_base = IMX_DBGUART_BASE,
- .size = 8192,
-};
-
static int falconwing_console_init(void)
{
- return register_device(&falconwing_serial_device);
+ add_generic_device("stm_serial", 0, NULL, IMX_DBGUART_BASE, 8192,
+ IORESOURCE_MEM, NULL);
+
+ return 0;
}
console_initcall(falconwing_console_init);
diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
index ecb5a38..aeeed17 100644
--- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
+++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
@@ -156,13 +156,6 @@ static struct fsl_usb2_platform_data usb_pdata = {
.phy_mode = FSL_USB2_PHY_UTMI,
};
-static struct device_d usbotg_dev = {
- .name = "fsl-udc",
- .map_base = IMX_OTG_BASE,
- .size = 0x200,
- .platform_data = &usb_pdata,
-};
-
#ifdef CONFIG_MMU
static void eukrea_cpuimx25_mmu_init(void)
{
@@ -280,7 +273,8 @@ static int eukrea_cpuimx25_devices_init(void)
imx25_usb_init();
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
- register_device(&usbotg_dev);
+ add_generic_device("fsl-udc", -1, NULL, IMX_OTG_BASE, 0x200,
+ IORESOURCE_MEM, &usb_pdata);
armlinux_set_bootparams((void *)0x80000100);
armlinux_set_architecture(MACH_TYPE_EUKREA_CPUIMX25);
diff --git a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c
index 65cf6d8..e8b62b2 100644
--- a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c
+++ b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c
@@ -149,14 +149,6 @@ static struct imx_fb_platform_data eukrea_cpuimx27_fb_data = {
.lscr1 = 0x00120300,
.dmacr = 0x00020010,
};
-
-static struct device_d imxfb_dev = {
- .id = -1,
- .name = "imxfb",
- .map_base = 0x10021000,
- .size = 0x1000,
- .platform_data = &eukrea_cpuimx27_fb_data,
-};
#endif
static int eukrea_cpuimx27_devices_init(void)
@@ -252,7 +244,7 @@ static int eukrea_cpuimx27_devices_init(void)
printf("Using environment in %s Flash\n", envdev);
#ifdef CONFIG_DRIVER_VIDEO_IMX
- register_device(&imxfb_dev);
+ imx_add_fb((void *)0x10021000, &eukrea_cpuimx27_fb_data);
gpio_direction_output(GPIO_PORTE | 5, 0);
gpio_set_value(GPIO_PORTE | 5, 1);
gpio_direction_output(GPIO_PORTA | 25, 0);
@@ -267,19 +259,10 @@ static int eukrea_cpuimx27_devices_init(void)
device_initcall(eukrea_cpuimx27_devices_init);
-#ifdef CONFIG_DRIVER_SERIAL_IMX
-static struct device_d eukrea_cpuimx27_serial_device = {
- .id = -1,
- .name = "imx_serial",
- .map_base = IMX_UART1_BASE,
- .size = 4096,
-};
-#endif
-
static int eukrea_cpuimx27_console_init(void)
{
#ifdef CONFIG_DRIVER_SERIAL_IMX
- register_device(&eukrea_cpuimx27_serial_device);
+ imx_add_uart((void *)IMX_UART1_BASE, -1);
#endif
/* configure 8 bit UART on cs3 */
FMCR &= ~0x2;
diff --git a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
index c1fe144..53e5bad 100644
--- a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
+++ b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
@@ -124,13 +124,6 @@ static struct fsl_usb2_platform_data usb_pdata = {
.operating_mode = FSL_USB2_DR_DEVICE,
.phy_mode = FSL_USB2_PHY_UTMI,
};
-
-static struct device_d usbotg_dev = {
- .name = "fsl-udc",
- .map_base = IMX_OTG_BASE,
- .size = 0x200,
- .platform_data = &usb_pdata,
-};
#endif
#ifdef CONFIG_MMU
@@ -182,7 +175,8 @@ static int eukrea_cpuimx35_devices_init(void)
/* Workaround ENGcm09152 */
tmp = readl(IMX_OTG_BASE + 0x608);
writel(tmp | (1 << 23), IMX_OTG_BASE + 0x608);
- register_device(&usbotg_dev);
+ add_generic_device("fsl-udc", -1, NULL, IMX_OTG_BASE, 0x200,
+ IORESOURCE_MEM, &usb_pdata);
#endif
armlinux_set_bootparams((void *)0x80000100);
armlinux_set_architecture(MACH_TYPE_EUKREA_CPUIMX35);
diff --git a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c
index d6c2996..f9f85fa 100644
--- a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c
+++ b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c
@@ -40,15 +40,12 @@ static int mx23_evk_devices_init(void)
device_initcall(mx23_evk_devices_init);
-static struct device_d mx23_evk_serial_device = {
- .name = "stm_serial",
- .map_base = IMX_DBGUART_BASE,
- .size = 8192,
-};
-
static int mx23_evk_console_init(void)
{
- return register_device(&mx23_evk_serial_device);
+ add_generic_device("stm_serial", 0, NULL, IMX_DBGUART_BASE, 8192,
+ IORESOURCE_MEM, NULL);
+
+ return 0;
}
console_initcall(mx23_evk_console_init);
diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c b/arch/arm/boards/karo-tx28/tx28-stk5.c
index 81cb80c..8427dc2 100644
--- a/arch/arm/boards/karo-tx28/tx28-stk5.c
+++ b/arch/arm/boards/karo-tx28/tx28-stk5.c
@@ -35,24 +35,12 @@ static struct mxs_mci_platform_data mci_pdata = {
.f_max = 25000000,
};
-static struct device_d mci_socket = {
- .name = "mxs_mci",
- .map_base = IMX_SSP0_BASE,
- .platform_data = &mci_pdata,
-};
-
/* PhyAD[0..2]=0, RMIISEL=1 */
static struct fec_platform_data fec_info = {
.xcv_type = RMII,
.phy_addr = 0,
};
-static struct device_d fec_dev = {
- .name = "fec_imx",
- .map_base = IMX_FEC0_BASE,
- .platform_data = &fec_info,
-};
-
/*
* The TX28 EVK comes with a VGA connector. We can support many video modes
*
@@ -215,13 +203,6 @@ static struct imx_fb_platformdata tx28_fb_pdata = {
.enable = tx28_fb_enable,
};
-static struct device_d ldcif_dev = {
- .name = "stmfb",
- .map_base = IMX_FB_BASE,
- .size = 4096,
- .platform_data = &tx28_fb_pdata,
-};
-
static const uint32_t tx28_starterkit_pad_setup[] = {
/*
* Part II of phy's initialization
@@ -378,17 +359,20 @@ void base_board_init(void)
/* run the SSP unit clock at 100 MHz */
imx_set_sspclk(0, 100000000, 1);
- register_device(&mci_socket);
+ add_generic_device("mxs_mci", 0, NULL, IMX_SSP0_BASE, 0,
+ IORESOURCE_MEM, &mci_pdata);
if (tx28_fb_pdata.fixed_screen < (void *)&_end) {
printf("Warning: fixed_screen overlaps barebox\n");
tx28_fb_pdata.fixed_screen = NULL;
}
- register_device(&ldcif_dev);
+ add_generic_device("stmfb", 0, NULL, IMX_FB_BASE, 4096,
+ IORESOURCE_MEM, &tx28_fb_pdata);
imx_enable_enetclk();
- register_device(&fec_dev);
+ add_generic_device("fec_imx", 0, NULL, IMX_FEC0_BASE, 0,
+ IORESOURCE_MEM, &fec_info);
ret = register_persistent_environment();
if (ret != 0)
@@ -396,15 +380,12 @@ void base_board_init(void)
"storage (%d)\n", ret);
}
-static struct device_d tx28kit_serial_device = {
- .name = "stm_serial",
- .map_base = IMX_DBGUART_BASE,
- .size = 8192,
-};
-
static int tx28kit_console_init(void)
{
- return register_device(&tx28kit_serial_device);
+ add_generic_device("stm_serial", 0, NULL, IMX_DBGUART_BASE, 8192,
+ IORESOURCE_MEM, NULL);
+
+ return 0;
}
console_initcall(tx28kit_console_init);
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 21/23] mci-core: switch to resource
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (26 preceding siblings ...)
2011-07-30 3:17 ` [PATCH 20/23] imx: switch remaing board " Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-30 3:17 ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-01 7:32 ` Sascha Hauer
2011-07-30 3:17 ` [PATCH 22/23] nios2: remove dead code in generic board Jean-Christophe PLAGNIOL-VILLARD
` (2 subsequent siblings)
30 siblings, 1 reply; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-30 3:17 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/mci/mci-core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 3cf364c..c03885b 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1231,7 +1231,7 @@ static int mci_card_probe(struct device_d *mci_dev)
p->priv = mci_dev;
strcpy(disk_dev->name, "disk");
- disk_dev->size = mci->capacity;
+ disk_dev->resource[0].size = mci->capacity;
disk_dev->platform_data = p;
register_device(disk_dev);
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 21/23] mci-core: switch to resource
2011-07-30 3:17 ` [PATCH 21/23] mci-core: switch " Jean-Christophe PLAGNIOL-VILLARD
@ 2011-08-01 7:32 ` Sascha Hauer
2011-08-01 7:47 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 39+ messages in thread
From: Sascha Hauer @ 2011-08-01 7:32 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Sat, Jul 30, 2011 at 05:17:09AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> drivers/mci/mci-core.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 3cf364c..c03885b 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -1231,7 +1231,7 @@ static int mci_card_probe(struct device_d *mci_dev)
> p->priv = mci_dev;
>
> strcpy(disk_dev->name, "disk");
> - disk_dev->size = mci->capacity;
> + disk_dev->resource[0].size = mci->capacity;
> disk_dev->platform_data = p;
Resources for a device must be allocated. I already fixed this once with
the following. Please do not reintroduce this bug again.
(and honestly, this registering of the "disk" device is just a crude way
of passing around data in a void pointer. The real solution for this is
to just add a register_ata_interface() function instead of registering a
device.)
Sascha
commit 8f24f965e117444c1b253c14621d80fcaf31554c
Author: Sascha Hauer <s.hauer@pengutronix.de>
Date: Wed Jul 27 14:56:57 2011 +0200
mci: do not use unitialized resource
disk_dev->resource is unitialized. Do not use it. This
got broken in:
commit 4c542622cb07354c410680e0a6782508179f9e5f
Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Date: Mon Jul 18 20:17:04 2011 +0800
mci: switch to "struct resource"
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 0611ce6..3cf364c 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1231,8 +1231,7 @@ static int mci_card_probe(struct device_d
*mci_dev)
p->priv = mci_dev;
strcpy(disk_dev->name, "disk");
- disk_dev->resource[0].size = mci->capacity;
- disk_dev->resource[0].start = 0;
+ disk_dev->size = mci->capacity;
disk_dev->platform_data = p;
register_device(disk_dev);
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 21/23] mci-core: switch to resource
2011-08-01 7:32 ` Sascha Hauer
@ 2011-08-01 7:47 ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-01 8:09 ` Sascha Hauer
0 siblings, 1 reply; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-08-01 7:47 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 09:32 Mon 01 Aug , Sascha Hauer wrote:
> On Sat, Jul 30, 2011 at 05:17:09AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> > drivers/mci/mci-core.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> > index 3cf364c..c03885b 100644
> > --- a/drivers/mci/mci-core.c
> > +++ b/drivers/mci/mci-core.c
> > @@ -1231,7 +1231,7 @@ static int mci_card_probe(struct device_d *mci_dev)
> > p->priv = mci_dev;
> >
> > strcpy(disk_dev->name, "disk");
> > - disk_dev->size = mci->capacity;
> > + disk_dev->resource[0].size = mci->capacity;
> > disk_dev->platform_data = p;
>
> Resources for a device must be allocated. I already fixed this once with
> the following. Please do not reintroduce this bug again.
>
> (and honestly, this registering of the "disk" device is just a crude way
> of passing around data in a void pointer. The real solution for this is
> to just add a register_ata_interface() function instead of registering a
> device.)
agreed I plan to get rid of this but first need to fininsh the map_base frop
but as we drop map_base and size so we need to do like this
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 21/23] mci-core: switch to resource
2011-08-01 7:47 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-08-01 8:09 ` Sascha Hauer
2011-08-01 8:03 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 39+ messages in thread
From: Sascha Hauer @ 2011-08-01 8:09 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Mon, Aug 01, 2011 at 09:47:21AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:32 Mon 01 Aug , Sascha Hauer wrote:
> > On Sat, Jul 30, 2011 at 05:17:09AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > ---
> > > drivers/mci/mci-core.c | 2 +-
> > > 1 files changed, 1 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> > > index 3cf364c..c03885b 100644
> > > --- a/drivers/mci/mci-core.c
> > > +++ b/drivers/mci/mci-core.c
> > > @@ -1231,7 +1231,7 @@ static int mci_card_probe(struct device_d *mci_dev)
> > > p->priv = mci_dev;
> > >
> > > strcpy(disk_dev->name, "disk");
> > > - disk_dev->size = mci->capacity;
> > > + disk_dev->resource[0].size = mci->capacity;
> > > disk_dev->platform_data = p;
> >
> > Resources for a device must be allocated. I already fixed this once with
> > the following. Please do not reintroduce this bug again.
> >
> > (and honestly, this registering of the "disk" device is just a crude way
> > of passing around data in a void pointer. The real solution for this is
> > to just add a register_ata_interface() function instead of registering a
> > device.)
> agreed I plan to get rid of this but first need to fininsh the map_base frop
>
> but as we drop map_base and size so we need to do like this
Ok, but please allocate the space for the resource then.
I thought about using mapping the vector page to the top of the memory
space. Then we could get proper NULL pointer deref aborts to catch
things like this.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 21/23] mci-core: switch to resource
2011-08-01 8:09 ` Sascha Hauer
@ 2011-08-01 8:03 ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-01 8:21 ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-01 8:53 ` Sascha Hauer
0 siblings, 2 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-08-01 8:03 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 10:09 Mon 01 Aug , Sascha Hauer wrote:
> On Mon, Aug 01, 2011 at 09:47:21AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 09:32 Mon 01 Aug , Sascha Hauer wrote:
> > > On Sat, Jul 30, 2011 at 05:17:09AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > > ---
> > > > drivers/mci/mci-core.c | 2 +-
> > > > 1 files changed, 1 insertions(+), 1 deletions(-)
> > > >
> > > > diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> > > > index 3cf364c..c03885b 100644
> > > > --- a/drivers/mci/mci-core.c
> > > > +++ b/drivers/mci/mci-core.c
> > > > @@ -1231,7 +1231,7 @@ static int mci_card_probe(struct device_d *mci_dev)
> > > > p->priv = mci_dev;
> > > >
> > > > strcpy(disk_dev->name, "disk");
> > > > - disk_dev->size = mci->capacity;
> > > > + disk_dev->resource[0].size = mci->capacity;
> > > > disk_dev->platform_data = p;
> > >
> > > Resources for a device must be allocated. I already fixed this once with
> > > the following. Please do not reintroduce this bug again.
> > >
> > > (and honestly, this registering of the "disk" device is just a crude way
> > > of passing around data in a void pointer. The real solution for this is
> > > to just add a register_ata_interface() function instead of registering a
> > > device.)
> > agreed I plan to get rid of this but first need to fininsh the map_base frop
> >
> > but as we drop map_base and size so we need to do like this
>
> Ok, but please allocate the space for the resource then.
>
> I thought about using mapping the vector page to the top of the memory
> space. Then we could get proper NULL pointer deref aborts to catch
> things like this.
can we can we do it in a second patch?
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 21/23] mci-core: switch to resource
2011-08-01 8:03 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-08-01 8:21 ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-01 8:53 ` Sascha Hauer
1 sibling, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-08-01 8:21 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/mci/mci-core.c | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 3cf364c..fea2691 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1175,7 +1175,6 @@ static int mci_card_probe(struct device_d *mci_dev)
{
struct mci *mci = GET_MCI_DATA(mci_dev);
struct mci_host *host = GET_MCI_PDATA(mci_dev);
- struct device_d *disk_dev;
struct ata_interface *p;
int rc;
@@ -1221,8 +1220,7 @@ static int mci_card_probe(struct device_d *mci_dev)
* An MMC/SD card acts like an ordinary disk.
* So, re-use the disk driver to gain access to this media
*/
- disk_dev = xzalloc(sizeof(struct device_d) + sizeof(struct ata_interface));
- p = (struct ata_interface*)&disk_dev[1];
+ p = xzalloc(sizeof(struct ata_interface));
#ifdef CONFIG_MCI_WRITE
p->write = mci_sd_write;
@@ -1230,11 +1228,7 @@ static int mci_card_probe(struct device_d *mci_dev)
p->read = mci_sd_read;
p->priv = mci_dev;
- strcpy(disk_dev->name, "disk");
- disk_dev->size = mci->capacity;
- disk_dev->platform_data = p;
-
- register_device(disk_dev);
+ add_generic_device("disk", -1, NULL, 0, mci->capacity, IORESOURCE_MEM, p);
pr_debug("SD Card successfully added\n");
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 21/23] mci-core: switch to resource
2011-08-01 8:03 ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-01 8:21 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-08-01 8:53 ` Sascha Hauer
1 sibling, 0 replies; 39+ messages in thread
From: Sascha Hauer @ 2011-08-01 8:53 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Mon, Aug 01, 2011 at 10:03:01AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 10:09 Mon 01 Aug , Sascha Hauer wrote:
> > On Mon, Aug 01, 2011 at 09:47:21AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 09:32 Mon 01 Aug , Sascha Hauer wrote:
> > > > On Sat, Jul 30, 2011 at 05:17:09AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > > > ---
> > > > > drivers/mci/mci-core.c | 2 +-
> > > > > 1 files changed, 1 insertions(+), 1 deletions(-)
> > > > >
> > > > > diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> > > > > index 3cf364c..c03885b 100644
> > > > > --- a/drivers/mci/mci-core.c
> > > > > +++ b/drivers/mci/mci-core.c
> > > > > @@ -1231,7 +1231,7 @@ static int mci_card_probe(struct device_d *mci_dev)
> > > > > p->priv = mci_dev;
> > > > >
> > > > > strcpy(disk_dev->name, "disk");
> > > > > - disk_dev->size = mci->capacity;
> > > > > + disk_dev->resource[0].size = mci->capacity;
> > > > > disk_dev->platform_data = p;
> > > >
> > > > Resources for a device must be allocated. I already fixed this once with
> > > > the following. Please do not reintroduce this bug again.
> > > >
> > > > (and honestly, this registering of the "disk" device is just a crude way
> > > > of passing around data in a void pointer. The real solution for this is
> > > > to just add a register_ata_interface() function instead of registering a
> > > > device.)
> > > agreed I plan to get rid of this but first need to fininsh the map_base frop
> > >
> > > but as we drop map_base and size so we need to do like this
> >
> > Ok, but please allocate the space for the resource then.
> >
> > I thought about using mapping the vector page to the top of the memory
> > space. Then we could get proper NULL pointer deref aborts to catch
> > things like this.
> can we can we do it in a second patch?
This was just an idea not a call for action :)
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 22/23] nios2: remove dead code in generic board
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (27 preceding siblings ...)
2011-07-30 3:17 ` [PATCH 21/23] mci-core: switch " Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-30 3:17 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-30 3:17 ` [PATCH 23/23] driver: remove map_base Jean-Christophe PLAGNIOL-VILLARD
2011-08-01 10:45 ` [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-30 3:17 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/nios2/boards/generic/generic.c | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/arch/nios2/boards/generic/generic.c b/arch/nios2/boards/generic/generic.c
index 49c1d7c..0e3852b 100644
--- a/arch/nios2/boards/generic/generic.c
+++ b/arch/nios2/boards/generic/generic.c
@@ -32,14 +32,6 @@ static struct device_d mac_dev = {
.platform_data = &phy_address,
};
-/*
-static struct device_d epcs_flash_device = {
- .id = -1,
- .name = "epcs_flash",
- .map_base = NIOS_SOPC_EPCS_BASE,
-};
-*/
-
static int generic_devices_init(void)
{
add_cfi_flash_device(-1, NIOS_SOPC_FLASH_BASE, NIOS_SOPC_FLASH_SIZE, 0);
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 23/23] driver: remove map_base
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (28 preceding siblings ...)
2011-07-30 3:17 ` [PATCH 22/23] nios2: remove dead code in generic board Jean-Christophe PLAGNIOL-VILLARD
@ 2011-07-30 3:17 ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-01 10:45 ` [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
30 siblings, 0 replies; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-30 3:17 UTC (permalink / raw)
To: barebox
as now all the drivers and board have been switch to resource when can drop
map_base and size from device_d
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/base/driver.c | 20 --------------------
include/driver.h | 6 ------
2 files changed, 0 insertions(+), 26 deletions(-)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 4ceb346..84f9c81 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -103,26 +103,6 @@ int register_device(struct device_d *new_device)
{
struct driver_d *drv;
- /* if no map_base available use the first resource if available
- * so we do not need to duplicate it
- * Temporary fixup until we get rid of map_base and size
- */
- if (new_device->map_base) {
- if (new_device->resource) {
- dev_err(new_device, "map_base and resource specifed\n");
- return -EIO;
- }
- dev_warn(new_device, "uses map_base. Please convert to use resources\n");
- 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;
- new_device->size = new_device->resource[0].size;
- }
-
if (new_device->id < 0) {
new_device->id = get_free_deviceid(new_device->name);
} else {
diff --git a/include/driver.h b/include/driver.h
index baf8d88..b011f98 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -71,12 +71,6 @@ struct device_d {
* something like eth0 or nor0. */
int id;
- resource_size_t size;
-
- /*! For devices which are directly mapped into memory, i.e. NOR
- * Flash or SDRAM. */
- resource_size_t map_base;
-
struct resource *resource;
int num_resources;
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PULL] final switch to resoruce
2011-07-29 15:53 [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
` (29 preceding siblings ...)
2011-07-30 3:17 ` [PATCH 23/23] driver: remove map_base Jean-Christophe PLAGNIOL-VILLARD
@ 2011-08-01 10:45 ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-01 12:11 ` Sascha Hauer
30 siblings, 1 reply; 39+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-08-01 10:45 UTC (permalink / raw)
To: barebox
On 17:53 Fri 29 Jul , Jean-Christophe PLAGNIOL-VILLARD wrote:
> Hi,
>
> the follwing patch series finish to switch all boards and drivers to
> resource
>
> The following changes since commit 5ba0502901dacc9a1971378d6af8318a1d28051c:
>
> arm: add support for the i.MX53 loco board (2011-07-29 12:10:38 +0200)
>
> are available in the git repository at:
> git://uboot.jcrosoft.org/barebox.git resource
I update the git with the mcu-core v2
is it ok to pull it?
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PULL] final switch to resoruce
2011-08-01 10:45 ` [PULL] final switch to resoruce Jean-Christophe PLAGNIOL-VILLARD
@ 2011-08-01 12:11 ` Sascha Hauer
0 siblings, 0 replies; 39+ messages in thread
From: Sascha Hauer @ 2011-08-01 12:11 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Mon, Aug 01, 2011 at 12:45:19PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 17:53 Fri 29 Jul , Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Hi,
> >
> > the follwing patch series finish to switch all boards and drivers to
> > resource
> >
> > The following changes since commit 5ba0502901dacc9a1971378d6af8318a1d28051c:
> >
> > arm: add support for the i.MX53 loco board (2011-07-29 12:10:38 +0200)
> >
> > are available in the git repository at:
> > git://uboot.jcrosoft.org/barebox.git resource
> I update the git with the mcu-core v2
>
> is it ok to pull it?
Yes, done.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 39+ messages in thread