Skip to contentSkip to conversation

board: ge: initial dm support

PATCH New Ian Ray 4 participants 30 messages Jan 31, 2019 – Mar 14, 2019

Subsystems (2)
lore
Share & tools
lore

Ian Ray

author
#0 lore raw

cover board: ge: initial dm support

This series is primarily (patches 01-07) about converting ge_bx50v3 and mx53ppd boards to use the Driver Model and Device Tree.

Four additional patches (08-13) include recent additional functionality and fixes.

Patches applicable on top of master:

* SHA1: 535d74a8ae8d194269cefdf59ae17a92cd6e75dc

* However, note that patch _13_ requires:
- https://patchwork.ozlabs.org/patch/947075/
- https://patchwork.ozlabs.org/patch/947076/
- https://patchwork.ozlabs.org/patch/947074/

Ian Ray (11):
board: ge: bx50v3: Enable CONFIG_DM
board: ge: bx50v3: Enable CONFIG_DM_MMC
board: ge: bx50v3: Enable CONFIG_DM_GPIO
board: ge: bx50v3: Enable CONFIG_DM_SPI, CONFIG_DM_SPI_FLASH
board: ge: ppd: Enable CONFIG_DM
arm: imx: Add esdhc3/4 nodes to imx53.dtsi
board: ge: ppd: Enable CONFIG_DM_MMC
board: ge: store version information in fdt
mx53ppd: bring dock out of reset at boot
mx53ppd: fix unsupported set command
bootcount: i2c: Delay after writing

Joonas Aijala (2):
board: ge: bx50v3: Specific ARP timeout removed
board: ge: bx50v3: Network booting of fitImage with nfs rootfs

 arch/arm/dts/Makefile             |   3 +
 arch/arm/dts/imx53-ppd.dts        |  43 ++++++++++
 arch/arm/dts/imx53.dtsi           |  26 +++++++
 arch/arm/dts/imx6q-bx50v3.dts     |  89 +++++++++++++++++++++
 board/ge/bx50v3/bx50v3.c          | 160 +++++---------------------------------
 board/ge/mx53ppd/mx53ppd.c        |  84 +++-----------------
 board/ge/mx53ppd/ppd_gpio.h       |   4 +
 configs/ge_bx50v3_defconfig       |  12 +++
 configs/mx53ppd_defconfig         |   9 +++
 drivers/bootcount/bootcount_i2c.c |   4 +
 include/configs/ge_bx50v3.h       |  36 +++++++--
 include/configs/mx53ppd.h         |  12 +--
 12 files changed, 255 insertions(+), 227 deletions(-)
 create mode 100644 arch/arm/dts/imx53-ppd.dts
 create mode 100644 arch/arm/dts/imx6q-bx50v3.dts
Signature · 1 line
2.10.1
author
#1 lore raw

PATCH 1/13 board: ge: bx50v3: Enable CONFIG_DM

Add simplified, generalised, bx50v3 device tree and enable CONFIG_DM.

---
 arch/arm/dts/Makefile         |  2 ++
 arch/arm/dts/imx6q-bx50v3.dts | 15 +++++++++++++++
 configs/ge_bx50v3_defconfig   |  4 ++++
 3 files changed, 21 insertions(+)
 create mode 100644 arch/arm/dts/imx6q-bx50v3.dts
arch/arm/dts/Makefile +2 -0
index 46f1d69..a902775 100644
@@ -582,6 +582,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 	mt7623n-bananapi-bpi-r2.dtb \
 	mt7629-rfb.dtb
 
+dtb-$(CONFIG_TARGET_GE_BX50V3) += imx6q-bx50v3.dtb
+
 targets += $(dtb-y)
 
 # Add any required device tree compiler flags here
arch/arm/dts/imx6q-bx50v3.dts new file +15 -0
new file mode 100644
index 0000000..10b1299
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ OR X11 */
+/*
+ * Copyright 2015 Timesys Corporation.
+ * Copyright 2018 General Electric Company
+ * Based on imx6q-ba16.dtsi and imx6q-bx50v3.dtsi from kernel 4.20.5.
+ */
+
+/dts-v1/;
+
+#include "imx6q.dtsi"
+
+/ {
+	model = "General Electric Bx50v3";
+	compatible = "ge,imx6q-bx50v3", "advantech,imx6q-ba16", "fsl,imx6q";
+};
configs/ge_bx50v3_defconfig +4 -0
index 4180050..58fa000 100644
@@ -51,3 +51,7 @@ CONFIG_MXC_SPI=y
 CONFIG_IMX_WATCHDOG=y
 CONFIG_OF_LIBFDT=y
 # CONFIG_EFI_LOADER is not set
+CONFIG_DM=y
+CONFIG_CMD_DM=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="imx6q-bx50v3"
Signature · 1 line
2.10.1
#2 lore raw

PATCH 1/13 board: ge: bx50v3: Enable CONFIG_DM

Quoted 2 lines

Add simplified, generalised, bx50v3 device tree and enable CONFIG_DM.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#3 lore raw

PATCH 2/13 board: ge: bx50v3: Enable CONFIG_DM_MMC

In reply to Ian Ray

Use MMC device model, and remove USDHC pin configuration code since the pinctrl driver is used.

