diff mbox series

[v2,3/4] mtd: rawnand: denali_dt: use UCLASS_MTD instead of UCLASS_MISC

Message ID 20200129155557.32191-3-yamada.masahiro@socionext.com
State New
Headers show
Series [v2,1/4] mtd: rawnand: denali_dt: insert udelay() after reset deassert | expand

Commit Message

Masahiro Yamada Jan. 29, 2020, 3:55 p.m. UTC
UCLASS_MTD is a better fit for NAND drivers.

Make NAND_DENALI_DT depend on DM_MTD, which is needed to compile
drivers/mtd/mtd-uclass.c

Also, make ARCH_SOCFPGA and ARCH_UNIPHIER select DM_MTD because
they use this driver.

Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
---

Changes in v2:
 - new patch

 arch/arm/Kconfig                 | 2 ++
 drivers/mtd/nand/raw/Kconfig     | 2 +-
 drivers/mtd/nand/raw/denali_dt.c | 4 ++--
 3 files changed, 5 insertions(+), 3 deletions(-)

Comments

Miquel Raynal Jan. 29, 2020, 4:34 p.m. UTC | #1
Hi Masahiro,

Masahiro Yamada <yamada.masahiro at socionext.com> wrote on Thu, 30 Jan
2020 00:55:56 +0900:

> UCLASS_MTD is a better fit for NAND drivers.
> 
> Make NAND_DENALI_DT depend on DM_MTD, which is needed to compile
> drivers/mtd/mtd-uclass.c
> 
> Also, make ARCH_SOCFPGA and ARCH_UNIPHIER select DM_MTD because
> they use this driver.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
> ---

Reviewed-by: Miquel Raynal <miquel.raynal at bootlin.com>

Thanks,
Miquèl
Simon Goldschmidt Jan. 29, 2020, 5:08 p.m. UTC | #2
Am 29.01.2020 um 16:55 schrieb Masahiro Yamada:
> UCLASS_MTD is a better fit for NAND drivers.
> 
> Make NAND_DENALI_DT depend on DM_MTD, which is needed to compile
> drivers/mtd/mtd-uclass.c
> 
> Also, make ARCH_SOCFPGA and ARCH_UNIPHIER select DM_MTD because
> they use this driver.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
> ---
> 
> Changes in v2:
>   - new patch
> 
>   arch/arm/Kconfig                 | 2 ++
>   drivers/mtd/nand/raw/Kconfig     | 2 +-
>   drivers/mtd/nand/raw/denali_dt.c | 4 ++--
>   3 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 1236315168..d1c58667c7 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -935,6 +935,7 @@ config ARCH_SOCFPGA
>   	select ARM64 if TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
>   	select CPU_V7A if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
>   	select DM
> +	select DM_MTD

Does any socfpga actually enable the denali driver? Do we need to 
default to this instead of enabling it in a defconfig?

If we need it, could you please change that to 'imply'? Not all configs 
will need this.

Thanks,
Simon

