Re: [PATCH] mmc: davinci_mmc: Cleanup to use dt in U-boot and static platdata in SPL

2020-05-25 Thread Bartosz Golaszewski
pt., 22 maj 2020 o 04:02 Faiz Abbas  napisał(a):
>
> Cleanup this driver to use dt in U-boot and static platdata in SPL.
> This requires the following steps:
>
> 1. Move all platdata assignment from probe() to ofdata_to_platdata().
>This function is only called in U-boot.
> 2. Replicate all the platdata assignment being done in
>ofdata_to_platdata() in the omapl138 board file. This data is used in
>the SPL case where SPL_OF_CONTROL is not enabled.
> 3. Remove SPL_OF_CONTROL and related configs from omapl138_lcdk_defconfig
>
> This cleanup effectively reverts 3ef94715cc ('mmc: davinci: fix mmc boot in 
> SPL')
>
> Signed-off-by: Faiz Abbas 

Tested-by: Bartosz Golaszewski 


Re: [PATCH v5 1/4] omap: mmc: Avoid using libfdt with of-platdata

2020-05-05 Thread Bartosz Golaszewski
wt., 5 maj 2020 o 08:50 Faiz Abbas  napisał(a):
>
> Hi,
>
> On 04/05/20 6:44 pm, Simon Glass wrote:
> > Hi Bart,
> >
> > On Mon, 4 May 2020 at 01:10, Bartosz Golaszewski  wrote:
> >>
> >> pt., 1 maj 2020 o 20:32 Tom Rini  napisał(a):
> >>>
> >>> On Thu, Apr 30, 2020 at 01:43:30PM +0200, Bartosz Golaszewski wrote:
> >>>> wt., 28 kwi 2020 o 09:01 Faiz Abbas  napisał(a):
> >>>>>
> >>>>> +Bartosz
> >>>>>
> >>>>> On 28/04/20 9:47 am, Lokesh Vutla wrote:
> >>>>>> +Faiz,
> >>>>>>
> >>>>>> On 28/04/20 12:29 AM, Tom Rini wrote:
> >>>>>>> On Mon, Apr 27, 2020 at 05:33:41AM +, Peng Fan wrote:
> >>>>>>>>> Subject: [PATCH v5 1/4] omap: mmc: Avoid using libfdt with 
> >>>>>>>>> of-platdata
> >>>>>>>>>
> >>>>>>>>> At present this driver is enabled in SPL on omapl138_lcdk, which 
> >>>>>>>>> uses
> >>>>>>>>> of-platdata. The driver needs to be ported to use of-platdata 
> >>>>>>>>> properly.
> >>>>>>>>> For now, avoid a build error by returning an error.
> >>>>>>>>>
> >>>>>>>>> Signed-off-by: Simon Glass 
> >>>>>>
> >>>>>> Does this break the boot on omap l138?
> >>>>>>
> >>>>>
> >>>>> I don't have a board at hand to test this out. Bartosz can you help 
> >>>>> test this with
> >>>>> omapl138?
> >>>>>
> >>>>> Thanks,
> >>>>> Faiz
> >>>>
> >>>> Hi Faiz,
> >>>>
> >>>> I can confirm - this *does* break the mmc boot on da850-lcdk.
> >>>
> >>> So who is going to fix the driver to unblock Simon's series?
> >>>
> >>
> >> Is this something that will take a lot of work? What exactly needs
> >> doing? I'm not sure what "use of-platdata properly" means.
> >
> > This board is defining CONFIG_SPL_OF_PLATDATA which means that device
> > tree is not available in SPL. Instead you need to use a C structure
> > created by dtoc. It basically involves creating that struct and
> > getting the data from that instead of calling the DT functions. I
> > expect it will take 2-4 hours to figure out, code and test.
> >
> > See of-plat.rst for full documentation. There are quite a few examples for 
> > mmc:
> >
> > grep PLATDATA drivers/mmc/*.c
> > drivers/mmc/ftsdc010_mci.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/ftsdc010_mci.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/ftsdc010_mci.c:#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/ftsdc010_mci.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/mxsmmc.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/mxsmmc.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/mxsmmc.c: debug("OF_PLATDATA: regs: 0x%p bw: %d clkid: %d
> > non_removable: %d\n",
> > drivers/mmc/mxsmmc.c:#if CONFIG_IS_ENABLED(OF_CONTROL) &&
> > !CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/mxsmmc.c:#if CONFIG_IS_ENABLED(OF_CONTROL) &&
> > !CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/omap_hsmmc.c:#if CONFIG_IS_ENABLED(OF_CONTROL) &&
> > !CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/omap_hsmmc.c:#if CONFIG_IS_ENABLED(OF_CONTROL) &&
> > !CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/omap_hsmmc.c:#if CONFIG_IS_ENABLED(OF_CONTROL) &&
> > !CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/rockchip_dw_mmc.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/rockchip_dw_mmc.c:#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/rockchip_dw_mmc.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/rockchip_sdhci.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/rockchip_sdhci.c:#if CONFIG_IS_ENABLED(OF_PLATDATA)
> > drivers/mmc/rockchip_sdhci.c:#if !CONFIG_IS_ENABLED(OF_PLATDATA)
> >
>
> I was able to get a setup to work on. Will post a fix for this soon.
>
> Thanks,
> Faiz

Thanks Faiz! Let me know if you need some help testing it.

Bart


Re: [PATCH v5 1/4] omap: mmc: Avoid using libfdt with of-platdata

2020-05-04 Thread Bartosz Golaszewski
pt., 1 maj 2020 o 20:32 Tom Rini  napisał(a):
>
> On Thu, Apr 30, 2020 at 01:43:30PM +0200, Bartosz Golaszewski wrote:
> > wt., 28 kwi 2020 o 09:01 Faiz Abbas  napisał(a):
> > >
> > > +Bartosz
> > >
> > > On 28/04/20 9:47 am, Lokesh Vutla wrote:
> > > > +Faiz,
> > > >
> > > > On 28/04/20 12:29 AM, Tom Rini wrote:
> > > >> On Mon, Apr 27, 2020 at 05:33:41AM +, Peng Fan wrote:
> > > >>>> Subject: [PATCH v5 1/4] omap: mmc: Avoid using libfdt with 
> > > >>>> of-platdata
> > > >>>>
> > > >>>> At present this driver is enabled in SPL on omapl138_lcdk, which uses
> > > >>>> of-platdata. The driver needs to be ported to use of-platdata 
> > > >>>> properly.
> > > >>>> For now, avoid a build error by returning an error.
> > > >>>>
> > > >>>> Signed-off-by: Simon Glass 
> > > >
> > > > Does this break the boot on omap l138?
> > > >
> > >
> > > I don't have a board at hand to test this out. Bartosz can you help test 
> > > this with
> > > omapl138?
> > >
> > > Thanks,
> > > Faiz
> >
> > Hi Faiz,
> >
> > I can confirm - this *does* break the mmc boot on da850-lcdk.
>
> So who is going to fix the driver to unblock Simon's series?
>

Is this something that will take a lot of work? What exactly needs
doing? I'm not sure what "use of-platdata properly" means.

Bart


Re: [PATCH v5 1/4] omap: mmc: Avoid using libfdt with of-platdata

2020-04-30 Thread Bartosz Golaszewski
wt., 28 kwi 2020 o 09:01 Faiz Abbas  napisał(a):
>
> +Bartosz
>
> On 28/04/20 9:47 am, Lokesh Vutla wrote:
> > +Faiz,
> >
> > On 28/04/20 12:29 AM, Tom Rini wrote:
> >> On Mon, Apr 27, 2020 at 05:33:41AM +, Peng Fan wrote:
>  Subject: [PATCH v5 1/4] omap: mmc: Avoid using libfdt with of-platdata
> 
>  At present this driver is enabled in SPL on omapl138_lcdk, which uses
>  of-platdata. The driver needs to be ported to use of-platdata properly.
>  For now, avoid a build error by returning an error.
> 
>  Signed-off-by: Simon Glass 
> >
> > Does this break the boot on omap l138?
> >
>
> I don't have a board at hand to test this out. Bartosz can you help test this 
> with
> omapl138?
>
> Thanks,
> Faiz

Hi Faiz,

I can confirm - this *does* break the mmc boot on da850-lcdk.

Bart


Re: [PATCH 2/4] mmc: davinci: drop struct davinci_mmc_plat

2020-01-04 Thread Bartosz Golaszewski
pt., 3 sty 2020 o 17:01 Adam Ford  napisał(a):
>
> On Thu, Nov 14, 2019 at 9:10 AM Bartosz Golaszewski  wrote:
> >
> > From: Bartosz Golaszewski 
> >
> > struct mmc_config & struct mmc don't need to be exported over platform
> > data, but can instead be private in the driver.
> >
> > Remove struct davinci_mmc_plat.
>
> This patch appears to break the da850-evm.
>
> With the pending release of 2020.01, is there any way we can revert
> before release and try to apply this going forward with more time to
> test?
>
> As of now, the da850-evm cannot read/write from the MMC card from
> U-Boot which includes MMC booting.
>

This is strange, this change doesn't seem to affect the logic.

This isn't revertible automatically anymore, due to other patches that
came before and after. We can probably try to revert it manually.

Bart


Re: [U-Boot] [PATCH 0/4] omapl138_lcdk: fix MMC boot

2019-12-02 Thread Bartosz Golaszewski
czw., 14 lis 2019 o 16:10 Bartosz Golaszewski  napisał(a):
>
> From: Bartosz Golaszewski 
>
> Booting from MMC on omapl138-lcdk is currently broken after we enabled
> driver-model in SPL. While I know what's wrong - the bind() callback not
> being called - I can't for the life of me figure out how to fix it.
>
> I'm still working on proper changes, but for now, I'd like to propose
> this series which fixes MMC boot with a workaround in which we call
> mmc_boot() manually from probe.
>
> First two patches drop some legacy code that's no longer needed. The
> third patch adds a U_BOOT_DEVICE() for mmc as we don't yet have full
> DT support (also in-progress). The last patch adds the workaround to
> the davinci mmc driver.
>
> This series depends on Adam Ford's patch increasing the pre-reloc
> malloc pool.
>
> [1] https://patchwork.ozlabs.org/patch/1192574/
>
> Bartosz Golaszewski (4):
>   mmc: davinci: drop support for ti,dm6441-mmc
>   mmc: davinci: drop struct davinci_mmc_plat
>   board: omapl138_lcdk: add the mmc device to SPL
>   mmc: davinci: fix mmc boot in SPL
>
>  arch/arm/mach-davinci/Kconfig |  1 +
>  .../mach-davinci/include/mach/sdmmc_defs.h|  6 --
>  board/davinci/da8xxevm/omapl138_lcdk.c| 10 ++-
>  drivers/mmc/davinci_mmc.c | 73 +++
>  4 files changed, 36 insertions(+), 54 deletions(-)
>
> --
> 2.23.0
>

Gentle ping.

Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: dts: da850-lcdk: Update DTS files for SPL device tree support

2019-11-14 Thread Bartosz Golaszewski
śr., 13 lis 2019 o 16:46 Adam Ford  napisał(a):
>
> Currently, the da850-lcdk uses SPL_OF_PLATDATA and manually loads
> the necessary source code instead of using the auto-generated,
> because the drivers don't properly autogenerate the code.
>
> This patch simply enables the various device tree options to
> mimic the da850-evm which doesn't need or use OF_PLATDATA for
> device tree support.  It does not disable OF_PLATDATA.
>
> Signed-off-by: Adam Ford 
>
> diff --git a/arch/arm/dts/da850-lcdk-u-boot.dtsi 
> b/arch/arm/dts/da850-lcdk-u-boot.dtsi
> index 541f4ca200..b372d06ca9 100644
> --- a/arch/arm/dts/da850-lcdk-u-boot.dtsi
> +++ b/arch/arm/dts/da850-lcdk-u-boot.dtsi
> @@ -8,9 +8,23 @@
>  / {
> aliases {
> i2c0 = 
> +   mmc0 = 
> +   serial2 = 
> +   };
> +
> +   soc@1c0 {
> +   u-boot,dm-spl;
> };
>
> nand {
> compatible = "ti,davinci-nand";
> };
>  };
> +
> + {
> +   u-boot,dm-spl;
> +};
> +
> + {
> +   u-boot,dm-spl;
> +};
> diff --git a/arch/arm/dts/da850-lcdk.dts b/arch/arm/dts/da850-lcdk.dts
> index 0177e3ed20..db8ae566f3 100644
> --- a/arch/arm/dts/da850-lcdk.dts
> +++ b/arch/arm/dts/da850-lcdk.dts
> @@ -18,7 +18,7 @@
> };
>
> chosen {
> -   stdout-path = "serial2:115200n8";
> +   stdout-path = 
> };
>
> memory@c000 {
> --
> 2.20.1
>

Hi Adam,

the generated platdata has wrong driver names. I'm not sure how these
are generated but at first glance it looks like the compatible string
is transformed by converting commas and hyphens into underscores. This
of course won't work as the real driver names are different and the
lookup fails (with your patch - if I remove the serial U_BOOT_DEVICE()
from the board file, the serial stops working). Are you aware of how
other SPL users handle this?

Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 4/4] mmc: davinci: fix mmc boot in SPL

2019-11-14 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

The MMC boot is currently broken on omapl138-lcdk after enabling the
driver model in SPL. The main problem is the driver's bind callback not
being called after probe in SPL (even with the DM_FLAG_PRE_RELOC flag
specified).

While a proper fix is still being worked on, this hacky changeset at
least fixes the MMC boot on this platform by calling mmc_bind()
manually from probe().

Signed-off-by: Bartosz Golaszewski 
---
 drivers/mmc/davinci_mmc.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/mmc/davinci_mmc.c b/drivers/mmc/davinci_mmc.c
index a27a039f9b..c3f7b57665 100644
--- a/drivers/mmc/davinci_mmc.c
+++ b/drivers/mmc/davinci_mmc.c
@@ -482,6 +482,9 @@ static int davinci_mmc_probe(struct udevice *dev)
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
struct davinci_mmc_priv *priv = dev_get_priv(dev);
struct mmc_config *cfg = >cfg;
+#ifdef CONFIG_SPL_BUILD
+   int ret;
+#endif
 
cfg->f_min = 20;
cfg->f_max = 2500;
@@ -501,6 +504,20 @@ static int davinci_mmc_probe(struct udevice *dev)
 
upriv->mmc = >mmc;
 
+#ifdef CONFIG_SPL_BUILD
+   /*
+* FIXME This is a temporary workaround to enable the driver model in
+* SPL on omapl138-lcdk. For some reason the bind() callback is not
+* being called in SPL for MMC which breaks the mmc boot - the hack
+* is to call mmc_bind() from probe(). We also don't have full DT
+* support in SPL, hence the hard-coded base register address.
+*/
+   priv->reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE;
+   ret = mmc_bind(dev, >mmc, >cfg);
+   if (ret)
+   return ret;
+#endif
+
return davinci_dm_mmc_init(dev);
 }
 
-- 
2.23.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/4] board: omapl138_lcdk: add the mmc device to SPL

2019-11-14 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

We don't have full device-tree support in SPL yet - add an appropriate
U_BOOT_DEVICE() to the board file.

Signed-off-by: Bartosz Golaszewski 
---
 arch/arm/mach-davinci/Kconfig  | 1 +
 board/davinci/da8xxevm/omapl138_lcdk.c | 9 +
 2 files changed, 10 insertions(+)

diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index adc50922c8..8a81c07881 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -14,6 +14,7 @@ config TARGET_OMAPL138_LCDK
bool "OMAPL138 LCDK"
select SOC_DA8XX
select SUPPORT_SPL
+   select SPL_BOARD_INIT
 
 config TARGET_LEGOEV3
bool "LEGO MINDSTORMS EV3"
diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index d4cda0a8a7..608a7f28eb 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -366,4 +366,13 @@ U_BOOT_DEVICE(omapl138_uart) = {
.name = "ns16550_serial",
.platdata = _pdata,
 };
+
+U_BOOT_DEVICE(omapl138_mmc) = {
+   .name = "davinci_mmc",
+};
+
+void spl_board_init(void)
+{
+   davinci_configure_pin_mux(mmc0_pins, ARRAY_SIZE(mmc0_pins));
+}
 #endif
-- 
2.23.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/4] mmc: davinci: drop struct davinci_mmc_plat

2019-11-14 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

struct mmc_config & struct mmc don't need to be exported over platform
data, but can instead be private in the driver.

Remove struct davinci_mmc_plat.

Signed-off-by: Bartosz Golaszewski 
---
 drivers/mmc/davinci_mmc.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/davinci_mmc.c b/drivers/mmc/davinci_mmc.c
index 370b18cc78..a27a039f9b 100644
--- a/drivers/mmc/davinci_mmc.c
+++ b/drivers/mmc/davinci_mmc.c
@@ -32,10 +32,6 @@ struct davinci_mmc_priv {
uint input_clk; /* Input clock to MMC controller */
struct gpio_desc cd_gpio;   /* Card Detect GPIO */
struct gpio_desc wp_gpio;   /* Write Protect GPIO */
-};
-
-struct davinci_mmc_plat
-{
struct mmc_config cfg;
struct mmc mmc;
 };
@@ -484,9 +480,8 @@ int davinci_mmc_init(bd_t *bis, struct davinci_mmc *host)
 static int davinci_mmc_probe(struct udevice *dev)
 {
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
-   struct davinci_mmc_plat *plat = dev_get_platdata(dev);
struct davinci_mmc_priv *priv = dev_get_priv(dev);
-   struct mmc_config *cfg = >cfg;
+   struct mmc_config *cfg = >cfg;
 
cfg->f_min = 20;
cfg->f_max = 2500;
@@ -504,16 +499,16 @@ static int davinci_mmc_probe(struct udevice *dev)
gpio_request_by_name(dev, "wp-gpios", 0, >wp_gpio, GPIOD_IS_IN);
 #endif
 
-   upriv->mmc = >mmc;
+   upriv->mmc = >mmc;
 
return davinci_dm_mmc_init(dev);
 }
 
 static int davinci_mmc_bind(struct udevice *dev)
 {
-   struct davinci_mmc_plat *plat = dev_get_platdata(dev);
+   struct davinci_mmc_priv *priv = dev_get_priv(dev);
 
-   return mmc_bind(dev, >mmc, >cfg);
+   return mmc_bind(dev, >mmc, >cfg);
 }
 
 static const struct udevice_id davinci_mmc_ids[] = {
@@ -530,7 +525,6 @@ U_BOOT_DRIVER(davinci_mmc_drv) = {
 #endif
.probe = davinci_mmc_probe,
.ops = _mmc_ops,
-   .platdata_auto_alloc_size = sizeof(struct davinci_mmc_plat),
.priv_auto_alloc_size = sizeof(struct davinci_mmc_priv),
 };
 #endif
-- 
2.23.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/4] mmc: davinci: drop support for ti,dm6441-mmc

2019-11-14 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

The DM family of DaVinci SoCs is no longer supported. Drop the
irrelevant code from the driver.

Signed-off-by: Bartosz Golaszewski 
---
 .../mach-davinci/include/mach/sdmmc_defs.h|  6 ---
 board/davinci/da8xxevm/omapl138_lcdk.c|  1 -
 drivers/mmc/davinci_mmc.c | 42 +++
 3 files changed, 5 insertions(+), 44 deletions(-)

diff --git a/arch/arm/mach-davinci/include/mach/sdmmc_defs.h 
b/arch/arm/mach-davinci/include/mach/sdmmc_defs.h
index 5755c45f91..46f6391aa2 100644
--- a/arch/arm/mach-davinci/include/mach/sdmmc_defs.h
+++ b/arch/arm/mach-davinci/include/mach/sdmmc_defs.h
@@ -149,15 +149,9 @@ struct davinci_mmc {
uint input_clk; /* Input clock to MMC controller */
uint host_caps; /* Host capabilities */
uint voltages;  /* Host supported voltages */
-   uint version;   /* MMC Controller version */
struct mmc_config cfg;
 };
 
-enum {
-   MMC_CTLR_VERSION_1 = 0, /* DM644x and DM355 */
-   MMC_CTLR_VERSION_2, /* DA830 */
-};
-
 int davinci_mmc_init(bd_t *bis, struct davinci_mmc *host);
 
 #endif /* _SDMMC_DEFS_H */
diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index 27a51d6a78..d4cda0a8a7 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -342,7 +342,6 @@ static struct davinci_mmc mmc_sd0 = {
.reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE,
.host_caps = MMC_MODE_4BIT, /* DA850 supports only 4-bit SD/MMC */
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
-   .version = MMC_CTLR_VERSION_2,
 };
 
 int board_mmc_init(bd_t *bis)
diff --git a/drivers/mmc/davinci_mmc.c b/drivers/mmc/davinci_mmc.c
index 0d63279db0..370b18cc78 100644
--- a/drivers/mmc/davinci_mmc.c
+++ b/drivers/mmc/davinci_mmc.c
@@ -26,16 +26,10 @@
 #define clear_bit(addr, val)   set_val((addr), (get_val(addr) & ~(val)))
 
 #ifdef CONFIG_DM_MMC
-struct davinci_of_data {
-   const char *name;
-   u8 version;
-};
-
 /* Davinci MMC board definitions */
 struct davinci_mmc_priv {
struct davinci_mmc_regs *reg_base;  /* Register base address */
uint input_clk; /* Input clock to MMC controller */
-   uint version;   /* MMC Controller version */
struct gpio_desc cd_gpio;   /* Card Detect GPIO */
struct gpio_desc wp_gpio;   /* Write Protect GPIO */
 };
