U-Boot PCI driver for mx6sxsabresd

Marek Vasut marex at denx.de
Wed Jan 29 16:12:09 CET 2020


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


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list