U-Boot PCI driver for mx6sxsabresd
diff mbox series

Message ID CAOyDSmZ00+ZTAyvYa4ZLZHvNzp28vugmy=sKtx9h81K3Atgzkw@mail.gmail.com
State Not Applicable
Delegated to: Stefano Babic
Headers show
Series
  • U-Boot PCI driver for mx6sxsabresd
Related show

Commit Message

Pedro Jardim Jan. 28, 2020, 5:11 p.m. UTC
Hi Marek,
I saw your commit c5773ccdca8a ("pci: imx: Add iMX6SX compatible") and
I've been trying to convert the PCI driver to DM_PCI on a mx6sxsabresd board.

I did the following changes:

--git a/arch/arm/dts/imx6sx-sdb.dtsi b/arch/arm/dts/imx6sx-sdb.dtsi
index da815527a7..f5b0e9ee3f 100644
Which obtained the following output:

=> pci enum
=> pci 0
No such bus
=> pci 1
No such bus

Before the DM conversion. Do you have any suggestions as to why the
PCI device is not detected after the DM_PCI conversion? Are you able
to get i.MX6SX to detect PCI devices when using DM_PCI?

Thank you in advance,
Pedro Jardim.

Comments

Marek Vasut Jan. 28, 2020, 5:14 p.m. UTC | #1
On 1/28/20 6:11 PM, Pedro Jardim wrote:
> Hi Marek,

Hi,

> I saw your commit c5773ccdca8a ("pci: imx: Add iMX6SX compatible") and
> I've been trying to convert the PCI driver to DM_PCI on a mx6sxsabresd board.
> 
> I did the following changes:
> 
> --git a/arch/arm/dts/imx6sx-sdb.dtsi b/arch/arm/dts/imx6sx-sdb.dtsi
> index da815527a7..f5b0e9ee3f 100644
> --- a/arch/arm/dts/imx6sx-sdb.dtsi
> +++ b/arch/arm/dts/imx6sx-sdb.dtsi
> @@ -78,6 +78,17 @@
>                         enable-active-high;
>                 };
> 
> +               reg_pcie_gpio: regulator-pcie-gpio {
> +                               compatible = "regulator-fixed";
> +                               pinctrl-names = "default";
> +                               pinctrl-0 = <&pinctrl_pcie_reg>;
> +                               regulator-name = "MPCIE_3V3";
> +                               regulator-min-microvolt = <3300000>;
> +                               regulator-max-microvolt = <3300000>;
> +                               gpio = <&gpio2 1 GPIO_ACTIVE_HIGH>;
> +                               enable-active-high;
> +                       };
> +
>                 reg_usb_otg2_vbus: regulator@2 {
>                         compatible = "regulator-fixed";
>                         reg = <2>;
> @@ -154,6 +165,14 @@
>         status = "okay";
>  };
> 
> +&pcie {
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&pinctrl_pcie>;
> +       reset-gpio = <&gpio2 0 GPIO_ACTIVE_LOW>;
> +       vpcie-supply = <®_pcie_gpio>;
                          ^
             Is this even a valid DT ?

[...]

> diff --git a/configs/mx6sxsabresd_defconfig b/configs/mx6sxsabresd_defconfig
> index 5150e3a837..6ce7e01b5f 100644
> --- a/configs/mx6sxsabresd_defconfig
> +++ b/configs/mx6sxsabresd_defconfig
> @@ -68,3 +68,4 @@ CONFIG_USB_STORAGE=y
>  CONFIG_USB_HOST_ETHER=y
>  CONFIG_USB_ETHER_ASIX=y
>  CONFIG_VIDEO=y
> +CONFIG_DM_PCI=y

You might need DM regulator somewhere. Take a look at what VINING 2000
does there, the PCI worked on that one.

> diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
> index 55aace1c6e..52aaa82fbc 100644
> --- a/include/configs/mx6sxsabresd.h
> +++ b/include/configs/mx6sxsabresd.h
> @@ -166,12 +166,10 @@
>  #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
>  #endif
> 
> -#ifdef CONFIG_CMD_PCI
>  #define CONFIG_PCI_SCAN_SHOW
>  #define CONFIG_PCIE_IMX
>  #define CONFIG_PCIE_IMX_PERST_GPIO     IMX_GPIO_NR(2, 0)
>  #define CONFIG_PCIE_IMX_POWER_GPIO     IMX_GPIO_NR(2, 1)
> -#endif
> 
>  #define CONFIG_IMX_THERMAL
> 
> Which obtained the following output:
> 
> => pci enum
> => pci 0
> No such bus
> => pci 1
> No such bus
> 
> Before the DM conversion. Do you have any suggestions as to why the
> PCI device is not detected after the DM_PCI conversion? Are you able
> to get i.MX6SX to detect PCI devices when using DM_PCI?

Yep, see above.
Marek Vasut Jan. 29, 2020, 3:12 p.m. UTC | #2
On 1/29/20 2:22 PM, Pedro Jardim wrote:
> Hi Marek,

Hi,

please don't top-post and keep the U-Boot ML on CC.

> I've made some changes based on VINING 2000 trying to add the DM
> regulator but it was not successful.
> The changes that I made were:
> 
> diff --git a/arch/arm/dts/imx6sx-sdb.dtsi b/arch/arm/dts/imx6sx-sdb.dtsi
> index da815527a7..86d56fb332 100644
> --- a/arch/arm/dts/imx6sx-sdb.dtsi
> +++ b/arch/arm/dts/imx6sx-sdb.dtsi
> @@ -78,6 +78,17 @@
>                         enable-active-high;
>                 };
> 
> +               reg_pcie_gpio: regulator-pcie-gpio {
> +                               compatible = "regulator-fixed";
> +                               pinctrl-names = "default";
> +                               pinctrl-0 = <&pinctrl_pcie_reg>;
> +                               regulator-name = "MPCIE_3V3";
> +                               regulator-min-microvolt = <3300000>;
> +                               regulator-max-microvolt = <3300000>;
> +                               gpio = <&gpio2 1 GPIO_ACTIVE_HIGH>;
> +                               enable-active-high;
> +                       };
> +
>                 reg_usb_otg2_vbus: regulator@2 {
>                         compatible = "regulator-fixed";
>                         reg = <2>;
> @@ -154,6 +165,14 @@
>         status = "okay";
>  };
> 
> +&pcie {
> +       vbus-supply = <&reg_pcie_gpio>;
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&pinctrl_pcie>;
> +       reset-gpio = <&gpio4 6 GPIO_ACTIVE_HIGH>;
> +       status = "okay";
> +};
> +
>  &fec1 {
>         pinctrl-names = "default";
>         pinctrl-0 = <&pinctrl_enet1>;
> @@ -191,6 +210,10 @@
>         status = "okay";
>  };
> 
> +&reg_pcie {
> +       regulator-always-on;
> +};
> +
>  &i2c4 {
>         clock-frequency = <100000>;
>         pinctrl-names = "default";
> @@ -453,6 +476,18 @@
>                         >;
>                 };
> 
> +               pinctrl_pcie: pciegrp {
> +                       fsl,pins = <
> +                               MX6SX_PAD_ENET1_COL__GPIO2_IO_0 0x10b0
> +                       >;
> +               };
> +
> +               pinctrl_pcie_reg: pciereggrp {
> +                       fsl,pins = <
> +                               MX6SX_PAD_ENET1_CRS__GPIO2_IO_1 0x10b0
> +                       >;
> +               };
> +
>                 pinctrl_peri_3v3: peri3v3grp {
>                         fsl,pins = <
>                                 MX6SX_PAD_QSPI1A_DATA0__GPIO4_IO_16
>  0x80000000
> diff --git a/configs/mx6sxsabresd_defconfig b/configs/mx6sxsabresd_defconfig
> index 5150e3a837..10dc3db726 100644
> --- a/configs/mx6sxsabresd_defconfig
> +++ b/configs/mx6sxsabresd_defconfig
> @@ -68,3 +68,6 @@ CONFIG_USB_STORAGE=y
>  CONFIG_USB_HOST_ETHER=y
>  CONFIG_USB_ETHER_ASIX=y
>  CONFIG_VIDEO=y
> +CONFIG_DM_PCI=y
> +CONFIG_DM_REGULATOR_FIXED=y
> +CONFIG_PCIE_IMX_POWER_GPIO=y
> +CONFIG_PCIE_IMX_PERST_GPIO=y
> diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
> index 55aace1c6e..52aaa82fbc 100644
> --- a/include/configs/mx6sxsabresd.h
> +++ b/include/configs/mx6sxsabresd.h
> @@ -166,12 +166,10 @@
>  #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
>  #endif
> 
> -#ifdef CONFIG_CMD_PCI
>  #define CONFIG_PCI_SCAN_SHOW
>  #define CONFIG_PCIE_IMX
>  #define CONFIG_PCIE_IMX_PERST_GPIO     IMX_GPIO_NR(2, 0)
>  #define CONFIG_PCIE_IMX_POWER_GPIO     IMX_GPIO_NR(2, 1)
> -#endif
> 
>  #define CONFIG_IMX_THERMAL
> 
> And inside the board I obtained just the PCI 0 output, seen above:
> =>   pci enum
> PCI: Failed autoconfig bar 10
> PCI: Failed autoconfig bar 10
> => pci 1
> Scanning PCI devices on bus 1
> BusDevFun  VendorId   DeviceId   Device Class       Sub-Class
> _____________________________________________________________
> => pci 0
> Scanning PCI devices on bus 0
> BusDevFun  VendorId   DeviceId   Device Class       Sub-Class
> _____________________________________________________________
> 00.00.00   0x16c3     0xabcd     Bridge device           0x04
> 00.01.00   0x16c3     0xabcd     Bridge device           0x04
> 
> Do you have any suggestions to why it isn't recognizing the pci 1 bus?

Maybe you need to power up your PCI device or release it from reset?

> 
> Thanks!
> Pedro Jardim
> 
> Em ter., 28 de jan. de 2020 às 14:14, Marek Vasut <marex@denx.de> escreveu:
>>
>> On 1/28/20 6:11 PM, Pedro Jardim wrote:
>>> Hi Marek,
>>
>> Hi,
>>
>>> I saw your commit c5773ccdca8a ("pci: imx: Add iMX6SX compatible") and
>>> I've been trying to convert the PCI driver to DM_PCI on a mx6sxsabresd board.
>>>
>>> I did the following changes:
>>>
>>> --git a/arch/arm/dts/imx6sx-sdb.dtsi b/arch/arm/dts/imx6sx-sdb.dtsi
>>> index da815527a7..f5b0e9ee3f 100644
>>> --- a/arch/arm/dts/imx6sx-sdb.dtsi
>>> +++ b/arch/arm/dts/imx6sx-sdb.dtsi
>>> @@ -78,6 +78,17 @@
>>>                         enable-active-high;
>>>                 };
>>>
>>> +               reg_pcie_gpio: regulator-pcie-gpio {
>>> +                               compatible = "regulator-fixed";
>>> +                               pinctrl-names = "default";
>>> +                               pinctrl-0 = <&pinctrl_pcie_reg>;
>>> +                               regulator-name = "MPCIE_3V3";
>>> +                               regulator-min-microvolt = <3300000>;
>>> +                               regulator-max-microvolt = <3300000>;
>>> +                               gpio = <&gpio2 1 GPIO_ACTIVE_HIGH>;
>>> +                               enable-active-high;
>>> +                       };
>>> +
>>>                 reg_usb_otg2_vbus: regulator@2 {
>>>                         compatible = "regulator-fixed";
>>>                         reg = <2>;
>>> @@ -154,6 +165,14 @@
>>>         status = "okay";
>>>  };
>>>
>>> +&pcie {
>>> +       pinctrl-names = "default";
>>> +       pinctrl-0 = <&pinctrl_pcie>;
>>> +       reset-gpio = <&gpio2 0 GPIO_ACTIVE_LOW>;
>>> +       vpcie-supply = <®_pcie_gpio>;
>>                           ^
>>              Is this even a valid DT ?
>>
>> [...]
>>
>>> diff --git a/configs/mx6sxsabresd_defconfig b/configs/mx6sxsabresd_defconfig
>>> index 5150e3a837..6ce7e01b5f 100644
>>> --- a/configs/mx6sxsabresd_defconfig
>>> +++ b/configs/mx6sxsabresd_defconfig
>>> @@ -68,3 +68,4 @@ CONFIG_USB_STORAGE=y
>>>  CONFIG_USB_HOST_ETHER=y
>>>  CONFIG_USB_ETHER_ASIX=y
>>>  CONFIG_VIDEO=y
>>> +CONFIG_DM_PCI=y
>>
>> You might need DM regulator somewhere. Take a look at what VINING 2000
>> does there, the PCI worked on that one.
>>
>>> diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
>>> index 55aace1c6e..52aaa82fbc 100644
>>> --- a/include/configs/mx6sxsabresd.h
>>> +++ b/include/configs/mx6sxsabresd.h
>>> @@ -166,12 +166,10 @@
>>>  #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
>>>  #endif
>>>
>>> -#ifdef CONFIG_CMD_PCI
>>>  #define CONFIG_PCI_SCAN_SHOW
>>>  #define CONFIG_PCIE_IMX
>>>  #define CONFIG_PCIE_IMX_PERST_GPIO     IMX_GPIO_NR(2, 0)
>>>  #define CONFIG_PCIE_IMX_POWER_GPIO     IMX_GPIO_NR(2, 1)
>>> -#endif
>>>
>>>  #define CONFIG_IMX_THERMAL
>>>
>>> Which obtained the following output:
>>>
>>> => pci enum
>>> => pci 0
>>> No such bus
>>> => pci 1
>>> No such bus
>>>
>>> Before the DM conversion. Do you have any suggestions as to why the
>>> PCI device is not detected after the DM_PCI conversion? Are you able
>>> to get i.MX6SX to detect PCI devices when using DM_PCI?
>>
>> Yep, see above.
>>
>> --
>> Best regards,
>> Marek Vasut
Fabio Estevam Jan. 29, 2020, 11:48 p.m. UTC | #3
Hi Marek,

On Wed, Jan 29, 2020 at 7:03 PM Marek Vasut <marex@denx.de> wrote:

> > Do you have any suggestions to why it isn't recognizing the pci 1 bus?
>
> Maybe you need to power up your PCI device or release it from reset?

I think I understand what is going on with regards to PCI on the
mx6sxsabresd board.

I have sent Pedro some patches for him to try.

Thanks for your help!
Marek Vasut Jan. 29, 2020, 11:54 p.m. UTC | #4
On 1/30/20 12:48 AM, Fabio Estevam wrote:
> Hi Marek,

Hello Fabio,

> On Wed, Jan 29, 2020 at 7:03 PM Marek Vasut <marex@denx.de> wrote:
> 
>>> Do you have any suggestions to why it isn't recognizing the pci 1 bus?
>>
>> Maybe you need to power up your PCI device or release it from reset?
> 
> I think I understand what is going on with regards to PCI on the
> mx6sxsabresd board.
> 
> I have sent Pedro some patches for him to try.
> 
> Thanks for your help!

OK, sure, you're welcome.
Fabio Estevam Jan. 30, 2020, 1:15 p.m. UTC | #5
Hi Marek,

On Wed, Jan 29, 2020 at 8:48 PM Fabio Estevam <festevam@gmail.com> wrote:

> I think I understand what is going on with regards to PCI on the
> mx6sxsabresd board.
>
> I have sent Pedro some patches for him to try.

Pedro confirmed that the Wifi card can be detected now with these
patches applied.

Just submitted the patches to the list.

Upgrading to a 5.4.16 imx6sx.dtsi fixed the issue and the reason is
the following hunk:

- reg = <0x08ffc000 0x4000>; /* DBI */
+ reg = <0x08ffc000 0x04000>, <0x08f00000 0x80000>;

The old imx6sx.dtsi only had the dbi entry and no cfg.

The version in mainline has the cfg entry, which is needed for the imx
PCI U-Boot DM driver.

Thanks

Patch
diff mbox series

--- a/arch/arm/dts/imx6sx-sdb.dtsi
+++ b/arch/arm/dts/imx6sx-sdb.dtsi
@@ -78,6 +78,17 @@ 
                        enable-active-high;
                };

