Re: [PATCH v3 2/2] mtd: rawnand: ingenic: Limit MTD_NAND_JZ4780 to architecture only

From: Paul Cercueil
Date: Sun Jul 26 2020 - 12:06:26 EST




Le sam. 25 juil. 2020 à 20:30, Arnd Bergmann <arnd@xxxxxxxx> a écrit :
On Sat, Jul 25, 2020 at 2:17 PM Paul Cercueil <paul@xxxxxxxxxxxxxxx> wrote:
Le ven. 24 juil. 2020 à 17:54, Krzysztof Kozlowski <krzk@xxxxxxxxxx> a
écrit :
> On Fri, Jul 24, 2020 at 05:50:06PM +0200, Paul Cercueil wrote:
>> Le ven. 24 juil. 2020 à 17:33, Krzysztof Kozlowski
>> <krzk@xxxxxxxxxx> a écrit:
>> > On Fri, 24 Jul 2020 at 17:19, Paul Cercueil <paul@xxxxxxxxxxxxxxx>
>> > wrote:
>>
>> On MIPS, the SoC selection is a Kconfig "choice", so you can only
>> support
>> one SoC family, unfortunately.
>
> Let's say someone selected then some other architecture
> (MIPS_ALCHEMY).
> They could select this MTD driver.
>
> Does it mean they would be able to run it on Ingenic hardware?

In *theory* yes, as long as the Kconfig options that MACH_INGENIC
selects are enabled, the kernel should boot and work on Ingenic SoCs.

Right now, this won't work yet, because there are platform specific
functions that are implemented by each of the platforms in arch/mips,
e.g. arch/mips/generic/init.c and arch/mips/jz4740/setup.c.

A lot of the newer platforms are part of arch/mips/generic
(CONFIG_MIPS_GENERIC), which roughly corresponds to
CONFIG_ARCH_MULTIPLATFORM on in arch/arm/.
Similarly, there are header files in arch/mips/include/asm/mach-*/
that conflict and you need to have the right one.

To have more than one platform enabled, each one needs to
have all of that platform code converted to fit into the
MIPS_GENERIC framework. This can be a lot of work, but
I suppose the ingenic platform would be a candidate for
which this makes sense, as long as new SoCs of that family
still come out.

It should be much less work now that the vast majority of arch/mips/jz4740 is gone. The code left is pretty much generic. I can have a look to convert it to the MIPS_GENERIC framework.

Although the code there is scary. Have a look at arch/mips/include/asm/{machine,mips_machine}.h, you'll see what I mean.

Anyway, I think we're way past the scope of this patch, so for this one:
Acked-by: Paul Cercueil <paul@xxxxxxxxxxxxxxx>

Cheers,
-Paul