diff mbox series

arm: imx6q_logic: Enable I2C PMIC

Message ID 20200818211957.1962116-1-aford173@gmail.com
State Changes Requested
Delegated to: Stefano Babic
Headers show
Series arm: imx6q_logic: Enable I2C PMIC | expand

Commit Message

Adam Ford Aug. 18, 2020, 9:19 p.m. UTC
The PMIC which powers the whole board is connected to the I2C1
bus.  This patch enables I2C.  With this enabled, the PMIC needs
to told to keep the rail enabled, or it gets shutdown before the
system boots.

Signed-off-by: Adam Ford <aford173@gmail.com>

Comments

Fabio Estevam Aug. 19, 2020, 2:33 a.m. UTC | #1
Hi Adam,

On Tue, Aug 18, 2020 at 6:20 PM Adam Ford <aford173@gmail.com> wrote:
>
> The PMIC which powers the whole board is connected to the I2C1
> bus.  This patch enables I2C.  With this enabled, the PMIC needs
> to told to keep the rail enabled, or it gets shutdown before the

Looks like a typo.

> system boots.
>
> Signed-off-by: Adam Ford <aford173@gmail.com>
>
> diff --git a/arch/arm/dts/imx6q-logicpd-u-boot.dtsi b/arch/arm/dts/imx6q-logicpd-u-boot.dtsi
> index ee44ed91fe..94b53d569d 100644
> --- a/arch/arm/dts/imx6q-logicpd-u-boot.dtsi
> +++ b/arch/arm/dts/imx6q-logicpd-u-boot.dtsi
> @@ -28,3 +28,7 @@
>  &pinctrl_usdhc2 {
>         u-boot,dm-spl;
>  };
> +
> +&sw2_reg {
> +       regulator-always-on;
> +};

It seems that this could be fixed in the main dts instead of the
U-Boot one since this dts description is not U-Boot specific.
Adam Ford Aug. 19, 2020, 12:13 p.m. UTC | #2
On Tue, Aug 18, 2020 at 9:33 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> Hi Adam,
>
> On Tue, Aug 18, 2020 at 6:20 PM Adam Ford <aford173@gmail.com> wrote:
> >
> > The PMIC which powers the whole board is connected to the I2C1
> > bus.  This patch enables I2C.  With this enabled, the PMIC needs
> > to told to keep the rail enabled, or it gets shutdown before the
>
> Looks like a typo.

Oops.

>
> > system boots.
> >
> > Signed-off-by: Adam Ford <aford173@gmail.com>
> >
> > diff --git a/arch/arm/dts/imx6q-logicpd-u-boot.dtsi b/arch/arm/dts/imx6q-logicpd-u-boot.dtsi
> > index ee44ed91fe..94b53d569d 100644
> > --- a/arch/arm/dts/imx6q-logicpd-u-boot.dtsi
> > +++ b/arch/arm/dts/imx6q-logicpd-u-boot.dtsi
> > @@ -28,3 +28,7 @@
> >  &pinctrl_usdhc2 {
> >         u-boot,dm-spl;
> >  };
> > +
> > +&sw2_reg {
> > +       regulator-always-on;
> > +};
>
> It seems that this could be fixed in the main dts instead of the
> U-Boot one since this dts description is not U-Boot specific.

The issue I am seeing is U-Boot specific, because Linux doesn't power
this rail down.  I'd rather not keep this regulator-always-on in
Linux, and I want to keep the devices trees between U-Boot and Linux
the same. In the device tree, I have associated this rail to the SDHC
interface , but for some reason, U-Boot still powers it down, so when
it tries to go and read from the SD card, the system hangs.

If you're ok with this rationale, I can update the commit message to
add some of this background info to V2 when I fix the typo above.

adam
Fabio Estevam Aug. 19, 2020, 7:52 p.m. UTC | #3
Hi Adam,

On Wed, Aug 19, 2020 at 9:13 AM Adam Ford <aford173@gmail.com> wrote:

> The issue I am seeing is U-Boot specific, because Linux doesn't power
> this rail down.  I'd rather not keep this regulator-always-on in
> Linux, and I want to keep the devices trees between U-Boot and Linux

Yes, I also prefer to always keep them in sync.

> the same. In the device tree, I have associated this rail to the SDHC
> interface , but for some reason, U-Boot still powers it down, so when
> it tries to go and read from the SD card, the system hangs.

Interesting. Then this needs to be investigated, otherwise we will
just paper over the real problem without understanding its root cause.

Why is U-Boot powering the regulator down?

The device tree representation of the regulators is agnostic to U-Boot
or kernel, as it just represents the hardware, so I prefer that the
correct regulator description is passed in the main device tree
instead of hacking the specific U-Boot device tree.
diff mbox series

Patch

diff --git a/arch/arm/dts/imx6q-logicpd-u-boot.dtsi b/arch/arm/dts/imx6q-logicpd-u-boot.dtsi
index ee44ed91fe..94b53d569d 100644
--- a/arch/arm/dts/imx6q-logicpd-u-boot.dtsi
+++ b/arch/arm/dts/imx6q-logicpd-u-boot.dtsi
@@ -28,3 +28,7 @@ 
 &pinctrl_usdhc2 {
 	u-boot,dm-spl;
 };
+
+&sw2_reg {
+	regulator-always-on;
+};
diff --git a/configs/imx6q_logic_defconfig b/configs/imx6q_logic_defconfig
index 35dfd8a303..d02c81449c 100644
--- a/configs/imx6q_logic_defconfig
+++ b/configs/imx6q_logic_defconfig
@@ -9,6 +9,7 @@  CONFIG_ENV_SIZE=0x100000
 CONFIG_ENV_OFFSET=0x400000
 CONFIG_MX6_OCRAM_256KB=y
 CONFIG_TARGET_MX6LOGICPD=y
+CONFIG_SYS_I2C_MXC_I2C1=y
 CONFIG_SPL_TEXT_BASE=0x00908000
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
@@ -70,6 +71,7 @@  CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_PCF8575_GPIO=y
+CONFIG_SYS_I2C_MXC=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
 CONFIG_FSL_USDHC=y