Skip to contentSkip to conversation

imx6ul: convert to enable pinctrl/DM POWER

PATCH Superseded Peng Fan 2 participants 6 messages Mar 9, 2016 – Mar 10, 2016

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

cover imx6ul: convert to enable pinctrl/DM POWER

This patch set is to covert to enable pinctrl driver and DM_PMIC and DM_REGULATOR for imx6ul 14x14/9x9 evk board.

This patch set is only to add device tree for i.MX6UL and is just initial step to convert to support device tree for i.MX6/7, I just have an idea to discard the pinmux settings in board file and let pinctrl driver to handle these for different drivers.

I am not very sure whether we need a full device tree here, since we do not support so many devices as linux kernel.

Any comments on this? There maybe some work need to be done to support this.

To the i2c part, the pinmux settings are still needed in board file, because there are some dependency in arch/arm/imx-common/i2c-mxv7.c. In future, we may need to refine this to totally let i2c driver handle this.

Peng Fan (3):
imx: imx6ul: Introduce device tree files
imx: mx6ul_evk: default enable device tree support
imx: mx6ul_evk: convert to use Driver model for power and i2c

 arch/arm/dts/Makefile                             |    4 +
 arch/arm/dts/imx6ul-14x14-evk.dts                 |  693 ++++++++++++
 arch/arm/dts/imx6ul-9x9-evk.dts                   |  790 ++++++++++++++
 arch/arm/dts/imx6ul-pinfunc.h                     |  938 +++++++++++++++++
 arch/arm/dts/imx6ul.dtsi                          | 1158 +++++++++++++++++++++
 board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c |   38 +-
 configs/mx6ul_14x14_evk_defconfig                 |   16 +-
 configs/mx6ul_9x9_evk_defconfig                   |   23 +-
 include/configs/mx6ul_14x14_evk.h                 |   11 +-
 include/dt-bindings/clock/imx6ul-clock.h          |  240 +++++
 10 files changed, 3868 insertions(+), 43 deletions(-)
 create mode 100644 arch/arm/dts/imx6ul-14x14-evk.dts
 create mode 100644 arch/arm/dts/imx6ul-9x9-evk.dts
 create mode 100644 arch/arm/dts/imx6ul-pinfunc.h
 create mode 100644 arch/arm/dts/imx6ul.dtsi
 create mode 100644 include/dt-bindings/clock/imx6ul-clock.h
Signature · 1 line
2.6.2
author
#1 lore raw

PATCH 1/3 imx: imx6ul: Introduce device tree files

Introduce device tree files for i.MX 6UltraLite
14X14/9x9 EVK board.

Since in linux kernel upsteam master branch, some device tree nodes are not upstreamed, so files are got from nxp vendor tree.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
---
 arch/arm/dts/Makefile                    |    4 +
 arch/arm/dts/imx6ul-14x14-evk.dts        |  693 ++++++++++++++++++
 arch/arm/dts/imx6ul-9x9-evk.dts          |  790 ++++++++++++++++++++
 arch/arm/dts/imx6ul-pinfunc.h            |  938 ++++++++++++++++++++++++
 arch/arm/dts/imx6ul.dtsi                 | 1158 ++++++++++++++++++++++++++++++
 include/dt-bindings/clock/imx6ul-clock.h |  240 +++++++
 6 files changed, 3823 insertions(+)
 create mode 100644 arch/arm/dts/imx6ul-14x14-evk.dts
 create mode 100644 arch/arm/dts/imx6ul-9x9-evk.dts
 create mode 100644 arch/arm/dts/imx6ul-pinfunc.h
 create mode 100644 arch/arm/dts/imx6ul.dtsi
 create mode 100644 include/dt-bindings/clock/imx6ul-clock.h
arch/arm/dts/Makefile +4 -0
index 578038b..1427f66 100644
@@ -56,6 +56,10 @@ dtb-$(CONFIG_ARCH_MVEBU) +=			\
 	armada-xp-synology-ds414.dtb		\
 	armada-xp-theadorable.dtb
 
+dtb-$(CONFIG_ARCH_MX6) +=			\
+	imx6ul-9x9-evk.dtb			\
+	imx6ul-14x14-evk.dtb
+
 dtb-$(CONFIG_ARCH_UNIPHIER) += \
 	uniphier-ph1-ld4-ref.dtb \
 	uniphier-ph1-ld6b-ref.dtb \
arch/arm/dts/imx6ul-14x14-evk.dts new file +693 -0

693 lines not on this page · raw message

arch/arm/dts/imx6ul-9x9-evk.dts new file +790 -0

790 lines not on this page · raw message

arch/arm/dts/imx6ul-pinfunc.h new file +938 -0

938 lines not on this page · raw message

arch/arm/dts/imx6ul.dtsi new file +1158 -0

569 lines not on this page · raw message

include/dt-bindings/clock/imx6ul-clock.h new file +240 -0

240 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.6.2

Part of the diff is not shown here. View the raw message.

author
#2 lore raw

PATCH 2/3 imx: mx6ul_evk: default enable device tree support

In reply to Peng Fan

Default enable device tree for mx6ul_14x14_evk and mx6ul_9x9_evk board. And sort the defconfig file to be in alphabet order.

Enable pinctrl driver for the two boards.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
---
 configs/mx6ul_14x14_evk_defconfig | 15 ++++++++++-----
 configs/mx6ul_9x9_evk_defconfig   | 15 ++++++++++-----
 2 files changed, 20 insertions(+), 10 deletions(-)
configs/mx6ul_14x14_evk_defconfig +10 -5
index 835285f..a756de7 100644
@@ -1,8 +1,13 @@
-CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
-CONFIG_TARGET_MX6UL_14X14_EVK=y
-CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg"
-CONFIG_CMD_GPIO=y
+CONFIG_ARM=y
 CONFIG_CMD_DHCP=y
+CONFIG_CMD_GPIO=y
 CONFIG_CMD_PING=y
+CONFIG_DEFAULT_DEVICE_TREE="imx6ul-14x14-evk"
+CONFIG_OF_CONTROL=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_FULL=y
+CONFIG_PINCTRL_IMX6=y
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg"
+CONFIG_TARGET_MX6UL_14X14_EVK=y
configs/mx6ul_9x9_evk_defconfig +10 -5
index efbffe3..fed0254 100644
@@ -1,8 +1,13 @@
-CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
-CONFIG_TARGET_MX6UL_9X9_EVK=y
-CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg"
-CONFIG_CMD_GPIO=y
+CONFIG_ARM=y
 CONFIG_CMD_DHCP=y
+CONFIG_CMD_GPIO=y
 CONFIG_CMD_PING=y
+CONFIG_DEFAULT_DEVICE_TREE="imx6ul-9x9-evk"
+CONFIG_OF_CONTROL=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_FULL=y
+CONFIG_PINCTRL_IMX6=y
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg"
+CONFIG_TARGET_MX6UL_9X9_EVK=y
Signature · 1 line
2.6.2
reviewer
#3 lore raw

PATCH 2/3 imx: mx6ul_evk: default enable device tree support

Hi Peng,

Quoted 9 lines · Peng Fan

Default enable device tree for mx6ul_14x14_evk and mx6ul_9x9_evk board. And sort the defconfig file to be in alphabet order.

Enable pinctrl driver for the two boards.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>

Shouldn't board/freescale/mx6ul_14x14_evk/README be updated to take into account the new new method for flashing the image?

author
#4 lore raw

PATCH 2/3 imx: mx6ul_evk: default enable device tree support

Hi Fabio,

Quoted 7 lines · Fabio Estevam

Hi Peng,

Quoted 4 lines · Peng Fan

Default enable device tree for mx6ul_14x14_evk and mx6ul_9x9_evk board. And sort the defconfig file to be in alphabet order.

Quoted 8 lines
Quoted 5 lines

Enable pinctrl driver for the two boards.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>

Shouldn't board/freescale/mx6ul_14x14_evk/README be updated to take into account the new new method for flashing the image?

Will update u-boot.img to u-boot-dtb.img.

Wait for more comments on the patch set and will address this in V3.

Actually I am not very sure whether we need to introduce a full device tree in U-Boot or not. It's too large a file, such as dtsi/clock header/pin header.

I just have an idea to introudce only needed part. Also I do not have plan to implement a DM clk driver for i.MX, since it's not easy to do clk management like linux kernel. If follow kernel, and add all the gates/muxes, it's too complicated a driver, and not easy for us to do bringup work. So I am thinking whether need to discard the clk related property in device tree.

Thanks,
Peng.

author
#5 lore raw

PATCH 3/3 imx: mx6ul_evk: convert to use Driver model for power and i2c

In reply to Peng Fan

Convert to use DM_PMIC/DM_REGULATOR/DM_I2C for mx6ul evk. To mx6ul_14x14_evk, there is no pmic on board, so only enable DM_I2C.

