* [PATCH 1/2 v3] mtd/uclinux: support ROM and allow passing the base address
@ 2013-01-10 16:31 Uwe Kleine-König
2013-01-10 16:31 ` [PATCH 2/2 v3] mtd/uclinux: add a comment about why uclinux_ram_map must not be static Uwe Kleine-König
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2013-01-10 16:31 UTC (permalink / raw)
To: linux-mtd; +Cc: Artem Bityutskiy, Mike Frysinger, kernel, Greg Ungerer
This allows to put the filesystem at a defined address in ROM allowing
to save more precious RAM.
I think it's safe to default to ROM because the intention of using the
uclinux map is to use a romfs and so mtd-ram doesn't give you anything
that mtd-rom doesn't.
Just in case I missed something a warning is added if the driver has to
fall back to the RAM mapping.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Changes since v2, id:1350027693-19528-1-git-send-email-u.kleine-koenig@pengutronix.de:
- drop a few "ram"s from printks instead of making them "ram/rom"
- fix a typo in the commit log and add rational for the introduced warning.
Who is responsible for taking (or not) these two patches? David? Artem?
Best regards
Uwe
---
drivers/mtd/maps/Kconfig | 2 +-
drivers/mtd/maps/uclinux.c | 26 +++++++++++++++++++++-----
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 2e47c2e..0dc86fc 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -443,7 +443,7 @@ config MTD_GPIO_ADDR
config MTD_UCLINUX
bool "Generic uClinux RAM/ROM filesystem support"
- depends on MTD_RAM=y && (!MMU || COLDFIRE)
+ depends on (MTD_RAM=y || MTD_ROM=y) && (!MMU || COLDFIRE)
help
Map driver to support image based filesystems for uClinux.
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
index 299bf88..b3a9c54 100644
--- a/drivers/mtd/maps/uclinux.c
+++ b/drivers/mtd/maps/uclinux.c
@@ -24,11 +24,12 @@
/****************************************************************************/
struct map_info uclinux_ram_map = {
- .name = "RAM",
- .phys = (unsigned long)__bss_stop,
.size = 0,
};
+static unsigned long physaddr = -1;
+module_param(physaddr, ulong, S_IRUGO);
+
static struct mtd_info *uclinux_ram_mtdinfo;
/****************************************************************************/
@@ -60,11 +61,17 @@ static int __init uclinux_mtd_init(void)
struct map_info *mapp;
mapp = &uclinux_ram_map;
+
+ if (physaddr == -1)
+ mapp->phys = (resource_size_t)__bss_stop;
+ else
+ mapp->phys = physaddr;
+
if (!mapp->size)
mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8))));
mapp->bankwidth = 4;
- printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
+ printk("uclinux[mtd]: probe address=0x%x size=0x%x\n",
(int) mapp->phys, (int) mapp->size);
/*
@@ -82,7 +89,16 @@ static int __init uclinux_mtd_init(void)
simple_map_init(mapp);
- mtd = do_map_probe("map_ram", mapp);
+ mapp->name = "ROM";
+ mtd = do_map_probe("map_rom", mapp);
+ if (!mtd) {
+ /* fall back to ram probing for compatibility reasons */
+ mapp->name = "RAM";
+ mtd = do_map_probe("map_ram", mapp);
+ if (mtd && IS_ENABLED(CONFIG_MTD_ROM))
+ pr_err("Failed to map rom, but ram succeeded. Please report this issue!\n");
+ }
+
if (!mtd) {
printk("uclinux[mtd]: failed to find a mapping?\n");
return(-ENXIO);
@@ -118,6 +134,6 @@ module_exit(uclinux_mtd_cleanup);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>");
-MODULE_DESCRIPTION("Generic RAM based MTD for uClinux");
+MODULE_DESCRIPTION("Generic MTD for uClinux");
/****************************************************************************/
--
1.7.10.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2 v3] mtd/uclinux: add a comment about why uclinux_ram_map must not be static
2013-01-10 16:31 [PATCH 1/2 v3] mtd/uclinux: support ROM and allow passing the base address Uwe Kleine-König
@ 2013-01-10 16:31 ` Uwe Kleine-König
2013-01-11 13:37 ` [PATCH 1/2 v3] mtd/uclinux: support ROM and allow passing the base address Greg Ungerer
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2013-01-10 16:31 UTC (permalink / raw)
To: linux-mtd; +Cc: Artem Bityutskiy, Mike Frysinger, kernel, Greg Ungerer
I was (at least) the second person trying to fix a warning by sparse, so
document in the code why this is a bad idea and add an extern declaration to
make sparse happy.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Greg Ungerer <gerg@uclinux.org>
---
Changes since v2, sent with
Message-Id: 1350027693-19528-2-git-send-email-u.kleine-koenig@pengutronix.de:
- note in the commit log that an extern declaration was added for sparse
drivers/mtd/maps/uclinux.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
index b3a9c54..fe1c83c 100644
--- a/drivers/mtd/maps/uclinux.c
+++ b/drivers/mtd/maps/uclinux.c
@@ -23,6 +23,12 @@
/****************************************************************************/
+/*
+ * Blackfin uses uclinux_ram_map during startup, so it must not be static.
+ * Provide a dummy declaration to make sparse happy.
+ */
+extern struct map_info uclinux_ram_map;
+
struct map_info uclinux_ram_map = {
.size = 0,
};
--
1.7.10.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2 v3] mtd/uclinux: support ROM and allow passing the base address
2013-01-10 16:31 [PATCH 1/2 v3] mtd/uclinux: support ROM and allow passing the base address Uwe Kleine-König
2013-01-10 16:31 ` [PATCH 2/2 v3] mtd/uclinux: add a comment about why uclinux_ram_map must not be static Uwe Kleine-König
@ 2013-01-11 13:37 ` Greg Ungerer
2013-01-11 14:02 ` Uwe Kleine-König
2013-01-16 14:36 ` [PATCH v4 1/2] " Uwe Kleine-König
2013-01-16 14:36 ` [PATCH v4 2/2] mtd/uclinux: add a comment about why uclinux_ram_map must not be static Uwe Kleine-König
3 siblings, 1 reply; 9+ messages in thread
From: Greg Ungerer @ 2013-01-11 13:37 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Artem Bityutskiy, linux-mtd, Mike Frysinger, kernel, Greg Ungerer
On 01/11/2013 02:31 AM, Uwe Kleine-König wrote:
> This allows to put the filesystem at a defined address in ROM allowing
> to save more precious RAM.
>
> I think it's safe to default to ROM because the intention of using the
> uclinux map is to use a romfs and so mtd-ram doesn't give you anything
> that mtd-rom doesn't.
>
> Just in case I missed something a warning is added if the driver has to
> fall back to the RAM mapping.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Changes since v2, id:1350027693-19528-1-git-send-email-u.kleine-koenig@pengutronix.de:
>
> - drop a few "ram"s from printks instead of making them "ram/rom"
> - fix a typo in the commit log and add rational for the introduced warning.
>
> Who is responsible for taking (or not) these two patches? David? Artem?
>
> Best regards
> Uwe
>
> ---
> drivers/mtd/maps/Kconfig | 2 +-
> drivers/mtd/maps/uclinux.c | 26 +++++++++++++++++++++-----
> 2 files changed, 22 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
> index 2e47c2e..0dc86fc 100644
> --- a/drivers/mtd/maps/Kconfig
> +++ b/drivers/mtd/maps/Kconfig
> @@ -443,7 +443,7 @@ config MTD_GPIO_ADDR
>
> config MTD_UCLINUX
> bool "Generic uClinux RAM/ROM filesystem support"
> - depends on MTD_RAM=y && (!MMU || COLDFIRE)
> + depends on (MTD_RAM=y || MTD_ROM=y) && (!MMU || COLDFIRE)
> help
> Map driver to support image based filesystems for uClinux.
>
> diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
> index 299bf88..b3a9c54 100644
> --- a/drivers/mtd/maps/uclinux.c
> +++ b/drivers/mtd/maps/uclinux.c
> @@ -24,11 +24,12 @@
> /****************************************************************************/
>
> struct map_info uclinux_ram_map = {
> - .name = "RAM",
> - .phys = (unsigned long)__bss_stop,
> .size = 0,
> };
>
> +static unsigned long physaddr = -1;
> +module_param(physaddr, ulong, S_IRUGO);
> +
> static struct mtd_info *uclinux_ram_mtdinfo;
>
> /****************************************************************************/
> @@ -60,11 +61,17 @@ static int __init uclinux_mtd_init(void)
> struct map_info *mapp;
>
> mapp = &uclinux_ram_map;
> +
> + if (physaddr == -1)
> + mapp->phys = (resource_size_t)__bss_stop;
> + else
> + mapp->phys = physaddr;
> +
> if (!mapp->size)
> mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8))));
> mapp->bankwidth = 4;
>
> - printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
> + printk("uclinux[mtd]: probe address=0x%x size=0x%x\n",
> (int) mapp->phys, (int) mapp->size);
>
> /*
> @@ -82,7 +89,16 @@ static int __init uclinux_mtd_init(void)
>
> simple_map_init(mapp);
>
> - mtd = do_map_probe("map_ram", mapp);
> + mapp->name = "ROM";
> + mtd = do_map_probe("map_rom", mapp);
> + if (!mtd) {
> + /* fall back to ram probing for compatibility reasons */
> + mapp->name = "RAM";
> + mtd = do_map_probe("map_ram", mapp);
> + if (mtd && IS_ENABLED(CONFIG_MTD_ROM))
> + pr_err("Failed to map rom, but ram succeeded. Please report this issue!\n");
I still don't like this, as per:
http://lists.infradead.org/pipermail/linux-mtd/2012-October/044612.html
Regards
Greg
> + }
> +
> if (!mtd) {
> printk("uclinux[mtd]: failed to find a mapping?\n");
> return(-ENXIO);
> @@ -118,6 +134,6 @@ module_exit(uclinux_mtd_cleanup);
>
> MODULE_LICENSE("GPL");
> MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>");
> -MODULE_DESCRIPTION("Generic RAM based MTD for uClinux");
> +MODULE_DESCRIPTION("Generic MTD for uClinux");
>
> /****************************************************************************/
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2 v3] mtd/uclinux: support ROM and allow passing the base address
2013-01-11 13:37 ` [PATCH 1/2 v3] mtd/uclinux: support ROM and allow passing the base address Greg Ungerer
@ 2013-01-11 14:02 ` Uwe Kleine-König
2013-01-12 11:42 ` Greg Ungerer
0 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2013-01-11 14:02 UTC (permalink / raw)
To: Greg Ungerer
Cc: Artem Bityutskiy, linux-mtd, Mike Frysinger, kernel, Greg Ungerer
Hello Greg,
On Fri, Jan 11, 2013 at 11:37:29PM +1000, Greg Ungerer wrote:
> On 01/11/2013 02:31 AM, Uwe Kleine-König wrote:
> >This allows to put the filesystem at a defined address in ROM allowing
> >to save more precious RAM.
> >
> >I think it's safe to default to ROM because the intention of using the
> >uclinux map is to use a romfs and so mtd-ram doesn't give you anything
> >that mtd-rom doesn't.
> >
> >Just in case I missed something a warning is added if the driver has to
> >fall back to the RAM mapping.
> >
> >Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> >---
> >Changes since v2, id:1350027693-19528-1-git-send-email-u.kleine-koenig@pengutronix.de:
> >
> > - drop a few "ram"s from printks instead of making them "ram/rom"
> > - fix a typo in the commit log and add rational for the introduced warning.
> >
> >Who is responsible for taking (or not) these two patches? David? Artem?
> >
> >Best regards
> >Uwe
> >
> >---
> > drivers/mtd/maps/Kconfig | 2 +-
> > drivers/mtd/maps/uclinux.c | 26 +++++++++++++++++++++-----
> > 2 files changed, 22 insertions(+), 6 deletions(-)
> >
> >diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
> >index 2e47c2e..0dc86fc 100644
> >--- a/drivers/mtd/maps/Kconfig
> >+++ b/drivers/mtd/maps/Kconfig
> >@@ -443,7 +443,7 @@ config MTD_GPIO_ADDR
> >
> > config MTD_UCLINUX
> > bool "Generic uClinux RAM/ROM filesystem support"
> >- depends on MTD_RAM=y && (!MMU || COLDFIRE)
> >+ depends on (MTD_RAM=y || MTD_ROM=y) && (!MMU || COLDFIRE)
> > help
> > Map driver to support image based filesystems for uClinux.
> >
> >diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
> >index 299bf88..b3a9c54 100644
> >--- a/drivers/mtd/maps/uclinux.c
> >+++ b/drivers/mtd/maps/uclinux.c
> >@@ -24,11 +24,12 @@
> > /****************************************************************************/
> >
> > struct map_info uclinux_ram_map = {
> >- .name = "RAM",
> >- .phys = (unsigned long)__bss_stop,
> > .size = 0,
> > };
> >
> >+static unsigned long physaddr = -1;
> >+module_param(physaddr, ulong, S_IRUGO);
> >+
> > static struct mtd_info *uclinux_ram_mtdinfo;
> >
> > /****************************************************************************/
> >@@ -60,11 +61,17 @@ static int __init uclinux_mtd_init(void)
> > struct map_info *mapp;
> >
> > mapp = &uclinux_ram_map;
> >+
> >+ if (physaddr == -1)
> >+ mapp->phys = (resource_size_t)__bss_stop;
> >+ else
> >+ mapp->phys = physaddr;
> >+
> > if (!mapp->size)
> > mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8))));
> > mapp->bankwidth = 4;
> >
> >- printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
> >+ printk("uclinux[mtd]: probe address=0x%x size=0x%x\n",
> > (int) mapp->phys, (int) mapp->size);
> >
> > /*
> >@@ -82,7 +89,16 @@ static int __init uclinux_mtd_init(void)
> >
> > simple_map_init(mapp);
> >
> >- mtd = do_map_probe("map_ram", mapp);
> >+ mapp->name = "ROM";
> >+ mtd = do_map_probe("map_rom", mapp);
> >+ if (!mtd) {
> >+ /* fall back to ram probing for compatibility reasons */
> >+ mapp->name = "RAM";
> >+ mtd = do_map_probe("map_ram", mapp);
> >+ if (mtd && IS_ENABLED(CONFIG_MTD_ROM))
> >+ pr_err("Failed to map rom, but ram succeeded. Please report this issue!\n");
>
> I still don't like this, as per:
>
> http://lists.infradead.org/pipermail/linux-mtd/2012-October/044612.html
I remember your concerns, but as you didn't write back on my last try to
explain why I consider the warning useful, I resent.
You wrote:
The message is only printed if both ROM and RAM mappings are enabled.
Many of the configs I use only have RAM mappings enabled.
Yeah, so the warning will not trigger for you. And this is correct,
because the only thing I want to catch is map_rom not being able to
provide everything needed when map_ram does.
I don't know what you would prefer. Just drop the warning? Force the
usage of map_rom by depending on (or selecting) MTD_ROM?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2 v3] mtd/uclinux: support ROM and allow passing the base address
2013-01-11 14:02 ` Uwe Kleine-König
@ 2013-01-12 11:42 ` Greg Ungerer
0 siblings, 0 replies; 9+ messages in thread
From: Greg Ungerer @ 2013-01-12 11:42 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Artem Bityutskiy, linux-mtd, Mike Frysinger, kernel, Greg Ungerer
On 01/12/2013 12:02 AM, Uwe Kleine-König wrote:
> Hello Greg,
>
> On Fri, Jan 11, 2013 at 11:37:29PM +1000, Greg Ungerer wrote:
>> On 01/11/2013 02:31 AM, Uwe Kleine-König wrote:
>>> This allows to put the filesystem at a defined address in ROM allowing
>>> to save more precious RAM.
>>>
>>> I think it's safe to default to ROM because the intention of using the
>>> uclinux map is to use a romfs and so mtd-ram doesn't give you anything
>>> that mtd-rom doesn't.
>>>
>>> Just in case I missed something a warning is added if the driver has to
>>> fall back to the RAM mapping.
>>>
>>> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>>> ---
>>> Changes since v2, id:1350027693-19528-1-git-send-email-u.kleine-koenig@pengutronix.de:
>>>
>>> - drop a few "ram"s from printks instead of making them "ram/rom"
>>> - fix a typo in the commit log and add rational for the introduced warning.
>>>
>>> Who is responsible for taking (or not) these two patches? David? Artem?
>>>
>>> Best regards
>>> Uwe
>>>
>>> ---
>>> drivers/mtd/maps/Kconfig | 2 +-
>>> drivers/mtd/maps/uclinux.c | 26 +++++++++++++++++++++-----
>>> 2 files changed, 22 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
>>> index 2e47c2e..0dc86fc 100644
>>> --- a/drivers/mtd/maps/Kconfig
>>> +++ b/drivers/mtd/maps/Kconfig
>>> @@ -443,7 +443,7 @@ config MTD_GPIO_ADDR
>>>
>>> config MTD_UCLINUX
>>> bool "Generic uClinux RAM/ROM filesystem support"
>>> - depends on MTD_RAM=y && (!MMU || COLDFIRE)
>>> + depends on (MTD_RAM=y || MTD_ROM=y) && (!MMU || COLDFIRE)
>>> help
>>> Map driver to support image based filesystems for uClinux.
>>>
>>> diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
>>> index 299bf88..b3a9c54 100644
>>> --- a/drivers/mtd/maps/uclinux.c
>>> +++ b/drivers/mtd/maps/uclinux.c
>>> @@ -24,11 +24,12 @@
>>> /****************************************************************************/
>>>
>>> struct map_info uclinux_ram_map = {
>>> - .name = "RAM",
>>> - .phys = (unsigned long)__bss_stop,
>>> .size = 0,
>>> };
>>>
>>> +static unsigned long physaddr = -1;
>>> +module_param(physaddr, ulong, S_IRUGO);
>>> +
>>> static struct mtd_info *uclinux_ram_mtdinfo;
>>>
>>> /****************************************************************************/
>>> @@ -60,11 +61,17 @@ static int __init uclinux_mtd_init(void)
>>> struct map_info *mapp;
>>>
>>> mapp = &uclinux_ram_map;
>>> +
>>> + if (physaddr == -1)
>>> + mapp->phys = (resource_size_t)__bss_stop;
>>> + else
>>> + mapp->phys = physaddr;
>>> +
>>> if (!mapp->size)
>>> mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8))));
>>> mapp->bankwidth = 4;
>>>
>>> - printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
>>> + printk("uclinux[mtd]: probe address=0x%x size=0x%x\n",
>>> (int) mapp->phys, (int) mapp->size);
>>>
>>> /*
>>> @@ -82,7 +89,16 @@ static int __init uclinux_mtd_init(void)
>>>
>>> simple_map_init(mapp);
>>>
>>> - mtd = do_map_probe("map_ram", mapp);
>>> + mapp->name = "ROM";
>>> + mtd = do_map_probe("map_rom", mapp);
>>> + if (!mtd) {
>>> + /* fall back to ram probing for compatibility reasons */
>>> + mapp->name = "RAM";
>>> + mtd = do_map_probe("map_ram", mapp);
>>> + if (mtd && IS_ENABLED(CONFIG_MTD_ROM))
>>> + pr_err("Failed to map rom, but ram succeeded. Please report this issue!\n");
>>
>> I still don't like this, as per:
>>
>> http://lists.infradead.org/pipermail/linux-mtd/2012-October/044612.html
> I remember your concerns, but as you didn't write back on my last try to
> explain why I consider the warning useful, I resent.
>
> You wrote:
>
> The message is only printed if both ROM and RAM mappings are enabled.
> Many of the configs I use only have RAM mappings enabled.
>
> Yeah, so the warning will not trigger for you. And this is correct,
> because the only thing I want to catch is map_rom not being able to
> provide everything needed when map_ram does.
But why?
I still don't see how this is a useful runtime message.
> I don't know what you would prefer. Just drop the warning? Force the
> usage of map_rom by depending on (or selecting) MTD_ROM?
I would suggest dropping the message. And yes making the use map_rom
depend on CONFIG_MAP_ROM being enabled would seem to make sense to me.
Regards
Greg
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 1/2] mtd/uclinux: support ROM and allow passing the base address
2013-01-10 16:31 [PATCH 1/2 v3] mtd/uclinux: support ROM and allow passing the base address Uwe Kleine-König
2013-01-10 16:31 ` [PATCH 2/2 v3] mtd/uclinux: add a comment about why uclinux_ram_map must not be static Uwe Kleine-König
2013-01-11 13:37 ` [PATCH 1/2 v3] mtd/uclinux: support ROM and allow passing the base address Greg Ungerer
@ 2013-01-16 14:36 ` Uwe Kleine-König
2013-01-17 3:12 ` Greg Ungerer
2013-01-17 13:37 ` Artem Bityutskiy
2013-01-16 14:36 ` [PATCH v4 2/2] mtd/uclinux: add a comment about why uclinux_ram_map must not be static Uwe Kleine-König
3 siblings, 2 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2013-01-16 14:36 UTC (permalink / raw)
To: linux-mtd; +Cc: Mike Frysinger, kernel, Greg Ungerer
This allows to put the filesystem at a defined address in ROM allowing
to save more precious RAM.
I think it's safe to default to ROM because the intention of using the
uclinux map is to use a romfs and so mtd-ram doesn't give you anything
that mtd-rom doesn't.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Changes since v3,
id:1357835498-23904-1-git-send-email-u.kleine-koenig@pengutronix.de:
- drop runtime warning
- only probe one of map_rom or map_ram as both should succeed in the
same cases
Changes since v2,
id:1350027693-19528-1-git-send-email-u.kleine-koenig@pengutronix.de:
- drop a few "ram"s from printks instead of making them "ram/rom".
- fix a typo in the commit log and add rational for the introduced
warning.
Changes since v1,
id:1349709952-4332-1-git-send-email-u.kleine-koenig@pengutronix.de:
- don't make uclinux_ram_map static as pointed out by Mike and Greg.
---
drivers/mtd/maps/Kconfig | 2 +-
drivers/mtd/maps/uclinux.c | 24 +++++++++++++++++++-----
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 62ba82c..3ed17c4 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -429,7 +429,7 @@ config MTD_GPIO_ADDR
config MTD_UCLINUX
bool "Generic uClinux RAM/ROM filesystem support"
- depends on MTD_RAM=y && (!MMU || COLDFIRE)
+ depends on (MTD_RAM=y || MTD_ROM=y) && (!MMU || COLDFIRE)
help
Map driver to support image based filesystems for uClinux.
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
index 299bf88..f56d0aa 100644
--- a/drivers/mtd/maps/uclinux.c
+++ b/drivers/mtd/maps/uclinux.c
@@ -23,12 +23,20 @@
/****************************************************************************/
+#ifdef CONFIG_MTD_ROM
+#define MAP_NAME "rom"
+#else
+#define MAP_NAME "ram"
+#endif
+
struct map_info uclinux_ram_map = {
- .name = "RAM",
- .phys = (unsigned long)__bss_stop,
+ .name = MAP_NAME,
.size = 0,
};
+static unsigned long physaddr = -1;
+module_param(physaddr, ulong, S_IRUGO);
+
static struct mtd_info *uclinux_ram_mtdinfo;
/****************************************************************************/
@@ -60,11 +68,17 @@ static int __init uclinux_mtd_init(void)
struct map_info *mapp;
mapp = &uclinux_ram_map;
+
+ if (physaddr == -1)
+ mapp->phys = (resource_size_t)__bss_stop;
+ else
+ mapp->phys = physaddr;
+
if (!mapp->size)
mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8))));
mapp->bankwidth = 4;
- printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
+ printk("uclinux[mtd]: probe address=0x%x size=0x%x\n",
(int) mapp->phys, (int) mapp->size);
/*
@@ -82,7 +96,7 @@ static int __init uclinux_mtd_init(void)
simple_map_init(mapp);
- mtd = do_map_probe("map_ram", mapp);
+ mtd = do_map_probe("map_" MAP_NAME, mapp);
if (!mtd) {
printk("uclinux[mtd]: failed to find a mapping?\n");
return(-ENXIO);
@@ -118,6 +132,6 @@ module_exit(uclinux_mtd_cleanup);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>");
-MODULE_DESCRIPTION("Generic RAM based MTD for uClinux");
+MODULE_DESCRIPTION("Generic MTD for uClinux");
/****************************************************************************/
--
1.7.10.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 2/2] mtd/uclinux: add a comment about why uclinux_ram_map must not be static
2013-01-10 16:31 [PATCH 1/2 v3] mtd/uclinux: support ROM and allow passing the base address Uwe Kleine-König
` (2 preceding siblings ...)
2013-01-16 14:36 ` [PATCH v4 1/2] " Uwe Kleine-König
@ 2013-01-16 14:36 ` Uwe Kleine-König
3 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2013-01-16 14:36 UTC (permalink / raw)
To: linux-mtd; +Cc: Mike Frysinger, kernel, Greg Ungerer
I was (at least) the second person trying to fix a warning by sparse, so
document in the code why this is a bad idea and add an extern declaration to
make sparse happy.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Greg Ungerer <gerg@uclinux.org>
---
No changes between v3 and v4.
Changes since v2,
id:1350027693-19528-2-git-send-email-u.kleine-koenig@pengutronix.de:
- note in the commit log that an extern declaration was added for sparse
Changes since v1:
- new patch
---
drivers/mtd/maps/uclinux.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
index f56d0aa..c1af83d 100644
--- a/drivers/mtd/maps/uclinux.c
+++ b/drivers/mtd/maps/uclinux.c
@@ -29,6 +29,12 @@
#define MAP_NAME "ram"
#endif
+/*
+ * Blackfin uses uclinux_ram_map during startup, so it must not be static.
+ * Provide a dummy declaration to make sparse happy.
+ */
+extern struct map_info uclinux_ram_map;
+
struct map_info uclinux_ram_map = {
.name = MAP_NAME,
.size = 0,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v4 1/2] mtd/uclinux: support ROM and allow passing the base address
2013-01-16 14:36 ` [PATCH v4 1/2] " Uwe Kleine-König
@ 2013-01-17 3:12 ` Greg Ungerer
2013-01-17 13:37 ` Artem Bityutskiy
1 sibling, 0 replies; 9+ messages in thread
From: Greg Ungerer @ 2013-01-17 3:12 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: Mike Frysinger, linux-mtd, kernel, Greg Ungerer
On 17/01/13 00:36, Uwe Kleine-König wrote:
> This allows to put the filesystem at a defined address in ROM allowing
> to save more precious RAM.
>
> I think it's safe to default to ROM because the intention of using the
> uclinux map is to use a romfs and so mtd-ram doesn't give you anything
> that mtd-rom doesn't.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Greg Ungerer <gerg@uclinux.org>
> ---
> Changes since v3,
> id:1357835498-23904-1-git-send-email-u.kleine-koenig@pengutronix.de:
>
> - drop runtime warning
> - only probe one of map_rom or map_ram as both should succeed in the
> same cases
>
> Changes since v2,
> id:1350027693-19528-1-git-send-email-u.kleine-koenig@pengutronix.de:
>
> - drop a few "ram"s from printks instead of making them "ram/rom".
> - fix a typo in the commit log and add rational for the introduced
> warning.
>
> Changes since v1,
> id:1349709952-4332-1-git-send-email-u.kleine-koenig@pengutronix.de:
>
> - don't make uclinux_ram_map static as pointed out by Mike and Greg.
> ---
> drivers/mtd/maps/Kconfig | 2 +-
> drivers/mtd/maps/uclinux.c | 24 +++++++++++++++++++-----
> 2 files changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
> index 62ba82c..3ed17c4 100644
> --- a/drivers/mtd/maps/Kconfig
> +++ b/drivers/mtd/maps/Kconfig
> @@ -429,7 +429,7 @@ config MTD_GPIO_ADDR
>
> config MTD_UCLINUX
> bool "Generic uClinux RAM/ROM filesystem support"
> - depends on MTD_RAM=y && (!MMU || COLDFIRE)
> + depends on (MTD_RAM=y || MTD_ROM=y) && (!MMU || COLDFIRE)
> help
> Map driver to support image based filesystems for uClinux.
>
> diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
> index 299bf88..f56d0aa 100644
> --- a/drivers/mtd/maps/uclinux.c
> +++ b/drivers/mtd/maps/uclinux.c
> @@ -23,12 +23,20 @@
>
> /****************************************************************************/
>
> +#ifdef CONFIG_MTD_ROM
> +#define MAP_NAME "rom"
> +#else
> +#define MAP_NAME "ram"
> +#endif
> +
> struct map_info uclinux_ram_map = {
> - .name = "RAM",
> - .phys = (unsigned long)__bss_stop,
> + .name = MAP_NAME,
> .size = 0,
> };
>
> +static unsigned long physaddr = -1;
> +module_param(physaddr, ulong, S_IRUGO);
> +
> static struct mtd_info *uclinux_ram_mtdinfo;
>
> /****************************************************************************/
> @@ -60,11 +68,17 @@ static int __init uclinux_mtd_init(void)
> struct map_info *mapp;
>
> mapp = &uclinux_ram_map;
> +
> + if (physaddr == -1)
> + mapp->phys = (resource_size_t)__bss_stop;
> + else
> + mapp->phys = physaddr;
> +
> if (!mapp->size)
> mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8))));
> mapp->bankwidth = 4;
>
> - printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
> + printk("uclinux[mtd]: probe address=0x%x size=0x%x\n",
> (int) mapp->phys, (int) mapp->size);
>
> /*
> @@ -82,7 +96,7 @@ static int __init uclinux_mtd_init(void)
>
> simple_map_init(mapp);
>
> - mtd = do_map_probe("map_ram", mapp);
> + mtd = do_map_probe("map_" MAP_NAME, mapp);
> if (!mtd) {
> printk("uclinux[mtd]: failed to find a mapping?\n");
> return(-ENXIO);
> @@ -118,6 +132,6 @@ module_exit(uclinux_mtd_cleanup);
>
> MODULE_LICENSE("GPL");
> MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>");
> -MODULE_DESCRIPTION("Generic RAM based MTD for uClinux");
> +MODULE_DESCRIPTION("Generic MTD for uClinux");
>
> /****************************************************************************/
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 1/2] mtd/uclinux: support ROM and allow passing the base address
2013-01-16 14:36 ` [PATCH v4 1/2] " Uwe Kleine-König
2013-01-17 3:12 ` Greg Ungerer
@ 2013-01-17 13:37 ` Artem Bityutskiy
1 sibling, 0 replies; 9+ messages in thread
From: Artem Bityutskiy @ 2013-01-17 13:37 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: Mike Frysinger, linux-mtd, kernel, Greg Ungerer
[-- Attachment #1: Type: text/plain, Size: 420 bytes --]
On Wed, 2013-01-16 at 15:36 +0100, Uwe Kleine-König wrote:
> This allows to put the filesystem at a defined address in ROM allowing
> to save more precious RAM.
>
> I think it's safe to default to ROM because the intention of using the
> uclinux map is to use a romfs and so mtd-ram doesn't give you anything
> that mtd-rom doesn't.
Pushed both to l2-mtd.git, thanks!
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-01-17 13:35 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-10 16:31 [PATCH 1/2 v3] mtd/uclinux: support ROM and allow passing the base address Uwe Kleine-König
2013-01-10 16:31 ` [PATCH 2/2 v3] mtd/uclinux: add a comment about why uclinux_ram_map must not be static Uwe Kleine-König
2013-01-11 13:37 ` [PATCH 1/2 v3] mtd/uclinux: support ROM and allow passing the base address Greg Ungerer
2013-01-11 14:02 ` Uwe Kleine-König
2013-01-12 11:42 ` Greg Ungerer
2013-01-16 14:36 ` [PATCH v4 1/2] " Uwe Kleine-König
2013-01-17 3:12 ` Greg Ungerer
2013-01-17 13:37 ` Artem Bityutskiy
2013-01-16 14:36 ` [PATCH v4 2/2] mtd/uclinux: add a comment about why uclinux_ram_map must not be static Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox