Skip to contentSkip to conversation

tbs2910 fixes and driver model conversion

PATCH New Soeren Moch 2 participants 24 messages Mar 1, 2019 – Apr 1, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover tbs2910 fixes and driver model conversion

DM_MMC activates BLK, so we have to convert dwc_ahsata to AHCI before.

Soeren Moch (10):
board: tbs2910: Fix default environment
board: tbs2910: Remove efi loader support in defconfig to reduce
u-boot size
board: tbs2910: Add device tree
board: tbs2910: Add pinctrl driver and convert gpio to driver model
board: tbs2910: Convert usb to driver model
board: tbs2910: Convert i2c and rtc to driver model
ata: dwc_ahsata: Fix sector reports for large disks
ata: dwc_ahsata: Add ahci driver model support
board: tbs2910: Convert sata to ahci driver model
board: tbs2910: Convert mmc to driver model

 arch/arm/dts/imx6q-tbs2910.dts | 394 +++++++++++++++++++++++++++++++++
 board/tbs/tbs2910/MAINTAINERS  |   1 +
 board/tbs/tbs2910/tbs2910.c    | 184 +--------------
 configs/cm_fx6_defconfig       |   1 +
 configs/tbs2910_defconfig      |  18 +-
 drivers/ata/Kconfig            |   8 +
 drivers/ata/dwc_ahsata.c       |  38 +++-
 include/configs/tbs2910.h      |  38 +---
 8 files changed, 455 insertions(+), 227 deletions(-)
 create mode 100644 arch/arm/dts/imx6q-tbs2910.dts

--
2.17.1

#1 lore raw

PATCH 1/10 board: tbs2910: Fix default environment

Especially fix usb keyboard support. Other changes are only for beautification.

---
Cc: Stefano Babic <[email protected]>
Cc: u-boot at lists.denx.de

---
 include/configs/tbs2910.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
include/configs/tbs2910.h +6 -6
index 2d4b9c9bfe..b06c90939c 100644
@@ -94,7 +94,7 @@
 		"run set_con_hdmi; " \
 	"else " \
 		"run set_con_serial; " \
-	"fi;"
+	"fi"
 #endif /* CONFIG_USB_KEYBOARD */
 #endif /* CONFIG_CMD_USB      */
 
@@ -142,12 +142,12 @@
 	"console=ttymxc0\0" \
 	"fan=gpio set 92\0" \
 	"set_con_serial=setenv stdout serial; " \
-			"setenv stderr serial;\0" \
+			"setenv stderr serial\0" \
 	"set_con_hdmi=setenv stdout serial,vga; " \
-			"setenv stderr serial,vga;\0" \
-	"stderr=serial,vga;\0" \
-	"stdin=serial,usbkbd;\0" \
-	"stdout=serial,vga;\0"
+			"setenv stderr serial,vga\0" \
+	"stderr=serial,vga\0" \
+	"stdin=serial,usbkbd\0" \
+	"stdout=serial,vga\0"
 
 #define CONFIG_BOOTCOMMAND \
 	"mmc rescan; " \

--
2.17.1

#2 lore raw

PATCH 1/10 board: tbs2910: Fix default environment

Quoted 7 lines · Soeren Moch

Especially fix usb keyboard support. Other changes are only for beautification.

---
Cc: Stefano Babic <[email protected]>
Cc: u-boot at lists.denx.de

Stefano,

apparently you decided to pull fixes for v2019.04 and DM conversions for v2019.07. Since this patch (1/10) is a fix, can you at least pull this now, and the rest of the series later (or for -next)?

Thanks,
Soeren

#3 lore raw

PATCH 1/10 board: tbs2910: Fix default environment

Quoted 4 lines · Soeren Moch
Quoted 3 lines · Soeren Moch

Especially fix usb keyboard support. Other changes are only for beautification.

Quoted 8 lines
Quoted 4 lines

---
Cc: Stefano Babic <[email protected]>
Cc: u-boot at lists.denx.de

Stefano,

apparently you decided to pull fixes for v2019.04 and DM conversions for v2019.07.

That is right.

Quoted 2 lines

Since this patch (1/10) is a fix, can you at least pull this now, and the rest of the series later (or for -next)?

I pick up 1/10

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
=====================================================================
#4 lore raw

PATCH 2/10 board: tbs2910: Remove efi loader support in defconfig to reduce u-boot size

In reply to Soeren Moch

---
Cc: Stefano Babic <[email protected]>
Cc: u-boot at lists.denx.de

---
 configs/tbs2910_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/tbs2910_defconfig +1 -0
index 78beb9a522..70a3e18e23 100644
@@ -56,3 +56,4 @@ CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_VIDEO=y
 CONFIG_OF_LIBFDT=y
+# CONFIG_EFI_LOADER is not set

--
2.17.1

#5 lore raw

PATCH 2/10 board: tbs2910: Remove efi loader support in defconfig to reduce u-boot size

Quoted 1 line

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
=====================================================================
#6 lore raw

PATCH 3/10 board: tbs2910: Add device tree

In reply to Soeren Moch

... as preparation for additional driver model coonversions.

We use CONFIG_OF_EMBED here to keep u-boot.imx as final binary name. So we maintain compatibility with the original TBS u-boot and available HOWTOs for u-boot updates.

---
Cc: Stefano Babic <[email protected]>
Cc: u-boot at lists.denx.de

---
 arch/arm/dts/imx6q-tbs2910.dts | 394 +++++++++++++++++++++++++++++++++
 board/tbs/tbs2910/MAINTAINERS  |   1 +
 board/tbs/tbs2910/tbs2910.c    |   6 -
 configs/tbs2910_defconfig      |   4 +-
 4 files changed, 398 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/imx6q-tbs2910.dts