Since we have PINCTRL driver and DM_I2C enabled, we could discard the pinmux setting in board file, but we can not do this, because still some dependency in arch/arm/imx-common/i2c-mxv7.c. Later we may need to find out a way to refine this.

To avoid SPL build warning, disable i2c-mxc driver for SPL part.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
---
 board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c | 38 +++++++++--------------
 configs/mx6ul_14x14_evk_defconfig                 |  1 +
 configs/mx6ul_9x9_evk_defconfig                   |  8 +++++
 include/configs/mx6ul_14x14_evk.h                 | 11 ++-----
 4 files changed, 25 insertions(+), 33 deletions(-)
board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c +14 -24
index 98d5675..62a3e68 100644
@@ -174,45 +174,35 @@ static struct i2c_pads_info i2c_pad_info1 = {
 	},
 };
 
-#ifdef CONFIG_POWER
-#define I2C_PMIC       0
+#ifdef CONFIG_DM_PMIC
 int power_init_board(void)
 {
 	if (is_mx6ul_9x9_evk()) {
-		struct pmic *pfuze;
-		int ret;
-		unsigned int reg, rev_id;
+		struct udevice *dev;
+		int ret, dev_id, rev_id;
 
-		ret = power_pfuze3000_init(I2C_PMIC);
-		if (ret)
+		ret = pmic_get("pfuze3000", &dev);
+		if (ret == -ENODEV)
+			return 0;
+		else if (ret != 0)
 			return ret;
 
-		pfuze = pmic_get("PFUZE3000");
-		ret = pmic_probe(pfuze);
-		if (ret)
-			return ret;
-
-		pmic_reg_read(pfuze, PFUZE3000_DEVICEID, &reg);
-		pmic_reg_read(pfuze, PFUZE3000_REVID, &rev_id);
+		dev_id = pmic_reg_read(dev, PFUZE3000_DEVICEID);
+		rev_id = pmic_reg_read(dev, PFUZE3000_REVID);
 		printf("PMIC: PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n",
-		       reg, rev_id);
+		       dev_id, rev_id);
 
 		/* disable Low Power Mode during standby mode */
-		pmic_reg_read(pfuze, PFUZE3000_LDOGCTL, &reg);
-		reg |= 0x1;
-		pmic_reg_write(pfuze, PFUZE3000_LDOGCTL, reg);
+		pmic_clrsetbits(dev, PFUZE3000_LDOGCTL, 0, 1);
 
 		/* SW1B step ramp up time from 2us to 4us/25mV */
-		reg = 0x40;
-		pmic_reg_write(pfuze, PFUZE3000_SW1BCONF, reg);
+		pmic_reg_write(dev, PFUZE3000_SW1BCONF, 0x40);
 
 		/* SW1B mode to APS/PFM */
-		reg = 0xc;
-		pmic_reg_write(pfuze, PFUZE3000_SW1BMODE, reg);
+		pmic_reg_write(dev, PFUZE3000_SW1BMODE, 0xc);
 
 		/* SW1B standby voltage set to 0.975V */
-		reg = 0xb;
-		pmic_reg_write(pfuze, PFUZE3000_SW1BSTBY, reg);
+		pmic_reg_write(dev, PFUZE3000_SW1BSTBY, 0xb);
 	}
 
 	return 0;
configs/mx6ul_14x14_evk_defconfig +1 -0
index a756de7..b67e0cb 100644
@@ -4,6 +4,7 @@ CONFIG_CMD_DHCP=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_PING=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6ul-14x14-evk"
+CONFIG_DM_I2C=y
 CONFIG_OF_CONTROL=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_FULL=y
configs/mx6ul_9x9_evk_defconfig +8 -0
index fed0254..cebfbdd 100644
@@ -3,7 +3,15 @@ CONFIG_ARM=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_PING=y
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6ul-9x9-evk"
+CONFIG_DM_I2C=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_PFUZE100=y
+CONFIG_ERRNO_STR=y
 CONFIG_OF_CONTROL=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_FULL=y
include/configs/mx6ul_14x14_evk.h +2 -9
index c7e10f9..8a27b26 100644
@@ -50,19 +50,12 @@
 #endif
 
 /* I2C configs */
+#ifndef CONFIG_SPL
 #define CONFIG_CMD_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_SPEED		100000
-
-/* PMIC only for 9X9 EVK */
-#define CONFIG_POWER
-#define CONFIG_POWER_I2C
-#define CONFIG_POWER_PFUZE3000
-#define CONFIG_POWER_PFUZE3000_I2C_ADDR  0x08
+#endif
 #endif
 
 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1
Signature · 1 line
2.6.2