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

From: Bartosz Golaszewski bgolaszewski@baylibre.com
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

From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com Acked-by: Heiko Schocher hs@denx.de --- 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 <configs/ti_omap3_common.h>
-#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 */

On Mon, Jul 29, 2019 at 08:57:58AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com Acked-by: Heiko Schocher hs@denx.de
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(-)
This breaks da850_am18xxevm as dvevm_read_mac_address() in arch/arm/mach-davinci/misc.c has not been updated for the i2c case. I suspect board/atmel/common/mac_eeprom.c::at91_set_ethaddr() could be adapted easily enough and if you don't have a chance to do so, I'll take a pass at that.

On Mon, Jul 29, 2019 at 11:14 AM Tom Rini trini@konsulko.com wrote:
On Mon, Jul 29, 2019 at 08:57:58AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com Acked-by: Heiko Schocher hs@denx.de
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(-)
This breaks da850_am18xxevm as dvevm_read_mac_address() in arch/arm/mach-davinci/misc.c has not been updated for the i2c case. I suspect board/atmel/common/mac_eeprom.c::at91_set_ethaddr() could be adapted easily enough and if you don't have a chance to do so, I'll take a pass at that.
I submitted a patch to remove da850_am18xxevm since it's been orphaned for a while, and I don't have the hardware to support it as that variation wasn't a board made by Logic PD. I would argue that we apply the patch to remove the da850_am18xxevm, then we can apply his patches to remove CONFIG_DM_I2C_COMPAT.
adam
-- Tom

On Mon, Jul 29, 2019 at 08:57:58AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com Acked-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com Acked-by: Heiko Schocher hs@denx.de --- 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

On Mon, Jul 29, 2019 at 08:57:59AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com Acked-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