arch/arm/dts/imx6q-tbs2910.dts new file +394 -0
new file mode 100644
index 0000000000..21e62c0cab
@@ -0,0 +1,394 @@
+// SPDX-License-Identifier: GPL-2.0+ OR MIT
+//
+// Copyright 2014-2019 Soeren Moch <[email protected]>
+
+/dts-v1/;
+
+#include "imx6q.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "TBS2910 Matrix ARM mini PC";
+	compatible = "tbs,imx6q-tbs2910", "fsl,imx6q";
+
+	chosen {
+		stdout-path = &uart1;
+	};
+
+	aliases {
+		mmc0 = &usdhc2;
+		mmc1 = &usdhc3;
+		mmc2 = &usdhc4;
+		usb0 = &usbotg;
+	};
+
+	memory at 10000000 {
+		reg = <0x10000000 0x80000000>;
+	};
+
+	fan {
+		compatible = "gpio-fan";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_gpio_fan>;
+		gpios = <&gpio3 28 GPIO_ACTIVE_HIGH>;
+		gpio-fan,speed-map = <0    0
+				      3000 1>;
+	};
+
+	ir_recv {
+		compatible = "gpio-ir-receiver";
+		gpios = <&gpio3 18 GPIO_ACTIVE_LOW>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_ir>;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_gpio_leds>;
+
+		blue {
+			label = "blue_status_led";
+			gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+			default-state = "keep";
+		};
+	};
+
+	reg_2p5v: regulator-2p5v {
+		compatible = "regulator-fixed";
+		regulator-name = "2P5V";
+		regulator-min-microvolt = <2500000>;
+		regulator-max-microvolt = <2500000>;
+	};
+
+	reg_3p3v: regulator-3p3v {
+		compatible = "regulator-fixed";
+		regulator-name = "3P3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
+
+	reg_5p0v: regulator-5p0v {
+		compatible = "regulator-fixed";
+		regulator-name = "5P0V";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+	};
+
+	sound-sgtl5000 {
+		audio-codec = <&sgtl5000>;
+		audio-routing =
+			"MIC_IN", "Mic Jack",
+			"Mic Jack", "Mic Bias",
+			"Headphone Jack", "HP_OUT";
+		compatible = "fsl,imx-audio-sgtl5000";
+		model = "On-board Codec";
+		mux-ext-port = <3>;
+		mux-int-port = <1>;
+		ssi-controller = <&ssi1>;
+	};
+
+	sound-spdif {
+		compatible = "fsl,imx-audio-spdif";
+		model = "On-board SPDIF";
+		spdif-controller = <&spdif>;
+		spdif-out;
+	};
+};
+
+&audmux {
+	status = "okay";
+};
+
+&fec {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_enet>;
+	phy-mode = "rgmii";
+	phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
+	status = "okay";
+};
+
+&hdmi {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_hdmi>;
+	ddc-i2c-bus = <&i2c2>;
+	status = "okay";
+};
+
+&i2c1 {
+	clock-frequency = <100000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_i2c1>;
+	status = "okay";
+
+	sgtl5000: sgtl5000 at a {
+		clocks = <&clks IMX6QDL_CLK_CKO>;
+		compatible = "fsl,sgtl5000";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_sgtl5000>;
+		reg = <0x0a>;
+		VDDA-supply = <&reg_2p5v>;
+		VDDIO-supply = <&reg_3p3v>;
+	};
+};
+
+&i2c2 {
+	clock-frequency = <100000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_i2c2>;
+	status = "okay";
+};
+
+&i2c3 {
+	clock-frequency = <100000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_i2c3>;
+	status = "okay";
+
+	rtc: ds1307 at 68 {
+		compatible = "dallas,ds1307";
+		reg = <0x68>;
+	};
+};
+
+&pcie {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_pcie>;
+	reset-gpio = <&gpio7 12 GPIO_ACTIVE_LOW>;
+	status = "okay";
+};
+
+&sata {
+	fsl,transmit-level-mV = <1104>;
+	fsl,transmit-boost-mdB = <3330>;
+	fsl,transmit-atten-16ths = <16>;
+	fsl,receive-eq-mdB = <3000>;
+	status = "okay";
+};
+
+&snvs_poweroff {
+	status = "okay";
+};
+
+&spdif {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_spdif>;
+	status = "okay";
+};
+
+&ssi1 {
+	status = "okay";
+};
+
+&uart1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_uart1>;
+	status = "okay";
+};
+
+&uart2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_uart2>;
+	status = "okay";
+};
+
+&usbh1 {
+	vbus-supply = <&reg_5p0v>;
+	status = "okay";
+};
+
+&usbotg {
+	vbus-supply = <&reg_5p0v>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usbotg>;
+	disable-over-current;
+	status = "okay";
+};
+
+&usdhc2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usdhc2>;
+	bus-width = <4>;
+	cd-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&reg_3p3v>;
+	voltage-ranges = <3300 3300>;
+	no-1-8-v;
+	status = "okay";
+};
+
+&usdhc3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usdhc3>;
+	bus-width = <4>;
+	cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
+	wp-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&reg_3p3v>;
+	voltage-ranges = <3300 3300>;
+	no-1-8-v;
+	status = "okay";
+};
+
+&usdhc4 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usdhc4>;
+	bus-width = <8>;
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&reg_3p3v>;
+	voltage-ranges = <3300 3300>;
+	non-removable;
+	no-1-8-v;
+	status = "okay";
+};
+
+&iomuxc {
+	pinctrl_enet: enetgrp {
+		fsl,pins = <
+			MX6QDL_PAD_ENET_MDIO__ENET_MDIO       0x1b0b0
+			MX6QDL_PAD_ENET_MDC__ENET_MDC         0x1b0b0
+			MX6QDL_PAD_RGMII_TXC__RGMII_TXC       0x1b030
+			MX6QDL_PAD_RGMII_TD0__RGMII_TD0       0x1b030
+			MX6QDL_PAD_RGMII_TD1__RGMII_TD1       0x1b030
+			MX6QDL_PAD_RGMII_TD2__RGMII_TD2       0x1b030
+			MX6QDL_PAD_RGMII_TD3__RGMII_TD3       0x1b030
+			MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b030
+			MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK  0x1b0b0
+			MX6QDL_PAD_RGMII_RXC__RGMII_RXC       0x1b030
+			MX6QDL_PAD_RGMII_RD0__RGMII_RD0       0x1b030
+			MX6QDL_PAD_RGMII_RD1__RGMII_RD1       0x1b030
+			MX6QDL_PAD_RGMII_RD2__RGMII_RD2       0x1b030
+			MX6QDL_PAD_RGMII_RD3__RGMII_RD3       0x1b030
+			MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b030
+			MX6QDL_PAD_GPIO_16__ENET_REF_CLK      0x4001b0a8
+			MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25    0x1b059
+		>;
+	};
+
+	pinctrl_gpio_fan: gpiofangrp {
+		fsl,pins = <
+			MX6QDL_PAD_EIM_D28__GPIO3_IO28        0x130b1
+		>;
+	};
+
+	pinctrl_gpio_leds: gpioledsgrp {
+		fsl,pins = <
+			MX6QDL_PAD_GPIO_2__GPIO1_IO02         0x130b1
+		>;
+	};
+
+	pinctrl_hdmi: hdmigrp {
+		fsl,pins = <
+			MX6QDL_PAD_KEY_ROW2__HDMI_TX_CEC_LINE 0x1f8b0
+		>;
+	};
+
+	pinctrl_i2c1: i2c1grp {
+		fsl,pins = <
+			MX6QDL_PAD_CSI0_DAT9__I2C1_SCL        0x4001b8b1
+			MX6QDL_PAD_CSI0_DAT8__I2C1_SDA        0x4001b8b1
+		>;
+	};
+
+	pinctrl_i2c2: i2c2grp {
+		fsl,pins = <
+			MX6QDL_PAD_KEY_COL3__I2C2_SCL         0x4001b8b1
+			MX6QDL_PAD_KEY_ROW3__I2C2_SDA         0x4001b8b1
+		>;
+	};
+
+	pinctrl_i2c3: i2c3grp {
+		fsl,pins = <
+			MX6QDL_PAD_GPIO_3__I2C3_SCL           0x4001b8b1
+			MX6QDL_PAD_GPIO_6__I2C3_SDA           0x4001b8b1
+		>;
+	};
+
+	pinctrl_ir: irgrp {
+		fsl,pins = <
+			MX6QDL_PAD_EIM_D18__GPIO3_IO18        0x17059
+		>;
+	};
+
+	pinctrl_pcie: pciegrp {
+		fsl,pins = <
+			MX6QDL_PAD_GPIO_17__GPIO7_IO12        0x17059
+		>;
+	};
+
+	pinctrl_sgtl5000: sgtl5000grp {
+		fsl,pins = <
+			MX6QDL_PAD_CSI0_DAT7__AUD3_RXD        0x130b0
+			MX6QDL_PAD_CSI0_DAT4__AUD3_TXC        0x130b0
+			MX6QDL_PAD_CSI0_DAT5__AUD3_TXD        0x110b0
+			MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS       0x130b0
+			MX6QDL_PAD_GPIO_0__CCM_CLKO1          0x130b0
+		>;
+	};
+
+	pinctrl_spdif: spdifgrp {
+		fsl,pins = <MX6QDL_PAD_GPIO_19__SPDIF_OUT     0x13091
+		>;
+	};
+
+	pinctrl_uart1: uart1grp {
+		fsl,pins = <
+			MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA  0x1b0b1
+			MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA  0x1b0b1
+		>;
+	};
+
+	pinctrl_uart2: uart2grp {
+		fsl,pins = <
+			MX6QDL_PAD_EIM_D26__UART2_TX_DATA     0x1b0b1
+			MX6QDL_PAD_EIM_D27__UART2_RX_DATA     0x1b0b1
+		>;
+	};
+
+	pinctrl_usbotg: usbotggrp {
+		fsl,pins = <
+			MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID     0x17059
+		>;
+	};
+
+	pinctrl_usdhc2: usdhc2grp {
+		fsl,pins = <
+			MX6QDL_PAD_SD2_CMD__SD2_CMD           0x17059
+			MX6QDL_PAD_SD2_CLK__SD2_CLK           0x10059
+			MX6QDL_PAD_SD2_DAT0__SD2_DATA0        0x17059
+			MX6QDL_PAD_SD2_DAT1__SD2_DATA1        0x17059
+			MX6QDL_PAD_SD2_DAT2__SD2_DATA2        0x17059
+			MX6QDL_PAD_SD2_DAT3__SD2_DATA3        0x17059
+			MX6QDL_PAD_NANDF_D2__GPIO2_IO02       0x17059
+		>;
+	};
+
+	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_NANDF_D0__GPIO2_IO00       0x17059
+			MX6QDL_PAD_NANDF_D1__GPIO2_IO01       0x17059
+		>;
+	};
+
+	pinctrl_usdhc4: usdhc4grp {
+		fsl,pins = <
+			MX6QDL_PAD_SD4_CMD__SD4_CMD           0x17059
+			MX6QDL_PAD_SD4_CLK__SD4_CLK           0x10059
+			MX6QDL_PAD_SD4_DAT0__SD4_DATA0        0x17059
+			MX6QDL_PAD_SD4_DAT1__SD4_DATA1        0x17059
+			MX6QDL_PAD_SD4_DAT2__SD4_DATA2        0x17059
+			MX6QDL_PAD_SD4_DAT3__SD4_DATA3        0x17059
+			MX6QDL_PAD_SD4_DAT4__SD4_DATA4        0x17059
+			MX6QDL_PAD_SD4_DAT5__SD4_DATA5        0x17059
+			MX6QDL_PAD_SD4_DAT6__SD4_DATA6        0x17059
+			MX6QDL_PAD_SD4_DAT7__SD4_DATA7        0x17059
+		>;
+	};
+};
board/tbs/tbs2910/MAINTAINERS +1 -0
index bf176553d2..a3ad2f712a 100644
@@ -1,6 +1,7 @@
 TBS2910 BOARD
 M:	Soeren Moch <[email protected]>
 S:	Maintained
+F:	arch/arm/dts/imx6q-tbs2910.dts
 F:	board/tbs/tbs2910/
 F:	configs/tbs2910_defconfig
 F:	include/configs/tbs2910.h
board/tbs/tbs2910/tbs2910.c +0 -6
index ecb45f208d..99b282ca6b 100644
@@ -446,9 +446,3 @@ int board_init(void)
 #endif
 	return 0;
 }
-
-int checkboard(void)
-{
-	puts("Board: TBS2910 Matrix ARM mini PC\n");
-	return 0;
-}
configs/tbs2910_defconfig +3 -1
index 70a3e18e23..3cc68eb922 100644
@@ -36,6 +36,9 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_EFI_PARTITION=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_EMBED=y
+CONFIG_DEFAULT_DEVICE_TREE="imx6q-tbs2910"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
@@ -55,5 +58,4 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_VIDEO=y
-CONFIG_OF_LIBFDT=y
 # CONFIG_EFI_LOADER is not set

--
2.17.1

#7 lore raw

PATCH 3/10 board: tbs2910: Add device tree

Quoted 5 lines

... as preparation for additional driver model coonversions. We use CONFIG_OF_EMBED here to keep u-boot.imx as final binary name. So we maintain compatibility with the original TBS u-boot and available HOWTOs for u-boot updates.

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
=====================================================================
#8 lore raw

PATCH 4/10 board: tbs2910: Add pinctrl driver and convert gpio to driver model

In reply to Soeren Moch

We need this for additional driver model conversions.

---
Cc: Stefano Babic <[email protected]>
Cc: u-boot at lists.denx.de

---
 board/tbs/tbs2910/tbs2910.c | 3 +++
 configs/tbs2910_defconfig   | 3 +++
 2 files changed, 6 insertions(+)
board/tbs/tbs2910/tbs2910.c +3 -0
index 99b282ca6b..175dd88a69 100644
@@ -138,6 +138,7 @@ static void setup_iomux_enet(void)
 	imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
 
 	/* Reset AR8035 PHY */
+	gpio_request(IMX_GPIO_NR(1, 25), "ETH_PHY_RESET");
 	gpio_direction_output(IMX_GPIO_NR(1, 25) , 0);
 	udelay(500);
 	gpio_set_value(IMX_GPIO_NR(1, 25), 1);
@@ -230,12 +231,14 @@ int board_mmc_init(bd_t *bis)
 		case 0:
 			imx_iomux_v3_setup_multiple_pads(
 				usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
+			gpio_request(USDHC2_CD_GPIO, "MMC0_CD");
 			gpio_direction_input(USDHC2_CD_GPIO);
 			usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
 			break;
 		case 1:
 			imx_iomux_v3_setup_multiple_pads(
 				usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
+			gpio_request(USDHC3_CD_GPIO, "MMC1_CD");
 			gpio_direction_input(USDHC3_CD_GPIO);
 			usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
 			break;
configs/tbs2910_defconfig +3 -0
index 3cc68eb922..717cabfa3b 100644
@@ -42,10 +42,13 @@ CONFIG_DEFAULT_DEVICE_TREE="imx6q-tbs2910"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
+CONFIG_DM_GPIO=y
 CONFIG_FSL_ESDHC=y
 CONFIG_PHYLIB=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
 CONFIG_DM_THERMAL=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y

--
2.17.1

#9 lore raw

PATCH 4/10 board: tbs2910: Add pinctrl driver and convert gpio to driver model

Quoted 2 lines

We need this for additional driver model conversions.

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
=====================================================================
#10 lore raw

PATCH 5/10 board: tbs2910: Convert usb to driver model

In reply to Soeren Moch

So we don't need to duplicate settings from the device tree in the board file.

---
Cc: Stefano Babic <[email protected]>
Cc: u-boot at lists.denx.de

---
 board/tbs/tbs2910/tbs2910.c | 10 ----------
 configs/tbs2910_defconfig   |  2 ++
 include/configs/tbs2910.h   |  1 -
 3 files changed, 2 insertions(+), 11 deletions(-)
board/tbs/tbs2910/tbs2910.c +0 -10
index 175dd88a69..20c93778e1 100644
@@ -418,12 +418,6 @@ static const struct boot_mode board_boot_modes[] = {
 };
 #endif
 
-#ifdef CONFIG_USB_EHCI_MX6
-static iomux_v3_cfg_t const usb_otg_pads[] = {
-	MX6_PAD_ENET_RX_ER__USB_OTG_ID | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-#endif
-
 int board_init(void)
 {
 	/* address of boot parameters */
@@ -442,10 +436,6 @@ int board_init(void)
 #endif
 #ifdef CONFIG_CMD_BMODE
 	add_board_boot_modes(board_boot_modes);
-#endif
-#ifdef CONFIG_USB_EHCI_MX6
-	imx_iomux_v3_setup_multiple_pads(
-		usb_otg_pads, ARRAY_SIZE(usb_otg_pads));
 #endif
 	return 0;
 }
configs/tbs2910_defconfig +2 -0
index 717cabfa3b..395275c6dd 100644
@@ -43,6 +43,7 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
 CONFIG_DM_GPIO=y
+CONFIG_DM_KEYBOARD=y
 CONFIG_FSL_ESDHC=y
 CONFIG_PHYLIB=y
 CONFIG_MII=y
@@ -51,6 +52,7 @@ CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_DM_THERMAL=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
include/configs/tbs2910.h +0 -1
index b06c90939c..93f75d72f3 100644
@@ -81,7 +81,6 @@
 
 /* USB */
 #ifdef CONFIG_CMD_USB
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
 #ifdef CONFIG_CMD_USB_MASS_STORAGE

--
2.17.1

#11 lore raw

PATCH 5/10 board: tbs2910: Convert usb to driver model

Quoted 2 lines

So we don't need to duplicate settings from the device tree in the board file.

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
=====================================================================
#12 lore raw

PATCH 6/10 board: tbs2910: Convert i2c and rtc to driver model

In reply to Soeren Moch

So we don't need to duplicate settings from the device tree in the board file.

---
Cc: Stefano Babic <[email protected]>
Cc: u-boot at lists.denx.de

---
 board/tbs/tbs2910/tbs2910.c | 57 -------------------------------------
 configs/tbs2910_defconfig   |  6 +++-
 include/configs/tbs2910.h   | 17 -----------
 3 files changed, 5 insertions(+), 75 deletions(-)
board/tbs/tbs2910/tbs2910.c +0 -57
index 20c93778e1..2445efbde2 100644
@@ -9,7 +9,6 @@
 #include <asm/arch/mx6-pins.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
-#include <asm/mach-imx/mxc_i2c.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/sata.h>
 #include <asm/mach-imx/boot_mode.h>
@@ -22,7 +21,6 @@
 #include <asm/arch/crm_regs.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
-#include <i2c.h>
 DECLARE_GLOBAL_DATA_PTR;
 
 #define WEAK_PULLUP	(PAD_CTL_PUS_47K_UP |			\
@@ -40,56 +38,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP |			\
 	PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
 
-#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)
-
-#define I2C_PAD MUX_PAD_CTRL(I2C_PAD_CTRL)
-
-#ifdef CONFIG_SYS_I2C
-/* I2C1, SGTL5000 */
-static struct i2c_pads_info i2c_pad_info0 = {
-	.scl = {
-		.i2c_mode = MX6_PAD_CSI0_DAT9__I2C1_SCL | I2C_PAD,
-		.gpio_mode = MX6_PAD_CSI0_DAT9__GPIO5_IO27 | I2C_PAD,
-		.gp = IMX_GPIO_NR(5, 27)
-	},
-	.sda = {
-		.i2c_mode = MX6_PAD_CSI0_DAT8__I2C1_SDA | I2C_PAD,
-		.gpio_mode = MX6_PAD_CSI0_DAT8__GPIO5_IO26 | I2C_PAD,
-		.gp = IMX_GPIO_NR(5, 26)
-	}
-};
-
-/* I2C2 HDMI */
-static struct i2c_pads_info i2c_pad_info1 = {
-	.scl = {
-		.i2c_mode = MX6_PAD_KEY_COL3__I2C2_SCL | I2C_PAD,
-		.gpio_mode = MX6_PAD_KEY_COL3__GPIO4_IO12 | I2C_PAD,
-		.gp = IMX_GPIO_NR(4, 12)
-	},
-	.sda = {
-		.i2c_mode = MX6_PAD_KEY_ROW3__I2C2_SDA | I2C_PAD,
-		.gpio_mode = MX6_PAD_KEY_ROW3__GPIO4_IO13 | I2C_PAD,
-		.gp = IMX_GPIO_NR(4, 13)
-	}
-};
-
-/* I2C3, CON11, DS1307, PCIe_SMB */
-static struct i2c_pads_info i2c_pad_info2 = {
-	.scl = {
-		.i2c_mode = MX6_PAD_GPIO_3__I2C3_SCL | I2C_PAD,
-		.gpio_mode = MX6_PAD_GPIO_3__GPIO1_IO03 | I2C_PAD,
-		.gp = IMX_GPIO_NR(1, 3)
-	},
-	.sda = {
-		.i2c_mode = MX6_PAD_GPIO_6__I2C3_SDA | I2C_PAD,
-		.gpio_mode = MX6_PAD_GPIO_6__GPIO1_IO06 | I2C_PAD,
-		.gp = IMX_GPIO_NR(1, 6)
-	}
-};
-#endif /* CONFIG_SYS_I2C */
-
 static iomux_v3_cfg_t const uart1_pads[] = {
 	MX6_PAD_CSI0_DAT10__UART1_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
 	MX6_PAD_CSI0_DAT11__UART1_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
@@ -426,11 +374,6 @@ int board_init(void)
 #ifdef CONFIG_VIDEO_IPUV3
 	setup_display();
 #endif
-#ifdef CONFIG_SYS_I2C
-	setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info0);
-	setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
-	setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
-#endif
 #ifdef CONFIG_DWC_AHSATA
 	setup_sata();
 #endif
configs/tbs2910_defconfig +5 -1
index 395275c6dd..153f61d09d 100644
@@ -28,7 +28,6 @@ CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_CACHE=y
-CONFIG_CMD_DATE=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_EXT2=y
 CONFIG_CMD_EXT4=y
@@ -43,6 +42,8 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
 CONFIG_DM_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MXC=y
 CONFIG_DM_KEYBOARD=y
 CONFIG_FSL_ESDHC=y
 CONFIG_PHYLIB=y
@@ -50,6 +51,8 @@ CONFIG_MII=y
 CONFIG_PCI=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_RTC=y
+CONFIG_RTC_DS1307=y
 CONFIG_DM_THERMAL=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
@@ -62,5 +65,6 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525
 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_I2C_EDID=y
 CONFIG_VIDEO=y
 # CONFIG_EFI_LOADER is not set
include/configs/tbs2910.h +0 -17
index 93f75d72f3..eff93eff4f 100644
@@ -97,23 +97,6 @@
 #endif /* CONFIG_USB_KEYBOARD */
 #endif /* CONFIG_CMD_USB      */
 
-/* RTC */
-#ifdef CONFIG_CMD_DATE
-#define CONFIG_RTC_DS1307
-#define CONFIG_SYS_RTC_BUS_NUM		2
-#endif
-
-/* I2C */
-#ifdef CONFIG_CMD_I2C
-#define CONFIG_SYS_I2C
-#define CONFIG_SYS_I2C_MXC
-#define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
-#define CONFIG_SYS_I2C_MXC_I2C2		/* enable I2C bus 2 */
-#define CONFIG_SYS_I2C_MXC_I2C3		/* enable I2C bus 3 */
-#define CONFIG_SYS_I2C_SPEED		100000
-#define CONFIG_I2C_EDID
-#endif
-
 /* Environment organization */
 #define CONFIG_SYS_MMC_ENV_DEV		2 /* overwritten on SD boot */
 #define CONFIG_SYS_MMC_ENV_PART		1 /* overwritten on SD boot */

--
2.17.1

#13 lore raw

PATCH 6/10 board: tbs2910: Convert i2c and rtc to driver model

Quoted 2 lines

So we don't need to duplicate settings from the device tree in the board file.

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
=====================================================================
#14 lore raw

PATCH 7/10 ata: dwc_ahsata: Fix sector reports for large disks

In reply to Soeren Moch

Do not report negative sector numbers for disks > 1TB, do not limit sector numbers to 32 bit if CONFIG_SYS_64BIT_LBA is enabled.

---
Cc: Stefano Babic <[email protected]>
Cc: u-boot at lists.denx.de

---
 drivers/ata/dwc_ahsata.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/ata/dwc_ahsata.c +3 -11
index 4c5b98482f..6fe5641dd9 100644
@@ -511,15 +511,9 @@ static int ahci_port_start(struct ahci_uc_priv *uc_priv, u8 port)
 static void dwc_ahsata_print_info(struct blk_desc *pdev)
 {
 	printf("SATA Device Info:\n\r");
-#ifdef CONFIG_SYS_64BIT_LBA
 	printf("S/N: %s\n\rProduct model number: %s\n\r"
-		"Firmware version: %s\n\rCapacity: %lld sectors\n\r",
+		"Firmware version: %s\n\rCapacity: " LBAFU " sectors\n\r",
 		pdev->product, pdev->vendor, pdev->revision, pdev->lba);
-#else
-	printf("S/N: %s\n\rProduct model number: %s\n\r"
-		"Firmware version: %s\n\rCapacity: %ld sectors\n\r",
-		pdev->product, pdev->vendor, pdev->revision, pdev->lba);
-#endif
 }
 
 static void dwc_ahsata_identify(struct ahci_uc_priv *uc_priv, u16 *id)
@@ -754,7 +748,6 @@ static int dwc_ahsata_scan_common(struct ahci_uc_priv *uc_priv,
 	u8 serial[ATA_ID_SERNO_LEN + 1] = { 0 };
 	u8 firmware[ATA_ID_FW_REV_LEN + 1] = { 0 };
 	u8 product[ATA_ID_PROD_LEN + 1] = { 0 };
-	u64 n_sectors;
 	u8 port = uc_priv->hard_port_no;
 	ALLOC_CACHE_ALIGN_BUFFER(u16, id, ATA_ID_WORDS);
 
@@ -773,9 +766,8 @@ static int dwc_ahsata_scan_common(struct ahci_uc_priv *uc_priv,
 	ata_id_c_string(id, product, ATA_ID_PROD, sizeof(product));
 	memcpy(pdev->vendor, product, sizeof(product));
 
-	/* Totoal sectors */
-	n_sectors = ata_id_n_sectors(id);
-	pdev->lba = (u32)n_sectors;
+	/* Total sectors */
+	pdev->lba = ata_id_n_sectors(id);
 
 	pdev->type = DEV_TYPE_HARDDISK;
 	pdev->blksz = ATA_SECT_SIZE;

--
2.17.1

#15 lore raw

PATCH 7/10 ata: dwc_ahsata: Fix sector reports for large disks

Quoted 3 lines

Do not report negative sector numbers for disks > 1TB, do not limit sector numbers to 32 bit if CONFIG_SYS_64BIT_LBA is enabled.

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
=====================================================================
#16 lore raw

PATCH 8/10 ata: dwc_ahsata: Add ahci driver model support

In reply to Soeren Moch

Disable this support for cm_fx6 to avoid breakage.

---
It would be easy to add weak board_ahci_enable/disable functions which can be overwritten (e.g. in the cm_fx6 board file) to handle power enable/ disable on driver probe/remove. But I have no idea why this board needs these repeated probe/remove calls for the same sata device. In my tests on a tbs2910 board a sata harddisk is always recognized by a 'sata init' command, also without this probe loop.
If this can be ironed out, we can remove the DWC_AHSATA_AHCI config option.

Cc Nikita Kiryanov <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Simon Glass <[email protected]>
Cc u-boot at lists.denx.de
---
 configs/cm_fx6_defconfig |  1 +
 drivers/ata/Kconfig      |  8 ++++++++
 drivers/ata/dwc_ahsata.c | 24 ++++++++++++++++++++++++
 3 files changed, 33 insertions(+)
configs/cm_fx6_defconfig +1 -0
index c8d1e83111..1623357132 100644
@@ -51,6 +51,7 @@ CONFIG_DEFAULT_DEVICE_TREE="imx6q-cm-fx6"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DWC_AHSATA=y
+# CONFIG_DWC_AHSATA_AHCI is not set
 CONFIG_DM_KEYBOARD=y
 CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
drivers/ata/Kconfig +8 -0
index 49a056e941..d7818c2d68 100644
@@ -66,6 +66,14 @@ config DWC_AHSATA
 	  Enable this driver to support the DWC AHSATA SATA controller found
 	  in i.MX5 and i.MX6 SoCs.
 
+config DWC_AHSATA_AHCI
+	bool "Enable DWC AHSATA AHCI driver support"
+	depends on DWC_AHSATA
+	depends on AHCI
+	default y
+	help
+	  Enable this option unless you need your private ahci implementation
+
 config FSL_SATA
 	bool "Enable Freescale SATA controller driver support"
 	select LIBATA
drivers/ata/dwc_ahsata.c +24 -0
index 6fe5641dd9..afced8e7e3 100644
@@ -16,6 +16,7 @@
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/mach-imx/sata.h>
 #include <linux/bitops.h>
 #include <linux/ctype.h>
 #include <linux/errno.h>
@@ -1020,6 +1021,9 @@ int dwc_ahsata_probe(struct udevice *dev)
 	struct ahci_uc_priv *uc_priv = dev_get_uclass_priv(dev);
 	int ret;
 
+#if defined(CONFIG_MX6)
+	setup_sata();
+#endif
 	uc_priv->host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
 			ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | ATA_FLAG_NO_ATAPI;
 	uc_priv->mmio_base = (void __iomem *)dev_read_addr(dev);
@@ -1067,4 +1071,24 @@ U_BOOT_DRIVER(dwc_ahsata_blk) = {
 	.ops		= &dwc_ahsata_blk_ops,
 };
 
+#if CONFIG_IS_ENABLED(DWC_AHSATA_AHCI)
+struct ahci_ops dwc_ahsata_ahci_ops = {
+	.port_status = dwc_ahsata_port_status,
+	.reset       = dwc_ahsata_bus_reset,
+	.scan        = dwc_ahsata_scan,
+};
+
+static const struct udevice_id dwc_ahsata_ahci_ids[] = {
+	{ .compatible = "fsl,imx6q-ahci" },
+	{ }
+};
+
+U_BOOT_DRIVER(dwc_ahsata_ahci) = {
+	.name     = "dwc_ahsata_ahci",
+	.id       = UCLASS_AHCI,
+	.of_match = dwc_ahsata_ahci_ids,
+	.ops      = &dwc_ahsata_ahci_ops,
+	.probe    = dwc_ahsata_probe,
+};
+#endif
 #endif

--
2.17.1

#17 lore raw

PATCH 8/10 ata: dwc_ahsata: Add ahci driver model support

Quoted 12 lines · Soeren Moch

Disable this support for cm_fx6 to avoid breakage.

---
It would be easy to add weak board_ahci_enable/disable functions which can be overwritten (e.g. in the cm_fx6 board file) to handle power enable/ disable on driver probe/remove. But I have no idea why this board needs these repeated probe/remove calls for the same sata device. In my tests on a tbs2910 board a sata harddisk is always recognized by a 'sata init' command, also without this probe loop.
If this can be ironed out, we can remove the DWC_AHSATA_AHCI config option.

Quoted 8 lines
Cc Nikita Kiryanov <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Simon Glass <[email protected]>
Cc u-boot at lists.denx.de

---

After rebasing this patch series from v2019.04-rc2 to -rc3, I get this:

Matrix U-Boot> sata init

AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl SATA mode

flags: ncq stag pm led clo only pmp pio slum part

Can not start port 0

data abort

pc : [<8ffab37c>]          lr : [<8ffab595>]

reloc pc : [<1781837c>] lr : [<17818595>]

sp : 87f909c8 ip : 87f90cd4 fp : 00000004

r10: 6c41202e r9 : 87f90ea0 r8 : 00000000

r7 : 87f90a80 r6 : 00000200 r5 : 00000000 r4 : 87f90a80

r3 : 00000070 r2 : 87f90cc0 r1 : 87f90cc0 r0 : 00000000

Flags: nzcv IRQs off FIQs off Mode SVC_32

Code: fb03231c f8d3030b 9001a00c 9e0c4611 (3038f8da)

Resetting CPU ...

Any idea what got broken here?

Thanks,
Soeren

#18 lore raw

PATCH 8/10 ata: dwc_ahsata: Add ahci driver model support

Quoted 45 lines · Soeren Moch
Quoted 12 lines · Soeren Moch

Disable this support for cm_fx6 to avoid breakage.

---
It would be easy to add weak board_ahci_enable/disable functions which can be overwritten (e.g. in the cm_fx6 board file) to handle power enable/ disable on driver probe/remove. But I have no idea why this board needs these repeated probe/remove calls for the same sata device. In my tests on a tbs2910 board a sata harddisk is always recognized by a 'sata init' command, also without this probe loop.
If this can be ironed out, we can remove the DWC_AHSATA_AHCI config option.

Quoted 8 lines
Cc Nikita Kiryanov <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Marcel Ziswiler <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Simon Glass <[email protected]>
Cc u-boot at lists.denx.de

---

After rebasing this patch series from v2019.04-rc2 to -rc3, I get this:

Matrix U-Boot> sata init

AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl SATA mode

flags: ncq stag pm led clo only pmp pio slum part

Can not start port 0

data abort

pc : [<8ffab37c>]          lr : [<8ffab595>]

reloc pc : [<1781837c>] lr : [<17818595>]

sp : 87f909c8 ip : 87f90cd4 fp : 00000004

r10: 6c41202e r9 : 87f90ea0 r8 : 00000000

r7 : 87f90a80 r6 : 00000200 r5 : 00000000 r4 : 87f90a80

r3 : 00000070 r2 : 87f90cc0 r1 : 87f90cc0 r0 : 00000000

Quoted 8 lines

Flags: nzcv IRQs off FIQs off Mode SVC_32

Code: fb03231c f8d3030b 9001a00c 9e0c4611 (3038f8da)

Resetting CPU ...

Any idea what got broken here?

This was caused by a bad power supply.
So this patch series still works fine on top of v2019.04-rc3.

Sorry for the noise,
Soeren

#19 lore raw

PATCH 8/10 ata: dwc_ahsata: Add ahci driver model support

In reply to Soeren Moch
Quoted 2 lines

Disable this support for cm_fx6 to avoid breakage.

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
=====================================================================
#20 lore raw

PATCH 9/10 board: tbs2910: Convert sata to ahci driver model

In reply to Soeren Moch

While at it, also configure 64-bit LBA support.

---
Cc: Stefano Babic <[email protected]>
Cc: Nikita Kiryanov <[email protected]>
Cc: Marcel Ziswiler <[email protected]>
Cc: u-boot at lists.denx.de

---
 board/tbs/tbs2910/tbs2910.c | 4 ----
 configs/tbs2910_defconfig   | 1 +
 include/configs/tbs2910.h   | 1 +
 3 files changed, 2 insertions(+), 4 deletions(-)
board/tbs/tbs2910/tbs2910.c +0 -4
index 2445efbde2..84c813e29f 100644
@@ -10,7 +10,6 @@
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
-#include <asm/mach-imx/sata.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/video.h>
 #include <mmc.h>
@@ -374,9 +373,6 @@ int board_init(void)
 #ifdef CONFIG_VIDEO_IPUV3
 	setup_display();
 #endif
-#ifdef CONFIG_DWC_AHSATA
-	setup_sata();
-#endif
 #ifdef CONFIG_CMD_BMODE
 	add_board_boot_modes(board_boot_modes);
 #endif
configs/tbs2910_defconfig +1 -0
index 153f61d09d..54e34df6aa 100644
@@ -4,6 +4,7 @@ CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
 CONFIG_TARGET_TBS2910=y
 CONFIG_CMD_HDMIDETECT=y
+CONFIG_AHCI=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_BOOTDELAY=3
 CONFIG_PRE_CONSOLE_BUFFER=y
include/configs/tbs2910.h +1 -0
index eff93eff4f..a211b9d611 100644
@@ -77,6 +77,7 @@
 #define CONFIG_DWC_AHSATA_PORT_ID	0
 #define CONFIG_DWC_AHSATA_BASE_ADDR	SATA_ARB_BASE_ADDR
 #define CONFIG_LBA48
+#define CONFIG_SYS_64BIT_LBA
 #endif
 
 /* USB */

--
2.17.1

#21 lore raw

PATCH 9/10 board: tbs2910: Convert sata to ahci driver model

Quoted 2 lines

While at it, also configure 64-bit LBA support.

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
=====================================================================
#22 lore raw

PATCH 10/10 board: tbs2910: Convert mmc to driver model

In reply to Soeren Moch

So we don't need to duplicate settings from the device tree in the board file.

---
Cc: Stefano Babic <[email protected]>
Cc: u-boot at lists.denx.de

---
 board/tbs/tbs2910/tbs2910.c | 108 ------------------------------------
 configs/tbs2910_defconfig   |   1 +
 include/configs/tbs2910.h   |   7 ---
 3 files changed, 1 insertion(+), 115 deletions(-)
board/tbs/tbs2910/tbs2910.c +0 -108
index 84c813e29f..fb0e773afc 100644
@@ -30,10 +30,6 @@ DECLARE_GLOBAL_DATA_PTR;
 	PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm |			\
 	PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
 
-#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP |			\
-	PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm |			\
-	PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
-
 #define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP |			\
 	PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
 
@@ -103,110 +99,6 @@ static void setup_iomux_uart(void)
 }
 
 #ifdef CONFIG_FSL_ESDHC
-static iomux_v3_cfg_t const usdhc2_pads[] = {
-	MX6_PAD_SD2_CLK__SD2_CLK     | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD2_CMD__SD2_CMD     | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD2_DAT0__SD2_DATA0  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD2_DAT1__SD2_DATA1  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD2_DAT2__SD2_DATA2  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD2_DAT3__SD2_DATA3  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_NANDF_D2__GPIO2_IO02 | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
-};
-
-static iomux_v3_cfg_t const usdhc3_pads[] = {
-	MX6_PAD_SD3_CLK__SD3_CLK     | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD3_CMD__SD3_CMD     | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD3_DAT0__SD3_DATA0  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD3_DAT1__SD3_DATA1  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD3_DAT2__SD3_DATA2  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD3_DAT3__SD3_DATA3  | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_NANDF_D0__GPIO2_IO00 | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
-};
-
-static iomux_v3_cfg_t const usdhc4_pads[] = {
-	MX6_PAD_SD4_CLK__SD4_CLK    | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD4_CMD__SD4_CMD    | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD4_DAT0__SD4_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD4_DAT1__SD4_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD4_DAT2__SD4_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD4_DAT3__SD4_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD4_DAT4__SD4_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD4_DAT5__SD4_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD4_DAT6__SD4_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-	MX6_PAD_SD4_DAT7__SD4_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-};
-
-static struct fsl_esdhc_cfg usdhc_cfg[3] = {
-	{USDHC2_BASE_ADDR},
-	{USDHC3_BASE_ADDR},
-	{USDHC4_BASE_ADDR},
-};
-
-#define USDHC2_CD_GPIO	IMX_GPIO_NR(2, 2)
-#define USDHC3_CD_GPIO	IMX_GPIO_NR(2, 0)
-
-int board_mmc_getcd(struct mmc *mmc)
-{
-	struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-	int ret = 0;
-
-	switch (cfg->esdhc_base) {
-	case USDHC2_BASE_ADDR:
-		ret = !gpio_get_value(USDHC2_CD_GPIO);
-		break;
-	case USDHC3_BASE_ADDR:
-		ret = !gpio_get_value(USDHC3_CD_GPIO);
-		break;
-	case USDHC4_BASE_ADDR:
-		ret = 1; /* eMMC/uSDHC4 is always present */
-		break;
-	}
-	return ret;
-}
-
-int board_mmc_init(bd_t *bis)
-{
-	/*
-	 * (U-Boot device node)    (Physical Port)
-	 * mmc0                    SD2
-	 * mmc1                    SD3
-	 * mmc2                    eMMC
-	 */
-	int i, ret;
-	for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
-		switch (i) {
-		case 0:
-			imx_iomux_v3_setup_multiple_pads(
-				usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
-			gpio_request(USDHC2_CD_GPIO, "MMC0_CD");
-			gpio_direction_input(USDHC2_CD_GPIO);
-			usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
-			break;
-		case 1:
-			imx_iomux_v3_setup_multiple_pads(
-				usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
-			gpio_request(USDHC3_CD_GPIO, "MMC1_CD");
-			gpio_direction_input(USDHC3_CD_GPIO);
-			usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
-			break;
-		case 2:
-			imx_iomux_v3_setup_multiple_pads(
-				usdhc4_pads, ARRAY_SIZE(usdhc4_pads));
-			usdhc_cfg[2].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
-			break;
-		default:
-			printf("Warning: you configured more USDHC controllers"
-			       "(%d) then supported by the board (%d)\n",
-			       i + 1, CONFIG_SYS_FSL_USDHC_NUM);
-			return -EINVAL;
-		}
-		ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
-		if (ret)
-			return ret;
-	}
-	return 0;
-}
-
 /* set environment device to boot device when booting from SD */
 int board_mmc_get_env_dev(int devno)
 {
configs/tbs2910_defconfig +1 -0
index 54e34df6aa..4d755c88c3 100644
@@ -46,6 +46,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_DM_KEYBOARD=y
+CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_PHYLIB=y
 CONFIG_MII=y
include/configs/tbs2910.h +0 -7
index a211b9d611..f31cadd951 100644
@@ -40,13 +40,6 @@
 #define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE		UART1_BASE /* select UART1/UART2 */
 
-/* Filesystems / image support */
-
-/* MMC */
-#define CONFIG_SYS_FSL_USDHC_NUM	3
-#define CONFIG_SYS_FSL_ESDHC_ADDR	USDHC4_BASE_ADDR
-#define CONFIG_SUPPORT_EMMC_BOOT
-
 /* Ethernet */
 #define CONFIG_FEC_MXC
 #define CONFIG_FEC_MXC

--
2.17.1

#23 lore raw

PATCH 10/10 board: tbs2910: Convert mmc to driver model

Quoted 2 lines

So we don't need to duplicate settings from the device tree in the board file.

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
=====================================================================