>   	select DM_SERIAL
>   	select ENABLE_ARM_SOC_BOOT0_HOOK if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
>   	select OF_CONTROL
> @@ -1548,6 +1549,7 @@ config ARCH_UNIPHIER
>   	select DM_GPIO
>   	select DM_I2C
>   	select DM_MMC
> +	select DM_MTD
>   	select DM_RESET
>   	select DM_SERIAL
>   	select DM_USB
> diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
> index 7814d84ba0..23201ca720 100644
> --- a/drivers/mtd/nand/raw/Kconfig
> +++ b/drivers/mtd/nand/raw/Kconfig
> @@ -116,7 +116,7 @@ config NAND_DENALI
>   config NAND_DENALI_DT
>   	bool "Support Denali NAND controller as a DT device"
>   	select NAND_DENALI
> -	depends on OF_CONTROL && DM
> +	depends on OF_CONTROL && DM_MTD
>   	help
>   	  Enable the driver for NAND flash on platforms using a Denali NAND
>   	  controller as a DT device.
> diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
> index 587e480faa..759ad40e51 100644
> --- a/drivers/mtd/nand/raw/denali_dt.c
> +++ b/drivers/mtd/nand/raw/denali_dt.c
> @@ -160,7 +160,7 @@ static int denali_dt_probe(struct udevice *dev)
>   
>   U_BOOT_DRIVER(denali_nand_dt) = {
>   	.name = "denali-nand-dt",
> -	.id = UCLASS_MISC,
> +	.id = UCLASS_MTD,
>   	.of_match = denali_nand_dt_ids,
>   	.probe = denali_dt_probe,
>   	.priv_auto_alloc_size = sizeof(struct denali_nand_info),
> @@ -171,7 +171,7 @@ void board_nand_init(void)
>   	struct udevice *dev;
>   	int ret;
>   
> -	ret = uclass_get_device_by_driver(UCLASS_MISC,
> +	ret = uclass_get_device_by_driver(UCLASS_MTD,
>   					  DM_GET_DRIVER(denali_nand_dt),
>   					  &dev);
>   	if (ret && ret != -ENODEV)
>
Marek Vasut Jan. 29, 2020, 10:01 p.m. UTC | #3
On 1/29/20 6:08 PM, Simon Goldschmidt wrote:
> Am 29.01.2020 um 16:55 schrieb Masahiro Yamada:
>> UCLASS_MTD is a better fit for NAND drivers.
>>
>> Make NAND_DENALI_DT depend on DM_MTD, which is needed to compile
>> drivers/mtd/mtd-uclass.c
>>
>> Also, make ARCH_SOCFPGA and ARCH_UNIPHIER select DM_MTD because
>> they use this driver.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
>> ---
>>
>> Changes in v2:
>>   - new patch
>>
>>   arch/arm/Kconfig                 | 2 ++
>>   drivers/mtd/nand/raw/Kconfig     | 2 +-
>>   drivers/mtd/nand/raw/denali_dt.c | 4 ++--
>>   3 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index 1236315168..d1c58667c7 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -935,6 +935,7 @@ config ARCH_SOCFPGA
>>       select ARM64 if TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
>>       select CPU_V7A if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
>>       select DM
>> +    select DM_MTD
> 
> Does any socfpga actually enable the denali driver? Do we need to
> default to this instead of enabling it in a defconfig?
> 
> If we need it, could you please change that to 'imply'? Not all configs
> will need this.

No SoCFPGA enables the Denali NAND, because support for that was
completely broken and I was waiting until the Denali NAND patches make
it in before sending that platform which will use it.

Indeed, DM_MTD should be enabled in platform config, not in general.
Masahiro Yamada Jan. 30, 2020, 5:34 a.m. UTC | #4
Hi Marek,


On Thu, Jan 30, 2020 at 7:03 AM Marek Vasut <marex at denx.de> wrote:
>
> On 1/29/20 6:08 PM, Simon Goldschmidt wrote:
> > Am 29.01.2020 um 16:55 schrieb Masahiro Yamada:
> >> UCLASS_MTD is a better fit for NAND drivers.
> >>
> >> Make NAND_DENALI_DT depend on DM_MTD, which is needed to compile
> >> drivers/mtd/mtd-uclass.c
> >>
> >> Also, make ARCH_SOCFPGA and ARCH_UNIPHIER select DM_MTD because
> >> they use this driver.
> >>
> >> Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
> >> ---
> >>
> >> Changes in v2:
> >>   - new patch
> >>
> >>   arch/arm/Kconfig                 | 2 ++
> >>   drivers/mtd/nand/raw/Kconfig     | 2 +-
> >>   drivers/mtd/nand/raw/denali_dt.c | 4 ++--
> >>   3 files changed, 5 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> >> index 1236315168..d1c58667c7 100644
> >> --- a/arch/arm/Kconfig
> >> +++ b/arch/arm/Kconfig
> >> @@ -935,6 +935,7 @@ config ARCH_SOCFPGA
> >>       select ARM64 if TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
> >>       select CPU_V7A if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
> >>       select DM
> >> +    select DM_MTD
> >
> > Does any socfpga actually enable the denali driver? Do we need to
> > default to this instead of enabling it in a defconfig?
> >
> > If we need it, could you please change that to 'imply'? Not all configs
> > will need this.
>
> No SoCFPGA enables the Denali NAND, because support for that was
> completely broken and I was waiting until the Denali NAND patches make
> it in before sending that platform which will use it.
>
> Indeed, DM_MTD should be enabled in platform config, not in general.


Right. None of ARCH_SOCFPGA boards enables the Denali,
It is up to you whichever defconfig you add the CONFIG option to.

I still prefer "select DM_MTD" for ARCH_UNIPHIER
because all uniphier_*_defconfig enables the Denali driver.



I will drop "select DM_MTD" from ARCH_SOCFPGA.

Is this OK for you ?
Marek Vasut Jan. 30, 2020, 1:06 p.m. UTC | #5
On 1/30/20 6:34 AM, Masahiro Yamada wrote:
> Hi Marek,
Hi,

> On Thu, Jan 30, 2020 at 7:03 AM Marek Vasut <marex at denx.de> wrote:
>>
>> On 1/29/20 6:08 PM, Simon Goldschmidt wrote:
>>> Am 29.01.2020 um 16:55 schrieb Masahiro Yamada:
>>>> UCLASS_MTD is a better fit for NAND drivers.
>>>>
>>>> Make NAND_DENALI_DT depend on DM_MTD, which is needed to compile
>>>> drivers/mtd/mtd-uclass.c
>>>>
>>>> Also, make ARCH_SOCFPGA and ARCH_UNIPHIER select DM_MTD because
>>>> they use this driver.
>>>>
>>>> Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
>>>> ---
>>>>
>>>> Changes in v2:
>>>>   - new patch
>>>>
>>>>   arch/arm/Kconfig                 | 2 ++
>>>>   drivers/mtd/nand/raw/Kconfig     | 2 +-
>>>>   drivers/mtd/nand/raw/denali_dt.c | 4 ++--
>>>>   3 files changed, 5 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>>>> index 1236315168..d1c58667c7 100644
>>>> --- a/arch/arm/Kconfig
>>>> +++ b/arch/arm/Kconfig
>>>> @@ -935,6 +935,7 @@ config ARCH_SOCFPGA
>>>>       select ARM64 if TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
>>>>       select CPU_V7A if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
>>>>       select DM
>>>> +    select DM_MTD
>>>
>>> Does any socfpga actually enable the denali driver? Do we need to
>>> default to this instead of enabling it in a defconfig?
>>>
>>> If we need it, could you please change that to 'imply'? Not all configs
>>> will need this.
>>
>> No SoCFPGA enables the Denali NAND, because support for that was
>> completely broken and I was waiting until the Denali NAND patches make
>> it in before sending that platform which will use it.
>>
>> Indeed, DM_MTD should be enabled in platform config, not in general.
> 
> 
> Right. None of ARCH_SOCFPGA boards enables the Denali,
> It is up to you whichever defconfig you add the CONFIG option to.
> 
> I still prefer "select DM_MTD" for ARCH_UNIPHIER
> because all uniphier_*_defconfig enables the Denali driver.
> 
> 
> 
> I will drop "select DM_MTD" from ARCH_SOCFPGA.
> 
> Is this OK for you ?

Yes, thanks.
diff mbox series

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1236315168..d1c58667c7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -935,6 +935,7 @@  config ARCH_SOCFPGA
 	select ARM64 if TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
 	select CPU_V7A if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
 	select DM
+	select DM_MTD
 	select DM_SERIAL
 	select ENABLE_ARM_SOC_BOOT0_HOOK if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
 	select OF_CONTROL
@@ -1548,6 +1549,7 @@  config ARCH_UNIPHIER
 	select DM_GPIO
 	select DM_I2C
 	select DM_MMC
+	select DM_MTD
 	select DM_RESET
 	select DM_SERIAL
 	select DM_USB
diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index 7814d84ba0..23201ca720 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -116,7 +116,7 @@  config NAND_DENALI
 config NAND_DENALI_DT
 	bool "Support Denali NAND controller as a DT device"
 	select NAND_DENALI
-	depends on OF_CONTROL && DM
+	depends on OF_CONTROL && DM_MTD
 	help
 	  Enable the driver for NAND flash on platforms using a Denali NAND
 	  controller as a DT device.
diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
index 587e480faa..759ad40e51 100644
--- a/drivers/mtd/nand/raw/denali_dt.c
+++ b/drivers/mtd/nand/raw/denali_dt.c
@@ -160,7 +160,7 @@  static int denali_dt_probe(struct udevice *dev)
 
 U_BOOT_DRIVER(denali_nand_dt) = {
 	.name = "denali-nand-dt",
-	.id = UCLASS_MISC,
+	.id = UCLASS_MTD,
 	.of_match = denali_nand_dt_ids,
 	.probe = denali_dt_probe,
 	.priv_auto_alloc_size = sizeof(struct denali_nand_info),
@@ -171,7 +171,7 @@  void board_nand_init(void)
 	struct udevice *dev;
 	int ret;
 
-	ret = uclass_get_device_by_driver(UCLASS_MISC,
+	ret = uclass_get_device_by_driver(UCLASS_MTD,
 					  DM_GET_DRIVER(denali_nand_dt),
 					  &dev);
 	if (ret && ret != -ENODEV)