From a4670f8ebb5b4df6afeb5155fb5b44c1d1d154b9 Mon Sep 17 00:00:00 2001 From: Adam Ford Date: Sun, 17 Sep 2017 20:43:46 -0500 Subject: [PATCH] arm: da850-evm: Enable DM and device tree support for da850-evm With the device tree ported and DM compatible drivers, enable: OF_CONTROL, DM_SPI, DM_SPI_FLASH and DM_SERIAL Note: DM_SERIAL is not enabled for da850evm_direct_nor_defconfig yet. Reviewed-by: Jagan Teki Signed-off-by: Adam Ford --- board/davinci/da8xxevm/Kconfig | 2 ++ board/davinci/da8xxevm/da850evm.c | 3 +- configs/da850_am18xxevm_defconfig | 13 +++++---- configs/da850evm_defconfig | 10 +++++-- configs/da850evm_direct_nor_defconfig | 7 ++++- include/configs/da850evm.h | 41 +++++++++++++++++++++++++-- 6 files changed, 64 insertions(+), 12 deletions(-) diff --git a/board/davinci/da8xxevm/Kconfig b/board/davinci/da8xxevm/Kconfig index bb1188b4ea..e0df97ca0e 100644 --- a/board/davinci/da8xxevm/Kconfig +++ b/board/davinci/da8xxevm/Kconfig @@ -33,6 +33,8 @@ config MAC_ADDR_IN_EEPROM endif +source "board/ti/common/Kconfig" + endif if TARGET_OMAPL138_LCDK diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c index 516d86df50..83c9f2940f 100644 --- a/board/davinci/da8xxevm/da850evm.c +++ b/board/davinci/da8xxevm/da850evm.c @@ -60,7 +60,7 @@ static int get_mac_addr(u8 *addr) return -1; } - ret = spi_flash_read(flash, CFG_MAC_ADDR_OFFSET, 6, addr); + ret = spi_flash_read(flash, (CFG_MAC_ADDR_OFFSET) + 1, 7, addr); if (ret) { printf("Error - unable to read MAC address from SPI flash.\n"); return -1; @@ -140,6 +140,7 @@ int misc_init_r(void) uchar buff[6]; spi_mac_read = get_mac_addr(buff); + buff[0] = 0; /* * MAC address not present in the environment diff --git a/configs/da850_am18xxevm_defconfig b/configs/da850_am18xxevm_defconfig index 27370e7c0c..832c9ceb07 100644 --- a/configs/da850_am18xxevm_defconfig +++ b/configs/da850_am18xxevm_defconfig @@ -1,17 +1,16 @@ CONFIG_ARM=y CONFIG_ARCH_DAVINCI=y CONFIG_TARGET_DA850EVM=y -CONFIG_TI_COMMON_CMD_OPTIONS=y CONFIG_MAC_ADDR_IN_EEPROM=y +CONFIG_TI_COMMON_CMD_OPTIONS=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y +CONFIG_DEFAULT_DEVICE_TREE="da850-evm" CONFIG_SYS_EXTRA_OPTIONS="DA850_AM18X_EVM,SYS_I2C_EEPROM_ADDR_LEN=2,SYS_I2C_EEPROM_ADDR=0x50" CONFIG_BOOTDELAY=3 -CONFIG_USE_BOOTARGS=y -CONFIG_BOOTARGS="mem=32M console=ttyS2,115200n8 root=/dev/mtdblock2 rw noinitrd ip=dhcp" CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set @@ -19,7 +18,7 @@ CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y CONFIG_SPL_BOARD_INIT=y CONFIG_HUSH_PARSER=y -# CONFIG_CMD_BOOTZ is not set +CONFIG_SYS_PROMPT="U-Boot > " # CONFIG_CMD_IMLS is not set CONFIG_CRC32_VERIFY=y # CONFIG_CMD_EEPROM is not set @@ -33,10 +32,14 @@ CONFIG_CRC32_VERIFY=y # CONFIG_CMD_EXT4 is not set # CONFIG_CMD_FS_GENERIC is not set CONFIG_CMD_DIAG=y +CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_DM=y +CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_DM_SERIAL=y CONFIG_SYS_NS16550=y +CONFIG_DM_SPI=y # CONFIG_FAT_WRITE is not set -CONFIG_OF_LIBFDT=y diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig index bfa5ea1c4b..05dc8131fa 100644 --- a/configs/da850evm_defconfig +++ b/configs/da850evm_defconfig @@ -7,9 +7,9 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y +CONFIG_DEFAULT_DEVICE_TREE="da850-evm" +CONFIG_SYS_EXTRA_OPTIONS="MAC_ADDR_IN_SPIFLASH" CONFIG_BOOTDELAY=3 -CONFIG_USE_BOOTARGS=y -CONFIG_BOOTARGS="mem=32M console=ttyS2,115200n8 root=/dev/mtdblock2 rw noinitrd ip=dhcp" CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set @@ -31,10 +31,14 @@ CONFIG_CRC32_VERIFY=y # CONFIG_CMD_EXT4 is not set # CONFIG_CMD_FS_GENERIC is not set CONFIG_CMD_DIAG=y +CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_DM=y +CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_DM_SERIAL=y CONFIG_SYS_NS16550=y +CONFIG_DM_SPI=y # CONFIG_FAT_WRITE is not set -CONFIG_OF_LIBFDT=y diff --git a/configs/da850evm_direct_nor_defconfig b/configs/da850evm_direct_nor_defconfig index 24ab89224d..8f8bad0756 100644 --- a/configs/da850evm_direct_nor_defconfig +++ b/configs/da850evm_direct_nor_defconfig @@ -2,6 +2,8 @@ CONFIG_ARM=y CONFIG_ARCH_DAVINCI=y CONFIG_TARGET_DA850EVM=y CONFIG_TI_COMMON_CMD_OPTIONS=y +CONFIG_DEFAULT_DEVICE_TREE="da850-evm" +# CONFIG_SYS_MALLOC_F is not set CONFIG_SYS_EXTRA_OPTIONS="USE_NOR,DIRECT_NOR_BOOT" CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y @@ -28,11 +30,14 @@ CONFIG_CRC32_VERIFY=y # CONFIG_CMD_FAT is not set # CONFIG_CMD_FS_GENERIC is not set CONFIG_CMD_DIAG=y +CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_FLASH=y +CONFIG_DM=y # CONFIG_MMC is not set CONFIG_MTD_NOR_FLASH=y +CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y CONFIG_SYS_NS16550=y -CONFIG_OF_LIBFDT=y +CONFIG_DM_SPI=y diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h index c05c64cad7..d383c23bbe 100644 --- a/include/configs/da850evm.h +++ b/include/configs/da850evm.h @@ -20,6 +20,16 @@ #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_SPI +#undef CONFIG_DM_SPI_FLASH +#undef CONFIG_DM_I2C +#undef CONFIG_DM_I2C_COMPAT +#endif /* * SoC Configuration */ @@ -130,18 +140,23 @@ /* * Serial Driver info */ + +#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_DIRECT_NOR_BOOT) #define CONFIG_SYS_NS16550_SERIAL #define CONFIG_SYS_NS16550_REG_SIZE -4 /* NS16550 register size */ #define CONFIG_SYS_NS16550_COM1 DAVINCI_UART2_BASE /* Base address of UART2 */ +#endif #define CONFIG_SYS_NS16550_CLK clk_get(DAVINCI_UART2_CLKID) #define CONFIG_CONS_INDEX 1 /* use UART0 for console */ #define CONFIG_SPI #define CONFIG_DAVINCI_SPI -#define CONFIG_SYS_SPI_BASE DAVINCI_SPI1_BASE #define CONFIG_SYS_SPI_CLK clk_get(DAVINCI_SPI1_CLKID) +#ifdef CONFIG_SPL_BUILD +#define CONFIG_SYS_SPI_BASE DAVINCI_SPI1_BASE #define CONFIG_SF_DEFAULT_SPEED 30000000 #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED +#endif #ifdef CONFIG_USE_SPIFLASH #define CONFIG_SPL_SPI_LOAD @@ -257,7 +272,29 @@ #define CONFIG_CMDLINE_TAG #define CONFIG_REVISION_TAG #define CONFIG_SETUP_MEMORY_TAGS -#define CONFIG_EXTRA_ENV_SETTINGS "hwconfig=dsp:wake=yes" + +#define CONFIG_BOOTCOMMAND \ + "run envboot; " \ + "run mmcboot; " + +#define DEFAULT_LINUX_BOOT_ENV \ + "loadaddr=0xc0700000\0" \ + "fdtaddr=0xc0600000\0" \ + "scriptaddr=0xc0600000\0" + +#include + +#define CONFIG_EXTRA_ENV_SETTINGS \ + DEFAULT_LINUX_BOOT_ENV \ + DEFAULT_MMC_TI_ARGS \ + "bootpart=0:2\0" \ + "bootdir=/boot\0" \ + "bootfile=zImage\0" \ + "fdtfile=da850-evm.dtb\0" \ + "boot_fdt=yes\0" \ + "boot_fit=0\0" \ + "console=ttyS2,115200n8\0" \ + "hwconfig=dsp:wake=yes" #ifdef CONFIG_CMD_BDI #define CONFIG_CLOCKS -- 2.25.1