From: Bartosz Golaszewski bgolaszewski@baylibre.com
There are no more users of the compatibility layer for i2c. Remove the driver and all references to it.
Signed-off-by: Bartosz Golaszewski bgolaszewski@baylibre.com Acked-by: Heiko Schocher hs@denx.de --- 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, wd@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..0000000000 --- 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 <common.h> -#include <dm.h> -#include <errno.h> -#include <i2c.h> - -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, &bus); - 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, &dev); -} - -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, &dev); - 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; - int ret; - - ret = i2c_compat_get_device(chip_addr, alen, &dev); - if (ret) - return ret; - - return dm_i2c_write(dev, addr, buffer, len); -} - -int i2c_get_bus_num_fdt(int node) -{ - struct udevice *bus; - int ret; - - ret = uclass_get_device_by_of_offset(UCLASS_I2C, node, &bus); - if (ret) - return ret; - - return bus->seq; -} - -unsigned int i2c_get_bus_num(void) -{ - return cur_busnum; -} - -int i2c_set_bus_num(unsigned int bus) -{ - cur_busnum = bus; - - return 0; -} - -void i2c_init(int speed, int slaveaddr) -{ - /* Nothing to do here - the init happens through driver model */ -} - -void board_i2c_init(const void *blob) -{ - /* Nothing to do here - the init happens through driver model */ -} - -uint8_t i2c_reg_read(uint8_t chip_addr, uint8_t offset) -{ - struct udevice *dev; - int ret; - - ret = i2c_compat_get_device(chip_addr, 1, &dev); - if (ret) - return 0xff; - return dm_i2c_reg_read(dev, offset); -} - -void i2c_reg_write(uint8_t chip_addr, uint8_t offset, uint8_t val) -{ - struct udevice *dev; - int ret; - - ret = i2c_compat_get_device(chip_addr, 1, &dev); - if (!ret) - dm_i2c_reg_write(dev, offset, val); -} diff --git a/include/_exports.h b/include/_exports.h index c15050e30b..0dee05f077 100644 --- a/include/_exports.h +++ b/include/_exports.h @@ -40,8 +40,7 @@ EXPORT_FUNC(simple_strtol, long, simple_strtol, const char *, char **, unsigned int) EXPORT_FUNC(strcmp, int, strcmp, const char *cs, const char *ct) -#if defined(CONFIG_CMD_I2C) && \ - (!defined(CONFIG_DM_I2C) || defined(CONFIG_DM_I2C_COMPAT)) +#if defined(CONFIG_CMD_I2C) && !defined(CONFIG_DM_I2C) EXPORT_FUNC(i2c_write, int, i2c_write, uchar, uint, int , uchar * , int) EXPORT_FUNC(i2c_read, int, i2c_read, uchar, uint, int , uchar * , int) #else diff --git a/include/exports.h b/include/exports.h index a4b862f191..bf8d53c6b0 100644 --- a/include/exports.h +++ b/include/exports.h @@ -32,8 +32,7 @@ long simple_strtol(const char *cp, char **endp, unsigned int base); int strcmp(const char *cs, const char *ct); unsigned long ustrtoul(const char *cp, char **endp, unsigned int base); unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base); -#if defined(CONFIG_CMD_I2C) && \ - (!defined(CONFIG_DM_I2C) || defined(CONFIG_DM_I2C_COMPAT)) +#if defined(CONFIG_CMD_I2C) && !defined(CONFIG_DM_I2C) int i2c_write (uchar, uint, int , uchar* , int); int i2c_read (uchar, uint, int , uchar* , int); #endif diff --git a/include/i2c.h b/include/i2c.h index a5c760c711..33570f5404 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -271,86 +271,6 @@ int i2c_get_chip_offset_len(struct udevice *dev); */ int i2c_deblock(struct udevice *bus);
-#ifdef CONFIG_DM_I2C_COMPAT -/** - * i2c_probe() - Compatibility function for driver model - * - * Calls dm_i2c_probe() on the current bus - */ -int i2c_probe(uint8_t chip_addr); - -/** - * i2c_read() - Compatibility function for driver model - * - * Calls dm_i2c_read() with the device corresponding to @chip_addr, and offset - * set to @addr. @alen must match the current setting for the device. - */ -int i2c_read(uint8_t chip_addr, unsigned int addr, int alen, uint8_t *buffer, - int len); - -/** - * i2c_write() - Compatibility function for driver model - * - * Calls dm_i2c_write() with the device corresponding to @chip_addr, and offset - * set to @addr. @alen must match the current setting for the device. - */ -int i2c_write(uint8_t chip_addr, unsigned int addr, int alen, uint8_t *buffer, - int len); - -/** - * i2c_get_bus_num_fdt() - Compatibility function for driver model - * - * @return the bus number associated with the given device tree node - */ -int i2c_get_bus_num_fdt(int node); - -/** - * i2c_get_bus_num() - Compatibility function for driver model - * - * @return the 'current' bus number - */ -unsigned int i2c_get_bus_num(void); - -/** - * i2c_set_bus_num() - Compatibility function for driver model - * - * Sets the 'current' bus - */ -int i2c_set_bus_num(unsigned int bus); - -static inline void I2C_SET_BUS(unsigned int bus) -{ - i2c_set_bus_num(bus); -} - -static inline unsigned int I2C_GET_BUS(void) -{ - return i2c_get_bus_num(); -} - -/** - * i2c_init() - Compatibility function for driver model - * - * This function does nothing. - */ -void i2c_init(int speed, int slaveaddr); - -/** - * board_i2c_init() - Compatibility function for driver model - * - * @param blob Device tree blbo - * @return the number of I2C bus - */ -void board_i2c_init(const void *blob); - -/* - * Compatibility functions for driver model. - */ -uint8_t i2c_reg_read(uint8_t addr, uint8_t reg); -void i2c_reg_write(uint8_t addr, uint8_t reg, uint8_t val); - -#endif - /** * struct dm_i2c_ops - driver operations for I2C uclass *

On Mon, Jul 29, 2019 at 08:58:00AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
There are no more users of the compatibility layer for i2c. Remove the driver and all references to it.
Signed-off-by: Bartosz Golaszewski bgolaszewski@baylibre.com Acked-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com Acked-by: Heiko Schocher hs@denx.de --- 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=30000000 -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

On Mon, Jul 29, 2019 at 08:58:01AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com Acked-by: Heiko Schocher hs@denx.de
Applied to u-boot/master, thanks!