@@ -173,7 +167,7 @@ davinci_mmc_send_cmd(struct udevice *dev, struct mmc_cmd 
*cmd, struct mmc_data *
 
/* Clear status registers */
mmcstatus = get_val(>mmcst0);
-   fifo_words = (host->version == MMC_CTLR_VERSION_2) ? 16 : 8;
+   fifo_words = 16;
fifo_bytes = fifo_words << 2;
 
/* Wait for any previous busy signal to be cleared */
@@ -211,8 +205,7 @@ davinci_mmc_send_cmd(struct udevice *dev, struct mmc_cmd 
*cmd, struct mmc_data *
set_val(>mmcfifoctl,
(MMCFIFOCTL_FIFOLEV | MMCFIFOCTL_FIFORST));
 
-   if (host->version == MMC_CTLR_VERSION_2)
-   cmddata |= MMCCMD_DMATRIG;
+   cmddata |= MMCCMD_DMATRIG;
 
cmddata |= MMCCMD_WDATX;
if (data->flags == MMC_DATA_READ) {
@@ -494,18 +487,13 @@ static int davinci_mmc_probe(struct udevice *dev)
struct davinci_mmc_plat *plat = dev_get_platdata(dev);
struct davinci_mmc_priv *priv = dev_get_priv(dev);
struct mmc_config *cfg = >cfg;
-   struct davinci_of_data *data =
-   (struct davinci_of_data *)dev_get_driver_data(dev);
+
cfg->f_min = 20;
cfg->f_max = 2500;
cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
cfg->host_caps = MMC_MODE_4BIT, /* DA850 supports only 4-bit SD/MMC */
cfg->b_max = DAVINCI_MAX_BLOCKS;
-
-   if (data) {
-   cfg->name = data->name;
-   priv->version = data->version;
-   }
+   cfg->name = "da830-mmc";
 
priv->reg_base = (struct davinci_mmc_regs *)dev_read_addr(dev);
priv->input_clk = clk_get(DAVINCI_MMCSD_CLKID);
@@ -528,28 +516,8 @@ static int davinci_mmc_bind(struct udevice *dev)
return mmc_bind(dev, >mmc, >cfg);
 }
 
-
-const struct davinci_of_data davinci_mmc_host_info[] = {
-   {
-   .name   = "dm6441-mmc",
-   .version = MMC_CTLR_VERSION_1,
-   },
-   {
-   .name   = "da830-mmc",
-   .version = MMC_CTLR_VERSION_2,
-   },
-   {},
-};
-
 static const struct udevice_id davinci_mmc_ids[] = {
-   {
-   .compatible = "ti,dm6441-mmc",
-   .data = (ulong) _mmc_host_info[MMC_CTLR_VERSION_1]
-   },
-   {
-   .compatible = "ti,da830-mmc&qu

[U-Boot] [PATCH 0/4] omapl138_lcdk: fix MMC boot

2019-11-14 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Booting from MMC on omapl138-lcdk is currently broken after we enabled
driver-model in SPL. While I know what's wrong - the bind() callback not
being called - I can't for the life of me figure out how to fix it.

I'm still working on proper changes, but for now, I'd like to propose
this series which fixes MMC boot with a workaround in which we call
mmc_boot() manually from probe.

First two patches drop some legacy code that's no longer needed. The
third patch adds a U_BOOT_DEVICE() for mmc as we don't yet have full
DT support (also in-progress). The last patch adds the workaround to
the davinci mmc driver.

This series depends on Adam Ford's patch increasing the pre-reloc
malloc pool.

[1] https://patchwork.ozlabs.org/patch/1192574/

Bartosz Golaszewski (4):
  mmc: davinci: drop support for ti,dm6441-mmc
  mmc: davinci: drop struct davinci_mmc_plat
  board: omapl138_lcdk: add the mmc device to SPL
  mmc: davinci: fix mmc boot in SPL

 arch/arm/mach-davinci/Kconfig |  1 +
 .../mach-davinci/include/mach/sdmmc_defs.h|  6 --
 board/davinci/da8xxevm/omapl138_lcdk.c| 10 ++-
 drivers/mmc/davinci_mmc.c | 73 +++
 4 files changed, 36 insertions(+), 54 deletions(-)

-- 
2.23.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] ARM: omapl138_lcdk: Enable SPL_DM_SEQ_ALIAS and SPL_OF_TRANSLATE

2019-11-13 Thread Bartosz Golaszewski
niedz., 10 lis 2019 o 15:01 Adam Ford  napisał(a):
>
> In order to further prepare for full device tree support in SPL,
> this patch enables both SPL_DM_SEQ_ALIAS and SPL_OF_TRANSLATE.
> Both of these are already enabled in U-Boot, so SPL will have
> the same functionality
>
> Signed-off-by: Adam Ford 
>
> diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
> index 376bb9f953..c95d06b551 100644
> --- a/configs/omapl138_lcdk_defconfig
> +++ b/configs/omapl138_lcdk_defconfig
> @@ -44,6 +44,8 @@ CONFIG_ENV_IS_IN_NAND=y
>  CONFIG_NET_RANDOM_ETHADDR=y
>  CONFIG_DM=y
>  CONFIG_SPL_DM=y
> +CONFIG_SPL_DM_SEQ_ALIAS=y
> +CONFIG_SPL_OF_TRANSLATE=y
>  CONFIG_DM_GPIO=y
>  CONFIG_DA8XX_GPIO=y
>  CONFIG_DM_I2C=y
> --
> 2.20.1
>

Tested-by: Bartosz Golaszewski 
Reviewed-by: Bartosz Golaszewski 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] ARM: omapl138_lcdk: Separate BSS in SPL

2019-11-13 Thread Bartosz Golaszewski
niedz., 10 lis 2019 o 15:01 Adam Ford  napisał(a):
>
> In preparation to use full device tree support, SPL can separate
> BSS from text region.
>
> This patch enables SPL_SEPARATE_BSS.
>
> Signed-off-by: Adam Ford 
>
> diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
> index 16287a4ac2..cceb0c408e 100644
> --- a/configs/omapl138_lcdk_defconfig
> +++ b/configs/omapl138_lcdk_defconfig
> @@ -20,6 +20,7 @@ CONFIG_VERSION_VARIABLE=y
>  # CONFIG_DISPLAY_CPUINFO is not set
>  CONFIG_BOARD_EARLY_INIT_F=y
>  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
> +CONFIG_SPL_SEPARATE_BSS=y
>  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5
>  CONFIG_SPL_NAND_SUPPORT=y
>  CONFIG_HUSH_PARSER=y
> --
> 2.20.1
>

Tested-by: Bartosz Golaszewski 
Reviewed-by: Bartosz Golaszewski 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] ARM: omapl138_lcdk: Increase malloc pool before relocation

2019-11-13 Thread Bartosz Golaszewski
niedz., 10 lis 2019 o 15:01 Adam Ford  napisał(a):
>
> Driver model requires a malloc pool to allocate memory before
> relocations to operate serial and some other devices.  This patch
> increases the pool size to 2K.
>
> Signed-off-by: Adam Ford 
>
> diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
> index cceb0c408e..376bb9f953 100644
> --- a/configs/omapl138_lcdk_defconfig
> +++ b/configs/omapl138_lcdk_defconfig
> @@ -8,6 +8,7 @@ CONFIG_SYS_DA850_PLL1_PLLDIV3=0x8003
>  CONFIG_TI_COMMON_CMD_OPTIONS=y
>  CONFIG_SPL_LIBCOMMON_SUPPORT=y
>  CONFIG_SPL_LIBGENERIC_SUPPORT=y
> +CONFIG_SYS_MALLOC_F_LEN=0x800
>  CONFIG_SPL_MMC_SUPPORT=y
>  CONFIG_SPL_SERIAL_SUPPORT=y
>  CONFIG_NR_DRAM_BANKS=1
> --
> 2.20.1
>

Tested-by: Bartosz Golaszewski 
Reviewed-by: Bartosz Golaszewski 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: omapl138_lcdk: Allow early init to start instruction cache

2019-11-13 Thread Bartosz Golaszewski
niedz., 10 lis 2019 o 17:18 Adam Ford  napisał(a):
>
> Currently the omapl138_lcdk has SKIP_LOWLEVEL_INIT set.
> The README states there is a variation of this for the ARM926EJ-S
> which allows the board to just skip the call to lowlevel_init()
> and do the normal CP15 init which enables the instruction cache.
>
> On the da850evm, this was shown to improve startup time.
>
> This patch switches SKIP_LOWLEVEL_INIT to SKIP_LOWLEVEL_INIT_ONLY
> thus, enabling the cache.
>
> Signed-off-by: Adam Ford 
>
> diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h
> index 1c41e7e97a..3b5c085a24 100644
> --- a/include/configs/omapl138_lcdk.h
> +++ b/include/configs/omapl138_lcdk.h
> @@ -23,7 +23,7 @@
>  #define CONFIG_SYS_TIMERBASE   DAVINCI_TIMER0_BASE
>  #define CONFIG_SYS_HZ_CLOCKclk_get(DAVINCI_AUXCLK_CLKID)
>  #define CONFIG_SYS_HZ  1000
> -#define CONFIG_SKIP_LOWLEVEL_INIT
> +#define CONFIG_SKIP_LOWLEVEL_INIT_ONLY
>
>  /*
>   * Memory Info
> --
> 2.20.1
>

Tested-by: Bartosz Golaszewski 
Reviewed-by: Bartosz Golaszewski 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: omapl138_lcdk: Shrink code size by building with Thumb

2019-11-13 Thread Bartosz Golaszewski
niedz., 10 lis 2019 o 13:33 Adam Ford  napisał(a):
>
> SPL has limited available resources, and the performance between
> ARM and Thumb isn't that significant.
>
> This patch builds using Thumb instruction set to reduce the code
> size by nearly 6K.
>
> Original:
>textdata bss dec hex filename
>   2652640041376   319067ca2 spl/u-boot-spl
>
> Thumb:
>
>textdata bss dec hex filename
>   2023240041376   25612640c spl/u-boot-spl
>
> Signed-off-by: Adam Ford 
>
> diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
> index 9821df9884..16287a4ac2 100644
> --- a/configs/omapl138_lcdk_defconfig
> +++ b/configs/omapl138_lcdk_defconfig
> @@ -1,4 +1,5 @@
>  CONFIG_ARM=y
> +CONFIG_SYS_THUMB_BUILD=y
>  CONFIG_ARCH_DAVINCI=y
>  CONFIG_SYS_TEXT_BASE=0xc108
>  CONFIG_TARGET_OMAPL138_LCDK=y
> --
> 2.20.1
>

Tested-by: Bartosz Golaszewski 
Reviewed-by: Bartosz Golaszewski 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] scripts: dtc: ignore files generated generated by python

2019-11-13 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Add __pycache__ to ignored files and extend the rule for _libfdt to also
include generated shared objects (e.g. _libfdt.cpython-37m-x86_64-linux-gnu.so).

Signed-off-by: Bartosz Golaszewski 
---
 scripts/dtc/pylibfdt/.gitignore | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/dtc/pylibfdt/.gitignore b/scripts/dtc/pylibfdt/.gitignore
index 033f23dfdd..3a512001c9 100644
--- a/scripts/dtc/pylibfdt/.gitignore
+++ b/scripts/dtc/pylibfdt/.gitignore
@@ -1,4 +1,5 @@
-/_libfdt.so
+/_libfdt.*
 /libfdt.py
 /libfdt.pyc
 /libfdt_wrap.c
+/__pycache__
-- 
2.23.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 12/13] davinci: omapl138-lcdk: enable driver-model in SPL

2019-11-13 Thread Bartosz Golaszewski
śr., 13 lis 2019 o 11:52 Bartosz Golaszewski  napisał(a):
>
> pon., 11 lis 2019 o 13:58 Adam Ford  napisał(a):
> >
> > On Fri, Nov 8, 2019 at 11:59 AM Bartosz Golaszewski  wrote:
> > >
> > > pt., 8 lis 2019 o 18:33 Bartosz Golaszewski
> > >  napisał(a):
> > > >
> > > > pt., 8 lis 2019 o 17:14 Adam Ford  napisał(a):
> > > > >
> > > > > On Fri, Nov 8, 2019 at 9:50 AM Bartosz Golaszewski
> > > > >  wrote:
> > > > > >
> > > > > > pt., 25 paź 2019 o 18:10 Bartosz Golaszewski  
> > > > > > napisał(a):
> > > > > > >
> > > > > > > czw., 26 wrz 2019 o 01:21 Faiz Abbas  
> > > > > > > napisał(a):
> > > > > > > >
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
> > > > > > > > > From: Bartosz Golaszewski 
> > > > > > > > >
> > > > > > > > > Enable CONFIG_SPL_DM and enable the driver model for serial 
> > > > > > > > > by defining
> > > > > > > > > an appropriate device in the board file for da850-lcdk.
> > > > > > > > >
> > > > > > > >
> > > > > > > > This breaks booting from MMC on omapl138_lcdk. You didn't add a
> > > > > > > > U_BOOT_DEVICE for the mmc node.
> > > > > > > >
> > > > > > > > Thanks,
> > > > > > > > Faiz
> > > > > > >
> > > > > > > Just letting you know I haven't forgotten about this. I finally 
> > > > > > > got
> > > > > > > some time to work on it this week, but it turned out to be
> > > > > > > non-trivial, as for some reason the set_cmd mmc callback is not 
> > > > > > > being
> > > > > > > properly assigned in SPL with driver-model and I couldn't find 
> > > > > > > out why
> > > > > > > so far. Next week I'm at ELCE, but I'll be back at it on 
> > > > > > > Thursday. I'm
> > > > > > > not sure if you want to revert the offending patch for now or 
> > > > > > > this can
> > > > > > > wait for another week?
> > > > > > >
> > > > > > > Best regards,
> > > > > > > Bartosz Golaszewski
> > > > > >
> > > > > > I've been working on this some more this week and noticed that in 
> > > > > > SPL
> > > > > > for some reason the bind function of the mmc driver is not called
> > > > > > (despite the driver being probed fine), but so far I've been unable 
> > > > > > to
> > > > > > figure out why exactly. This is the reason for the failure as the 
> > > > > > mmc
> > > > > > is not properly setup but the mmc core thinks it is and tries using
> > > > > > it.
> > > > > >
> > > > > > I've tried both using a U_BOOT_DEVICE() defined in the board file or
> > > > > > adding the mmc node to arch/arm/dts/da850-lcdk-u-boot.dtsi.
> > > > > >
> > > > > > Adam: you know davinci's SPL pretty well - do you have any 
> > > > > > suggestions?
> > > > >
> > > > > I am not sure that I know it well.  It's just one of several TI
> > > > > platforms that I support for Logic PD.
> > > > >
> > > > > Two thoughts I had:  There are aliases setup for various peripherals
> > > > > but I am not seeing one for mmc0 =   I a not sure if it will
> > > > > help or not but it is different I see.
> > > > >
> > > >
> > > > I'm having the same problem even when I'm defining the device using
> > > > U_BOOT_DEVICE() in the relevant board file.
> > > >
> > > > > There is also a function void board_boot_order (u32 *spl_boot_list)
> > > > > which can force the system to boot from a given device (ie, MMC1).
> > > > > It's an optional function, but it's a quick and dirty option to try.
> > > > >
> > > >
> > > > Thanks, I'll take a look at that.
> > >
> > > It's still the same, no matter what or

Re: [U-Boot] [RESEND PATCH v2 12/13] davinci: omapl138-lcdk: enable driver-model in SPL

2019-11-13 Thread Bartosz Golaszewski
pon., 11 lis 2019 o 13:58 Adam Ford  napisał(a):
>
> On Fri, Nov 8, 2019 at 11:59 AM Bartosz Golaszewski  wrote:
> >
> > pt., 8 lis 2019 o 18:33 Bartosz Golaszewski
> >  napisał(a):
> > >
> > > pt., 8 lis 2019 o 17:14 Adam Ford  napisał(a):
> > > >
> > > > On Fri, Nov 8, 2019 at 9:50 AM Bartosz Golaszewski
> > > >  wrote:
> > > > >
> > > > > pt., 25 paź 2019 o 18:10 Bartosz Golaszewski  
> > > > > napisał(a):
> > > > > >
> > > > > > czw., 26 wrz 2019 o 01:21 Faiz Abbas  napisał(a):
> > > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
> > > > > > > > From: Bartosz Golaszewski 
> > > > > > > >
> > > > > > > > Enable CONFIG_SPL_DM and enable the driver model for serial by 
> > > > > > > > defining
> > > > > > > > an appropriate device in the board file for da850-lcdk.
> > > > > > > >
> > > > > > >
> > > > > > > This breaks booting from MMC on omapl138_lcdk. You didn't add a
> > > > > > > U_BOOT_DEVICE for the mmc node.
> > > > > > >
> > > > > > > Thanks,
> > > > > > > Faiz
> > > > > >
> > > > > > Just letting you know I haven't forgotten about this. I finally got
> > > > > > some time to work on it this week, but it turned out to be
> > > > > > non-trivial, as for some reason the set_cmd mmc callback is not 
> > > > > > being
> > > > > > properly assigned in SPL with driver-model and I couldn't find out 
> > > > > > why
> > > > > > so far. Next week I'm at ELCE, but I'll be back at it on Thursday. 
> > > > > > I'm
> > > > > > not sure if you want to revert the offending patch for now or this 
> > > > > > can
> > > > > > wait for another week?
> > > > > >
> > > > > > Best regards,
> > > > > > Bartosz Golaszewski
> > > > >
> > > > > I've been working on this some more this week and noticed that in SPL
> > > > > for some reason the bind function of the mmc driver is not called
> > > > > (despite the driver being probed fine), but so far I've been unable to
> > > > > figure out why exactly. This is the reason for the failure as the mmc
> > > > > is not properly setup but the mmc core thinks it is and tries using
> > > > > it.
> > > > >
> > > > > I've tried both using a U_BOOT_DEVICE() defined in the board file or
> > > > > adding the mmc node to arch/arm/dts/da850-lcdk-u-boot.dtsi.
> > > > >
> > > > > Adam: you know davinci's SPL pretty well - do you have any 
> > > > > suggestions?
> > > >
> > > > I am not sure that I know it well.  It's just one of several TI
> > > > platforms that I support for Logic PD.
> > > >
> > > > Two thoughts I had:  There are aliases setup for various peripherals
> > > > but I am not seeing one for mmc0 =   I a not sure if it will
> > > > help or not but it is different I see.
> > > >
> > >
> > > I'm having the same problem even when I'm defining the device using
> > > U_BOOT_DEVICE() in the relevant board file.
> > >
> > > > There is also a function void board_boot_order (u32 *spl_boot_list)
> > > > which can force the system to boot from a given device (ie, MMC1).
> > > > It's an optional function, but it's a quick and dirty option to try.
> > > >
> > >
> > > Thanks, I'll take a look at that.
> >
> > It's still the same, no matter what order I specify here.
> >
> > One thing that bothers me is: if I manually call mmc_bind() from probe
> > instead of the bind() callback, it fails with ENOMEM on memory
> > allocation when creating the block device. I'm wondering if it has
> > something to do with the simple malloc we're using now.
>
> Over the weekend, I sent a series of patches.  One of them, [1], was
> to increase the size of the available RAM before relocation. I believe
> i doubled the amount from 1k to 2k.
>
> Can you see if the ENMOM error still exists?
>

Hi Adam,

thanks a lot, this helps with memory. I can even boot from mmc if I
manually call mmc_bind() from probe, but the bind callback is still
not called even with DM_FLAG_PRE_RELOC added to mmc driver's flags.

I'm still working on it though, must be some minor detail.

Bart

> [1] - https://patchwork.ozlabs.org/patch/1192574/
>
> adam
> >
> > Bart
> >
> > >
> > > > What are the jumper settings to boot from SD,  I have an lcdk I can
> > > > try when I have some time.  It's not an official board I can support,
> > > > but I can tinker when I'm off the clock.
> > > >
> > >
> > > When looking at the board with the ethernet port in the upper-right
> > > corner the jumpers should be like this:
> > >
> > > ---^
> > >
> > > You can flash the .ais image onto an SD card with the following command:
> > >
> > > dd if=u-boot.ais of= seek=117 bs=512 conv=fsync
> > >
> > > Thanks!
> > > Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 12/13] davinci: omapl138-lcdk: enable driver-model in SPL

2019-11-08 Thread Bartosz Golaszewski
pt., 8 lis 2019 o 17:14 Adam Ford  napisał(a):
>
> On Fri, Nov 8, 2019 at 9:50 AM Bartosz Golaszewski
>  wrote:
> >
> > pt., 25 paź 2019 o 18:10 Bartosz Golaszewski  napisał(a):
> > >
> > > czw., 26 wrz 2019 o 01:21 Faiz Abbas  napisał(a):
> > > >
> > > > Hi,
> > > >
> > > > On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
> > > > > From: Bartosz Golaszewski 
> > > > >
> > > > > Enable CONFIG_SPL_DM and enable the driver model for serial by 
> > > > > defining
> > > > > an appropriate device in the board file for da850-lcdk.
> > > > >
> > > >
> > > > This breaks booting from MMC on omapl138_lcdk. You didn't add a
> > > > U_BOOT_DEVICE for the mmc node.
> > > >
> > > > Thanks,
> > > > Faiz
> > >
> > > Just letting you know I haven't forgotten about this. I finally got
> > > some time to work on it this week, but it turned out to be
> > > non-trivial, as for some reason the set_cmd mmc callback is not being
> > > properly assigned in SPL with driver-model and I couldn't find out why
> > > so far. Next week I'm at ELCE, but I'll be back at it on Thursday. I'm
> > > not sure if you want to revert the offending patch for now or this can
> > > wait for another week?
> > >
> > > Best regards,
> > > Bartosz Golaszewski
> >
> > I've been working on this some more this week and noticed that in SPL
> > for some reason the bind function of the mmc driver is not called
> > (despite the driver being probed fine), but so far I've been unable to
> > figure out why exactly. This is the reason for the failure as the mmc
> > is not properly setup but the mmc core thinks it is and tries using
> > it.
> >
> > I've tried both using a U_BOOT_DEVICE() defined in the board file or
> > adding the mmc node to arch/arm/dts/da850-lcdk-u-boot.dtsi.
> >
> > Adam: you know davinci's SPL pretty well - do you have any suggestions?
>
> I am not sure that I know it well.  It's just one of several TI
> platforms that I support for Logic PD.
>
> Two thoughts I had:  There are aliases setup for various peripherals
> but I am not seeing one for mmc0 =   I a not sure if it will
> help or not but it is different I see.
>

I'm having the same problem even when I'm defining the device using
U_BOOT_DEVICE() in the relevant board file.

> There is also a function void board_boot_order (u32 *spl_boot_list)
> which can force the system to boot from a given device (ie, MMC1).
> It's an optional function, but it's a quick and dirty option to try.
>

Thanks, I'll take a look at that.

> What are the jumper settings to boot from SD,  I have an lcdk I can
> try when I have some time.  It's not an official board I can support,
> but I can tinker when I'm off the clock.
>

When looking at the board with the ethernet port in the upper-right
corner the jumpers should be like this:

---^

You can flash the .ais image onto an SD card with the following command:

dd if=u-boot.ais of= seek=117 bs=512 conv=fsync

Thanks!
Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 12/13] davinci: omapl138-lcdk: enable driver-model in SPL

2019-11-08 Thread Bartosz Golaszewski
pt., 8 lis 2019 o 18:33 Bartosz Golaszewski
 napisał(a):
>
> pt., 8 lis 2019 o 17:14 Adam Ford  napisał(a):
> >
> > On Fri, Nov 8, 2019 at 9:50 AM Bartosz Golaszewski
> >  wrote:
> > >
> > > pt., 25 paź 2019 o 18:10 Bartosz Golaszewski  napisał(a):
> > > >
> > > > czw., 26 wrz 2019 o 01:21 Faiz Abbas  napisał(a):
> > > > >
> > > > > Hi,
> > > > >
> > > > > On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
> > > > > > From: Bartosz Golaszewski 
> > > > > >
> > > > > > Enable CONFIG_SPL_DM and enable the driver model for serial by 
> > > > > > defining
> > > > > > an appropriate device in the board file for da850-lcdk.
> > > > > >
> > > > >
> > > > > This breaks booting from MMC on omapl138_lcdk. You didn't add a
> > > > > U_BOOT_DEVICE for the mmc node.
> > > > >
> > > > > Thanks,
> > > > > Faiz
> > > >
> > > > Just letting you know I haven't forgotten about this. I finally got
> > > > some time to work on it this week, but it turned out to be
> > > > non-trivial, as for some reason the set_cmd mmc callback is not being
> > > > properly assigned in SPL with driver-model and I couldn't find out why
> > > > so far. Next week I'm at ELCE, but I'll be back at it on Thursday. I'm
> > > > not sure if you want to revert the offending patch for now or this can
> > > > wait for another week?
> > > >
> > > > Best regards,
> > > > Bartosz Golaszewski
> > >
> > > I've been working on this some more this week and noticed that in SPL
> > > for some reason the bind function of the mmc driver is not called
> > > (despite the driver being probed fine), but so far I've been unable to
> > > figure out why exactly. This is the reason for the failure as the mmc
> > > is not properly setup but the mmc core thinks it is and tries using
> > > it.
> > >
> > > I've tried both using a U_BOOT_DEVICE() defined in the board file or
> > > adding the mmc node to arch/arm/dts/da850-lcdk-u-boot.dtsi.
> > >
> > > Adam: you know davinci's SPL pretty well - do you have any suggestions?
> >
> > I am not sure that I know it well.  It's just one of several TI
> > platforms that I support for Logic PD.
> >
> > Two thoughts I had:  There are aliases setup for various peripherals
> > but I am not seeing one for mmc0 =   I a not sure if it will
> > help or not but it is different I see.
> >
>
> I'm having the same problem even when I'm defining the device using
> U_BOOT_DEVICE() in the relevant board file.
>
> > There is also a function void board_boot_order (u32 *spl_boot_list)
> > which can force the system to boot from a given device (ie, MMC1).
> > It's an optional function, but it's a quick and dirty option to try.
> >
>
> Thanks, I'll take a look at that.

It's still the same, no matter what order I specify here.

One thing that bothers me is: if I manually call mmc_bind() from probe
instead of the bind() callback, it fails with ENOMEM on memory
allocation when creating the block device. I'm wondering if it has
something to do with the simple malloc we're using now.

Bart

>
> > What are the jumper settings to boot from SD,  I have an lcdk I can
> > try when I have some time.  It's not an official board I can support,
> > but I can tinker when I'm off the clock.
> >
>
> When looking at the board with the ethernet port in the upper-right
> corner the jumpers should be like this:
>
> ---^
>
> You can flash the .ais image onto an SD card with the following command:
>
> dd if=u-boot.ais of= seek=117 bs=512 conv=fsync
>
> Thanks!
> Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 12/13] davinci: omapl138-lcdk: enable driver-model in SPL

2019-11-08 Thread Bartosz Golaszewski
pt., 25 paź 2019 o 18:10 Bartosz Golaszewski  napisał(a):
>
> czw., 26 wrz 2019 o 01:21 Faiz Abbas  napisał(a):
> >
> > Hi,
> >
> > On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
> > > From: Bartosz Golaszewski 
> > >
> > > Enable CONFIG_SPL_DM and enable the driver model for serial by defining
> > > an appropriate device in the board file for da850-lcdk.
> > >
> >
> > This breaks booting from MMC on omapl138_lcdk. You didn't add a
> > U_BOOT_DEVICE for the mmc node.
> >
> > Thanks,
> > Faiz
>
> Just letting you know I haven't forgotten about this. I finally got
> some time to work on it this week, but it turned out to be
> non-trivial, as for some reason the set_cmd mmc callback is not being
> properly assigned in SPL with driver-model and I couldn't find out why
> so far. Next week I'm at ELCE, but I'll be back at it on Thursday. I'm
> not sure if you want to revert the offending patch for now or this can
> wait for another week?
>
> Best regards,
> Bartosz Golaszewski

I've been working on this some more this week and noticed that in SPL
for some reason the bind function of the mmc driver is not called
(despite the driver being probed fine), but so far I've been unable to
figure out why exactly. This is the reason for the failure as the mmc
is not properly setup but the mmc core thinks it is and tries using
it.

I've tried both using a U_BOOT_DEVICE() defined in the board file or
adding the mmc node to arch/arm/dts/da850-lcdk-u-boot.dtsi.

Adam: you know davinci's SPL pretty well - do you have any suggestions?

Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 12/13] davinci: omapl138-lcdk: enable driver-model in SPL

2019-10-28 Thread Bartosz Golaszewski
pt., 25 paź 2019 o 19:25 Rizvi, Mohammad Faiz Abbas
 napisał(a):
>
> Hi Barotz,
>

It's Bartosz - it's literally on the next line of the e-mail too. :)

> On 10/25/2019 9:40 PM, Bartosz Golaszewski wrote:
> > czw., 26 wrz 2019 o 01:21 Faiz Abbas  napisał(a):
> >>
> >> Hi,
> >>
> >> On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
> >>> From: Bartosz Golaszewski 
> >>>
> >>> Enable CONFIG_SPL_DM and enable the driver model for serial by defining
> >>> an appropriate device in the board file for da850-lcdk.
> >>>
> >>
> >> This breaks booting from MMC on omapl138_lcdk. You didn't add a
> >> U_BOOT_DEVICE for the mmc node.
> >>
> >> Thanks,
> >> Faiz
> >
> > Just letting you know I haven't forgotten about this. I finally got
> > some time to work on it this week, but it turned out to be
> > non-trivial, as for some reason the set_cmd mmc callback is not being
> > properly assigned in SPL with driver-model and I couldn't find out why
> > so far.
>
> I will try to look at it as well.
>
>  Next week I'm at ELCE, but I'll be back at it on Thursday.
>
> I'm at ELC as well. Will be nice to meet up with you and discuss this if
> you want.
>

Sure, I'll be doing a talk on Wednesday, may be a good time to catch
me afterwards.

Bartosz

> Thanks,
> Faiz
>
>
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 12/13] davinci: omapl138-lcdk: enable driver-model in SPL

2019-10-25 Thread Bartosz Golaszewski
czw., 26 wrz 2019 o 01:21 Faiz Abbas  napisał(a):
>
> Hi,
>
> On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski 
> >
> > Enable CONFIG_SPL_DM and enable the driver model for serial by defining
> > an appropriate device in the board file for da850-lcdk.
> >
>
> This breaks booting from MMC on omapl138_lcdk. You didn't add a
> U_BOOT_DEVICE for the mmc node.
>
> Thanks,
> Faiz

Just letting you know I haven't forgotten about this. I finally got
some time to work on it this week, but it turned out to be
non-trivial, as for some reason the set_cmd mmc callback is not being
properly assigned in SPL with driver-model and I couldn't find out why
so far. Next week I'm at ELCE, but I'll be back at it on Thursday. I'm
not sure if you want to revert the offending patch for now or this can
wait for another week?

Best regards,
Bartosz Golaszewski
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v2 03/13] i2c: remove i2c driver-model compatibility layer

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

There are no more users of the compatibility layer for i2c. Remove the
driver and all references to it.

Signed-off-by: Bartosz Golaszewski 
Acked-by: Heiko Schocher 
---
 Makefile|   7 --
 drivers/i2c/Kconfig |  13 +---
 drivers/i2c/Makefile|   1 -
 drivers/i2c/i2c-uclass-compat.c | 128 
 include/_exports.h  |   3 +-
 include/exports.h   |   3 +-
 include/i2c.h   |  80 
 7 files changed, 3 insertions(+), 232 deletions(-)
 delete mode 100644 drivers/i2c/i2c-uclass-compat.c

diff --git a/Makefile b/Makefile
index 252525bf0a..bff5a402a7 100644
--- a/Makefile
+++ b/Makefile
@@ -936,13 +936,6 @@ ifneq ($(CONFIG_DM_SPI)$(CONFIG_OF_CONTROL),yy)
 endif
 endif
 endif
-ifeq ($(CONFIG_DM_I2C_COMPAT),y)
-   @echo >&2 "= WARNING =="
-   @echo >&2 "This board uses CONFIG_DM_I2C_COMPAT. Please remove"
-   @echo >&2 "(possibly in a subsequent patch in your series)"
-   @echo >&2 "before sending patches to the mailing list."
-   @echo >&2 ""
-endif
 ifeq ($(CONFIG_MMC),y)
 ifneq ($(CONFIG_DM_MMC)$(CONFIG_OF_CONTROL)$(CONFIG_BLK),yyy)
@echo >&2 "= WARNING =="
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 4772db3837..03d2fed341 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -12,18 +12,7 @@ config DM_I2C
  write and speed, is implemented with the bus drivers operations,
  which provide methods for bus setting and data transfer. Each chip
  device (bus child) info is kept as parent platdata. The interface
- is defined in include/i2c.h. When i2c bus driver supports the i2c
- uclass, but the device drivers not, then DM_I2C_COMPAT config can
- be used as compatibility layer.
-
-config DM_I2C_COMPAT
-   bool "Enable I2C compatibility layer"
-   depends on DM
-   help
- Enable old-style I2C functions for compatibility with existing code.
- This option can be enabled as a temporary measure to avoid needing
- to convert all code for a board in a single commit. It should not
- be enabled for any board in an official release.
+ is defined in include/i2c.h.
 
 config I2C_CROS_EC_TUNNEL
tristate "Chrome OS EC tunnel I2C bus"
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index dc40055efb..c2f75d8755 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -3,7 +3,6 @@
 # (C) Copyright 2000-2007
 # Wolfgang Denk, DENX Software Engineering, w...@denx.de.
 obj-$(CONFIG_DM_I2C) += i2c-uclass.o
-obj-$(CONFIG_DM_I2C_COMPAT) += i2c-uclass-compat.o
 obj-$(CONFIG_DM_I2C_GPIO) += i2c-gpio.o
 obj-$(CONFIG_$(SPL_)I2C_CROS_EC_TUNNEL) += cros_ec_tunnel.o
 obj-$(CONFIG_$(SPL_)I2C_CROS_EC_LDO) += cros_ec_ldo.o
diff --git a/drivers/i2c/i2c-uclass-compat.c b/drivers/i2c/i2c-uclass-compat.c
deleted file mode 100644
index b3ade88113..00
--- a/drivers/i2c/i2c-uclass-compat.c
+++ /dev/null
@@ -1,128 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (c) 2014 Google, Inc
- */
-
-#include 
-#include 
-#include 
-#include 
-
-static int cur_busnum __attribute__((section(".data")));
-
-static int i2c_compat_get_device(uint chip_addr, int alen,
-struct udevice **devp)
-{
-   struct dm_i2c_chip *chip;
-   int ret;
-
-   ret = i2c_get_chip_for_busnum(cur_busnum, chip_addr, alen, devp);
-   if (ret)
-   return ret;
-   chip = dev_get_parent_platdata(*devp);
-   if (chip->offset_len != alen) {
-   printf("I2C chip %x: requested alen %d does not match chip 
offset_len %d\n",
-  chip_addr, alen, chip->offset_len);
-   return -EADDRNOTAVAIL;
-   }
-
-   return 0;
-}
-
-int i2c_probe(uint8_t chip_addr)
-{
-   struct udevice *bus, *dev;
-   int ret;
-
-   ret = uclass_get_device_by_seq(UCLASS_I2C, cur_busnum, );
-   if (ret) {
-   debug("Cannot find I2C bus %d: err=%d\n", cur_busnum, ret);
-   return ret;
-   }
-
-   if (!bus)
-   return -ENOENT;
-
-   return dm_i2c_probe(bus, chip_addr, 0, );
-}
-
-int i2c_read(uint8_t chip_addr, unsigned int addr, int alen, uint8_t *buffer,
-int len)
-{
-   struct udevice *dev;
-   int ret;
-
-   ret = i2c_compat_get_device(chip_addr, alen, );
-   if (ret)
-   return ret;
-
-   return dm_i2c_read(dev, addr, buffer, len);
-}
-
-int i2c_write(uint8_t chip_addr, unsigned int addr, int alen, uint8_t *buffer,
- int len)
-{
-   struct udevice *dev;
-

[U-Boot] [RESEND PATCH v2 13/13] configs: omapl138_lcdk: enable NAND self-init in SPL

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Now that we have enabled the driver-model in SPL, we can remove the
code disabling NAND self-init in SPL from the config include for
omapl138-lcdk.

Signed-off-by: Bartosz Golaszewski 
---
 include/configs/omapl138_lcdk.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h
index 20fd7ff713..db4a663c53 100644
--- a/include/configs/omapl138_lcdk.h
+++ b/include/configs/omapl138_lcdk.h
@@ -168,10 +168,6 @@
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
 #define CONFIG_SPL_NAND_LOAD
-
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_SYS_NAND_SELF_INIT
-#endif
 #endif
 
 #ifdef CONFIG_SYS_USE_NOR
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v2 10/13] davinci: omapl138-lcdk: enable CONFIG_USE_TINY_PRINTF

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

We're working towards enabling the driver-model in SPL for da850-lcdk.
Enable CONFIG_USE_TINY_PRINTF in defconfig to reduce SPL size.

Signed-off-by: Bartosz Golaszewski 
---
 configs/omapl138_lcdk_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index bfb88e397a..c4eebb3612 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -53,3 +53,4 @@ CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
+CONFIG_USE_TINY_PRINTF=y
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v2 07/13] davinci: omapl138-lcdk: enable driver model for NAND

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Enable the driver-model on da850-lcdk. We need to add a dummy nand node
to the device tree, as the real nand node is a sub-node of the aemif
device.