+               reg_pcie_gpio: regulator-pcie-gpio {
+                               compatible = "regulator-fixed";
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_pcie_reg>;
+                               regulator-name = "MPCIE_3V3";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               gpio = <&gpio2 1 GPIO_ACTIVE_HIGH>;
+                               enable-active-high;
+                       };
+
                reg_usb_otg2_vbus: regulator@2 {
                        compatible = "regulator-fixed";
                        reg = <2>;
@@ -154,6 +165,14 @@ 
        status = "okay";
 };

+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio2 0 GPIO_ACTIVE_LOW>;
+       vpcie-supply = <®_pcie_gpio>;
+       status = "okay";
+};
+
 &fec1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet1>;
@@ -453,6 +472,18 @@ 
                        >;
                };

+               pinctrl_pcie: pciegrp {
+                       fsl,pins = <
+                               MX6SX_PAD_ENET1_COL__GPIO2_IO_0 0x10b0
+                       >;
+               };
+
+               pinctrl_pcie_reg: pciereggrp {
+                       fsl,pins = <
+                               MX6SX_PAD_ENET1_CRS__GPIO2_IO_1 0x10b0
+                       >;
+               };
+
                pinctrl_peri_3v3: peri3v3grp {
                        fsl,pins = <
                                MX6SX_PAD_QSPI1A_DATA0__GPIO4_IO_16
 0x80000000
diff --git a/configs/mx6sxsabresd_defconfig b/configs/mx6sxsabresd_defconfig
index 5150e3a837..6ce7e01b5f 100644
--- a/configs/mx6sxsabresd_defconfig
+++ b/configs/mx6sxsabresd_defconfig
@@ -68,3 +68,4 @@  CONFIG_USB_STORAGE=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
 CONFIG_VIDEO=y
+CONFIG_DM_PCI=y
diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
index 55aace1c6e..52aaa82fbc 100644
--- a/include/configs/mx6sxsabresd.h
+++ b/include/configs/mx6sxsabresd.h
@@ -166,12 +166,10 @@ 
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
 #endif

-#ifdef CONFIG_CMD_PCI
 #define CONFIG_PCI_SCAN_SHOW
 #define CONFIG_PCIE_IMX
 #define CONFIG_PCIE_IMX_PERST_GPIO     IMX_GPIO_NR(2, 0)
 #define CONFIG_PCIE_IMX_POWER_GPIO     IMX_GPIO_NR(2, 1)
-#endif

 #define CONFIG_IMX_THERMAL