* [PATCH] ixp4xx: add support for static flash partitions
@ 2010-05-31 16:24 Richard Cochran
2010-06-13 9:16 ` Artem Bityutskiy
0 siblings, 1 reply; 5+ messages in thread
From: Richard Cochran @ 2010-05-31 16:24 UTC (permalink / raw)
To: linux-arm-kernel
This patch adds support for static flash partitioning from a platform
device. Also, we clean up some weirdness where statements were separated
by commas instead of semicolons. While we are at it, fix some minor bad
white space, too.
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/mtd/maps/ixp4xx.c | 37 ++++++++++++++++++++++++++++---------
1 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index 7b05152..5345d11 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -108,7 +108,7 @@ static void ixp4xx_copy_from(struct map_info *map, void *to,
if (from & 1) {
*dest++ = BYTE1(flash_read16(src));
- src++;
+ src++;
--len;
}
@@ -118,7 +118,7 @@ static void ixp4xx_copy_from(struct map_info *map, void *to,
*dest++ = BYTE1(data);
src += 2;
len -= 2;
- }
+ }
if (len > 0)
*dest++ = BYTE0(flash_read16(src));
@@ -185,6 +185,8 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
{
struct flash_platform_data *plat = dev->dev.platform_data;
struct ixp4xx_flash_info *info;
+ const char *part_type = NULL;
+ int nr_parts = 0;
int err = -1;
if (!plat)
@@ -219,9 +221,9 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
*/
info->map.bankwidth = 2;
info->map.name = dev_name(&dev->dev);
- info->map.read = ixp4xx_read16,
- info->map.write = ixp4xx_probe_write16,
- info->map.copy_from = ixp4xx_copy_from,
+ info->map.read = ixp4xx_read16;
+ info->map.write = ixp4xx_probe_write16;
+ info->map.copy_from = ixp4xx_copy_from;
info->res = request_mem_region(dev->resource->start,
resource_size(dev->resource),
@@ -249,11 +251,28 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
info->mtd->owner = THIS_MODULE;
/* Use the fast version */
- info->map.write = ixp4xx_write16,
+ info->map.write = ixp4xx_write16;
+
+#ifdef CONFIG_MTD_PARTITIONS
+ nr_parts = parse_mtd_partitions(info->mtd, probes, &info->partitions,
+ dev->resource->start);
+#endif
+ if (nr_parts > 0) {
+ part_type = "dynamic";
+ } else {
+ info->partitions = plat->parts;
+ nr_parts = plat->nr_parts;
+ part_type = "static";
+ }
+ if (nr_parts == 0) {
+ printk(KERN_NOTICE "IXP4xx flash: no partition info "
+ "available, registering whole flash\n");
+ err = add_mtd_device(info->mtd);
+ } else {
+ printk(KERN_NOTICE "IXP4xx flash: using %s partition "
+ "definition\n", part_type);
+ err = add_mtd_partitions(info->mtd, info->partitions, nr_parts);
- err = parse_mtd_partitions(info->mtd, probes, &info->partitions, dev->resource->start);
- if (err > 0) {
- err = add_mtd_partitions(info->mtd, info->partitions, err);
if(err)
printk(KERN_ERR "Could not parse partitions\n");
}
--
1.6.3.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] ixp4xx: add support for static flash partitions
2010-05-31 16:24 [PATCH] ixp4xx: add support for static flash partitions Richard Cochran
@ 2010-06-13 9:16 ` Artem Bityutskiy
2010-06-14 16:15 ` Richard Cochran
0 siblings, 1 reply; 5+ messages in thread
From: Artem Bityutskiy @ 2010-06-13 9:16 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 2010-05-31 at 18:24 +0200, Richard Cochran wrote:
> This patch adds support for static flash partitioning from a platform
> device. Also, we clean up some weirdness where statements were separated
> by commas instead of semicolons. While we are at it, fix some minor bad
> white space, too.
>
> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
> ---
> drivers/mtd/maps/ixp4xx.c | 37 ++++++++++++++++++++++++++++---------
> 1 files changed, 28 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
> index 7b05152..5345d11 100644
> --- a/drivers/mtd/maps/ixp4xx.c
> +++ b/drivers/mtd/maps/ixp4xx.c
> @@ -108,7 +108,7 @@ static void ixp4xx_copy_from(struct map_info *map, void *to,
>
> if (from & 1) {
> *dest++ = BYTE1(flash_read16(src));
> - src++;
> + src++;
> --len;
> }
Your patch mostly applies, except of this chunk, which was modified
before by
commit 53f2b1c86a1fa1414be93571062ac4c263fa9fbc
Author: Jon Ringle <jon@ringle.org>
Date: Wed Jan 13 09:36:10 2010 -0500
mtd: ixp4xx: fix reading from half-word boundary
Fix handling of reads that don't start on a half-word boundary.
Signed-off-by: Jon Ringle <jon@ringle.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
I could fix your patch up myself, but I do not know the code, so please,
re-send a patch against the latest mtd-2.6 tree.
--
Best Regards,
Artem Bityutskiy (????? ????????)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ixp4xx: add support for static flash partitions
2010-06-13 9:16 ` Artem Bityutskiy
@ 2010-06-14 16:15 ` Richard Cochran
2010-06-15 23:59 ` Marek Vasut
2010-06-29 6:47 ` Artem Bityutskiy
0 siblings, 2 replies; 5+ messages in thread
From: Richard Cochran @ 2010-06-14 16:15 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Jun 13, 2010 at 12:16:06PM +0300, Artem Bityutskiy wrote:
> I could fix your patch up myself, but I do not know the code, so please,
> re-send a patch against the latest mtd-2.6 tree.
Okay, here it is again, this time against today's master branch of
git://git.infradead.org/mtd-2.6.git
Thanks,
Richard
This patch adds support for static flash partitioning from a platform
device. Also, we clean up some weirdness where statements were separated
by commas instead of semicolons. While we are at it, fix some minor bad
white space, too.
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
drivers/mtd/maps/ixp4xx.c | 35 +++++++++++++++++++++++++++--------
1 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index e0a5e04..1f9fde0 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -118,7 +118,7 @@ static void ixp4xx_copy_from(struct map_info *map, void *to,
*dest++ = BYTE1(data);
src += 2;
len -= 2;
- }
+ }
if (len > 0)
*dest++ = BYTE0(flash_read16(src));
@@ -185,6 +185,8 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
{
struct flash_platform_data *plat = dev->dev.platform_data;
struct ixp4xx_flash_info *info;
+ const char *part_type = NULL;
+ int nr_parts = 0;
int err = -1;
if (!plat)
@@ -218,9 +220,9 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
*/
info->map.bankwidth = 2;
info->map.name = dev_name(&dev->dev);
- info->map.read = ixp4xx_read16,
- info->map.write = ixp4xx_probe_write16,
- info->map.copy_from = ixp4xx_copy_from,
+ info->map.read = ixp4xx_read16;
+ info->map.write = ixp4xx_probe_write16;
+ info->map.copy_from = ixp4xx_copy_from;
info->res = request_mem_region(dev->resource->start,
resource_size(dev->resource),
@@ -248,11 +250,28 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
info->mtd->owner = THIS_MODULE;
/* Use the fast version */
- info->map.write = ixp4xx_write16,
+ info->map.write = ixp4xx_write16;
+
+#ifdef CONFIG_MTD_PARTITIONS
+ nr_parts = parse_mtd_partitions(info->mtd, probes, &info->partitions,
+ dev->resource->start);
+#endif
+ if (nr_parts > 0) {
+ part_type = "dynamic";
+ } else {
+ info->partitions = plat->parts;
+ nr_parts = plat->nr_parts;
+ part_type = "static";
+ }
+ if (nr_parts == 0) {
+ printk(KERN_NOTICE "IXP4xx flash: no partition info "
+ "available, registering whole flash\n");
+ err = add_mtd_device(info->mtd);
+ } else {
+ printk(KERN_NOTICE "IXP4xx flash: using %s partition "
+ "definition\n", part_type);
+ err = add_mtd_partitions(info->mtd, info->partitions, nr_parts);
- err = parse_mtd_partitions(info->mtd, probes, &info->partitions, dev->resource->start);
- if (err > 0) {
- err = add_mtd_partitions(info->mtd, info->partitions, err);
if(err)
printk(KERN_ERR "Could not parse partitions\n");
}
--
1.6.3.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] ixp4xx: add support for static flash partitions
2010-06-14 16:15 ` Richard Cochran
@ 2010-06-15 23:59 ` Marek Vasut
2010-06-29 6:47 ` Artem Bityutskiy
1 sibling, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2010-06-15 23:59 UTC (permalink / raw)
To: linux-arm-kernel
Dne Po 14. ?ervna 2010 18:15:19 Richard Cochran napsal(a):
> On Sun, Jun 13, 2010 at 12:16:06PM +0300, Artem Bityutskiy wrote:
> > I could fix your patch up myself, but I do not know the code, so please,
> > re-send a patch against the latest mtd-2.6 tree.
>
> Okay, here it is again, this time against today's master branch of
> git://git.infradead.org/mtd-2.6.git
>
> Thanks,
> Richard
>
>
> This patch adds support for static flash partitioning from a platform
> device. Also, we clean up some weirdness where statements were separated
> by commas instead of semicolons. While we are at it, fix some minor bad
> white space, too.
>
> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
> ---
> drivers/mtd/maps/ixp4xx.c | 35 +++++++++++++++++++++++++++--------
> 1 files changed, 27 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
> index e0a5e04..1f9fde0 100644
> --- a/drivers/mtd/maps/ixp4xx.c
> +++ b/drivers/mtd/maps/ixp4xx.c
> @@ -118,7 +118,7 @@ static void ixp4xx_copy_from(struct map_info *map, void
> *to, *dest++ = BYTE1(data);
> src += 2;
> len -= 2;
> - }
> + }
>
> if (len > 0)
> *dest++ = BYTE0(flash_read16(src));
> @@ -185,6 +185,8 @@ static int ixp4xx_flash_probe(struct platform_device
> *dev) {
> struct flash_platform_data *plat = dev->dev.platform_data;
> struct ixp4xx_flash_info *info;
> + const char *part_type = NULL;
> + int nr_parts = 0;
> int err = -1;
>
> if (!plat)
> @@ -218,9 +220,9 @@ static int ixp4xx_flash_probe(struct platform_device
> *dev) */
> info->map.bankwidth = 2;
> info->map.name = dev_name(&dev->dev);
> - info->map.read = ixp4xx_read16,
> - info->map.write = ixp4xx_probe_write16,
> - info->map.copy_from = ixp4xx_copy_from,
> + info->map.read = ixp4xx_read16;
> + info->map.write = ixp4xx_probe_write16;
> + info->map.copy_from = ixp4xx_copy_from;
>
> info->res = request_mem_region(dev->resource->start,
> resource_size(dev->resource),
> @@ -248,11 +250,28 @@ static int ixp4xx_flash_probe(struct platform_device
> *dev) info->mtd->owner = THIS_MODULE;
>
> /* Use the fast version */
> - info->map.write = ixp4xx_write16,
> + info->map.write = ixp4xx_write16;
> +
> +#ifdef CONFIG_MTD_PARTITIONS
> + nr_parts = parse_mtd_partitions(info->mtd, probes, &info->partitions,
> + dev->resource->start);
> +#endif
> + if (nr_parts > 0) {
> + part_type = "dynamic";
> + } else {
> + info->partitions = plat->parts;
> + nr_parts = plat->nr_parts;
> + part_type = "static";
> + }
> + if (nr_parts == 0) {
> + printk(KERN_NOTICE "IXP4xx flash: no partition info "
> + "available, registering whole flash\n");
> + err = add_mtd_device(info->mtd);
> + } else {
> + printk(KERN_NOTICE "IXP4xx flash: using %s partition "
> + "definition\n", part_type);
> + err = add_mtd_partitions(info->mtd, info->partitions, nr_parts);
>
> - err = parse_mtd_partitions(info->mtd, probes, &info->partitions,
> dev->resource->start); - if (err > 0) {
> - err = add_mtd_partitions(info->mtd, info->partitions, err);
> if(err)
> printk(KERN_ERR "Could not parse partitions\n");
> }
Maybe send the formating fixes in a separate patch. Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ixp4xx: add support for static flash partitions
2010-06-14 16:15 ` Richard Cochran
2010-06-15 23:59 ` Marek Vasut
@ 2010-06-29 6:47 ` Artem Bityutskiy
1 sibling, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2010-06-29 6:47 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 2010-06-14 at 18:15 +0200, Richard Cochran wrote:
> On Sun, Jun 13, 2010 at 12:16:06PM +0300, Artem Bityutskiy wrote:
> > I could fix your patch up myself, but I do not know the code, so please,
> > re-send a patch against the latest mtd-2.6 tree.
>
> Okay, here it is again, this time against today's master branch of
> git://git.infradead.org/mtd-2.6.git
>
> Thanks,
> Richard
>
>
> This patch adds support for static flash partitioning from a platform
> device. Also, we clean up some weirdness where statements were separated
> by commas instead of semicolons. While we are at it, fix some minor bad
> white space, too.
>
> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
Pushed to l2-mtd-2.6.git / dunno.
--
Best Regards,
Artem Bityutskiy (????? ????????)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-06-29 6:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-31 16:24 [PATCH] ixp4xx: add support for static flash partitions Richard Cochran
2010-06-13 9:16 ` Artem Bityutskiy
2010-06-14 16:15 ` Richard Cochran
2010-06-15 23:59 ` Marek Vasut
2010-06-29 6:47 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).