On linux the aemif driver populates all its child nodes, but we can't do
it in u-boot currently.

Signed-off-by: Bartosz Golaszewski 
---
 arch/arm/dts/da850-lcdk-u-boot.dtsi | 4 
 configs/omapl138_lcdk_defconfig | 1 +
 include/configs/omapl138_lcdk.h | 4 
 3 files changed, 9 insertions(+)

diff --git a/arch/arm/dts/da850-lcdk-u-boot.dtsi 
b/arch/arm/dts/da850-lcdk-u-boot.dtsi
index 80dda8ef58..541f4ca200 100644
--- a/arch/arm/dts/da850-lcdk-u-boot.dtsi
+++ b/arch/arm/dts/da850-lcdk-u-boot.dtsi
@@ -9,4 +9,8 @@
aliases {
i2c0 = 
};
+
+   nand {
+   compatible = "ti,davinci-nand";
+   };
 };
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 7752308564..fa4ce692ff 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -39,6 +39,7 @@ CONFIG_DM=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
+CONFIG_MTD=y
 CONFIG_NAND=y
 CONFIG_NAND_DAVINCI=y
 CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h
index db4a663c53..20fd7ff713 100644
--- a/include/configs/omapl138_lcdk.h
+++ b/include/configs/omapl138_lcdk.h
@@ -168,6 +168,10 @@
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
 #define CONFIG_SPL_NAND_LOAD
+
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_SYS_NAND_SELF_INIT
+#endif
 #endif
 
 #ifdef CONFIG_SYS_USE_NOR
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v2 06/13] nand: davinci: add support for driver model

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Extend the davinci NAND driver to support the driver model. For now this
doesn't add any device-tree parsing due to the fact that we can't access
the actual nand node on the device-tree - it's a subnode of the aemif
device and we don't have an aemif driver on davinci at the moment.

Signed-off-by: Bartosz Golaszewski 
---
 drivers/mtd/nand/raw/davinci_nand.c | 46 -
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/davinci_nand.c 
b/drivers/mtd/nand/raw/davinci_nand.c
index e1c4498cb9..33c2f16be8 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* Definitions for 4-bit hardware ECC */
@@ -785,10 +786,53 @@ static void davinci_nand_init(struct nand_chip *nand)
nand->dev_ready = nand_davinci_dev_ready;
 }
 
-int board_nand_init(struct nand_chip *chip) __attribute__((weak));
+#ifdef CONFIG_SYS_NAND_SELF_INIT
+static int davinci_nand_probe(struct udevice *dev)
+{
+   struct nand_chip *nand = dev_get_priv(dev);
+   struct mtd_info *mtd = nand_to_mtd(nand);
+   int ret;
+
+   nand->IO_ADDR_R = (void __iomem *)CONFIG_SYS_NAND_BASE;
+   nand->IO_ADDR_W = (void __iomem *)CONFIG_SYS_NAND_BASE;
+
+   davinci_nand_init(nand);
+
+   ret = nand_scan(mtd, CONFIG_SYS_NAND_MAX_CHIPS);
+   if (ret)
+   return ret;
+
+   return nand_register(0, mtd);
+}
+
+static const struct udevice_id davinci_nand_ids[] = {
+   { .compatible = "ti,davinci-nand" },
+   { }
+};
+
+U_BOOT_DRIVER(davinci_nand) = {
+   .name   = "davinci-nand",
+   .id = UCLASS_MTD,
+   .of_match   = davinci_nand_ids,
+   .probe  = davinci_nand_probe,
+   .priv_auto_alloc_size = sizeof(struct nand_chip),
+};
+
+void board_nand_init(void)
+{
+   struct udevice *dev;
+   int ret;
 
+   ret = uclass_get_device_by_driver(UCLASS_MTD,
+ DM_GET_DRIVER(davinci_nand), );
+   if (ret && ret != -ENODEV)
+   pr_err("Failed to initialize %s: %d\n", dev->name, ret);
+}
+#else
+int board_nand_init(struct nand_chip *chip) __attribute__((weak));
 int board_nand_init(struct nand_chip *chip)
 {
davinci_nand_init(chip);
return 0;
 }
+#endif /* CONFIG_SYS_NAND_SELF_INIT */
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v2 12/13] davinci: omapl138-lcdk: enable driver-model in SPL

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Enable CONFIG_SPL_DM and enable the driver model for serial by defining
an appropriate device in the board file for da850-lcdk.

Signed-off-by: Bartosz Golaszewski 
---
 board/davinci/da8xxevm/omapl138_lcdk.c | 16 
 configs/omapl138_lcdk_defconfig|  5 +
 2 files changed, 21 insertions(+)

diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index 7f8c28b953..578d928443 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -14,6 +14,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -355,3 +357,17 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 #endif
+
+#ifdef CONFIG_SPL_BUILD
+static const struct ns16550_platdata serial_pdata = {
+   .base = DAVINCI_UART2_BASE,
+   .reg_shift = 2,
+   .clock = 22800,
+   .fcr = UART_FCR_DEFVAL,
+};
+
+U_BOOT_DEVICE(omapl138_uart) = {
+   .name = "ns16550_serial",
+   .platdata = _pdata,
+};
+#endif
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index c4eebb3612..26b4950f8f 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -33,10 +33,13 @@ CONFIG_CMD_MTDPARTS=y
 CONFIG_CMD_DIAG=y
 CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="da850-lcdk"
+CONFIG_SPL_OF_PLATDATA=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
+CONFIG_SPL_DM=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
@@ -51,6 +54,8 @@ CONFIG_SF_DEFAULT_SPEED=3000
 CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
+CONFIG_SPECIFY_CONSOLE_INDEX=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_USE_TINY_PRINTF=y
+# CONFIG_SPL_OF_LIBFDT is not set
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v2 04/13] omapl138_lcdk_defconfig: don't build support for SPI

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

The following warning is emited when building u-boot for da850-lcdk:

= WARNING ==
This board does not use CONFIG_DM_SPI. Please update
the board before v2019.04 for no dm conversion
and v2019.07 for partially dm converted drivers.
Failure to update can lead to driver/board removal
See doc/driver-model/MIGRATION.txt for more info.

= WARNING ==
This board does not use CONFIG_DM_SPI_FLASH. Please update
the board to use CONFIG_SPI_FLASH before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.


While we could fix it by selecting CONFIG_DM_SPI, there's no need to
build it at all as SPI is disabled on da850-lcdk. Remove all unneeded
options from the defconfig.

Signed-off-by: Bartosz Golaszewski 
Acked-by: Heiko Schocher 
---
 configs/omapl138_lcdk_defconfig | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index b5d41bd3f6..7752308564 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -26,6 +26,7 @@ CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_GPIO is not set
 CONFIG_CMD_NAND=y
+# CONFIG_CMD_SPI is not set
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_MTDPARTS=y
 CONFIG_CMD_DIAG=y
@@ -44,14 +45,9 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x28000
 CONFIG_SPL_NAND_SIMPLE=y
-CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=3000
-CONFIG_SPI_FLASH_STMICRO=y
-CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
-CONFIG_SPI=y
-CONFIG_DAVINCI_SPI=y
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v2 09/13] davinci: omapl138-lcdk: enable SPL_SYS_MALLOC_SIMPLE

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

We're working towards enabling the driver model in SPL for da850-lcdk.
Enable SPL_SYS_MALLOC_SIMPLE in defconfig to reduce SPL size.

Signed-off-by: Bartosz Golaszewski 
---
 configs/omapl138_lcdk_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index fa4ce692ff..bfb88e397a 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -18,6 +18,7 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_TEXT_BASE=0x8000
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_HUSH_PARSER=y
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v2 02/13] sandbox: remove CONFIG_DM_I2C_COMPAT from defconfigs

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

There are no more "real" users of CONFIG_DM_I2C_COMPAT and we'll soon
remove it altogether. Stop building it in sandbox mode.

Signed-off-by: Bartosz Golaszewski 
Acked-by: Heiko Schocher 
---
 Makefile   | 2 +-
 configs/sandbox64_defconfig| 1 -
 configs/sandbox_defconfig  | 1 -
 configs/sandbox_flattree_defconfig | 1 -
 configs/sandbox_noblk_defconfig| 1 -
 configs/sandbox_spl_defconfig  | 1 -
 configs/tools-only_defconfig   | 1 -
 7 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 704579bec1..252525bf0a 100644
--- a/Makefile
+++ b/Makefile
@@ -936,7 +936,7 @@ ifneq ($(CONFIG_DM_SPI)$(CONFIG_OF_CONTROL),yy)
 endif
 endif
 endif
-ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
+ifeq ($(CONFIG_DM_I2C_COMPAT),y)
@echo >&2 "= WARNING =="
@echo >&2 "This board uses CONFIG_DM_I2C_COMPAT. Please remove"
@echo >&2 "(possibly in a subsequent patch in your series)"
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
index 827b8761cd..c177ff8ad5 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -89,7 +89,6 @@ CONFIG_BOARD=y
 CONFIG_BOARD_SANDBOX=y
 CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 62594e3c21..aa09c4571a 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -107,7 +107,6 @@ CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
 CONFIG_DM_HWSPINLOCK=y
 CONFIG_HWSPINLOCK_SANDBOX=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/sandbox_flattree_defconfig 
b/configs/sandbox_flattree_defconfig
index 2429ae4621..a70793b7ad 100644
--- a/configs/sandbox_flattree_defconfig
+++ b/configs/sandbox_flattree_defconfig
@@ -75,7 +75,6 @@ CONFIG_BOARD=y
 CONFIG_BOARD_SANDBOX=y
 CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/sandbox_noblk_defconfig b/configs/sandbox_noblk_defconfig
index da9229fc79..381bad2003 100644
--- a/configs/sandbox_noblk_defconfig
+++ b/configs/sandbox_noblk_defconfig
@@ -81,7 +81,6 @@ CONFIG_BOARD=y
 CONFIG_BOARD_SANDBOX=y
 CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig
index 27034cfaa9..c40a79cc73 100644
--- a/configs/sandbox_spl_defconfig
+++ b/configs/sandbox_spl_defconfig
@@ -95,7 +95,6 @@ CONFIG_BOARD=y
 CONFIG_BOARD_SANDBOX=y
 CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig
index aa73661a92..4808b49850 100644
--- a/configs/tools-only_defconfig
+++ b/configs/tools-only_defconfig
@@ -12,7 +12,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sandbox"
 CONFIG_IP_DEFRAG=y
 # CONFIG_UDP_FUNCTION_FASTBOOT is not set
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_PCI_SANDBOX=y
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v2 08/13] davinci: da850-evm: enable driver model for NAND

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Enable the driver-model on da850-evm. We need to add a dummy nand node
to the device tree, as the real nand node is a sub-node of the aemif
device.

On linux the aemif driver populates all its child nodes, but we can't do
it in u-boot currently.

Signed-off-by: Bartosz Golaszewski 
Tested-by: Adam Ford  #da850-evm
---
 arch/arm/dts/da850-evm-u-boot.dtsi| 4 
 configs/da850evm_defconfig| 1 +
 configs/da850evm_direct_nor_defconfig | 1 +
 configs/da850evm_nand_defconfig   | 1 +
 include/configs/da850evm.h| 4 
 5 files changed, 11 insertions(+)

diff --git a/arch/arm/dts/da850-evm-u-boot.dtsi 
b/arch/arm/dts/da850-evm-u-boot.dtsi
index 1683f3472e..d9e8b9926a 100644
--- a/arch/arm/dts/da850-evm-u-boot.dtsi
+++ b/arch/arm/dts/da850-evm-u-boot.dtsi
@@ -10,6 +10,10 @@
soc@1c0 {
u-boot,dm-spl;
};
+
+   nand {
+   compatible = "ti,davinci-nand";
+   };
 };
 
  {
diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
index 99300cb297..7de1d2ffc4 100644
--- a/configs/da850evm_defconfig
+++ b/configs/da850evm_defconfig
@@ -52,6 +52,7 @@ CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
+CONFIG_MTD=y
 CONFIG_MTD_DEVICE=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
diff --git a/configs/da850evm_direct_nor_defconfig 
b/configs/da850evm_direct_nor_defconfig
index dcb4d96d0d..e3c2d13986 100644
--- a/configs/da850evm_direct_nor_defconfig
+++ b/configs/da850evm_direct_nor_defconfig
@@ -42,6 +42,7 @@ CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 # CONFIG_MMC is not set
+CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
diff --git a/configs/da850evm_nand_defconfig b/configs/da850evm_nand_defconfig
index 7065205783..96602e514a 100644
--- a/configs/da850evm_nand_defconfig
+++ b/configs/da850evm_nand_defconfig
@@ -49,6 +49,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+CONFIG_MTD=y
 CONFIG_NAND=y
 CONFIG_NAND_DAVINCI=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index 2dab17afab..ff536131ba 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -174,6 +174,10 @@
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
 #define CONFIG_SPL_NAND_LOAD
+
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_SYS_NAND_SELF_INIT
+#endif
 #endif
 
 /*
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v2 11/13] davinci: omapl138-lcdk: remove unneeded includes

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

There's no SPI on da850-lcdk. Remove unnecessary includes.

Signed-off-by: Bartosz Golaszewski 
---
 board/davinci/da8xxevm/omapl138_lcdk.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index dd11551428..7f8c28b953 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -11,8 +11,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v2 05/13] nand: davinci: make davinci_nand_init() static

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

This function is only used within the driver itself. No need
to export it.

Signed-off-by: Bartosz Golaszewski 
---
 arch/arm/include/asm/ti-common/davinci_nand.h | 2 --
 drivers/mtd/nand/raw/davinci_nand.c   | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/ti-common/davinci_nand.h 
b/arch/arm/include/asm/ti-common/davinci_nand.h
index e26381c7fd..28842c3b15 100644
--- a/arch/arm/include/asm/ti-common/davinci_nand.h
+++ b/arch/arm/include/asm/ti-common/davinci_nand.h
@@ -95,6 +95,4 @@ struct davinci_emif_regs {
 #define DAVINCI_ABCR_ASIZE_16BIT   1
 #define DAVINCI_ABCR_ASIZE_8BIT0
 
-void davinci_nand_init(struct nand_chip *nand);
-
 #endif
diff --git a/drivers/mtd/nand/raw/davinci_nand.c 
b/drivers/mtd/nand/raw/davinci_nand.c
index cfa9b535c8..e1c4498cb9 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -730,7 +730,7 @@ static int nand_davinci_dev_ready(struct mtd_info *mtd)
return __raw_readl(_emif_regs->nandfsr) & 0x1;
 }
 
-void davinci_nand_init(struct nand_chip *nand)
+static void davinci_nand_init(struct nand_chip *nand)
 {
 #if defined CONFIG_KEYSTONE_RBL_NAND
int i;
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v2 01/13] davinci: remove CONFIG_DM_I2C_COMPAT from defconfigs

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

This option is no longer used on any davinci board but still selected
in defconfigs which causes the following warning:

= WARNING ==
This board uses CONFIG_DM_I2C_COMPAT. Please remove
(possibly in a subsequent patch in your series)
before sending patches to the mailing list.


Remove all references to CONFIG_DM_I2C_COMPAT from davinci.

Signed-off-by: Bartosz Golaszewski 
Acked-by: Heiko Schocher 
---
 configs/da850_am18xxevm_defconfig | 1 -
 configs/omapl138_lcdk_defconfig   | 1 -
 include/configs/am3517_evm.h  | 1 -
 include/configs/omapl138_lcdk.h   | 8 
 4 files changed, 11 deletions(-)

diff --git a/configs/da850_am18xxevm_defconfig 
b/configs/da850_am18xxevm_defconfig
index f7054b4a1e..bc6199822e 100644
--- a/configs/da850_am18xxevm_defconfig
+++ b/configs/da850_am18xxevm_defconfig
@@ -43,7 +43,6 @@ CONFIG_DM=y
 CONFIG_SPL_DM=y
 CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_MTD_DEVICE=y
 CONFIG_DM_SPI_FLASH=y
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 466ae860cd..b5d41bd3f6 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -36,7 +36,6 @@ CONFIG_ENV_IS_IN_NAND=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_DM_I2C=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
 CONFIG_NAND=y
diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h
index 2e8481890f..c2c5c1f668 100644
--- a/include/configs/am3517_evm.h
+++ b/include/configs/am3517_evm.h
@@ -14,7 +14,6 @@
 
 #include 
 
-#undef CONFIG_DM_I2C_COMPAT
 #define CONFIG_REVISION_TAG
 
 /* Hardware drivers */
diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h
index da615e5063..db4a663c53 100644
--- a/include/configs/omapl138_lcdk.h
+++ b/include/configs/omapl138_lcdk.h
@@ -16,14 +16,6 @@
 #undef CONFIG_USE_SPIFLASH
 #undef CONFIG_SYS_USE_NOR
 
-/*
-* Disable DM_* for SPL build and can be re-enabled after adding
-* DM support in SPL
-*/
-#ifdef CONFIG_SPL_BUILD
-#undef CONFIG_DM_I2C
-#undef CONFIG_DM_I2C_COMPAT
-#endif
 /*
  * SoC Configuration
  */
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [RESEND PATCH v2 00/13] ARM: davinci: driver-model improvements

2019-07-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

NOTE: emac conversion is already upstream, so dropped it from this
series. No other changes.

The following series contains all the patches for davinci that have
been sent to the mailing list recently rebased on top of v2019.07 and
retested on da850-lcdk and da850-evm. I collected all the review and
test tags too.

Patches 1-4 fix build warnings due to legacy interfaces usage. Patches
5-8 add support for driver model to the davinci NAND driver. Patches
9-12 enable driver-model support in SPL for davinci. Last patch enables
the driver model for NAND in SPL.

v1 -> v2:
- fixed a build error on da850_am18xx due to missing CONFIG_DM_ETH=y

Bartosz Golaszewski (13):
  davinci: remove CONFIG_DM_I2C_COMPAT from defconfigs
  sandbox: remove CONFIG_DM_I2C_COMPAT from defconfigs
  i2c: remove i2c driver-model compatibility layer
  omapl138_lcdk_defconfig: don't build support for SPI
  nand: davinci: make davinci_nand_init() static
  nand: davinci: add support for driver model
  davinci: omapl138-lcdk: enable driver model for NAND
  davinci: da850-evm: enable driver model for NAND
  davinci: omapl138-lcdk: enable SPL_SYS_MALLOC_SIMPLE
  davinci: omapl138-lcdk: enable CONFIG_USE_TINY_PRINTF
  davinci: omapl138-lcdk: remove unneeded includes
  davinci: omapl138-lcdk: enable driver-model in SPL
  configs: omapl138_lcdk: enable NAND self-init in SPL

 Makefile  |   7 -
 arch/arm/dts/da850-evm-u-boot.dtsi|   4 +
 arch/arm/dts/da850-lcdk-u-boot.dtsi   |   4 +
 arch/arm/include/asm/ti-common/davinci_nand.h |   2 -
 board/davinci/da8xxevm/omapl138_lcdk.c|  18 ++-
 configs/da850_am18xxevm_defconfig |   1 -
 configs/da850evm_defconfig|   1 +
 configs/da850evm_direct_nor_defconfig |   1 +
 configs/da850evm_nand_defconfig   |   1 +
 configs/omapl138_lcdk_defconfig   |  15 +-
 configs/sandbox64_defconfig   |   1 -
 configs/sandbox_defconfig |   1 -
 configs/sandbox_flattree_defconfig|   1 -
 configs/sandbox_noblk_defconfig   |   1 -
 configs/sandbox_spl_defconfig |   1 -
 configs/tools-only_defconfig  |   1 -
 drivers/i2c/Kconfig   |  13 +-
 drivers/i2c/Makefile  |   1 -
 drivers/i2c/i2c-uclass-compat.c   | 128 --
 drivers/mtd/nand/raw/davinci_nand.c   |  48 ++-
 include/_exports.h|   3 +-
 include/configs/am3517_evm.h  |   1 -
 include/configs/da850evm.h|   4 +
 include/configs/omapl138_lcdk.h   |   8 --
 include/exports.h |   3 +-
 include/i2c.h |  80 ---
 26 files changed, 89 insertions(+), 260 deletions(-)
 delete mode 100644 drivers/i2c/i2c-uclass-compat.c

-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 00/14] ARM: davinci: driver-model improvements

2019-07-29 Thread Bartosz Golaszewski
niedz., 28 lip 2019 o 19:12 Tom Rini  napisał(a):
>
> On Sun, Jul 28, 2019 at 06:46:57PM +0200, Bartosz Golaszewski wrote:
> > śr., 24 lip 2019 o 21:06 Joe Hershberger  
> > napisał(a):
> > >
> > > On Wed, Jul 24, 2019 at 3:12 AM Bartosz Golaszewski  wrote:
> > > >
> > > > From: Bartosz Golaszewski 
> > > >
> > > > The following series contains all the patches for davinci that have
> > > > been sent to the mailing list recently rebased on top of v2019.07 and
> > > > retested on da850-lcdk and da850-evm. I collected all the review and
> > > > test tags too.
> > > >
> > > > The first patch is the emac driver conversion to driver model. Patches
> > > > 2-5 fix build warnings due to legacy interfaces usage. Patches 6-9 add
> > > > support for driver model to the davinci NAND driver. Patches 10-13
> > > > enable driver-model support in SPL for davinci. Last patch enables the
> > > > driver model for NAND in SPL.
> > > >
> > > > These patches (except for the last, trivial one) have spent a lot of
> > > > time on the list and have been validated. I think they are ready to be
> > > > picked up for upstream.
> > > >
> > > > v1 -> v2:
> > > > - fixed a build error on da850_am18xx due to missing CONFIG_DM_ETH=y
> > >
> > > Heiko, want me to take this through my tree?
> > >
> > > Thanks,
> > > -Joe
> >
> > Hi Tom,
> >
> > could you pick up the rest of the patches? They've been on the list
> > for several weeks now.
>
> I thought Joe picked it all up, please repost whatever is missing,
> thanks.
>
> --
> Tom

No, he just picked up the emac conversion.

Resending now.

Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 00/14] ARM: davinci: driver-model improvements

2019-07-28 Thread Bartosz Golaszewski
śr., 24 lip 2019 o 21:06 Joe Hershberger  napisał(a):
>
> On Wed, Jul 24, 2019 at 3:12 AM Bartosz Golaszewski  wrote:
> >
> > From: Bartosz Golaszewski 
> >
> > The following series contains all the patches for davinci that have
> > been sent to the mailing list recently rebased on top of v2019.07 and
> > retested on da850-lcdk and da850-evm. I collected all the review and
> > test tags too.
> >
> > The first patch is the emac driver conversion to driver model. Patches
> > 2-5 fix build warnings due to legacy interfaces usage. Patches 6-9 add
> > support for driver model to the davinci NAND driver. Patches 10-13
> > enable driver-model support in SPL for davinci. Last patch enables the
> > driver model for NAND in SPL.
> >
> > These patches (except for the last, trivial one) have spent a lot of
> > time on the list and have been validated. I think they are ready to be
> > picked up for upstream.
> >
> > v1 -> v2:
> > - fixed a build error on da850_am18xx due to missing CONFIG_DM_ETH=y
>
> Heiko, want me to take this through my tree?
>
> Thanks,
> -Joe

Hi Tom,

could you pick up the rest of the patches? They've been on the list
for several weeks now.

Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 12/14] davinci: omapl138-lcdk: remove unneeded includes

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

There's no SPI on da850-lcdk. Remove unnecessary includes.

Signed-off-by: Bartosz Golaszewski 
---
 board/davinci/da8xxevm/omapl138_lcdk.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index dd11551428..7f8c28b953 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -11,8 +11,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 11/14] davinci: omapl138-lcdk: enable CONFIG_USE_TINY_PRINTF

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

We're working towards enabling the driver-model in SPL for da850-lcdk.
Enable CONFIG_USE_TINY_PRINTF in defconfig to reduce SPL size.

Signed-off-by: Bartosz Golaszewski 
---
 configs/omapl138_lcdk_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index bfb88e397a..c4eebb3612 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -53,3 +53,4 @@ CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
+CONFIG_USE_TINY_PRINTF=y
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 14/14] configs: omapl138_lcdk: enable NAND self-init in SPL

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Now that we have enabled the driver-model in SPL, we can remove the
code disabling NAND self-init in SPL from the config include for
omapl138-lcdk.

Signed-off-by: Bartosz Golaszewski 
---
 include/configs/omapl138_lcdk.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h
index 20fd7ff713..db4a663c53 100644
--- a/include/configs/omapl138_lcdk.h
+++ b/include/configs/omapl138_lcdk.h
@@ -168,10 +168,6 @@
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
 #define CONFIG_SPL_NAND_LOAD
-
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_SYS_NAND_SELF_INIT
-#endif
 #endif
 
 #ifdef CONFIG_SYS_USE_NOR
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 03/14] sandbox: remove CONFIG_DM_I2C_COMPAT from defconfigs

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

There are no more "real" users of CONFIG_DM_I2C_COMPAT and we'll soon
remove it altogether. Stop building it in sandbox mode.

Signed-off-by: Bartosz Golaszewski 
Acked-by: Heiko Schocher 
---
 Makefile   | 2 +-
 configs/sandbox64_defconfig| 1 -
 configs/sandbox_defconfig  | 1 -
 configs/sandbox_flattree_defconfig | 1 -
 configs/sandbox_noblk_defconfig| 1 -
 configs/sandbox_spl_defconfig  | 1 -
 configs/tools-only_defconfig   | 1 -
 7 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 73fdf70cdd..57ffa4c99f 100644
--- a/Makefile
+++ b/Makefile
@@ -936,7 +936,7 @@ ifneq ($(CONFIG_DM_SPI)$(CONFIG_OF_CONTROL),yy)
 endif
 endif
 endif
-ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
+ifeq ($(CONFIG_DM_I2C_COMPAT),y)
@echo >&2 "= WARNING =="
@echo >&2 "This board uses CONFIG_DM_I2C_COMPAT. Please remove"
@echo >&2 "(possibly in a subsequent patch in your series)"
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
index 827b8761cd..c177ff8ad5 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -89,7 +89,6 @@ CONFIG_BOARD=y
 CONFIG_BOARD_SANDBOX=y
 CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 61391a7acd..068d311dca 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -104,7 +104,6 @@ CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
 CONFIG_DM_HWSPINLOCK=y
 CONFIG_HWSPINLOCK_SANDBOX=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/sandbox_flattree_defconfig 
b/configs/sandbox_flattree_defconfig
index af335285c9..a574144cd9 100644
--- a/configs/sandbox_flattree_defconfig
+++ b/configs/sandbox_flattree_defconfig
@@ -74,7 +74,6 @@ CONFIG_BOARD=y
 CONFIG_BOARD_SANDBOX=y
 CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/sandbox_noblk_defconfig b/configs/sandbox_noblk_defconfig
index da9229fc79..381bad2003 100644
--- a/configs/sandbox_noblk_defconfig
+++ b/configs/sandbox_noblk_defconfig
@@ -81,7 +81,6 @@ CONFIG_BOARD=y
 CONFIG_BOARD_SANDBOX=y
 CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig
index 27034cfaa9..c40a79cc73 100644
--- a/configs/sandbox_spl_defconfig
+++ b/configs/sandbox_spl_defconfig
@@ -95,7 +95,6 @@ CONFIG_BOARD=y
 CONFIG_BOARD_SANDBOX=y
 CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig
index aa73661a92..4808b49850 100644
--- a/configs/tools-only_defconfig
+++ b/configs/tools-only_defconfig
@@ -12,7 +12,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sandbox"
 CONFIG_IP_DEFRAG=y
 # CONFIG_UDP_FUNCTION_FASTBOOT is not set
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_PCI_SANDBOX=y
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 08/14] davinci: omapl138-lcdk: enable driver model for NAND

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Enable the driver-model on da850-lcdk. We need to add a dummy nand node
to the device tree, as the real nand node is a sub-node of the aemif
device.

