public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] Kconfig: Add entry for VF610 NAND NFC device tree aware driver
@ 2018-12-03  9:24 Lukasz Majewski
  2018-12-03  9:24 ` [U-Boot] [PATCH 2/2] nand: vybrid: Extend the vf610 NFC NAND driver to support device tree (and DM) Lukasz Majewski
  2018-12-03 14:03 ` [U-Boot] [PATCH 1/2] Kconfig: Add entry for VF610 NAND NFC device tree aware driver Stefan Agner
  0 siblings, 2 replies; 4+ messages in thread
From: Lukasz Majewski @ 2018-12-03  9:24 UTC (permalink / raw)
  To: u-boot

This commit provides code to add proper entry to Kconfig to enable
support for VF610 device tree aware driver.

Signed-off-by: Lukasz Majewski <lukma@denx.de>

---

 drivers/mtd/nand/raw/Kconfig | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index 008f7b4b4b..fd1723feda 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -88,6 +88,15 @@ config NAND_VF610_NFC
 	  The driver supports a maximum 2k page size. The driver
 	  currently does not support hardware ECC.
 
+if NAND_VF610_NFC
+
+config NAND_VF610_NFC_DT
+        bool "Support Vybrid's vf610 NAND controller as a DT device"
+        depends on OF_CONTROL && MTD
+        help
+          Enable the driver for Vybrid's vf610 NAND flash on platforms
+	  using device tree.
+
 choice
 	prompt "Hardware ECC strength"
 	depends on NAND_VF610_NFC
@@ -103,6 +112,8 @@ config SYS_NAND_VF610_NFC_60_ECC_BYTES
 
 endchoice
 
+endif
+
 config NAND_PXA3XX
 	bool "Support for NAND on PXA3xx and Armada 370/XP/38x"
 	select SYS_NAND_SELF_INIT
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 2/2] nand: vybrid: Extend the vf610 NFC NAND driver to support device tree (and DM)
  2018-12-03  9:24 [U-Boot] [PATCH 1/2] Kconfig: Add entry for VF610 NAND NFC device tree aware driver Lukasz Majewski
@ 2018-12-03  9:24 ` Lukasz Majewski
  2018-12-03 14:03 ` [U-Boot] [PATCH 1/2] Kconfig: Add entry for VF610 NAND NFC device tree aware driver Stefan Agner
  1 sibling, 0 replies; 4+ messages in thread
From: Lukasz Majewski @ 2018-12-03  9:24 UTC (permalink / raw)
  To: u-boot

This commit adds support for device tree and enumeration via device model
for the Vybrid's NFC NAND driver.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---

 drivers/mtd/nand/raw/vf610_nfc.c | 47 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c
index 619d0403e9..fce7e5f299 100644
--- a/drivers/mtd/nand/raw/vf610_nfc.c
+++ b/drivers/mtd/nand/raw/vf610_nfc.c
@@ -31,6 +31,11 @@
 #include <nand.h>
 #include <errno.h>
 #include <asm/io.h>
+#if CONFIG_NAND_VF610_NFC_DT
+#include <dm.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+#endif
 
 /* Register Offsets */
 #define NFC_FLASH_CMD1			0x3F00
@@ -760,9 +765,51 @@ error:
 	return err;
 }
 
+#if CONFIG_NAND_VF610_NFC_DT
+static const struct udevice_id vf610_nfc_dt_ids[] = {
+	{
+		.compatible = "fsl,vf610-nfc",
+	},
+	{ /* sentinel */ }
+};
+
+static int vf610_nfc_dt_probe(struct udevice *dev)
+{
+	struct resource res;
+	int ret;
+
+	ret = dev_read_resource(dev, 0, &res);
+	if (ret)
+		return ret;
+
+	return vf610_nfc_nand_init(0, devm_ioremap(dev, res.start,
+						   resource_size(&res)));
+}
+
+U_BOOT_DRIVER(vf610_nfc_dt) = {
+	.name = "vf610-nfc-dt",
+	.id = UCLASS_MTD,
+	.of_match = vf610_nfc_dt_ids,
+	.probe = vf610_nfc_dt_probe,
+};
+
+void board_nand_init(void)
+{
+	struct udevice *dev;
+	int ret;
+
+	ret = uclass_get_device_by_driver(UCLASS_MTD,
+					  DM_GET_DRIVER(vf610_nfc_dt),
+					  &dev);
+	if (ret && ret != -ENODEV)
+		pr_err("Failed to initialize NAND controller. (error %d)\n",
+		       ret);
+}
+#else
 void board_nand_init(void)
 {
 	int err = vf610_nfc_nand_init(0, (void __iomem *)CONFIG_SYS_NAND_BASE);
 	if (err)
 		printf("VF610 NAND init failed (err %d)\n", err);
 }