---
 arch/arm/dts/imx6q-bx50v3.dts |  47 ++++++++++++++++++
 board/ge/bx50v3/bx50v3.c      | 113 ------------------------------------------
 configs/ge_bx50v3_defconfig   |   4 ++
 include/configs/ge_bx50v3.h   |   6 +--
 4 files changed, 52 insertions(+), 118 deletions(-)
arch/arm/dts/imx6q-bx50v3.dts +47 -0
index 10b1299..0fff219 100644
@@ -13,3 +13,50 @@
 	model = "General Electric Bx50v3";
 	compatible = "ge,imx6q-bx50v3", "advantech,imx6q-ba16", "fsl,imx6q";
 };
+
+&iomuxc {
+	pinctrl-names = "default";
+
+	pinctrl_usdhc3: usdhc3grp {
+		fsl,pins = <
+			MX6QDL_PAD_SD3_CMD__SD3_CMD	0x17059
+			MX6QDL_PAD_SD3_CLK__SD3_CLK	0x10059
+			MX6QDL_PAD_SD3_DAT0__SD3_DATA0	0x17059
+			MX6QDL_PAD_SD3_DAT1__SD3_DATA1	0x17059
+			MX6QDL_PAD_SD3_DAT2__SD3_DATA2	0x17059
+			MX6QDL_PAD_SD3_DAT3__SD3_DATA3	0x17059
+			MX6QDL_PAD_SD3_DAT4__SD3_DATA4	0x17059
+			MX6QDL_PAD_SD3_DAT5__SD3_DATA5	0x17059
+			MX6QDL_PAD_SD3_DAT6__SD3_DATA6	0x17059
+			MX6QDL_PAD_SD3_DAT7__SD3_DATA7	0x17059
+		>;
+	};
+
+	pinctrl_usdhc3_reset: usdhc3grp-reset {
+		fsl,pins = <
+			MX6QDL_PAD_SD3_RST__SD3_RESET   0x170F9
+		>;
+	};
+};
+
+&usdhc1 {
+	status = "disabled";
+};
+
+&usdhc2 {
+	status = "disabled";
+};
+
+/* eMMC */
+&usdhc3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usdhc3 &pinctrl_usdhc3_reset>;
+	bus-width = <8>;
+	non-removable;
+	keep-power-in-suspend;
+	status = "okay";
+};
+
+&usdhc4 {
+	status = "disabled";
+};
board/ge/bx50v3/bx50v3.c +0 -113

131 lines not on this page · raw message

configs/ge_bx50v3_defconfig +4 -0
index 58fa000..af8a243 100644
@@ -55,3 +55,7 @@ CONFIG_DM=y
 CONFIG_CMD_DM=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6q-bx50v3"
+CONFIG_DM_MMC=y
+CONFIG_BLK=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
include/configs/ge_bx50v3.h +1 -5
index 040b3ac..7d62483 100644
@@ -45,10 +45,6 @@
 #define CONFIG_LBA48
 #endif
 
-/* MMC Configs */
-#define CONFIG_FSL_USDHC
-#define CONFIG_SYS_FSL_ESDHC_ADDR      0
-
 /* USB Configs */
 #ifdef CONFIG_USB
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
@@ -88,7 +84,7 @@
 	"image=/boot/fitImage\0" \
 	"fdt_high=0xffffffff\0" \
 	"dev=mmc\0" \
-	"devnum=1\0" \
+	"devnum=2\0" \
 	"rootdev=mmcblk0p\0" \
 	"quiet=quiet loglevel=0\0" \
 	"console=" CONSOLE_DEV "\0" \
Signature · 1 line
2.10.1
#4 lore raw

PATCH 2/13 board: ge: bx50v3: Enable CONFIG_DM_MMC

Quoted 3 lines

Use MMC device model, and remove USDHC pin configuration code since the pinctrl driver is used.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#5 lore raw

PATCH 3/13 board: ge: bx50v3: Enable CONFIG_DM_GPIO

In reply to Ian Ray

Enable CONFIG_DM_GPIO as a pre-requisite for enabling CONFIG_DM_SPI.

Add explicit gpio_requests.

---
 board/ge/bx50v3/bx50v3.c    | 11 ++++++++++-
 configs/ge_bx50v3_defconfig |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)
board/ge/bx50v3/bx50v3.c +10 -1
index fe3fa27..dac063d 100644
@@ -106,6 +106,7 @@ static void setup_iomux_enet(void)
 	imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
 
 	/* Reset AR8033 PHY */
+	gpio_request(IMX_GPIO_NR(1, 28), "fec_rst");
 	gpio_direction_output(IMX_GPIO_NR(1, 28), 0);
 	mdelay(10);
 	gpio_set_value(IMX_GPIO_NR(1, 28), 1);
@@ -420,8 +421,8 @@ static void setup_display_bx50v3(void)
 	/* backlights off until needed */
 	imx_iomux_v3_setup_multiple_pads(backlight_pads,
 					 ARRAY_SIZE(backlight_pads));
+	gpio_request(LVDS_POWER_GP, "lvds_power");
 	gpio_direction_input(LVDS_POWER_GP);
-	gpio_direction_input(LVDS_BACKLIGHT_GP);
 }
 #endif /* CONFIG_VIDEO_IPUV3 */
 
@@ -574,14 +575,22 @@ int board_init(void)
 		set_confidx(&vpd);
 	}
 
+	gpio_request(SUS_S3_OUT, "sus_s3_out");
 	gpio_direction_output(SUS_S3_OUT, 1);
+
+	gpio_request(WIFI_EN, "wifi_en");
 	gpio_direction_output(WIFI_EN, 1);
+
 #if defined(CONFIG_VIDEO_IPUV3)
 	if (is_b850v3())
 		setup_display_b850v3();
 	else
 		setup_display_bx50v3();
+
+	gpio_request(LVDS_BACKLIGHT_GP, "lvds_backlight");
+	gpio_direction_input(LVDS_BACKLIGHT_GP);
 #endif
+
 	/* address of boot parameters */
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
configs/ge_bx50v3_defconfig +1 -0
index af8a243..10a8b67 100644
@@ -59,3 +59,4 @@ CONFIG_DM_MMC=y
 CONFIG_BLK=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_GPIO=y
Signature · 1 line
2.10.1
#6 lore raw

PATCH 3/13 board: ge: bx50v3: Enable CONFIG_DM_GPIO

Quoted 3 lines

Enable CONFIG_DM_GPIO as a pre-requisite for enabling CONFIG_DM_SPI. Add explicit gpio_requests.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#7 lore raw

PATCH 4/13 board: ge: bx50v3: Enable CONFIG_DM_SPI, CONFIG_DM_SPI_FLASH

In reply to Ian Ray

Use SPI flash device model, and remove SPI pin configuration code since the pinctrl driver is used.

---
 arch/arm/dts/imx6q-bx50v3.dts | 27 +++++++++++++++++++++++++++
 board/ge/bx50v3/bx50v3.c      | 25 -------------------------
 configs/ge_bx50v3_defconfig   |  2 ++
 3 files changed, 29 insertions(+), 25 deletions(-)
arch/arm/dts/imx6q-bx50v3.dts +27 -0
index 0fff219..deaec63 100644
@@ -8,6 +8,7 @@
 /dts-v1/;
 
 #include "imx6q.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	model = "General Electric Bx50v3";
@@ -17,6 +18,16 @@
 &iomuxc {
 	pinctrl-names = "default";
 
+	pinctrl_ecspi1: ecspi1grp {
+		fsl,pins = <
+			MX6QDL_PAD_EIM_D17__ECSPI1_MISO	0x100b1
+			MX6QDL_PAD_EIM_D18__ECSPI1_MOSI	0x100b1
+			MX6QDL_PAD_EIM_D16__ECSPI1_SCLK	0x100b1
+			/* SPI1 CS */
+			MX6QDL_PAD_EIM_EB2__GPIO2_IO30	0x1b0b0
+		>;
+	};
+
 	pinctrl_usdhc3: usdhc3grp {
 		fsl,pins = <
 			MX6QDL_PAD_SD3_CMD__SD3_CMD	0x17059
@@ -60,3 +71,19 @@
 &usdhc4 {
 	status = "disabled";
 };
+
+/* SPI NOR */
+&ecspi1 {
+	cs-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_ecspi1>;
+	status = "okay";
+
+	flash: n25q032 at 0 {
+		compatible = "jedec,spi-nor";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		spi-max-frequency = <20000000>;
+		reg = <0>;
+	};
+};
board/ge/bx50v3/bx50v3.c +0 -25
index dac063d..b69b9e7 100644
@@ -53,9 +53,6 @@ static struct vpd_cache vpd;
 #define ENET_RX_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
 	PAD_CTL_SPEED_HIGH   | PAD_CTL_SRE_FAST)
 
-#define SPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_SPEED_MED | \
-		      PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
-
 #define I2C_PAD_CTRL  (PAD_CTL_PUS_100K_UP |			\
 	PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS |	\
 	PAD_CTL_ODE | PAD_CTL_SRE_FAST)
@@ -113,13 +110,6 @@ static void setup_iomux_enet(void)
 	mdelay(1);
 }
 
-static iomux_v3_cfg_t const ecspi1_pads[] = {
-	MX6_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),
-	MX6_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
-	MX6_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL),
-	MX6_PAD_EIM_EB2__GPIO2_IO30 | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
 static struct i2c_pads_info i2c_pad_info1 = {
 	.scl = {
 		.i2c_mode = MX6_PAD_CSI0_DAT9__I2C1_SCL | I2C_PAD,
@@ -159,18 +149,6 @@ static struct i2c_pads_info i2c_pad_info3 = {
 	}
 };
 
-#ifdef CONFIG_MXC_SPI
-int board_spi_cs_gpio(unsigned bus, unsigned cs)
-{
-	return (bus == 0 && cs == 0) ? (IMX_GPIO_NR(2, 30)) : -1;
-}
-
-static void setup_spi(void)
-{
-	imx_iomux_v3_setup_multiple_pads(ecspi1_pads, ARRAY_SIZE(ecspi1_pads));
-}
-#endif
-
 static iomux_v3_cfg_t const pcie_pads[] = {
 	MX6_PAD_GPIO_5__GPIO1_IO05 | MUX_PAD_CTRL(NO_PAD_CTRL),
 	MX6_PAD_GPIO_17__GPIO7_IO12 | MUX_PAD_CTRL(NO_PAD_CTRL),
@@ -594,9 +572,6 @@ int board_init(void)
 	/* address of boot parameters */
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
-#ifdef CONFIG_MXC_SPI
-	setup_spi();
-#endif
 	return 0;
 }
 
configs/ge_bx50v3_defconfig +2 -0
index 10a8b67..71bf9d6 100644
@@ -60,3 +60,5 @@ CONFIG_BLK=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_DM_GPIO=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
Signature · 1 line
2.10.1
#8 lore raw

PATCH 4/13 board: ge: bx50v3: Enable CONFIG_DM_SPI, CONFIG_DM_SPI_FLASH

Quoted 3 lines

Use SPI flash device model, and remove SPI pin configuration code since the pinctrl driver is used.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#9 lore raw

PATCH 5/13 board: ge: ppd: Enable CONFIG_DM

In reply to Ian Ray

Add simplified, generalised, ppd device tree and enable CONFIG_DM.

---
 arch/arm/dts/Makefile      |  1 +
 arch/arm/dts/imx53-ppd.dts | 14 ++++++++++++++
 configs/mx53ppd_defconfig  |  4 ++++
 3 files changed, 19 insertions(+)
 create mode 100644 arch/arm/dts/imx53-ppd.dts
arch/arm/dts/Makefile +1 -0
index a902775..1fd778b 100644
@@ -583,6 +583,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 	mt7629-rfb.dtb
 
 dtb-$(CONFIG_TARGET_GE_BX50V3) += imx6q-bx50v3.dtb
+dtb-$(CONFIG_TARGET_MX53PPD) += imx53-ppd.dtb
 
 targets += $(dtb-y)
 
arch/arm/dts/imx53-ppd.dts new file +14 -0
new file mode 100644
index 0000000..98e7dad
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0+ OR X11 */
+/*
+ * Copyright 2018 General Electric Company
+ * Based on imx53-ppd.dts from kernel 4.20.5.
+ */
+
+/dts-v1/;
+
+#include "imx53.dtsi"
+
+/ {
+	model = "General Electric CS ONE";
+	compatible = "ge,imx53-cpuvo", "fsl,imx53";
+};
configs/mx53ppd_defconfig +4 -0
index 77af2ae..7556c0c 100644
@@ -45,3 +45,7 @@ CONFIG_VIDEO=y
 # CONFIG_VIDEO_SW_CURSOR is not set
 CONFIG_IMX_WATCHDOG=y
 CONFIG_OF_LIBFDT=y
+CONFIG_DM=y
+CONFIG_CMD_DM=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="imx53-ppd"
Signature · 1 line
2.10.1
#10 lore raw

PATCH 5/13 board: ge: ppd: Enable CONFIG_DM

Quoted 2 lines

Add simplified, generalised, ppd device tree and enable CONFIG_DM.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#11 lore raw

PATCH 6/13 arm: imx: Add esdhc3/4 nodes to imx53.dtsi

In reply to Ian Ray

These nodes are required by mx53ppd when built with CONFIG_DM_MMC=y. They are copied from Linux 4.20.5.

---
 arch/arm/dts/imx53.dtsi | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
arch/arm/dts/imx53.dtsi +26 -0
index e13009c..0fd4acc 100644
@@ -33,6 +33,8 @@
 		i2c2 = &i2c3;
 		mmc0 = &esdhc1;
 		mmc1 = &esdhc2;
+		mmc2 = &esdhc3;
+		mmc3 = &esdhc4;
 	};
 
 	tzic: tz-interrupt-controller at fffc000 {
@@ -86,6 +88,30 @@
 					bus-width = <4>;
 					status = "disabled";
 				};
+
+				esdhc3: esdhc at 50020000 {
+					compatible = "fsl,imx53-esdhc";
+					reg = <0x50020000 0x4000>;
+					interrupts = <3>;
+					clocks = <&clks IMX5_CLK_ESDHC3_IPG_GATE>,
+						 <&clks IMX5_CLK_DUMMY>,
+						 <&clks IMX5_CLK_ESDHC3_PER_GATE>;
+					clock-names = "ipg", "ahb", "per";
+					bus-width = <4>;
+					status = "disabled";
+				};
+
+				esdhc4: esdhc at 50024000 {
+					compatible = "fsl,imx53-esdhc";
+					reg = <0x50024000 0x4000>;
+					interrupts = <4>;
+					clocks = <&clks IMX5_CLK_ESDHC4_IPG_GATE>,
+						 <&clks IMX5_CLK_DUMMY>,
+						 <&clks IMX5_CLK_ESDHC4_PER_GATE>;
+					clock-names = "ipg", "ahb", "per";
+					bus-width = <4>;
+					status = "disabled";
+				};
 			};
 
 			iomuxc: iomuxc at 53fa8000 {
Signature · 1 line
2.10.1
#12 lore raw

PATCH 6/13 arm: imx: Add esdhc3/4 nodes to imx53.dtsi

Quoted 3 lines

These nodes are required by mx53ppd when built with CONFIG_DM_MMC=y. They are copied from Linux 4.20.5.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#13 lore raw

PATCH 7/13 board: ge: ppd: Enable CONFIG_DM_MMC

In reply to Ian Ray

Use MMC device model, and remove USDHC pin configuration code since the pinctrl driver is used.

---
 arch/arm/dts/imx53-ppd.dts | 29 ++++++++++++++++++
 board/ge/mx53ppd/mx53ppd.c | 73 ----------------------------------------------
 configs/mx53ppd_defconfig  |  4 +++
 include/configs/mx53ppd.h  |  6 +---
 4 files changed, 34 insertions(+), 78 deletions(-)
arch/arm/dts/imx53-ppd.dts +29 -0
index 98e7dad..f89d6f4 100644
@@ -12,3 +12,32 @@
 	model = "General Electric CS ONE";
 	compatible = "ge,imx53-cpuvo", "fsl,imx53";
 };
+
+&iomuxc {
+	pinctrl-names = "default";
+
+	pinctrl_esdhc3: esdhc3grp {
+		fsl,pins = <
+			MX53_PAD_PATA_DATA8__ESDHC3_DAT0        0x1d5
+			MX53_PAD_PATA_DATA9__ESDHC3_DAT1        0x1d5
+			MX53_PAD_PATA_DATA10__ESDHC3_DAT2       0x1d5
+			MX53_PAD_PATA_DATA11__ESDHC3_DAT3       0x1d5
+			MX53_PAD_PATA_DATA0__ESDHC3_DAT4        0x1d5
+			MX53_PAD_PATA_DATA1__ESDHC3_DAT5        0x1d5
+			MX53_PAD_PATA_DATA2__ESDHC3_DAT6        0x1d5
+			MX53_PAD_PATA_DATA3__ESDHC3_DAT7        0x1d5
+			MX53_PAD_PATA_RESET_B__ESDHC3_CMD       0x1d5
+			MX53_PAD_PATA_IORDY__ESDHC3_CLK         0x1d5
+		>;
+	};
+};
+
+/* eMMC */
+&esdhc3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_esdhc3>;
+	compatible = "fsl,esdhc";
+	bus-width = <8>;
+	non-removable;
+	status = "okay";
+};
board/ge/mx53ppd/mx53ppd.c +0 -73

79 lines not on this page · raw message

configs/mx53ppd_defconfig +4 -0
index 7556c0c..cd19e9b 100644
@@ -49,3 +49,7 @@ CONFIG_DM=y
 CONFIG_CMD_DM=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx53-ppd"
+CONFIG_DM_MMC=y
+CONFIG_BLK=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX5=y
include/configs/mx53ppd.h +1 -5
index 467547e..efc2f31 100644
@@ -30,10 +30,6 @@
 #define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE	UART1_BASE
 
-/* MMC Configs */
-#define CONFIG_SYS_FSL_ESDHC_ADDR	0
-#define CONFIG_SYS_FSL_ESDHC_NUM	2
-
 /* Eth Configs */
 
 #define CONFIG_FEC_MXC
@@ -101,7 +97,7 @@
 	"image=/boot/fitImage\0" \
 	"fdt_high=0xffffffff\0" \
 	"dev=mmc\0" \
-	"devnum=0\0" \
+	"devnum=2\0" \
 	"rootdev=mmcblk0p\0" \
 	"quiet=quiet loglevel=0\0" \
 	"console=" CONSOLE_DEV "\0" \
Signature · 1 line
2.10.1
#14 lore raw

PATCH 7/13 board: ge: ppd: Enable CONFIG_DM_MMC

Quoted 3 lines

Use MMC device model, and remove USDHC pin configuration code since the pinctrl driver is used.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#15 lore raw

PATCH 8/13 board: ge: store version information in fdt

In reply to Ian Ray

Add board-specific FDT function to store U-Boot version in device tree.

---
 board/ge/bx50v3/bx50v3.c    | 11 +++++++++++
 board/ge/mx53ppd/mx53ppd.c  | 11 +++++++++++
 configs/ge_bx50v3_defconfig |  1 +
 configs/mx53ppd_defconfig   |  1 +
 4 files changed, 24 insertions(+)
board/ge/bx50v3/bx50v3.c +11 -0
index b69b9e7..f42d2ce 100644
@@ -10,6 +10,7 @@
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
 #include <linux/errno.h>
+#include <linux/libfdt.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/mach-imx/iomux-v3.h>
@@ -27,6 +28,7 @@
 #include <i2c.h>
 #include <input.h>
 #include <pwm.h>
+#include <version.h>
 #include <stdlib.h>
 #include "../common/ge_common.h"
 #include "../common/vpd_reader.h"
@@ -689,6 +691,15 @@ int checkboard(void)
 	return 0;
 }
 
