* [PATCH 1/5] devfs-core: introduce devfs_append_partition
2014-02-18 10:36 [PATCH 0/5] Introduce devfs_append_partition and a few users Uwe Kleine-König
@ 2014-02-18 10:36 ` Uwe Kleine-König
2014-02-18 10:36 ` [PATCH 2/5] ARM: sama5d3xek: convert to devfs_append_partition Uwe Kleine-König
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2014-02-18 10:36 UTC (permalink / raw)
To: barebox
From: Jan Luebbe <jlu@pengutronix.de>
This simplifies board code for partition setup by keeping track of the
offset.
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
[ukl: change return type analogous to how devfs_add_partition was
changed in 121c3d6e9c2f (devfs: let devfs_add_partition return the new
partition).]
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
fs/devfs-core.c | 9 +++++++++
include/driver.h | 6 ++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 44f0169e6324..c10345b3bfed 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -303,6 +303,15 @@ struct cdev *devfs_add_partition(const char *devname, loff_t offset, loff_t size
return new;
}
+struct cdev *devfs_append_partition(const char *devname, loff_t *offset,
+ loff_t size, int flags, const char *name)
+{
+ struct cdev *ret;
+ ret = devfs_add_partition(devname, *offset, size, flags, name);
+ *offset += size;
+ return ret;
+}
+
int devfs_del_partition(const char *name)
{
struct cdev *cdev;
diff --git a/include/driver.h b/include/driver.h
index bbe789b51ead..9fa94ae78ab2 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -487,8 +487,10 @@ int cdev_erase(struct cdev *cdev, size_t count, loff_t offset);
#define DEVFS_IS_PARTITION (1 << 2)
#define DEVFS_IS_CHARACTER_DEV (1 << 3)
-struct cdev *devfs_add_partition(const char *devname, loff_t offset, loff_t size,
- int flags, const char *name);
+struct cdev *devfs_add_partition(const char *devname, loff_t offset,
+ loff_t size, int flags, const char *name);
+struct cdev *devfs_append_partition(const char *devname, loff_t *offset,
+ loff_t size, int flags, const char *name);
int devfs_del_partition(const char *name);
#define DRV_OF_COMPAT(compat) \
--
1.8.5.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/5] ARM: sama5d3xek: convert to devfs_append_partition
2014-02-18 10:36 [PATCH 0/5] Introduce devfs_append_partition and a few users Uwe Kleine-König
2014-02-18 10:36 ` [PATCH 1/5] devfs-core: introduce devfs_append_partition Uwe Kleine-König
@ 2014-02-18 10:36 ` Uwe Kleine-König
2014-02-18 10:43 ` Jean-Christophe PLAGNIOL-VILLARD
2014-02-18 10:36 ` [PATCH 3/5] ARM: a9m2410: " Uwe Kleine-König
` (2 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2014-02-18 10:36 UTC (permalink / raw)
To: barebox
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
arch/arm/boards/sama5d3xek/init.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/arch/arm/boards/sama5d3xek/init.c b/arch/arm/boards/sama5d3xek/init.c
index 4f866aa6f85d..ba5f90c7063c 100644
--- a/arch/arm/boards/sama5d3xek/init.c
+++ b/arch/arm/boards/sama5d3xek/init.c
@@ -402,6 +402,8 @@ static void ek_add_device_hdmi(void)
static int at91sama5d3xek_devices_init(void)
{
+ loff_t offset = 0x0;
+
ek_add_device_w1();
ek_add_device_hdmi();
ek_add_device_nand();
@@ -411,13 +413,21 @@ static int at91sama5d3xek_devices_init(void)
ek_add_device_mci();
ek_add_device_lcdc();
- devfs_add_partition("nand0", 0x00000, SZ_256K, DEVFS_PARTITION_FIXED, "at91bootstrap_raw");
+ devfs_append_partition("nand0", &offset, SZ_256K,
+ DEVFS_PARTITION_FIXED, "at91bootstrap_raw");
dev_add_bb_dev("at91bootstrap_raw", "at91bootstrap");
- devfs_add_partition("nand0", SZ_256K, SZ_256K + SZ_128K, DEVFS_PARTITION_FIXED, "self_raw");
+ devfs_append_partition("nand0", &offset, SZ_256K + SZ_128K,
+ DEVFS_PARTITION_FIXED, "self_raw");
dev_add_bb_dev("self_raw", "self0");
- devfs_add_partition("nand0", SZ_512K + SZ_256K, SZ_256K, DEVFS_PARTITION_FIXED, "env_raw");
+
+ /* there is a hole in the partition layout of 128K */
+ offset = SZ_512K + SZ_256K;
+
+ devfs_append_partition("nand0", &offset, SZ_256K,
+ DEVFS_PARTITION_FIXED, "env_raw");
dev_add_bb_dev("env_raw", "env0");
- devfs_add_partition("nand0", SZ_1M, SZ_256K, DEVFS_PARTITION_FIXED, "env_raw1");
+ devfs_append_partition("nand0", &offset, SZ_256K,
+ DEVFS_PARTITION_FIXED, "env_raw1");
dev_add_bb_dev("env_raw1", "env1");
return 0;
--
1.8.5.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/5] ARM: sama5d3xek: convert to devfs_append_partition
2014-02-18 10:36 ` [PATCH 2/5] ARM: sama5d3xek: convert to devfs_append_partition Uwe Kleine-König
@ 2014-02-18 10:43 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 7+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2014-02-18 10:43 UTC (permalink / raw)
To: Uwe Kleine-K??nig; +Cc: barebox
On 11:36 Tue 18 Feb , Uwe Kleine-K??nig wrote:
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
I like it and not
can we simply use an struct now
like in linux
> ---
> arch/arm/boards/sama5d3xek/init.c | 18 ++++++++++++++----
> 1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/boards/sama5d3xek/init.c b/arch/arm/boards/sama5d3xek/init.c
> index 4f866aa6f85d..ba5f90c7063c 100644
> --- a/arch/arm/boards/sama5d3xek/init.c
> +++ b/arch/arm/boards/sama5d3xek/init.c
> @@ -402,6 +402,8 @@ static void ek_add_device_hdmi(void)
>
> static int at91sama5d3xek_devices_init(void)
> {
> + loff_t offset = 0x0;
> +
> ek_add_device_w1();
> ek_add_device_hdmi();
> ek_add_device_nand();
> @@ -411,13 +413,21 @@ static int at91sama5d3xek_devices_init(void)
> ek_add_device_mci();
> ek_add_device_lcdc();
>
> - devfs_add_partition("nand0", 0x00000, SZ_256K, DEVFS_PARTITION_FIXED, "at91bootstrap_raw");
> + devfs_append_partition("nand0", &offset, SZ_256K,
> + DEVFS_PARTITION_FIXED, "at91bootstrap_raw");
> dev_add_bb_dev("at91bootstrap_raw", "at91bootstrap");
> - devfs_add_partition("nand0", SZ_256K, SZ_256K + SZ_128K, DEVFS_PARTITION_FIXED, "self_raw");
> + devfs_append_partition("nand0", &offset, SZ_256K + SZ_128K,
> + DEVFS_PARTITION_FIXED, "self_raw");
> dev_add_bb_dev("self_raw", "self0");
> - devfs_add_partition("nand0", SZ_512K + SZ_256K, SZ_256K, DEVFS_PARTITION_FIXED, "env_raw");
> +
> + /* there is a hole in the partition layout of 128K */
> + offset = SZ_512K + SZ_256K;
> +
> + devfs_append_partition("nand0", &offset, SZ_256K,
> + DEVFS_PARTITION_FIXED, "env_raw");
> dev_add_bb_dev("env_raw", "env0");
> - devfs_add_partition("nand0", SZ_1M, SZ_256K, DEVFS_PARTITION_FIXED, "env_raw1");
> + devfs_append_partition("nand0", &offset, SZ_256K,
> + DEVFS_PARTITION_FIXED, "env_raw1");
> dev_add_bb_dev("env_raw1", "env1");
>
> return 0;
> --
> 1.8.5.3
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/5] ARM: a9m2410: convert to devfs_append_partition
2014-02-18 10:36 [PATCH 0/5] Introduce devfs_append_partition and a few users Uwe Kleine-König
2014-02-18 10:36 ` [PATCH 1/5] devfs-core: introduce devfs_append_partition Uwe Kleine-König
2014-02-18 10:36 ` [PATCH 2/5] ARM: sama5d3xek: convert to devfs_append_partition Uwe Kleine-König
@ 2014-02-18 10:36 ` Uwe Kleine-König
2014-02-18 10:36 ` [PATCH 4/5] ARM: freescale-mx35-3-stack: " Uwe Kleine-König
2014-02-18 10:36 ` [PATCH 5/5] ARM: pca100: " Uwe Kleine-König
4 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2014-02-18 10:36 UTC (permalink / raw)
To: barebox
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
arch/arm/boards/a9m2410/a9m2410.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/arch/arm/boards/a9m2410/a9m2410.c b/arch/arm/boards/a9m2410/a9m2410.c
index b2b6c87117a3..868a27a5e5bf 100644
--- a/arch/arm/boards/a9m2410/a9m2410.c
+++ b/arch/arm/boards/a9m2410/a9m2410.c
@@ -82,6 +82,22 @@ static int a9m2410_mem_init(void)
}
mem_initcall(a9m2410_mem_init);
+static void a9m2410_nand_partitions(void)
+{
+#ifdef CONFIG_NAND
+ loff_t offset = 0;
+
+ /* ----------- add some vital partitions -------- */
+ devfs_append_partition("nand0", &offset, 0x40000,
+ DEVFS_PARTITION_FIXED, "self_raw");
+ dev_add_bb_dev("self_raw", "self0");
+
+ devfs_append_partition("nand0", &offset, 0x20000,
+ DEVFS_PARTITION_FIXED, "env_raw");
+ dev_add_bb_dev("env_raw", "env0");
+#endif
+}
+
static int a9m2410_devices_init(void)
{
uint32_t reg;
@@ -116,14 +132,8 @@ static int a9m2410_devices_init(void)
add_generic_device("smc91c111", DEVICE_ID_DYNAMIC, NULL, S3C_CS1_BASE + 0x300,
16, IORESOURCE_MEM, NULL);
-#ifdef CONFIG_NAND
- /* ----------- add some vital partitions -------- */
- devfs_add_partition("nand0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self_raw");
- dev_add_bb_dev("self_raw", "self0");
+ a9m2410_nand_partitions();
- devfs_add_partition("nand0", 0x40000, 0x20000, DEVFS_PARTITION_FIXED, "env_raw");
- dev_add_bb_dev("env_raw", "env0");
-#endif
armlinux_set_architecture(MACH_TYPE_A9M2410);
return 0;
--
1.8.5.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/5] ARM: freescale-mx35-3-stack: convert to devfs_append_partition
2014-02-18 10:36 [PATCH 0/5] Introduce devfs_append_partition and a few users Uwe Kleine-König
` (2 preceding siblings ...)
2014-02-18 10:36 ` [PATCH 3/5] ARM: a9m2410: " Uwe Kleine-König
@ 2014-02-18 10:36 ` Uwe Kleine-König
2014-02-18 10:36 ` [PATCH 5/5] ARM: pca100: " Uwe Kleine-König
4 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2014-02-18 10:36 UTC (permalink / raw)
To: barebox
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
arch/arm/boards/freescale-mx35-3-stack/3stack.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/arch/arm/boards/freescale-mx35-3-stack/3stack.c b/arch/arm/boards/freescale-mx35-3-stack/3stack.c
index dbd1c7adcb10..ec4a95a08e50 100644
--- a/arch/arm/boards/freescale-mx35-3-stack/3stack.c
+++ b/arch/arm/boards/freescale-mx35-3-stack/3stack.c
@@ -132,6 +132,7 @@ static void set_board_rev(int rev)
static int f3s_devices_init(void)
{
uint32_t reg;
+ loff_t offset = 0;
/* CS0: Nor Flash */
imx35_setup_weimcs(0, 0x0000cf03, 0x10000d03, 0x00720900);
@@ -151,15 +152,19 @@ static int f3s_devices_init(void)
switch ((reg >> 25) & 0x3) {
case 0x01: /* NAND is the source */
- devfs_add_partition("nand0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self_raw");
+ devfs_append_partition("nand0", &offset, 0x40000,
+ DEVFS_PARTITION_FIXED, "self_raw");
dev_add_bb_dev("self_raw", "self0");
- devfs_add_partition("nand0", 0x40000, 0x80000, DEVFS_PARTITION_FIXED, "env_raw");
+ devfs_append_partition("nand0", &offset, 0x80000,
+ DEVFS_PARTITION_FIXED, "env_raw");
dev_add_bb_dev("env_raw", "env0");
break;
case 0x00: /* NOR is the source */
- devfs_add_partition("nor0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self0");
- devfs_add_partition("nor0", 0x40000, 0x80000, DEVFS_PARTITION_FIXED, "env0");
+ devfs_append_partition("nor0", &offset, 0x40000,
+ DEVFS_PARTITION_FIXED, "self0");
+ devfs_append_partition("nor0", &offset, 0x80000,
+ DEVFS_PARTITION_FIXED, "env0");
protect_file("/dev/env0", 1);
break;
}
--
1.8.5.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 5/5] ARM: pca100: convert to devfs_append_partition
2014-02-18 10:36 [PATCH 0/5] Introduce devfs_append_partition and a few users Uwe Kleine-König
` (3 preceding siblings ...)
2014-02-18 10:36 ` [PATCH 4/5] ARM: freescale-mx35-3-stack: " Uwe Kleine-König
@ 2014-02-18 10:36 ` Uwe Kleine-König
4 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2014-02-18 10:36 UTC (permalink / raw)
To: barebox
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
arch/arm/boards/phycard-i.MX27/pca100.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boards/phycard-i.MX27/pca100.c b/arch/arm/boards/phycard-i.MX27/pca100.c
index 2ff1b793291c..b211ef563532 100644
--- a/arch/arm/boards/phycard-i.MX27/pca100.c
+++ b/arch/arm/boards/phycard-i.MX27/pca100.c
@@ -179,6 +179,7 @@ static int pca100_devices_init(void)
{
int i;
struct device_d *nand;
+ loff_t offset = 0;
unsigned int mode[] = {
PD0_AIN_FEC_TXD0,
@@ -287,10 +288,10 @@ static int pca100_devices_init(void)
#endif
nand = get_device_by_name("nand0");
- devfs_add_partition("nand0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self_raw");
+ devfs_append_partition("nand0", &offset, 0x40000, DEVFS_PARTITION_FIXED, "self_raw");
dev_add_bb_dev("self_raw", "self0");
- devfs_add_partition("nand0", 0x40000, 0x20000, DEVFS_PARTITION_FIXED, "env_raw");
+ devfs_append_partition("nand0", &offset, 0x20000, DEVFS_PARTITION_FIXED, "env_raw");
dev_add_bb_dev("env_raw", "env0");
armlinux_set_architecture(2149);
--
1.8.5.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread