Skip to contentSkip to conversation

Migrate DA850-evm to Driver Model

PATCH New Adam Ford 2 participants 9 messages Sep 1, 2017

Subsystems (2)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

v2 cover Migrate DA850-evm to Driver Model

This series adds the DA850-evm device tree and related dependant files, along with enabling DM_SPI, DM_SERIAL, and DM_SPI with DM_SPIFLASH.

This is a resend of the original series. The only real change to this series from V1 is the additional adding of MTD PARTS and I2C.

Adam Ford (4):
spi: davinci_spi: Add da830-spi support for DM
arm: da850-evm: Enable DM and device tree support for da850-evm
arm: da850-evm: Enable MTD Parts
ARM: da850-evm: Enable DM_I2C

 arch/arm/dts/da850-evm-u-boot.dtsi |  1 +
 configs/da850evm_defconfig         | 14 ++++++++++++--
 drivers/spi/davinci_spi.c          |  1 +
 include/configs/da850evm.h         | 36 +++++++++++++++++++++++++++++++-----
 4 files changed, 45 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/4 spi: davinci_spi: Add da830-spi support for DM

The DM support is already in the driver, so add
da830-spi to the compatible list.

---
 drivers/spi/davinci_spi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/spi/davinci_spi.c +1 -0
index 291ef95..eda252d 100644
@@ -563,6 +563,7 @@ static const struct dm_spi_ops davinci_spi_ops = {
 static const struct udevice_id davinci_spi_ids[] = {
 	{ .compatible = "ti,keystone-spi" },
 	{ .compatible = "ti,dm6441-spi" },
+	{ .compatible = "ti,da830-spi" },
 	{ }
 };
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 1/4 spi: davinci_spi: Add da830-spi support for DM

Quoted 5 lines · Adam Ford

The DM support is already in the driver, so add
da830-spi to the compatible list.

---

I think you missed, last version r-w-b ?

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
author
#3 lore raw

PATCH v2 2/4 arm: da850-evm: Enable DM and device tree support for da850-evm

In reply to Adam Ford

With the device tree ported and DM compatible drivers, enable:
OF_CONTROL, DM_SPI, DM_SPI_FLASH and DM_SERIAL

---
 configs/da850evm_defconfig |  9 +++++++--
 include/configs/da850evm.h | 17 +++++++++++++++--
 2 files changed, 22 insertions(+), 4 deletions(-)
configs/da850evm_defconfig +7 -2
index 0135e7d..652da01 100644
@@ -6,8 +6,8 @@ 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_ENV_IS_IN_SPI_FLASH=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="mem=32M console=ttyS2,115200n8 root=/dev/mtdblock2 rw noinitrd ip=dhcp"
@@ -34,8 +34,13 @@ CONFIG_CMD_PING=y
 CONFIG_CMD_EXT2=y
 CONFIG_CMD_FAT=y
 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_OF_LIBFDT=y
+CONFIG_DM_SPI=y
include/configs/da850evm.h +15 -2
index 0736b39..b147bc5 100644
@@ -21,6 +21,15 @@
 #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
+#endif
+/*
  * SoC Configuration
  */
 #define CONFIG_MACH_DAVINCI_DA850_EVM
@@ -130,18 +139,23 @@
 /*
  * Serial Driver info
  */
+
+#ifdef CONFIG_SPL_BUILD
 #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
@@ -152,7 +166,6 @@
 /*
  * I2C Configuration
  */
-#define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_DAVINCI
 #define CONFIG_SYS_DAVINCI_I2C_SPEED		25000
 #define CONFIG_SYS_DAVINCI_I2C_SLAVE   10 /* Bogus, master-only in U-Boot */
Signature · 1 line
2.7.4
#4 lore raw

PATCH v2 2/4 arm: da850-evm: Enable DM and device tree support for da850-evm

Quoted 5 lines · Adam Ford

With the device tree ported and DM compatible drivers, enable:
OF_CONTROL, DM_SPI, DM_SPI_FLASH and DM_SERIAL

---

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
author
#5 lore raw

PATCH v2 3/4 arm: da850-evm: Enable MTD Parts

In reply to Adam Ford

There is a discrepency between U-Boot and Linux on the partition map. This enabes the MTD parts to pass MTD partition information from U-Boot to Linux. Linux already has a pending patch to enable MTD PARTS in davinci_all_defconfig

V2: This patch is new to the series

---
 configs/da850evm_defconfig |  2 ++
 include/configs/da850evm.h | 16 ++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
configs/da850evm_defconfig +2 -0
index 652da01..08cc2e8 100644
@@ -33,6 +33,7 @@ CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_EXT2=y
 CONFIG_CMD_FAT=y
+CONFIG_CMD_MTDPARTS=y
 CONFIG_CMD_DIAG=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
@@ -41,6 +42,7 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_DM_SPI=y
include/configs/da850evm.h +14 -2
index b147bc5..a47ba96 100644
@@ -139,7 +139,6 @@
 /*
  * Serial Driver info
  */
-
 #ifdef CONFIG_SPL_BUILD
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	-4	/* NS16550 register size */
@@ -148,6 +147,9 @@
 #define CONFIG_SYS_NS16550_CLK	clk_get(DAVINCI_UART2_CLKID)
 #define CONFIG_CONS_INDEX	1		/* use UART0 for console */
 
+/*
+ * SPI Driver Info
+ */
 #define CONFIG_SPI
 #define CONFIG_DAVINCI_SPI
 #define CONFIG_SYS_SPI_CLK		clk_get(DAVINCI_SPI1_CLKID)
@@ -156,11 +158,21 @@
 #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
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x8000
 #define CONFIG_SYS_SPI_U_BOOT_SIZE	0x40000
+#ifdef CONFIG_SPL_BUILD
+#undef CONFIG_SPI_FLASH_MTD
+#endif
+#define CONFIG_MTD_DEVICE		/* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS		/* required for UBI partition support */
+#define MTDIDS_DEFAULT			"nor0=spi0.0"
+#define MTDPARTS_DEFAULT		"mtdparts=spi0.0:"\
+						"512k(u-boot.ais),"\
+						"64k(u-boot-env),"\
+						"7552k(kernel-spare),"\
+						"64k(MAC-Address)"
 #endif
 
 /*
Signature · 1 line
2.7.4
#6 lore raw

PATCH v2 3/4 arm: da850-evm: Enable MTD Parts

Quoted 9 lines · Adam Ford

There is a discrepency between U-Boot and Linux on the partition map. This enabes the MTD parts to pass MTD partition information from U-Boot to Linux. Linux already has a pending patch to enable MTD PARTS in davinci_all_defconfig

V2: This patch is new to the series
---

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
author
#7 lore raw

PATCH v2 4/4 ARM: da850-evm: Enable DM_I2C

In reply to Adam Ford

With DM now enabled with the device tree pulled from Linux, we can enable DM_I2C in U-Boot.

V2: New to series

---
 arch/arm/dts/da850-evm-u-boot.dtsi | 1 +
 configs/da850evm_defconfig         | 3 +++
 include/configs/da850evm.h         | 5 +++--
 3 files changed, 7 insertions(+), 2 deletions(-)
arch/arm/dts/da850-evm-u-boot.dtsi +1 -0
index 516bc1d..2041cde 100644
@@ -13,6 +13,7 @@
 	};
 	
 	aliases {
+		i2c0 = &i2c0;
 		spi0 = &spi1;
 	};
 };
configs/da850evm_defconfig +3 -0
index 08cc2e8..d6cd1fa 100644
@@ -24,6 +24,7 @@ CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_ASKENV=y
 CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_FLASH is not set
+CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
@@ -38,6 +39,8 @@ CONFIG_CMD_DIAG=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_DM=y
+CONFIG_DM_I2C=y
+CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
include/configs/da850evm.h +3 -2
index a47ba96..38798b0 100644
@@ -28,6 +28,7 @@
 #undef CONFIG_DM_SPI
 #undef CONFIG_DM_SPI_FLASH
 #undef CONFIG_DM_I2C
+#undef CONFIG_DM_I2C_COMPAT
 #endif
 /*
  * SoC Configuration
@@ -178,10 +179,10 @@
 /*
  * I2C Configuration
  */
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_SYS_I2C_DAVINCI
-#define CONFIG_SYS_DAVINCI_I2C_SPEED		25000
-#define CONFIG_SYS_DAVINCI_I2C_SLAVE   10 /* Bogus, master-only in U-Boot */
 #define CONFIG_SYS_I2C_EXPANDER_ADDR   0x20
+#endif
 
 /*
  * Flash & Environment
Signature · 1 line
2.7.4
#8 lore raw

PATCH v2 4/4 ARM: da850-evm: Enable DM_I2C

Quoted 7 lines · Adam Ford

With DM now enabled with the device tree pulled from Linux, we can enable DM_I2C in U-Boot.

V2: New to series
---

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.