+#ifdef CONFIG_OF_BOARD_SETUP
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	fdt_setprop(blob, 0, "ge,boot-ver", version_string,
+	                                    strlen(version_string) + 1);
+	return 0;
+}
+#endif
+
 static int do_backlight_enable(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 #ifdef CONFIG_VIDEO_IPUV3
board/ge/mx53ppd/mx53ppd.c +11 -0
index 9e13a24..5411e42 100644
@@ -17,6 +17,7 @@
 #include <asm/arch/iomux-mx53.h>
 #include <asm/arch/clock.h>
 #include <linux/errno.h>
+#include <linux/libfdt.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/mach-imx/mx5_video.h>
 #include <environment.h>
@@ -30,6 +31,7 @@
 #include <fsl_pmic.h>
 #include <linux/fb.h>
 #include <ipu_pixfmt.h>
+#include <version.h>
 #include <watchdog.h>
 #include "ppd_gpio.h"
 #include <stdlib.h>
@@ -307,3 +309,12 @@ int checkboard(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_OF_BOARD_SETUP
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	fdt_setprop(blob, 0, "ge,boot-ver", version_string,
+	                                    strlen(version_string) + 1);
+	return 0;
+}
+#endif
configs/ge_bx50v3_defconfig +1 -0
index 71bf9d6..d2ed2c1 100644
@@ -62,3 +62,4 @@ CONFIG_PINCTRL_IMX6=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_SPI=y
 CONFIG_DM_SPI_FLASH=y
+CONFIG_OF_BOARD_SETUP=y
configs/mx53ppd_defconfig +1 -0
index cd19e9b..fc6ea71 100644
@@ -53,3 +53,4 @@ CONFIG_DM_MMC=y
 CONFIG_BLK=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX5=y
+CONFIG_OF_BOARD_SETUP=y
Signature · 1 line
2.10.1
#16 lore raw

PATCH 8/13 board: ge: store version information in fdt

Quoted 2 lines

Add board-specific FDT function to store U-Boot version in device tree.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#17 lore raw

PATCH 9/13 board: ge: bx50v3: Specific ARP timeout removed

In reply to Ian Ray

From: Joonas Aijala <[email protected]>

Specific ARP timeout sometimes causes ARP timeout during nfs loading of the fitImage.

---
 include/configs/ge_bx50v3.h | 1 -
 1 file changed, 1 deletion(-)
include/configs/ge_bx50v3.h +0 -1
index 7d62483..d48228b 100644
@@ -148,7 +148,6 @@
 #define CONFIG_BOOTCOMMAND CONFIG_MMCBOOTCOMMAND
 #endif
 
-#define CONFIG_ARP_TIMEOUT     200UL
 
 /* Miscellaneous configurable options */
 
Signature · 1 line
2.10.1
#18 lore raw

PATCH 9/13 board: ge: bx50v3: Specific ARP timeout removed

Quoted 5 lines

From: Joonas Aijala <[email protected]>
Specific ARP timeout sometimes causes ARP timeout during nfs loading of the fitImage.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#19 lore raw

PATCH 10/13 board: ge: bx50v3: Network booting of fitImage with nfs rootfs

In reply to Ian Ray

From: Joonas Aijala <[email protected]>

New boot command introduced to automate network booting.

---
 include/configs/ge_bx50v3.h | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
include/configs/ge_bx50v3.h +28 -1
index d48228b..bc63861 100644
@@ -79,7 +79,32 @@
 
 #define CONFIG_LOADADDR	0x12000000
 
+#ifdef CONFIG_NFS_CMD
+#define NETWORKBOOT \
+        "setnetworkboot=" \
+                "setenv ipaddr 172.16.2.10; setenv serverip 172.16.2.20; " \
+                "setenv gatewayip 172.16.2.20; setenv nfsserver 172.16.2.20; " \
+                "setenv netmask 255.255.255.0; setenv ethaddr ca:fe:de:ca:f0:11; " \
+                "setenv bootargs root=/dev/nfs nfsroot=${nfsserver}:/srv/nfs/,v3,tcp rw rootwait" \
+                "setenv bootargs $bootargs ip=${ipaddr}:${nfsserver}:${gatewayip}:${netmask}::eth0:off " \
+                "setenv bootargs $bootargs cma=128M bootcause=POR console=${console} ${videoargs} " \
+                "setenv bootargs $bootargs systemd.mask=helix-network-defaults.service " \
+                "setenv bootargs $bootargs watchdog.handle_boot_enabled=1\0" \
+        "networkboot=" \
+                "run setnetworkboot; " \
+                "nfs ${loadaddr} /srv/nfs/fitImage; " \
+                "bootm ${loadaddr}#conf@${confidx}\0" \
+
+#define CONFIG_NETWORKBOOTCOMMAND \
+	"run networkboot; " \
+
+#else
+#define NETWORKBOOT \
+
+#endif
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
+	NETWORKBOOT \
 	"bootcause=POR\0" \
 	"image=/boot/fitImage\0" \
 	"fdt_high=0xffffffff\0" \
@@ -142,7 +167,9 @@
 #define CONFIG_USBBOOTCOMMAND \
 	"echo Unsupported; " \
 
-#ifdef CONFIG_CMD_USB
+#ifdef CONFIG_NFS_CMD
+#define CONFIG_BOOTCOMMAND CONFIG_NETWORKBOOTCOMMAND
+#elif CONFIG_CMD_USB
 #define CONFIG_BOOTCOMMAND CONFIG_USBBOOTCOMMAND
 #else
 #define CONFIG_BOOTCOMMAND CONFIG_MMCBOOTCOMMAND
Signature · 1 line
2.10.1
#20 lore raw

PATCH 10/13 board: ge: bx50v3: Network booting of fitImage with nfs rootfs

Quoted 4 lines

From: Joonas Aijala <[email protected]>
New boot command introduced to automate network booting.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#21 lore raw

PATCH 11/13 mx53ppd: bring dock out of reset at boot

In reply to Ian Ray

Configure GPIO BUFFERED_HOST_CONTROLLED_RESET_TO_DOCKING_CONNECTOR_N to bring the dock out of reset at boot.

---
 board/ge/mx53ppd/ppd_gpio.h | 4 ++++
 1 file changed, 4 insertions(+)
board/ge/mx53ppd/ppd_gpio.h +4 -0
index e3b84c7..ba2d1ba 100644
@@ -36,6 +36,8 @@ static const iomux_v3_cfg_t ppd_pads[] = {
 	MX53_PAD_KEY_COL2__GPIO4_10,
 	MX53_PAD_KEY_ROW2__GPIO4_11,
 	MX53_PAD_KEY_COL3__GPIO4_12,
+
+	MX53_PAD_PATA_DATA7__GPIO2_7,    /* BUFFERED_HOST_CONTROLLED_RESET_TO_DOCKING_CONNECTOR_N */
 };
 
 struct gpio_cfg {
@@ -61,6 +63,7 @@ struct gpio_cfg {
 #define ECSPI1_CS1 IMX_GPIO_NR(4, 10)
 #define ECSPI1_CS2 IMX_GPIO_NR(4, 11)
 #define ECSPI1_CS3 IMX_GPIO_NR(4, 12)
+#define BUFFERED_HOST_CONTROLLED_RESET_TO_DOCKING_CONNECTOR_N IMX_GPIO_NR(2, 7)
 
 static const struct gpio_cfg ppd_gpios[] = {
 	/* FEC */
@@ -90,6 +93,7 @@ static const struct gpio_cfg ppd_gpios[] = {
 	{ ECSPI1_CS1, 1 },
 	{ ECSPI1_CS2, 1 },
 	{ ECSPI1_CS3, 1 },
+	{ BUFFERED_HOST_CONTROLLED_RESET_TO_DOCKING_CONNECTOR_N, 1 },
 };
 
 #endif /* __PPD_GPIO_H_ */
Signature · 1 line
2.10.1
#22 lore raw

PATCH 11/13 mx53ppd: bring dock out of reset at boot

Quoted 3 lines

Configure GPIO BUFFERED_HOST_CONTROLLED_RESET_TO_DOCKING_CONNECTOR_N to bring the dock out of reset at boot.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#23 lore raw

PATCH 12/13 mx53ppd: fix unsupported set command

In reply to Ian Ray

Fix the NFS commands which used set' to instead use setenv'.

---
 include/configs/mx53ppd.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/configs/mx53ppd.h +3 -3
index efc2f31..e34693e 100644
@@ -85,10 +85,10 @@
 	"nfsroot=/opt/springdale/rd\0" \
 	"bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs " \
 		"${kern_ipconf} nfsroot=${nfsserver}:${nfsroot},v3,tcp rw\0" \
-	"choose_ip=if test $use_dhcp = 1; then set kern_ipconf ip=dhcp; " \
-		"set getcmd dhcp; else set kern_ipconf " \
+	"choose_ip=if test $use_dhcp = 1; then setenv kern_ipconf ip=dhcp; " \
+		"setenv getcmd dhcp; else setenv kern_ipconf " \
 		"ip=${ipaddr}:${nfsserver}:${gatewayip}:${netmask}::eth0:off; " \
-		"set getcmd tftp; fi\0" \
+		"setenv getcmd tftp; fi\0" \
 	"nfs=run choose_ip setargs bootargs_nfs; ${getcmd} ${loadaddr} " \
 		"${nfsserver}:${image}; bootm ${loadaddr}\0" \
 
Signature · 1 line
2.10.1
#24 lore raw

PATCH 12/13 mx53ppd: fix unsupported set command

Quoted 2 lines

Fix the NFS commands which used set' to instead use setenv'.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#25 lore raw

PATCH 13/13 bootcount: i2c: Delay after writing

In reply to Ian Ray

Since 2018.11, the pattern of bootcount load and store has changed such that bootcount_inc() and bootcount_error() will load, increment, store, and load *again*. The second load exposes a timing problem whereby the i2c read fails. The root cause _seems_ to relate to performance of the 24c08 EEPROM. Insert a delay after writing to work around this.

---
 drivers/bootcount/bootcount_i2c.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/bootcount/bootcount_i2c.c +4 -0
index ed22389..dd86426 100644
@@ -64,6 +64,10 @@ void bootcount_store(ulong a)
 			CONFIG_BOOTCOUNT_ALEN, buf, sizeof(buf));
 	if (ret != 0)
 		puts("Error writing bootcount\n");
+	else
+		/* Datasheet claims 2 ms typical write cycle time.
+		 * This delay ensures that next read will succeed. */
+		mdelay(5);
 
 	bootcount_set_bus_back(prev_i2c_bus);
 }
Signature · 1 line
2.10.1
#26 lore raw

PATCH 13/13 bootcount: i2c: Delay after writing

Hi Ian,

Quoted 16 lines · Ian Ray

Since 2018.11, the pattern of bootcount load and store has changed such that bootcount_inc() and bootcount_error() will load, increment, store, and load *again*. The second load exposes a timing problem whereby the i2c read fails. The root cause _seems_ to relate to performance of the 24c08 EEPROM. Insert a delay after writing to work around this.

---
 drivers/bootcount/bootcount_i2c.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/bootcount/bootcount_i2c.c +0 -0
index ed22389..dd86426 100644

drivers/bootcount/bootcount_i2c.c void bootcount_store(ulong a) · line 71

Quoted 8 lines
drivers/bootcount/bootcount_i2c.c +4 -0
@@ -64,6 +64,10 @@ void bootcount_store(ulong a)
 			CONFIG_BOOTCOUNT_ALEN, buf, sizeof(buf));
 	if (ret != 0)
 		puts("Error writing bootcount\n");
+	else
+		/* Datasheet claims 2 ms typical write cycle time.
+		 * This delay ensures that next read will succeed. */
+		mdelay(5);
 

I see, but this is device specific while bootcount_i2c should be device-unaware. I know this driver is used with PMIC where no delay is required. Heiko, is it ok to put a fix delay here or should be configurable ?

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#27 lore raw

PATCH 13/13 bootcount: i2c: Delay after writing

Hello Stefano,

Am 13.03.2019 um 11:04 schrieb Stefano Babic:

Quoted 24 lines

Hi Ian,

Quoted 21 lines · Ian Ray

Since 2018.11, the pattern of bootcount load and store has changed such that bootcount_inc() and bootcount_error() will load, increment, store, and load *again*. The second load exposes a timing problem whereby the i2c read fails. The root cause _seems_ to relate to performance of the 24c08 EEPROM. Insert a delay after writing to work around this.

---
  drivers/bootcount/bootcount_i2c.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/bootcount/bootcount_i2c.c +2 -0
index ed22389..dd86426 100644
@@ -64,6 +64,10 @@ void bootcount_store(ulong a)
  			CONFIG_BOOTCOUNT_ALEN, buf, sizeof(buf));
  	if (ret != 0)
  		puts("Error writing bootcount\n");
+	else
+		/* Datasheet claims 2 ms typical write cycle time.
Quoted 8 lines

drivers/bootcount/bootcount_i2c.c void bootcount_store(ulong a) · line 71

Quoted 3 lines
drivers/bootcount/bootcount_i2c.c +2 -0
+		 * This delay ensures that next read will succeed. */
+		mdelay(5);
 

I see, but this is device specific while bootcount_i2c should be device-unaware. I know this driver is used with PMIC where no delay is required. Heiko, is it ok to put a fix delay here or should be configurable ?

I would prefer here to make this timeout configurable, thinking about boottime constraints.

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de
#28 lore raw

PATCH 13/13 bootcount: i2c: Delay after writing

Quoted 37 lines · Heiko Schocher

Hello Stefano,

Am 13.03.2019 um 11:04 schrieb Stefano Babic:

Quoted 25 lines

Hi Ian,

Quoted 22 lines · Ian Ray

Since 2018.11, the pattern of bootcount load and store has changed such that bootcount_inc() and bootcount_error() will load, increment, store, and load *again*.  The second load exposes a timing problem whereby the i2c read fails.  The root cause _seems_ to relate to performance of the 24c08 EEPROM.  Insert a delay after writing to work around this.

---
  drivers/bootcount/bootcount_i2c.c | 4 ++++

  1 file changed, 4 insertions(+)