+#endif /* CONFIG_NAND_VF610_NFC_DT */
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 1/2] Kconfig: Add entry for VF610 NAND NFC device tree aware driver
  2018-12-03  9:24 [U-Boot] [PATCH 1/2] Kconfig: Add entry for VF610 NAND NFC device tree aware driver Lukasz Majewski
  2018-12-03  9:24 ` [U-Boot] [PATCH 2/2] nand: vybrid: Extend the vf610 NFC NAND driver to support device tree (and DM) Lukasz Majewski
@ 2018-12-03 14:03 ` Stefan Agner
  2018-12-03 14:36   ` Lukasz Majewski
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Agner @ 2018-12-03 14:03 UTC (permalink / raw)
  To: u-boot

On 03.12.2018 10:24, Lukasz Majewski wrote:
> This commit provides code to add proper entry to Kconfig to enable
> support for VF610 device tree aware driver.

Looks like a start, but ideally we should also move all the board/system
specific properties to device-tree (e.g.
CONFIG_SYS_NAND_VF610_NFC_45_ECC_BYTES).

--
Stefan

> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> 
> ---
> 
>  drivers/mtd/nand/raw/Kconfig | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
> index 008f7b4b4b..fd1723feda 100644
> --- a/drivers/mtd/nand/raw/Kconfig
> +++ b/drivers/mtd/nand/raw/Kconfig
> @@ -88,6 +88,15 @@ config NAND_VF610_NFC
>  	  The driver supports a maximum 2k page size. The driver
>  	  currently does not support hardware ECC.
>  
> +if NAND_VF610_NFC
> +
> +config NAND_VF610_NFC_DT
> +        bool "Support Vybrid's vf610 NAND controller as a DT device"
> +        depends on OF_CONTROL && MTD
> +        help
> +          Enable the driver for Vybrid's vf610 NAND flash on platforms
> +	  using device tree.
> +
>  choice
>  	prompt "Hardware ECC strength"
>  	depends on NAND_VF610_NFC
> @@ -103,6 +112,8 @@ config SYS_NAND_VF610_NFC_60_ECC_BYTES
>  
>  endchoice
>  
> +endif
> +
>  config NAND_PXA3XX
>  	bool "Support for NAND on PXA3xx and Armada 370/XP/38x"
>  	select SYS_NAND_SELF_INIT

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 1/2] Kconfig: Add entry for VF610 NAND NFC device tree aware driver
  2018-12-03 14:03 ` [U-Boot] [PATCH 1/2] Kconfig: Add entry for VF610 NAND NFC device tree aware driver Stefan Agner
@ 2018-12-03 14:36   ` Lukasz Majewski
  0 siblings, 0 replies; 4+ messages in thread
From: Lukasz Majewski @ 2018-12-03 14:36 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

> On 03.12.2018 10:24, Lukasz Majewski wrote:
> > This commit provides code to add proper entry to Kconfig to enable
> > support for VF610 device tree aware driver.  
> 
> Looks like a start, 

Indeed - this is a start. Vybrid is a bit behind the current u-boot
peace of development.

I'm trying to give it some momentum.

> but ideally we should also move all the
> board/system specific properties to device-tree (e.g.
> CONFIG_SYS_NAND_VF610_NFC_45_ECC_BYTES).

Yes, that would be a long term goal. However, those configs are already
moved to Kconfig, so there is no urgent need to make the conversion
now.

> 
> --
> Stefan
> 
> > 
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > 
> > ---
> > 
> >  drivers/mtd/nand/raw/Kconfig | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/drivers/mtd/nand/raw/Kconfig
> > b/drivers/mtd/nand/raw/Kconfig index 008f7b4b4b..fd1723feda 100644
> > --- a/drivers/mtd/nand/raw/Kconfig
> > +++ b/drivers/mtd/nand/raw/Kconfig
> > @@ -88,6 +88,15 @@ config NAND_VF610_NFC
> >  	  The driver supports a maximum 2k page size. The driver
> >  	  currently does not support hardware ECC.
> >  
> > +if NAND_VF610_NFC
> > +
> > +config NAND_VF610_NFC_DT
> > +        bool "Support Vybrid's vf610 NAND controller as a DT
> > device"
> > +        depends on OF_CONTROL && MTD
> > +        help
> > +          Enable the driver for Vybrid's vf610 NAND flash on
> > platforms
> > +	  using device tree.
> > +
> >  choice
> >  	prompt "Hardware ECC strength"
> >  	depends on NAND_VF610_NFC
> > @@ -103,6 +112,8 @@ config SYS_NAND_VF610_NFC_60_ECC_BYTES
> >  
> >  endchoice
> >  
> > +endif
> > +
> >  config NAND_PXA3XX
> >  	bool "Support for NAND on PXA3xx and Armada 370/XP/38x"
> >  	select SYS_NAND_SELF_INIT  




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181203/e687526e/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-03 14:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-03  9:24 [U-Boot] [PATCH 1/2] Kconfig: Add entry for VF610 NAND NFC device tree aware driver Lukasz Majewski
2018-12-03  9:24 ` [U-Boot] [PATCH 2/2] nand: vybrid: Extend the vf610 NFC NAND driver to support device tree (and DM) Lukasz Majewski
2018-12-03 14:03 ` [U-Boot] [PATCH 1/2] Kconfig: Add entry for VF610 NAND NFC device tree aware driver Stefan Agner
2018-12-03 14:36   ` Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox