diff mbox series

[1/2] mtd: physmap_of: Move custom initialization

Message ID 20181011185326.1371-1-linus.walleij@linaro.org
State New
Headers show
Series [1/2] mtd: physmap_of: Move custom initialization | expand

Commit Message

Linus Walleij Oct. 11, 2018, 6:53 p.m. UTC
In order to be able to assign custom complex mappings
to the physmap_of plugin for Gemini, move the initialization
so that the simple map is initialized before we enter the
platform-specific functions so the latter can override
them.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/mtd/maps/physmap_of_core.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

-- 
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

Comments

Boris Brezillon Oct. 12, 2018, 9:20 a.m. UTC | #1
Hi Linus,

On Thu, 11 Oct 2018 20:53:25 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> In order to be able to assign custom complex mappings

> to the physmap_of plugin for Gemini, move the initialization

> so that the simple map is initialized before we enter the

> platform-specific functions so the latter can override

> them.


I forgot to Cc you but I'm currently reworking the physmap driver to
merge the physmap_of logic in it [1]. I'll probably ask you to rebase
this patchset on top of mtd/next once [1] is applied.

Sorry for the inconvenience.

Boris

[1]https://patchwork.ozlabs.org/cover/980800/

> 

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

> ---

>  drivers/mtd/maps/physmap_of_core.c | 15 ++++++++-------

>  1 file changed, 8 insertions(+), 7 deletions(-)

> 

> diff --git a/drivers/mtd/maps/physmap_of_core.c b/drivers/mtd/maps/physmap_of_core.c

> index 4129535b8e46..74ad753265f3 100644

> --- a/drivers/mtd/maps/physmap_of_core.c

> +++ b/drivers/mtd/maps/physmap_of_core.c

> @@ -239,13 +239,6 @@ static int of_flash_probe(struct platform_device *dev)

>  		else if (of_property_read_bool(dp, "little-endian"))

>  			info->list[i].map.swap = CFI_LITTLE_ENDIAN;

>  

> -		err = of_flash_probe_gemini(dev, dp, &info->list[i].map);

> -		if (err)

> -			goto err_out;

> -		err = of_flash_probe_versatile(dev, dp, &info->list[i].map);

> -		if (err)

> -			goto err_out;

> -

>  		err = -ENOMEM;

>  		info->list[i].map.virt = ioremap(info->list[i].map.phys,

>  						 info->list[i].map.size);

> @@ -257,6 +250,14 @@ static int of_flash_probe(struct platform_device *dev)

>  

>  		simple_map_init(&info->list[i].map);

>  

> +		/* Variants can override map accessors */

> +		err = of_flash_probe_gemini(dev, dp, &info->list[i].map);

> +		if (err)

> +			goto err_out;

> +		err = of_flash_probe_versatile(dev, dp, &info->list[i].map);

> +		if (err)

> +			goto err_out;

> +

>  		/*

>  		 * On some platforms (e.g. MPC5200) a direct 1:1 mapping

>  		 * may cause problems with JFFS2 usage, as the local bus (LPB)



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Linus Walleij Oct. 13, 2018, 4:26 p.m. UTC | #2
On Fri, Oct 12, 2018 at 11:21 AM Boris Brezillon
<boris.brezillon@bootlin.com> wrote:
> Linus Walleij <linus.walleij@linaro.org> wrote:


> > In order to be able to assign custom complex mappings

> > to the physmap_of plugin for Gemini, move the initialization

> > so that the simple map is initialized before we enter the

> > platform-specific functions so the latter can override

> > them.

>

> I forgot to Cc you but I'm currently reworking the physmap driver to

> merge the physmap_of logic in it [1]. I'll probably ask you to rebase

> this patchset on top of mtd/next once [1] is applied.


No problem. Will you apply it after v4.20-rc1?

Yours,
Linus Walleij

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Boris Brezillon Oct. 14, 2018, 6:34 a.m. UTC | #3
On Sat, 13 Oct 2018 18:26:00 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Fri, Oct 12, 2018 at 11:21 AM Boris Brezillon

> <boris.brezillon@bootlin.com> wrote:

> > Linus Walleij <linus.walleij@linaro.org> wrote:  

> 

> > > In order to be able to assign custom complex mappings

> > > to the physmap_of plugin for Gemini, move the initialization

> > > so that the simple map is initialized before we enter the

> > > platform-specific functions so the latter can override

> > > them.  

> >

> > I forgot to Cc you but I'm currently reworking the physmap driver to

> > merge the physmap_of logic in it [1]. I'll probably ask you to rebase

> > this patchset on top of mtd/next once [1] is applied.  

> 

> No problem. Will you apply it after v4.20-rc1?


Yep, that's the plan.

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
diff mbox series

Patch

diff --git a/drivers/mtd/maps/physmap_of_core.c b/drivers/mtd/maps/physmap_of_core.c
index 4129535b8e46..74ad753265f3 100644
--- a/drivers/mtd/maps/physmap_of_core.c
+++ b/drivers/mtd/maps/physmap_of_core.c
@@ -239,13 +239,6 @@  static int of_flash_probe(struct platform_device *dev)
 		else if (of_property_read_bool(dp, "little-endian"))
 			info->list[i].map.swap = CFI_LITTLE_ENDIAN;
 
-		err = of_flash_probe_gemini(dev, dp, &info->list[i].map);
-		if (err)
-			goto err_out;
-		err = of_flash_probe_versatile(dev, dp, &info->list[i].map);
-		if (err)
-			goto err_out;
-
 		err = -ENOMEM;
 		info->list[i].map.virt = ioremap(info->list[i].map.phys,
 						 info->list[i].map.size);
@@ -257,6 +250,14 @@  static int of_flash_probe(struct platform_device *dev)
 
 		simple_map_init(&info->list[i].map);
 
+		/* Variants can override map accessors */
+		err = of_flash_probe_gemini(dev, dp, &info->list[i].map);
+		if (err)
+			goto err_out;
+		err = of_flash_probe_versatile(dev, dp, &info->list[i].map);
+		if (err)
+			goto err_out;
+
 		/*
 		 * On some platforms (e.g. MPC5200) a direct 1:1 mapping
 		 * may cause problems with JFFS2 usage, as the local bus (LPB)