On linux the aemif driver populates all its child nodes, but we can't do
it in u-boot currently.

Signed-off-by: Bartosz Golaszewski 
---
 arch/arm/dts/da850-lcdk-u-boot.dtsi | 4 
 configs/omapl138_lcdk_defconfig | 1 +
 include/configs/omapl138_lcdk.h | 4 
 3 files changed, 9 insertions(+)

diff --git a/arch/arm/dts/da850-lcdk-u-boot.dtsi 
b/arch/arm/dts/da850-lcdk-u-boot.dtsi
index 80dda8ef58..541f4ca200 100644
--- a/arch/arm/dts/da850-lcdk-u-boot.dtsi
+++ b/arch/arm/dts/da850-lcdk-u-boot.dtsi
@@ -9,4 +9,8 @@
aliases {
i2c0 = 
};
+
+   nand {
+   compatible = "ti,davinci-nand";
+   };
 };
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 7752308564..fa4ce692ff 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -39,6 +39,7 @@ CONFIG_DM=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
+CONFIG_MTD=y
 CONFIG_NAND=y
 CONFIG_NAND_DAVINCI=y
 CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h
index db4a663c53..20fd7ff713 100644
--- a/include/configs/omapl138_lcdk.h
+++ b/include/configs/omapl138_lcdk.h
@@ -168,6 +168,10 @@
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
 #define CONFIG_SPL_NAND_LOAD
+
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_SYS_NAND_SELF_INIT
+#endif
 #endif
 
 #ifdef CONFIG_SYS_USE_NOR
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 05/14] omapl138_lcdk_defconfig: don't build support for SPI

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

The following warning is emited when building u-boot for da850-lcdk:

= WARNING ==
This board does not use CONFIG_DM_SPI. Please update
the board before v2019.04 for no dm conversion
and v2019.07 for partially dm converted drivers.
Failure to update can lead to driver/board removal
See doc/driver-model/MIGRATION.txt for more info.

= WARNING ==
This board does not use CONFIG_DM_SPI_FLASH. Please update
the board to use CONFIG_SPI_FLASH before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.


While we could fix it by selecting CONFIG_DM_SPI, there's no need to
build it at all as SPI is disabled on da850-lcdk. Remove all unneeded
options from the defconfig.

Signed-off-by: Bartosz Golaszewski 
Acked-by: Heiko Schocher 
---
 configs/omapl138_lcdk_defconfig | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index b5d41bd3f6..7752308564 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -26,6 +26,7 @@ CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_GPIO is not set
 CONFIG_CMD_NAND=y
+# CONFIG_CMD_SPI is not set
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_MTDPARTS=y
 CONFIG_CMD_DIAG=y
@@ -44,14 +45,9 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x28000
 CONFIG_SPL_NAND_SIMPLE=y
-CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=3000
-CONFIG_SPI_FLASH_STMICRO=y
-CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
-CONFIG_SPI=y
-CONFIG_DAVINCI_SPI=y
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 13/14] davinci: omapl138-lcdk: enable driver-model in SPL

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Enable CONFIG_SPL_DM and enable the driver model for serial by defining
an appropriate device in the board file for da850-lcdk.

Signed-off-by: Bartosz Golaszewski 
---
 board/davinci/da8xxevm/omapl138_lcdk.c | 16 
 configs/omapl138_lcdk_defconfig|  5 +
 2 files changed, 21 insertions(+)

diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index 7f8c28b953..578d928443 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -14,6 +14,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -355,3 +357,17 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 #endif
+
+#ifdef CONFIG_SPL_BUILD
+static const struct ns16550_platdata serial_pdata = {
+   .base = DAVINCI_UART2_BASE,
+   .reg_shift = 2,
+   .clock = 22800,
+   .fcr = UART_FCR_DEFVAL,
+};
+
+U_BOOT_DEVICE(omapl138_uart) = {
+   .name = "ns16550_serial",
+   .platdata = _pdata,
+};
+#endif
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index c4eebb3612..26b4950f8f 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -33,10 +33,13 @@ CONFIG_CMD_MTDPARTS=y
 CONFIG_CMD_DIAG=y
 CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="da850-lcdk"
+CONFIG_SPL_OF_PLATDATA=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
+CONFIG_SPL_DM=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
@@ -51,6 +54,8 @@ CONFIG_SF_DEFAULT_SPEED=3000
 CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
+CONFIG_SPECIFY_CONSOLE_INDEX=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_USE_TINY_PRINTF=y
+# CONFIG_SPL_OF_LIBFDT is not set
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 04/14] i2c: remove i2c driver-model compatibility layer

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

There are no more users of the compatibility layer for i2c. Remove the
driver and all references to it.

Signed-off-by: Bartosz Golaszewski 
Acked-by: Heiko Schocher 
---
 Makefile|   7 --
 drivers/i2c/Kconfig |  13 +---
 drivers/i2c/Makefile|   1 -
 drivers/i2c/i2c-uclass-compat.c | 128 
 include/_exports.h  |   3 +-
 include/exports.h   |   3 +-
 include/i2c.h   |  80 
 7 files changed, 3 insertions(+), 232 deletions(-)
 delete mode 100644 drivers/i2c/i2c-uclass-compat.c

diff --git a/Makefile b/Makefile
index 57ffa4c99f..4341a0494e 100644
--- a/Makefile
+++ b/Makefile
@@ -936,13 +936,6 @@ ifneq ($(CONFIG_DM_SPI)$(CONFIG_OF_CONTROL),yy)
 endif
 endif
 endif
-ifeq ($(CONFIG_DM_I2C_COMPAT),y)
-   @echo >&2 "= WARNING =="
-   @echo >&2 "This board uses CONFIG_DM_I2C_COMPAT. Please remove"
-   @echo >&2 "(possibly in a subsequent patch in your series)"
-   @echo >&2 "before sending patches to the mailing list."
-   @echo >&2 ""
-endif
 ifeq ($(CONFIG_MMC),y)
 ifneq ($(CONFIG_DM_MMC)$(CONFIG_OF_CONTROL)$(CONFIG_BLK),yyy)
@echo >&2 "= WARNING =="
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 4772db3837..03d2fed341 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -12,18 +12,7 @@ config DM_I2C
  write and speed, is implemented with the bus drivers operations,
  which provide methods for bus setting and data transfer. Each chip
  device (bus child) info is kept as parent platdata. The interface
- is defined in include/i2c.h. When i2c bus driver supports the i2c
- uclass, but the device drivers not, then DM_I2C_COMPAT config can
- be used as compatibility layer.
-
-config DM_I2C_COMPAT
-   bool "Enable I2C compatibility layer"
-   depends on DM
-   help
- Enable old-style I2C functions for compatibility with existing code.
- This option can be enabled as a temporary measure to avoid needing
- to convert all code for a board in a single commit. It should not
- be enabled for any board in an official release.
+ is defined in include/i2c.h.
 
 config I2C_CROS_EC_TUNNEL
tristate "Chrome OS EC tunnel I2C bus"
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index dc40055efb..c2f75d8755 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -3,7 +3,6 @@
 # (C) Copyright 2000-2007
 # Wolfgang Denk, DENX Software Engineering, w...@denx.de.
 obj-$(CONFIG_DM_I2C) += i2c-uclass.o
-obj-$(CONFIG_DM_I2C_COMPAT) += i2c-uclass-compat.o
 obj-$(CONFIG_DM_I2C_GPIO) += i2c-gpio.o
 obj-$(CONFIG_$(SPL_)I2C_CROS_EC_TUNNEL) += cros_ec_tunnel.o
 obj-$(CONFIG_$(SPL_)I2C_CROS_EC_LDO) += cros_ec_ldo.o
diff --git a/drivers/i2c/i2c-uclass-compat.c b/drivers/i2c/i2c-uclass-compat.c
deleted file mode 100644
index b3ade88113..00
--- a/drivers/i2c/i2c-uclass-compat.c
+++ /dev/null
@@ -1,128 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (c) 2014 Google, Inc
- */
-
-#include 
-#include 
-#include 
-#include 
-
-static int cur_busnum __attribute__((section(".data")));
-
-static int i2c_compat_get_device(uint chip_addr, int alen,
-struct udevice **devp)
-{
-   struct dm_i2c_chip *chip;
-   int ret;
-
-   ret = i2c_get_chip_for_busnum(cur_busnum, chip_addr, alen, devp);
-   if (ret)
-   return ret;
-   chip = dev_get_parent_platdata(*devp);
-   if (chip->offset_len != alen) {
-   printf("I2C chip %x: requested alen %d does not match chip 
offset_len %d\n",
-  chip_addr, alen, chip->offset_len);
-   return -EADDRNOTAVAIL;
-   }
-
-   return 0;
-}
-
-int i2c_probe(uint8_t chip_addr)
-{
-   struct udevice *bus, *dev;
-   int ret;
-
-   ret = uclass_get_device_by_seq(UCLASS_I2C, cur_busnum, );
-   if (ret) {
-   debug("Cannot find I2C bus %d: err=%d\n", cur_busnum, ret);
-   return ret;
-   }
-
-   if (!bus)
-   return -ENOENT;
-
-   return dm_i2c_probe(bus, chip_addr, 0, );
-}
-
-int i2c_read(uint8_t chip_addr, unsigned int addr, int alen, uint8_t *buffer,
-int len)
-{
-   struct udevice *dev;
-   int ret;
-
-   ret = i2c_compat_get_device(chip_addr, alen, );
-   if (ret)
-   return ret;
-
-   return dm_i2c_read(dev, addr, buffer, len);
-}
-
-int i2c_write(uint8_t chip_addr, unsigned int addr, int alen, uint8_t *buffer,
- int len)
-{
-   struct udevice *dev;
-

[U-Boot] [PATCH v2 09/14] davinci: da850-evm: enable driver model for NAND

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Enable the driver-model on da850-evm. We need to add a dummy nand node
to the device tree, as the real nand node is a sub-node of the aemif
device.

On linux the aemif driver populates all its child nodes, but we can't do
it in u-boot currently.

Signed-off-by: Bartosz Golaszewski 
Tested-by: Adam Ford  #da850-evm
---
 arch/arm/dts/da850-evm-u-boot.dtsi| 4 
 configs/da850evm_defconfig| 1 +
 configs/da850evm_direct_nor_defconfig | 1 +
 configs/da850evm_nand_defconfig   | 1 +
 include/configs/da850evm.h| 4 
 5 files changed, 11 insertions(+)

diff --git a/arch/arm/dts/da850-evm-u-boot.dtsi 
b/arch/arm/dts/da850-evm-u-boot.dtsi
index 1683f3472e..d9e8b9926a 100644
--- a/arch/arm/dts/da850-evm-u-boot.dtsi
+++ b/arch/arm/dts/da850-evm-u-boot.dtsi
@@ -10,6 +10,10 @@
soc@1c0 {
u-boot,dm-spl;
};
+
+   nand {
+   compatible = "ti,davinci-nand";
+   };
 };
 
  {
diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
index f7c679d3b5..0f93d88cc6 100644
--- a/configs/da850evm_defconfig
+++ b/configs/da850evm_defconfig
@@ -52,6 +52,7 @@ CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
+CONFIG_MTD=y
 CONFIG_MTD_DEVICE=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
diff --git a/configs/da850evm_direct_nor_defconfig 
b/configs/da850evm_direct_nor_defconfig
index 9b1da07384..152ec7ae9a 100644
--- a/configs/da850evm_direct_nor_defconfig
+++ b/configs/da850evm_direct_nor_defconfig
@@ -42,6 +42,7 @@ CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 # CONFIG_MMC is not set
+CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
diff --git a/configs/da850evm_nand_defconfig b/configs/da850evm_nand_defconfig
index 8f06b8592b..30ffba2d73 100644
--- a/configs/da850evm_nand_defconfig
+++ b/configs/da850evm_nand_defconfig
@@ -49,6 +49,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+CONFIG_MTD=y
 CONFIG_NAND=y
 CONFIG_NAND_DAVINCI=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index 5d02c35279..9b4b8f2c94 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -174,6 +174,10 @@
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
 #define CONFIG_SPL_NAND_LOAD
+
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_SYS_NAND_SELF_INIT
+#endif
 #endif
 
 /*
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 07/14] nand: davinci: add support for driver model

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Extend the davinci NAND driver to support the driver model. For now this
doesn't add any device-tree parsing due to the fact that we can't access
the actual nand node on the device-tree - it's a subnode of the aemif
device and we don't have an aemif driver on davinci at the moment.

Signed-off-by: Bartosz Golaszewski 
---
 drivers/mtd/nand/raw/davinci_nand.c | 46 -
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/davinci_nand.c 
b/drivers/mtd/nand/raw/davinci_nand.c
index e1c4498cb9..33c2f16be8 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* Definitions for 4-bit hardware ECC */
@@ -785,10 +786,53 @@ static void davinci_nand_init(struct nand_chip *nand)
nand->dev_ready = nand_davinci_dev_ready;
 }
 
-int board_nand_init(struct nand_chip *chip) __attribute__((weak));
+#ifdef CONFIG_SYS_NAND_SELF_INIT
+static int davinci_nand_probe(struct udevice *dev)
+{
+   struct nand_chip *nand = dev_get_priv(dev);
+   struct mtd_info *mtd = nand_to_mtd(nand);
+   int ret;
+
+   nand->IO_ADDR_R = (void __iomem *)CONFIG_SYS_NAND_BASE;
+   nand->IO_ADDR_W = (void __iomem *)CONFIG_SYS_NAND_BASE;
+
+   davinci_nand_init(nand);
+
+   ret = nand_scan(mtd, CONFIG_SYS_NAND_MAX_CHIPS);
+   if (ret)
+   return ret;
+
+   return nand_register(0, mtd);
+}
+
+static const struct udevice_id davinci_nand_ids[] = {
+   { .compatible = "ti,davinci-nand" },
+   { }
+};
+
+U_BOOT_DRIVER(davinci_nand) = {
+   .name   = "davinci-nand",
+   .id = UCLASS_MTD,
+   .of_match   = davinci_nand_ids,
+   .probe  = davinci_nand_probe,
+   .priv_auto_alloc_size = sizeof(struct nand_chip),
+};
+
+void board_nand_init(void)
+{
+   struct udevice *dev;
+   int ret;
 
+   ret = uclass_get_device_by_driver(UCLASS_MTD,
+ DM_GET_DRIVER(davinci_nand), );
+   if (ret && ret != -ENODEV)
+   pr_err("Failed to initialize %s: %d\n", dev->name, ret);
+}
+#else
+int board_nand_init(struct nand_chip *chip) __attribute__((weak));
 int board_nand_init(struct nand_chip *chip)
 {
davinci_nand_init(chip);
return 0;
 }
+#endif /* CONFIG_SYS_NAND_SELF_INIT */
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 06/14] nand: davinci: make davinci_nand_init() static

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

This function is only used within the driver itself. No need
to export it.

Signed-off-by: Bartosz Golaszewski 
---
 arch/arm/include/asm/ti-common/davinci_nand.h | 2 --
 drivers/mtd/nand/raw/davinci_nand.c   | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/ti-common/davinci_nand.h 
b/arch/arm/include/asm/ti-common/davinci_nand.h
index e26381c7fd..28842c3b15 100644
--- a/arch/arm/include/asm/ti-common/davinci_nand.h
+++ b/arch/arm/include/asm/ti-common/davinci_nand.h
@@ -95,6 +95,4 @@ struct davinci_emif_regs {
 #define DAVINCI_ABCR_ASIZE_16BIT   1
 #define DAVINCI_ABCR_ASIZE_8BIT0
 
-void davinci_nand_init(struct nand_chip *nand);
-
 #endif
diff --git a/drivers/mtd/nand/raw/davinci_nand.c 
b/drivers/mtd/nand/raw/davinci_nand.c
index cfa9b535c8..e1c4498cb9 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -730,7 +730,7 @@ static int nand_davinci_dev_ready(struct mtd_info *mtd)
return __raw_readl(_emif_regs->nandfsr) & 0x1;
 }
 
-void davinci_nand_init(struct nand_chip *nand)
+static void davinci_nand_init(struct nand_chip *nand)
 {
 #if defined CONFIG_KEYSTONE_RBL_NAND
int i;
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 10/14] davinci: omapl138-lcdk: enable SPL_SYS_MALLOC_SIMPLE

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

We're working towards enabling the driver model in SPL for da850-lcdk.
Enable SPL_SYS_MALLOC_SIMPLE in defconfig to reduce SPL size.

Signed-off-by: Bartosz Golaszewski 
---
 configs/omapl138_lcdk_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index fa4ce692ff..bfb88e397a 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -18,6 +18,7 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_TEXT_BASE=0x8000
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_HUSH_PARSER=y
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 02/14] davinci: remove CONFIG_DM_I2C_COMPAT from defconfigs

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

This option is no longer used on any davinci board but still selected
in defconfigs which causes the following warning:

= WARNING ==
This board uses CONFIG_DM_I2C_COMPAT. Please remove
(possibly in a subsequent patch in your series)
before sending patches to the mailing list.


Remove all references to CONFIG_DM_I2C_COMPAT from davinci.

Signed-off-by: Bartosz Golaszewski 
Acked-by: Heiko Schocher 
---
 configs/da850_am18xxevm_defconfig | 1 -
 configs/omapl138_lcdk_defconfig   | 1 -
 include/configs/am3517_evm.h  | 1 -
 include/configs/da850evm.h| 8 
 include/configs/omapl138_lcdk.h   | 8 
 5 files changed, 19 deletions(-)

diff --git a/configs/da850_am18xxevm_defconfig 
b/configs/da850_am18xxevm_defconfig
index adcbe1d35d..2291c548ba 100644
--- a/configs/da850_am18xxevm_defconfig
+++ b/configs/da850_am18xxevm_defconfig
@@ -43,7 +43,6 @@ CONFIG_DM=y
 CONFIG_SPL_DM=y
 CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_MTD_DEVICE=y
 CONFIG_DM_SPI_FLASH=y
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 466ae860cd..b5d41bd3f6 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -36,7 +36,6 @@ CONFIG_ENV_IS_IN_NAND=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_DM_I2C=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
 CONFIG_NAND=y
diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h
index e0521abe90..8afbe2d333 100644
--- a/include/configs/am3517_evm.h
+++ b/include/configs/am3517_evm.h
@@ -14,7 +14,6 @@
 
 #include 
 
-#undef CONFIG_DM_I2C_COMPAT
 #define CONFIG_REVISION_TAG
 
 /* Hardware drivers */
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index ccdac0abec..5d02c35279 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -18,14 +18,6 @@
 #define CONFIG_USE_SPIFLASH
 #endif
 
-/*
-* Disable DM_* for SPL build and can be re-enabled after adding
-* DM support in SPL
-*/
-#ifdef CONFIG_SPL_BUILD
-#undef CONFIG_DM_I2C
-#undef CONFIG_DM_I2C_COMPAT
-#endif
 /*
  * SoC Configuration
  */
diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h
index da615e5063..db4a663c53 100644
--- a/include/configs/omapl138_lcdk.h
+++ b/include/configs/omapl138_lcdk.h
@@ -16,14 +16,6 @@
 #undef CONFIG_USE_SPIFLASH
 #undef CONFIG_SYS_USE_NOR
 
-/*
-* Disable DM_* for SPL build and can be re-enabled after adding
-* DM support in SPL
-*/
-#ifdef CONFIG_SPL_BUILD
-#undef CONFIG_DM_I2C
-#undef CONFIG_DM_I2C_COMPAT
-#endif
 /*
  * SoC Configuration
  */
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 01/14] net: davinci_emac: convert to using the driver model

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Now that we removed all legacy boards selecting TI_EMAC we can
completely convert the driver code to using the driver model.
This patch also updates all remaining users of davinci_emac.

Signed-off-by: Bartosz Golaszewski 
Tested-by: Adam Ford  #am3517-evm & da850-evm
Reviewed-by: Ramon Fried 
---
 arch/arm/mach-davinci/cpu.c| 13 -
 arch/arm/mach-omap2/omap3/emac.c   |  3 +-
 board/davinci/da8xxevm/da850evm.c  |  6 --
 board/davinci/da8xxevm/omapl138_lcdk.c | 14 -
 board/logicpd/am3517evm/am3517evm.c|  1 -
 board/ti/ti816x/evm.c  |  3 +-
 configs/am3517_evm_defconfig   |  1 +
 configs/da850_am18xxevm_defconfig  |  1 +
 configs/da850evm_defconfig |  1 +
 configs/da850evm_direct_nor_defconfig  |  1 +
 configs/da850evm_nand_defconfig|  1 +
 configs/omapl138_lcdk_defconfig|  1 +
 configs/ti816x_evm_defconfig   |  1 +
 drivers/net/ti/davinci_emac.c  | 77 ++
 include/netdev.h   |  1 -
 15 files changed, 51 insertions(+), 74 deletions(-)

diff --git a/arch/arm/mach-davinci/cpu.c b/arch/arm/mach-davinci/cpu.c
index f97ad3fc74..9fd6564d04 100644
--- a/arch/arm/mach-davinci/cpu.c
+++ b/arch/arm/mach-davinci/cpu.c
@@ -5,7 +5,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 
@@ -90,15 +89,3 @@ int set_cpu_clk_info(void)
gd->bd->bi_dsp_freq = 0;
return 0;
 }
-
-/*
- * Initializes on-chip ethernet controllers.
- * to override, implement board_eth_init()
- */
-int cpu_eth_init(bd_t *bis)
-{
-#if defined(CONFIG_DRIVER_TI_EMAC)
-   davinci_emac_initialize();
-#endif
-   return 0;
-}
diff --git a/arch/arm/mach-omap2/omap3/emac.c b/arch/arm/mach-omap2/omap3/emac.c
index c79e870183..fb0c9188f5 100644
--- a/arch/arm/mach-omap2/omap3/emac.c
+++ b/arch/arm/mach-omap2/omap3/emac.c
@@ -7,7 +7,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 
@@ -24,5 +23,5 @@ int cpu_eth_init(bd_t *bis)
reset &= ~CPGMACSS_SW_RST;
writel(reset, _scm_general_regs->ip_sw_reset);
 
-   return davinci_emac_initialize();
+   return 0;
 }
diff --git a/board/davinci/da8xxevm/da850evm.c 
b/board/davinci/da8xxevm/da850evm.c
index 5180128db4..43483d526a 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -13,7 +13,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -482,11 +481,6 @@ int board_eth_init(bd_t *bis)
if (rmii_hw_init())
printf("RMII hardware init failed!!!\n");
 #endif
-   if (!davinci_emac_initialize()) {
-   printf("Error: Ethernet init failed!\n");
-   return -1;
-   }
-
return 0;
 }
 #endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index fe1bf44101..dd11551428 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -229,19 +228,6 @@ int board_init(void)
 
 #ifdef CONFIG_DRIVER_TI_EMAC
 
-/*
- * Initializes on-board ethernet controllers.
- */
-int board_eth_init(bd_t *bis)
-{
-   if (!davinci_emac_initialize()) {
-   printf("Error: Ethernet init failed!\n");
-   return -1;
-   }
-
-   return 0;
-}
-
 #endif /* CONFIG_DRIVER_TI_EMAC */
 
 #define CFG_MAC_ADDR_SPI_BUS   0
diff --git a/board/logicpd/am3517evm/am3517evm.c 
b/board/logicpd/am3517evm/am3517evm.c
index 10031a4801..bfd4e78274 100644
--- a/board/logicpd/am3517evm/am3517evm.c
+++ b/board/logicpd/am3517evm/am3517evm.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include "am3517evm.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c
index 07a084bab8..240df8cbe1 100644
--- a/board/ti/ti816x/evm.c
+++ b/board/ti/ti816x/evm.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -56,7 +55,7 @@ int board_eth_init(bd_t *bis)
printf("Unable to read MAC address. Set \n");
}
 
-   return davinci_emac_initialize();
+   return 0;
 }
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig
index b9f59f3291..5cb76322df 100644
--- a/configs/am3517_evm_defconfig
+++ b/configs/am3517_evm_defconfig
@@ -44,6 +44,7 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x8
 CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
 CONFIG_PINCTRL=y
diff --git a/configs/da850_am18xxevm_defconfig 
b/configs/da850_am18xxevm_defconfig
index 7ecdc361ce..adcbe1d35d 100644
--- a/configs/da850_am18xxevm_defconfig
+++ b/configs/da850_am18xxevm_defconfig
@@ -50,6 +50,7 @@ CO

[U-Boot] [PATCH v2 00/14] ARM: davinci: driver-model improvements

2019-07-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

The following series contains all the patches for davinci that have
been sent to the mailing list recently rebased on top of v2019.07 and
retested on da850-lcdk and da850-evm. I collected all the review and
test tags too.

The first patch is the emac driver conversion to driver model. Patches
2-5 fix build warnings due to legacy interfaces usage. Patches 6-9 add
support for driver model to the davinci NAND driver. Patches 10-13
enable driver-model support in SPL for davinci. Last patch enables the
driver model for NAND in SPL.

These patches (except for the last, trivial one) have spent a lot of
time on the list and have been validated. I think they are ready to be
picked up for upstream.

v1 -> v2:
- fixed a build error on da850_am18xx due to missing CONFIG_DM_ETH=y

Bartosz Golaszewski (14):
  net: davinci_emac: convert to using the driver model
  davinci: remove CONFIG_DM_I2C_COMPAT from defconfigs
  sandbox: remove CONFIG_DM_I2C_COMPAT from defconfigs
  i2c: remove i2c driver-model compatibility layer
  omapl138_lcdk_defconfig: don't build support for SPI
  nand: davinci: make davinci_nand_init() static
  nand: davinci: add support for driver model
  davinci: omapl138-lcdk: enable driver model for NAND
  davinci: da850-evm: enable driver model for NAND
  davinci: omapl138-lcdk: enable SPL_SYS_MALLOC_SIMPLE
  davinci: omapl138-lcdk: enable CONFIG_USE_TINY_PRINTF
  davinci: omapl138-lcdk: remove unneeded includes
  davinci: omapl138-lcdk: enable driver-model in SPL
  configs: omapl138_lcdk: enable NAND self-init in SPL

 Makefile  |   7 -
 arch/arm/dts/da850-evm-u-boot.dtsi|   4 +
 arch/arm/dts/da850-lcdk-u-boot.dtsi   |   4 +
 arch/arm/include/asm/ti-common/davinci_nand.h |   2 -
 arch/arm/mach-davinci/cpu.c   |  13 --
 arch/arm/mach-omap2/omap3/emac.c  |   3 +-
 board/davinci/da8xxevm/da850evm.c |   6 -
 board/davinci/da8xxevm/omapl138_lcdk.c|  32 ++---
 board/logicpd/am3517evm/am3517evm.c   |   1 -
 board/ti/ti816x/evm.c |   3 +-
 configs/am3517_evm_defconfig  |   1 +
 configs/da850_am18xxevm_defconfig |   2 +-
 configs/da850evm_defconfig|   2 +
 configs/da850evm_direct_nor_defconfig |   2 +
 configs/da850evm_nand_defconfig   |   2 +
 configs/omapl138_lcdk_defconfig   |  16 ++-
 configs/sandbox64_defconfig   |   1 -
 configs/sandbox_defconfig |   1 -
 configs/sandbox_flattree_defconfig|   1 -
 configs/sandbox_noblk_defconfig   |   1 -
 configs/sandbox_spl_defconfig |   1 -
 configs/ti816x_evm_defconfig  |   1 +
 configs/tools-only_defconfig  |   1 -
 drivers/i2c/Kconfig   |  13 +-
 drivers/i2c/Makefile  |   1 -
 drivers/i2c/i2c-uclass-compat.c   | 128 --
 drivers/mtd/nand/raw/davinci_nand.c   |  48 ++-
 drivers/net/ti/davinci_emac.c |  77 ++-
 include/_exports.h|   3 +-
 include/configs/am3517_evm.h  |   1 -
 include/configs/da850evm.h|  12 +-
 include/configs/omapl138_lcdk.h   |   8 --
 include/exports.h |   3 +-
 include/i2c.h |  80 ---
 include/netdev.h  |   1 -
 35 files changed, 140 insertions(+), 342 deletions(-)
 delete mode 100644 drivers/i2c/i2c-uclass-compat.c

-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] net: davinci_emac: convert to using the driver model

2019-07-24 Thread Bartosz Golaszewski
śr., 24 lip 2019 o 01:22 Joe Hershberger  napisał(a):
>
> On Mon, Jun 24, 2019 at 9:22 AM Bartosz Golaszewski  wrote:
> >
> > From: Bartosz Golaszewski 
> >
> > Now that we removed all legacy boards selecting TI_EMAC we can
> > completely convert the driver code to using the driver model.
> > This patch also updates all remaining users of davinci_emac.
> >
> > Signed-off-by: Bartosz Golaszewski 
> > ---
> > v1 -> v2:
> > - moved the packetp assignment to the top of the recv() callback which fixes
> >   a crash on am3517_evm
> > - dropped a redundant call to net_process_received_packet(): this is already
> >   called from eth core
> >
> > Thanks goes to Adam Ford for much appreciated testing and help.
> >
> > Tested on da850-lcdk and da850-evm.
>
> Looks like a build failure on this patch...
>
> https://travis-ci.org/jhershbe/u-boot/jobs/562799958
>
> Can you have a look?
>
> Thanks,
> -Joe

