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

2020-06-18 Thread Lokesh Vutla



On 22/05/20 7:32 am, Faiz Abbas wrote:
> 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 

Applied to u-boot-ti next.

Thanks and regards,
Lokesh



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

2020-05-26 Thread Simon Glass
Hi Faiz,

On Tue, 26 May 2020 at 11:37, Faiz Abbas  wrote:
>
> Simon,
>
> On 26/05/20 10:24 pm, Simon Glass wrote:
> > Hi Faiz,
> >
> > I have ended up with an omap L138 lcdk board. Do you have instructions
> > on how to get it booting from uSD and how to create the card image?  I
> > have tried various sources but nothing works so far. Also, are you
> > able to send me a test image I can 'dd' onto the board?
> >
>
> The commands in board/davinci/da8xxevm/README.da850 don't work?
>
> Try the following:
>
>  2 - using the "dd" command
> $ dd if=u-boot.ais of=/dev/mmcblk0 seek=117 bs=512 conv=fsync

Thanks! I didn't make the connection with da850 or think to look in
board/ for docs.

Regards,
Simon


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

2020-05-26 Thread Faiz Abbas
Simon,

On 26/05/20 10:24 pm, Simon Glass wrote:
> Hi Faiz,
> 
> I have ended up with an omap L138 lcdk board. Do you have instructions
> on how to get it booting from uSD and how to create the card image?  I
> have tried various sources but nothing works so far. Also, are you
> able to send me a test image I can 'dd' onto the board?
> 

The commands in board/davinci/da8xxevm/README.da850 don't work?

Try the following:

 2 - using the "dd" command
$ dd if=u-boot.ais of=/dev/mmcblk0 seek=117 bs=512 conv=fsync

Thanks,
Faiz



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

2020-05-26 Thread Simon Glass
Hi Faiz,

I have ended up with an omap L138 lcdk board. Do you have instructions
on how to get it booting from uSD and how to create the card image?  I
have tried various sources but nothing works so far. Also, are you
able to send me a test image I can 'dd' onto the board?

Regards,
Simon

On Mon, 25 May 2020 at 09:38, Simon Glass  wrote:
>
> Hi Faiz,
>
> On Mon, 25 May 2020 at 09:33, Faiz Abbas  wrote:
> >
> > Hi Simon,
> >
> > On 25/05/20 8:27 pm, Simon Glass wrote:
> > > Hi Faiz,
> > >
> > > On Thu, 21 May 2020 at 20:02, Faiz Abbas  wrote:
> > >>
> > >> 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 
> > >> ---
> > >>
> > >> This patch fixes things being broken by Simon's series disabling
> > >> libfdt when using of-platdata:
> > >> https://patchwork.ozlabs.org/project/uboot/cover/20191107155318.103300-1-...@chromium.org/
> > >>
> > >>
> > >>  .../mach-davinci/include/mach/sdmmc_defs.h|  7 +++
> > >>  board/davinci/da8xxevm/omapl138_lcdk.c| 12 
> > >>  configs/omapl138_lcdk_defconfig   |  4 --
> > >>  drivers/mmc/davinci_mmc.c | 63 ---
> > >>  4 files changed, 45 insertions(+), 41 deletions(-)
> > >
> > > Could this use of-platdata instead?
> > >
> >
> > We would need to implement address translation in of-platdata to do that. I 
> > prefer merging your
> > fixes with this for now and leave of-platdata up for the future.
>
> OK, yes, we can't wait for non-existent features.
>
> There is a bit of a queue of functionality lining up for of-platdata at 
> present.
>
> Regards,
> Simon


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

2020-05-25 Thread Simon Glass
Hi Faiz,

On Mon, 25 May 2020 at 09:33, Faiz Abbas  wrote:
>
> Hi Simon,
>
> On 25/05/20 8:27 pm, Simon Glass wrote:
> > Hi Faiz,
> >
> > On Thu, 21 May 2020 at 20:02, Faiz Abbas  wrote:
> >>
> >> 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 
> >> ---
> >>
> >> This patch fixes things being broken by Simon's series disabling
> >> libfdt when using of-platdata:
> >> https://patchwork.ozlabs.org/project/uboot/cover/20191107155318.103300-1-...@chromium.org/
> >>
> >>
> >>  .../mach-davinci/include/mach/sdmmc_defs.h|  7 +++
> >>  board/davinci/da8xxevm/omapl138_lcdk.c| 12 
> >>  configs/omapl138_lcdk_defconfig   |  4 --
> >>  drivers/mmc/davinci_mmc.c | 63 ---
> >>  4 files changed, 45 insertions(+), 41 deletions(-)
> >
> > Could this use of-platdata instead?
> >
>
> We would need to implement address translation in of-platdata to do that. I 
> prefer merging your
> fixes with this for now and leave of-platdata up for the future.

OK, yes, we can't wait for non-existent features.

There is a bit of a queue of functionality lining up for of-platdata at present.

Regards,
Simon


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

2020-05-25 Thread Faiz Abbas
Hi Simon,

On 25/05/20 8:27 pm, Simon Glass wrote:
> Hi Faiz,
> 
> On Thu, 21 May 2020 at 20:02, Faiz Abbas  wrote:
>>
>> 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 
>> ---
>>
>> This patch fixes things being broken by Simon's series disabling
>> libfdt when using of-platdata:
>> https://patchwork.ozlabs.org/project/uboot/cover/20191107155318.103300-1-...@chromium.org/
>>
>>
>>  .../mach-davinci/include/mach/sdmmc_defs.h|  7 +++
>>  board/davinci/da8xxevm/omapl138_lcdk.c| 12 
>>  configs/omapl138_lcdk_defconfig   |  4 --
>>  drivers/mmc/davinci_mmc.c | 63 ---
>>  4 files changed, 45 insertions(+), 41 deletions(-)
> 
> Could this use of-platdata instead?
> 

We would need to implement address translation in of-platdata to do that. I 
prefer merging your
fixes with this for now and leave of-platdata up for the future.

Thanks,
Faiz


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

2020-05-25 Thread Simon Glass
Hi Faiz,

On Thu, 21 May 2020 at 20:02, Faiz Abbas  wrote:
>
> 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 
> ---
>
> This patch fixes things being broken by Simon's series disabling
> libfdt when using of-platdata:
> https://patchwork.ozlabs.org/project/uboot/cover/20191107155318.103300-1-...@chromium.org/
>
>
>  .../mach-davinci/include/mach/sdmmc_defs.h|  7 +++
>  board/davinci/da8xxevm/omapl138_lcdk.c| 12 
>  configs/omapl138_lcdk_defconfig   |  4 --
>  drivers/mmc/davinci_mmc.c | 63 ---
>  4 files changed, 45 insertions(+), 41 deletions(-)

Could this use of-platdata instead?

Regards,
Simon


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 


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

2020-05-21 Thread Faiz Abbas
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 
---

This patch fixes things being broken by Simon's series disabling
libfdt when using of-platdata:
https://patchwork.ozlabs.org/project/uboot/cover/20191107155318.103300-1-...@chromium.org/


 .../mach-davinci/include/mach/sdmmc_defs.h|  7 +++
 board/davinci/da8xxevm/omapl138_lcdk.c| 12 
 configs/omapl138_lcdk_defconfig   |  4 --
 drivers/mmc/davinci_mmc.c | 63 ---
 4 files changed, 45 insertions(+), 41 deletions(-)

diff --git a/arch/arm/mach-davinci/include/mach/sdmmc_defs.h 
b/arch/arm/mach-davinci/include/mach/sdmmc_defs.h
index 46f6391aa2..f95a607e52 100644
--- a/arch/arm/mach-davinci/include/mach/sdmmc_defs.h
+++ b/arch/arm/mach-davinci/include/mach/sdmmc_defs.h
@@ -152,6 +152,13 @@ struct davinci_mmc {
struct mmc_config cfg;
 };
 
+#define DAVINCI_MAX_BLOCKS (32)
+struct davinci_mmc_plat {
+   struct davinci_mmc_regs *reg_base;  /* Register base address */
+   struct mmc_config cfg;
+   struct mmc mmc;
+};
+
 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 adb56c6c87..84603cb117 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -368,8 +368,20 @@ U_BOOT_DEVICE(omapl138_uart) = {
.platdata = &serial_pdata,
 };
 
+static const struct davinci_mmc_plat mmc_platdata = {
+   .reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE,
+   .cfg = {
+   .f_min = 20,
+   .f_max = 2500,
+   .voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
+   .host_caps = MMC_MODE_4BIT,
+   .b_max = DAVINCI_MAX_BLOCKS,
+   .name = "da830-mmc",
+   },
+};
 U_BOOT_DEVICE(omapl138_mmc) = {
.name = "davinci_mmc",
+   .platdata = &mmc_platdata,
 };
 
 void spl_board_init(void)
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
index 50cf09c7f1..b0a58de03d 100644
--- a/configs/omapl138_lcdk_defconfig
+++ b/configs/omapl138_lcdk_defconfig
@@ -40,16 +40,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_SYS_RELOC_GD_ENV_ADDR=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_DA8XX_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DAVINCI=y
@@ -82,4 +79,3 @@ CONFIG_USB_MUSB_HOST=y
 CONFIG_USB_MUSB_DA8XX=y
 CONFIG_USB_MUSB_PIO_ONLY=y
 CONFIG_USB_STORAGE=y
-# CONFIG_SPL_OF_LIBFDT is not set
diff --git a/drivers/mmc/davinci_mmc.c b/drivers/mmc/davinci_mmc.c
index 2408a687d2..4ef9f7cc8b 100644
--- a/drivers/mmc/davinci_mmc.c
+++ b/drivers/mmc/davinci_mmc.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 
-#define DAVINCI_MAX_BLOCKS (32)
 #define WATCHDOG_COUNT (10)
 
 #define get_val(addr)  REG(addr)
@@ -34,12 +33,6 @@ struct davinci_mmc_priv {
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;
-};
 #endif
 
 /* Set davinci clock prescalar value based on the required clock in HZ */
@@ -487,43 +480,16 @@ 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 = &plat->cfg;
-#ifdef CONFIG_SPL_BUILD
-   int ret;
-#endif
-
-   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;
-   cfg->name = "da830-mmc";
 
-   priv->reg_base = (struct davinci_mmc_regs *)dev_read_addr(dev);
+   priv->reg_base = plat->reg_base;
priv->input_clk = clk_get(DAVINCI_MMCSD_CLKID);
-
 #if CONFIG_IS_ENABLED(DM_GPIO)
/* These GPIOs are optional */
gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, GPIOD_IS_IN);
gpio_request_by_name(dev, "wp-gpios", 0,