From: Bartosz Golaszewski bgolaszewski@baylibre.com
This function is only used within the driver itself. No need to export it.
Signed-off-by: Bartosz Golaszewski bgolaszewski@baylibre.com --- 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_8BIT 0
-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(&davinci_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;

On Mon, Jul 29, 2019 at 08:58:02AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
This function is only used within the driver itself. No need to export it.
Signed-off-by: Bartosz Golaszewski bgolaszewski@baylibre.com
Applied to u-boot/master, thanks!

From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com --- 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 <common.h> #include <asm/io.h> #include <nand.h> +#include <dm/uclass.h> #include <asm/ti-common/davinci_nand.h>
/* 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), &dev); + 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 */

On Mon, Jul 29, 2019 at 08:58:03AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com
Applied to u-boot/master, thanks!

From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com --- 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 = &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

On Mon, Jul 29, 2019 at 08:58:04AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com
Applied to u-boot/master, thanks!

From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com Tested-by: Adam Ford aford173@gmail.com #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@1c00000 { u-boot,dm-spl; }; + + nand { + compatible = "ti,davinci-nand"; + }; };
&flash { 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
/*

On Mon, Jul 29, 2019 at 1:58 AM Bartosz Golaszewski brgl@bgdev.pl wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com Tested-by: Adam Ford aford173@gmail.com #da850-evm
The current state of master currently has nand booting broken on the da850evm_nand_defconfig, so I'll welcome this patch since it seems to fix the broken booting. I haven't bisected it because there is this pending fix.
adam
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@1c00000 { u-boot,dm-spl; };
nand {
compatible = "ti,davinci-nand";
};
};
&flash { 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

On Mon, Jul 29, 2019 at 08:58:05AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com Tested-by: Adam Ford aford173@gmail.com #da850-evm
Applied to u-boot/master, thanks!

From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com --- 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=0x80000000 +CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5 CONFIG_SPL_NAND_SUPPORT=y CONFIG_HUSH_PARSER=y

On Mon, Jul 29, 2019 at 08:58:06AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com
Applied to u-boot/master, thanks!

From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com --- 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

On Mon, Jul 29, 2019 at 08:58:07AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com
Applied to u-boot/master, thanks!

From: Bartosz Golaszewski bgolaszewski@baylibre.com
There's no SPI on da850-lcdk. Remove unnecessary includes.
Signed-off-by: Bartosz Golaszewski bgolaszewski@baylibre.com --- 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 <common.h> #include <i2c.h> #include <net.h> -#include <spi.h> -#include <spi_flash.h> #include <asm/arch/hardware.h> #include <asm/ti-common/davinci_nand.h> #include <asm/io.h>

On Mon, Jul 29, 2019 at 08:58:08AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
There's no SPI on da850-lcdk. Remove unnecessary includes.
Signed-off-by: Bartosz Golaszewski bgolaszewski@baylibre.com
Applied to u-boot/master, thanks!

From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com --- 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 <asm/arch/hardware.h> #include <asm/ti-common/davinci_nand.h> #include <asm/io.h> +#include <ns16550.h> +#include <dm/platdata.h> #include <linux/errno.h> #include <asm/mach-types.h> #include <asm/arch/davinci_misc.h> @@ -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 = 228000000, + .fcr = UART_FCR_DEFVAL, +}; + +U_BOOT_DEVICE(omapl138_uart) = { + .name = "ns16550_serial", + .platdata = &serial_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=30000000 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

On Mon, Jul 29, 2019 at 08:58:09AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com
Applied to u-boot/master, thanks!

Hi,
On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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

czw., 26 wrz 2019 o 01:21 Faiz Abbas faiz_abbas@ti.com napisał(a):
Hi,
On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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

Hi Barotz,
On 10/25/2019 9:40 PM, Bartosz Golaszewski wrote:
czw., 26 wrz 2019 o 01:21 Faiz Abbas faiz_abbas@ti.com napisał(a):
Hi,
On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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.
Thanks, Faiz

pt., 25 paź 2019 o 19:25 Rizvi, Mohammad Faiz Abbas faiz_abbas@ti.com 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 faiz_abbas@ti.com napisał(a):
Hi,
On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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

pt., 25 paź 2019 o 18:10 Bartosz Golaszewski brgl@bgdev.pl napisał(a):
czw., 26 wrz 2019 o 01:21 Faiz Abbas faiz_abbas@ti.com napisał(a):
Hi,
On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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

On Fri, Nov 8, 2019 at 9:50 AM Bartosz Golaszewski bgolaszewski@baylibre.com wrote:
pt., 25 paź 2019 o 18:10 Bartosz Golaszewski brgl@bgdev.pl napisał(a):
czw., 26 wrz 2019 o 01:21 Faiz Abbas faiz_abbas@ti.com napisał(a):
Hi,
On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 = &mmc1. I a not sure if it will help or not but it is different I see.
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.
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.
adam
Bart

pt., 8 lis 2019 o 17:14 Adam Ford aford173@gmail.com napisał(a):
On Fri, Nov 8, 2019 at 9:50 AM Bartosz Golaszewski bgolaszewski@baylibre.com wrote:
pt., 25 paź 2019 o 18:10 Bartosz Golaszewski brgl@bgdev.pl napisał(a):
czw., 26 wrz 2019 o 01:21 Faiz Abbas faiz_abbas@ti.com napisał(a):
Hi,
On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 = &mmc1. 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=<sdcard> seek=117 bs=512 conv=fsync
Thanks! Bart

pt., 8 lis 2019 o 18:33 Bartosz Golaszewski bgolaszewski@baylibre.com napisał(a):
pt., 8 lis 2019 o 17:14 Adam Ford aford173@gmail.com napisał(a):
On Fri, Nov 8, 2019 at 9:50 AM Bartosz Golaszewski bgolaszewski@baylibre.com wrote:
pt., 25 paź 2019 o 18:10 Bartosz Golaszewski brgl@bgdev.pl napisał(a):
czw., 26 wrz 2019 o 01:21 Faiz Abbas faiz_abbas@ti.com napisał(a):
Hi,
On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 = &mmc1. 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=<sdcard> seek=117 bs=512 conv=fsync
Thanks! Bart

On Fri, Nov 8, 2019 at 11:59 AM Bartosz Golaszewski brgl@bgdev.pl wrote:
pt., 8 lis 2019 o 18:33 Bartosz Golaszewski bgolaszewski@baylibre.com napisał(a):
pt., 8 lis 2019 o 17:14 Adam Ford aford173@gmail.com napisał(a):
On Fri, Nov 8, 2019 at 9:50 AM Bartosz Golaszewski bgolaszewski@baylibre.com wrote:
pt., 25 paź 2019 o 18:10 Bartosz Golaszewski brgl@bgdev.pl napisał(a):
czw., 26 wrz 2019 o 01:21 Faiz Abbas faiz_abbas@ti.com napisał(a):
Hi,
On 29/07/19 12:28 PM, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski bgolaszewski@baylibre.com > > 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 = &mmc1. 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?
[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=<sdcard> seek=117 bs=512 conv=fsync
Thanks! Bart

pon., 11 lis 2019 o 13:58 Adam Ford aford173@gmail.com napisał(a):
On Fri, Nov 8, 2019 at 11:59 AM Bartosz Golaszewski brgl@bgdev.pl wrote:
pt., 8 lis 2019 o 18:33 Bartosz Golaszewski bgolaszewski@baylibre.com napisał(a):
pt., 8 lis 2019 o 17:14 Adam Ford aford173@gmail.com napisał(a):
On Fri, Nov 8, 2019 at 9:50 AM Bartosz Golaszewski bgolaszewski@baylibre.com wrote:
pt., 25 paź 2019 o 18:10 Bartosz Golaszewski brgl@bgdev.pl napisał(a):
czw., 26 wrz 2019 o 01:21 Faiz Abbas faiz_abbas@ti.com napisał(a): > > Hi, > > On 29/07/19 12:28 PM, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski bgolaszewski@baylibre.com > > > > 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 = &mmc1. 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=<sdcard> seek=117 bs=512 conv=fsync
Thanks! Bart

śr., 13 lis 2019 o 11:52 Bartosz Golaszewski brgl@bgdev.pl napisał(a):
pon., 11 lis 2019 o 13:58 Adam Ford aford173@gmail.com napisał(a):
On Fri, Nov 8, 2019 at 11:59 AM Bartosz Golaszewski brgl@bgdev.pl wrote:
pt., 8 lis 2019 o 18:33 Bartosz Golaszewski bgolaszewski@baylibre.com napisał(a):
pt., 8 lis 2019 o 17:14 Adam Ford aford173@gmail.com napisał(a):
On Fri, Nov 8, 2019 at 9:50 AM Bartosz Golaszewski bgolaszewski@baylibre.com wrote:
pt., 25 paź 2019 o 18:10 Bartosz Golaszewski brgl@bgdev.pl napisał(a): > > czw., 26 wrz 2019 o 01:21 Faiz Abbas faiz_abbas@ti.com napisał(a): > > > > Hi, > > > > On 29/07/19 12:28 PM, Bartosz Golaszewski wrote: > > > From: Bartosz Golaszewski bgolaszewski@baylibre.com > > > > > > 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 = &mmc1. 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.
I noticed that calling mmc_bind() from probe() actually results in davinci_mmc_bind() being called. Is this expected? Because all the latter function does is call mmc_bind() again. This doesn't seem right - should someone else call mmc_bind in SPL maybe?
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=<sdcard> seek=117 bs=512 conv=fsync
Thanks! Bart

Hi Bartosz,
On 08/11/19 9:20 PM, Bartosz Golaszewski wrote:
pt., 25 paź 2019 o 18:10 Bartosz Golaszewski brgl@bgdev.pl napisał(a):
czw., 26 wrz 2019 o 01:21 Faiz Abbas faiz_abbas@ti.com napisał(a):
Hi,
On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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.
I suspect you need to set DM_FLAG_PRE_RELOC for the bind to be called. Can you try setting this flag?
Thanks, Faiz

From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com --- 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

On Mon, Jul 29, 2019 at 08:58:10AM +0200, Bartosz Golaszewski wrote:
From: Bartosz Golaszewski bgolaszewski@baylibre.com
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 bgolaszewski@baylibre.com
Applied to u-boot/master, thanks!
participants (6)
-
Adam Ford
-
Bartosz Golaszewski
-
Bartosz Golaszewski
-
Faiz Abbas
-
Rizvi, Mohammad Faiz Abbas
-
Tom Rini