This board was missing CONFIG_DM_ETH=y in my patch. I fixed it and v2
of the integration series is on the way.

Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 00/14] ARM: davinci: driver-model improvements

2019-07-22 Thread Bartosz Golaszewski
wt., 9 lip 2019 o 09:55 Bartosz Golaszewski  napisał(a):
>
> From: Bartosz Golaszewski 
>
> Hi Tom,
>
> the following series contains all the patches for davinci that have
> been sent to the mailing list recently rebased on top of v2019.07 and
> retested on da850-lcdk and da850-evm. I collected all the review and
> test tags too.
>
> The first patch is the emac driver conversion to driver model. Patches
> 2-5 fix build warnings due to legacy interfaces usage. Patches 6-9 add
> support for driver model to the davinci NAND driver. Patches 10-13
> enable driver-model support in SPL for davinci. Last patch enables the
> driver model for NAND in SPL.
>
> These patches (except for the last, trivial one) have spent a lot of
> time on the list and have been validated. I think they are ready to be
> picked up for upstream.
>

Gentle ping.

Bart

> Bartosz Golaszewski (14):
>   net: davinci_emac: convert to using the driver model
>   davinci: remove CONFIG_DM_I2C_COMPAT from defconfigs
>   sandbox: remove CONFIG_DM_I2C_COMPAT from defconfigs
>   i2c: remove i2c driver-model compatibility layer
>   omapl138_lcdk_defconfig: don't build support for SPI
>   nand: davinci: make davinci_nand_init() static
>   nand: davinci: add support for driver model
>   davinci: omapl138-lcdk: enable driver model for NAND
>   davinci: da850-evm: enable driver model for NAND
>   davinci: omapl138-lcdk: enable SPL_SYS_MALLOC_SIMPLE
>   davinci: omapl138-lcdk: enable CONFIG_USE_TINY_PRINTF
>   davinci: omapl138-lcdk: remove unneeded includes
>   davinci: omapl138-lcdk: enable driver-model in SPL
>   configs: omapl138_lcdk: enable NAND self-init in SPL
>
>  Makefile  |   7 -
>  arch/arm/dts/da850-evm-u-boot.dtsi|   4 +
>  arch/arm/dts/da850-lcdk-u-boot.dtsi   |   4 +
>  arch/arm/include/asm/ti-common/davinci_nand.h |   2 -
>  arch/arm/mach-davinci/cpu.c   |  13 --
>  arch/arm/mach-omap2/omap3/emac.c  |   3 +-
>  board/davinci/da8xxevm/da850evm.c |   6 -
>  board/davinci/da8xxevm/omapl138_lcdk.c|  32 ++---
>  board/logicpd/am3517evm/am3517evm.c   |   1 -
>  board/ti/ti816x/evm.c |   3 +-
>  configs/am3517_evm_defconfig  |   1 +
>  configs/da850_am18xxevm_defconfig |   1 -
>  configs/da850evm_defconfig|   2 +
>  configs/da850evm_direct_nor_defconfig |   2 +
>  configs/da850evm_nand_defconfig   |   2 +
>  configs/omapl138_lcdk_defconfig   |  16 ++-
>  configs/sandbox64_defconfig   |   1 -
>  configs/sandbox_defconfig |   1 -
>  configs/sandbox_flattree_defconfig|   1 -
>  configs/sandbox_noblk_defconfig   |   1 -
>  configs/sandbox_spl_defconfig |   1 -
>  configs/ti816x_evm_defconfig  |   1 +
>  configs/tools-only_defconfig  |   1 -
>  drivers/i2c/Kconfig   |  13 +-
>  drivers/i2c/Makefile  |   1 -
>  drivers/i2c/i2c-uclass-compat.c   | 128 --
>  drivers/mtd/nand/raw/davinci_nand.c   |  48 ++-
>  drivers/net/ti/davinci_emac.c |  77 ++-
>  include/_exports.h|   3 +-
>  include/configs/am3517_evm.h  |   1 -
>  include/configs/da850evm.h|  12 +-
>  include/configs/omapl138_lcdk.h   |   8 --
>  include/exports.h |   3 +-
>  include/i2c.h |  80 ---
>  include/netdev.h  |   1 -
>  35 files changed, 139 insertions(+), 342 deletions(-)
>  delete mode 100644 drivers/i2c/i2c-uclass-compat.c
>
> --
> 2.21.0
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 13/14] davinci: omapl138-lcdk: enable driver-model in SPL

2019-07-09 Thread Bartosz Golaszewski
wt., 9 lip 2019 o 15:34 Adam Ford  napisał(a):
>
> On Tue, Jul 9, 2019 at 2:55 AM Bartosz Golaszewski  wrote:
> >
> > From: Bartosz Golaszewski 
> >
> > Enable CONFIG_SPL_DM and enable the driver model for serial by defining
> > an appropriate device in the board file for da850-lcdk.
> >
> > Signed-off-by: Bartosz Golaszewski 
> > ---
> >  board/davinci/da8xxevm/omapl138_lcdk.c | 16 
> >  configs/omapl138_lcdk_defconfig|  5 +
> >  2 files changed, 21 insertions(+)
> >
> > diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
> > b/board/davinci/da8xxevm/omapl138_lcdk.c
> > index 7f8c28b953..578d928443 100644
> > --- a/board/davinci/da8xxevm/omapl138_lcdk.c
> > +++ b/board/davinci/da8xxevm/omapl138_lcdk.c
> > @@ -14,6 +14,8 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -355,3 +357,17 @@ int board_mmc_init(bd_t *bis)
> >  }
> >  #endif
> >  #endif
> > +
> > +#ifdef CONFIG_SPL_BUILD
> > +static const struct ns16550_platdata serial_pdata = {
> > +   .base = DAVINCI_UART2_BASE,
> > +   .reg_shift = 2,
> > +   .clock = 22800,
> > +   .fcr = UART_FCR_DEFVAL,
> > +};
> > +
> > +U_BOOT_DEVICE(omapl138_uart) = {
> > +   .name = "ns16550_serial",
> > +   .platdata = _pdata,
> > +};
> > +#endif
>
> Is the above part necessary since SPL_OF_CONTROL is defined?  I know
> the da850evm doesn't need this anymore and I was able to remove it
> when converting to SPL_OF_CONTROL.
>
> See: https://patchwork.ozlabs.org/patch/1048078/
>
> adam
>

Hi Adam,

we discussed it last time[1]: I tried to follow your example but got
stuck on a nasty build error and we agreed to merge it in this form
and try to improve it later.

I hope you're still ok with that.

Bart

[1] https://patchwork.ozlabs.org/patch/1106229/

> > diff --git a/configs/omapl138_lcdk_defconfig 
> > b/configs/omapl138_lcdk_defconfig
> > index c4eebb3612..26b4950f8f 100644
> > --- a/configs/omapl138_lcdk_defconfig
> > +++ b/configs/omapl138_lcdk_defconfig
> > @@ -33,10 +33,13 @@ CONFIG_CMD_MTDPARTS=y
> >  CONFIG_CMD_DIAG=y
> >  CONFIG_CMD_UBI=y
> >  CONFIG_OF_CONTROL=y
> > +CONFIG_SPL_OF_CONTROL=y
> >  CONFIG_DEFAULT_DEVICE_TREE="da850-lcdk"
> > +CONFIG_SPL_OF_PLATDATA=y
> >  CONFIG_ENV_IS_IN_NAND=y
> >  CONFIG_NET_RANDOM_ETHADDR=y
> >  CONFIG_DM=y
> > +CONFIG_SPL_DM=y
> >  CONFIG_DM_I2C=y
> >  CONFIG_SYS_I2C_DAVINCI=y
> >  CONFIG_DM_MMC=y
> > @@ -51,6 +54,8 @@ CONFIG_SF_DEFAULT_SPEED=3000
> >  CONFIG_DM_ETH=y
> >  CONFIG_MII=y
> >  CONFIG_DRIVER_TI_EMAC=y
> > +CONFIG_SPECIFY_CONSOLE_INDEX=y
> >  CONFIG_DM_SERIAL=y
> >  CONFIG_SYS_NS16550=y
> >  CONFIG_USE_TINY_PRINTF=y
> > +# CONFIG_SPL_OF_LIBFDT is not set
> > --
> > 2.21.0
> >
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 11/14] davinci: omapl138-lcdk: enable CONFIG_USE_TINY_PRINTF

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

We're working towards enabling the driver-model in SPL for da850-lcdk.
Enable CONFIG_USE_TINY_PRINTF in defconfig to reduce SPL size.

Signed-off-by: Bartosz Golaszewski 
---
 configs/omapl138_lcdk_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index bfb88e397a..c4eebb3612 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -53,3 +53,4 @@ CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
+CONFIG_USE_TINY_PRINTF=y
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 08/14] davinci: omapl138-lcdk: enable driver model for NAND

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Enable the driver-model on da850-lcdk. We need to add a dummy nand node
to the device tree, as the real nand node is a sub-node of the aemif
device.

On linux the aemif driver populates all its child nodes, but we can't do
it in u-boot currently.

Signed-off-by: Bartosz Golaszewski 
---
 arch/arm/dts/da850-lcdk-u-boot.dtsi | 4 
 configs/omapl138_lcdk_defconfig | 1 +
 include/configs/omapl138_lcdk.h | 4 
 3 files changed, 9 insertions(+)

diff --git a/arch/arm/dts/da850-lcdk-u-boot.dtsi 
b/arch/arm/dts/da850-lcdk-u-boot.dtsi
index 80dda8ef58..541f4ca200 100644
--- a/arch/arm/dts/da850-lcdk-u-boot.dtsi
+++ b/arch/arm/dts/da850-lcdk-u-boot.dtsi
@@ -9,4 +9,8 @@
aliases {
i2c0 = 
};
+
+   nand {
+   compatible = "ti,davinci-nand";
+   };
 };
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 7752308564..fa4ce692ff 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -39,6 +39,7 @@ CONFIG_DM=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
+CONFIG_MTD=y
 CONFIG_NAND=y
 CONFIG_NAND_DAVINCI=y
 CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h
index db4a663c53..20fd7ff713 100644
--- a/include/configs/omapl138_lcdk.h
+++ b/include/configs/omapl138_lcdk.h
@@ -168,6 +168,10 @@
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
 #define CONFIG_SPL_NAND_LOAD
+
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_SYS_NAND_SELF_INIT
+#endif
 #endif
 
 #ifdef CONFIG_SYS_USE_NOR
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 14/14] configs: omapl138_lcdk: enable NAND self-init in SPL

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Now that we have enabled the driver-model in SPL, we can remove the
code disabling NAND self-init in SPL from the config include for
omapl138-lcdk.

Signed-off-by: Bartosz Golaszewski 
---
 include/configs/omapl138_lcdk.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h
index 20fd7ff713..db4a663c53 100644
--- a/include/configs/omapl138_lcdk.h
+++ b/include/configs/omapl138_lcdk.h
@@ -168,10 +168,6 @@
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
 #define CONFIG_SPL_NAND_LOAD
-
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_SYS_NAND_SELF_INIT
-#endif
 #endif
 
 #ifdef CONFIG_SYS_USE_NOR
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 12/14] davinci: omapl138-lcdk: remove unneeded includes

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

There's no SPI on da850-lcdk. Remove unnecessary includes.

Signed-off-by: Bartosz Golaszewski 
---
 board/davinci/da8xxevm/omapl138_lcdk.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index dd11551428..7f8c28b953 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -11,8 +11,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 10/14] davinci: omapl138-lcdk: enable SPL_SYS_MALLOC_SIMPLE

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

We're working towards enabling the driver model in SPL for da850-lcdk.
Enable SPL_SYS_MALLOC_SIMPLE in defconfig to reduce SPL size.

Signed-off-by: Bartosz Golaszewski 
---
 configs/omapl138_lcdk_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index fa4ce692ff..bfb88e397a 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -18,6 +18,7 @@ CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_TEXT_BASE=0x8000
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_HUSH_PARSER=y
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 07/14] nand: davinci: add support for driver model

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Extend the davinci NAND driver to support the driver model. For now this
doesn't add any device-tree parsing due to the fact that we can't access
the actual nand node on the device-tree - it's a subnode of the aemif
device and we don't have an aemif driver on davinci at the moment.

Signed-off-by: Bartosz Golaszewski 
---
 drivers/mtd/nand/raw/davinci_nand.c | 46 -
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/davinci_nand.c 
b/drivers/mtd/nand/raw/davinci_nand.c
index e1c4498cb9..33c2f16be8 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* Definitions for 4-bit hardware ECC */
@@ -785,10 +786,53 @@ static void davinci_nand_init(struct nand_chip *nand)
nand->dev_ready = nand_davinci_dev_ready;
 }
 
-int board_nand_init(struct nand_chip *chip) __attribute__((weak));
+#ifdef CONFIG_SYS_NAND_SELF_INIT
+static int davinci_nand_probe(struct udevice *dev)
+{
+   struct nand_chip *nand = dev_get_priv(dev);
+   struct mtd_info *mtd = nand_to_mtd(nand);
+   int ret;
+
+   nand->IO_ADDR_R = (void __iomem *)CONFIG_SYS_NAND_BASE;
+   nand->IO_ADDR_W = (void __iomem *)CONFIG_SYS_NAND_BASE;
+
+   davinci_nand_init(nand);
+
+   ret = nand_scan(mtd, CONFIG_SYS_NAND_MAX_CHIPS);
+   if (ret)
+   return ret;
+
+   return nand_register(0, mtd);
+}
+
+static const struct udevice_id davinci_nand_ids[] = {
+   { .compatible = "ti,davinci-nand" },
+   { }
+};
+
+U_BOOT_DRIVER(davinci_nand) = {
+   .name   = "davinci-nand",
+   .id = UCLASS_MTD,
+   .of_match   = davinci_nand_ids,
+   .probe  = davinci_nand_probe,
+   .priv_auto_alloc_size = sizeof(struct nand_chip),
+};
+
+void board_nand_init(void)
+{
+   struct udevice *dev;
+   int ret;
 
+   ret = uclass_get_device_by_driver(UCLASS_MTD,
+ DM_GET_DRIVER(davinci_nand), );
+   if (ret && ret != -ENODEV)
+   pr_err("Failed to initialize %s: %d\n", dev->name, ret);
+}
+#else
+int board_nand_init(struct nand_chip *chip) __attribute__((weak));
 int board_nand_init(struct nand_chip *chip)
 {
davinci_nand_init(chip);
return 0;
 }
+#endif /* CONFIG_SYS_NAND_SELF_INIT */
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 09/14] davinci: da850-evm: enable driver model for NAND

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Enable the driver-model on da850-evm. We need to add a dummy nand node
to the device tree, as the real nand node is a sub-node of the aemif
device.

On linux the aemif driver populates all its child nodes, but we can't do
it in u-boot currently.

Signed-off-by: Bartosz Golaszewski 
Tested-by: Adam Ford  #da850-evm
---
 arch/arm/dts/da850-evm-u-boot.dtsi| 4 
 configs/da850evm_defconfig| 1 +
 configs/da850evm_direct_nor_defconfig | 1 +
 configs/da850evm_nand_defconfig   | 1 +
 include/configs/da850evm.h| 4 
 5 files changed, 11 insertions(+)

diff --git a/arch/arm/dts/da850-evm-u-boot.dtsi 
b/arch/arm/dts/da850-evm-u-boot.dtsi
index 1683f3472e..d9e8b9926a 100644
--- a/arch/arm/dts/da850-evm-u-boot.dtsi
+++ b/arch/arm/dts/da850-evm-u-boot.dtsi
@@ -10,6 +10,10 @@
soc@1c0 {
u-boot,dm-spl;
};
+
+   nand {
+   compatible = "ti,davinci-nand";
+   };
 };
 
  {
diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
index f7c679d3b5..0f93d88cc6 100644
--- a/configs/da850evm_defconfig
+++ b/configs/da850evm_defconfig
@@ -52,6 +52,7 @@ CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
+CONFIG_MTD=y
 CONFIG_MTD_DEVICE=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
diff --git a/configs/da850evm_direct_nor_defconfig 
b/configs/da850evm_direct_nor_defconfig
index 9b1da07384..152ec7ae9a 100644
--- a/configs/da850evm_direct_nor_defconfig
+++ b/configs/da850evm_direct_nor_defconfig
@@ -42,6 +42,7 @@ CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 # CONFIG_MMC is not set
+CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
diff --git a/configs/da850evm_nand_defconfig b/configs/da850evm_nand_defconfig
index 8f06b8592b..30ffba2d73 100644
--- a/configs/da850evm_nand_defconfig
+++ b/configs/da850evm_nand_defconfig
@@ -49,6 +49,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+CONFIG_MTD=y
 CONFIG_NAND=y
 CONFIG_NAND_DAVINCI=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index 5d02c35279..9b4b8f2c94 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -174,6 +174,10 @@
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
 #define CONFIG_SPL_NAND_LOAD
+
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_SYS_NAND_SELF_INIT
+#endif
 #endif
 
 /*
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 13/14] davinci: omapl138-lcdk: enable driver-model in SPL

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Enable CONFIG_SPL_DM and enable the driver model for serial by defining
an appropriate device in the board file for da850-lcdk.

Signed-off-by: Bartosz Golaszewski 
---
 board/davinci/da8xxevm/omapl138_lcdk.c | 16 
 configs/omapl138_lcdk_defconfig|  5 +
 2 files changed, 21 insertions(+)

diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index 7f8c28b953..578d928443 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -14,6 +14,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -355,3 +357,17 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 #endif
+
+#ifdef CONFIG_SPL_BUILD
+static const struct ns16550_platdata serial_pdata = {
+   .base = DAVINCI_UART2_BASE,
+   .reg_shift = 2,
+   .clock = 22800,
+   .fcr = UART_FCR_DEFVAL,
+};
+
+U_BOOT_DEVICE(omapl138_uart) = {
+   .name = "ns16550_serial",
+   .platdata = _pdata,
+};
+#endif
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index c4eebb3612..26b4950f8f 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -33,10 +33,13 @@ CONFIG_CMD_MTDPARTS=y
 CONFIG_CMD_DIAG=y
 CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="da850-lcdk"
+CONFIG_SPL_OF_PLATDATA=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
+CONFIG_SPL_DM=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
@@ -51,6 +54,8 @@ CONFIG_SF_DEFAULT_SPEED=3000
 CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
+CONFIG_SPECIFY_CONSOLE_INDEX=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_USE_TINY_PRINTF=y
+# CONFIG_SPL_OF_LIBFDT is not set
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 04/14] i2c: remove i2c driver-model compatibility layer

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

There are no more users of the compatibility layer for i2c. Remove the
driver and all references to it.

Signed-off-by: Bartosz Golaszewski 
Acked-by: Heiko Schocher 
---
 Makefile|   7 --
 drivers/i2c/Kconfig |  13 +---
 drivers/i2c/Makefile|   1 -
 drivers/i2c/i2c-uclass-compat.c | 128 
 include/_exports.h  |   3 +-
 include/exports.h   |   3 +-
 include/i2c.h   |  80 
 7 files changed, 3 insertions(+), 232 deletions(-)
 delete mode 100644 drivers/i2c/i2c-uclass-compat.c

diff --git a/Makefile b/Makefile
index 1b7d893cd3..3079415d7f 100644
--- a/Makefile
+++ b/Makefile
@@ -936,13 +936,6 @@ ifneq ($(CONFIG_DM_SPI)$(CONFIG_OF_CONTROL),yy)
 endif
 endif
 endif
-ifeq ($(CONFIG_DM_I2C_COMPAT),y)
-   @echo >&2 "= WARNING =="
-   @echo >&2 "This board uses CONFIG_DM_I2C_COMPAT. Please remove"
-   @echo >&2 "(possibly in a subsequent patch in your series)"
-   @echo >&2 "before sending patches to the mailing list."
-   @echo >&2 ""
-endif
 ifeq ($(CONFIG_MMC),y)
 ifneq ($(CONFIG_DM_MMC)$(CONFIG_OF_CONTROL)$(CONFIG_BLK),yyy)
@echo >&2 "= WARNING =="
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 095a9bc6a4..9c26471f94 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -12,18 +12,7 @@ config DM_I2C
  write and speed, is implemented with the bus drivers operations,
  which provide methods for bus setting and data transfer. Each chip
  device (bus child) info is kept as parent platdata. The interface
- is defined in include/i2c.h. When i2c bus driver supports the i2c
- uclass, but the device drivers not, then DM_I2C_COMPAT config can
- be used as compatibility layer.
-
-config DM_I2C_COMPAT
-   bool "Enable I2C compatibility layer"
-   depends on DM
-   help
- Enable old-style I2C functions for compatibility with existing code.
- This option can be enabled as a temporary measure to avoid needing
- to convert all code for a board in a single commit. It should not
- be enabled for any board in an official release.
+ is defined in include/i2c.h.
 
 config I2C_CROS_EC_TUNNEL
tristate "Chrome OS EC tunnel I2C bus"
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index dc40055efb..c2f75d8755 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -3,7 +3,6 @@
 # (C) Copyright 2000-2007
 # Wolfgang Denk, DENX Software Engineering, w...@denx.de.
 obj-$(CONFIG_DM_I2C) += i2c-uclass.o
-obj-$(CONFIG_DM_I2C_COMPAT) += i2c-uclass-compat.o
 obj-$(CONFIG_DM_I2C_GPIO) += i2c-gpio.o
 obj-$(CONFIG_$(SPL_)I2C_CROS_EC_TUNNEL) += cros_ec_tunnel.o
 obj-$(CONFIG_$(SPL_)I2C_CROS_EC_LDO) += cros_ec_ldo.o
diff --git a/drivers/i2c/i2c-uclass-compat.c b/drivers/i2c/i2c-uclass-compat.c
deleted file mode 100644
index b3ade88113..00
--- a/drivers/i2c/i2c-uclass-compat.c
+++ /dev/null
@@ -1,128 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (c) 2014 Google, Inc
- */
-
-#include 
-#include 
-#include 
-#include 
-
-static int cur_busnum __attribute__((section(".data")));
-
-static int i2c_compat_get_device(uint chip_addr, int alen,
-struct udevice **devp)
-{
-   struct dm_i2c_chip *chip;
-   int ret;
-
-   ret = i2c_get_chip_for_busnum(cur_busnum, chip_addr, alen, devp);
-   if (ret)
-   return ret;
-   chip = dev_get_parent_platdata(*devp);
-   if (chip->offset_len != alen) {
-   printf("I2C chip %x: requested alen %d does not match chip 
offset_len %d\n",
-  chip_addr, alen, chip->offset_len);
-   return -EADDRNOTAVAIL;
-   }
-
-   return 0;
-}
-
-int i2c_probe(uint8_t chip_addr)
-{
-   struct udevice *bus, *dev;
-   int ret;
-
-   ret = uclass_get_device_by_seq(UCLASS_I2C, cur_busnum, );
-   if (ret) {
-   debug("Cannot find I2C bus %d: err=%d\n", cur_busnum, ret);
-   return ret;
-   }
-
-   if (!bus)
-   return -ENOENT;
-
-   return dm_i2c_probe(bus, chip_addr, 0, );
-}
-
-int i2c_read(uint8_t chip_addr, unsigned int addr, int alen, uint8_t *buffer,
-int len)
-{
-   struct udevice *dev;
-   int ret;
-
-   ret = i2c_compat_get_device(chip_addr, alen, );
-   if (ret)
-   return ret;
-
-   return dm_i2c_read(dev, addr, buffer, len);
-}
-
-int i2c_write(uint8_t chip_addr, unsigned int addr, int alen, uint8_t *buffer,
- int len)
-{
-   struct udevice *dev;
-

[U-Boot] [PATCH 03/14] sandbox: remove CONFIG_DM_I2C_COMPAT from defconfigs

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

There are no more "real" users of CONFIG_DM_I2C_COMPAT and we'll soon
remove it altogether. Stop building it in sandbox mode.

Signed-off-by: Bartosz Golaszewski 
Acked-by: Heiko Schocher 
---
 Makefile   | 2 +-
 configs/sandbox64_defconfig| 1 -
 configs/sandbox_defconfig  | 1 -
 configs/sandbox_flattree_defconfig | 1 -
 configs/sandbox_noblk_defconfig| 1 -
 configs/sandbox_spl_defconfig  | 1 -
 configs/tools-only_defconfig   | 1 -
 7 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 516260f46d..1b7d893cd3 100644
--- a/Makefile
+++ b/Makefile
@@ -936,7 +936,7 @@ ifneq ($(CONFIG_DM_SPI)$(CONFIG_OF_CONTROL),yy)
 endif
 endif
 endif
-ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
+ifeq ($(CONFIG_DM_I2C_COMPAT),y)
@echo >&2 "= WARNING =="
@echo >&2 "This board uses CONFIG_DM_I2C_COMPAT. Please remove"
@echo >&2 "(possibly in a subsequent patch in your series)"
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
index 29a9df8ab0..cfe7622a79 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -89,7 +89,6 @@ CONFIG_BOARD=y
 CONFIG_BOARD_SANDBOX=y
 CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 6894262b89..97b071d3dd 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -104,7 +104,6 @@ CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
 CONFIG_DM_HWSPINLOCK=y
 CONFIG_HWSPINLOCK_SANDBOX=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/sandbox_flattree_defconfig 
b/configs/sandbox_flattree_defconfig
index af335285c9..a574144cd9 100644
--- a/configs/sandbox_flattree_defconfig
+++ b/configs/sandbox_flattree_defconfig
@@ -74,7 +74,6 @@ CONFIG_BOARD=y
 CONFIG_BOARD_SANDBOX=y
 CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/sandbox_noblk_defconfig b/configs/sandbox_noblk_defconfig
index da9229fc79..381bad2003 100644
--- a/configs/sandbox_noblk_defconfig
+++ b/configs/sandbox_noblk_defconfig
@@ -81,7 +81,6 @@ CONFIG_BOARD=y
 CONFIG_BOARD_SANDBOX=y
 CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig
index d355cc3f3b..2b6bc4c3d4 100644
--- a/configs/sandbox_spl_defconfig
+++ b/configs/sandbox_spl_defconfig
@@ -95,7 +95,6 @@ CONFIG_BOARD=y
 CONFIG_BOARD_SANDBOX=y
 CONFIG_PM8916_GPIO=y
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_I2C_CROS_EC_LDO=y
 CONFIG_DM_I2C_GPIO=y
diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig
index aa73661a92..4808b49850 100644
--- a/configs/tools-only_defconfig
+++ b/configs/tools-only_defconfig
@@ -12,7 +12,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sandbox"
 CONFIG_IP_DEFRAG=y
 # CONFIG_UDP_FUNCTION_FASTBOOT is not set
 CONFIG_SANDBOX_GPIO=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_PCI_SANDBOX=y
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 05/14] omapl138_lcdk_defconfig: don't build support for SPI

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

The following warning is emited when building u-boot for da850-lcdk:

= WARNING ==
This board does not use CONFIG_DM_SPI. Please update
the board before v2019.04 for no dm conversion
and v2019.07 for partially dm converted drivers.
Failure to update can lead to driver/board removal
See doc/driver-model/MIGRATION.txt for more info.

= WARNING ==
This board does not use CONFIG_DM_SPI_FLASH. Please update
the board to use CONFIG_SPI_FLASH before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.


While we could fix it by selecting CONFIG_DM_SPI, there's no need to
build it at all as SPI is disabled on da850-lcdk. Remove all unneeded
options from the defconfig.

Signed-off-by: Bartosz Golaszewski 
Acked-by: Heiko Schocher 
---
 configs/omapl138_lcdk_defconfig | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index b5d41bd3f6..7752308564 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -26,6 +26,7 @@ CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_GPIO is not set
 CONFIG_CMD_NAND=y
+# CONFIG_CMD_SPI is not set
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_MTDPARTS=y
 CONFIG_CMD_DIAG=y
@@ -44,14 +45,9 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x28000
 CONFIG_SPL_NAND_SIMPLE=y
-CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=3000
-CONFIG_SPI_FLASH_STMICRO=y
-CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
-CONFIG_SPI=y
-CONFIG_DAVINCI_SPI=y
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 06/14] nand: davinci: make davinci_nand_init() static

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

This function is only used within the driver itself. No need
to export it.

Signed-off-by: Bartosz Golaszewski 
---
 arch/arm/include/asm/ti-common/davinci_nand.h | 2 --
 drivers/mtd/nand/raw/davinci_nand.c   | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/ti-common/davinci_nand.h 
b/arch/arm/include/asm/ti-common/davinci_nand.h
index e26381c7fd..28842c3b15 100644
--- a/arch/arm/include/asm/ti-common/davinci_nand.h
+++ b/arch/arm/include/asm/ti-common/davinci_nand.h
@@ -95,6 +95,4 @@ struct davinci_emif_regs {
 #define DAVINCI_ABCR_ASIZE_16BIT   1
 #define DAVINCI_ABCR_ASIZE_8BIT0
 
-void davinci_nand_init(struct nand_chip *nand);
-
 #endif
diff --git a/drivers/mtd/nand/raw/davinci_nand.c 
b/drivers/mtd/nand/raw/davinci_nand.c
index cfa9b535c8..e1c4498cb9 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -730,7 +730,7 @@ static int nand_davinci_dev_ready(struct mtd_info *mtd)
return __raw_readl(_emif_regs->nandfsr) & 0x1;
 }
 
-void davinci_nand_init(struct nand_chip *nand)
+static void davinci_nand_init(struct nand_chip *nand)
 {
 #if defined CONFIG_KEYSTONE_RBL_NAND
int i;
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 01/14] net: davinci_emac: convert to using the driver model

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Now that we removed all legacy boards selecting TI_EMAC we can
completely convert the driver code to using the driver model.
This patch also updates all remaining users of davinci_emac.

Signed-off-by: Bartosz Golaszewski 
Tested-by: Adam Ford  #am3517-evm & da850-evm
Reviewed-by: Ramon Fried 
---
 arch/arm/mach-davinci/cpu.c| 13 -
 arch/arm/mach-omap2/omap3/emac.c   |  3 +-
 board/davinci/da8xxevm/da850evm.c  |  6 --
 board/davinci/da8xxevm/omapl138_lcdk.c | 14 -
 board/logicpd/am3517evm/am3517evm.c|  1 -
 board/ti/ti816x/evm.c  |  3 +-
 configs/am3517_evm_defconfig   |  1 +
 configs/da850evm_defconfig |  1 +
 configs/da850evm_direct_nor_defconfig  |  1 +
 configs/da850evm_nand_defconfig|  1 +
 configs/omapl138_lcdk_defconfig|  1 +
 configs/ti816x_evm_defconfig   |  1 +
 drivers/net/ti/davinci_emac.c  | 77 ++
 include/netdev.h   |  1 -
 14 files changed, 50 insertions(+), 74 deletions(-)

diff --git a/arch/arm/mach-davinci/cpu.c b/arch/arm/mach-davinci/cpu.c
index f97ad3fc74..9fd6564d04 100644
--- a/arch/arm/mach-davinci/cpu.c
+++ b/arch/arm/mach-davinci/cpu.c
@@ -5,7 +5,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 
@@ -90,15 +89,3 @@ int set_cpu_clk_info(void)
gd->bd->bi_dsp_freq = 0;
return 0;
 }
-
-/*
- * Initializes on-chip ethernet controllers.
- * to override, implement board_eth_init()
- */
-int cpu_eth_init(bd_t *bis)
-{
-#if defined(CONFIG_DRIVER_TI_EMAC)
-   davinci_emac_initialize();
-#endif
-   return 0;
-}
diff --git a/arch/arm/mach-omap2/omap3/emac.c b/arch/arm/mach-omap2/omap3/emac.c
index c79e870183..fb0c9188f5 100644
--- a/arch/arm/mach-omap2/omap3/emac.c
+++ b/arch/arm/mach-omap2/omap3/emac.c
@@ -7,7 +7,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 
@@ -24,5 +23,5 @@ int cpu_eth_init(bd_t *bis)
reset &= ~CPGMACSS_SW_RST;
writel(reset, _scm_general_regs->ip_sw_reset);
 
-   return davinci_emac_initialize();
+   return 0;
 }
diff --git a/board/davinci/da8xxevm/da850evm.c 
b/board/davinci/da8xxevm/da850evm.c
index a90b7a3538..a5c583444d 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -13,7 +13,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -472,11 +471,6 @@ int board_eth_init(bd_t *bis)
if (rmii_hw_init())
printf("RMII hardware init failed!!!\n");
 #endif
-   if (!davinci_emac_initialize()) {
-   printf("Error: Ethernet init failed!\n");
-   return -1;
-   }
-
return 0;
 }
 #endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index fe1bf44101..dd11551428 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -229,19 +228,6 @@ int board_init(void)
 
 #ifdef CONFIG_DRIVER_TI_EMAC
 
-/*
- * Initializes on-board ethernet controllers.
- */
-int board_eth_init(bd_t *bis)
-{
-   if (!davinci_emac_initialize()) {
-   printf("Error: Ethernet init failed!\n");
-   return -1;
-   }
-
-   return 0;
-}
-
 #endif /* CONFIG_DRIVER_TI_EMAC */
 
 #define CFG_MAC_ADDR_SPI_BUS   0
diff --git a/board/logicpd/am3517evm/am3517evm.c 
b/board/logicpd/am3517evm/am3517evm.c
index 10031a4801..bfd4e78274 100644
--- a/board/logicpd/am3517evm/am3517evm.c
+++ b/board/logicpd/am3517evm/am3517evm.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include "am3517evm.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c
index 07a084bab8..240df8cbe1 100644
--- a/board/ti/ti816x/evm.c
+++ b/board/ti/ti816x/evm.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -56,7 +55,7 @@ int board_eth_init(bd_t *bis)
printf("Unable to read MAC address. Set \n");
}
 
-   return davinci_emac_initialize();
+   return 0;
 }
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig
index b9f59f3291..5cb76322df 100644
--- a/configs/am3517_evm_defconfig
+++ b/configs/am3517_evm_defconfig
@@ -44,6 +44,7 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x8
 CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
 CONFIG_PINCTRL=y
diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
index c095058282..f7c679d3b5 100644
--- a/configs/da850evm_defconfig
+++ b/configs/da850evm_defconfig
@@ -59,6 +59,7 @@ CONFIG_SF_DEFAULT_SPEED=3000
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLA

[U-Boot] [PATCH 02/14] davinci: remove CONFIG_DM_I2C_COMPAT from defconfigs

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

This option is no longer used on any davinci board but still selected
in defconfigs which causes the following warning:

= WARNING ==
This board uses CONFIG_DM_I2C_COMPAT. Please remove
(possibly in a subsequent patch in your series)
before sending patches to the mailing list.


Remove all references to CONFIG_DM_I2C_COMPAT from davinci.

Signed-off-by: Bartosz Golaszewski 
Acked-by: Heiko Schocher 
---
 configs/da850_am18xxevm_defconfig | 1 -
 configs/omapl138_lcdk_defconfig   | 1 -
 include/configs/am3517_evm.h  | 1 -
 include/configs/da850evm.h| 8 
 include/configs/omapl138_lcdk.h   | 8 
 5 files changed, 19 deletions(-)

diff --git a/configs/da850_am18xxevm_defconfig 
b/configs/da850_am18xxevm_defconfig
index 7ecdc361ce..b224b4da8f 100644
--- a/configs/da850_am18xxevm_defconfig
+++ b/configs/da850_am18xxevm_defconfig
@@ -43,7 +43,6 @@ CONFIG_DM=y
 CONFIG_SPL_DM=y
 CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_MTD_DEVICE=y
 CONFIG_DM_SPI_FLASH=y
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 466ae860cd..b5d41bd3f6 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -36,7 +36,6 @@ CONFIG_ENV_IS_IN_NAND=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_DM_I2C=y
-CONFIG_DM_I2C_COMPAT=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
 CONFIG_NAND=y
diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h
index 9475e9975d..11f8f6d213 100644
--- a/include/configs/am3517_evm.h
+++ b/include/configs/am3517_evm.h
@@ -14,7 +14,6 @@
 
 #include 
 
-#undef CONFIG_DM_I2C_COMPAT
 #define CONFIG_REVISION_TAG
 
 /* Hardware drivers */
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index ccdac0abec..5d02c35279 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -18,14 +18,6 @@
 #define CONFIG_USE_SPIFLASH
 #endif
 
-/*
-* Disable DM_* for SPL build and can be re-enabled after adding
-* DM support in SPL
-*/
-#ifdef CONFIG_SPL_BUILD
-#undef CONFIG_DM_I2C
-#undef CONFIG_DM_I2C_COMPAT
-#endif
 /*
  * SoC Configuration
  */
diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h
index da615e5063..db4a663c53 100644
--- a/include/configs/omapl138_lcdk.h
+++ b/include/configs/omapl138_lcdk.h
@@ -16,14 +16,6 @@
 #undef CONFIG_USE_SPIFLASH
 #undef CONFIG_SYS_USE_NOR
 
-/*
-* Disable DM_* for SPL build and can be re-enabled after adding
-* DM support in SPL
-*/
-#ifdef CONFIG_SPL_BUILD
-#undef CONFIG_DM_I2C
-#undef CONFIG_DM_I2C_COMPAT
-#endif
 /*
  * SoC Configuration
  */
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 00/14] ARM: davinci: driver-model improvements

2019-07-09 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Hi Tom,

the following series contains all the patches for davinci that have
been sent to the mailing list recently rebased on top of v2019.07 and
retested on da850-lcdk and da850-evm. I collected all the review and
test tags too.

The first patch is the emac driver conversion to driver model. Patches
2-5 fix build warnings due to legacy interfaces usage. Patches 6-9 add
support for driver model to the davinci NAND driver. Patches 10-13
enable driver-model support in SPL for davinci. Last patch enables the
driver model for NAND in SPL.

These patches (except for the last, trivial one) have spent a lot of
time on the list and have been validated. I think they are ready to be
picked up for upstream.

Bartosz Golaszewski (14):
  net: davinci_emac: convert to using the driver model
  davinci: remove CONFIG_DM_I2C_COMPAT from defconfigs
  sandbox: remove CONFIG_DM_I2C_COMPAT from defconfigs
  i2c: remove i2c driver-model compatibility layer
  omapl138_lcdk_defconfig: don't build support for SPI
  nand: davinci: make davinci_nand_init() static
  nand: davinci: add support for driver model
  davinci: omapl138-lcdk: enable driver model for NAND
  davinci: da850-evm: enable driver model for NAND
  davinci: omapl138-lcdk: enable SPL_SYS_MALLOC_SIMPLE
  davinci: omapl138-lcdk: enable CONFIG_USE_TINY_PRINTF
  davinci: omapl138-lcdk: remove unneeded includes
  davinci: omapl138-lcdk: enable driver-model in SPL
  configs: omapl138_lcdk: enable NAND self-init in SPL

 Makefile  |   7 -
 arch/arm/dts/da850-evm-u-boot.dtsi|   4 +
 arch/arm/dts/da850-lcdk-u-boot.dtsi   |   4 +
 arch/arm/include/asm/ti-common/davinci_nand.h |   2 -
 arch/arm/mach-davinci/cpu.c   |  13 --
 arch/arm/mach-omap2/omap3/emac.c  |   3 +-
 board/davinci/da8xxevm/da850evm.c |   6 -
 board/davinci/da8xxevm/omapl138_lcdk.c|  32 ++---
 board/logicpd/am3517evm/am3517evm.c   |   1 -
 board/ti/ti816x/evm.c |   3 +-
 configs/am3517_evm_defconfig  |   1 +
 configs/da850_am18xxevm_defconfig |   1 -
 configs/da850evm_defconfig|   2 +
 configs/da850evm_direct_nor_defconfig |   2 +
 configs/da850evm_nand_defconfig   |   2 +
 configs/omapl138_lcdk_defconfig   |  16 ++-
 configs/sandbox64_defconfig   |   1 -
 configs/sandbox_defconfig |   1 -
 configs/sandbox_flattree_defconfig|   1 -
 configs/sandbox_noblk_defconfig   |   1 -
 configs/sandbox_spl_defconfig |   1 -
 configs/ti816x_evm_defconfig  |   1 +
 configs/tools-only_defconfig  |   1 -
 drivers/i2c/Kconfig   |  13 +-
 drivers/i2c/Makefile  |   1 -
 drivers/i2c/i2c-uclass-compat.c   | 128 --
 drivers/mtd/nand/raw/davinci_nand.c   |  48 ++-
 drivers/net/ti/davinci_emac.c |  77 ++-
 include/_exports.h|   3 +-
 include/configs/am3517_evm.h  |   1 -
 include/configs/da850evm.h|  12 +-
 include/configs/omapl138_lcdk.h   |   8 --
 include/exports.h |   3 +-
 include/i2c.h |  80 ---
 include/netdev.h  |   1 -
 35 files changed, 139 insertions(+), 342 deletions(-)
 delete mode 100644 drivers/i2c/i2c-uclass-compat.c

-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/4] davinci: fix build warnings

2019-07-04 Thread Bartosz Golaszewski
pon., 24 cze 2019 o 10:18 Bartosz Golaszewski  napisał(a):
>
> pon., 27 maj 2019 o 10:57 Bartosz Golaszewski  napisał(a):
> >
> > From: Bartosz Golaszewski 
> >
> > There are several build warnings related to driver-model usage emitted
> > when building u-boot for da850-evm and da850-lcdk. This series fixes them
> > and - while we're at it - removes the i2c compatiblity layer as davinci
> > was the last user of it.
> >
> > Bartosz Golaszewski (4):
> >   davinci: remove CONFIG_DM_I2C_COMPAT from defconfigs
> >   sandbox: remove CONFIG_DM_I2C_COMPAT from defconfigs
> >   i2c: remove i2c driver-model compatibility layer
> >   omapl138_lcdk_defconfig: don't build support for SPI
> >
> >  Makefile   |   7 --
> >  configs/da850_am18xxevm_defconfig  |   1 -
> >  configs/omapl138_lcdk_defconfig|   7 +-
> >  configs/sandbox64_defconfig|   1 -
> >  configs/sandbox_defconfig  |   1 -
> >  configs/sandbox_flattree_defconfig |   1 -
> >  configs/sandbox_noblk_defconfig|   1 -
> >  configs/sandbox_spl_defconfig  |   1 -
> >  configs/tools-only_defconfig   |   1 -
> >  drivers/i2c/Kconfig|  13 +--
> >  drivers/i2c/Makefile   |   1 -
> >  drivers/i2c/i2c-uclass-compat.c| 128 -
> >  include/_exports.h |   3 +-
> >  include/configs/am3517_evm.h   |   1 -
> >  include/configs/da850evm.h |   8 --
> >  include/configs/omapl138_lcdk.h|   8 --
> >  include/exports.h  |   3 +-
> >  include/i2c.h  |  80 --
> >  18 files changed, 4 insertions(+), 262 deletions(-)
> >  delete mode 100644 drivers/i2c/i2c-uclass-compat.c
> >
> > --
> > 2.21.0
> >
>
> Ping
>
> Bart

Hi Tom,

could you pick this one up as well post release?

Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/4] nand: davinci: enable driver model for NAND

2019-07-03 Thread Bartosz Golaszewski
pt., 7 cze 2019 o 10:16 Bartosz Golaszewski  napisał(a):
>
> czw., 6 cze 2019 o 17:58 Adam Ford  napisał(a):
> >
> > On Thu, Jun 6, 2019 at 10:50 AM Bartosz Golaszewski  wrote:
> > >
> > > From: Bartosz Golaszewski 
> > >
> > > This series enables the driver model for NAND on davinci da850 boards.
> > >
> > > The first patch is a simple tweak for an unnecessarily exported function.
> > >
> > > The second patch extends the NAND driver to support both legacy and
> > > driver-model users. For now we don't parse the device-tree as it's a
> > > bit complicated on da850, namely: the nand node is a child of the
> > > aemif node for which we don't have a driver in u-boot (unlike on linux
> > > where the aemif driver populates all its subnodes). In order for the
> > > nand device to be probed, we're adding a dummy node to the u-boot dts
> > > extensions with an appropriate compatible.
> > >
> > > Two last patches enable driver model for NAND on da850-lcdk and da850-evm.
> > > We don't enable the driver model in SPL as first: the patches enabling
> > > CONFIG_SPL_DM are still waiting to be merged, and second: the
> > > nand_spl_simple driver used by davinci SPL doesn't support driver model
> > > users. This is planned for future series once some basic support is
> > > merged.
> >
> > What happens when the board is booting SPL from NAND?  Will it still
> > work as expected?  I know the da850-evm has at least one configuration
> > which this is intended to boot from NAND instead of the default SPI
> > flash.
> >
>
> The driver works just like before in SPL. The support for the driver
> model is added incrementally. In fact I tested it on da850-lcdk with
> SPL loading u-boot from NAND.
>
> On da850-evm we could probably enable driver-model in SPL as well for
> NAND, but I prefer to do it at once for both boards.
>
> Bart
>
> > adam
> >
> > >
> > > Bartosz Golaszewski (4):
> > >   nand: davinci: make davinci_nand_init() static
> > >   nand: davinci: add support for driver model
> > >   davinci: omapl138-lcdk: enable driver model for NAND
> > >   davinci: da850-evm: enable driver model for NAND
> > >
> > >  arch/arm/dts/da850-evm-u-boot.dtsi|  4 ++
> > >  arch/arm/dts/da850-lcdk-u-boot.dtsi   |  4 ++
> > >  arch/arm/include/asm/ti-common/davinci_nand.h |  2 -
> > >  configs/da850evm_defconfig|  1 +
> > >  configs/da850evm_direct_nor_defconfig |  1 +
> > >  configs/da850evm_nand_defconfig   |  1 +
> > >  configs/omapl138_lcdk_defconfig   |  1 +
> > >  drivers/mtd/nand/raw/davinci_nand.c   | 48 ++-
> > >  include/configs/da850evm.h|  4 ++
> > >  include/configs/omapl138_lcdk.h   |  4 ++
> > >  10 files changed, 66 insertions(+), 4 deletions(-)
> > >
> > > --
> > > 2.21.0
> > >

Hi Tom,

can you pick up this series?

Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/4] davinci: omapl138-lcdk: enable CONFIG_SPL_DM

2019-07-03 Thread Bartosz Golaszewski
pon., 24 cze 2019 o 10:18 Bartosz Golaszewski  napisał(a):
>
> wt., 28 maj 2019 o 11:58 Bartosz Golaszewski  napisał(a):
> >
> > From: Bartosz Golaszewski 
> >
> > This series enables the driver model in SPL on omapl138-lcdk. First two
> > patches enable size-reducing options in defconfig. The third patch is
> > just a cleanup of the board file. Last patch enables the driver model
> > and defines the serial device so that we don't have to disable
> > CONFIG_SPL_DM_SERIAL which is enabled by default when selecting
> > CONFIG_SPL_DM.
> >
> > Bartosz Golaszewski (4):
> >   davinci: omapl138-lcdk: enable SPL_SYS_MALLOC_SIMPLE
> >   davinci: omapl138-lcdk: enable CONFIG_USE_TINY_PRINTF
> >   davinci: omapl138-lcdk: remove unneeded includes
> >   davinci: omapl138-lcdk: enable driver-model in SPL
> >
> >  board/davinci/da8xxevm/omapl138_lcdk.c | 18 --
> >  configs/omapl138_lcdk_defconfig|  7 +++
> >  2 files changed, 23 insertions(+), 2 deletions(-)
> >
> > --
> > 2.21.0
> >
>
> Gentle ping
>
> Bart

Ping again. Any objections to this series?

Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] net: davinci_emac: convert to using the driver model

2019-06-24 Thread Bartosz Golaszewski
pon., 24 cze 2019 o 15:39 Adam Ford  napisał(a):
>
> On Mon, Jun 24, 2019 at 7:07 AM Bartosz Golaszewski  wrote:
> >
> > śr., 12 cze 2019 o 18:46 Adam Ford  napisał(a):
> > >
> > > On Mon, Jun 3, 2019 at 10:29 AM Bartosz Golaszewski  wrote:
> > > >
> > > > pon., 3 cze 2019 o 15:03 Adam Ford  napisał(a):
> > > > >
> > > > > On Mon, Jun 3, 2019 at 3:12 AM Bartosz Golaszewski  
> > > > > wrote:
> > > > > >
> > > > > > sob., 1 cze 2019 o 05:24 Adam Ford  napisał(a):
> > > > > > >
> > > > > > > On Fri, May 31, 2019 at 8:32 AM Bartosz Golaszewski 
> > > > > > >  wrote:
> > > > > > > >
> > > > > > > > From: Bartosz Golaszewski 
> > > > > > > >
> > > > > > > > Now that we removed all legacy boards selecting TI_EMAC we can
> > > > > > > > completely convert the driver code to using the driver model.
> > > > > > > > This patch also updates all remaining users of davinci_emac.
> > > > > > > >
> > > > > > >
> > > > > > > I took a break from this to come back, and I'm going to give some
> > > > > > > feedback about how the driver was written. I still do not know 
> > > > > > > why I
> > > > > > > cannot get an IP address with this patch on the AM3517-evm.
> > > > > > >
> > > > > >
> > > > > > Hi Adam,
> > > > > >
> > > > > > thanks for all the testing. Unfortunately I can only test with
> > > > > > da850-evm and da850-lcdk.
> > > > > >
> > > > > > I was wondering if it is possible that the problem is caused by
> > > > > > cpu_eth_init() from ./arch/arm/mach-omap2/omap3/emac. not being 
> > > > > > called
> > > > > > with CONFIG_DM_ETH? The comments say that it brings the module out 
> > > > > > of
> > > > > > reset, so maybe this is what causes the problem you're seeing?
> > > > >
> > > > > I looked into that nearly right away, but there is a chunk of code in
> > > > > board/logicpd/am3517evm/am3517evm.c which has a function called
> > > > > misc_init_r() which does the same thing. Looking through the debug
> > > > > data, it appears as if the drive is communicating for a bit, but at
> > > > > some point it dies.  I'm not going to be able to look at it for a few
> > > > > days.  Is there any way you can submit a V2 to use #ifdef's to allow
> > > > > users to use the same driver with and without DM_ETH?  That would give
> > > > > the da850/L138 boards the DM_ETH, and give me some time to
> > > > > troubleshoot the am3517-evm. I know Sekhar works for TI and the AM3517
> > > > > was the official development kit for TI back in the day.  If TI has
> > > > > some ideas, I'm open to trying them as well when I can get back to it.
> > > > >
> > > > > adam
> > > >
> > > > Hi Adam,
> > > >
> > > > I'm trying to find out if I can get my hands on one of these boards 
> > > > somehow.
> > > >
> > > > My priority for this week is the nand driver conversion. I'll also be
> > > > off next week and the one after. I think that since we already removed
> > > > a bunch of boards to make it possible to avoid the ifdef hell, it's
> > > > better to wait a bit more than to merge something that we'll remove
> > > > soon anyway.
> > > >
> > > > If Sekhar agrees, we can push back merging of this patch until it's 
> > > > fixed.
> > > >
> > > > There's also a big backlog of my other davinci patches on the list
> > > > anyway, maybe they'll get picked up before we get back to it.
> > > >
> > > > Bart
> > > >
> > > > >
> > > > > >
> > > > > > > > Signed-off-by: Bartosz Golaszewski 
> > > > > > > > ---
> > > > > > > >  arch/arm/mach-davinci/cpu.c| 13 -
> > > > > > > >  arch/arm/mach-omap2/omap3/emac.c   |  3 +-
> > > > > > > >  board/davinci/da8xxevm/da850evm.c  |  6 --
> > > > > > > >  board/davinci/da8xxev

[U-Boot] [PATCH v2] net: davinci_emac: convert to using the driver model

2019-06-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Now that we removed all legacy boards selecting TI_EMAC we can
completely convert the driver code to using the driver model.
This patch also updates all remaining users of davinci_emac.

Signed-off-by: Bartosz Golaszewski 
---
v1 -> v2:
- moved the packetp assignment to the top of the recv() callback which fixes
  a crash on am3517_evm
- dropped a redundant call to net_process_received_packet(): this is already
  called from eth core

Thanks goes to Adam Ford for much appreciated testing and help.

Tested on da850-lcdk and da850-evm.

 arch/arm/mach-davinci/cpu.c| 13 -
 arch/arm/mach-omap2/omap3/emac.c   |  3 +-
 board/davinci/da8xxevm/da850evm.c  |  6 --
 board/davinci/da8xxevm/omapl138_lcdk.c | 14 -
 board/logicpd/am3517evm/am3517evm.c|  1 -
 board/ti/ti816x/evm.c  |  3 +-
 configs/am3517_evm_defconfig   |  1 +
 configs/da850evm_defconfig |  1 +
 configs/da850evm_direct_nor_defconfig  |  1 +
 configs/da850evm_nand_defconfig|  1 +
 configs/omapl138_lcdk_defconfig|  1 +
 configs/ti816x_evm_defconfig   |  1 +
 drivers/net/ti/davinci_emac.c  | 77 ++
 include/netdev.h   |  1 -
 14 files changed, 50 insertions(+), 74 deletions(-)

diff --git a/arch/arm/mach-davinci/cpu.c b/arch/arm/mach-davinci/cpu.c
index f97ad3fc74..9fd6564d04 100644
--- a/arch/arm/mach-davinci/cpu.c
+++ b/arch/arm/mach-davinci/cpu.c
@@ -5,7 +5,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 
@@ -90,15 +89,3 @@ int set_cpu_clk_info(void)
gd->bd->bi_dsp_freq = 0;
return 0;
 }
-
-/*
- * Initializes on-chip ethernet controllers.
- * to override, implement board_eth_init()
- */
-int cpu_eth_init(bd_t *bis)
-{
-#if defined(CONFIG_DRIVER_TI_EMAC)
-   davinci_emac_initialize();
-#endif
-   return 0;
-}
diff --git a/arch/arm/mach-omap2/omap3/emac.c b/arch/arm/mach-omap2/omap3/emac.c
index c79e870183..fb0c9188f5 100644
--- a/arch/arm/mach-omap2/omap3/emac.c
+++ b/arch/arm/mach-omap2/omap3/emac.c
@@ -7,7 +7,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 
@@ -24,5 +23,5 @@ int cpu_eth_init(bd_t *bis)
reset &= ~CPGMACSS_SW_RST;
writel(reset, _scm_general_regs->ip_sw_reset);
 
-   return davinci_emac_initialize();
+   return 0;
 }
diff --git a/board/davinci/da8xxevm/da850evm.c 
b/board/davinci/da8xxevm/da850evm.c
index a90b7a3538..a5c583444d 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -13,7 +13,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -472,11 +471,6 @@ int board_eth_init(bd_t *bis)
if (rmii_hw_init())
printf("RMII hardware init failed!!!\n");
 #endif
-   if (!davinci_emac_initialize()) {
-   printf("Error: Ethernet init failed!\n");
-   return -1;
-   }
-
return 0;
 }
 #endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index fe1bf44101..dd11551428 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -229,19 +228,6 @@ int board_init(void)
 
 #ifdef CONFIG_DRIVER_TI_EMAC
 
-/*
- * Initializes on-board ethernet controllers.
- */
-int board_eth_init(bd_t *bis)
-{
-   if (!davinci_emac_initialize()) {
-   printf("Error: Ethernet init failed!\n");
-   return -1;
-   }
-
-   return 0;
-}
-
 #endif /* CONFIG_DRIVER_TI_EMAC */
 
 #define CFG_MAC_ADDR_SPI_BUS   0
diff --git a/board/logicpd/am3517evm/am3517evm.c 
b/board/logicpd/am3517evm/am3517evm.c
index 10031a4801..bfd4e78274 100644
--- a/board/logicpd/am3517evm/am3517evm.c
+++ b/board/logicpd/am3517evm/am3517evm.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include "am3517evm.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c
index 07a084bab8..240df8cbe1 100644
--- a/board/ti/ti816x/evm.c
+++ b/board/ti/ti816x/evm.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -56,7 +55,7 @@ int board_eth_init(bd_t *bis)
printf("Unable to read MAC address. Set \n");
}
 
-   return davinci_emac_initialize();
+   return 0;
 }
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig
index b9f59f3291..5cb76322df 100644
--- a/configs/am3517_evm_defconfig
+++ b/configs/am3517_evm_defconfig
@@ -44,6 +44,7 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x8
 CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
 CONFIG_PINCTRL=y
diff --git a/configs/da850evm_d

Re: [U-Boot] [PATCH] net: davinci_emac: convert to using the driver model

2019-06-24 Thread Bartosz Golaszewski
śr., 12 cze 2019 o 18:46 Adam Ford  napisał(a):
>
> On Mon, Jun 3, 2019 at 10:29 AM Bartosz Golaszewski  wrote:
> >
> > pon., 3 cze 2019 o 15:03 Adam Ford  napisał(a):
> > >
> > > On Mon, Jun 3, 2019 at 3:12 AM Bartosz Golaszewski  wrote:
> > > >
> > > > sob., 1 cze 2019 o 05:24 Adam Ford  napisał(a):
> > > > >
> > > > > On Fri, May 31, 2019 at 8:32 AM Bartosz Golaszewski  
> > > > > wrote:
> > > > > >
> > > > > > From: Bartosz Golaszewski 
> > > > > >
> > > > > > Now that we removed all legacy boards selecting TI_EMAC we can
> > > > > > completely convert the driver code to using the driver model.
> > > > > > This patch also updates all remaining users of davinci_emac.
> > > > > >
> > > > >
> > > > > I took a break from this to come back, and I'm going to give some
> > > > > feedback about how the driver was written. I still do not know why I
> > > > > cannot get an IP address with this patch on the AM3517-evm.
> > > > >
> > > >
> > > > Hi Adam,
> > > >
> > > > thanks for all the testing. Unfortunately I can only test with
> > > > da850-evm and da850-lcdk.
> > > >
> > > > I was wondering if it is possible that the problem is caused by
> > > > cpu_eth_init() from ./arch/arm/mach-omap2/omap3/emac. not being called
> > > > with CONFIG_DM_ETH? The comments say that it brings the module out of
> > > > reset, so maybe this is what causes the problem you're seeing?
> > >
> > > I looked into that nearly right away, but there is a chunk of code in
> > > board/logicpd/am3517evm/am3517evm.c which has a function called
> > > misc_init_r() which does the same thing. Looking through the debug
> > > data, it appears as if the drive is communicating for a bit, but at
> > > some point it dies.  I'm not going to be able to look at it for a few
> > > days.  Is there any way you can submit a V2 to use #ifdef's to allow
> > > users to use the same driver with and without DM_ETH?  That would give
> > > the da850/L138 boards the DM_ETH, and give me some time to
> > > troubleshoot the am3517-evm. I know Sekhar works for TI and the AM3517
> > > was the official development kit for TI back in the day.  If TI has
> > > some ideas, I'm open to trying them as well when I can get back to it.
> > >
> > > adam
> >
> > Hi Adam,
> >
> > I'm trying to find out if I can get my hands on one of these boards somehow.
> >
> > My priority for this week is the nand driver conversion. I'll also be
> > off next week and the one after. I think that since we already removed
> > a bunch of boards to make it possible to avoid the ifdef hell, it's
> > better to wait a bit more than to merge something that we'll remove
> > soon anyway.
> >
> > If Sekhar agrees, we can push back merging of this patch until it's fixed.
> >
> > There's also a big backlog of my other davinci patches on the list
> > anyway, maybe they'll get picked up before we get back to it.
> >
> > Bart
> >
> > >
> > > >
> > > > > > Signed-off-by: Bartosz Golaszewski 
> > > > > > ---
> > > > > >  arch/arm/mach-davinci/cpu.c| 13 -
> > > > > >  arch/arm/mach-omap2/omap3/emac.c   |  3 +-
> > > > > >  board/davinci/da8xxevm/da850evm.c  |  6 --
> > > > > >  board/davinci/da8xxevm/omapl138_lcdk.c | 14 -
> > > > > >  board/logicpd/am3517evm/am3517evm.c|  1 -
> > > > > >  board/ti/ti816x/evm.c  |  3 +-
> > > > > >  configs/am3517_evm_defconfig   |  1 +
> > > > > >  configs/da850evm_defconfig |  1 +
> > > > > >  configs/da850evm_direct_nor_defconfig  |  1 +
> > > > > >  configs/da850evm_nand_defconfig|  1 +
> > > > > >  configs/omapl138_lcdk_defconfig|  1 +
> > > > > >  configs/ti816x_evm_defconfig   |  1 +
> > > > > >  drivers/net/ti/davinci_emac.c  | 77 
> > > > > > ++
> > > > > >  include/netdev.h   |  1 -
> > > > > >  14 files changed, 51 insertions(+), 73 deletions(-)
> > > > > >
> > > > > > diff --git a/arch/arm/

Re: [U-Boot] [PATCH] net: davinci_emac: convert to using the driver model

2019-06-24 Thread Bartosz Golaszewski
śr., 12 cze 2019 o 18:46 Adam Ford  napisał(a):
>
> On Mon, Jun 3, 2019 at 10:29 AM Bartosz Golaszewski  wrote:
> >
> > pon., 3 cze 2019 o 15:03 Adam Ford  napisał(a):
> > >
> > > On Mon, Jun 3, 2019 at 3:12 AM Bartosz Golaszewski  wrote:
> > > >
> > > > sob., 1 cze 2019 o 05:24 Adam Ford  napisał(a):
> > > > >
> > > > > On Fri, May 31, 2019 at 8:32 AM Bartosz Golaszewski  
> > > > > wrote:
> > > > > >
> > > > > > From: Bartosz Golaszewski 
> > > > > >
> > > > > > Now that we removed all legacy boards selecting TI_EMAC we can
> > > > > > completely convert the driver code to using the driver model.
> > > > > > This patch also updates all remaining users of davinci_emac.
> > > > > >
> > > > >
> > > > > I took a break from this to come back, and I'm going to give some
> > > > > feedback about how the driver was written. I still do not know why I
> > > > > cannot get an IP address with this patch on the AM3517-evm.
> > > > >
> > > >
> > > > Hi Adam,
> > > >
> > > > thanks for all the testing. Unfortunately I can only test with
> > > > da850-evm and da850-lcdk.
> > > >
> > > > I was wondering if it is possible that the problem is caused by
> > > > cpu_eth_init() from ./arch/arm/mach-omap2/omap3/emac. not being called
> > > > with CONFIG_DM_ETH? The comments say that it brings the module out of
> > > > reset, so maybe this is what causes the problem you're seeing?
> > >
> > > I looked into that nearly right away, but there is a chunk of code in
> > > board/logicpd/am3517evm/am3517evm.c which has a function called
> > > misc_init_r() which does the same thing. Looking through the debug
> > > data, it appears as if the drive is communicating for a bit, but at
> > > some point it dies.  I'm not going to be able to look at it for a few
> > > days.  Is there any way you can submit a V2 to use #ifdef's to allow
> > > users to use the same driver with and without DM_ETH?  That would give
> > > the da850/L138 boards the DM_ETH, and give me some time to
> > > troubleshoot the am3517-evm. I know Sekhar works for TI and the AM3517
> > > was the official development kit for TI back in the day.  If TI has
> > > some ideas, I'm open to trying them as well when I can get back to it.
> > >
> > > adam
> >
> > Hi Adam,
> >
> > I'm trying to find out if I can get my hands on one of these boards somehow.
> >
> > My priority for this week is the nand driver conversion. I'll also be
> > off next week and the one after. I think that since we already removed
> > a bunch of boards to make it possible to avoid the ifdef hell, it's
> > better to wait a bit more than to merge something that we'll remove
> > soon anyway.
> >
> > If Sekhar agrees, we can push back merging of this patch until it's fixed.
> >
> > There's also a big backlog of my other davinci patches on the list
> > anyway, maybe they'll get picked up before we get back to it.
> >
> > Bart
> >
> > >
> > > >
> > > > > > Signed-off-by: Bartosz Golaszewski 
> > > > > > ---
> > > > > >  arch/arm/mach-davinci/cpu.c| 13 -
> > > > > >  arch/arm/mach-omap2/omap3/emac.c   |  3 +-
> > > > > >  board/davinci/da8xxevm/da850evm.c  |  6 --
> > > > > >  board/davinci/da8xxevm/omapl138_lcdk.c | 14 -
> > > > > >  board/logicpd/am3517evm/am3517evm.c|  1 -
> > > > > >  board/ti/ti816x/evm.c  |  3 +-
> > > > > >  configs/am3517_evm_defconfig   |  1 +
> > > > > >  configs/da850evm_defconfig |  1 +
> > > > > >  configs/da850evm_direct_nor_defconfig  |  1 +
> > > > > >  configs/da850evm_nand_defconfig|  1 +
> > > > > >  configs/omapl138_lcdk_defconfig|  1 +
> > > > > >  configs/ti816x_evm_defconfig   |  1 +
> > > > > >  drivers/net/ti/davinci_emac.c  | 77 
> > > > > > ++
> > > > > >  include/netdev.h   |  1 -
> > > > > >  14 files changed, 51 insertions(+), 73 deletions(-)
> > > > > >
> > > > > > diff --git a/arch/arm/

Re: [U-Boot] [PATCH 0/4] davinci: omapl138-lcdk: enable CONFIG_SPL_DM

2019-06-24 Thread Bartosz Golaszewski
wt., 28 maj 2019 o 11:58 Bartosz Golaszewski  napisał(a):
>
> From: Bartosz Golaszewski 
>
> This series enables the driver model in SPL on omapl138-lcdk. First two
> patches enable size-reducing options in defconfig. The third patch is
> just a cleanup of the board file. Last patch enables the driver model
> and defines the serial device so that we don't have to disable
> CONFIG_SPL_DM_SERIAL which is enabled by default when selecting
> CONFIG_SPL_DM.
>
> Bartosz Golaszewski (4):
>   davinci: omapl138-lcdk: enable SPL_SYS_MALLOC_SIMPLE
>   davinci: omapl138-lcdk: enable CONFIG_USE_TINY_PRINTF
>   davinci: omapl138-lcdk: remove unneeded includes
>   davinci: omapl138-lcdk: enable driver-model in SPL
>
>  board/davinci/da8xxevm/omapl138_lcdk.c | 18 --
>  configs/omapl138_lcdk_defconfig|  7 +++
>  2 files changed, 23 insertions(+), 2 deletions(-)
>
> --
> 2.21.0
>

Gentle ping

Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/4] davinci: fix build warnings

2019-06-24 Thread Bartosz Golaszewski
pon., 27 maj 2019 o 10:57 Bartosz Golaszewski  napisał(a):
>
> From: Bartosz Golaszewski 
>
> There are several build warnings related to driver-model usage emitted
> when building u-boot for da850-evm and da850-lcdk. This series fixes them
> and - while we're at it - removes the i2c compatiblity layer as davinci
> was the last user of it.
>
> Bartosz Golaszewski (4):
>   davinci: remove CONFIG_DM_I2C_COMPAT from defconfigs
>   sandbox: remove CONFIG_DM_I2C_COMPAT from defconfigs
>   i2c: remove i2c driver-model compatibility layer
>   omapl138_lcdk_defconfig: don't build support for SPI
>
>  Makefile   |   7 --
>  configs/da850_am18xxevm_defconfig  |   1 -
>  configs/omapl138_lcdk_defconfig|   7 +-
>  configs/sandbox64_defconfig|   1 -
>  configs/sandbox_defconfig  |   1 -
>  configs/sandbox_flattree_defconfig |   1 -
>  configs/sandbox_noblk_defconfig|   1 -
>  configs/sandbox_spl_defconfig  |   1 -
>  configs/tools-only_defconfig   |   1 -
>  drivers/i2c/Kconfig|  13 +--
>  drivers/i2c/Makefile   |   1 -
>  drivers/i2c/i2c-uclass-compat.c| 128 -
>  include/_exports.h |   3 +-
>  include/configs/am3517_evm.h   |   1 -
>  include/configs/da850evm.h |   8 --
>  include/configs/omapl138_lcdk.h|   8 --
>  include/exports.h  |   3 +-
>  include/i2c.h  |  80 --
>  18 files changed, 4 insertions(+), 262 deletions(-)
>  delete mode 100644 drivers/i2c/i2c-uclass-compat.c
>
> --
> 2.21.0
>

Ping

Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/4] nand: davinci: enable driver model for NAND

2019-06-07 Thread Bartosz Golaszewski
czw., 6 cze 2019 o 17:58 Adam Ford  napisał(a):
>
> On Thu, Jun 6, 2019 at 10:50 AM Bartosz Golaszewski  wrote:
> >
> > From: Bartosz Golaszewski 
> >
> > This series enables the driver model for NAND on davinci da850 boards.
> >
> > The first patch is a simple tweak for an unnecessarily exported function.
> >
> > The second patch extends the NAND driver to support both legacy and
> > driver-model users. For now we don't parse the device-tree as it's a
> > bit complicated on da850, namely: the nand node is a child of the
> > aemif node for which we don't have a driver in u-boot (unlike on linux
> > where the aemif driver populates all its subnodes). In order for the
> > nand device to be probed, we're adding a dummy node to the u-boot dts
> > extensions with an appropriate compatible.
> >
> > Two last patches enable driver model for NAND on da850-lcdk and da850-evm.
> > We don't enable the driver model in SPL as first: the patches enabling
> > CONFIG_SPL_DM are still waiting to be merged, and second: the
> > nand_spl_simple driver used by davinci SPL doesn't support driver model
> > users. This is planned for future series once some basic support is
> > merged.
>
> What happens when the board is booting SPL from NAND?  Will it still
> work as expected?  I know the da850-evm has at least one configuration
> which this is intended to boot from NAND instead of the default SPI
> flash.
>

The driver works just like before in SPL. The support for the driver
model is added incrementally. In fact I tested it on da850-lcdk with
SPL loading u-boot from NAND.

On da850-evm we could probably enable driver-model in SPL as well for
NAND, but I prefer to do it at once for both boards.

Bart

> adam
>
> >
> > Bartosz Golaszewski (4):
> >   nand: davinci: make davinci_nand_init() static
> >   nand: davinci: add support for driver model
> >   davinci: omapl138-lcdk: enable driver model for NAND
> >   davinci: da850-evm: enable driver model for NAND
> >
> >  arch/arm/dts/da850-evm-u-boot.dtsi|  4 ++
> >  arch/arm/dts/da850-lcdk-u-boot.dtsi   |  4 ++
> >  arch/arm/include/asm/ti-common/davinci_nand.h |  2 -
> >  configs/da850evm_defconfig|  1 +
> >  configs/da850evm_direct_nor_defconfig |  1 +
> >  configs/da850evm_nand_defconfig   |  1 +
> >  configs/omapl138_lcdk_defconfig   |  1 +
> >  drivers/mtd/nand/raw/davinci_nand.c   | 48 ++-
> >  include/configs/da850evm.h|  4 ++
> >  include/configs/omapl138_lcdk.h   |  4 ++
> >  10 files changed, 66 insertions(+), 4 deletions(-)
> >
> > --
> > 2.21.0
> >
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 4/4] davinci: da850-evm: enable driver model for NAND

2019-06-06 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Enable the driver-model on da850-evm. We need to add a dummy nand node
to the device tree, as the real nand node is a sub-node of the aemif
device.

On linux the aemif driver populates all its child nodes, but we can't do
it in u-boot currently.

Signed-off-by: Bartosz Golaszewski 
---
 arch/arm/dts/da850-evm-u-boot.dtsi| 4 
 configs/da850evm_defconfig| 1 +
 configs/da850evm_direct_nor_defconfig | 1 +
 configs/da850evm_nand_defconfig   | 1 +
 include/configs/da850evm.h| 4 
 5 files changed, 11 insertions(+)

diff --git a/arch/arm/dts/da850-evm-u-boot.dtsi 
b/arch/arm/dts/da850-evm-u-boot.dtsi
index 1683f3472e..d9e8b9926a 100644
--- a/arch/arm/dts/da850-evm-u-boot.dtsi
+++ b/arch/arm/dts/da850-evm-u-boot.dtsi
@@ -10,6 +10,10 @@
soc@1c0 {
u-boot,dm-spl;
};
+
+   nand {
+   compatible = "ti,davinci-nand";
+   };
 };
 
  {
diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
index c095058282..8a891eb8aa 100644
--- a/configs/da850evm_defconfig
+++ b/configs/da850evm_defconfig
@@ -52,6 +52,7 @@ CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
+CONFIG_MTD=y
 CONFIG_MTD_DEVICE=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
diff --git a/configs/da850evm_direct_nor_defconfig 
b/configs/da850evm_direct_nor_defconfig
index 166e77b8e3..85c96f9951 100644
--- a/configs/da850evm_direct_nor_defconfig
+++ b/configs/da850evm_direct_nor_defconfig
@@ -42,6 +42,7 @@ CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
 # CONFIG_MMC is not set
+CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
diff --git a/configs/da850evm_nand_defconfig b/configs/da850evm_nand_defconfig
index 7271016346..187087768f 100644
--- a/configs/da850evm_nand_defconfig
+++ b/configs/da850evm_nand_defconfig
@@ -49,6 +49,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
+CONFIG_MTD=y
 CONFIG_NAND=y
 CONFIG_NAND_DAVINCI=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index ccdac0abec..b8556adbb1 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -182,6 +182,10 @@
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
 #define CONFIG_SPL_NAND_LOAD
+
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_SYS_NAND_SELF_INIT
+#endif
 #endif
 
 /*
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/4] davinci: omapl138-lcdk: enable driver model for NAND

2019-06-06 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Enable the driver-model on da850-lcdk. We need to add a dummy nand node
to the device tree, as the real nand node is a sub-node of the aemif
device.

On linux the aemif driver populates all its child nodes, but we can't do
it in u-boot currently.

Signed-off-by: Bartosz Golaszewski 
---
 arch/arm/dts/da850-lcdk-u-boot.dtsi | 4 
 configs/omapl138_lcdk_defconfig | 1 +
 include/configs/omapl138_lcdk.h | 4 
 3 files changed, 9 insertions(+)

diff --git a/arch/arm/dts/da850-lcdk-u-boot.dtsi 
b/arch/arm/dts/da850-lcdk-u-boot.dtsi
index 80dda8ef58..541f4ca200 100644
--- a/arch/arm/dts/da850-lcdk-u-boot.dtsi
+++ b/arch/arm/dts/da850-lcdk-u-boot.dtsi
@@ -9,4 +9,8 @@
aliases {
i2c0 = 
};
+
+   nand {
+   compatible = "ti,davinci-nand";
+   };
 };
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 48f251ebb8..94609f9a34 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -39,6 +39,7 @@ CONFIG_DM_I2C=y
 CONFIG_DM_I2C_COMPAT=y
 CONFIG_SYS_I2C_DAVINCI=y
 CONFIG_DM_MMC=y
+CONFIG_MTD=y
 CONFIG_NAND=y
 CONFIG_NAND_DAVINCI=y
 CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h
index da615e5063..a4dc060634 100644
--- a/include/configs/omapl138_lcdk.h
+++ b/include/configs/omapl138_lcdk.h
@@ -176,6 +176,10 @@
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
 #define CONFIG_SPL_NAND_LOAD
+
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_SYS_NAND_SELF_INIT
+#endif
 #endif
 
 #ifdef CONFIG_SYS_USE_NOR
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 0/4] nand: davinci: enable driver model for NAND

2019-06-06 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

This series enables the driver model for NAND on davinci da850 boards.

The first patch is a simple tweak for an unnecessarily exported function.

The second patch extends the NAND driver to support both legacy and
driver-model users. For now we don't parse the device-tree as it's a
bit complicated on da850, namely: the nand node is a child of the
aemif node for which we don't have a driver in u-boot (unlike on linux
where the aemif driver populates all its subnodes). In order for the
nand device to be probed, we're adding a dummy node to the u-boot dts
extensions with an appropriate compatible.

Two last patches enable driver model for NAND on da850-lcdk and da850-evm.
We don't enable the driver model in SPL as first: the patches enabling
CONFIG_SPL_DM are still waiting to be merged, and second: the
nand_spl_simple driver used by davinci SPL doesn't support driver model
users. This is planned for future series once some basic support is
merged.

Bartosz Golaszewski (4):
  nand: davinci: make davinci_nand_init() static
  nand: davinci: add support for driver model
  davinci: omapl138-lcdk: enable driver model for NAND
  davinci: da850-evm: enable driver model for NAND

 arch/arm/dts/da850-evm-u-boot.dtsi|  4 ++
 arch/arm/dts/da850-lcdk-u-boot.dtsi   |  4 ++
 arch/arm/include/asm/ti-common/davinci_nand.h |  2 -
 configs/da850evm_defconfig|  1 +
 configs/da850evm_direct_nor_defconfig |  1 +
 configs/da850evm_nand_defconfig   |  1 +
 configs/omapl138_lcdk_defconfig   |  1 +
 drivers/mtd/nand/raw/davinci_nand.c   | 48 ++-
 include/configs/da850evm.h|  4 ++
 include/configs/omapl138_lcdk.h   |  4 ++
 10 files changed, 66 insertions(+), 4 deletions(-)

-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/4] nand: davinci: make davinci_nand_init() static

2019-06-06 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

This function is only used within the driver itself. No need
to export it.

Signed-off-by: Bartosz Golaszewski 
---
 arch/arm/include/asm/ti-common/davinci_nand.h | 2 --
 drivers/mtd/nand/raw/davinci_nand.c   | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/ti-common/davinci_nand.h 
b/arch/arm/include/asm/ti-common/davinci_nand.h
index e26381c7fd..28842c3b15 100644
--- a/arch/arm/include/asm/ti-common/davinci_nand.h
+++ b/arch/arm/include/asm/ti-common/davinci_nand.h
@@ -95,6 +95,4 @@ struct davinci_emif_regs {
 #define DAVINCI_ABCR_ASIZE_16BIT   1
 #define DAVINCI_ABCR_ASIZE_8BIT0
 
-void davinci_nand_init(struct nand_chip *nand);
-
 #endif
diff --git a/drivers/mtd/nand/raw/davinci_nand.c 
b/drivers/mtd/nand/raw/davinci_nand.c
index cfa9b535c8..e1c4498cb9 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -730,7 +730,7 @@ static int nand_davinci_dev_ready(struct mtd_info *mtd)
return __raw_readl(_emif_regs->nandfsr) & 0x1;
 }
 
-void davinci_nand_init(struct nand_chip *nand)
+static void davinci_nand_init(struct nand_chip *nand)
 {
 #if defined CONFIG_KEYSTONE_RBL_NAND
int i;
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/4] nand: davinci: add support for driver model

2019-06-06 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Extend the davinci NAND driver to support the driver model. For now this
doesn't add any device-tree parsing due to the fact that we can't access
the actual nand node on the device-tree - it's a subnode of the aemif
device and we don't have an aemif driver on davinci at the moment.

Signed-off-by: Bartosz Golaszewski 
---
 drivers/mtd/nand/raw/davinci_nand.c | 46 -
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/davinci_nand.c 
b/drivers/mtd/nand/raw/davinci_nand.c
index e1c4498cb9..33c2f16be8 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* Definitions for 4-bit hardware ECC */
@@ -785,10 +786,53 @@ static void davinci_nand_init(struct nand_chip *nand)
nand->dev_ready = nand_davinci_dev_ready;
 }
 
-int board_nand_init(struct nand_chip *chip) __attribute__((weak));
+#ifdef CONFIG_SYS_NAND_SELF_INIT
+static int davinci_nand_probe(struct udevice *dev)
+{
+   struct nand_chip *nand = dev_get_priv(dev);
+   struct mtd_info *mtd = nand_to_mtd(nand);
+   int ret;
+
+   nand->IO_ADDR_R = (void __iomem *)CONFIG_SYS_NAND_BASE;
+   nand->IO_ADDR_W = (void __iomem *)CONFIG_SYS_NAND_BASE;
+
+   davinci_nand_init(nand);
+
+   ret = nand_scan(mtd, CONFIG_SYS_NAND_MAX_CHIPS);
+   if (ret)
+   return ret;
+
+   return nand_register(0, mtd);
+}
+
+static const struct udevice_id davinci_nand_ids[] = {
+   { .compatible = "ti,davinci-nand" },
+   { }
+};
+
+U_BOOT_DRIVER(davinci_nand) = {
+   .name   = "davinci-nand",
+   .id = UCLASS_MTD,
+   .of_match   = davinci_nand_ids,
+   .probe  = davinci_nand_probe,
+   .priv_auto_alloc_size = sizeof(struct nand_chip),
+};
+
+void board_nand_init(void)
+{
+   struct udevice *dev;
+   int ret;
 
+   ret = uclass_get_device_by_driver(UCLASS_MTD,
+ DM_GET_DRIVER(davinci_nand), );
+   if (ret && ret != -ENODEV)
+   pr_err("Failed to initialize %s: %d\n", dev->name, ret);
+}
+#else
+int board_nand_init(struct nand_chip *chip) __attribute__((weak));
 int board_nand_init(struct nand_chip *chip)
 {
davinci_nand_init(chip);
return 0;
 }
+#endif /* CONFIG_SYS_NAND_SELF_INIT */
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] net: davinci_emac: convert to using the driver model

2019-06-03 Thread Bartosz Golaszewski
pon., 3 cze 2019 o 15:03 Adam Ford  napisał(a):
>
> On Mon, Jun 3, 2019 at 3:12 AM Bartosz Golaszewski  wrote:
> >
> > sob., 1 cze 2019 o 05:24 Adam Ford  napisał(a):
> > >
> > > On Fri, May 31, 2019 at 8:32 AM Bartosz Golaszewski  wrote:
> > > >
> > > > From: Bartosz Golaszewski 
> > > >
> > > > Now that we removed all legacy boards selecting TI_EMAC we can
> > > > completely convert the driver code to using the driver model.
> > > > This patch also updates all remaining users of davinci_emac.
> > > >
> > >
> > > I took a break from this to come back, and I'm going to give some
> > > feedback about how the driver was written. I still do not know why I
> > > cannot get an IP address with this patch on the AM3517-evm.
> > >
> >
> > Hi Adam,
> >
> > thanks for all the testing. Unfortunately I can only test with
> > da850-evm and da850-lcdk.
> >
> > I was wondering if it is possible that the problem is caused by
> > cpu_eth_init() from ./arch/arm/mach-omap2/omap3/emac. not being called
> > with CONFIG_DM_ETH? The comments say that it brings the module out of
> > reset, so maybe this is what causes the problem you're seeing?
>
> I looked into that nearly right away, but there is a chunk of code in
> board/logicpd/am3517evm/am3517evm.c which has a function called
> misc_init_r() which does the same thing. Looking through the debug
> data, it appears as if the drive is communicating for a bit, but at
> some point it dies.  I'm not going to be able to look at it for a few
> days.  Is there any way you can submit a V2 to use #ifdef's to allow
> users to use the same driver with and without DM_ETH?  That would give
> the da850/L138 boards the DM_ETH, and give me some time to
> troubleshoot the am3517-evm. I know Sekhar works for TI and the AM3517
> was the official development kit for TI back in the day.  If TI has
> some ideas, I'm open to trying them as well when I can get back to it.
>
> adam

Hi Adam,

I'm trying to find out if I can get my hands on one of these boards somehow.

My priority for this week is the nand driver conversion. I'll also be
off next week and the one after. I think that since we already removed
a bunch of boards to make it possible to avoid the ifdef hell, it's
better to wait a bit more than to merge something that we'll remove
soon anyway.

If Sekhar agrees, we can push back merging of this patch until it's fixed.

There's also a big backlog of my other davinci patches on the list
anyway, maybe they'll get picked up before we get back to it.

Bart

>
> >
> > > > Signed-off-by: Bartosz Golaszewski 
> > > > ---
> > > >  arch/arm/mach-davinci/cpu.c| 13 -
> > > >  arch/arm/mach-omap2/omap3/emac.c   |  3 +-
> > > >  board/davinci/da8xxevm/da850evm.c  |  6 --
> > > >  board/davinci/da8xxevm/omapl138_lcdk.c | 14 -
> > > >  board/logicpd/am3517evm/am3517evm.c|  1 -
> > > >  board/ti/ti816x/evm.c  |  3 +-
> > > >  configs/am3517_evm_defconfig   |  1 +
> > > >  configs/da850evm_defconfig |  1 +
> > > >  configs/da850evm_direct_nor_defconfig  |  1 +
> > > >  configs/da850evm_nand_defconfig|  1 +
> > > >  configs/omapl138_lcdk_defconfig|  1 +
> > > >  configs/ti816x_evm_defconfig   |  1 +
> > > >  drivers/net/ti/davinci_emac.c  | 77 ++
> > > >  include/netdev.h   |  1 -
> > > >  14 files changed, 51 insertions(+), 73 deletions(-)
> > > >
> > > > diff --git a/arch/arm/mach-davinci/cpu.c b/arch/arm/mach-davinci/cpu.c
> > > > index f97ad3fc74..9fd6564d04 100644
> > > > --- a/arch/arm/mach-davinci/cpu.c
> > > > +++ b/arch/arm/mach-davinci/cpu.c
> > > > @@ -5,7 +5,6 @@
> > > >   */
> > > >
> > > >  #include 
> > > > -#include 
> > > >  #include 
> > > >  #include 
> > > >
> > > > @@ -90,15 +89,3 @@ int set_cpu_clk_info(void)
> > > > gd->bd->bi_dsp_freq = 0;
> > > > return 0;
> > > >  }
> > > > -
> > > > -/*
> > > > - * Initializes on-chip ethernet controllers.
> > > > - * to override, implement board_eth_init()
> > > > - */
> > > > -int cpu_eth_init(bd_t *bis)
> > > > -{
> > > > -#if defined(CONFIG_DRIVER_TI_EMAC)
> > > > -   davinci_emac_initialize();

Re: [U-Boot] [PATCH] net: davinci_emac: convert to using the driver model

2019-06-03 Thread Bartosz Golaszewski
sob., 1 cze 2019 o 05:24 Adam Ford  napisał(a):
>
> On Fri, May 31, 2019 at 8:32 AM Bartosz Golaszewski  wrote:
> >
> > From: Bartosz Golaszewski 
> >
> > Now that we removed all legacy boards selecting TI_EMAC we can
> > completely convert the driver code to using the driver model.
> > This patch also updates all remaining users of davinci_emac.
> >
>
> I took a break from this to come back, and I'm going to give some
> feedback about how the driver was written. I still do not know why I
> cannot get an IP address with this patch on the AM3517-evm.
>

Hi Adam,

thanks for all the testing. Unfortunately I can only test with
da850-evm and da850-lcdk.

I was wondering if it is possible that the problem is caused by
cpu_eth_init() from ./arch/arm/mach-omap2/omap3/emac. not being called
with CONFIG_DM_ETH? The comments say that it brings the module out of
reset, so maybe this is what causes the problem you're seeing?

> > Signed-off-by: Bartosz Golaszewski 
> > ---
> >  arch/arm/mach-davinci/cpu.c| 13 -
> >  arch/arm/mach-omap2/omap3/emac.c   |  3 +-
> >  board/davinci/da8xxevm/da850evm.c  |  6 --
> >  board/davinci/da8xxevm/omapl138_lcdk.c | 14 -
> >  board/logicpd/am3517evm/am3517evm.c|  1 -
> >  board/ti/ti816x/evm.c  |  3 +-
> >  configs/am3517_evm_defconfig   |  1 +
> >  configs/da850evm_defconfig |  1 +
> >  configs/da850evm_direct_nor_defconfig  |  1 +
> >  configs/da850evm_nand_defconfig|  1 +
> >  configs/omapl138_lcdk_defconfig|  1 +
> >  configs/ti816x_evm_defconfig   |  1 +
> >  drivers/net/ti/davinci_emac.c  | 77 ++
> >  include/netdev.h   |  1 -
> >  14 files changed, 51 insertions(+), 73 deletions(-)
> >
> > diff --git a/arch/arm/mach-davinci/cpu.c b/arch/arm/mach-davinci/cpu.c
> > index f97ad3fc74..9fd6564d04 100644
> > --- a/arch/arm/mach-davinci/cpu.c
> > +++ b/arch/arm/mach-davinci/cpu.c
> > @@ -5,7 +5,6 @@
> >   */
> >
> >  #include 
> > -#include 
> >  #include 
> >  #include 
> >
> > @@ -90,15 +89,3 @@ int set_cpu_clk_info(void)
> > gd->bd->bi_dsp_freq = 0;
> > return 0;
> >  }
> > -
> > -/*
> > - * Initializes on-chip ethernet controllers.
> > - * to override, implement board_eth_init()
> > - */
> > -int cpu_eth_init(bd_t *bis)
> > -{
> > -#if defined(CONFIG_DRIVER_TI_EMAC)
> > -   davinci_emac_initialize();
> > -#endif
> > -   return 0;
> > -}
> > diff --git a/arch/arm/mach-omap2/omap3/emac.c 
> > b/arch/arm/mach-omap2/omap3/emac.c
> > index c79e870183..fb0c9188f5 100644
> > --- a/arch/arm/mach-omap2/omap3/emac.c
> > +++ b/arch/arm/mach-omap2/omap3/emac.c
> > @@ -7,7 +7,6 @@
> >   */
> >
> >  #include 
> > -#include 
> >  #include 
> >  #include 
> >
> > @@ -24,5 +23,5 @@ int cpu_eth_init(bd_t *bis)
> > reset &= ~CPGMACSS_SW_RST;
> > writel(reset, _scm_general_regs->ip_sw_reset);
> >
> > -   return davinci_emac_initialize();
> > +   return 0;
> >  }
> > diff --git a/board/davinci/da8xxevm/da850evm.c 
> > b/board/davinci/da8xxevm/da850evm.c
> > index 1bc26828bf..d090c00466 100644
> > --- a/board/davinci/da8xxevm/da850evm.c
> > +++ b/board/davinci/da8xxevm/da850evm.c
> > @@ -13,7 +13,6 @@
> >  #include 
> >  #include 
> >  #include 
> > -#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -472,11 +471,6 @@ int board_eth_init(bd_t *bis)
> > if (rmii_hw_init())
> > printf("RMII hardware init failed!!!\n");
> >  #endif
> > -   if (!davinci_emac_initialize()) {
> > -   printf("Error: Ethernet init failed!\n");
> > -   return -1;
> > -   }
> > -
> > return 0;
> >  }
> >  #endif /* CONFIG_DRIVER_TI_EMAC */
> > diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
> > b/board/davinci/da8xxevm/omapl138_lcdk.c
> > index 2c2f885d43..ef9656add8 100644
> > --- a/board/davinci/da8xxevm/omapl138_lcdk.c
> > +++ b/board/davinci/da8xxevm/omapl138_lcdk.c
> > @@ -11,7 +11,6 @@
> >  #include 
> >  #include 
> >  #include 
> > -#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -229,19 +228,6 @@ int board_init(void)
> >
> >  #ifdef CONFIG_DRIVER_TI_EMAC
> >
> > -/*
> > - * Initializes on-boa

[U-Boot] [PATCH] net: davinci_emac: convert to using the driver model

2019-05-31 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Now that we removed all legacy boards selecting TI_EMAC we can
completely convert the driver code to using the driver model.
This patch also updates all remaining users of davinci_emac.

Signed-off-by: Bartosz Golaszewski 
---
 arch/arm/mach-davinci/cpu.c| 13 -
 arch/arm/mach-omap2/omap3/emac.c   |  3 +-
 board/davinci/da8xxevm/da850evm.c  |  6 --
 board/davinci/da8xxevm/omapl138_lcdk.c | 14 -
 board/logicpd/am3517evm/am3517evm.c|  1 -
 board/ti/ti816x/evm.c  |  3 +-
 configs/am3517_evm_defconfig   |  1 +
 configs/da850evm_defconfig |  1 +
 configs/da850evm_direct_nor_defconfig  |  1 +
 configs/da850evm_nand_defconfig|  1 +
 configs/omapl138_lcdk_defconfig|  1 +
 configs/ti816x_evm_defconfig   |  1 +
 drivers/net/ti/davinci_emac.c  | 77 ++
 include/netdev.h   |  1 -
 14 files changed, 51 insertions(+), 73 deletions(-)

diff --git a/arch/arm/mach-davinci/cpu.c b/arch/arm/mach-davinci/cpu.c
index f97ad3fc74..9fd6564d04 100644
--- a/arch/arm/mach-davinci/cpu.c
+++ b/arch/arm/mach-davinci/cpu.c
@@ -5,7 +5,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 
@@ -90,15 +89,3 @@ int set_cpu_clk_info(void)
gd->bd->bi_dsp_freq = 0;
return 0;
 }
-
-/*
- * Initializes on-chip ethernet controllers.
- * to override, implement board_eth_init()
- */
-int cpu_eth_init(bd_t *bis)
-{
-#if defined(CONFIG_DRIVER_TI_EMAC)
-   davinci_emac_initialize();
-#endif
-   return 0;
-}
diff --git a/arch/arm/mach-omap2/omap3/emac.c b/arch/arm/mach-omap2/omap3/emac.c
index c79e870183..fb0c9188f5 100644
--- a/arch/arm/mach-omap2/omap3/emac.c
+++ b/arch/arm/mach-omap2/omap3/emac.c
@@ -7,7 +7,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 
@@ -24,5 +23,5 @@ int cpu_eth_init(bd_t *bis)
reset &= ~CPGMACSS_SW_RST;
writel(reset, _scm_general_regs->ip_sw_reset);
 
-   return davinci_emac_initialize();
+   return 0;
 }
diff --git a/board/davinci/da8xxevm/da850evm.c 
b/board/davinci/da8xxevm/da850evm.c
index 1bc26828bf..d090c00466 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -13,7 +13,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -472,11 +471,6 @@ int board_eth_init(bd_t *bis)
if (rmii_hw_init())
printf("RMII hardware init failed!!!\n");
 #endif
-   if (!davinci_emac_initialize()) {
-   printf("Error: Ethernet init failed!\n");
-   return -1;
-   }
-
return 0;
 }
 #endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index 2c2f885d43..ef9656add8 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -229,19 +228,6 @@ int board_init(void)
 
 #ifdef CONFIG_DRIVER_TI_EMAC
 
-/*
- * Initializes on-board ethernet controllers.
- */
-int board_eth_init(bd_t *bis)
-{
-   if (!davinci_emac_initialize()) {
-   printf("Error: Ethernet init failed!\n");
-   return -1;
-   }
-
-   return 0;
-}
-
 #endif /* CONFIG_DRIVER_TI_EMAC */
 
 #define CFG_MAC_ADDR_SPI_BUS   0
diff --git a/board/logicpd/am3517evm/am3517evm.c 
b/board/logicpd/am3517evm/am3517evm.c
index 10031a4801..bfd4e78274 100644
--- a/board/logicpd/am3517evm/am3517evm.c
+++ b/board/logicpd/am3517evm/am3517evm.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include "am3517evm.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c
index 07a084bab8..240df8cbe1 100644
--- a/board/ti/ti816x/evm.c
+++ b/board/ti/ti816x/evm.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -56,7 +55,7 @@ int board_eth_init(bd_t *bis)
printf("Unable to read MAC address. Set \n");
}
 
-   return davinci_emac_initialize();
+   return 0;
 }
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig
index b9f59f3291..5cb76322df 100644
--- a/configs/am3517_evm_defconfig
+++ b/configs/am3517_evm_defconfig
@@ -44,6 +44,7 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x8
 CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
 CONFIG_PINCTRL=y
diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
index 8c16d5c4f5..ca304ed78a 100644
--- a/configs/da850evm_defconfig
+++ b/configs/da850evm_defconfig
@@ -60,6 +60,7 @@ CONFIG_SF_DEFAULT_SPEED=3000
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SPI_FLASH_MTD=y
+CONFIG_DM_ETH=y
 CONFIG_MII=y

Re: [U-Boot] [PATCH] ARM: davinci: Remove ipam390 linker script from Kconfig

2019-05-31 Thread Bartosz Golaszewski
pt., 31 maj 2019 o 01:04 Adam Ford  napisał(a):
>
> With ipam390 support removed in we can remove the reference to the
> linker script since that case will never be true.
>
> Signed-off-by: Adam Ford 
>
> diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
> index 61e84e5129..adc50922c8 100644
> --- a/arch/arm/mach-davinci/Kconfig
> +++ b/arch/arm/mach-davinci/Kconfig
> @@ -134,7 +134,6 @@ source "board/davinci/da8xxevm/Kconfig"
>  source "board/lego/ev3/Kconfig"
>
>  config SPL_LDSCRIPT
> -   default "board/$(BOARDDIR)/u-boot-spl-ipam390.lds" if TARGET_IPAM390
> default "board/$(BOARDDIR)/u-boot-spl-da850evm.lds"
>
>  endif
> --
> 2.17.1
>

Reviewed-by: Bartosz Golaszewski 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] arm: davinci: remove leftover assembly

2019-05-31 Thread Bartosz Golaszewski
śr., 29 maj 2019 o 19:18 Tom Rini  napisał(a):
>
> On Mon, May 20, 2019 at 06:29:38PM +0200, Bartosz Golaszewski wrote:
>
> > From: Bartosz Golaszewski 
> >
> > There are no more users of lowlevel_init.S. Remove the file.
> >
> > Suggested-by: Adam Ford 
> > Signed-off-by: Bartosz Golaszewski 
>
> Applied to u-boot/master, thanks!
>
> --
> Tom

Hi Tom,

I don't see this patch in master. I think you didn't push it.

Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] davinci: omapl138-lcdk: enable driver-model in SPL

2019-05-29 Thread Bartosz Golaszewski
śr., 29 maj 2019 o 15:47 Adam Ford  napisał(a):
>
> On Wed, May 29, 2019 at 8:23 AM Bartosz Golaszewski  wrote:
> >
> > śr., 29 maj 2019 o 15:04 Adam Ford  napisał(a):
> > >
> > > On Wed, May 29, 2019 at 4:40 AM Bartosz Golaszewski  wrote:
> > > >
> > > > wt., 28 maj 2019 o 17:05 Adam Ford  napisał(a):
> > > > >
> > > > > On Tue, May 28, 2019 at 2:58 AM Bartosz Golaszewski  
> > > > > wrote:
> > > > > >
> > > > > > From: Bartosz Golaszewski 
> > > > > >
> > > > > > Enable CONFIG_SPL_DM and enable the driver model for serial by 
> > > > > > defining
> > > > > > an appropriate device in the board file for da850-lcdk.
> > > > > >
> > > > > > Signed-off-by: Bartosz Golaszewski 
> > > > > > ---
> > > > > >  board/davinci/da8xxevm/omapl138_lcdk.c | 16 
> > > > > >  configs/omapl138_lcdk_defconfig|  5 +
> > > > > >  2 files changed, 21 insertions(+)
> > > > > >
> > > > > > diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
> > > > > > b/board/davinci/da8xxevm/omapl138_lcdk.c
> > > > > > index 156d61d9fb..b20747ba01 100644
> > > > > > --- a/board/davinci/da8xxevm/omapl138_lcdk.c
> > > > > > +++ b/board/davinci/da8xxevm/omapl138_lcdk.c
> > > > > > @@ -15,6 +15,8 @@
> > > > > >  #include 
> > > > > >  #include 
> > > > > >  #include 
> > > > > > +#include 
> > > > > > +#include 
> > > > > >  #include 
> > > > > >  #include 
> > > > > >  #include 
> > > > > > @@ -369,3 +371,17 @@ int board_mmc_init(bd_t *bis)
> > > > > >  }
> > > > > >  #endif
> > > > > >  #endif
> > > > > > +
> > > > > > +#ifdef CONFIG_SPL_BUILD
> > > > > > +static const struct ns16550_platdata serial_pdata = {
> > > > > > +   .base = DAVINCI_UART2_BASE,
> > > > > > +   .reg_shift = 2,
> > > > > > +   .clock = 22800,
> > > > > > +   .fcr = UART_FCR_DEFVAL,
> > > > > > +};
> > > > > > +
> > > > > > +U_BOOT_DEVICE(omapl138_uart) = {
> > > > > > +   .name = "ns16550_serial",
> > > > > > +   .platdata = _pdata,
> > > > > > +};
> > > > > > +#endif
> > > > > > diff --git a/configs/omapl138_lcdk_defconfig 
> > > > > > b/configs/omapl138_lcdk_defconfig
> > > > > > index b375da50df..f53a51321c 100644
> > > > > > --- a/configs/omapl138_lcdk_defconfig
> > > > > > +++ b/configs/omapl138_lcdk_defconfig
> > > > > > @@ -33,10 +33,13 @@ CONFIG_CMD_MTDPARTS=y
> > > > > >  CONFIG_CMD_DIAG=y
> > > > > >  CONFIG_CMD_UBI=y
> > > > > >  CONFIG_OF_CONTROL=y
> > > > > > +CONFIG_SPL_OF_CONTROL=y
> > > > >
> > > > > If SPL_OF_CONTROL is being added, why do you need to manually add the
> > > > > stuff above for the serial port?  Checkout the da850-evm-u-boot.dtsi
> > > > > file.  I adds the device tree entries for the serial port to appear in
> > > > > the SPL DTB.
> > > > >
> > > > > See 
> > > > > http://git.denx.de/?p=u-boot.git;a=commit;h=f7c1d53605d9ec528abacda9ba1763c67221fc88
> > > > >
> > > >
> > > > I tried to follow the example from this patch but for some reason
> > > > adding u-boot,dm-spl; to the soc@1c0 node in
> > > > da850-lcdk-u-boot.dtsi results in the final image being reported as
> > > > corrupted by the aisimage tool:
> > > >
> > > > [...]
> > > >   COPYspl/u-boot-spl.dtb
> > > >   CC  spl/common/spl/spl.o
> > > >   LD  spl/common/spl/built-in.o
> > > >   CC  spl/lib/display_options.o
> > > >   LD  spl/lib/built-in.o
> > > >   LD  spl/u-boot-spl
> > > >   OBJCOPY spl/u-boot-spl-nodtb.bin
> > > >   CAT spl/u-boot-spl-dtb.bin
> > > >   COPYspl/u-boot-spl.bin
> > > >   MKIMAGE spl/u-boot-spl.ais
> > > > Error: -  AIS Image corrupt

Re: [U-Boot] [PATCH 4/4] davinci: omapl138-lcdk: enable driver-model in SPL

2019-05-29 Thread Bartosz Golaszewski
śr., 29 maj 2019 o 15:04 Adam Ford  napisał(a):
>
> On Wed, May 29, 2019 at 4:40 AM Bartosz Golaszewski  wrote:
> >
> > wt., 28 maj 2019 o 17:05 Adam Ford  napisał(a):
> > >
> > > On Tue, May 28, 2019 at 2:58 AM Bartosz Golaszewski  wrote:
> > > >
> > > > From: Bartosz Golaszewski 
> > > >
> > > > Enable CONFIG_SPL_DM and enable the driver model for serial by defining
> > > > an appropriate device in the board file for da850-lcdk.
> > > >
> > > > Signed-off-by: Bartosz Golaszewski 
> > > > ---
> > > >  board/davinci/da8xxevm/omapl138_lcdk.c | 16 
> > > >  configs/omapl138_lcdk_defconfig|  5 +
> > > >  2 files changed, 21 insertions(+)
> > > >
> > > > diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
> > > > b/board/davinci/da8xxevm/omapl138_lcdk.c
> > > > index 156d61d9fb..b20747ba01 100644
> > > > --- a/board/davinci/da8xxevm/omapl138_lcdk.c
> > > > +++ b/board/davinci/da8xxevm/omapl138_lcdk.c
> > > > @@ -15,6 +15,8 @@
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > +#include 
> > > > +#include 
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > @@ -369,3 +371,17 @@ int board_mmc_init(bd_t *bis)
> > > >  }
> > > >  #endif
> > > >  #endif
> > > > +
> > > > +#ifdef CONFIG_SPL_BUILD
> > > > +static const struct ns16550_platdata serial_pdata = {
> > > > +   .base = DAVINCI_UART2_BASE,
> > > > +   .reg_shift = 2,
> > > > +   .clock = 22800,
> > > > +   .fcr = UART_FCR_DEFVAL,
> > > > +};
> > > > +
> > > > +U_BOOT_DEVICE(omapl138_uart) = {
> > > > +   .name = "ns16550_serial",
> > > > +   .platdata = _pdata,
> > > > +};
> > > > +#endif
> > > > diff --git a/configs/omapl138_lcdk_defconfig 
> > > > b/configs/omapl138_lcdk_defconfig
> > > > index b375da50df..f53a51321c 100644
> > > > --- a/configs/omapl138_lcdk_defconfig
> > > > +++ b/configs/omapl138_lcdk_defconfig
> > > > @@ -33,10 +33,13 @@ CONFIG_CMD_MTDPARTS=y
> > > >  CONFIG_CMD_DIAG=y
> > > >  CONFIG_CMD_UBI=y
> > > >  CONFIG_OF_CONTROL=y
> > > > +CONFIG_SPL_OF_CONTROL=y
> > >
> > > If SPL_OF_CONTROL is being added, why do you need to manually add the
> > > stuff above for the serial port?  Checkout the da850-evm-u-boot.dtsi
> > > file.  I adds the device tree entries for the serial port to appear in
> > > the SPL DTB.
> > >
> > > See 
> > > http://git.denx.de/?p=u-boot.git;a=commit;h=f7c1d53605d9ec528abacda9ba1763c67221fc88
> > >
> >
> > I tried to follow the example from this patch but for some reason
> > adding u-boot,dm-spl; to the soc@1c0 node in
> > da850-lcdk-u-boot.dtsi results in the final image being reported as
> > corrupted by the aisimage tool:
> >
> > [...]
> >   COPYspl/u-boot-spl.dtb
> >   CC  spl/common/spl/spl.o
> >   LD  spl/common/spl/built-in.o
> >   CC  spl/lib/display_options.o
> >   LD  spl/lib/built-in.o
> >   LD  spl/u-boot-spl
> >   OBJCOPY spl/u-boot-spl-nodtb.bin
> >   CAT spl/u-boot-spl-dtb.bin
> >   COPYspl/u-boot-spl.bin
> >   MKIMAGE spl/u-boot-spl.ais
> > Error: -  AIS Image corrupted
> >   CAT u-boot.ais
> >   CFGCHK  u-boot.cfg
> >
> > The image doen't boot (or at least there's nothing on the console).
> >
> > I'm not sure what's causing it. Any idea?
>
> I got the same 'AIS Image corrupted' message if the SPL + DTB image is
> too large.
>
> I enabled SPL_SYS_MALLOC_SIMPLE along with USE_TINY_PRINTF reduced my code 
> size:
> (see commit c4fa049a121457ff38b74daac32e18d7afbd4538)
> Original:
>   textdata bss dec hex filename
>   207601216  80   220565628 spl/u-boot-spl
>
> Tiny Printf
>textdata bss dec hex filename
>   179471216  80   192434b2b spl/u-boot-spl
>
> Malloc Simple + Tiny Printf
>textdata bss dec hex filename
>   15187 176  28   153913c1f spl/u-boot-spl
>
> I think you can also setup CONFIG_SPL_SYS_THUMB_BUILD to also reduce
> size.  The DA850 evm has that and CONFIG_SYS_THUMB_BUILD set to sh

Re: [U-Boot] [PATCH] configs/legoev3: define CONFIG_SKIP_LOWLEVEL_INIT

2019-05-29 Thread Bartosz Golaszewski
śr., 29 maj 2019 o 03:55 David Lechner  napisał(a):
>
> On 5/28/19 8:52 PM, Adam Ford wrote:
> > On Tue, May 28, 2019 at 7:03 PM David Lechner  wrote:
> >>
> >> This adds a define for CONFIG_SKIP_LOWLEVEL_INIT in the legoev3 config.
> >> On the EV3, U-Boot is loaded into RAM by another bootloader, so we
> >> don't need the lowlevel init in U-Boot.
> >>
> >> Signed-off-by: David Lechner 
> >> ---
> >>   include/configs/legoev3.h | 1 +
> >>   1 file changed, 1 insertion(+)
> >>
> >> diff --git a/include/configs/legoev3.h b/include/configs/legoev3.h
> >> index 1e239ecadd..36ca3b201e 100644
> >> --- a/include/configs/legoev3.h
> >> +++ b/include/configs/legoev3.h
> >> @@ -22,6 +22,7 @@
> >>   #define CONFIG_SYS_OSCIN_FREQ  2400
> >>   #define CONFIG_SYS_TIMERBASE   DAVINCI_TIMER0_BASE
> >>   #define CONFIG_SYS_HZ_CLOCKclk_get(DAVINCI_AUXCLK_CLKID)
> >> +#define CONFIG_SKIP_LOWLEVEL_INIT
> >
> > If that's the case, does this mean that the NAK'd patch from Bartosz
> > removing the dead code can be accepted?
>
> Probably

I will resend the two patches in a single series to avoid confusion.

Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] davinci: omapl138-lcdk: enable driver-model in SPL

2019-05-29 Thread Bartosz Golaszewski
wt., 28 maj 2019 o 17:05 Adam Ford  napisał(a):
>
> On Tue, May 28, 2019 at 2:58 AM Bartosz Golaszewski  wrote:
> >
> > From: Bartosz Golaszewski 
> >
> > Enable CONFIG_SPL_DM and enable the driver model for serial by defining
> > an appropriate device in the board file for da850-lcdk.
> >
> > Signed-off-by: Bartosz Golaszewski 
> > ---
> >  board/davinci/da8xxevm/omapl138_lcdk.c | 16 
> >  configs/omapl138_lcdk_defconfig|  5 +
> >  2 files changed, 21 insertions(+)
> >
> > diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
> > b/board/davinci/da8xxevm/omapl138_lcdk.c
> > index 156d61d9fb..b20747ba01 100644
> > --- a/board/davinci/da8xxevm/omapl138_lcdk.c
> > +++ b/board/davinci/da8xxevm/omapl138_lcdk.c
> > @@ -15,6 +15,8 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -369,3 +371,17 @@ int board_mmc_init(bd_t *bis)
> >  }
> >  #endif
> >  #endif
> > +
> > +#ifdef CONFIG_SPL_BUILD
> > +static const struct ns16550_platdata serial_pdata = {
> > +   .base = DAVINCI_UART2_BASE,
> > +   .reg_shift = 2,
> > +   .clock = 22800,
> > +   .fcr = UART_FCR_DEFVAL,
> > +};
> > +
> > +U_BOOT_DEVICE(omapl138_uart) = {
> > +   .name = "ns16550_serial",
> > +   .platdata = _pdata,
> > +};
> > +#endif
> > diff --git a/configs/omapl138_lcdk_defconfig 
> > b/configs/omapl138_lcdk_defconfig
> > index b375da50df..f53a51321c 100644
> > --- a/configs/omapl138_lcdk_defconfig
> > +++ b/configs/omapl138_lcdk_defconfig
> > @@ -33,10 +33,13 @@ CONFIG_CMD_MTDPARTS=y
> >  CONFIG_CMD_DIAG=y
> >  CONFIG_CMD_UBI=y
> >  CONFIG_OF_CONTROL=y
> > +CONFIG_SPL_OF_CONTROL=y
>
> If SPL_OF_CONTROL is being added, why do you need to manually add the
> stuff above for the serial port?  Checkout the da850-evm-u-boot.dtsi
> file.  I adds the device tree entries for the serial port to appear in
> the SPL DTB.
>
> See 
> http://git.denx.de/?p=u-boot.git;a=commit;h=f7c1d53605d9ec528abacda9ba1763c67221fc88
>

I tried to follow the example from this patch but for some reason
adding u-boot,dm-spl; to the soc@1c0 node in
da850-lcdk-u-boot.dtsi results in the final image being reported as
corrupted by the aisimage tool:

[...]
  COPYspl/u-boot-spl.dtb
  CC  spl/common/spl/spl.o
  LD  spl/common/spl/built-in.o
  CC  spl/lib/display_options.o
  LD  spl/lib/built-in.o
  LD  spl/u-boot-spl
  OBJCOPY spl/u-boot-spl-nodtb.bin
  CAT spl/u-boot-spl-dtb.bin
  COPYspl/u-boot-spl.bin
  MKIMAGE spl/u-boot-spl.ais
Error: -  AIS Image corrupted
  CAT u-boot.ais
  CFGCHK  u-boot.cfg

The image doen't boot (or at least there's nothing on the console).

I'm not sure what's causing it. Any idea?

Bart

>
> >  CONFIG_DEFAULT_DEVICE_TREE="da850-lcdk"
> > +CONFIG_SPL_OF_PLATDATA=y
> >  CONFIG_ENV_IS_IN_NAND=y
> >  CONFIG_NET_RANDOM_ETHADDR=y
> >  CONFIG_DM=y
> > +CONFIG_SPL_DM=y
> >  CONFIG_DM_I2C=y
> >  CONFIG_DM_I2C_COMPAT=y
> >  CONFIG_SYS_I2C_DAVINCI=y
> > @@ -53,8 +56,10 @@ CONFIG_SPI_FLASH_STMICRO=y
> >  CONFIG_SPI_FLASH_WINBOND=y
> >  CONFIG_MII=y
> >  CONFIG_DRIVER_TI_EMAC=y
> > +CONFIG_SPECIFY_CONSOLE_INDEX=y
> >  CONFIG_DM_SERIAL=y
> >  CONFIG_SYS_NS16550=y
> >  CONFIG_SPI=y
> >  CONFIG_DAVINCI_SPI=y
> >  CONFIG_USE_TINY_PRINTF=y
> > +# CONFIG_SPL_OF_LIBFDT is not set
> > --
> > 2.21.0
> >
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/2] configs/legoev3: define CONFIG_SKIP_LOWLEVEL_INIT

2019-05-29 Thread Bartosz Golaszewski
From: David Lechner 

This adds a define for CONFIG_SKIP_LOWLEVEL_INIT in the legoev3 config.
On the EV3, U-Boot is loaded into RAM by another bootloader, so we
don't need the lowlevel init in U-Boot.

Signed-off-by: David Lechner 
Signed-off-by: Bartosz Golaszewski 
---
 include/configs/legoev3.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/legoev3.h b/include/configs/legoev3.h
index 1e239ecadd..36ca3b201e 100644
--- a/include/configs/legoev3.h
+++ b/include/configs/legoev3.h
@@ -22,6 +22,7 @@
 #define CONFIG_SYS_OSCIN_FREQ  2400
 #define CONFIG_SYS_TIMERBASE   DAVINCI_TIMER0_BASE
 #define CONFIG_SYS_HZ_CLOCKclk_get(DAVINCI_AUXCLK_CLKID)
+#define CONFIG_SKIP_LOWLEVEL_INIT
 
 /*
  * Memory Info
-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 0/2] davinci: remove leftover low-level routines

2019-05-29 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

I'm resending my earlier patch together with David's commit that makes
this series not break the build for LEGO EV3.

Bartosz Golaszewski (1):
  arm: davinci: remove leftover assembly

David Lechner (1):
  configs/legoev3: define CONFIG_SKIP_LOWLEVEL_INIT

 arch/arm/mach-davinci/Makefile|   4 -
 arch/arm/mach-davinci/lowlevel_init.S | 692 --
 include/configs/legoev3.h |   1 +
 3 files changed, 1 insertion(+), 696 deletions(-)
 delete mode 100644 arch/arm/mach-davinci/lowlevel_init.S

-- 
2.21.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


  1   2   >