rockchip: Add PCIe host support
Subsystems (4)
v2 cover rockchip: Add PCIe host support
This series support PCIe host controller support on rockchip rk3399 platform.
It is based on previous version[1] changes.
Works well on rk3399 boards like rock960, nanopc-t4 and roc-kr3399-pc-mezzanine board as Gen1 configurable host with M.2 SSD.
Changes for v2:
- handle USB, GMAC clocks
- collect kever r-o-b tag
- simplify rd and wr conf API
Any inputs?
Jagan.
Jagan Teki (8):
iopoll: Add dealy to read poll
iopoll: Add readl_poll_sleep_timeout
clk: rk3399: Add enable/disable clks
clk: rk3399: Enable/Disable the PCIEPHY clk
pci: Add Rockchip PCIe controller driver
pci: Add Rockchip PCIe PHY controller driver
rockchip: Enable PCIe/M.2 on rk3399 board w/ M.2
rockchip: Enable PCIe/M.2 on rock960 board
arch/arm/dts/rk3399-u-boot.dtsi | 1 + board/vamrs/rock960_rk3399/rock960-rk3399.c | 20 + configs/nanopc-t4-rk3399_defconfig | 4 + configs/roc-pc-mezzanine-rk3399_defconfig | 4 + configs/rock960-rk3399_defconfig | 5 + drivers/clk/rockchip/clk_rk3399.c | 154 ++++++ drivers/pci/Kconfig | 8 + drivers/pci/Makefile | 1 + drivers/pci/pcie_rockchip.c | 491 ++++++++++++++++++++ drivers/pci/pcie_rockchip.h | 142 ++++++ drivers/pci/pcie_rockchip_phy.c | 205 ++++++++ include/linux/iopoll.h | 23 +- 12 files changed, 1049 insertions(+), 9 deletions(-) create mode 100644 drivers/pci/pcie_rockchip.c create mode 100644 drivers/pci/pcie_rockchip.h create mode 100644 drivers/pci/pcie_rockchip_phy.c
Signature · 1 line
2.17.1
A message that is not in the archive (sent off-list or not yet received): 20200430070412.12499-1-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org
PATCH v2 1/8 iopoll: Add dealy to read poll
Some drivers and other bsp code not only poll the register with timeout but also required to delay on each transaction.
This patch add that requirement by adding sleep_us variable so-that read_poll_timeout now support delay as well.
---
Changes for v2:
- none
include/linux/iopoll.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
include/linux/iopoll.h +12 -10
@@ -16,6 +16,7 @@* @addr: Address to poll * @val: Variable to read the value into * @cond: Break condition (usually involving @val) +* @sleep_us: Maximum time to sleep in us * @timeout_us: Timeout in us, 0 means never timeout * * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
@@ -24,7 +25,7 @@* When available, you'll probably want to use one of the specialized * macros defined below rather than this macro directly. */ -#define readx_poll_timeout (op, addr, val, cond, timeout_us) \ +#define readx_poll_timeout (op, addr, val, cond, sleep_us, timeout_us) \ ({ \ unsigned long timeout = timer_get_us() + timeout_us; \ for (;;) { \
@@ -35,33 +36,34 @@ (val) =op (addr); \ break; \ } \ +if (sleep_us) \ +udelay (sleep_us); \ } \ (cond) ?0 : -ETIMEDOUT ; \ }) -#define readb_poll_timeout (addr, val, cond, timeout_us) \ - readx_poll_timeout(readb, addr, val, cond, timeout_us) + readx_poll_timeout(readb, addr, val, cond, false, timeout_us)#define readw_poll_timeout (addr, val, cond, timeout_us) \ - readx_poll_timeout(readw, addr, val, cond, timeout_us) + readx_poll_timeout(readw, addr, val, cond, false, timeout_us)#define readl_poll_timeout (addr, val, cond, timeout_us) \ - readx_poll_timeout(readl, addr, val, cond, timeout_us) + readx_poll_timeout(readl, addr, val, cond, false, timeout_us)#define readq_poll_timeout (addr, val, cond, timeout_us) \ - readx_poll_timeout(readq, addr, val, cond, timeout_us) + readx_poll_timeout(readq, addr, val, cond, false, timeout_us)#define readb_relaxed_poll_timeout (addr, val, cond, timeout_us) \ - readx_poll_timeout(readb_relaxed, addr, val, cond, timeout_us) + readx_poll_timeout(readb_relaxed, addr, val, cond, false, timeout_us)#define readw_relaxed_poll_timeout (addr, val, cond, timeout_us) \ - readx_poll_timeout(readw_relaxed, addr, val, cond, timeout_us) + readx_poll_timeout(readw_relaxed, addr, val, cond, false, timeout_us)#define readl_relaxed_poll_timeout (addr, val, cond, timeout_us) \ - readx_poll_timeout(readl_relaxed, addr, val, cond, timeout_us) + readx_poll_timeout(readl_relaxed, addr, val, cond, false, timeout_us)#define readq_relaxed_poll_timeout (addr, val, cond, timeout_us) \ - readx_poll_timeout(readq_relaxed, addr, val, cond, timeout_us) + readx_poll_timeout(readq_relaxed, addr, val, cond, false, timeout_us)#endif /* _LINUX_IOPOLL_H */
Signature · 1 line
2.17.1
Re: [PATCH v2 1/8] iopoll: Add dealy to read poll
Quoted 10 lines · Jagan Teki
Some drivers and other bsp code not only poll the register with timeout but also required to delay on each transaction.
This patch add that requirement by adding
sleep_usvariable so-thatread_poll_timeoutnow support delay as well.Cc Tom Rini <[email protected]>Signed-off-by Jagan Teki <[email protected]>
This (and 2/8) need to say what kernel commit you're taking this from, thanks.
Signature · 1 line
Tom
Re: [PATCH v2 1/8] iopoll: Add dealy to read poll
Quoted 11 lines · Tom Rini
Quoted 8 lines · Jagan Teki
Some drivers and other bsp code not only poll the register with timeout but also required to delay on each transaction.
This patch add that requirement by adding
sleep_usvariable so-thatread_poll_timeoutnow support delay as well.
Quoted 5 lines
Quoted 2 lines
Cc Tom Rini <trini-OWPKS81ov/FWk0Htik3J/[email protected]>This (and 2/8) need to say what kernel commit you're taking this from, thanks.
Linux supports sleep_us at the beginning where read_poll_timeout supports, i.e. the reason I didn't add the sha1. If that works, I will add the same sha1 and apply via my tree (since it has some SPI changes dependency patch)?
Jagan.
Re: [PATCH v2 1/8] iopoll: Add dealy to read poll
Quoted 15 lines · Jagan Teki
Quoted 14 lines · Tom Rini
Quoted 10 lines · Jagan Teki
Some drivers and other bsp code not only poll the register with timeout but also required to delay on each transaction.
This patch add that requirement by adding
sleep_usvariable so-thatread_poll_timeoutnow support delay as well.Cc Tom Rini <[email protected]>Signed-off-by Jagan Teki <[email protected]>
Quoted 7 lines
Quoted 2 lines
This (and 2/8) need to say what kernel commit you're taking this from, thanks.
Linux supports
sleep_usat the beginning whereread_poll_timeoutsupports, i.e. the reason I didn't add the sha1. If that works, I will add the same sha1 and apply via my tree (since it has some SPI changes dependency patch)?
Yes, I think that sounds right, thanks!
Signature · 1 line
Tom
Re: [PATCH v2 1/8] iopoll: Add dealy to read poll
Quoted 20 lines · Tom Rini
Quoted 18 lines · Jagan Teki
Quoted 16 lines · Tom Rini
Quoted 10 lines · Jagan Teki
Some drivers and other bsp code not only poll the register with timeout but also required to delay on each transaction.
This patch add that requirement by adding
sleep_usvariable so-thatread_poll_timeoutnow support delay as well.Cc Tom Rini <[email protected]>Signed-off-by Jagan Teki <[email protected]>This (and 2/8) need to say what kernel commit you're taking this from, thanks.
Quoted 6 lines
Quoted 4 lines
Linux supports
sleep_usat the beginning whereread_poll_timeoutsupports, i.e. the reason I didn't add the sha1. If that works, I will add the same sha1 and apply via my tree (since it has some SPI changes dependency patch)?Yes, I think that sounds right, thanks!
Applied 1/8 and 2/8 to u-boot-spi/master
PATCH v2 2/8 iopoll: Add readl_poll_sleep_timeout
In reply to a message not in the archiveAdd readl poll API with sleep and timeout support.
---
Changes for v2:
- none
include/linux/iopoll.h | 3 +++ 1 file changed, 3 insertions(+)
include/linux/iopoll.h +3 -0
@@ -42,6 +42,9 @@ (cond) ?0 : -ETIMEDOUT ; \ }) +#define readl_poll_sleep_timeout (addr, val, cond, sleep_us, timeout_us) \ + readx_poll_timeout(readl, addr, val, cond, sleep_us, timeout_us) +#define readb_poll_timeout (addr, val, cond, timeout_us) \ readx_poll_timeout(readb, addr, val, cond, false, timeout_us)
Signature · 1 line
2.17.1
PATCH v2 3/8 clk: rk3399: Add enable/disable clks
In reply to a message not in the archiveYes, most of the high speed peripheral clocks in rk3399 enabled by default.
But it would be better to handle them via clk enable/disable API for handling proper reset conditions like 'usb reset' over command line.
So, enable USB, GMAC clock via enable/disable ops.
---
Changes for v2:
- new patch
drivers/clk/rockchip/clk_rk3399.c | 148 ++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+)
drivers/clk/rockchip/clk_rk3399.c +148 -0
@@ -1071,12 +1071,160 @@ static int __maybe_unused rk3399_clk_set_parent(struct clk *clk,return -ENOENT ; } +static int rk3399_clk_enable (struct clk *clk) +{ +struct rk3399_clk_priv *priv =dev_get_priv (clk->dev); + +switch (clk->id) { +case SCLK_MAC : +rk_clrreg (&priv->cru->clkgate_con[5 ],BIT (5 )); +break ; +case SCLK_MAC_RX : +rk_clrreg (&priv->cru->clkgate_con[5 ],BIT (8 )); +break ; +case SCLK_MAC_TX : +rk_clrreg (&priv->cru->clkgate_con[5 ],BIT (9 )); +break ; +case SCLK_MACREF : +rk_clrreg (&priv->cru->clkgate_con[5 ],BIT (7 )); +break ; +case SCLK_MACREF_OUT : +rk_clrreg (&priv->cru->clkgate_con[5 ],BIT (6 )); +break ; +case ACLK_GMAC : +rk_clrreg (&priv->cru->clkgate_con[32 ],BIT (0 )); +break ; +case PCLK_GMAC : +rk_clrreg (&priv->cru->clkgate_con[32 ],BIT (2 )); +break ; +case SCLK_USB3OTG0_REF : +rk_clrreg (&priv->cru->clksel_con[12 ],BIT (1 )); +break ; +case SCLK_USB3OTG1_REF : +rk_clrreg (&priv->cru->clksel_con[12 ],BIT (2 )); +break ; +case SCLK_USB3OTG0_SUSPEND : +rk_clrreg (&priv->cru->clkgate_con[12 ],BIT (3 )); +break ; +case SCLK_USB3OTG1_SUSPEND : +rk_clrreg (&priv->cru->clkgate_con[12 ],BIT (4 )); +break ; +case ACLK_USB3OTG0 : +rk_clrreg (&priv->cru->clkgate_con[30 ],BIT (1 )); +break ; +case ACLK_USB3OTG1 : +rk_clrreg (&priv->cru->clkgate_con[30 ],BIT (2 )); +break ; +case ACLK_USB3_RKSOC_AXI_PERF : +rk_clrreg (&priv->cru->clkgate_con[30 ],BIT (3 )); +break ; +case ACLK_USB3 : +rk_clrreg (&priv->cru->clkgate_con[12 ],BIT (0 )); +break ; +case ACLK_USB3_GRF : +rk_clrreg (&priv->cru->clkgate_con[30 ],BIT (4 )); +break ; +case HCLK_HOST0 : +rk_clrreg (&priv->cru->clksel_con[20 ],BIT (5 )); +break ; +case HCLK_HOST0_ARB : +rk_clrreg (&priv->cru->clksel_con[20 ],BIT (6 )); +break ; +case HCLK_HOST1 : +rk_clrreg (&priv->cru->clksel_con[20 ],BIT (7 )); +break ; +case HCLK_HOST1_ARB : +rk_clrreg (&priv->cru->clksel_con[20 ],BIT (8 )); +break ; +default : +debug ("%s: unsupported clk %ld\n" , __func__, clk->id); +return -ENOENT ; + } + +return 0 ; +} + +static int rk3399_clk_disable (struct clk *clk) +{ +struct rk3399_clk_priv *priv =dev_get_priv (clk->dev); + +switch (clk->id) { +case SCLK_MAC : +rk_setreg (&priv->cru->clkgate_con[5 ],BIT (5 )); +break ; +case SCLK_MAC_RX : +rk_setreg (&priv->cru->clkgate_con[5 ],BIT (8 )); +break ; +case SCLK_MAC_TX : +rk_setreg (&priv->cru->clkgate_con[5 ],BIT (9 )); +break ; +case SCLK_MACREF : +rk_setreg (&priv->cru->clkgate_con[5 ],BIT (7 )); +break ; +case SCLK_MACREF_OUT : +rk_setreg (&priv->cru->clkgate_con[5 ],BIT (6 )); +break ; +case ACLK_GMAC : +rk_setreg (&priv->cru->clkgate_con[32 ],BIT (0 )); +break ; +case PCLK_GMAC : +rk_setreg (&priv->cru->clkgate_con[32 ],BIT (2 )); +break ; +case SCLK_USB3OTG0_REF : +rk_setreg (&priv->cru->clksel_con[12 ],BIT (1 )); +break ; +case SCLK_USB3OTG1_REF : +rk_setreg (&priv->cru->clksel_con[12 ],BIT (2 )); +break ; +case SCLK_USB3OTG0_SUSPEND : +rk_setreg (&priv->cru->clkgate_con[12 ],BIT (3 )); +break ; +case SCLK_USB3OTG1_SUSPEND : +rk_setreg (&priv->cru->clkgate_con[12 ],BIT (4 )); +break ; +case ACLK_USB3OTG0 : +rk_setreg (&priv->cru->clkgate_con[30 ],BIT (1 )); +break ; +case ACLK_USB3OTG1 : +rk_setreg (&priv->cru->clkgate_con[30 ],BIT (2 )); +break ; +case ACLK_USB3_RKSOC_AXI_PERF : +rk_setreg (&priv->cru->clkgate_con[30 ],BIT (3 )); +break ; +case ACLK_USB3 : +rk_setreg (&priv->cru->clkgate_con[12 ],BIT (0 )); +break ; +case ACLK_USB3_GRF : +rk_setreg (&priv->cru->clkgate_con[30 ],BIT (4 )); +break ; +case HCLK_HOST0 : +rk_setreg (&priv->cru->clksel_con[20 ],BIT (5 )); +break ; +case HCLK_HOST0_ARB : +rk_setreg (&priv->cru->clksel_con[20 ],BIT (6 )); +break ; +case HCLK_HOST1 : +rk_setreg (&priv->cru->clksel_con[20 ],BIT (7 )); +break ; +case HCLK_HOST1_ARB : +rk_setreg (&priv->cru->clksel_con[20 ],BIT (8 )); +break ; +default : +debug ("%s: unsupported clk %ld\n" , __func__, clk->id); +return -ENOENT ; + } + +return 0 ; +} +static struct clk_ops rk3399_clk_ops = { .get_rate = rk3399_clk_get_rate, .set_rate = rk3399_clk_set_rate, #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) .set_parent = rk3399_clk_set_parent, #endif + .enable = rk3399_clk_enable, + .disable = rk3399_clk_disable, };#ifdef CONFIG_SPL_BUILD
Signature · 1 line
2.17.1
PATCH v2 4/8 clk: rk3399: Enable/Disable the PCIEPHY clk
In reply to a message not in the archiveEnable/Disable the PCIEPHY clk for rk3399.
CLK is clear in both enable and disable functionality.
---
Changes for v2:
- clear the clk in enable
drivers/clk/rockchip/clk_rk3399.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/clk/rockchip/clk_rk3399.c +6 -0
@@ -1136,6 +1136,9 @@ static int rk3399_clk_enable(struct clk *clk)case HCLK_HOST1_ARB :rk_clrreg (&priv->cru->clksel_con[20 ],BIT (8 ));break ; +case SCLK_PCIEPHY_REF : +rk_clrreg (&priv->cru->clksel_con[18 ],BIT (10 )); +break ;default :debug ("%s: unsupported clk %ld\n" , __func__, clk->id);return -ENOENT ;
@@ -1209,6 +1212,9 @@ static int rk3399_clk_disable(struct clk *clk)case HCLK_HOST1_ARB :rk_setreg (&priv->cru->clksel_con[20 ],BIT (8 ));break ; +case SCLK_PCIEPHY_REF : +rk_clrreg (&priv->cru->clksel_con[18 ],BIT (10 )); +break ;default :debug ("%s: unsupported clk %ld\n" , __func__, clk->id);return -ENOENT ;
Signature · 1 line
2.17.1
PATCH v2 5/8 pci: Add Rockchip PCIe controller driver
In reply to a message not in the archiveAdd Rockchip PCIe controller driver for rk3399 platform.
Driver support Gen1 by operating as a Root complex.
Thanks to Patrick for initial work.
---
Changes for v2:
- simplify bdf in rd_conf, wr_conf
- collect kever r-o-b
drivers/pci/Kconfig | 8 + drivers/pci/Makefile | 1 + drivers/pci/pcie_rockchip.c | 467 ++++++++++++++++++++++++++++++++++++ drivers/pci/pcie_rockchip.h | 79 ++++++ 4 files changed, 555 insertions(+) create mode 100644 drivers/pci/pcie_rockchip.c create mode 100644 drivers/pci/pcie_rockchip.h
drivers/pci/Kconfig +8 -0
@@ -197,4 +197,12 @@ config PCIE_MEDIATEK Say Y here if you want to enable Gen2 PCIe controller, which could be found on MT7623 SoC family. +config PCIE_ROCKCHIP + bool "Enable Rockchip PCIe driver" + select DM_PCI + default y if ROCKCHIP_RK3399 + help + Say Y here if you want to enable PCIe controller support on + Rockchip SoCs. + endif
drivers/pci/Makefile +1 -0
@@ -43,3 +43,4 @@ obj-$(CONFIG_PCI_PHYTIUM) += pcie_phytium.o obj-$(CONFIG_PCIE_INTEL_FPGA) += pcie_intel_fpga.o obj-$(CONFIG_PCI_KEYSTONE) += pcie_dw_ti.o obj-$(CONFIG_PCIE_MEDIATEK) += pcie_mediatek.o +obj-$(CONFIG_PCIE_ROCKCHIP) += pcie_rockchip.o
drivers/pci/pcie_rockchip.c new file +467 -0
467 lines not on this page · raw message
drivers/pci/pcie_rockchip.h new file +79 -0
79 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 6/8 pci: Add Rockchip PCIe PHY controller driver
In reply to a message not in the archiveYes, it is possible to have a dedicated UCLASS PHY driver for this Rockchip PCIe PHY but there are some issues on Generic PHY framework to support the same.
The Generic PHY framework is unable to get the PHY if the PHY parent is of a different uclass.
Say if we try to get the PCIe PHY then the phy-uclass will look for PHY in the first instance if it is not in the root node it will try to probe the parent by assuming that the actual PHY is inside the parent PHY of UCLASS_PHY. But, in rk3399 hardware representation PHY like emmc, usb and pcie are part of syscon which is completely a different of UCLASS_SYSCON.
Example:
grf: syscon@ff770000 {
compatible = "rockchip,rk3399-grf", "syscon", "simple-mfd"; reg = <0x0 0xff770000 0x0 0x10000>; #address-cells = <1>;
#size-cells = <1>;
pcie_phy: pcie-phy {
compatible = "rockchip,rk3399-pcie-phy";
clocks = <&cru SCLK_PCIEPHY_REF>;
clock-names = "refclk";
#phy-cells = <1>;
resets = <&cru SRST_PCIEPHY>;
drive-impedance-ohm = <50>;
reset-names = "phy";
status = "disabled"; };
};
Due to this limitation, this patch adds a separate PHY driver for Rockchip PCIe. This might be removed in future once Generic PHY supports this limitation.
---
Changes for v2:
- none
drivers/pci/Makefile | 2 +- drivers/pci/pcie_rockchip.c | 50 ++++++-- drivers/pci/pcie_rockchip.h | 63 ++++++++++ drivers/pci/pcie_rockchip_phy.c | 205 ++++++++++++++++++++++++++++++++ 4 files changed, 306 insertions(+), 14 deletions(-) create mode 100644 drivers/pci/pcie_rockchip_phy.c
drivers/pci/Makefile +1 -1
@@ -43,4 +43,4 @@ obj-$(CONFIG_PCI_PHYTIUM) += pcie_phytium.o obj-$(CONFIG_PCIE_INTEL_FPGA) += pcie_intel_fpga.o obj-$(CONFIG_PCI_KEYSTONE) += pcie_dw_ti.o obj-$(CONFIG_PCIE_MEDIATEK) += pcie_mediatek.o -obj-$(CONFIG_PCIE_ROCKCHIP) += pcie_rockchip.o +obj-$(CONFIG_PCIE_ROCKCHIP) += pcie_rockchip.o pcie_rockchip_phy.o
drivers/pci/pcie_rockchip.c +37 -13
143 lines not on this page · raw message
drivers/pci/pcie_rockchip.h +63 -0
77 lines not on this page · raw message
drivers/pci/pcie_rockchip_phy.c new file +205 -0
205 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 7/8 rockchip: Enable PCIe/M.2 on rk3399 board w/ M.2
In reply to a message not in the archiveEnable PCIe/M.2 support on
- NanoPC-T4
- ROC-RK3399-PC Mezzanine boards.
---
Changes for v2:
- none
arch/arm/dts/rk3399-u-boot.dtsi | 1 + configs/nanopc-t4-rk3399_defconfig | 4 ++++ configs/roc-pc-mezzanine-rk3399_defconfig | 4 ++++ 3 files changed, 9 insertions(+)
arch/arm/dts/rk3399-u-boot.dtsi +1 -0
@@ -8,6 +8,7 @@ aliases { mmc0 = &sdhci; mmc1 = &sdmmc; + pci0 = &pcie0; }; cic: syscon@ff620000 {
configs/nanopc-t4-rk3399_defconfig +4 -0
@@ -18,6 +18,7 @@ CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y CONFIG_CMD_USB=y +CONFIG_CMD_PCI=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_TIME=y CONFIG_SPL_OF_CONTROL=y
@@ -34,10 +35,13 @@ CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_NVME=y +CONFIG_PCI=y CONFIG_PMIC_RK8XX=y CONFIG_REGULATOR_PWM=y CONFIG_REGULATOR_RK8XX=y CONFIG_PWM_ROCKCHIP=y +CONFIG_DM_RESET=y CONFIG_BAUDRATE=1500000 CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYSRESET=y
configs/roc-pc-mezzanine-rk3399_defconfig +4 -0
@@ -19,6 +19,7 @@ CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y CONFIG_CMD_USB=y +CONFIG_CMD_PCI=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_TIME=y CONFIG_SPL_OF_CONTROL=y
@@ -36,11 +37,14 @@ CONFIG_SPI_FLASH_WINBOND=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_NVME=y +CONFIG_PCI=y CONFIG_PMIC_RK8XX=y CONFIG_REGULATOR_PWM=y CONFIG_REGULATOR_RK8XX=y CONFIG_PWM_ROCKCHIP=y CONFIG_RAM_RK3399_LPDDR4=y +CONFIG_DM_RESET=y CONFIG_BAUDRATE=1500000 CONFIG_DEBUG_UART_SHIFT=2 CONFIG_ROCKCHIP_SPI=y
Signature · 1 line
2.17.1
PATCH v2 8/8 rockchip: Enable PCIe/M.2 on rock960 board
In reply to a message not in the archiveDue to some on board limitation rock960 PCIe
works only with 1.8V IO domain.
So, this patch enables grf io_sel explicitly
to make PCIe/M.2 to work.
---
Changes for v2:
- none
board/vamrs/rock960_rk3399/rock960-rk3399.c | 20 ++++++++++++++++++++ configs/rock960-rk3399_defconfig | 5 +++++ 2 files changed, 25 insertions(+)
board/vamrs/rock960_rk3399/rock960-rk3399.c +20 -0
@@ -2,3 +2,23 @@/* * Copyright (C) 2018 Manivannan Sadhasivam <[email protected]> */ + +#include <common.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch-rockchip/clock.h> +#include <asm/arch-rockchip/grf_rk3399.h> +#include <asm/arch-rockchip/hardware.h> + +#ifdef CONFIG_MISC_INIT_R +int misc_init_r (void ) +{ +struct rk3399_grf_regs *grf = +syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); + +/* BT565 is in 1.8v domain */ +rk_setreg (&grf->io_vsel,BIT (0 )); + +return 0 ; +} +#endif
configs/rock960-rk3399_defconfig +5 -0
@@ -9,6 +9,7 @@ CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_DEBUG_UART=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock960.dtb" +CONFIG_MISC_INIT_R=y CONFIG_DISPLAY_BOARDINFO_LATE=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_STACK_R=y
@@ -19,6 +20,7 @@ CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y CONFIG_CMD_USB=y +CONFIG_CMD_PCI=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_TIME=y CONFIG_CMD_PMIC=y
@@ -36,10 +38,13 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_DM_ETH=y +CONFIG_NVME=y +CONFIG_PCI=y CONFIG_PMIC_RK8XX=y CONFIG_REGULATOR_PWM=y CONFIG_REGULATOR_RK8XX=y CONFIG_PWM_ROCKCHIP=y +CONFIG_DM_RESET=y CONFIG_BAUDRATE=1500000 CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYSRESET=y
Signature · 1 line
2.17.1
A message that is not in the archive (sent off-list or not yet received): 20200430070412.12499-9-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org
Manivannan Sadhasivam
Acked-byRe: [PATCH v2 8/8] rockchip: Enable PCIe/M.2 on rock960 board
Quoted 30 lines · Jagan Teki
Due to some on board limitation rock960 PCIe
works only with 1.8V IO domain.So, this patch enables grf
io_selexplicitly
to make PCIe/M.2 to work.Cc Tom Cubie <tom-jhlD/[email protected]>Cc Manivannan Sadhasivam <[email protected]>---
Changes for v2:
- noneboard/vamrs/rock960_rk3399/rock960-rk3399.c | 20 ++++++++++++++++++++ configs/rock960-rk3399_defconfig | 5 +++++ 2 files changed, 25 insertions(+)board/vamrs/rock960_rk3399/rock960-rk3399.c +5
-0@@ -2,3 +2,23 @@/* * Copyright (C) 2018 Manivannan Sadhasivam <[email protected]> */ + +#include <common.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch-rockchip/clock.h>
board/vamrs/rock960_rk3399/rock960-rk3399.c line 19
Quoted 10 lines
board/vamrs/rock960_rk3399/rock960-rk3399.c +10
-0+#include <asm/arch-rockchip/grf_rk3399.h> +#include <asm/arch-rockchip/hardware.h> + +#ifdef CONFIG_MISC_INIT_R +int misc_init_r (void ) +{ +struct rk3399_grf_regs *grf = +syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); + +/* BT565 is in 1.8v domain */
From where this BT565 comes in?
Anyway, I don't have the PCI-E device with me to test this change but it looks good to me.
PS: Added Peter to CC incase he is interested.
Thanks,
Mani
Quoted 42 lines
board/vamrs/rock960_rk3399/rock960-rk3399.c +5
-0+rk_setreg (&grf->io_vsel,BIT (0 )); + + return 0; +} +#endif configs/rock960-rk3399_defconfig +5
-0@@ -9,6 +9,7 @@ CONFIG_DEBUG_UART_BASE=0xFF1A0000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_DEBUG_UART=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock960.dtb" +CONFIG_MISC_INIT_R=y CONFIG_DISPLAY_BOARDINFO_LATE=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_STACK_R=y@@ -19,6 +20,7 @@ CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y CONFIG_CMD_USB=y +CONFIG_CMD_PCI=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_TIME=y CONFIG_CMD_PMIC=y@@ -36,10 +38,13 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_DM_ETH=y +CONFIG_NVME=y +CONFIG_PCI=y CONFIG_PMIC_RK8XX=y CONFIG_REGULATOR_PWM=y CONFIG_REGULATOR_RK8XX=y CONFIG_PWM_ROCKCHIP=y +CONFIG_DM_RESET=y CONFIG_BAUDRATE=1500000 CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYSRESET=ySignature · 1 line
2.17.1
Re: [PATCH v2 8/8] rockchip: Enable PCIe/M.2 on rock960 board
Quoted 36 lines · Manivannan Sadhasivam
Quoted 34 lines · Jagan Teki
Due to some on board limitation rock960 PCIe
works only with 1.8V IO domain.So, this patch enables grf
io_selexplicitly
to make PCIe/M.2 to work.Cc Tom Cubie <tom-jhlD/[email protected]>Cc Manivannan Sadhasivam <[email protected]>---
Changes for v2:
- noneboard/vamrs/rock960_rk3399/rock960-rk3399.c | 20 ++++++++++++++++++++ configs/rock960-rk3399_defconfig | 5 +++++ 2 files changed, 25 insertions(+)board/vamrs/rock960_rk3399/rock960-rk3399.c +9
-0@@ -2,3 +2,23 @@/* * Copyright (C) 2018 Manivannan Sadhasivam <[email protected]> */ + +#include <common.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch-rockchip/clock.h> +#include <asm/arch-rockchip/grf_rk3399.h> +#include <asm/arch-rockchip/hardware.h> + +#ifdef CONFIG_MISC_INIT_R
Quoted 8 lines
board/vamrs/rock960_rk3399/rock960-rk3399.c line 19
Quoted 6 lines
board/vamrs/rock960_rk3399/rock960-rk3399.c +6
-0+int misc_init_r (void ) +{ +struct rk3399_grf_regs *grf = +syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); + +/* BT565 is in 1.8v domain */ From where this BT565 comes in?
If my understanding was correct, some SSD's to work on this board do require this explicit domain voltage change. Usually it requires GPIO enablement followed by grf voltage domain update [1] but in my case it worked w/o gpio.
Maybe I will update this details in the commit message and also in the code.
[1] https://github.com/radxa/u-boot/blob/stable-4.4-rockpi4/board/rockchip/evb_rk3399/evb-rk3399.c#L194
Jagan.