drivers/bootcount/bootcount_i2c.c +2 -0
index ed22389..dd86426 100644
@@ -64,6 +64,10 @@ void bootcount_store(ulong a)
               CONFIG_BOOTCOUNT_ALEN, buf, sizeof(buf));
       if (ret != 0)
           puts("Error writing bootcount\n");
+    else
+        /* Datasheet claims 2 ms typical write cycle time.
Quoted 8 lines
Quoted 3 lines
drivers/bootcount/bootcount_i2c.c +2 -0
+         * This delay ensures that next read will succeed. */
+        mdelay(5);

I see, but this is device specific while bootcount_i2c should be device-unaware. I know this driver is used with PMIC where no delay is required. Heiko, is it ok to put a fix delay here or should be configurable ?

Quoted 3 lines

I would prefer here to make this timeout configurable, thinking about boottime constraints.

Right, I see the same - Ian, I have applied the whole series with the exception of this one to u-boot-imx, next branch.

Regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#29 lore raw

[U-Boot] EXT: Re: [PATCH 13/13] bootcount: i2c: Delay after writing

Quoted 42 lines · Stefano Babic
Quoted 37 lines · Heiko Schocher

Hello Stefano,

Am 13.03.2019 um 11:04 schrieb Stefano Babic:

Quoted 33 lines

Hi Ian,

Quoted 17 lines · Ian Ray

Since 2018.11, the pattern of bootcount load and store has changed such that bootcount_inc() and bootcount_error() will load, increment, store, and load *again*. The second load exposes a timing problem whereby the i2c read fails. The root cause _seems_ to relate to performance of the 24c08 EEPROM. Insert a delay after writing to work around this.

---
  drivers/bootcount/bootcount_i2c.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/bootcount/bootcount_i2c.c +0 -0
index ed22389..dd86426 100644

drivers/bootcount/bootcount_i2c.c void bootcount_store(ulong a) · line 71

Quoted 8 lines
drivers/bootcount/bootcount_i2c.c +4 -0
@@ -64,6 +64,10 @@ void bootcount_store(ulong a)
              CONFIG_BOOTCOUNT_ALEN, buf, sizeof(buf));
      if (ret != 0)
          puts("Error writing bootcount\n");
+    else
+        /* Datasheet claims 2 ms typical write cycle time.
+         * This delay ensures that next read will succeed. */
+        mdelay(5);
 

I see, but this is device specific while bootcount_i2c should be device-unaware. I know this driver is used with PMIC where no delay is required. Heiko, is it ok to put a fix delay here or should be configurable ?

Quoted 7 lines
Quoted 3 lines

I would prefer here to make this timeout configurable, thinking about boottime constraints.

Right, I see the same - Ian, I have applied the whole series with the exception of this one to u-boot-imx, next branch.

Thank you! I will look in to the configuration.

Quoted 9 lines

Regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================