Enable PCIE controller on iMX95 EVK
Subsystems (5)
cover Enable PCIE controller on iMX95 EVK
The patch set is used to enable PCIE host controller on iMX95 EVK. We need below driver changes:
1. Add iMX95 support to pcie_dw_imx driver.
2. Add iXM95 blkctrl clock driver which is a abstract of clock gate in hsio blkctrl for PCIE.
3. Add vin-supply enablement for fixed regulator, since iMX95 EVK uses two levels regulators in DTS.
4. Fix issue in clk-uclass when assign high clock rate.
log on iMX95 19x19 EVK:
u-boot=> pci
BusDevFun VendorId DeviceId Device Class Sub-Class
_____________________________________________________________
00.00.00 0x1131 0xe101 Network controller 0x00
00.01.00 0x1131 0xe001 Base system peripheral 0x07
01.00.00 0x1131 0xee00 Base system peripheral 0x80
01.01.00 0x1131 0xe001 Base system peripheral 0x07
02.00.00 0x1131 0x0000 Bridge device 0x04
03.00.00 0x1b4b 0x2b43 Network controller 0x00
03.00.01 0x1b4b 0x2b44 Network controller 0x00
PCIE-4: Link downYe Li (8):
pci: dw: Fix wrong register used for PCI_COMMAND
pci: pcie_dw_imx: Add iMX9 support to the driver
clk: imx: Add imx95 blkctrl clock driver
power: regulator: Add vin-supply for GPIO and Fixed regulators
clk: clk-uclass: Fix clk_set_default_rates issue
arm: dts: imx95: Assign HSIOPLL_VCO as HSIOPLL parent clock
arm: dts: imx95-evk: set alias for enetc PCI buses
imx95_evk: Enable PCI host controller on iMX95 19x19 EVK
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi | 7 + arch/arm/dts/imx95-u-boot.dtsi | 16 ++ configs/imx95_19x19_evk_defconfig | 3 + drivers/clk/clk-uclass.c | 2 +- drivers/clk/imx/Kconfig | 9 + drivers/clk/imx/Makefile | 1 + drivers/clk/imx/clk-imx95-blkctrl.c | 170 ++++++++++++ drivers/pci/Kconfig | 2 +- drivers/pci/pcie_dw_common.c | 3 +- drivers/pci/pcie_dw_imx.c | 420 ++++++++++++++++++++++++++--- drivers/power/regulator/regulator_common.c | 10 + drivers/power/regulator/regulator_common.h | 1 + 12 files changed, 596 insertions(+), 48 deletions(-) create mode 100644 drivers/clk/imx/clk-imx95-blkctrl.c
Signature · 1 line
2.7.4
PATCH RESEND 1/8 pci: dw: Fix wrong register used for PCI_COMMAND
Wirting to command register should use PCI_COMMAND not PCI_PRIMARY_BUS
--- drivers/pci/pcie_dw_common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pci/pcie_dw_common.c +1 -2
@@ -7,7 +7,6 @@* * Copyright (C) 2018 Texas Instruments, Inc */ -#include <dm.h> #include <log.h> #include <pci.h>
@@ -385,7 +384,7 @@ void pcie_dw_setup_host(struct pcie_dw *pci) 0xffffff, 0x00ff0100);/* setup command register */ -clrsetbits_le32 (pci->dbi_base +PCI_PRIMARY_BUS , +clrsetbits_le32 (pci->dbi_base +PCI_COMMAND ,0xffff ,PCI_COMMAND_IO |PCI_COMMAND_MEMORY |PCI_COMMAND_MASTER |PCI_COMMAND_SERR );
Signature · 1 line
2.37.1
PATCH RESEND 2/8 pci: pcie_dw_imx: Add iMX9 support to the driver
In reply to Ye LiAdding iMX95/iMX94 support to the dw driver. Follow kernel driver stype to use flags to distinguish the characteristic of different platforms.
--- drivers/pci/Kconfig | 2 +- drivers/pci/pcie_dw_imx.c | 420 ++++++++++++++++++++++++++++++++++---- 2 files changed, 377 insertions(+), 45 deletions(-)
drivers/pci/Kconfig +1 -1
@@ -456,7 +456,7 @@ config PCIE_STARFIVE_JH7110 config PCIE_DW_IMX bool "i.MX DW PCIe controller support" - depends on ARCH_IMX8M + depends on ARCH_IMX8M || ARCH_IMX9 select PCIE_DW_COMMON select DM_REGULATOR select REGMAP
drivers/pci/pcie_dw_imx.c +376 -44
584 lines not on this page · raw message
Signature · 1 line
2.37.1
PATCH RESEND 3/8 clk: imx: Add imx95 blkctrl clock driver
In reply to Ye LiAdd iMX95 blkctrl clock driver which implements clocks for HSIOMIX blkctrl and LVDS blkctrl.
Since multiple blkctrl device for different blkctrl may be enabled, and each has dedicated clock id from 0. We must enable CLK_AUTO_ID to avoid conflict on clock id.
--- drivers/clk/imx/Kconfig | 9 ++ drivers/clk/imx/Makefile | 1 + drivers/clk/imx/clk-imx95-blkctrl.c | 170 ++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 drivers/clk/imx/clk-imx95-blkctrl.c
drivers/clk/imx/Kconfig +9 -0
@@ -167,3 +167,12 @@ config CLK_IMXRT1170 select CLK_CCF help This enables support clock driver for i.MXRT1170 platforms. + +config CLK_IMX95_BLKCTRL + bool "Enable i.MX95 blkctrl clock driver" + depends on IMX95 || IMX94 + select CLK + select CLK_CCF + select CLK_AUTO_ID + help + Enable support for clocks in i.MX95 MIX blkctrl like HSIO and LVDS.
drivers/clk/imx/Makefile +1 -0
@@ -25,3 +25,4 @@ obj-$(CONFIG_$(PHASE_)CLK_IMX93) += clk-imx93.o clk-fracn-gppll.o \ obj-$(CONFIG_$(PHASE_)CLK_IMXRT1020) += clk-imxrt1020.o obj-$(CONFIG_$(PHASE_)CLK_IMXRT1050) += clk-imxrt1050.o obj-$(CONFIG_$(PHASE_)CLK_IMXRT1170) += clk-imxrt1170.o +obj-$(CONFIG_CLK_IMX95_BLKCTRL) += clk-imx95-blkctrl.o
drivers/clk/imx/clk-imx95-blkctrl.c new file +170 -0
170 lines not on this page · raw message
Signature · 1 line
2.37.1
PATCH RESEND 4/8 power: regulator: Add vin-supply for GPIO and Fixed regulators
In reply to Ye LiEnable the vin-supply when probing the regulator device.
--- drivers/power/regulator/regulator_common.c | 10 ++++++++++ drivers/power/regulator/regulator_common.h | 1 + 2 files changed, 11 insertions(+)
drivers/power/regulator/regulator_common.c +10 -0
@@ -45,6 +45,16 @@ int regulator_common_of_to_plat(struct udevice *dev,dev_read_u32_default (dev,"u-boot,off-on-delay-us" ,0 ); } + ret =device_get_supply_regulator (dev,"vin-supply" , &plat->vin_supply); +if (ret) { +debug ("Regulator vin regulator not defined: %d\n" , ret); +if (ret != -ENOENT ) +return ret; + } + +if (plat->vin_supply) +regulator_set_enable_if_allowed (plat->vin_supply, true); +return 0 ; }
drivers/power/regulator/regulator_common.h +1 -0
@@ -14,6 +14,7 @@ struct regulator_common_plat {unsigned int startup_delay_us;unsigned int off_on_delay_us;unsigned int enable_count; +struct udevice *vin_supply; }; int regulator_common_of_to_plat(struct udevice *dev,
Signature · 1 line
2.37.1
PATCH RESEND 5/8 clk: clk-uclass: Fix clk_set_default_rates issue
In reply to Ye Liclk_set_rate returns the actual clock rate, When assigned clock rate is higher than 0x7FFFFFFF, the return value will be recognized as error. Change to IS_ERR_VALUE to check the return value.
--- drivers/clk/clk-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-uclass.c +1 -1
@@ -358,7 +358,7 @@ static int clk_set_default_rates(struct udevice *dev, ret =clk_set_rate (c, rates[index]); -if (ret <0 ) { +if (IS_ERR_VALUE (ret)) {dev_warn (dev,"failed to set rate on clock index %d (%ld) (error = %d)\n" , index, clk.id, ret);
Signature · 1 line
2.37.1
PATCH RESEND 6/8 arm: dts: imx95: Assign HSIOPLL_VCO as HSIOPLL parent clock
In reply to Ye LiWe have to explicitly assign HSIOPLL_VCO as HSIOPLL parent. So when enabling HSIOPLL, its parent HSIOPLL_VCO will be enabled firstly.
--- arch/arm/dts/imx95-u-boot.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm/dts/imx95-u-boot.dtsi +16 -0
@@ -170,6 +170,22 @@ bootph-all; }; +&pcie0 { + assigned-clocks =<&scmi_clk IMX95_CLK_HSIOPLL_VCO>, + <&scmi_clk IMX95_CLK_HSIOPLL>, + <&scmi_clk IMX95_CLK_HSIOPCIEAUX>; + assigned-clock-parents = <0>, <&scmi_clk IMX95_CLK_HSIOPLL_VCO>, + <&scmi_clk IMX95_CLK_SYSPLL1_PFD1_DIV2>; +}; + +&pcie1 { + assigned-clocks =<&scmi_clk IMX95_CLK_HSIOPLL_VCO>, + <&scmi_clk IMX95_CLK_HSIOPLL>, + <&scmi_clk IMX95_CLK_HSIOPCIEAUX>; + assigned-clock-parents = <0>, <&scmi_clk IMX95_CLK_HSIOPLL_VCO>, + <&scmi_clk IMX95_CLK_SYSPLL1_PFD1_DIV2>; +}; + &{/soc} { bootph-all; };
Signature · 1 line
2.37.1
PATCH RESEND 7/8 arm: dts: imx95-evk: set alias for enetc PCI buses
In reply to Ye LiUse fixed seq 0 and 1 for enetc PCI buses, then the seq for PCI controllers could start after them.
--- arch/arm/dts/imx95-19x19-evk-u-boot.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/dts/imx95-19x19-evk-u-boot.dtsi +7 -0
@@ -5,6 +5,13 @@ #include "imx95-u-boot.dtsi" +/ { + aliases { + pci0 = &netc_bus0; + pci1 = &netc_bus1; + }; +}; + &lpuart1 { bootph-pre-ram; };
Signature · 1 line
2.37.1
PATCH RESEND 8/8 imx95_evk: Enable PCI host controller on iMX95 19x19 EVK
In reply to Ye LiEnable DW IMX PCI driver and iMX95 BLKCTRL clock driver in defconfig, so PCI controller can work.
--- configs/imx95_19x19_evk_defconfig | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
configs/imx95_19x19_evk_defconfig +2 -5
@@ -94,15 +94,12 @@ CONFIG_ETHPRIME="eth0" CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SYS_RX_ETH_BUFFER=8 CONFIG_SPL_DM=y -CONFIG_REGMAP=y -CONFIG_SYSCON=y CONFIG_SPL_OF_TRANSLATE=y -CONFIG_CLK=y CONFIG_SPL_CLK=y CONFIG_SPL_CLK_CCF=y -CONFIG_CLK_CCF=y CONFIG_CLK_SCMI=y CONFIG_SPL_CLK_SCMI=y +CONFIG_CLK_IMX95_BLKCTRL=y CONFIG_DFU_MMC=y CONFIG_DFU_RAM=y CONFIG_SPL_FIRMWARE=y
@@ -130,13 +127,13 @@ CONFIG_DM_MDIO=y CONFIG_MII=y CONFIG_FSL_ENETC=y CONFIG_PCIE_ECAM_GENERIC=y +CONFIG_PCIE_DW_IMX=y CONFIG_PHY=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX_SCMI=y CONFIG_POWER_DOMAIN=y CONFIG_SCMI_POWER_DOMAIN=y -CONFIG_DM_REGULATOR=y CONFIG_SPL_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_SPL_DM_REGULATOR_FIXED=y
Signature · 1 line
2.37.1