mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
Add a directory by kernel instead of a common root, add qnap-301w and rpi4 kernel 6.1 suppport
This commit is contained in:
parent
e910436a7a
commit
46837ec4c0
9459 changed files with 362648 additions and 116345 deletions
35
5.15/target/linux/rockchip/patches-5.15/
Normal file
35
5.15/target/linux/rockchip/patches-5.15/
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
From 2076121eecc18fa31ae749c6ddc5648be96f0b5e Mon Sep 17 00:00:00 2001
|
||||
From: Simon Xue <xxm@rock-chips.com>
|
||||
Date: Mon, 5 Jul 2021 09:26:10 +0800
|
||||
Subject: [PATCH] arm64: dts: rockchip: add saradc node for rk3568
|
||||
|
||||
Add the core dt-node for the rk3568's saradc.
|
||||
|
||||
Signed-off-by: Simon Xue <xxm@rock-chips.com>
|
||||
Link: https://lore.kernel.org/r/20210705012610.3831-1-xxm@rock-chips.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3568.dtsi | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
@@ -754,6 +754,18 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ saradc: saradc@fe720000 {
|
||||
+ compatible = "rockchip,rk3568-saradc", "rockchip,rk3399-saradc";
|
||||
+ reg = <0x0 0xfe720000 0x0 0x100>;
|
||||
+ interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru CLK_SARADC>, <&cru PCLK_SARADC>;
|
||||
+ clock-names = "saradc", "apb_pclk";
|
||||
+ resets = <&cru SRST_P_SARADC>;
|
||||
+ reset-names = "saradc-apb";
|
||||
+ #io-channel-cells = <1>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
pinctrl: pinctrl {
|
||||
compatible = "rockchip,rk3568-pinctrl";
|
||||
rockchip,grf = <&grf>;
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
From bc6c96d850419e71dbc9b0094ccc9b668ba9be43 Mon Sep 17 00:00:00 2001
|
||||
From: David Bauer <mail@david-bauer.net>
|
||||
Date: Mon, 28 Sep 2020 22:54:52 +0200
|
||||
Subject: [PATCH] rockchip: rk3328: add compatible to NanoPi R2S ethernet PHY
|
||||
|
||||
This adds the compatible property to the NanoPi R2S ethernet PHY node.
|
||||
Otherwise, the PHY might not be probed, as the PHY ID reads all 0xff
|
||||
when it is still in reset.
|
||||
|
||||
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
|
||||
@@ -156,6 +156,8 @@
|
||||
#size-cells = <0>;
|
||||
|
||||
rtl8211e: ethernet-phy@1 {
|
||||
+ compatible = "ethernet-phy-id001c.c915",
|
||||
+ "ethernet-phy-ieee802.3-c22";
|
||||
reg = <1>;
|
||||
pinctrl-0 = <ð_phy_reset_pin>;
|
||||
pinctrl-names = "default";
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
From 43f3999d1836117ab2e601aec9a9e6f292ce4958 Mon Sep 17 00:00:00 2001
|
||||
From: Tianling Shen <cnsztl@gmail.com>
|
||||
Date: Mon, 7 Jun 2021 15:45:37 +0800
|
||||
Subject: [PATCH] arm64: dts: rockchip: add EEPROM node for NanoPi R4S
|
||||
|
||||
NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which
|
||||
stores the MAC address.
|
||||
|
||||
Signed-off-by: Tianling Shen <cnsztl@gmail.com>
|
||||
---
|
||||
.../boot/dts/rockchip/rk3399-nanopi-r4s.dts | 18 ++++++++++++++++++
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
|
||||
@@ -68,6 +68,19 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+&i2c2 {
|
||||
+ eeprom@51 {
|
||||
+ compatible = "microchip,24c02", "atmel,24c02";
|
||||
+ reg = <0x51>;
|
||||
+ pagesize = <16>;
|
||||
+ size = <256>;
|
||||
+
|
||||
+ mac_address: mac-address@fa {
|
||||
+ reg = <0xfa 0x06>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&i2c4 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
From 02832ed8ae2c8b130efea4e43d3ecac50b4b7933 Mon Sep 17 00:00:00 2001
|
||||
From: Johan Jonker <jbx6244@gmail.com>
|
||||
Date: Thu, 30 Sep 2021 13:05:16 +0200
|
||||
Subject: [PATCH] thermal/drivers/rockchip_thermal: Allow more resets for tsadc
|
||||
node
|
||||
|
||||
The tsadc node in rk356x.dtsi has more resets then currently supported
|
||||
by the rockchip_thermal.c driver, so use
|
||||
devm_reset_control_array_get() to reset them all.
|
||||
|
||||
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20210930110517.14323-3-jbx6244@gmail.com
|
||||
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
|
||||
---
|
||||
drivers/thermal/rockchip_thermal.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/thermal/rockchip_thermal.c
|
||||
+++ b/drivers/thermal/rockchip_thermal.c
|
||||
@@ -1383,7 +1383,7 @@ static int rockchip_thermal_probe(struct
|
||||
if (IS_ERR(thermal->regs))
|
||||
return PTR_ERR(thermal->regs);
|
||||
|
||||
- thermal->reset = devm_reset_control_get(&pdev->dev, "tsadc-apb");
|
||||
+ thermal->reset = devm_reset_control_array_get(&pdev->dev, false, false);
|
||||
if (IS_ERR(thermal->reset)) {
|
||||
error = PTR_ERR(thermal->reset);
|
||||
dev_err(&pdev->dev, "failed to get tsadc reset: %d\n", error);
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
From 884d2b845477cd0a18302444dc20fe2d9a01743e Mon Sep 17 00:00:00 2001
|
||||
From: David Wu <david.wu@rock-chips.com>
|
||||
Date: Mon, 13 Dec 2021 19:15:15 +0800
|
||||
Subject: [PATCH] net: stmmac: Add GFP_DMA32 for rx buffers if no 64 capability
|
||||
|
||||
Use page_pool_alloc_pages instead of page_pool_dev_alloc_pages, which
|
||||
can give the gfp parameter, in the case of not supporting 64-bit width,
|
||||
using 32-bit address memory can reduce a copy from swiotlb.
|
||||
|
||||
Signed-off-by: David Wu <david.wu@rock-chips.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++++++++++----
|
||||
1 file changed, 12 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
||||
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
||||
@@ -1487,16 +1487,20 @@ static int stmmac_init_rx_buffers(struct
|
||||
{
|
||||
struct stmmac_rx_queue *rx_q = &dma_conf->rx_queue[queue];
|
||||
struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i];
|
||||
+ gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN);
|
||||
+
|
||||
+ if (priv->dma_cap.addr64 <= 32)
|
||||
+ gfp |= GFP_DMA32;
|
||||
|
||||
if (!buf->page) {
|
||||
- buf->page = page_pool_dev_alloc_pages(rx_q->page_pool);
|
||||
+ buf->page = page_pool_alloc_pages(rx_q->page_pool, gfp);
|
||||
if (!buf->page)
|
||||
return -ENOMEM;
|
||||
buf->page_offset = stmmac_rx_offset(priv);
|
||||
}
|
||||
|
||||
if (priv->sph && !buf->sec_page) {
|
||||
- buf->sec_page = page_pool_dev_alloc_pages(rx_q->page_pool);
|
||||
+ buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp);
|
||||
if (!buf->sec_page)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -4633,6 +4637,10 @@ static inline void stmmac_rx_refill(stru
|
||||
struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
|
||||
int dirty = stmmac_rx_dirty(priv, queue);
|
||||
unsigned int entry = rx_q->dirty_rx;
|
||||
+ gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN);
|
||||
+
|
||||
+ if (priv->dma_cap.addr64 <= 32)
|
||||
+ gfp |= GFP_DMA32;
|
||||
|
||||
while (dirty-- > 0) {
|
||||
struct stmmac_rx_buffer *buf = &rx_q->buf_pool[entry];
|
||||
@@ -4645,13 +4653,13 @@ static inline void stmmac_rx_refill(stru
|
||||
p = rx_q->dma_rx + entry;
|
||||
|
||||
if (!buf->page) {
|
||||
- buf->page = page_pool_dev_alloc_pages(rx_q->page_pool);
|
||||
+ buf->page = page_pool_alloc_pages(rx_q->page_pool, gfp);
|
||||
if (!buf->page)
|
||||
break;
|
||||
}
|
||||
|
||||
if (priv->sph && !buf->sec_page) {
|
||||
- buf->sec_page = page_pool_dev_alloc_pages(rx_q->page_pool);
|
||||
+ buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp);
|
||||
if (!buf->sec_page)
|
||||
break;
|
||||
|
||||
|
|
@ -0,0 +1,266 @@
|
|||
From e1152a526b16951fbebba5540cfcbb9394532431 Mon Sep 17 00:00:00 2001
|
||||
From: Liang Chen <cl@rock-chips.com>
|
||||
Date: Thu, 24 Jun 2021 21:10:27 +0800
|
||||
Subject: [PATCH] arm64: dts: rockchip: add pmu and qos nodes for rk3568
|
||||
|
||||
Add the power-management and QoS nodes to the core rk3568 dtsi.
|
||||
|
||||
Signed-off-by: Liang Chen <cl@rock-chips.com>
|
||||
Link: https://lore.kernel.org/r/20210624131027.3719-1-cl@rock-chips.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3568.dtsi | 229 +++++++++++++++++++++++
|
||||
1 file changed, 229 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/phy/phy.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
+#include <dt-bindings/power/rk3568-power.h>
|
||||
#include <dt-bindings/soc/rockchip,boot-mode.h>
|
||||
#include <dt-bindings/thermal/thermal.h>
|
||||
|
||||
@@ -257,6 +258,99 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ pmu: power-management@fdd90000 {
|
||||
+ compatible = "rockchip,rk3568-pmu", "syscon", "simple-mfd";
|
||||
+ reg = <0x0 0xfdd90000 0x0 0x1000>;
|
||||
+
|
||||
+ power: power-controller {
|
||||
+ compatible = "rockchip,rk3568-power-controller";
|
||||
+ #power-domain-cells = <1>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ /* These power domains are grouped by VD_GPU */
|
||||
+ power-domain@RK3568_PD_GPU {
|
||||
+ reg = <RK3568_PD_GPU>;
|
||||
+ clocks = <&cru ACLK_GPU_PRE>,
|
||||
+ <&cru PCLK_GPU_PRE>;
|
||||
+ pm_qos = <&qos_gpu>;
|
||||
+ #power-domain-cells = <0>;
|
||||
+ };
|
||||
+
|
||||
+ /* These power domains are grouped by VD_LOGIC */
|
||||
+ power-domain@RK3568_PD_VI {
|
||||
+ reg = <RK3568_PD_VI>;
|
||||
+ clocks = <&cru HCLK_VI>,
|
||||
+ <&cru PCLK_VI>;
|
||||
+ pm_qos = <&qos_isp>,
|
||||
+ <&qos_vicap0>,
|
||||
+ <&qos_vicap1>;
|
||||
+ #power-domain-cells = <0>;
|
||||
+ };
|
||||
+
|
||||
+ power-domain@RK3568_PD_VO {
|
||||
+ reg = <RK3568_PD_VO>;
|
||||
+ clocks = <&cru HCLK_VO>,
|
||||
+ <&cru PCLK_VO>,
|
||||
+ <&cru ACLK_VOP_PRE>;
|
||||
+ pm_qos = <&qos_hdcp>,
|
||||
+ <&qos_vop_m0>,
|
||||
+ <&qos_vop_m1>;
|
||||
+ #power-domain-cells = <0>;
|
||||
+ };
|
||||
+
|
||||
+ power-domain@RK3568_PD_RGA {
|
||||
+ reg = <RK3568_PD_RGA>;
|
||||
+ clocks = <&cru HCLK_RGA_PRE>,
|
||||
+ <&cru PCLK_RGA_PRE>;
|
||||
+ pm_qos = <&qos_ebc>,
|
||||
+ <&qos_iep>,
|
||||
+ <&qos_jpeg_dec>,
|
||||
+ <&qos_jpeg_enc>,
|
||||
+ <&qos_rga_rd>,
|
||||
+ <&qos_rga_wr>;
|
||||
+ #power-domain-cells = <0>;
|
||||
+ };
|
||||
+
|
||||
+ power-domain@RK3568_PD_VPU {
|
||||
+ reg = <RK3568_PD_VPU>;
|
||||
+ clocks = <&cru HCLK_VPU_PRE>;
|
||||
+ pm_qos = <&qos_vpu>;
|
||||
+ #power-domain-cells = <0>;
|
||||
+ };
|
||||
+
|
||||
+ power-domain@RK3568_PD_RKVDEC {
|
||||
+ clocks = <&cru HCLK_RKVDEC_PRE>;
|
||||
+ reg = <RK3568_PD_RKVDEC>;
|
||||
+ pm_qos = <&qos_rkvdec>;
|
||||
+ #power-domain-cells = <0>;
|
||||
+ };
|
||||
+
|
||||
+ power-domain@RK3568_PD_RKVENC {
|
||||
+ reg = <RK3568_PD_RKVENC>;
|
||||
+ clocks = <&cru HCLK_RKVENC_PRE>;
|
||||
+ pm_qos = <&qos_rkvenc_rd_m0>,
|
||||
+ <&qos_rkvenc_rd_m1>,
|
||||
+ <&qos_rkvenc_wr_m0>;
|
||||
+ #power-domain-cells = <0>;
|
||||
+ };
|
||||
+
|
||||
+ power-domain@RK3568_PD_PIPE {
|
||||
+ reg = <RK3568_PD_PIPE>;
|
||||
+ clocks = <&cru PCLK_PIPE>;
|
||||
+ pm_qos = <&qos_pcie2x1>,
|
||||
+ <&qos_pcie3x1>,
|
||||
+ <&qos_pcie3x2>,
|
||||
+ <&qos_sata0>,
|
||||
+ <&qos_sata1>,
|
||||
+ <&qos_sata2>,
|
||||
+ <&qos_usb3_0>,
|
||||
+ <&qos_usb3_1>;
|
||||
+ #power-domain-cells = <0>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
sdmmc2: mmc@fe000000 {
|
||||
compatible = "rockchip,rk3568-dw-mshc", "rockchip,rk3288-dw-mshc";
|
||||
reg = <0x0 0xfe000000 0x0 0x4000>;
|
||||
@@ -271,6 +365,141 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ qos_gpu: qos@fe128000 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe128000 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_rkvenc_rd_m0: qos@fe138080 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe138080 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_rkvenc_rd_m1: qos@fe138100 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe138100 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_rkvenc_wr_m0: qos@fe138180 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe138180 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_isp: qos@fe148000 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe148000 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_vicap0: qos@fe148080 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe148080 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_vicap1: qos@fe148100 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe148100 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_vpu: qos@fe150000 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe150000 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_ebc: qos@fe158000 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe158000 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_iep: qos@fe158100 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe158100 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_jpeg_dec: qos@fe158180 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe158180 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_jpeg_enc: qos@fe158200 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe158200 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_rga_rd: qos@fe158280 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe158280 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_rga_wr: qos@fe158300 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe158300 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_npu: qos@fe180000 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe180000 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_pcie2x1: qos@fe190000 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe190000 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_pcie3x1: qos@fe190080 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe190080 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_pcie3x2: qos@fe190100 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe190100 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_sata0: qos@fe190200 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe190200 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_sata1: qos@fe190280 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe190280 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_sata2: qos@fe190300 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe190300 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_usb3_0: qos@fe190380 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe190380 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_usb3_1: qos@fe190400 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe190400 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_rkvdec: qos@fe198000 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe198000 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_hdcp: qos@fe1a8000 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe1a8000 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_vop_m0: qos@fe1a8080 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe1a8080 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_vop_m1: qos@fe1a8100 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe1a8100 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
sdmmc0: mmc@fe2b0000 {
|
||||
compatible = "rockchip,rk3568-dw-mshc", "rockchip,rk3288-dw-mshc";
|
||||
reg = <0x0 0xfe2b0000 0x0 0x4000>;
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
From 2076121eecc18fa31ae749c6ddc5648be96f0b5e Mon Sep 17 00:00:00 2001
|
||||
From: Simon Xue <xxm@rock-chips.com>
|
||||
Date: Mon, 5 Jul 2021 09:26:10 +0800
|
||||
Subject: [PATCH] arm64: dts: rockchip: add saradc node for rk3568
|
||||
|
||||
Add the core dt-node for the rk3568's saradc.
|
||||
|
||||
Signed-off-by: Simon Xue <xxm@rock-chips.com>
|
||||
Link: https://lore.kernel.org/r/20210705012610.3831-1-xxm@rock-chips.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3568.dtsi | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
@@ -754,6 +754,18 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ saradc: saradc@fe720000 {
|
||||
+ compatible = "rockchip,rk3568-saradc", "rockchip,rk3399-saradc";
|
||||
+ reg = <0x0 0xfe720000 0x0 0x100>;
|
||||
+ interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru CLK_SARADC>, <&cru PCLK_SARADC>;
|
||||
+ clock-names = "saradc", "apb_pclk";
|
||||
+ resets = <&cru SRST_P_SARADC>;
|
||||
+ reset-names = "saradc-apb";
|
||||
+ #io-channel-cells = <1>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
pinctrl: pinctrl {
|
||||
compatible = "rockchip,rk3568-pinctrl";
|
||||
rockchip,grf = <&grf>;
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
From 4e50d2173b67115a5574f4f4ce64ec9c5d9c136e Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Sat, 10 Jul 2021 11:10:31 -0400
|
||||
Subject: [PATCH] arm64: dts: rockchip: move rk3568 dtsi to rk356x dtsi
|
||||
|
||||
In preparation for separating the rk3568 and rk3566 device trees, move
|
||||
the base rk3568 dtsi to rk356x dtsi.
|
||||
This will allow us to strip out the rk3568 specific nodes.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20210710151034.32857-2-pgwipeout@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/{rk3568.dtsi => rk356x.dtsi} | 0
|
||||
1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
rename arch/arm64/boot/dts/rockchip/{rk3568.dtsi => rk356x.dtsi} (100%)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3568.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
similarity index 100%
|
||||
rename from arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
rename to arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
From 5067f459e5ee22857eeb4f659219db8e28c6263e Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Sat, 10 Jul 2021 11:10:32 -0400
|
||||
Subject: [PATCH] arm64: dts: rockchip: split rk3568 device tree
|
||||
|
||||
In preparation for the rk3566 inclusion, split apart the rk3568 specific
|
||||
nodes into a separate device tree.
|
||||
This allows us to create the rk3566 device tree without deleting nodes.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20210710151034.32857-3-pgwipeout@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3568.dtsi | 48 ++++++++++++++++++++++++
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 36 ------------------
|
||||
2 files changed, 48 insertions(+), 36 deletions(-)
|
||||
create mode 100644 arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
@@ -0,0 +1,48 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2021 Rockchip Electronics Co., Ltd.
|
||||
+ */
|
||||
+
|
||||
+#include "rk356x.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ compatible = "rockchip,rk3568";
|
||||
+
|
||||
+ qos_pcie3x1: qos@fe190080 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe190080 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_pcie3x2: qos@fe190100 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe190100 0x0 0x20>;
|
||||
+ };
|
||||
+
|
||||
+ qos_sata0: qos@fe190200 {
|
||||
+ compatible = "rockchip,rk3568-qos", "syscon";
|
||||
+ reg = <0x0 0xfe190200 0x0 0x20>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&cpu0_opp_table {
|
||||
+ opp-1992000000 {
|
||||
+ opp-hz = /bits/ 64 <1992000000>;
|
||||
+ opp-microvolt = <1150000 1150000 1150000>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&power {
|
||||
+ power-domain@RK3568_PD_PIPE {
|
||||
+ reg = <RK3568_PD_PIPE>;
|
||||
+ clocks = <&cru PCLK_PIPE>;
|
||||
+ pm_qos = <&qos_pcie2x1>,
|
||||
+ <&qos_pcie3x1>,
|
||||
+ <&qos_pcie3x2>,
|
||||
+ <&qos_sata0>,
|
||||
+ <&qos_sata1>,
|
||||
+ <&qos_sata2>,
|
||||
+ <&qos_usb3_0>,
|
||||
+ <&qos_usb3_1>;
|
||||
+ #power-domain-cells = <0>;
|
||||
+ };
|
||||
+};
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -13,8 +13,6 @@
|
||||
#include <dt-bindings/thermal/thermal.h>
|
||||
|
||||
/ {
|
||||
- compatible = "rockchip,rk3568";
|
||||
-
|
||||
interrupt-parent = <&gic>;
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
@@ -121,11 +119,6 @@
|
||||
opp-hz = /bits/ 64 <1800000000>;
|
||||
opp-microvolt = <1050000 1050000 1150000>;
|
||||
};
|
||||
-
|
||||
- opp-1992000000 {
|
||||
- opp-hz = /bits/ 64 <1992000000>;
|
||||
- opp-microvolt = <1150000 1150000 1150000>;
|
||||
- };
|
||||
};
|
||||
|
||||
firmware {
|
||||
@@ -334,20 +327,6 @@
|
||||
<&qos_rkvenc_wr_m0>;
|
||||
#power-domain-cells = <0>;
|
||||
};
|
||||
-
|
||||
- power-domain@RK3568_PD_PIPE {
|
||||
- reg = <RK3568_PD_PIPE>;
|
||||
- clocks = <&cru PCLK_PIPE>;
|
||||
- pm_qos = <&qos_pcie2x1>,
|
||||
- <&qos_pcie3x1>,
|
||||
- <&qos_pcie3x2>,
|
||||
- <&qos_sata0>,
|
||||
- <&qos_sata1>,
|
||||
- <&qos_sata2>,
|
||||
- <&qos_usb3_0>,
|
||||
- <&qos_usb3_1>;
|
||||
- #power-domain-cells = <0>;
|
||||
- };
|
||||
};
|
||||
};
|
||||
|
||||
@@ -445,21 +424,6 @@
|
||||
reg = <0x0 0xfe190000 0x0 0x20>;
|
||||
};
|
||||
|
||||
- qos_pcie3x1: qos@fe190080 {
|
||||
- compatible = "rockchip,rk3568-qos", "syscon";
|
||||
- reg = <0x0 0xfe190080 0x0 0x20>;
|
||||
- };
|
||||
-
|
||||
- qos_pcie3x2: qos@fe190100 {
|
||||
- compatible = "rockchip,rk3568-qos", "syscon";
|
||||
- reg = <0x0 0xfe190100 0x0 0x20>;
|
||||
- };
|
||||
-
|
||||
- qos_sata0: qos@fe190200 {
|
||||
- compatible = "rockchip,rk3568-qos", "syscon";
|
||||
- reg = <0x0 0xfe190200 0x0 0x20>;
|
||||
- };
|
||||
-
|
||||
qos_sata1: qos@fe190280 {
|
||||
compatible = "rockchip,rk3568-qos", "syscon";
|
||||
reg = <0x0 0xfe190280 0x0 0x20>;
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
From 016c0e8a7a6e7820fb54d8ff8a4a2928a3016421 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Sat, 10 Jul 2021 11:10:33 -0400
|
||||
Subject: [PATCH] arm64: dts: rockchip: add rk3566 dtsi
|
||||
|
||||
Add the rk3566 dtsi which includes the soc specific changes for this
|
||||
chip.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20210710151034.32857-4-pgwipeout@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3566.dtsi | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
create mode 100644 arch/arm64/boot/dts/rockchip/rk3566.dtsi
|
||||
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3566.dtsi
|
||||
@@ -0,0 +1,20 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+
|
||||
+#include "rk356x.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ compatible = "rockchip,rk3566";
|
||||
+};
|
||||
+
|
||||
+&power {
|
||||
+ power-domain@RK3568_PD_PIPE {
|
||||
+ reg = <RK3568_PD_PIPE>;
|
||||
+ clocks = <&cru PCLK_PIPE>;
|
||||
+ pm_qos = <&qos_pcie2x1>,
|
||||
+ <&qos_sata1>,
|
||||
+ <&qos_sata2>,
|
||||
+ <&qos_usb3_0>,
|
||||
+ <&qos_usb3_1>;
|
||||
+ #power-domain-cells = <0>;
|
||||
+ };
|
||||
+};
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
From 0edcfec3fafa1fe58fd9a3be727742881ec340c3 Mon Sep 17 00:00:00 2001
|
||||
From: Liang Chen <cl@rock-chips.com>
|
||||
Date: Tue, 22 Jun 2021 12:29:07 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: add watchdog to rk3568
|
||||
|
||||
Add the watchdog node to rk3568.
|
||||
|
||||
Signed-off-by: Liang Chen <cl@rock-chips.com>
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
Link: https://lore.kernel.org/r/20210622102907.99242-2-heiko@sntech.de
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -592,6 +592,14 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ wdt: watchdog@fe600000 {
|
||||
+ compatible = "rockchip,rk3568-wdt", "snps,dw-wdt";
|
||||
+ reg = <0x0 0xfe600000 0x0 0x100>;
|
||||
+ interrupts = <GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru TCLK_WDT_NS>, <&cru PCLK_WDT_NS>;
|
||||
+ clock-names = "tclk", "pclk";
|
||||
+ };
|
||||
+
|
||||
uart1: serial@fe650000 {
|
||||
compatible = "rockchip,rk3568-uart", "snps,dw-apb-uart";
|
||||
reg = <0x0 0xfe650000 0x0 0x100>;
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
From b6c1a590148c63f822091912b4c09c79fbb13971 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Wed, 28 Jul 2021 14:00:27 -0400
|
||||
Subject: [PATCH] arm64: dts: rockchip: fix rk3568 mbi-alias
|
||||
|
||||
The mbi-alias incorrectly points to 0xfd100000 when it should point to
|
||||
0xfd410000.
|
||||
This fixes MSIs on rk3568.
|
||||
|
||||
Fixes: a3adc0b9071d ("arm64: dts: rockchip: add core dtsi for RK3568 SoC")
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20210728180034.717953-2-pgwipeout@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -195,7 +195,7 @@
|
||||
interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <3>;
|
||||
- mbi-alias = <0x0 0xfd100000>;
|
||||
+ mbi-alias = <0x0 0xfd410000>;
|
||||
mbi-ranges = <296 24>;
|
||||
msi-controller;
|
||||
};
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
From 0dcec571cee519989d9536fd31328cdcbc0a45c7 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Wed, 28 Jul 2021 14:00:30 -0400
|
||||
Subject: [PATCH] arm64: dts: rockchip: add rk356x gmac1 node
|
||||
|
||||
Add the gmac1 controller to the rk356x device tree.
|
||||
This is the controller common to both the rk3568 and rk3566.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20210728180034.717953-5-pgwipeout@gmail.com
|
||||
[adjusted sorting a bit]
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 47 ++++++++++++++++++++++++
|
||||
1 file changed, 47 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -344,6 +344,53 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ gmac1: ethernet@fe010000 {
|
||||
+ compatible = "rockchip,rk3568-gmac", "snps,dwmac-4.20a";
|
||||
+ reg = <0x0 0xfe010000 0x0 0x10000>;
|
||||
+ interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "macirq", "eth_wake_irq";
|
||||
+ clocks = <&cru SCLK_GMAC1>, <&cru SCLK_GMAC1_RX_TX>,
|
||||
+ <&cru SCLK_GMAC1_RX_TX>, <&cru CLK_MAC1_REFOUT>,
|
||||
+ <&cru ACLK_GMAC1>, <&cru PCLK_GMAC1>,
|
||||
+ <&cru SCLK_GMAC1_RX_TX>, <&cru CLK_GMAC1_PTP_REF>;
|
||||
+ clock-names = "stmmaceth", "mac_clk_rx",
|
||||
+ "mac_clk_tx", "clk_mac_refout",
|
||||
+ "aclk_mac", "pclk_mac",
|
||||
+ "clk_mac_speed", "ptp_ref";
|
||||
+ resets = <&cru SRST_A_GMAC1>;
|
||||
+ reset-names = "stmmaceth";
|
||||
+ rockchip,grf = <&grf>;
|
||||
+ snps,axi-config = <&gmac1_stmmac_axi_setup>;
|
||||
+ snps,mixed-burst;
|
||||
+ snps,mtl-rx-config = <&gmac1_mtl_rx_setup>;
|
||||
+ snps,mtl-tx-config = <&gmac1_mtl_tx_setup>;
|
||||
+ snps,tso;
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ mdio1: mdio {
|
||||
+ compatible = "snps,dwmac-mdio";
|
||||
+ #address-cells = <0x1>;
|
||||
+ #size-cells = <0x0>;
|
||||
+ };
|
||||
+
|
||||
+ gmac1_stmmac_axi_setup: stmmac-axi-config {
|
||||
+ snps,blen = <0 0 0 0 16 8 4>;
|
||||
+ snps,rd_osr_lmt = <8>;
|
||||
+ snps,wr_osr_lmt = <4>;
|
||||
+ };
|
||||
+
|
||||
+ gmac1_mtl_rx_setup: rx-queues-config {
|
||||
+ snps,rx-queues-to-use = <1>;
|
||||
+ queue0 {};
|
||||
+ };
|
||||
+
|
||||
+ gmac1_mtl_tx_setup: tx-queues-config {
|
||||
+ snps,tx-queues-to-use = <1>;
|
||||
+ queue0 {};
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
qos_gpu: qos@fe128000 {
|
||||
compatible = "rockchip,rk3568-qos", "syscon";
|
||||
reg = <0x0 0xfe128000 0x0 0x20>;
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
From f7c5b9c2a1af765de0aae3a21073e051e95448bf Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Wed, 28 Jul 2021 14:00:32 -0400
|
||||
Subject: [PATCH] arm64: dts: rockchip: adjust rk3568 pll clocks
|
||||
|
||||
The rk3568 gpll should run at 1200mhz and the ppll should run at 200mhz.
|
||||
These are set incorrectly by the bootloader, so fix them here.
|
||||
|
||||
gpll boots at 1188mhz, but to get most accurate dividers for all
|
||||
gpll_dividers it needs to run at 1200mhz, otherwise everyone downstream
|
||||
isn't quite right.
|
||||
|
||||
ppll feeds the combophys, which has a divide by 2 clock, so 200mhz is
|
||||
required to reach a 100mhz clock input for them.
|
||||
|
||||
The vendor-kernel also makes this fix.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
[pulled deeper explanation from discussion into commit message]
|
||||
Link: https://lore.kernel.org/r/20210728180034.717953-7-pgwipeout@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -222,6 +222,8 @@
|
||||
reg = <0x0 0xfdd20000 0x0 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
+ assigned-clocks = <&cru PLL_GPLL>, <&pmucru PLL_PPLL>;
|
||||
+ assigned-clock-rates = <1200000000>, <200000000>;
|
||||
};
|
||||
|
||||
i2c0: i2c@fdd40000 {
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
From b8d41e5053cd823817344cc5e7a2bfda508effff Mon Sep 17 00:00:00 2001
|
||||
From: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Date: Thu, 29 Jul 2021 11:39:12 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: add gmac0 node to rk3568
|
||||
|
||||
While both RK3566 and RK3568 feature the gmac1 node, the gmac0
|
||||
node is exclusive to the RK3568.
|
||||
|
||||
Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Link: https://lore.kernel.org/r/20210729093913.8917-2-michael.riesch@wolfvision.net
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3568.dtsi | 49 ++++++++++++++++++++++++
|
||||
1 file changed, 49 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
@@ -22,6 +22,55 @@
|
||||
compatible = "rockchip,rk3568-qos", "syscon";
|
||||
reg = <0x0 0xfe190200 0x0 0x20>;
|
||||
};
|
||||
+
|
||||
+ gmac0: ethernet@fe2a0000 {
|
||||
+ compatible = "rockchip,rk3568-gmac", "snps,dwmac-4.20a";
|
||||
+ reg = <0x0 0xfe2a0000 0x0 0x10000>;
|
||||
+ interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "macirq", "eth_wake_irq";
|
||||
+ clocks = <&cru SCLK_GMAC0>, <&cru SCLK_GMAC0_RX_TX>,
|
||||
+ <&cru SCLK_GMAC0_RX_TX>, <&cru CLK_MAC0_REFOUT>,
|
||||
+ <&cru ACLK_GMAC0>, <&cru PCLK_GMAC0>,
|
||||
+ <&cru SCLK_GMAC0_RX_TX>, <&cru CLK_GMAC0_PTP_REF>,
|
||||
+ <&cru PCLK_XPCS>;
|
||||
+ clock-names = "stmmaceth", "mac_clk_rx",
|
||||
+ "mac_clk_tx", "clk_mac_refout",
|
||||
+ "aclk_mac", "pclk_mac",
|
||||
+ "clk_mac_speed", "ptp_ref",
|
||||
+ "pclk_xpcs";
|
||||
+ resets = <&cru SRST_A_GMAC0>;
|
||||
+ reset-names = "stmmaceth";
|
||||
+ rockchip,grf = <&grf>;
|
||||
+ snps,axi-config = <&gmac0_stmmac_axi_setup>;
|
||||
+ snps,mixed-burst;
|
||||
+ snps,mtl-rx-config = <&gmac0_mtl_rx_setup>;
|
||||
+ snps,mtl-tx-config = <&gmac0_mtl_tx_setup>;
|
||||
+ snps,tso;
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ mdio0: mdio {
|
||||
+ compatible = "snps,dwmac-mdio";
|
||||
+ #address-cells = <0x1>;
|
||||
+ #size-cells = <0x0>;
|
||||
+ };
|
||||
+
|
||||
+ gmac0_stmmac_axi_setup: stmmac-axi-config {
|
||||
+ snps,blen = <0 0 0 0 16 8 4>;
|
||||
+ snps,rd_osr_lmt = <8>;
|
||||
+ snps,wr_osr_lmt = <4>;
|
||||
+ };
|
||||
+
|
||||
+ gmac0_mtl_rx_setup: rx-queues-config {
|
||||
+ snps,rx-queues-to-use = <1>;
|
||||
+ queue0 {};
|
||||
+ };
|
||||
+
|
||||
+ gmac0_mtl_tx_setup: tx-queues-config {
|
||||
+ snps,tx-queues-to-use = <1>;
|
||||
+ queue0 {};
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&cpu0_opp_table {
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
From 2dbcb2514c83416f2d0731bb0744a6c132f5c8c6 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Date: Thu, 5 Aug 2021 14:01:03 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: add core io domains node for rk356x
|
||||
|
||||
Enable the PMU IO domains for the RK3566 and the RK3568.
|
||||
|
||||
Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Link: https://lore.kernel.org/r/20210805120107.27007-4-michael.riesch@wolfvision.net
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -203,6 +203,11 @@
|
||||
pmugrf: syscon@fdc20000 {
|
||||
compatible = "rockchip,rk3568-pmugrf", "syscon", "simple-mfd";
|
||||
reg = <0x0 0xfdc20000 0x0 0x10000>;
|
||||
+
|
||||
+ pmu_io_domains: io-domains {
|
||||
+ compatible = "rockchip,rk3568-pmu-io-voltage-domain";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
};
|
||||
|
||||
grf: syscon@fdc60000 {
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
From 3d9170c3ea221f495902cc42fcea1c072c0af7c7 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Wed, 28 Jul 2021 14:00:29 -0400
|
||||
Subject: [PATCH] arm64: dts: rockchip: add rk356x gpio debounce clocks
|
||||
|
||||
The rk356x added a debounce clock to the gpio devices. This clock is
|
||||
necessary for the new v2 gpio driver to bind.
|
||||
Add the clocks to the rk356x device tree.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20210728180034.717953-4-pgwipeout@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -804,7 +804,7 @@
|
||||
compatible = "rockchip,gpio-bank";
|
||||
reg = <0x0 0xfdd60000 0x0 0x100>;
|
||||
interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
|
||||
- clocks = <&pmucru PCLK_GPIO0>;
|
||||
+ clocks = <&pmucru PCLK_GPIO0>, <&pmucru DBCLK_GPIO0>;
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
interrupt-controller;
|
||||
@@ -815,7 +815,7 @@
|
||||
compatible = "rockchip,gpio-bank";
|
||||
reg = <0x0 0xfe740000 0x0 0x100>;
|
||||
interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
|
||||
- clocks = <&cru PCLK_GPIO1>;
|
||||
+ clocks = <&cru PCLK_GPIO1>, <&cru DBCLK_GPIO1>;
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
interrupt-controller;
|
||||
@@ -826,7 +826,7 @@
|
||||
compatible = "rockchip,gpio-bank";
|
||||
reg = <0x0 0xfe750000 0x0 0x100>;
|
||||
interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
|
||||
- clocks = <&cru PCLK_GPIO2>;
|
||||
+ clocks = <&cru PCLK_GPIO2>, <&cru DBCLK_GPIO2>;
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
interrupt-controller;
|
||||
@@ -837,7 +837,7 @@
|
||||
compatible = "rockchip,gpio-bank";
|
||||
reg = <0x0 0xfe760000 0x0 0x100>;
|
||||
interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
|
||||
- clocks = <&cru PCLK_GPIO3>;
|
||||
+ clocks = <&cru PCLK_GPIO3>, <&cru DBCLK_GPIO3>;
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
interrupt-controller;
|
||||
@@ -848,7 +848,7 @@
|
||||
compatible = "rockchip,gpio-bank";
|
||||
reg = <0x0 0xfe770000 0x0 0x100>;
|
||||
interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
|
||||
- clocks = <&cru PCLK_GPIO4>;
|
||||
+ clocks = <&cru PCLK_GPIO4>, <&cru DBCLK_GPIO4>;
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
interrupt-controller;
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
From 1330875dc2a3742fd41127e78d5036f2d8f261da Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Wed, 28 Jul 2021 14:00:31 -0400
|
||||
Subject: [PATCH] arm64: dts: rockchip: add rk3568 tsadc nodes
|
||||
|
||||
Add the thermal and tsadc nodes to the rk3568 device tree.
|
||||
There are two sensors, one for the cpu, one for the gpu.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20210728180034.717953-6-pgwipeout@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
.../boot/dts/rockchip/rk3568-pinctrl.dtsi | 9 +++
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 70 +++++++++++++++++++
|
||||
2 files changed, 79 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3568-pinctrl.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568-pinctrl.dtsi
|
||||
@@ -3108,4 +3108,13 @@
|
||||
<4 RK_PA0 3 &pcfg_pull_none_drv_level_2>;
|
||||
};
|
||||
};
|
||||
+
|
||||
+ tsadc {
|
||||
+ /omit-if-no-ref/
|
||||
+ tsadc_pin: tsadc-pin {
|
||||
+ rockchip,pins =
|
||||
+ /* tsadc_pin */
|
||||
+ <0 RK_PA1 0 &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -50,6 +50,7 @@
|
||||
compatible = "arm,cortex-a55";
|
||||
reg = <0x0 0x0>;
|
||||
clocks = <&scmi_clk 0>;
|
||||
+ #cooling-cells = <2>;
|
||||
enable-method = "psci";
|
||||
operating-points-v2 = <&cpu0_opp_table>;
|
||||
};
|
||||
@@ -58,6 +59,7 @@
|
||||
device_type = "cpu";
|
||||
compatible = "arm,cortex-a55";
|
||||
reg = <0x0 0x100>;
|
||||
+ #cooling-cells = <2>;
|
||||
enable-method = "psci";
|
||||
operating-points-v2 = <&cpu0_opp_table>;
|
||||
};
|
||||
@@ -66,6 +68,7 @@
|
||||
device_type = "cpu";
|
||||
compatible = "arm,cortex-a55";
|
||||
reg = <0x0 0x200>;
|
||||
+ #cooling-cells = <2>;
|
||||
enable-method = "psci";
|
||||
operating-points-v2 = <&cpu0_opp_table>;
|
||||
};
|
||||
@@ -74,6 +77,7 @@
|
||||
device_type = "cpu";
|
||||
compatible = "arm,cortex-a55";
|
||||
reg = <0x0 0x300>;
|
||||
+ #cooling-cells = <2>;
|
||||
enable-method = "psci";
|
||||
operating-points-v2 = <&cpu0_opp_table>;
|
||||
};
|
||||
@@ -780,6 +784,72 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ thermal_zones: thermal-zones {
|
||||
+ cpu_thermal: cpu-thermal {
|
||||
+ polling-delay-passive = <100>;
|
||||
+ polling-delay = <1000>;
|
||||
+
|
||||
+ thermal-sensors = <&tsadc 0>;
|
||||
+
|
||||
+ trips {
|
||||
+ cpu_alert0: cpu_alert0 {
|
||||
+ temperature = <70000>;
|
||||
+ hysteresis = <2000>;
|
||||
+ type = "passive";
|
||||
+ };
|
||||
+ cpu_alert1: cpu_alert1 {
|
||||
+ temperature = <75000>;
|
||||
+ hysteresis = <2000>;
|
||||
+ type = "passive";
|
||||
+ };
|
||||
+ cpu_crit: cpu_crit {
|
||||
+ temperature = <95000>;
|
||||
+ hysteresis = <2000>;
|
||||
+ type = "critical";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ cooling-maps {
|
||||
+ map0 {
|
||||
+ trip = <&cpu_alert0>;
|
||||
+ cooling-device =
|
||||
+ <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ gpu_thermal: gpu-thermal {
|
||||
+ polling-delay-passive = <20>; /* milliseconds */
|
||||
+ polling-delay = <1000>; /* milliseconds */
|
||||
+
|
||||
+ thermal-sensors = <&tsadc 1>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ tsadc: tsadc@fe710000 {
|
||||
+ compatible = "rockchip,rk3568-tsadc";
|
||||
+ reg = <0x0 0xfe710000 0x0 0x100>;
|
||||
+ interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ assigned-clocks = <&cru CLK_TSADC_TSEN>, <&cru CLK_TSADC>;
|
||||
+ assigned-clock-rates = <17000000>, <700000>;
|
||||
+ clocks = <&cru CLK_TSADC>, <&cru PCLK_TSADC>;
|
||||
+ clock-names = "tsadc", "apb_pclk";
|
||||
+ resets = <&cru SRST_TSADC>, <&cru SRST_P_TSADC>,
|
||||
+ <&cru SRST_TSADCPHY>;
|
||||
+ reset-names = "tsadc", "tsadc-apb", "tsadc-phy";
|
||||
+ rockchip,grf = <&grf>;
|
||||
+ rockchip,hw-tshut-temp = <95000>;
|
||||
+ pinctrl-names = "init", "default", "sleep";
|
||||
+ pinctrl-0 = <&tsadc_pin>;
|
||||
+ pinctrl-1 = <&tsadc_shutorg>;
|
||||
+ pinctrl-2 = <&tsadc_pin>;
|
||||
+ #thermal-sensor-cells = <1>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
saradc: saradc@fe720000 {
|
||||
compatible = "rockchip,rk3568-saradc", "rockchip,rk3399-saradc";
|
||||
reg = <0x0 0xfe720000 0x0 0x100>;
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
From 95ad4dbe5f43bf67036775df56c848aa8ffea8e2 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Date: Mon, 23 Aug 2021 14:39:11 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: add missing rockchip,grf property to
|
||||
rk356x
|
||||
|
||||
This commit fixes the error messages
|
||||
|
||||
rockchip_clk_register_muxgrf: regmap not available
|
||||
rockchip_clk_register_branches: failed to register clock clk_ddr1x: -524
|
||||
|
||||
during boot by providing the missing rockchip,grf property.
|
||||
|
||||
Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Tested-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20210823123911.12095-2-michael.riesch@wolfvision.net
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -233,6 +233,7 @@
|
||||
#reset-cells = <1>;
|
||||
assigned-clocks = <&cru PLL_GPLL>, <&pmucru PLL_PPLL>;
|
||||
assigned-clock-rates = <1200000000>, <200000000>;
|
||||
+ rockchip,grf = <&grf>;
|
||||
};
|
||||
|
||||
i2c0: i2c@fdd40000 {
|
||||
|
|
@ -0,0 +1,207 @@
|
|||
From 98419a39d1dc276ac395c230ba2e6cf435a624b9 Mon Sep 17 00:00:00 2001
|
||||
From: Liang Chen <cl@rock-chips.com>
|
||||
Date: Mon, 26 Jul 2021 11:03:55 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: add pwm nodes for rk3568
|
||||
|
||||
Add the pwm controller nodes to the core rk3568 dtsi.
|
||||
|
||||
Signed-off-by: Liang Chen <cl@rock-chips.com>
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
Link: https://lore.kernel.org/r/20210726090355.1548483-2-heiko@sntech.de
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 176 +++++++++++++++++++++++
|
||||
1 file changed, 176 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -263,6 +263,50 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ pwm0: pwm@fdd70000 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfdd70000 0x0 0x10>;
|
||||
+ clocks = <&pmucru CLK_PWM0>, <&pmucru PCLK_PWM0>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm0m0_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm1: pwm@fdd70010 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfdd70010 0x0 0x10>;
|
||||
+ clocks = <&pmucru CLK_PWM0>, <&pmucru PCLK_PWM0>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm1m0_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm2: pwm@fdd70020 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfdd70020 0x0 0x10>;
|
||||
+ clocks = <&pmucru CLK_PWM0>, <&pmucru PCLK_PWM0>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm2m0_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm3: pwm@fdd70030 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfdd70030 0x0 0x10>;
|
||||
+ clocks = <&pmucru CLK_PWM0>, <&pmucru PCLK_PWM0>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm3_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
pmu: power-management@fdd90000 {
|
||||
compatible = "rockchip,rk3568-pmu", "syscon", "simple-mfd";
|
||||
reg = <0x0 0xfdd90000 0x0 0x1000>;
|
||||
@@ -863,6 +907,138 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ pwm4: pwm@fe6e0000 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfe6e0000 0x0 0x10>;
|
||||
+ clocks = <&cru CLK_PWM1>, <&cru PCLK_PWM1>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm4_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm5: pwm@fe6e0010 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfe6e0010 0x0 0x10>;
|
||||
+ clocks = <&cru CLK_PWM1>, <&cru PCLK_PWM1>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm5_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm6: pwm@fe6e0020 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfe6e0020 0x0 0x10>;
|
||||
+ clocks = <&cru CLK_PWM1>, <&cru PCLK_PWM1>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm6_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm7: pwm@fe6e0030 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfe6e0030 0x0 0x10>;
|
||||
+ clocks = <&cru CLK_PWM1>, <&cru PCLK_PWM1>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm7_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm8: pwm@fe6f0000 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfe6f0000 0x0 0x10>;
|
||||
+ clocks = <&cru CLK_PWM2>, <&cru PCLK_PWM2>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm8m0_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm9: pwm@fe6f0010 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfe6f0010 0x0 0x10>;
|
||||
+ clocks = <&cru CLK_PWM2>, <&cru PCLK_PWM2>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm9m0_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm10: pwm@fe6f0020 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfe6f0020 0x0 0x10>;
|
||||
+ clocks = <&cru CLK_PWM2>, <&cru PCLK_PWM2>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm10m0_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm11: pwm@fe6f0030 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfe6f0030 0x0 0x10>;
|
||||
+ clocks = <&cru CLK_PWM2>, <&cru PCLK_PWM2>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm11m0_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm12: pwm@fe700000 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfe700000 0x0 0x10>;
|
||||
+ clocks = <&cru CLK_PWM3>, <&cru PCLK_PWM3>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm12m0_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm13: pwm@fe700010 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfe700010 0x0 0x10>;
|
||||
+ clocks = <&cru CLK_PWM3>, <&cru PCLK_PWM3>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm13m0_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm14: pwm@fe700020 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfe700020 0x0 0x10>;
|
||||
+ clocks = <&cru CLK_PWM3>, <&cru PCLK_PWM3>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm14m0_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pwm15: pwm@fe700030 {
|
||||
+ compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
|
||||
+ reg = <0x0 0xfe700030 0x0 0x10>;
|
||||
+ clocks = <&cru CLK_PWM3>, <&cru PCLK_PWM3>;
|
||||
+ clock-names = "pwm", "pclk";
|
||||
+ pinctrl-0 = <&pwm15m0_pins>;
|
||||
+ pinctrl-names = "active";
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
pinctrl: pinctrl {
|
||||
compatible = "rockchip,rk3568-pinctrl";
|
||||
rockchip,grf = <&grf>;
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
From a65e6523e6dcf1dc4ea167ab78ca6fad01f16d91 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Fri, 15 Oct 2021 13:13:01 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: add spdif node to rk356x
|
||||
|
||||
This adds the spdif node to the rk356x device tree.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20211015111303.1365328-1-frattaroli.nicolas@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -608,6 +608,20 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ spdif: spdif@fe460000 {
|
||||
+ compatible = "rockchip,rk3568-spdif";
|
||||
+ reg = <0x0 0xfe460000 0x0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clock-names = "mclk", "hclk";
|
||||
+ clocks = <&cru MCLK_SPDIF_8CH>, <&cru HCLK_SPDIF_8CH>;
|
||||
+ dmas = <&dmac1 1>;
|
||||
+ dma-names = "tx";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spdifm0_tx>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
dmac0: dmac@fe530000 {
|
||||
compatible = "arm,pl330", "arm,primecell";
|
||||
reg = <0x0 0xfe530000 0x0 0x4000>;
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
From ef5c913570040df1955dd49cea221783468faeaf Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
|
||||
Date: Sat, 16 Oct 2021 12:53:52 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: Add i2s1 on rk356x
|
||||
|
||||
This adds the necessary device tree node on rk3566 and rk3568
|
||||
to enable the I2S1 TDM audio controller.
|
||||
|
||||
I2S0 has not been added, as it is connected to HDMI and there is
|
||||
no way to test that it's working without a functioning video
|
||||
clock (read: VOP2 driver).
|
||||
|
||||
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20211016105354.116513-4-frattaroli.nicolas@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 25 ++++++++++++++++++++++++
|
||||
1 file changed, 25 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -622,6 +622,31 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ i2s1_8ch: i2s@fe410000 {
|
||||
+ compatible = "rockchip,rk3568-i2s-tdm";
|
||||
+ reg = <0x0 0xfe410000 0x0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ assigned-clocks = <&cru CLK_I2S1_8CH_TX_SRC>, <&cru CLK_I2S1_8CH_RX_SRC>;
|
||||
+ assigned-clock-rates = <1188000000>, <1188000000>;
|
||||
+ clocks = <&cru MCLK_I2S1_8CH_TX>, <&cru MCLK_I2S1_8CH_RX>,
|
||||
+ <&cru HCLK_I2S1_8CH>;
|
||||
+ clock-names = "mclk_tx", "mclk_rx", "hclk";
|
||||
+ dmas = <&dmac1 3>, <&dmac1 2>;
|
||||
+ dma-names = "rx", "tx";
|
||||
+ resets = <&cru SRST_M_I2S1_8CH_TX>, <&cru SRST_M_I2S1_8CH_RX>;
|
||||
+ reset-names = "tx-m", "rx-m";
|
||||
+ rockchip,grf = <&grf>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&i2s1m0_sclktx &i2s1m0_sclkrx
|
||||
+ &i2s1m0_lrcktx &i2s1m0_lrckrx
|
||||
+ &i2s1m0_sdi0 &i2s1m0_sdi1
|
||||
+ &i2s1m0_sdi2 &i2s1m0_sdi3
|
||||
+ &i2s1m0_sdo0 &i2s1m0_sdo1
|
||||
+ &i2s1m0_sdo2 &i2s1m0_sdo3>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
dmac0: dmac@fe530000 {
|
||||
compatible = "arm,pl330", "arm,primecell";
|
||||
reg = <0x0 0xfe530000 0x0 0x4000>;
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
From 5c9e66c6b75a754025c74bde7b7a6c52674d8aa1 Mon Sep 17 00:00:00 2001
|
||||
From: Johan Jonker <jbx6244@gmail.com>
|
||||
Date: Thu, 30 Sep 2021 13:05:17 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: fix resets in tsadc node for rk356x
|
||||
|
||||
In the rockchip_thermal.c driver we now get the resets with
|
||||
a devm_reset_control_array_get() function, so remove
|
||||
the reset-names property as it is no longer needed.
|
||||
Although no longer required in rockchip-thermal.yaml
|
||||
sort tsadc-apb as first item.
|
||||
|
||||
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20210930110517.14323-4-jbx6244@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -921,9 +921,8 @@
|
||||
assigned-clock-rates = <17000000>, <700000>;
|
||||
clocks = <&cru CLK_TSADC>, <&cru PCLK_TSADC>;
|
||||
clock-names = "tsadc", "apb_pclk";
|
||||
- resets = <&cru SRST_TSADC>, <&cru SRST_P_TSADC>,
|
||||
+ resets = <&cru SRST_P_TSADC>, <&cru SRST_TSADC>,
|
||||
<&cru SRST_TSADCPHY>;
|
||||
- reset-names = "tsadc", "tsadc-apb", "tsadc-phy";
|
||||
rockchip,grf = <&grf>;
|
||||
rockchip,hw-tshut-temp = <95000>;
|
||||
pinctrl-names = "init", "default", "sleep";
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
From aaa552d84580e9213d0e2bf0f9243477d1227bdd Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
|
||||
Date: Sat, 27 Nov 2021 15:19:08 +0100
|
||||
Subject: [PATCH] arm64: dts: rockchip: Add spi nodes on rk356x
|
||||
|
||||
This adds the four spi nodes (spi0, spi1, spi2, spi3) to the
|
||||
rk356x dtsi. These are from the downstream device tree, though
|
||||
I have double-checked that their interrupts and DMA numbers are
|
||||
correct. I have also tested spi1 with an SPI device.
|
||||
|
||||
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20211127141910.12649-3-frattaroli.nicolas@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 64 ++++++++++++++++++++++++
|
||||
1 file changed, 64 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -39,6 +39,10 @@
|
||||
serial7 = &uart7;
|
||||
serial8 = &uart8;
|
||||
serial9 = &uart9;
|
||||
+ spi0 = &spi0;
|
||||
+ spi1 = &spi1;
|
||||
+ spi2 = &spi2;
|
||||
+ spi3 = &spi3;
|
||||
};
|
||||
|
||||
cpus {
|
||||
@@ -742,6 +746,66 @@
|
||||
clock-names = "tclk", "pclk";
|
||||
};
|
||||
|
||||
+ spi0: spi@fe610000 {
|
||||
+ compatible = "rockchip,rk3568-spi", "rockchip,rk3066-spi";
|
||||
+ reg = <0x0 0xfe610000 0x0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru CLK_SPI0>, <&cru PCLK_SPI0>;
|
||||
+ clock-names = "spiclk", "apb_pclk";
|
||||
+ dmas = <&dmac0 20>, <&dmac0 21>;
|
||||
+ dma-names = "tx", "rx";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi0m0_cs0 &spi0m0_cs1 &spi0m0_pins>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ spi1: spi@fe620000 {
|
||||
+ compatible = "rockchip,rk3568-spi", "rockchip,rk3066-spi";
|
||||
+ reg = <0x0 0xfe620000 0x0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru CLK_SPI1>, <&cru PCLK_SPI1>;
|
||||
+ clock-names = "spiclk", "apb_pclk";
|
||||
+ dmas = <&dmac0 22>, <&dmac0 23>;
|
||||
+ dma-names = "tx", "rx";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi1m0_cs0 &spi1m0_cs1 &spi1m0_pins>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ spi2: spi@fe630000 {
|
||||
+ compatible = "rockchip,rk3568-spi", "rockchip,rk3066-spi";
|
||||
+ reg = <0x0 0xfe630000 0x0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru CLK_SPI2>, <&cru PCLK_SPI2>;
|
||||
+ clock-names = "spiclk", "apb_pclk";
|
||||
+ dmas = <&dmac0 24>, <&dmac0 25>;
|
||||
+ dma-names = "tx", "rx";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi2m0_cs0 &spi2m0_cs1 &spi2m0_pins>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ spi3: spi@fe640000 {
|
||||
+ compatible = "rockchip,rk3568-spi", "rockchip,rk3066-spi";
|
||||
+ reg = <0x0 0xfe640000 0x0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru CLK_SPI3>, <&cru PCLK_SPI3>;
|
||||
+ clock-names = "spiclk", "apb_pclk";
|
||||
+ dmas = <&dmac0 26>, <&dmac0 27>;
|
||||
+ dma-names = "tx", "rx";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi3m0_cs0 &spi3m0_cs1 &spi3m0_pins>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
uart1: serial@fe650000 {
|
||||
compatible = "rockchip,rk3568-uart", "snps,dw-apb-uart";
|
||||
reg = <0x0 0xfe650000 0x0 0x100>;
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
From cca4da59db28cdd284d34835be9f109f37bf0803 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Wed, 15 Dec 2021 16:02:51 -0500
|
||||
Subject: [PATCH] arm64: dts: rockchip: add usb2 nodes to rk3568 device tree
|
||||
|
||||
Add the requisite nodes to the rk3568 device tree to enable the usb2
|
||||
device controllers.
|
||||
Includes the usb2phy nodes, usb2phy grf nodes, and usb2 controller
|
||||
nodes.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Tested-by: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Link: https://lore.kernel.org/r/20211215210252.120923-8-pgwipeout@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 98 ++++++++++++++++++++++++
|
||||
1 file changed, 98 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -208,6 +208,50 @@
|
||||
msi-controller;
|
||||
};
|
||||
|
||||
+ usb_host0_ehci: usb@fd800000 {
|
||||
+ compatible = "generic-ehci";
|
||||
+ reg = <0x0 0xfd800000 0x0 0x40000>;
|
||||
+ interrupts = <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru HCLK_USB2HOST0>, <&cru HCLK_USB2HOST0_ARB>,
|
||||
+ <&cru PCLK_USB>;
|
||||
+ phys = <&u2phy1_otg>;
|
||||
+ phy-names = "usb";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ usb_host0_ohci: usb@fd840000 {
|
||||
+ compatible = "generic-ohci";
|
||||
+ reg = <0x0 0xfd840000 0x0 0x40000>;
|
||||
+ interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru HCLK_USB2HOST0>, <&cru HCLK_USB2HOST0_ARB>,
|
||||
+ <&cru PCLK_USB>;
|
||||
+ phys = <&u2phy1_otg>;
|
||||
+ phy-names = "usb";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ usb_host1_ehci: usb@fd880000 {
|
||||
+ compatible = "generic-ehci";
|
||||
+ reg = <0x0 0xfd880000 0x0 0x40000>;
|
||||
+ interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru HCLK_USB2HOST1>, <&cru HCLK_USB2HOST1_ARB>,
|
||||
+ <&cru PCLK_USB>;
|
||||
+ phys = <&u2phy1_host>;
|
||||
+ phy-names = "usb";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ usb_host1_ohci: usb@fd8c0000 {
|
||||
+ compatible = "generic-ohci";
|
||||
+ reg = <0x0 0xfd8c0000 0x0 0x40000>;
|
||||
+ interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru HCLK_USB2HOST1>, <&cru HCLK_USB2HOST1_ARB>,
|
||||
+ <&cru PCLK_USB>;
|
||||
+ phys = <&u2phy1_host>;
|
||||
+ phy-names = "usb";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
pmugrf: syscon@fdc20000 {
|
||||
compatible = "rockchip,rk3568-pmugrf", "syscon", "simple-mfd";
|
||||
reg = <0x0 0xfdc20000 0x0 0x10000>;
|
||||
@@ -223,6 +267,16 @@
|
||||
reg = <0x0 0xfdc60000 0x0 0x10000>;
|
||||
};
|
||||
|
||||
+ usb2phy0_grf: syscon@fdca0000 {
|
||||
+ compatible = "rockchip,rk3568-usb2phy-grf", "syscon";
|
||||
+ reg = <0x0 0xfdca0000 0x0 0x8000>;
|
||||
+ };
|
||||
+
|
||||
+ usb2phy1_grf: syscon@fdca8000 {
|
||||
+ compatible = "rockchip,rk3568-usb2phy-grf", "syscon";
|
||||
+ reg = <0x0 0xfdca8000 0x0 0x8000>;
|
||||
+ };
|
||||
+
|
||||
pmucru: clock-controller@fdd00000 {
|
||||
compatible = "rockchip,rk3568-pmucru";
|
||||
reg = <0x0 0xfdd00000 0x0 0x1000>;
|
||||
@@ -1141,6 +1195,50 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ u2phy0: usb2phy@fe8a0000 {
|
||||
+ compatible = "rockchip,rk3568-usb2phy";
|
||||
+ reg = <0x0 0xfe8a0000 0x0 0x10000>;
|
||||
+ clocks = <&pmucru CLK_USBPHY0_REF>;
|
||||
+ clock-names = "phyclk";
|
||||
+ clock-output-names = "clk_usbphy0_480m";
|
||||
+ interrupts = <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ rockchip,usbgrf = <&usb2phy0_grf>;
|
||||
+ #clock-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ u2phy0_host: host-port {
|
||||
+ #phy-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ u2phy0_otg: otg-port {
|
||||
+ #phy-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ u2phy1: usb2phy@fe8b0000 {
|
||||
+ compatible = "rockchip,rk3568-usb2phy";
|
||||
+ reg = <0x0 0xfe8b0000 0x0 0x10000>;
|
||||
+ clocks = <&pmucru CLK_USBPHY1_REF>;
|
||||
+ clock-names = "phyclk";
|
||||
+ clock-output-names = "clk_usbphy1_480m";
|
||||
+ interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ rockchip,usbgrf = <&usb2phy1_grf>;
|
||||
+ #clock-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ u2phy1_host: host-port {
|
||||
+ #phy-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ u2phy1_otg: otg-port {
|
||||
+ #phy-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
pinctrl: pinctrl {
|
||||
compatible = "rockchip,rk3568-pinctrl";
|
||||
rockchip,grf = <&grf>;
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
From 85a8bccfa945680dc561f06b65ea01341d2033fc Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Sun, 23 Jan 2022 14:35:10 +0100
|
||||
Subject: [PATCH] arm64: dts: rockchip: drop pclk_xpcs from gmac0 on rk3568
|
||||
|
||||
pclk_xpcs is not supported by mainline driver and breaks dtbs_check
|
||||
|
||||
following warnings occour, and many more
|
||||
|
||||
rk3568-evb1-v10.dt.yaml: ethernet@fe2a0000: clocks:
|
||||
[[15, 386], [15, 389], [15, 389], [15, 184], [15, 180], [15, 181],
|
||||
[15, 389], [15, 185], [15, 172]] is too long
|
||||
From schema: Documentation/devicetree/bindings/net/snps,dwmac.yaml
|
||||
rk3568-evb1-v10.dt.yaml: ethernet@fe2a0000: clock-names:
|
||||
['stmmaceth', 'mac_clk_rx', 'mac_clk_tx', 'clk_mac_refout', 'aclk_mac',
|
||||
'pclk_mac', 'clk_mac_speed', 'ptp_ref', 'pclk_xpcs'] is too long
|
||||
From schema: Documentation/devicetree/bindings/net/snps,dwmac.yaml
|
||||
|
||||
after removing it, the clock and other warnings are gone.
|
||||
|
||||
pclk_xpcs on gmac is used to support QSGMII, but this requires a driver
|
||||
supporting it.
|
||||
Once xpcs support is introduced, the clock can be added to the
|
||||
documentation and both controllers.
|
||||
|
||||
Fixes: b8d41e5053cd ("arm64: dts: rockchip: add gmac0 node to rk3568")
|
||||
Co-developed-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Acked-by: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Link: https://lore.kernel.org/r/20220123133510.135651-1-linux@fw-web.de
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3568.dtsi | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
@@ -32,13 +32,11 @@
|
||||
clocks = <&cru SCLK_GMAC0>, <&cru SCLK_GMAC0_RX_TX>,
|
||||
<&cru SCLK_GMAC0_RX_TX>, <&cru CLK_MAC0_REFOUT>,
|
||||
<&cru ACLK_GMAC0>, <&cru PCLK_GMAC0>,
|
||||
- <&cru SCLK_GMAC0_RX_TX>, <&cru CLK_GMAC0_PTP_REF>,
|
||||
- <&cru PCLK_XPCS>;
|
||||
+ <&cru SCLK_GMAC0_RX_TX>, <&cru CLK_GMAC0_PTP_REF>;
|
||||
clock-names = "stmmaceth", "mac_clk_rx",
|
||||
"mac_clk_tx", "clk_mac_refout",
|
||||
"aclk_mac", "pclk_mac",
|
||||
- "clk_mac_speed", "ptp_ref",
|
||||
- "pclk_xpcs";
|
||||
+ "clk_mac_speed", "ptp_ref";
|
||||
resets = <&cru SRST_A_GMAC0>;
|
||||
reset-names = "stmmaceth";
|
||||
rockchip,grf = <&grf>;
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
From 9c19c531dc98d7ba49b44802a607042e763ebe21 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Wed, 15 Dec 2021 16:02:47 -0500
|
||||
Subject: [PATCH] phy: phy-rockchip-inno-usb2: support #address_cells = 2
|
||||
|
||||
New Rockchip devices have the usb phy nodes as standalone devices.
|
||||
These nodes have register nodes with #address_cells = 2, but only use 32
|
||||
bit addresses.
|
||||
|
||||
Adjust the driver to check if the returned address is "0", and adjust
|
||||
the index in that case.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Tested-by: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Link: https://lore.kernel.org/r/20211215210252.120923-4-pgwipeout@gmail.com
|
||||
Signed-off-by: Vinod Koul <vkoul@kernel.org>
|
||||
---
|
||||
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 11 ++++++++++-
|
||||
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
|
||||
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
|
||||
@@ -1100,12 +1100,21 @@ static int rockchip_usb2phy_probe(struct
|
||||
rphy->usbgrf = NULL;
|
||||
}
|
||||
|
||||
- if (of_property_read_u32(np, "reg", ®)) {
|
||||
+ if (of_property_read_u32_index(np, "reg", 0, ®)) {
|
||||
dev_err(dev, "the reg property is not assigned in %pOFn node\n",
|
||||
np);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+ /* support address_cells=2 */
|
||||
+ if (reg == 0) {
|
||||
+ if (of_property_read_u32_index(np, "reg", 1, ®)) {
|
||||
+ dev_err(dev, "the reg property is not assigned in %pOFn node\n",
|
||||
+ np);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
rphy->dev = dev;
|
||||
phy_cfgs = match->data;
|
||||
rphy->chg_state = USB_CHG_STATE_UNDEFINED;
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
From e6915e1acca57bc4fdb61dccd5cc2e49f72ef743 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Wed, 15 Dec 2021 16:02:48 -0500
|
||||
Subject: [PATCH] phy: phy-rockchip-inno-usb2: support standalone phy nodes
|
||||
|
||||
New Rockchip devices have the usb2 phy devices as standalone nodes
|
||||
instead of children of the grf node.
|
||||
Allow the driver to find the grf node from a phandle.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Tested-by: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Link: https://lore.kernel.org/r/20211215210252.120923-5-pgwipeout@gmail.com
|
||||
Signed-off-by: Vinod Koul <vkoul@kernel.org>
|
||||
---
|
||||
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 17 ++++++++++++-----
|
||||
1 file changed, 12 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
|
||||
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
|
||||
@@ -1083,12 +1083,19 @@ static int rockchip_usb2phy_probe(struct
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
- if (!dev->parent || !dev->parent->of_node)
|
||||
- return -EINVAL;
|
||||
+ if (!dev->parent || !dev->parent->of_node) {
|
||||
+ rphy->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,usbgrf");
|
||||
+ if (IS_ERR(rphy->grf)) {
|
||||
+ dev_err(dev, "failed to locate usbgrf\n");
|
||||
+ return PTR_ERR(rphy->grf);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- rphy->grf = syscon_node_to_regmap(dev->parent->of_node);
|
||||
- if (IS_ERR(rphy->grf))
|
||||
- return PTR_ERR(rphy->grf);
|
||||
+ else {
|
||||
+ rphy->grf = syscon_node_to_regmap(dev->parent->of_node);
|
||||
+ if (IS_ERR(rphy->grf))
|
||||
+ return PTR_ERR(rphy->grf);
|
||||
+ }
|
||||
|
||||
if (of_device_is_compatible(np, "rockchip,rv1108-usb2phy")) {
|
||||
rphy->usbgrf =
|
||||
|
|
@ -0,0 +1,237 @@
|
|||
From ed2b5a8e6b98d042b323afbe177a5dc618921b31 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Wed, 15 Dec 2021 16:02:49 -0500
|
||||
Subject: [PATCH] phy: phy-rockchip-inno-usb2: support muxed interrupts
|
||||
|
||||
The rk3568 usb2phy has a single muxed interrupt that handles all
|
||||
interrupts.
|
||||
Allow the driver to plug in only a single interrupt as necessary.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Tested-by: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Link: https://lore.kernel.org/r/20211215210252.120923-6-pgwipeout@gmail.com
|
||||
Signed-off-by: Vinod Koul <vkoul@kernel.org>
|
||||
---
|
||||
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 168 +++++++++++++-----
|
||||
1 file changed, 119 insertions(+), 49 deletions(-)
|
||||
|
||||
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
|
||||
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
|
||||
@@ -204,6 +204,7 @@ struct rockchip_usb2phy_port {
|
||||
* @dcd_retries: The retry count used to track Data contact
|
||||
* detection process.
|
||||
* @edev: extcon device for notification registration
|
||||
+ * @irq: muxed interrupt for single irq configuration
|
||||
* @phy_cfg: phy register configuration, assigned by driver data.
|
||||
* @ports: phy port instance.
|
||||
*/
|
||||
@@ -218,6 +219,7 @@ struct rockchip_usb2phy {
|
||||
enum power_supply_type chg_type;
|
||||
u8 dcd_retries;
|
||||
struct extcon_dev *edev;
|
||||
+ int irq;
|
||||
const struct rockchip_usb2phy_cfg *phy_cfg;
|
||||
struct rockchip_usb2phy_port ports[USB2PHY_NUM_PORTS];
|
||||
};
|
||||
@@ -936,6 +938,102 @@ static irqreturn_t rockchip_usb2phy_otg_
|
||||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
+static irqreturn_t rockchip_usb2phy_irq(int irq, void *data)
|
||||
+{
|
||||
+ struct rockchip_usb2phy *rphy = data;
|
||||
+ struct rockchip_usb2phy_port *rport;
|
||||
+ irqreturn_t ret = IRQ_NONE;
|
||||
+ unsigned int index;
|
||||
+
|
||||
+ for (index = 0; index < rphy->phy_cfg->num_ports; index++) {
|
||||
+ rport = &rphy->ports[index];
|
||||
+ if (!rport->phy)
|
||||
+ continue;
|
||||
+
|
||||
+ /* Handle linestate irq for both otg port and host port */
|
||||
+ ret = rockchip_usb2phy_linestate_irq(irq, rport);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int rockchip_usb2phy_port_irq_init(struct rockchip_usb2phy *rphy,
|
||||
+ struct rockchip_usb2phy_port *rport,
|
||||
+ struct device_node *child_np)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ /*
|
||||
+ * If the usb2 phy used combined irq for otg and host port,
|
||||
+ * don't need to init otg and host port irq separately.
|
||||
+ */
|
||||
+ if (rphy->irq > 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ switch (rport->port_id) {
|
||||
+ case USB2PHY_PORT_HOST:
|
||||
+ rport->ls_irq = of_irq_get_byname(child_np, "linestate");
|
||||
+ if (rport->ls_irq < 0) {
|
||||
+ dev_err(rphy->dev, "no linestate irq provided\n");
|
||||
+ return rport->ls_irq;
|
||||
+ }
|
||||
+
|
||||
+ ret = devm_request_threaded_irq(rphy->dev, rport->ls_irq, NULL,
|
||||
+ rockchip_usb2phy_linestate_irq,
|
||||
+ IRQF_ONESHOT,
|
||||
+ "rockchip_usb2phy", rport);
|
||||
+ if (ret) {
|
||||
+ dev_err(rphy->dev, "failed to request linestate irq handle\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+ break;
|
||||
+ case USB2PHY_PORT_OTG:
|
||||
+ /*
|
||||
+ * Some SoCs use one interrupt with otg-id/otg-bvalid/linestate
|
||||
+ * interrupts muxed together, so probe the otg-mux interrupt first,
|
||||
+ * if not found, then look for the regular interrupts one by one.
|
||||
+ */
|
||||
+ rport->otg_mux_irq = of_irq_get_byname(child_np, "otg-mux");
|
||||
+ if (rport->otg_mux_irq > 0) {
|
||||
+ ret = devm_request_threaded_irq(rphy->dev, rport->otg_mux_irq,
|
||||
+ NULL,
|
||||
+ rockchip_usb2phy_otg_mux_irq,
|
||||
+ IRQF_ONESHOT,
|
||||
+ "rockchip_usb2phy_otg",
|
||||
+ rport);
|
||||
+ if (ret) {
|
||||
+ dev_err(rphy->dev,
|
||||
+ "failed to request otg-mux irq handle\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+ } else {
|
||||
+ rport->bvalid_irq = of_irq_get_byname(child_np, "otg-bvalid");
|
||||
+ if (rport->bvalid_irq < 0) {
|
||||
+ dev_err(rphy->dev, "no vbus valid irq provided\n");
|
||||
+ ret = rport->bvalid_irq;
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = devm_request_threaded_irq(rphy->dev, rport->bvalid_irq,
|
||||
+ NULL,
|
||||
+ rockchip_usb2phy_bvalid_irq,
|
||||
+ IRQF_ONESHOT,
|
||||
+ "rockchip_usb2phy_bvalid",
|
||||
+ rport);
|
||||
+ if (ret) {
|
||||
+ dev_err(rphy->dev,
|
||||
+ "failed to request otg-bvalid irq handle\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int rockchip_usb2phy_host_port_init(struct rockchip_usb2phy *rphy,
|
||||
struct rockchip_usb2phy_port *rport,
|
||||
struct device_node *child_np)
|
||||
@@ -949,18 +1047,9 @@ static int rockchip_usb2phy_host_port_in
|
||||
mutex_init(&rport->mutex);
|
||||
INIT_DELAYED_WORK(&rport->sm_work, rockchip_usb2phy_sm_work);
|
||||
|
||||
- rport->ls_irq = of_irq_get_byname(child_np, "linestate");
|
||||
- if (rport->ls_irq < 0) {
|
||||
- dev_err(rphy->dev, "no linestate irq provided\n");
|
||||
- return rport->ls_irq;
|
||||
- }
|
||||
-
|
||||
- ret = devm_request_threaded_irq(rphy->dev, rport->ls_irq, NULL,
|
||||
- rockchip_usb2phy_linestate_irq,
|
||||
- IRQF_ONESHOT,
|
||||
- "rockchip_usb2phy", rport);
|
||||
+ ret = rockchip_usb2phy_port_irq_init(rphy, rport, child_np);
|
||||
if (ret) {
|
||||
- dev_err(rphy->dev, "failed to request linestate irq handle\n");
|
||||
+ dev_err(rphy->dev, "failed to setup host irq\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1009,44 +1098,10 @@ static int rockchip_usb2phy_otg_port_ini
|
||||
INIT_DELAYED_WORK(&rport->chg_work, rockchip_chg_detect_work);
|
||||
INIT_DELAYED_WORK(&rport->otg_sm_work, rockchip_usb2phy_otg_sm_work);
|
||||
|
||||
- /*
|
||||
- * Some SoCs use one interrupt with otg-id/otg-bvalid/linestate
|
||||
- * interrupts muxed together, so probe the otg-mux interrupt first,
|
||||
- * if not found, then look for the regular interrupts one by one.
|
||||
- */
|
||||
- rport->otg_mux_irq = of_irq_get_byname(child_np, "otg-mux");
|
||||
- if (rport->otg_mux_irq > 0) {
|
||||
- ret = devm_request_threaded_irq(rphy->dev, rport->otg_mux_irq,
|
||||
- NULL,
|
||||
- rockchip_usb2phy_otg_mux_irq,
|
||||
- IRQF_ONESHOT,
|
||||
- "rockchip_usb2phy_otg",
|
||||
- rport);
|
||||
- if (ret) {
|
||||
- dev_err(rphy->dev,
|
||||
- "failed to request otg-mux irq handle\n");
|
||||
- goto out;
|
||||
- }
|
||||
- } else {
|
||||
- rport->bvalid_irq = of_irq_get_byname(child_np, "otg-bvalid");
|
||||
- if (rport->bvalid_irq < 0) {
|
||||
- dev_err(rphy->dev, "no vbus valid irq provided\n");
|
||||
- ret = rport->bvalid_irq;
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- ret = devm_request_threaded_irq(rphy->dev, rport->bvalid_irq,
|
||||
- NULL,
|
||||
- rockchip_usb2phy_bvalid_irq,
|
||||
- IRQF_ONESHOT,
|
||||
- "rockchip_usb2phy_bvalid",
|
||||
- rport);
|
||||
- if (ret) {
|
||||
- dev_err(rphy->dev,
|
||||
- "failed to request otg-bvalid irq handle\n");
|
||||
- goto out;
|
||||
- }
|
||||
- }
|
||||
+ ret = rockchip_usb2phy_port_irq_init(rphy, rport, child_np);
|
||||
+ if (ret) {
|
||||
+ dev_err(rphy->dev, "failed to init irq for host port\n");
|
||||
+ goto out;
|
||||
|
||||
if (!IS_ERR(rphy->edev)) {
|
||||
rport->event_nb.notifier_call = rockchip_otg_event;
|
||||
@@ -1126,6 +1181,7 @@ static int rockchip_usb2phy_probe(struct
|
||||
phy_cfgs = match->data;
|
||||
rphy->chg_state = USB_CHG_STATE_UNDEFINED;
|
||||
rphy->chg_type = POWER_SUPPLY_TYPE_UNKNOWN;
|
||||
+ rphy->irq = platform_get_irq_optional(pdev, 0);
|
||||
platform_set_drvdata(pdev, rphy);
|
||||
|
||||
ret = rockchip_usb2phy_extcon_register(rphy);
|
||||
@@ -1205,6 +1261,20 @@ next_child:
|
||||
}
|
||||
|
||||
provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
|
||||
+
|
||||
+ if (rphy->irq > 0) {
|
||||
+ ret = devm_request_threaded_irq(rphy->dev, rphy->irq, NULL,
|
||||
+ rockchip_usb2phy_irq,
|
||||
+ IRQF_ONESHOT,
|
||||
+ "rockchip_usb2phy",
|
||||
+ rphy);
|
||||
+ if (ret) {
|
||||
+ dev_err(rphy->dev,
|
||||
+ "failed to request usb2phy irq handle\n");
|
||||
+ goto put_child;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return PTR_ERR_OR_ZERO(provider);
|
||||
|
||||
put_child:
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
From 42b559727a45d79c811f493515eb9b7e56016421 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Wed, 15 Dec 2021 16:02:50 -0500
|
||||
Subject: [PATCH] phy: phy-rockchip-inno-usb2: add rk3568 support
|
||||
|
||||
The rk3568 usb2phy is a standalone device with a single muxed interrupt.
|
||||
Add support for the registers to the usb2phy driver.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Tested-by: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Link: https://lore.kernel.org/r/20211215210252.120923-7-pgwipeout@gmail.com
|
||||
Signed-off-by: Vinod Koul <vkoul@kernel.org>
|
||||
---
|
||||
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 65 +++++++++++++++++++
|
||||
1 file changed, 65 insertions(+)
|
||||
|
||||
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
|
||||
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
|
||||
@@ -1102,6 +1102,7 @@ static int rockchip_usb2phy_otg_port_ini
|
||||
if (ret) {
|
||||
dev_err(rphy->dev, "failed to init irq for host port\n");
|
||||
goto out;
|
||||
+ }
|
||||
|
||||
if (!IS_ERR(rphy->edev)) {
|
||||
rport->event_nb.notifier_call = rockchip_otg_event;
|
||||
@@ -1513,6 +1514,69 @@ static const struct rockchip_usb2phy_cfg
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
+static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = {
|
||||
+ {
|
||||
+ .reg = 0xfe8a0000,
|
||||
+ .num_ports = 2,
|
||||
+ .clkout_ctl = { 0x0008, 4, 4, 1, 0 },
|
||||
+ .port_cfgs = {
|
||||
+ [USB2PHY_PORT_OTG] = {
|
||||
+ .phy_sus = { 0x0000, 8, 0, 0, 0x1d1 },
|
||||
+ .bvalid_det_en = { 0x0080, 2, 2, 0, 1 },
|
||||
+ .bvalid_det_st = { 0x0084, 2, 2, 0, 1 },
|
||||
+ .bvalid_det_clr = { 0x0088, 2, 2, 0, 1 },
|
||||
+ .utmi_avalid = { 0x00c0, 10, 10, 0, 1 },
|
||||
+ .utmi_bvalid = { 0x00c0, 9, 9, 0, 1 },
|
||||
+ },
|
||||
+ [USB2PHY_PORT_HOST] = {
|
||||
+ /* Select suspend control from controller */
|
||||
+ .phy_sus = { 0x0004, 8, 0, 0x1d2, 0x1d2 },
|
||||
+ .ls_det_en = { 0x0080, 1, 1, 0, 1 },
|
||||
+ .ls_det_st = { 0x0084, 1, 1, 0, 1 },
|
||||
+ .ls_det_clr = { 0x0088, 1, 1, 0, 1 },
|
||||
+ .utmi_ls = { 0x00c0, 17, 16, 0, 1 },
|
||||
+ .utmi_hstdet = { 0x00c0, 19, 19, 0, 1 }
|
||||
+ }
|
||||
+ },
|
||||
+ .chg_det = {
|
||||
+ .opmode = { 0x0000, 3, 0, 5, 1 },
|
||||
+ .cp_det = { 0x00c0, 24, 24, 0, 1 },
|
||||
+ .dcp_det = { 0x00c0, 23, 23, 0, 1 },
|
||||
+ .dp_det = { 0x00c0, 25, 25, 0, 1 },
|
||||
+ .idm_sink_en = { 0x0008, 8, 8, 0, 1 },
|
||||
+ .idp_sink_en = { 0x0008, 7, 7, 0, 1 },
|
||||
+ .idp_src_en = { 0x0008, 9, 9, 0, 1 },
|
||||
+ .rdm_pdwn_en = { 0x0008, 10, 10, 0, 1 },
|
||||
+ .vdm_src_en = { 0x0008, 12, 12, 0, 1 },
|
||||
+ .vdp_src_en = { 0x0008, 11, 11, 0, 1 },
|
||||
+ },
|
||||
+ },
|
||||
+ {
|
||||
+ .reg = 0xfe8b0000,
|
||||
+ .num_ports = 2,
|
||||
+ .clkout_ctl = { 0x0008, 4, 4, 1, 0 },
|
||||
+ .port_cfgs = {
|
||||
+ [USB2PHY_PORT_OTG] = {
|
||||
+ .phy_sus = { 0x0000, 8, 0, 0x1d2, 0x1d1 },
|
||||
+ .ls_det_en = { 0x0080, 0, 0, 0, 1 },
|
||||
+ .ls_det_st = { 0x0084, 0, 0, 0, 1 },
|
||||
+ .ls_det_clr = { 0x0088, 0, 0, 0, 1 },
|
||||
+ .utmi_ls = { 0x00c0, 5, 4, 0, 1 },
|
||||
+ .utmi_hstdet = { 0x00c0, 7, 7, 0, 1 }
|
||||
+ },
|
||||
+ [USB2PHY_PORT_HOST] = {
|
||||
+ .phy_sus = { 0x0004, 8, 0, 0x1d2, 0x1d1 },
|
||||
+ .ls_det_en = { 0x0080, 1, 1, 0, 1 },
|
||||
+ .ls_det_st = { 0x0084, 1, 1, 0, 1 },
|
||||
+ .ls_det_clr = { 0x0088, 1, 1, 0, 1 },
|
||||
+ .utmi_ls = { 0x00c0, 17, 16, 0, 1 },
|
||||
+ .utmi_hstdet = { 0x00c0, 19, 19, 0, 1 }
|
||||
+ }
|
||||
+ },
|
||||
+ },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+
|
||||
static const struct rockchip_usb2phy_cfg rv1108_phy_cfgs[] = {
|
||||
{
|
||||
.reg = 0x100,
|
||||
@@ -1562,6 +1626,7 @@ static const struct of_device_id rockchi
|
||||
{ .compatible = "rockchip,rk3328-usb2phy", .data = &rk3328_phy_cfgs },
|
||||
{ .compatible = "rockchip,rk3366-usb2phy", .data = &rk3366_phy_cfgs },
|
||||
{ .compatible = "rockchip,rk3399-usb2phy", .data = &rk3399_phy_cfgs },
|
||||
+ { .compatible = "rockchip,rk3568-usb2phy", .data = &rk3568_phy_cfgs },
|
||||
{ .compatible = "rockchip,rv1108-usb2phy", .data = &rv1108_phy_cfgs },
|
||||
{}
|
||||
};
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
From 78f7186095db5a64009d44c18843a03dbc72d896 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Date: Thu, 27 Jan 2022 20:04:55 +0100
|
||||
Subject: [PATCH] arm64: dts: rockchip: rename and sort the rk356x usb2 phy
|
||||
handles
|
||||
|
||||
All nodes and handles related to USB have the prefix usb or usb2,
|
||||
whereas the phy handles are prefixed with u2phy. Rename for
|
||||
consistency reasons and to facilitate sorting.
|
||||
|
||||
This patch also updates the handles in the only board file that
|
||||
uses them (rk3566-quartz64-a.dts).
|
||||
|
||||
Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Link: https://lore.kernel.org/r/20220127190456.2195527-1-michael.riesch@wolfvision.net
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
.../boot/dts/rockchip/rk3566-quartz64-a.dts | 18 ++++++++---------
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 20 +++++++++----------
|
||||
2 files changed, 19 insertions(+), 19 deletions(-)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -214,7 +214,7 @@
|
||||
interrupts = <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&cru HCLK_USB2HOST0>, <&cru HCLK_USB2HOST0_ARB>,
|
||||
<&cru PCLK_USB>;
|
||||
- phys = <&u2phy1_otg>;
|
||||
+ phys = <&usb2phy1_otg>;
|
||||
phy-names = "usb";
|
||||
status = "disabled";
|
||||
};
|
||||
@@ -225,7 +225,7 @@
|
||||
interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&cru HCLK_USB2HOST0>, <&cru HCLK_USB2HOST0_ARB>,
|
||||
<&cru PCLK_USB>;
|
||||
- phys = <&u2phy1_otg>;
|
||||
+ phys = <&usb2phy1_otg>;
|
||||
phy-names = "usb";
|
||||
status = "disabled";
|
||||
};
|
||||
@@ -236,7 +236,7 @@
|
||||
interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&cru HCLK_USB2HOST1>, <&cru HCLK_USB2HOST1_ARB>,
|
||||
<&cru PCLK_USB>;
|
||||
- phys = <&u2phy1_host>;
|
||||
+ phys = <&usb2phy1_host>;
|
||||
phy-names = "usb";
|
||||
status = "disabled";
|
||||
};
|
||||
@@ -247,7 +247,7 @@
|
||||
interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&cru HCLK_USB2HOST1>, <&cru HCLK_USB2HOST1_ARB>,
|
||||
<&cru PCLK_USB>;
|
||||
- phys = <&u2phy1_host>;
|
||||
+ phys = <&usb2phy1_host>;
|
||||
phy-names = "usb";
|
||||
status = "disabled";
|
||||
};
|
||||
@@ -1195,7 +1195,7 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
- u2phy0: usb2phy@fe8a0000 {
|
||||
+ usb2phy0: usb2phy@fe8a0000 {
|
||||
compatible = "rockchip,rk3568-usb2phy";
|
||||
reg = <0x0 0xfe8a0000 0x0 0x10000>;
|
||||
clocks = <&pmucru CLK_USBPHY0_REF>;
|
||||
@@ -1206,18 +1206,18 @@
|
||||
#clock-cells = <0>;
|
||||
status = "disabled";
|
||||
|
||||
- u2phy0_host: host-port {
|
||||
+ usb2phy0_host: host-port {
|
||||
#phy-cells = <0>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
- u2phy0_otg: otg-port {
|
||||
+ usb2phy0_otg: otg-port {
|
||||
#phy-cells = <0>;
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
- u2phy1: usb2phy@fe8b0000 {
|
||||
+ usb2phy1: usb2phy@fe8b0000 {
|
||||
compatible = "rockchip,rk3568-usb2phy";
|
||||
reg = <0x0 0xfe8b0000 0x0 0x10000>;
|
||||
clocks = <&pmucru CLK_USBPHY1_REF>;
|
||||
@@ -1228,12 +1228,12 @@
|
||||
#clock-cells = <0>;
|
||||
status = "disabled";
|
||||
|
||||
- u2phy1_host: host-port {
|
||||
+ usb2phy1_host: host-port {
|
||||
#phy-cells = <0>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
- u2phy1_otg: otg-port {
|
||||
+ usb2phy1_otg: otg-port {
|
||||
#phy-cells = <0>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
|
@ -0,0 +1,633 @@
|
|||
From 7160820d742a16313f7802e33c2956c19548e488 Mon Sep 17 00:00:00 2001
|
||||
From: Yifeng Zhao <yifeng.zhao@rock-chips.com>
|
||||
Date: Tue, 8 Feb 2022 17:13:25 +0800
|
||||
Subject: [PATCH] phy: rockchip: add naneng combo phy for RK3568
|
||||
|
||||
This patch implements a combo phy driver for Rockchip SoCs
|
||||
with NaNeng IP block. This phy can be used as pcie-phy, usb3-phy,
|
||||
sata-phy or sgmii-phy.
|
||||
|
||||
Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
|
||||
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
|
||||
Tested-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Link: https://lore.kernel.org/r/20220208091326.12495-4-yifeng.zhao@rock-chips.com
|
||||
Signed-off-by: Vinod Koul <vkoul@kernel.org>
|
||||
---
|
||||
drivers/phy/rockchip/Kconfig | 8 +
|
||||
drivers/phy/rockchip/Makefile | 1 +
|
||||
.../rockchip/phy-rockchip-naneng-combphy.c | 581 ++++++++++++++++++
|
||||
3 files changed, 590 insertions(+)
|
||||
create mode 100644 drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
|
||||
|
||||
--- a/drivers/phy/rockchip/Kconfig
|
||||
+++ b/drivers/phy/rockchip/Kconfig
|
||||
@@ -66,6 +66,14 @@ config PHY_ROCKCHIP_INNO_DSIDPHY
|
||||
Enable this to support the Rockchip MIPI/LVDS/TTL PHY with
|
||||
Innosilicon IP block.
|
||||
|
||||
+config PHY_ROCKCHIP_NANENG_COMBO_PHY
|
||||
+ tristate "Rockchip NANENG COMBO PHY Driver"
|
||||
+ depends on ARCH_ROCKCHIP && OF
|
||||
+ select GENERIC_PHY
|
||||
+ help
|
||||
+ Enable this to support the Rockchip PCIe/USB3.0/SATA/QSGMII
|
||||
+ combo PHY with NaNeng IP block.
|
||||
+
|
||||
config PHY_ROCKCHIP_PCIE
|
||||
tristate "Rockchip PCIe PHY Driver"
|
||||
depends on (ARCH_ROCKCHIP && OF) || COMPILE_TEST
|
||||
--- a/drivers/phy/rockchip/Makefile
|
||||
+++ b/drivers/phy/rockchip/Makefile
|
||||
@@ -6,6 +6,7 @@ obj-$(CONFIG_PHY_ROCKCHIP_INNO_CSIDPHY)
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY) += phy-rockchip-inno-dsidphy.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_INNO_HDMI) += phy-rockchip-inno-hdmi.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2) += phy-rockchip-inno-usb2.o
|
||||
+obj-$(CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY) += phy-rockchip-naneng-combphy.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_PCIE) += phy-rockchip-pcie.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
|
||||
@@ -0,0 +1,581 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Rockchip PIPE USB3.0 PCIE SATA Combo Phy driver
|
||||
+ *
|
||||
+ * Copyright (C) 2021 Rockchip Electronics Co., Ltd.
|
||||
+ */
|
||||
+
|
||||
+#include <dt-bindings/phy/phy.h>
|
||||
+#include <linux/clk.h>
|
||||
+#include <linux/mfd/syscon.h>
|
||||
+#include <linux/of_device.h>
|
||||
+#include <linux/phy/phy.h>
|
||||
+#include <linux/regmap.h>
|
||||
+#include <linux/reset.h>
|
||||
+#include <linux/units.h>
|
||||
+
|
||||
+#define BIT_WRITEABLE_SHIFT 16
|
||||
+#define REF_CLOCK_24MHz (24 * HZ_PER_MHZ)
|
||||
+#define REF_CLOCK_25MHz (25 * HZ_PER_MHZ)
|
||||
+#define REF_CLOCK_100MHz (100 * HZ_PER_MHZ)
|
||||
+
|
||||
+/* COMBO PHY REG */
|
||||
+#define PHYREG6 0x14
|
||||
+#define PHYREG6_PLL_DIV_MASK GENMASK(7, 6)
|
||||
+#define PHYREG6_PLL_DIV_SHIFT 6
|
||||
+#define PHYREG6_PLL_DIV_2 1
|
||||
+
|
||||
+#define PHYREG7 0x18
|
||||
+#define PHYREG7_TX_RTERM_MASK GENMASK(7, 4)
|
||||
+#define PHYREG7_TX_RTERM_SHIFT 4
|
||||
+#define PHYREG7_TX_RTERM_50OHM 8
|
||||
+#define PHYREG7_RX_RTERM_MASK GENMASK(3, 0)
|
||||
+#define PHYREG7_RX_RTERM_SHIFT 0
|
||||
+#define PHYREG7_RX_RTERM_44OHM 15
|
||||
+
|
||||
+#define PHYREG8 0x1C
|
||||
+#define PHYREG8_SSC_EN BIT(4)
|
||||
+
|
||||
+#define PHYREG11 0x28
|
||||
+#define PHYREG11_SU_TRIM_0_7 0xF0
|
||||
+
|
||||
+#define PHYREG12 0x2C
|
||||
+#define PHYREG12_PLL_LPF_ADJ_VALUE 4
|
||||
+
|
||||
+#define PHYREG13 0x30
|
||||
+#define PHYREG13_RESISTER_MASK GENMASK(5, 4)
|
||||
+#define PHYREG13_RESISTER_SHIFT 0x4
|
||||
+#define PHYREG13_RESISTER_HIGH_Z 3
|
||||
+#define PHYREG13_CKRCV_AMP0 BIT(7)
|
||||
+
|
||||
+#define PHYREG14 0x34
|
||||
+#define PHYREG14_CKRCV_AMP1 BIT(0)
|
||||
+
|
||||
+#define PHYREG15 0x38
|
||||
+#define PHYREG15_CTLE_EN BIT(0)
|
||||
+#define PHYREG15_SSC_CNT_MASK GENMASK(7, 6)
|
||||
+#define PHYREG15_SSC_CNT_SHIFT 6
|
||||
+#define PHYREG15_SSC_CNT_VALUE 1
|
||||
+
|
||||
+#define PHYREG16 0x3C
|
||||
+#define PHYREG16_SSC_CNT_VALUE 0x5f
|
||||
+
|
||||
+#define PHYREG18 0x44
|
||||
+#define PHYREG18_PLL_LOOP 0x32
|
||||
+
|
||||
+#define PHYREG32 0x7C
|
||||
+#define PHYREG32_SSC_MASK GENMASK(7, 4)
|
||||
+#define PHYREG32_SSC_DIR_SHIFT 4
|
||||
+#define PHYREG32_SSC_UPWARD 0
|
||||
+#define PHYREG32_SSC_DOWNWARD 1
|
||||
+#define PHYREG32_SSC_OFFSET_SHIFT 6
|
||||
+#define PHYREG32_SSC_OFFSET_500PPM 1
|
||||
+
|
||||
+#define PHYREG33 0x80
|
||||
+#define PHYREG33_PLL_KVCO_MASK GENMASK(4, 2)
|
||||
+#define PHYREG33_PLL_KVCO_SHIFT 2
|
||||
+#define PHYREG33_PLL_KVCO_VALUE 2
|
||||
+
|
||||
+struct rockchip_combphy_priv;
|
||||
+
|
||||
+struct combphy_reg {
|
||||
+ u16 offset;
|
||||
+ u16 bitend;
|
||||
+ u16 bitstart;
|
||||
+ u16 disable;
|
||||
+ u16 enable;
|
||||
+};
|
||||
+
|
||||
+struct rockchip_combphy_grfcfg {
|
||||
+ struct combphy_reg pcie_mode_set;
|
||||
+ struct combphy_reg usb_mode_set;
|
||||
+ struct combphy_reg sgmii_mode_set;
|
||||
+ struct combphy_reg qsgmii_mode_set;
|
||||
+ struct combphy_reg pipe_rxterm_set;
|
||||
+ struct combphy_reg pipe_txelec_set;
|
||||
+ struct combphy_reg pipe_txcomp_set;
|
||||
+ struct combphy_reg pipe_clk_25m;
|
||||
+ struct combphy_reg pipe_clk_100m;
|
||||
+ struct combphy_reg pipe_phymode_sel;
|
||||
+ struct combphy_reg pipe_rate_sel;
|
||||
+ struct combphy_reg pipe_rxterm_sel;
|
||||
+ struct combphy_reg pipe_txelec_sel;
|
||||
+ struct combphy_reg pipe_txcomp_sel;
|
||||
+ struct combphy_reg pipe_clk_ext;
|
||||
+ struct combphy_reg pipe_sel_usb;
|
||||
+ struct combphy_reg pipe_sel_qsgmii;
|
||||
+ struct combphy_reg pipe_phy_status;
|
||||
+ struct combphy_reg con0_for_pcie;
|
||||
+ struct combphy_reg con1_for_pcie;
|
||||
+ struct combphy_reg con2_for_pcie;
|
||||
+ struct combphy_reg con3_for_pcie;
|
||||
+ struct combphy_reg con0_for_sata;
|
||||
+ struct combphy_reg con1_for_sata;
|
||||
+ struct combphy_reg con2_for_sata;
|
||||
+ struct combphy_reg con3_for_sata;
|
||||
+ struct combphy_reg pipe_con0_for_sata;
|
||||
+ struct combphy_reg pipe_xpcs_phy_ready;
|
||||
+};
|
||||
+
|
||||
+struct rockchip_combphy_cfg {
|
||||
+ const struct rockchip_combphy_grfcfg *grfcfg;
|
||||
+ int (*combphy_cfg)(struct rockchip_combphy_priv *priv);
|
||||
+};
|
||||
+
|
||||
+struct rockchip_combphy_priv {
|
||||
+ u8 type;
|
||||
+ void __iomem *mmio;
|
||||
+ int num_clks;
|
||||
+ struct clk_bulk_data *clks;
|
||||
+ struct device *dev;
|
||||
+ struct regmap *pipe_grf;
|
||||
+ struct regmap *phy_grf;
|
||||
+ struct phy *phy;
|
||||
+ struct reset_control *phy_rst;
|
||||
+ const struct rockchip_combphy_cfg *cfg;
|
||||
+ bool enable_ssc;
|
||||
+ bool ext_refclk;
|
||||
+ struct clk *refclk;
|
||||
+};
|
||||
+
|
||||
+static void rockchip_combphy_updatel(struct rockchip_combphy_priv *priv,
|
||||
+ int mask, int val, int reg)
|
||||
+{
|
||||
+ unsigned int temp;
|
||||
+
|
||||
+ temp = readl(priv->mmio + reg);
|
||||
+ temp = (temp & ~(mask)) | val;
|
||||
+ writel(temp, priv->mmio + reg);
|
||||
+}
|
||||
+
|
||||
+static int rockchip_combphy_param_write(struct regmap *base,
|
||||
+ const struct combphy_reg *reg, bool en)
|
||||
+{
|
||||
+ u32 val, mask, tmp;
|
||||
+
|
||||
+ tmp = en ? reg->enable : reg->disable;
|
||||
+ mask = GENMASK(reg->bitend, reg->bitstart);
|
||||
+ val = (tmp << reg->bitstart) | (mask << BIT_WRITEABLE_SHIFT);
|
||||
+
|
||||
+ return regmap_write(base, reg->offset, val);
|
||||
+}
|
||||
+
|
||||
+static u32 rockchip_combphy_is_ready(struct rockchip_combphy_priv *priv)
|
||||
+{
|
||||
+ const struct rockchip_combphy_grfcfg *cfg = priv->cfg->grfcfg;
|
||||
+ u32 mask, val;
|
||||
+
|
||||
+ mask = GENMASK(cfg->pipe_phy_status.bitend,
|
||||
+ cfg->pipe_phy_status.bitstart);
|
||||
+
|
||||
+ regmap_read(priv->phy_grf, cfg->pipe_phy_status.offset, &val);
|
||||
+ val = (val & mask) >> cfg->pipe_phy_status.bitstart;
|
||||
+
|
||||
+ return val;
|
||||
+}
|
||||
+
|
||||
+static int rockchip_combphy_init(struct phy *phy)
|
||||
+{
|
||||
+ struct rockchip_combphy_priv *priv = phy_get_drvdata(phy);
|
||||
+ const struct rockchip_combphy_grfcfg *cfg = priv->cfg->grfcfg;
|
||||
+ u32 val;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = clk_bulk_prepare_enable(priv->num_clks, priv->clks);
|
||||
+ if (ret) {
|
||||
+ dev_err(priv->dev, "failed to enable clks\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ switch (priv->type) {
|
||||
+ case PHY_TYPE_PCIE:
|
||||
+ case PHY_TYPE_USB3:
|
||||
+ case PHY_TYPE_SATA:
|
||||
+ case PHY_TYPE_SGMII:
|
||||
+ case PHY_TYPE_QSGMII:
|
||||
+ if (priv->cfg->combphy_cfg)
|
||||
+ ret = priv->cfg->combphy_cfg(priv);
|
||||
+ break;
|
||||
+ default:
|
||||
+ dev_err(priv->dev, "incompatible PHY type\n");
|
||||
+ ret = -EINVAL;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (ret) {
|
||||
+ dev_err(priv->dev, "failed to init phy for phy type %x\n", priv->type);
|
||||
+ goto err_clk;
|
||||
+ }
|
||||
+
|
||||
+ ret = reset_control_deassert(priv->phy_rst);
|
||||
+ if (ret)
|
||||
+ goto err_clk;
|
||||
+
|
||||
+ if (priv->type == PHY_TYPE_USB3) {
|
||||
+ ret = readx_poll_timeout_atomic(rockchip_combphy_is_ready,
|
||||
+ priv, val,
|
||||
+ val == cfg->pipe_phy_status.enable,
|
||||
+ 10, 1000);
|
||||
+ if (ret)
|
||||
+ dev_warn(priv->dev, "wait phy status ready timeout\n");
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+err_clk:
|
||||
+ clk_bulk_disable_unprepare(priv->num_clks, priv->clks);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int rockchip_combphy_exit(struct phy *phy)
|
||||
+{
|
||||
+ struct rockchip_combphy_priv *priv = phy_get_drvdata(phy);
|
||||
+
|
||||
+ clk_bulk_disable_unprepare(priv->num_clks, priv->clks);
|
||||
+ reset_control_assert(priv->phy_rst);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct phy_ops rochchip_combphy_ops = {
|
||||
+ .init = rockchip_combphy_init,
|
||||
+ .exit = rockchip_combphy_exit,
|
||||
+ .owner = THIS_MODULE,
|
||||
+};
|
||||
+
|
||||
+static struct phy *rockchip_combphy_xlate(struct device *dev, struct of_phandle_args *args)
|
||||
+{
|
||||
+ struct rockchip_combphy_priv *priv = dev_get_drvdata(dev);
|
||||
+
|
||||
+ if (args->args_count != 1) {
|
||||
+ dev_err(dev, "invalid number of arguments\n");
|
||||
+ return ERR_PTR(-EINVAL);
|
||||
+ }
|
||||
+
|
||||
+ if (priv->type != PHY_NONE && priv->type != args->args[0])
|
||||
+ dev_warn(dev, "phy type select %d overwriting type %d\n",
|
||||
+ args->args[0], priv->type);
|
||||
+
|
||||
+ priv->type = args->args[0];
|
||||
+
|
||||
+ return priv->phy;
|
||||
+}
|
||||
+
|
||||
+static int rockchip_combphy_parse_dt(struct device *dev, struct rockchip_combphy_priv *priv)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ priv->num_clks = devm_clk_bulk_get_all(dev, &priv->clks);
|
||||
+ if (priv->num_clks < 1)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ priv->refclk = NULL;
|
||||
+ for (i = 0; i < priv->num_clks; i++) {
|
||||
+ if (!strncmp(priv->clks[i].id, "ref", 3)) {
|
||||
+ priv->refclk = priv->clks[i].clk;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!priv->refclk) {
|
||||
+ dev_err(dev, "no refclk found\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ priv->pipe_grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,pipe-grf");
|
||||
+ if (IS_ERR(priv->pipe_grf)) {
|
||||
+ dev_err(dev, "failed to find peri_ctrl pipe-grf regmap\n");
|
||||
+ return PTR_ERR(priv->pipe_grf);
|
||||
+ }
|
||||
+
|
||||
+ priv->phy_grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,pipe-phy-grf");
|
||||
+ if (IS_ERR(priv->phy_grf)) {
|
||||
+ dev_err(dev, "failed to find peri_ctrl pipe-phy-grf regmap\n");
|
||||
+ return PTR_ERR(priv->phy_grf);
|
||||
+ }
|
||||
+
|
||||
+ priv->enable_ssc = device_property_present(dev, "rockchip,enable-ssc");
|
||||
+
|
||||
+ priv->ext_refclk = device_property_present(dev, "rockchip,ext-refclk");
|
||||
+
|
||||
+ priv->phy_rst = devm_reset_control_array_get_exclusive(dev);
|
||||
+ if (IS_ERR(priv->phy_rst))
|
||||
+ return dev_err_probe(dev, PTR_ERR(priv->phy_rst), "failed to get phy reset\n");
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rockchip_combphy_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct phy_provider *phy_provider;
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct rockchip_combphy_priv *priv;
|
||||
+ const struct rockchip_combphy_cfg *phy_cfg;
|
||||
+ struct resource *res;
|
||||
+ int ret;
|
||||
+
|
||||
+ phy_cfg = of_device_get_match_data(dev);
|
||||
+ if (!phy_cfg) {
|
||||
+ dev_err(dev, "no OF match data provided\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
+ if (!priv)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ priv->mmio = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
+ if (IS_ERR(priv->mmio)) {
|
||||
+ ret = PTR_ERR(priv->mmio);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ priv->dev = dev;
|
||||
+ priv->type = PHY_NONE;
|
||||
+ priv->cfg = phy_cfg;
|
||||
+
|
||||
+ ret = rockchip_combphy_parse_dt(dev, priv);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = reset_control_assert(priv->phy_rst);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "failed to reset phy\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ priv->phy = devm_phy_create(dev, NULL, &rochchip_combphy_ops);
|
||||
+ if (IS_ERR(priv->phy)) {
|
||||
+ dev_err(dev, "failed to create combphy\n");
|
||||
+ return PTR_ERR(priv->phy);
|
||||
+ }
|
||||
+
|
||||
+ dev_set_drvdata(dev, priv);
|
||||
+ phy_set_drvdata(priv->phy, priv);
|
||||
+
|
||||
+ phy_provider = devm_of_phy_provider_register(dev, rockchip_combphy_xlate);
|
||||
+
|
||||
+ return PTR_ERR_OR_ZERO(phy_provider);
|
||||
+}
|
||||
+
|
||||
+static int rk3568_combphy_cfg(struct rockchip_combphy_priv *priv)
|
||||
+{
|
||||
+ const struct rockchip_combphy_grfcfg *cfg = priv->cfg->grfcfg;
|
||||
+ unsigned long rate;
|
||||
+ u32 val;
|
||||
+
|
||||
+ switch (priv->type) {
|
||||
+ case PHY_TYPE_PCIE:
|
||||
+ /* Set SSC downward spread spectrum. */
|
||||
+ rockchip_combphy_updatel(priv, PHYREG32_SSC_MASK,
|
||||
+ PHYREG32_SSC_DOWNWARD << PHYREG32_SSC_DIR_SHIFT,
|
||||
+ PHYREG32);
|
||||
+
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->con0_for_pcie, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->con1_for_pcie, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->con2_for_pcie, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->con3_for_pcie, true);
|
||||
+ break;
|
||||
+
|
||||
+ case PHY_TYPE_USB3:
|
||||
+ /* Set SSC downward spread spectrum. */
|
||||
+ rockchip_combphy_updatel(priv, PHYREG32_SSC_MASK,
|
||||
+ PHYREG32_SSC_DOWNWARD << PHYREG32_SSC_DIR_SHIFT,
|
||||
+ PHYREG32);
|
||||
+
|
||||
+ /* Enable adaptive CTLE for USB3.0 Rx. */
|
||||
+ val = readl(priv->mmio + PHYREG15);
|
||||
+ val |= PHYREG15_CTLE_EN;
|
||||
+ writel(val, priv->mmio + PHYREG15);
|
||||
+
|
||||
+ /* Set PLL KVCO fine tuning signals. */
|
||||
+ rockchip_combphy_updatel(priv, PHYREG33_PLL_KVCO_MASK,
|
||||
+ PHYREG33_PLL_KVCO_VALUE << PHYREG33_PLL_KVCO_SHIFT,
|
||||
+ PHYREG33);
|
||||
+
|
||||
+ /* Enable controlling random jitter. */
|
||||
+ writel(PHYREG12_PLL_LPF_ADJ_VALUE, priv->mmio + PHYREG12);
|
||||
+
|
||||
+ /* Set PLL input clock divider 1/2. */
|
||||
+ rockchip_combphy_updatel(priv, PHYREG6_PLL_DIV_MASK,
|
||||
+ PHYREG6_PLL_DIV_2 << PHYREG6_PLL_DIV_SHIFT,
|
||||
+ PHYREG6);
|
||||
+
|
||||
+ writel(PHYREG18_PLL_LOOP, priv->mmio + PHYREG18);
|
||||
+ writel(PHYREG11_SU_TRIM_0_7, priv->mmio + PHYREG11);
|
||||
+
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_sel_usb, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_txcomp_sel, false);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_txelec_sel, false);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->usb_mode_set, true);
|
||||
+ break;
|
||||
+
|
||||
+ case PHY_TYPE_SATA:
|
||||
+ /* Enable adaptive CTLE for SATA Rx. */
|
||||
+ val = readl(priv->mmio + PHYREG15);
|
||||
+ val |= PHYREG15_CTLE_EN;
|
||||
+ writel(val, priv->mmio + PHYREG15);
|
||||
+ /*
|
||||
+ * Set tx_rterm=50ohm and rx_rterm=44ohm for SATA.
|
||||
+ * 0: 60ohm, 8: 50ohm 15: 44ohm (by step abort 1ohm)
|
||||
+ */
|
||||
+ val = PHYREG7_TX_RTERM_50OHM << PHYREG7_TX_RTERM_SHIFT;
|
||||
+ val |= PHYREG7_RX_RTERM_44OHM << PHYREG7_RX_RTERM_SHIFT;
|
||||
+ writel(val, priv->mmio + PHYREG7);
|
||||
+
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->con0_for_sata, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->con1_for_sata, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->con2_for_sata, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->con3_for_sata, true);
|
||||
+ rockchip_combphy_param_write(priv->pipe_grf, &cfg->pipe_con0_for_sata, true);
|
||||
+ break;
|
||||
+
|
||||
+ case PHY_TYPE_SGMII:
|
||||
+ rockchip_combphy_param_write(priv->pipe_grf, &cfg->pipe_xpcs_phy_ready, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_phymode_sel, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_sel_qsgmii, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->sgmii_mode_set, true);
|
||||
+ break;
|
||||
+
|
||||
+ case PHY_TYPE_QSGMII:
|
||||
+ rockchip_combphy_param_write(priv->pipe_grf, &cfg->pipe_xpcs_phy_ready, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_phymode_sel, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_rate_sel, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_sel_qsgmii, true);
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->qsgmii_mode_set, true);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ dev_err(priv->dev, "incompatible PHY type\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ rate = clk_get_rate(priv->refclk);
|
||||
+
|
||||
+ switch (rate) {
|
||||
+ case REF_CLOCK_24MHz:
|
||||
+ if (priv->type == PHY_TYPE_USB3 || priv->type == PHY_TYPE_SATA) {
|
||||
+ /* Set ssc_cnt[9:0]=0101111101 & 31.5KHz. */
|
||||
+ val = PHYREG15_SSC_CNT_VALUE << PHYREG15_SSC_CNT_SHIFT;
|
||||
+ rockchip_combphy_updatel(priv, PHYREG15_SSC_CNT_MASK,
|
||||
+ val, PHYREG15);
|
||||
+
|
||||
+ writel(PHYREG16_SSC_CNT_VALUE, priv->mmio + PHYREG16);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case REF_CLOCK_25MHz:
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_clk_25m, true);
|
||||
+ break;
|
||||
+
|
||||
+ case REF_CLOCK_100MHz:
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_clk_100m, true);
|
||||
+ if (priv->type == PHY_TYPE_PCIE) {
|
||||
+ /* PLL KVCO fine tuning. */
|
||||
+ val = PHYREG33_PLL_KVCO_VALUE << PHYREG33_PLL_KVCO_SHIFT;
|
||||
+ rockchip_combphy_updatel(priv, PHYREG33_PLL_KVCO_MASK,
|
||||
+ val, PHYREG33);
|
||||
+
|
||||
+ /* Enable controlling random jitter. */
|
||||
+ writel(PHYREG12_PLL_LPF_ADJ_VALUE, priv->mmio + PHYREG12);
|
||||
+
|
||||
+ val = PHYREG6_PLL_DIV_2 << PHYREG6_PLL_DIV_SHIFT;
|
||||
+ rockchip_combphy_updatel(priv, PHYREG6_PLL_DIV_MASK,
|
||||
+ val, PHYREG6);
|
||||
+
|
||||
+ writel(PHYREG18_PLL_LOOP, priv->mmio + PHYREG18);
|
||||
+ writel(PHYREG11_SU_TRIM_0_7, priv->mmio + PHYREG11);
|
||||
+ } else if (priv->type == PHY_TYPE_SATA) {
|
||||
+ /* downward spread spectrum +500ppm */
|
||||
+ val = PHYREG32_SSC_DOWNWARD << PHYREG32_SSC_DIR_SHIFT;
|
||||
+ val |= PHYREG32_SSC_OFFSET_500PPM << PHYREG32_SSC_OFFSET_SHIFT;
|
||||
+ rockchip_combphy_updatel(priv, PHYREG32_SSC_MASK, val, PHYREG32);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ dev_err(priv->dev, "unsupported rate: %lu\n", rate);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (priv->ext_refclk) {
|
||||
+ rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_clk_ext, true);
|
||||
+ if (priv->type == PHY_TYPE_PCIE && rate == REF_CLOCK_100MHz) {
|
||||
+ val = PHYREG13_RESISTER_HIGH_Z << PHYREG13_RESISTER_SHIFT;
|
||||
+ val |= PHYREG13_CKRCV_AMP0;
|
||||
+ rockchip_combphy_updatel(priv, PHYREG13_RESISTER_MASK, val, PHYREG13);
|
||||
+
|
||||
+ val = readl(priv->mmio + PHYREG14);
|
||||
+ val |= PHYREG14_CKRCV_AMP1;
|
||||
+ writel(val, priv->mmio + PHYREG14);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (priv->enable_ssc) {
|
||||
+ val = readl(priv->mmio + PHYREG8);
|
||||
+ val |= PHYREG8_SSC_EN;
|
||||
+ writel(val, priv->mmio + PHYREG8);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct rockchip_combphy_grfcfg rk3568_combphy_grfcfgs = {
|
||||
+ /* pipe-phy-grf */
|
||||
+ .pcie_mode_set = { 0x0000, 5, 0, 0x00, 0x11 },
|
||||
+ .usb_mode_set = { 0x0000, 5, 0, 0x00, 0x04 },
|
||||
+ .sgmii_mode_set = { 0x0000, 5, 0, 0x00, 0x01 },
|
||||
+ .qsgmii_mode_set = { 0x0000, 5, 0, 0x00, 0x21 },
|
||||
+ .pipe_rxterm_set = { 0x0000, 12, 12, 0x00, 0x01 },
|
||||
+ .pipe_txelec_set = { 0x0004, 1, 1, 0x00, 0x01 },
|
||||
+ .pipe_txcomp_set = { 0x0004, 4, 4, 0x00, 0x01 },
|
||||
+ .pipe_clk_25m = { 0x0004, 14, 13, 0x00, 0x01 },
|
||||
+ .pipe_clk_100m = { 0x0004, 14, 13, 0x00, 0x02 },
|
||||
+ .pipe_phymode_sel = { 0x0008, 1, 1, 0x00, 0x01 },
|
||||
+ .pipe_rate_sel = { 0x0008, 2, 2, 0x00, 0x01 },
|
||||
+ .pipe_rxterm_sel = { 0x0008, 8, 8, 0x00, 0x01 },
|
||||
+ .pipe_txelec_sel = { 0x0008, 12, 12, 0x00, 0x01 },
|
||||
+ .pipe_txcomp_sel = { 0x0008, 15, 15, 0x00, 0x01 },
|
||||
+ .pipe_clk_ext = { 0x000c, 9, 8, 0x02, 0x01 },
|
||||
+ .pipe_sel_usb = { 0x000c, 14, 13, 0x00, 0x01 },
|
||||
+ .pipe_sel_qsgmii = { 0x000c, 15, 13, 0x00, 0x07 },
|
||||
+ .pipe_phy_status = { 0x0034, 6, 6, 0x01, 0x00 },
|
||||
+ .con0_for_pcie = { 0x0000, 15, 0, 0x00, 0x1000 },
|
||||
+ .con1_for_pcie = { 0x0004, 15, 0, 0x00, 0x0000 },
|
||||
+ .con2_for_pcie = { 0x0008, 15, 0, 0x00, 0x0101 },
|
||||
+ .con3_for_pcie = { 0x000c, 15, 0, 0x00, 0x0200 },
|
||||
+ .con0_for_sata = { 0x0000, 15, 0, 0x00, 0x0119 },
|
||||
+ .con1_for_sata = { 0x0004, 15, 0, 0x00, 0x0040 },
|
||||
+ .con2_for_sata = { 0x0008, 15, 0, 0x00, 0x80c3 },
|
||||
+ .con3_for_sata = { 0x000c, 15, 0, 0x00, 0x4407 },
|
||||
+ /* pipe-grf */
|
||||
+ .pipe_con0_for_sata = { 0x0000, 15, 0, 0x00, 0x2220 },
|
||||
+ .pipe_xpcs_phy_ready = { 0x0040, 2, 2, 0x00, 0x01 },
|
||||
+};
|
||||
+
|
||||
+static const struct rockchip_combphy_cfg rk3568_combphy_cfgs = {
|
||||
+ .grfcfg = &rk3568_combphy_grfcfgs,
|
||||
+ .combphy_cfg = rk3568_combphy_cfg,
|
||||
+};
|
||||
+
|
||||
+static const struct of_device_id rockchip_combphy_of_match[] = {
|
||||
+ {
|
||||
+ .compatible = "rockchip,rk3568-naneng-combphy",
|
||||
+ .data = &rk3568_combphy_cfgs,
|
||||
+ },
|
||||
+ { },
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rockchip_combphy_of_match);
|
||||
+
|
||||
+static struct platform_driver rockchip_combphy_driver = {
|
||||
+ .probe = rockchip_combphy_probe,
|
||||
+ .driver = {
|
||||
+ .name = "rockchip-naneng-combphy",
|
||||
+ .of_match_table = rockchip_combphy_of_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(rockchip_combphy_driver);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Rockchip NANENG COMBPHY driver");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
From 3cc8cd2d25954ed5794df2d190b81c7325c584e3 Mon Sep 17 00:00:00 2001
|
||||
From: Yifeng Zhao <yifeng.zhao@rock-chips.com>
|
||||
Date: Tue, 8 Feb 2022 17:13:26 +0800
|
||||
Subject: [PATCH] arm64: dts: rockchip: add naneng combo phy nodes for rk3568
|
||||
|
||||
Add the core dt-node for the rk3568's naneng combo phys.
|
||||
|
||||
Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
|
||||
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
|
||||
Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Link: https://lore.kernel.org/r/20220208091326.12495-5-yifeng.zhao@rock-chips.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3568.dtsi | 21 +++++++++++
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 47 ++++++++++++++++++++++++
|
||||
2 files changed, 68 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
@@ -8,6 +8,11 @@
|
||||
/ {
|
||||
compatible = "rockchip,rk3568";
|
||||
|
||||
+ pipe_phy_grf0: syscon@fdc70000 {
|
||||
+ compatible = "rockchip,rk3568-pipe-phy-grf", "syscon";
|
||||
+ reg = <0x0 0xfdc70000 0x0 0x1000>;
|
||||
+ };
|
||||
+
|
||||
qos_pcie3x1: qos@fe190080 {
|
||||
compatible = "rockchip,rk3568-qos", "syscon";
|
||||
reg = <0x0 0xfe190080 0x0 0x20>;
|
||||
@@ -69,6 +74,22 @@
|
||||
queue0 {};
|
||||
};
|
||||
};
|
||||
+
|
||||
+ combphy0: phy@fe820000 {
|
||||
+ compatible = "rockchip,rk3568-naneng-combphy";
|
||||
+ reg = <0x0 0xfe820000 0x0 0x100>;
|
||||
+ clocks = <&pmucru CLK_PCIEPHY0_REF>,
|
||||
+ <&cru PCLK_PIPEPHY0>,
|
||||
+ <&cru PCLK_PIPE>;
|
||||
+ clock-names = "ref", "apb", "pipe";
|
||||
+ assigned-clocks = <&pmucru CLK_PCIEPHY0_REF>;
|
||||
+ assigned-clock-rates = <100000000>;
|
||||
+ resets = <&cru SRST_PIPEPHY0>;
|
||||
+ rockchip,pipe-grf = <&pipegrf>;
|
||||
+ rockchip,pipe-phy-grf = <&pipe_phy_grf0>;
|
||||
+ #phy-cells = <1>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
};
|
||||
|
||||
&cpu0_opp_table {
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -262,11 +262,26 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ pipegrf: syscon@fdc50000 {
|
||||
+ compatible = "rockchip,rk3568-pipe-grf", "syscon";
|
||||
+ reg = <0x0 0xfdc50000 0x0 0x1000>;
|
||||
+ };
|
||||
+
|
||||
grf: syscon@fdc60000 {
|
||||
compatible = "rockchip,rk3568-grf", "syscon", "simple-mfd";
|
||||
reg = <0x0 0xfdc60000 0x0 0x10000>;
|
||||
};
|
||||
|
||||
+ pipe_phy_grf1: syscon@fdc80000 {
|
||||
+ compatible = "rockchip,rk3568-pipe-phy-grf", "syscon";
|
||||
+ reg = <0x0 0xfdc80000 0x0 0x1000>;
|
||||
+ };
|
||||
+
|
||||
+ pipe_phy_grf2: syscon@fdc90000 {
|
||||
+ compatible = "rockchip,rk3568-pipe-phy-grf", "syscon";
|
||||
+ reg = <0x0 0xfdc90000 0x0 0x1000>;
|
||||
+ };
|
||||
+
|
||||
usb2phy0_grf: syscon@fdca0000 {
|
||||
compatible = "rockchip,rk3568-usb2phy-grf", "syscon";
|
||||
reg = <0x0 0xfdca0000 0x0 0x8000>;
|
||||
@@ -1195,6 +1210,38 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ combphy1: phy@fe830000 {
|
||||
+ compatible = "rockchip,rk3568-naneng-combphy";
|
||||
+ reg = <0x0 0xfe830000 0x0 0x100>;
|
||||
+ clocks = <&pmucru CLK_PCIEPHY1_REF>,
|
||||
+ <&cru PCLK_PIPEPHY1>,
|
||||
+ <&cru PCLK_PIPE>;
|
||||
+ clock-names = "ref", "apb", "pipe";
|
||||
+ assigned-clocks = <&pmucru CLK_PCIEPHY1_REF>;
|
||||
+ assigned-clock-rates = <100000000>;
|
||||
+ resets = <&cru SRST_PIPEPHY1>;
|
||||
+ rockchip,pipe-grf = <&pipegrf>;
|
||||
+ rockchip,pipe-phy-grf = <&pipe_phy_grf1>;
|
||||
+ #phy-cells = <1>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ combphy2: phy@fe840000 {
|
||||
+ compatible = "rockchip,rk3568-naneng-combphy";
|
||||
+ reg = <0x0 0xfe840000 0x0 0x100>;
|
||||
+ clocks = <&pmucru CLK_PCIEPHY2_REF>,
|
||||
+ <&cru PCLK_PIPEPHY2>,
|
||||
+ <&cru PCLK_PIPE>;
|
||||
+ clock-names = "ref", "apb", "pipe";
|
||||
+ assigned-clocks = <&pmucru CLK_PCIEPHY2_REF>;
|
||||
+ assigned-clock-rates = <100000000>;
|
||||
+ resets = <&cru SRST_PIPEPHY2>;
|
||||
+ rockchip,pipe-grf = <&pipegrf>;
|
||||
+ rockchip,pipe-phy-grf = <&pipe_phy_grf2>;
|
||||
+ #phy-cells = <1>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
usb2phy0: usb2phy@fe8a0000 {
|
||||
compatible = "rockchip,rk3568-usb2phy";
|
||||
reg = <0x0 0xfe8a0000 0x0 0x10000>;
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
From 16c0f95d9ed14f033b5f1bd37e96d257b60c198c Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Fri, 11 Mar 2022 22:03:57 +0100
|
||||
Subject: [PATCH] arm64: dts: rockchip: Add sata nodes to rk356x
|
||||
|
||||
RK356x supports up to 3 sata controllers which were compatible with the
|
||||
existing snps,dwc-ahci binding.
|
||||
|
||||
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Link: https://lore.kernel.org/r/20220311210357.222830-7-linux@fw-web.de
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3568.dtsi | 14 ++++++++++++
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 28 ++++++++++++++++++++++++
|
||||
2 files changed, 42 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
@@ -8,6 +8,20 @@
|
||||
/ {
|
||||
compatible = "rockchip,rk3568";
|
||||
|
||||
+ sata0: sata@fc000000 {
|
||||
+ compatible = "rockchip,rk3568-dwc-ahci", "snps,dwc-ahci";
|
||||
+ reg = <0 0xfc000000 0 0x1000>;
|
||||
+ clocks = <&cru ACLK_SATA0>, <&cru CLK_SATA0_PMALIVE>,
|
||||
+ <&cru CLK_SATA0_RXOOB>;
|
||||
+ clock-names = "sata", "pmalive", "rxoob";
|
||||
+ interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ phys = <&combphy0 PHY_TYPE_SATA>;
|
||||
+ phy-names = "sata-phy";
|
||||
+ ports-implemented = <0x1>;
|
||||
+ power-domains = <&power RK3568_PD_PIPE>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
pipe_phy_grf0: syscon@fdc70000 {
|
||||
compatible = "rockchip,rk3568-pipe-phy-grf", "syscon";
|
||||
reg = <0x0 0xfdc70000 0x0 0x1000>;
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -196,6 +196,34 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ sata1: sata@fc400000 {
|
||||
+ compatible = "rockchip,rk3568-dwc-ahci", "snps,dwc-ahci";
|
||||
+ reg = <0 0xfc400000 0 0x1000>;
|
||||
+ clocks = <&cru ACLK_SATA1>, <&cru CLK_SATA1_PMALIVE>,
|
||||
+ <&cru CLK_SATA1_RXOOB>;
|
||||
+ clock-names = "sata", "pmalive", "rxoob";
|
||||
+ interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ phys = <&combphy1 PHY_TYPE_SATA>;
|
||||
+ phy-names = "sata-phy";
|
||||
+ ports-implemented = <0x1>;
|
||||
+ power-domains = <&power RK3568_PD_PIPE>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ sata2: sata@fc800000 {
|
||||
+ compatible = "rockchip,rk3568-dwc-ahci", "snps,dwc-ahci";
|
||||
+ reg = <0 0xfc800000 0 0x1000>;
|
||||
+ clocks = <&cru ACLK_SATA2>, <&cru CLK_SATA2_PMALIVE>,
|
||||
+ <&cru CLK_SATA2_RXOOB>;
|
||||
+ clock-names = "sata", "pmalive", "rxoob";
|
||||
+ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ phys = <&combphy2 PHY_TYPE_SATA>;
|
||||
+ phy-names = "sata-phy";
|
||||
+ ports-implemented = <0x1>;
|
||||
+ power-domains = <&power RK3568_PD_PIPE>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
gic: interrupt-controller@fd400000 {
|
||||
compatible = "arm,gic-v3";
|
||||
reg = <0x0 0xfd400000 0 0x10000>, /* GICD */
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
From 62b20e6e0dde8d5633e3d94b028f86fb24b31d22 Mon Sep 17 00:00:00 2001
|
||||
From: Bin Yang <yangbin@rock-chips.com>
|
||||
Date: Mon, 28 Feb 2022 08:56:56 -0500
|
||||
Subject: [PATCH] usb: dwc3: core: do not use 3.0 clock when operating in 2.0
|
||||
mode
|
||||
|
||||
In the 3.0 device core, if the core is programmed to operate in
|
||||
2.0 only, then setting the GUCTL1.DEV_FORCE_20_CLK_FOR_30_CLK makes
|
||||
the internal 2.0(utmi/ulpi) clock to be routed as the 3.0 (pipe)
|
||||
clock. Enabling this feature allows the pipe3 clock to be not-running
|
||||
when forcibly operating in 2.0 device mode.
|
||||
|
||||
Tested-by: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20220228135700.1089526-6-pgwipeout@gmail.com
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/usb/dwc3/core.c | 5 +++++
|
||||
drivers/usb/dwc3/core.h | 1 +
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
--- a/drivers/usb/dwc3/core.c
|
||||
+++ b/drivers/usb/dwc3/core.c
|
||||
@@ -1090,6 +1090,11 @@ static int dwc3_core_init(struct dwc3 *d
|
||||
if (dwc->parkmode_disable_ss_quirk)
|
||||
reg |= DWC3_GUCTL1_PARKMODE_DISABLE_SS;
|
||||
|
||||
+ if (DWC3_VER_IS_WITHIN(DWC3, 290A, ANY) &&
|
||||
+ (dwc->maximum_speed == USB_SPEED_HIGH ||
|
||||
+ dwc->maximum_speed == USB_SPEED_FULL))
|
||||
+ reg |= DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK;
|
||||
+
|
||||
dwc3_writel(dwc->regs, DWC3_GUCTL1, reg);
|
||||
}
|
||||
|
||||
--- a/drivers/usb/dwc3/core.h
|
||||
+++ b/drivers/usb/dwc3/core.h
|
||||
@@ -258,6 +258,7 @@
|
||||
/* Global User Control 1 Register */
|
||||
#define DWC3_GUCTL1_DEV_DECOUPLE_L1L2_EVT BIT(31)
|
||||
#define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28)
|
||||
+#define DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK BIT(26)
|
||||
#define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24)
|
||||
#define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17)
|
||||
#define DWC3_GUCTL1_RESUME_OPMODE_HS_HOST BIT(10)
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
From c4313e75001492f8a288d3ffd595544cbc880821 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Sat, 5 Mar 2022 16:58:34 -0500
|
||||
Subject: [PATCH] mmc: dw_mmc: Support setting f_min from host drivers
|
||||
|
||||
Host drivers may not be able to support frequencies as low as dw-mmc
|
||||
supports. Unfortunately f_min isn't available when the drv_data->init
|
||||
function is called, as the mmc_host struct hasn't been set up yet.
|
||||
|
||||
Support the host drivers saving the requested minimum frequency, so we
|
||||
can later set f_min when it is available.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20220305215835.2210388-2-pgwipeout@gmail.com
|
||||
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
|
||||
---
|
||||
drivers/mmc/host/dw_mmc.c | 7 ++++++-
|
||||
drivers/mmc/host/dw_mmc.h | 2 ++
|
||||
2 files changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/mmc/host/dw_mmc.c
|
||||
+++ b/drivers/mmc/host/dw_mmc.c
|
||||
@@ -2853,7 +2853,12 @@ static int dw_mci_init_slot_caps(struct
|
||||
if (host->pdata->caps2)
|
||||
mmc->caps2 = host->pdata->caps2;
|
||||
|
||||
- mmc->f_min = DW_MCI_FREQ_MIN;
|
||||
+ /* if host has set a minimum_freq, we should respect it */
|
||||
+ if (host->minimum_speed)
|
||||
+ mmc->f_min = host->minimum_speed;
|
||||
+ else
|
||||
+ mmc->f_min = DW_MCI_FREQ_MIN;
|
||||
+
|
||||
if (!mmc->f_max)
|
||||
mmc->f_max = DW_MCI_FREQ_MAX;
|
||||
|
||||
--- a/drivers/mmc/host/dw_mmc.h
|
||||
+++ b/drivers/mmc/host/dw_mmc.h
|
||||
@@ -99,6 +99,7 @@ struct dw_mci_dma_slave {
|
||||
* @bus_hz: The rate of @mck in Hz. This forms the basis for MMC bus
|
||||
* rate and timeout calculations.
|
||||
* @current_speed: Configured rate of the controller.
|
||||
+ * @minimum_speed: Stored minimum rate of the controller.
|
||||
* @fifoth_val: The value of FIFOTH register.
|
||||
* @verid: Denote Version ID.
|
||||
* @dev: Device associated with the MMC controller.
|
||||
@@ -200,6 +201,7 @@ struct dw_mci {
|
||||
|
||||
u32 bus_hz;
|
||||
u32 current_speed;
|
||||
+ u32 minimum_speed;
|
||||
u32 fifoth_val;
|
||||
u16 verid;
|
||||
struct device *dev;
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
From 52c92286b71e28d88642a4a416f40fbdb6cbb46f Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Sat, 5 Mar 2022 16:58:35 -0500
|
||||
Subject: [PATCH] mmc: dw-mmc-rockchip: Fix handling invalid clock rates
|
||||
|
||||
The Rockchip rk356x ciu clock cannot be set as low as the dw-mmc
|
||||
hardware supports. This leads to a situation during card initialization
|
||||
where the clock is set lower than the clock driver can support. The
|
||||
dw-mmc-rockchip driver spews errors when this happens.
|
||||
For normal operation this only happens a few times during boot, but when
|
||||
cd-broken is enabled (in cases such as the SoQuartz module) this fires
|
||||
multiple times each poll cycle.
|
||||
|
||||
Fix this by testing the lowest possible frequency that the clock driver
|
||||
can support which is within the mmc specification. Divide that rate by
|
||||
the internal divider and set f_min to this.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20220305215835.2210388-3-pgwipeout@gmail.com
|
||||
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
|
||||
---
|
||||
drivers/mmc/host/dw_mmc-rockchip.c | 27 +++++++++++++++++++++++----
|
||||
1 file changed, 23 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/mmc/host/dw_mmc-rockchip.c
|
||||
+++ b/drivers/mmc/host/dw_mmc-rockchip.c
|
||||
@@ -15,7 +15,9 @@
|
||||
#include "dw_mmc.h"
|
||||
#include "dw_mmc-pltfm.h"
|
||||
|
||||
-#define RK3288_CLKGEN_DIV 2
|
||||
+#define RK3288_CLKGEN_DIV 2
|
||||
+
|
||||
+static const unsigned int freqs[] = { 100000, 200000, 300000, 400000 };
|
||||
|
||||
struct dw_mci_rockchip_priv_data {
|
||||
struct clk *drv_clk;
|
||||
@@ -51,7 +53,7 @@ static void dw_mci_rk3288_set_ios(struct
|
||||
|
||||
ret = clk_set_rate(host->ciu_clk, cclkin);
|
||||
if (ret)
|
||||
- dev_warn(host->dev, "failed to set rate %uHz\n", ios->clock);
|
||||
+ dev_warn(host->dev, "failed to set rate %uHz err: %d\n", cclkin, ret);
|
||||
|
||||
bus_hz = clk_get_rate(host->ciu_clk) / RK3288_CLKGEN_DIV;
|
||||
if (bus_hz != host->bus_hz) {
|
||||
@@ -290,13 +292,30 @@ static int dw_mci_rk3288_parse_dt(struct
|
||||
|
||||
static int dw_mci_rockchip_init(struct dw_mci *host)
|
||||
{
|
||||
+ int ret, i;
|
||||
+
|
||||
/* It is slot 8 on Rockchip SoCs */
|
||||
host->sdio_id0 = 8;
|
||||
|
||||
- if (of_device_is_compatible(host->dev->of_node,
|
||||
- "rockchip,rk3288-dw-mshc"))
|
||||
+ if (of_device_is_compatible(host->dev->of_node, "rockchip,rk3288-dw-mshc")) {
|
||||
host->bus_hz /= RK3288_CLKGEN_DIV;
|
||||
|
||||
+ /* clock driver will fail if the clock is less than the lowest source clock
|
||||
+ * divided by the internal clock divider. Test for the lowest available
|
||||
+ * clock and set the minimum freq to clock / clock divider.
|
||||
+ */
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(freqs); i++) {
|
||||
+ ret = clk_round_rate(host->ciu_clk, freqs[i] * RK3288_CLKGEN_DIV);
|
||||
+ if (ret > 0) {
|
||||
+ host->minimum_speed = ret / RK3288_CLKGEN_DIV;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (ret < 0)
|
||||
+ dev_warn(host->dev, "no valid minimum freq: %d\n", ret);
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
From 4d94b98f2e2407e3f053b2546f86c76179fea644 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Jirman <megous@megous.com>
|
||||
Date: Sun, 29 Aug 2021 04:51:53 +0200
|
||||
Subject: [PATCH] mfd: rk808: Add support for power off on RK817
|
||||
|
||||
RK817 has a power-off bit in SYS_CFG3. Add support for powering
|
||||
off the PMIC.
|
||||
|
||||
Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
Signed-off-by: Lee Jones <lee.jones@linaro.org>
|
||||
---
|
||||
drivers/mfd/rk808.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/drivers/mfd/rk808.c
|
||||
+++ b/drivers/mfd/rk808.c
|
||||
@@ -543,6 +543,10 @@ static void rk808_pm_power_off(void)
|
||||
reg = RK808_DEVCTRL_REG,
|
||||
bit = DEV_OFF_RST;
|
||||
break;
|
||||
+ case RK817_ID:
|
||||
+ reg = RK817_SYS_CFG(3);
|
||||
+ bit = DEV_OFF;
|
||||
+ break;
|
||||
case RK818_ID:
|
||||
reg = RK818_DEVCTRL_REG;
|
||||
bit = DEV_OFF;
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
From 56f216d8efbc1212bf5ff8a6ff5e29927965e8db Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Tue, 8 Feb 2022 14:40:23 -0500
|
||||
Subject: [PATCH] mfd: rk808: Add reboot support to rk808.c
|
||||
|
||||
This adds reboot support to the rk808 pmic driver and enables it for
|
||||
the rk809 and rk817 devices.
|
||||
This only enables if the rockchip,system-power-controller flag is set.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
|
||||
Signed-off-by: Lee Jones <lee.jones@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20220208194023.929720-1-pgwipeout@gmail.com
|
||||
---
|
||||
drivers/mfd/rk808.c | 44 +++++++++++++++++++++++++++++++++++++++
|
||||
include/linux/mfd/rk808.h | 1 +
|
||||
2 files changed, 45 insertions(+)
|
||||
|
||||
--- a/drivers/mfd/rk808.c
|
||||
+++ b/drivers/mfd/rk808.c
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/regmap.h>
|
||||
+#include <linux/reboot.h>
|
||||
|
||||
struct rk808_reg_data {
|
||||
int addr;
|
||||
@@ -543,6 +544,7 @@ static void rk808_pm_power_off(void)
|
||||
reg = RK808_DEVCTRL_REG,
|
||||
bit = DEV_OFF_RST;
|
||||
break;
|
||||
+ case RK809_ID:
|
||||
case RK817_ID:
|
||||
reg = RK817_SYS_CFG(3);
|
||||
bit = DEV_OFF;
|
||||
@@ -559,6 +561,34 @@ static void rk808_pm_power_off(void)
|
||||
dev_err(&rk808_i2c_client->dev, "Failed to shutdown device!\n");
|
||||
}
|
||||
|
||||
+static int rk808_restart_notify(struct notifier_block *this, unsigned long mode, void *cmd)
|
||||
+{
|
||||
+ struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
|
||||
+ unsigned int reg, bit;
|
||||
+ int ret;
|
||||
+
|
||||
+ switch (rk808->variant) {
|
||||
+ case RK809_ID:
|
||||
+ case RK817_ID:
|
||||
+ reg = RK817_SYS_CFG(3);
|
||||
+ bit = DEV_RST;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ return NOTIFY_DONE;
|
||||
+ }
|
||||
+ ret = regmap_update_bits(rk808->regmap, reg, bit, bit);
|
||||
+ if (ret)
|
||||
+ dev_err(&rk808_i2c_client->dev, "Failed to restart device!\n");
|
||||
+
|
||||
+ return NOTIFY_DONE;
|
||||
+}
|
||||
+
|
||||
+static struct notifier_block rk808_restart_handler = {
|
||||
+ .notifier_call = rk808_restart_notify,
|
||||
+ .priority = 192,
|
||||
+};
|
||||
+
|
||||
static void rk8xx_shutdown(struct i2c_client *client)
|
||||
{
|
||||
struct rk808 *rk808 = i2c_get_clientdata(client);
|
||||
@@ -727,6 +757,18 @@ static int rk808_probe(struct i2c_client
|
||||
if (of_property_read_bool(np, "rockchip,system-power-controller")) {
|
||||
rk808_i2c_client = client;
|
||||
pm_power_off = rk808_pm_power_off;
|
||||
+
|
||||
+ switch (rk808->variant) {
|
||||
+ case RK809_ID:
|
||||
+ case RK817_ID:
|
||||
+ ret = register_restart_handler(&rk808_restart_handler);
|
||||
+ if (ret)
|
||||
+ dev_warn(&client->dev, "failed to register rst handler, %d\n", ret);
|
||||
+ break;
|
||||
+ default:
|
||||
+ dev_dbg(&client->dev, "pmic controlled board reset not supported\n");
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -749,6 +791,8 @@ static int rk808_remove(struct i2c_clien
|
||||
if (pm_power_off == rk808_pm_power_off)
|
||||
pm_power_off = NULL;
|
||||
|
||||
+ unregister_restart_handler(&rk808_restart_handler);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- a/include/linux/mfd/rk808.h
|
||||
+++ b/include/linux/mfd/rk808.h
|
||||
@@ -373,6 +373,7 @@ enum rk805_reg {
|
||||
#define SWITCH2_EN BIT(6)
|
||||
#define SWITCH1_EN BIT(5)
|
||||
#define DEV_OFF_RST BIT(3)
|
||||
+#define DEV_RST BIT(2)
|
||||
#define DEV_OFF BIT(0)
|
||||
#define RTC_STOP BIT(0)
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
From 5c0bb71138770d85ea840acd379edc6471b867ee Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Fri, 8 Apr 2022 11:12:34 -0400
|
||||
Subject: [PATCH] soc: rockchip: set dwc3 clock for rk3566
|
||||
|
||||
The rk3566 dwc3 otg port clock is unavailable at boot, as it defaults to
|
||||
the combophy as the clock source. As combophy0 doesn't exist on rk3566,
|
||||
we need to set the clock source to the usb2 phy instead.
|
||||
|
||||
Add handling to the grf driver to handle this on boot.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20220408151237.3165046-3-pgwipeout@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
drivers/soc/rockchip/grf.c | 17 +++++++++++++++++
|
||||
1 file changed, 17 insertions(+)
|
||||
|
||||
--- a/drivers/soc/rockchip/grf.c
|
||||
+++ b/drivers/soc/rockchip/grf.c
|
||||
@@ -108,6 +108,20 @@ static const struct rockchip_grf_info rk
|
||||
.num_values = ARRAY_SIZE(rk3399_defaults),
|
||||
};
|
||||
|
||||
+#define RK3566_GRF_USB3OTG0_CON1 0x0104
|
||||
+
|
||||
+static const struct rockchip_grf_value rk3566_defaults[] __initconst = {
|
||||
+ { "usb3otg port switch", RK3566_GRF_USB3OTG0_CON1, HIWORD_UPDATE(0, 1, 12) },
|
||||
+ { "usb3otg clock switch", RK3566_GRF_USB3OTG0_CON1, HIWORD_UPDATE(1, 1, 7) },
|
||||
+ { "usb3otg disable usb3", RK3566_GRF_USB3OTG0_CON1, HIWORD_UPDATE(1, 1, 0) },
|
||||
+};
|
||||
+
|
||||
+static const struct rockchip_grf_info rk3566_pipegrf __initconst = {
|
||||
+ .values = rk3566_defaults,
|
||||
+ .num_values = ARRAY_SIZE(rk3566_defaults),
|
||||
+};
|
||||
+
|
||||
+
|
||||
static const struct of_device_id rockchip_grf_dt_match[] __initconst = {
|
||||
{
|
||||
.compatible = "rockchip,rk3036-grf",
|
||||
@@ -130,6 +144,9 @@ static const struct of_device_id rockchi
|
||||
}, {
|
||||
.compatible = "rockchip,rk3399-grf",
|
||||
.data = (void *)&rk3399_grf,
|
||||
+ }, {
|
||||
+ .compatible = "rockchip,rk3566-pipe-grf",
|
||||
+ .data = (void *)&rk3566_pipegrf,
|
||||
},
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
From 9f4c480f24e2ce1d464ff9d5f8a249a485acdc7f Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Fri, 8 Apr 2022 11:12:35 -0400
|
||||
Subject: [PATCH] arm64: dts: rockchip: add rk356x dwc3 usb3 nodes
|
||||
|
||||
Add the dwc3 device nodes to the rk356x device trees.
|
||||
The rk3566 has one usb2 capable dwc3 otg controller and one usb3 capable
|
||||
dwc3 host controller.
|
||||
The rk3568 has one usb3 capable dwc3 otg controller and one usb3 capable
|
||||
dwc3 host controller.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Link: https://lore.kernel.org/r/20220408151237.3165046-4-pgwipeout@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3566.dtsi | 11 ++++++++
|
||||
arch/arm64/boot/dts/rockchip/rk3568.dtsi | 9 ++++++
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 35 +++++++++++++++++++++++-
|
||||
3 files changed, 54 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3566.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3566.dtsi
|
||||
@@ -6,6 +6,10 @@
|
||||
compatible = "rockchip,rk3566";
|
||||
};
|
||||
|
||||
+&pipegrf {
|
||||
+ compatible = "rockchip,rk3566-pipe-grf", "syscon";
|
||||
+};
|
||||
+
|
||||
&power {
|
||||
power-domain@RK3568_PD_PIPE {
|
||||
reg = <RK3568_PD_PIPE>;
|
||||
@@ -18,3 +22,10 @@
|
||||
#power-domain-cells = <0>;
|
||||
};
|
||||
};
|
||||
+
|
||||
+&usb_host0_xhci {
|
||||
+ phys = <&usb2phy0_otg>;
|
||||
+ phy-names = "usb2-phy";
|
||||
+ extcon = <&usb2phy0>;
|
||||
+ maximum-speed = "high-speed";
|
||||
+};
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
@@ -113,6 +113,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&pipegrf {
|
||||
+ compatible = "rockchip,rk3568-pipe-grf", "syscon";
|
||||
+};
|
||||
+
|
||||
&power {
|
||||
power-domain@RK3568_PD_PIPE {
|
||||
reg = <RK3568_PD_PIPE>;
|
||||
@@ -128,3 +132,8 @@
|
||||
#power-domain-cells = <0>;
|
||||
};
|
||||
};
|
||||
+
|
||||
+&usb_host0_xhci {
|
||||
+ phys = <&usb2phy0_otg>, <&combphy0 PHY_TYPE_USB3>;
|
||||
+ phy-names = "usb2-phy", "usb3-phy";
|
||||
+};
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -224,6 +224,40 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ usb_host0_xhci: usb@fcc00000 {
|
||||
+ compatible = "rockchip,rk3568-dwc3", "snps,dwc3";
|
||||
+ reg = <0x0 0xfcc00000 0x0 0x400000>;
|
||||
+ interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru CLK_USB3OTG0_REF>, <&cru CLK_USB3OTG0_SUSPEND>,
|
||||
+ <&cru ACLK_USB3OTG0>;
|
||||
+ clock-names = "ref_clk", "suspend_clk",
|
||||
+ "bus_clk";
|
||||
+ dr_mode = "host";
|
||||
+ phy_type = "utmi_wide";
|
||||
+ power-domains = <&power RK3568_PD_PIPE>;
|
||||
+ resets = <&cru SRST_USB3OTG0>;
|
||||
+ snps,dis_u2_susphy_quirk;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ usb_host1_xhci: usb@fd000000 {
|
||||
+ compatible = "rockchip,rk3568-dwc3", "snps,dwc3";
|
||||
+ reg = <0x0 0xfd000000 0x0 0x400000>;
|
||||
+ interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru CLK_USB3OTG1_REF>, <&cru CLK_USB3OTG1_SUSPEND>,
|
||||
+ <&cru ACLK_USB3OTG1>;
|
||||
+ clock-names = "ref_clk", "suspend_clk",
|
||||
+ "bus_clk";
|
||||
+ dr_mode = "host";
|
||||
+ phys = <&usb2phy0_host>, <&combphy1 PHY_TYPE_USB3>;
|
||||
+ phy-names = "usb2-phy", "usb3-phy";
|
||||
+ phy_type = "utmi_wide";
|
||||
+ power-domains = <&power RK3568_PD_PIPE>;
|
||||
+ resets = <&cru SRST_USB3OTG1>;
|
||||
+ snps,dis_u2_susphy_quirk;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
gic: interrupt-controller@fd400000 {
|
||||
compatible = "arm,gic-v3";
|
||||
reg = <0x0 0xfd400000 0 0x10000>, /* GICD */
|
||||
@@ -291,7 +325,6 @@
|
||||
};
|
||||
|
||||
pipegrf: syscon@fdc50000 {
|
||||
- compatible = "rockchip,rk3568-pipe-grf", "syscon";
|
||||
reg = <0x0 0xfdc50000 0x0 0x1000>;
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
From 431e7d2eece5b906578926d15ee22a70504c364d Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Fri, 29 Apr 2022 08:38:28 -0400
|
||||
Subject: [PATCH] PCI: rockchip-dwc: Reset core at driver probe
|
||||
|
||||
The PCIe controller is in an unknown state at driver probe. This can
|
||||
lead to undesireable effects when the driver attempts to configure the
|
||||
controller.
|
||||
|
||||
Prevent issues in the future by resetting the core during probe.
|
||||
|
||||
Link: https://lore.kernel.org/r/20220429123832.2376381-3-pgwipeout@gmail.com
|
||||
Tested-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
|
||||
---
|
||||
drivers/pci/controller/dwc/pcie-dw-rockchip.c | 23 ++++++++-----------
|
||||
1 file changed, 10 insertions(+), 13 deletions(-)
|
||||
|
||||
--- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
|
||||
+++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
|
||||
@@ -152,6 +152,11 @@ static int rockchip_pcie_resource_get(st
|
||||
if (IS_ERR(rockchip->rst_gpio))
|
||||
return PTR_ERR(rockchip->rst_gpio);
|
||||
|
||||
+ rockchip->rst = devm_reset_control_array_get_exclusive(&pdev->dev);
|
||||
+ if (IS_ERR(rockchip->rst))
|
||||
+ return dev_err_probe(&pdev->dev, PTR_ERR(rockchip->rst),
|
||||
+ "failed to get reset lines\n");
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -182,18 +187,6 @@ static void rockchip_pcie_phy_deinit(str
|
||||
phy_power_off(rockchip->phy);
|
||||
}
|
||||
|
||||
-static int rockchip_pcie_reset_control_release(struct rockchip_pcie *rockchip)
|
||||
-{
|
||||
- struct device *dev = rockchip->pci.dev;
|
||||
-
|
||||
- rockchip->rst = devm_reset_control_array_get_exclusive(dev);
|
||||
- if (IS_ERR(rockchip->rst))
|
||||
- return dev_err_probe(dev, PTR_ERR(rockchip->rst),
|
||||
- "failed to get reset lines\n");
|
||||
-
|
||||
- return reset_control_deassert(rockchip->rst);
|
||||
-}
|
||||
-
|
||||
static const struct dw_pcie_ops dw_pcie_ops = {
|
||||
.link_up = rockchip_pcie_link_up,
|
||||
.start_link = rockchip_pcie_start_link,
|
||||
@@ -222,6 +215,10 @@ static int rockchip_pcie_probe(struct pl
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ ret = reset_control_assert(rockchip->rst);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
/* DON'T MOVE ME: must be enable before PHY init */
|
||||
rockchip->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3");
|
||||
if (IS_ERR(rockchip->vpcie3v3)) {
|
||||
@@ -241,7 +238,7 @@ static int rockchip_pcie_probe(struct pl
|
||||
if (ret)
|
||||
goto disable_regulator;
|
||||
|
||||
- ret = rockchip_pcie_reset_control_release(rockchip);
|
||||
+ ret = reset_control_deassert(rockchip->rst);
|
||||
if (ret)
|
||||
goto deinit_phy;
|
||||
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
From e8aae154df6121167e5b4f156cfc2402e651d2b1 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Fri, 29 Apr 2022 08:38:29 -0400
|
||||
Subject: [PATCH] PCI: rockchip-dwc: Add legacy interrupt support
|
||||
|
||||
The legacy interrupts on the rk356x PCIe controller are handled by a
|
||||
single muxed interrupt. Add IRQ domain support to the pcie-dw-rockchip
|
||||
driver to support the virtual domain.
|
||||
|
||||
Link: https://lore.kernel.org/r/20220429123832.2376381-4-pgwipeout@gmail.com
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
|
||||
Reviewed-by: Marc Zyngier <maz@kernel.org>
|
||||
---
|
||||
drivers/pci/controller/dwc/pcie-dw-rockchip.c | 96 ++++++++++++++++++-
|
||||
1 file changed, 94 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
|
||||
+++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
|
||||
@@ -10,9 +10,12 @@
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
+#include <linux/irqchip/chained_irq.h>
|
||||
+#include <linux/irqdomain.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_device.h>
|
||||
+#include <linux/of_irq.h>
|
||||
#include <linux/phy/phy.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
@@ -26,6 +29,7 @@
|
||||
*/
|
||||
#define HIWORD_UPDATE(mask, val) (((mask) << 16) | (val))
|
||||
#define HIWORD_UPDATE_BIT(val) HIWORD_UPDATE(val, val)
|
||||
+#define HIWORD_DISABLE_BIT(val) HIWORD_UPDATE(val, ~val)
|
||||
|
||||
#define to_rockchip_pcie(x) dev_get_drvdata((x)->dev)
|
||||
|
||||
@@ -36,10 +40,12 @@
|
||||
#define PCIE_LINKUP (PCIE_SMLH_LINKUP | PCIE_RDLH_LINKUP)
|
||||
#define PCIE_L0S_ENTRY 0x11
|
||||
#define PCIE_CLIENT_GENERAL_CONTROL 0x0
|
||||
+#define PCIE_CLIENT_INTR_STATUS_LEGACY 0x8
|
||||
+#define PCIE_CLIENT_INTR_MASK_LEGACY 0x1c
|
||||
#define PCIE_CLIENT_GENERAL_DEBUG 0x104
|
||||
-#define PCIE_CLIENT_HOT_RESET_CTRL 0x180
|
||||
+#define PCIE_CLIENT_HOT_RESET_CTRL 0x180
|
||||
#define PCIE_CLIENT_LTSSM_STATUS 0x300
|
||||
-#define PCIE_LTSSM_ENABLE_ENHANCE BIT(4)
|
||||
+#define PCIE_LTSSM_ENABLE_ENHANCE BIT(4)
|
||||
#define PCIE_LTSSM_STATUS_MASK GENMASK(5, 0)
|
||||
|
||||
struct rockchip_pcie {
|
||||
@@ -51,6 +57,7 @@ struct rockchip_pcie {
|
||||
struct reset_control *rst;
|
||||
struct gpio_desc *rst_gpio;
|
||||
struct regulator *vpcie3v3;
|
||||
+ struct irq_domain *irq_domain;
|
||||
};
|
||||
|
||||
static int rockchip_pcie_readl_apb(struct rockchip_pcie *rockchip,
|
||||
@@ -65,6 +72,78 @@ static void rockchip_pcie_writel_apb(str
|
||||
writel_relaxed(val, rockchip->apb_base + reg);
|
||||
}
|
||||
|
||||
+static void rockchip_pcie_legacy_int_handler(struct irq_desc *desc)
|
||||
+{
|
||||
+ struct irq_chip *chip = irq_desc_get_chip(desc);
|
||||
+ struct rockchip_pcie *rockchip = irq_desc_get_handler_data(desc);
|
||||
+ unsigned long reg, hwirq;
|
||||
+
|
||||
+ chained_irq_enter(chip, desc);
|
||||
+
|
||||
+ reg = rockchip_pcie_readl_apb(rockchip, PCIE_CLIENT_INTR_STATUS_LEGACY);
|
||||
+
|
||||
+ for_each_set_bit(hwirq, ®, 4)
|
||||
+ generic_handle_domain_irq(rockchip->irq_domain, hwirq);
|
||||
+
|
||||
+ chained_irq_exit(chip, desc);
|
||||
+}
|
||||
+
|
||||
+static void rockchip_intx_mask(struct irq_data *data)
|
||||
+{
|
||||
+ rockchip_pcie_writel_apb(irq_data_get_irq_chip_data(data),
|
||||
+ HIWORD_UPDATE_BIT(BIT(data->hwirq)),
|
||||
+ PCIE_CLIENT_INTR_MASK_LEGACY);
|
||||
+};
|
||||
+
|
||||
+static void rockchip_intx_unmask(struct irq_data *data)
|
||||
+{
|
||||
+ rockchip_pcie_writel_apb(irq_data_get_irq_chip_data(data),
|
||||
+ HIWORD_DISABLE_BIT(BIT(data->hwirq)),
|
||||
+ PCIE_CLIENT_INTR_MASK_LEGACY);
|
||||
+};
|
||||
+
|
||||
+static struct irq_chip rockchip_intx_irq_chip = {
|
||||
+ .name = "INTx",
|
||||
+ .irq_mask = rockchip_intx_mask,
|
||||
+ .irq_unmask = rockchip_intx_unmask,
|
||||
+ .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND,
|
||||
+};
|
||||
+
|
||||
+static int rockchip_pcie_intx_map(struct irq_domain *domain, unsigned int irq,
|
||||
+ irq_hw_number_t hwirq)
|
||||
+{
|
||||
+ irq_set_chip_and_handler(irq, &rockchip_intx_irq_chip, handle_level_irq);
|
||||
+ irq_set_chip_data(irq, domain->host_data);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct irq_domain_ops intx_domain_ops = {
|
||||
+ .map = rockchip_pcie_intx_map,
|
||||
+};
|
||||
+
|
||||
+static int rockchip_pcie_init_irq_domain(struct rockchip_pcie *rockchip)
|
||||
+{
|
||||
+ struct device *dev = rockchip->pci.dev;
|
||||
+ struct device_node *intc;
|
||||
+
|
||||
+ intc = of_get_child_by_name(dev->of_node, "legacy-interrupt-controller");
|
||||
+ if (!intc) {
|
||||
+ dev_err(dev, "missing child interrupt-controller node\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ rockchip->irq_domain = irq_domain_add_linear(intc, PCI_NUM_INTX,
|
||||
+ &intx_domain_ops, rockchip);
|
||||
+ of_node_put(intc);
|
||||
+ if (!rockchip->irq_domain) {
|
||||
+ dev_err(dev, "failed to get a INTx IRQ domain\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static void rockchip_pcie_enable_ltssm(struct rockchip_pcie *rockchip)
|
||||
{
|
||||
rockchip_pcie_writel_apb(rockchip, PCIE_CLIENT_ENABLE_LTSSM,
|
||||
@@ -111,7 +190,20 @@ static int rockchip_pcie_host_init(struc
|
||||
{
|
||||
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
|
||||
struct rockchip_pcie *rockchip = to_rockchip_pcie(pci);
|
||||
+ struct device *dev = rockchip->pci.dev;
|
||||
u32 val = HIWORD_UPDATE_BIT(PCIE_LTSSM_ENABLE_ENHANCE);
|
||||
+ int irq, ret;
|
||||
+
|
||||
+ irq = of_irq_get_byname(dev->of_node, "legacy");
|
||||
+ if (irq < 0)
|
||||
+ return irq;
|
||||
+
|
||||
+ ret = rockchip_pcie_init_irq_domain(rockchip);
|
||||
+ if (ret < 0)
|
||||
+ dev_err(dev, "failed to init irq domain\n");
|
||||
+
|
||||
+ irq_set_chained_handler_and_data(irq, rockchip_pcie_legacy_int_handler,
|
||||
+ rockchip);
|
||||
|
||||
/* LTSSM enable control mode */
|
||||
rockchip_pcie_writel_apb(rockchip, val, PCIE_CLIENT_HOT_RESET_CTRL);
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
From 13e0ee34f39c01948a7bbaab0b3c225d9b00a5bb Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Fri, 29 Apr 2022 07:52:49 -0400
|
||||
Subject: [PATCH] arm64: dts: rockchip: add rk356x sfc support
|
||||
|
||||
Add the sfc node to the rk356x device tree. This enables spi flash
|
||||
support for this soc.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20220429115252.2360496-5-pgwipeout@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -729,6 +729,17 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ sfc: spi@fe300000 {
|
||||
+ compatible = "rockchip,sfc";
|
||||
+ reg = <0x0 0xfe300000 0x0 0x4000>;
|
||||
+ interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>;
|
||||
+ clock-names = "clk_sfc", "hclk_sfc";
|
||||
+ pinctrl-0 = <&fspi_pins>;
|
||||
+ pinctrl-names = "default";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
sdhci: mmc@fe310000 {
|
||||
compatible = "rockchip,rk3568-dwcmshc";
|
||||
reg = <0x0 0xfe310000 0x0 0x10000>;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
From cd2d081d18de396cb45636c215dc589a330b3f4e Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Wed, 11 May 2022 11:01:13 -0400
|
||||
Subject: [PATCH] arm64: dts: rockchip: add clocks to rk356x cru
|
||||
|
||||
The rk356x cru requires a 24m clock input to function. Add the clocks
|
||||
properties to the cru to clear some dtbs_check warnings.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20220511150117.113070-3-pgwipeout@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -363,6 +363,8 @@
|
||||
cru: clock-controller@fdd20000 {
|
||||
compatible = "rockchip,rk3568-cru";
|
||||
reg = <0x0 0xfdd20000 0x0 0x1000>;
|
||||
+ clocks = <&xin24m>;
|
||||
+ clock-names = "xin24m";
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
assigned-clocks = <&cru PLL_GPLL>, <&pmucru PLL_PPLL>;
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
From 66b51ea7d70fcc2ede87161c413fe1db4422bdac Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Fri, 29 Apr 2022 08:38:30 -0400
|
||||
Subject: [PATCH] arm64: dts: rockchip: Add rk3568 PCIe2x1 controller
|
||||
|
||||
The PCIe2x1 controller is common between the rk3568 and rk3566. It is a
|
||||
single lane PCIe2 compliant controller.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20220429123832.2376381-5-pgwipeout@gmail.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 50 ++++++++++++++++++++++++
|
||||
1 file changed, 50 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -703,6 +703,56 @@
|
||||
reg = <0x0 0xfe1a8100 0x0 0x20>;
|
||||
};
|
||||
|
||||
+ pcie2x1: pcie@fe260000 {
|
||||
+ compatible = "rockchip,rk3568-pcie";
|
||||
+ reg = <0x3 0xc0000000 0x0 0x00400000>,
|
||||
+ <0x0 0xfe260000 0x0 0x00010000>,
|
||||
+ <0x3 0x3f000000 0x0 0x01000000>;
|
||||
+ reg-names = "dbi", "apb", "config";
|
||||
+ interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "sys", "pmc", "msi", "legacy", "err";
|
||||
+ bus-range = <0x0 0xf>;
|
||||
+ clocks = <&cru ACLK_PCIE20_MST>, <&cru ACLK_PCIE20_SLV>,
|
||||
+ <&cru ACLK_PCIE20_DBI>, <&cru PCLK_PCIE20>,
|
||||
+ <&cru CLK_PCIE20_AUX_NDFT>;
|
||||
+ clock-names = "aclk_mst", "aclk_slv",
|
||||
+ "aclk_dbi", "pclk", "aux";
|
||||
+ device_type = "pci";
|
||||
+ interrupt-map-mask = <0 0 0 7>;
|
||||
+ interrupt-map = <0 0 0 1 &pcie_intc 0>,
|
||||
+ <0 0 0 2 &pcie_intc 1>,
|
||||
+ <0 0 0 3 &pcie_intc 2>,
|
||||
+ <0 0 0 4 &pcie_intc 3>;
|
||||
+ linux,pci-domain = <0>;
|
||||
+ num-ib-windows = <6>;
|
||||
+ num-ob-windows = <2>;
|
||||
+ max-link-speed = <2>;
|
||||
+ msi-map = <0x0 &gic 0x0 0x1000>;
|
||||
+ num-lanes = <1>;
|
||||
+ phys = <&combphy2 PHY_TYPE_PCIE>;
|
||||
+ phy-names = "pcie-phy";
|
||||
+ power-domains = <&power RK3568_PD_PIPE>;
|
||||
+ ranges = <0x01000000 0x0 0x3ef00000 0x3 0x3ef00000 0x0 0x00100000
|
||||
+ 0x02000000 0x0 0x00000000 0x3 0x00000000 0x0 0x3ef00000>;
|
||||
+ resets = <&cru SRST_PCIE20_POWERUP>;
|
||||
+ reset-names = "pipe";
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ pcie_intc: legacy-interrupt-controller {
|
||||
+ #address-cells = <0>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+ interrupt-controller;
|
||||
+ interrupt-parent = <&gic>;
|
||||
+ interrupts = <GIC_SPI 72 IRQ_TYPE_EDGE_RISING>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
sdmmc0: mmc@fe2b0000 {
|
||||
compatible = "rockchip,rk3568-dw-mshc", "rockchip,rk3288-dw-mshc";
|
||||
reg = <0x0 0xfe2b0000 0x0 0x4000>;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
From a323e6b5737bb6e3d3946369b97099abb7dde695 Mon Sep 17 00:00:00 2001
|
||||
From: Jensen Huang <jensenhuang@friendlyarm.com>
|
||||
Date: Fri, 13 Jan 2023 14:44:57 +0800
|
||||
Subject: [PATCH] arm64: dts: rockchip: add missing #interrupt-cells to rk356x
|
||||
pcie2x1
|
||||
|
||||
This fixes the following issue:
|
||||
pcieport 0000:00:00.0: of_irq_parse_pci: failed with rc=-22
|
||||
|
||||
Signed-off-by: Jensen Huang <jensenhuang@friendlyarm.com>
|
||||
Link: https://lore.kernel.org/r/20230113064457.7105-1-jensenhuang@friendlyarm.com
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -722,6 +722,7 @@
|
||||
clock-names = "aclk_mst", "aclk_slv",
|
||||
"aclk_dbi", "pclk", "aux";
|
||||
device_type = "pci";
|
||||
+ #interrupt-cells = <1>;
|
||||
interrupt-map-mask = <0 0 0 7>;
|
||||
interrupt-map = <0 0 0 1 &pcie_intc 0>,
|
||||
<0 0 0 2 &pcie_intc 1>,
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
From 64b69474edf3b885c19a89bb165f978ba1b4be00 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Tue, 10 Jan 2023 22:55:50 +0000
|
||||
Subject: [PATCH] arm64: dts: rockchip: assign rate to clk_rtc_32k on rk356x
|
||||
|
||||
clk_rtc_32k and its child clock clk_hdmi_cec detauls to a rate of 24 MHz
|
||||
and not to 32 kHz on RK356x.
|
||||
|
||||
Fix this by assigning clk_rtc_32k a rate of 32768, also assign the parent
|
||||
to clk_rtc32k_frac.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
Link: https://lore.kernel.org/r/20230110225547.1563119-2-jonas@kwiboo.se
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -367,8 +367,9 @@
|
||||
clock-names = "xin24m";
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
- assigned-clocks = <&cru PLL_GPLL>, <&pmucru PLL_PPLL>;
|
||||
- assigned-clock-rates = <1200000000>, <200000000>;
|
||||
+ assigned-clocks = <&pmucru CLK_RTC_32K>, <&cru PLL_GPLL>, <&pmucru PLL_PPLL>;
|
||||
+ assigned-clock-rates = <32768>, <1200000000>, <200000000>;
|
||||
+ assigned-clock-parents = <&pmucru CLK_RTC32K_FRAC>;
|
||||
rockchip,grf = <&grf>;
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
From 604be85547ce4d61b89292d2f9a78c721b778c16 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Yan <andy.yan@rock-chips.com>
|
||||
Date: Fri, 22 Apr 2022 09:28:39 +0200
|
||||
Subject: [PATCH] drm/rockchip: Add VOP2 driver
|
||||
|
||||
The VOP2 unit is found on Rockchip SoCs beginning with rk3566/rk3568.
|
||||
It replaces the VOP unit found in the older Rockchip SoCs.
|
||||
|
||||
This driver has been derived from the downstream Rockchip Kernel and
|
||||
heavily modified:
|
||||
|
||||
- All nonstandard DRM properties have been removed
|
||||
- dropped struct vop2_plane_state and pass around less data between
|
||||
functions
|
||||
- Dropped all DRM_FORMAT_* not known on upstream
|
||||
- rework register access to get rid of excessively used macros
|
||||
- Drop all waiting for framesyncs
|
||||
|
||||
The driver is tested with HDMI and MIPI-DSI display on a RK3568-EVB
|
||||
board. Overlay support is tested with the modetest utility. AFBC support
|
||||
on the cluster windows is tested with weston-simple-dmabuf-egl on
|
||||
weston using the (yet to be upstreamed) panfrost driver support.
|
||||
|
||||
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
|
||||
Co-Developed-by: Sascha Hauer <s.hauer@pengutronix.de>
|
||||
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
||||
Tested-by: Michael Riesch <michael.riesch@wolfvision.net>
|
||||
[dt-binding-header:]
|
||||
Acked-by: Rob Herring <robh@kernel.org>
|
||||
[moved dt-binding header from dt-nodes patch to here
|
||||
and made checkpatch --strict happier]
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
Link: https://patchwork.freedesktop.org/patch/msgid/20220422072841.2206452-23-s.hauer@pengutronix.de
|
||||
---
|
||||
drivers/gpu/drm/rockchip/Kconfig | 6 +
|
||||
drivers/gpu/drm/rockchip/Makefile | 1 +
|
||||
drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 1 +
|
||||
drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 6 +-
|
||||
drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 2 +
|
||||
drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 14 +
|
||||
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 2706 ++++++++++++++++++
|
||||
drivers/gpu/drm/rockchip/rockchip_drm_vop2.h | 477 +++
|
||||
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 281 ++
|
||||
include/dt-bindings/soc/rockchip,vop2.h | 14 +
|
||||
10 files changed, 3507 insertions(+), 1 deletion(-)
|
||||
create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
|
||||
create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_vop2.h
|
||||
create mode 100644 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
|
||||
create mode 100644 include/dt-bindings/soc/rockchip,vop2.h
|
||||
|
||||
--- /dev/null
|
||||
+++ b/include/dt-bindings/soc/rockchip,vop2.h
|
||||
@@ -0,0 +1,14 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
|
||||
+
|
||||
+#ifndef __DT_BINDINGS_ROCKCHIP_VOP2_H
|
||||
+#define __DT_BINDINGS_ROCKCHIP_VOP2_H
|
||||
+
|
||||
+#define ROCKCHIP_VOP2_EP_RGB0 1
|
||||
+#define ROCKCHIP_VOP2_EP_HDMI0 2
|
||||
+#define ROCKCHIP_VOP2_EP_EDP0 3
|
||||
+#define ROCKCHIP_VOP2_EP_MIPI0 4
|
||||
+#define ROCKCHIP_VOP2_EP_LVDS0 5
|
||||
+#define ROCKCHIP_VOP2_EP_MIPI1 6
|
||||
+#define ROCKCHIP_VOP2_EP_LVDS1 7
|
||||
+
|
||||
+#endif /* __DT_BINDINGS_ROCKCHIP_VOP2_H */
|
||||
|
|
@ -0,0 +1,394 @@
|
|||
From 2e9bffc4f713db465177238f6033f7d367d6f151 Mon Sep 17 00:00:00 2001
|
||||
From: Shawn Lin <shawn.lin@rock-chips.com>
|
||||
Date: Thu, 25 Aug 2022 21:38:34 +0200
|
||||
Subject: [PATCH] phy: rockchip: Support PCIe v3
|
||||
|
||||
RK3568 supports PCIe v3 using not Combphy like PCIe v2 on rk3566.
|
||||
It use a dedicated PCIe-phy. Add support for this.
|
||||
|
||||
Initial support by Shawn Lin, modifications by Peter Geis and Frank
|
||||
Wunderlich.
|
||||
|
||||
Add data-lanes property for splitting pcie-lanes across controllers.
|
||||
|
||||
The data-lanes is an array where x=0 means lane is disabled and x > 0
|
||||
means controller x is assigned to phy lane.
|
||||
|
||||
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
|
||||
Suggested-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Link: https://lore.kernel.org/r/20220825193836.54262-4-linux@fw-web.de
|
||||
Signed-off-by: Vinod Koul <vkoul@kernel.org>
|
||||
---
|
||||
drivers/phy/rockchip/Kconfig | 9 +
|
||||
drivers/phy/rockchip/Makefile | 1 +
|
||||
.../phy/rockchip/phy-rockchip-snps-pcie3.c | 319 ++++++++++++++++++
|
||||
include/linux/phy/pcie.h | 12 +
|
||||
4 files changed, 341 insertions(+)
|
||||
create mode 100644 drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
|
||||
create mode 100644 include/linux/phy/pcie.h
|
||||
|
||||
--- a/drivers/phy/rockchip/Kconfig
|
||||
+++ b/drivers/phy/rockchip/Kconfig
|
||||
@@ -83,6 +83,15 @@ config PHY_ROCKCHIP_PCIE
|
||||
help
|
||||
Enable this to support the Rockchip PCIe PHY.
|
||||
|
||||
+config PHY_ROCKCHIP_SNPS_PCIE3
|
||||
+ tristate "Rockchip Snps PCIe3 PHY Driver"
|
||||
+ depends on (ARCH_ROCKCHIP && OF) || COMPILE_TEST
|
||||
+ depends on HAS_IOMEM
|
||||
+ select GENERIC_PHY
|
||||
+ select MFD_SYSCON
|
||||
+ help
|
||||
+ Enable this to support the Rockchip snps PCIe3 PHY.
|
||||
+
|
||||
config PHY_ROCKCHIP_TYPEC
|
||||
tristate "Rockchip TYPEC PHY Driver"
|
||||
depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST)
|
||||
--- a/drivers/phy/rockchip/Makefile
|
||||
+++ b/drivers/phy/rockchip/Makefile
|
||||
@@ -8,5 +8,6 @@ obj-$(CONFIG_PHY_ROCKCHIP_INNO_HDMI) +=
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2) += phy-rockchip-inno-usb2.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY) += phy-rockchip-naneng-combphy.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_PCIE) += phy-rockchip-pcie.o
|
||||
+obj-$(CONFIG_PHY_ROCKCHIP_SNPS_PCIE3) += phy-rockchip-snps-pcie3.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.o
|
||||
obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
|
||||
@@ -0,0 +1,319 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Rockchip PCIE3.0 phy driver
|
||||
+ *
|
||||
+ * Copyright (C) 2022 Rockchip Electronics Co., Ltd.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/clk.h>
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/iopoll.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/mfd/syscon.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of_device.h>
|
||||
+#include <linux/phy/pcie.h>
|
||||
+#include <linux/phy/phy.h>
|
||||
+#include <linux/regmap.h>
|
||||
+#include <linux/reset.h>
|
||||
+
|
||||
+/* Register for RK3568 */
|
||||
+#define GRF_PCIE30PHY_CON1 0x4
|
||||
+#define GRF_PCIE30PHY_CON6 0x18
|
||||
+#define GRF_PCIE30PHY_CON9 0x24
|
||||
+#define GRF_PCIE30PHY_DA_OCM (BIT(15) | BIT(31))
|
||||
+#define GRF_PCIE30PHY_STATUS0 0x80
|
||||
+#define GRF_PCIE30PHY_WR_EN (0xf << 16)
|
||||
+#define SRAM_INIT_DONE(reg) (reg & BIT(14))
|
||||
+
|
||||
+#define RK3568_BIFURCATION_LANE_0_1 BIT(0)
|
||||
+
|
||||
+/* Register for RK3588 */
|
||||
+#define PHP_GRF_PCIESEL_CON 0x100
|
||||
+#define RK3588_PCIE3PHY_GRF_CMN_CON0 0x0
|
||||
+#define RK3588_PCIE3PHY_GRF_PHY0_STATUS1 0x904
|
||||
+#define RK3588_PCIE3PHY_GRF_PHY1_STATUS1 0xa04
|
||||
+#define RK3588_SRAM_INIT_DONE(reg) (reg & BIT(0))
|
||||
+
|
||||
+#define RK3588_BIFURCATION_LANE_0_1 BIT(0)
|
||||
+#define RK3588_BIFURCATION_LANE_2_3 BIT(1)
|
||||
+#define RK3588_LANE_AGGREGATION BIT(2)
|
||||
+
|
||||
+struct rockchip_p3phy_ops;
|
||||
+
|
||||
+struct rockchip_p3phy_priv {
|
||||
+ const struct rockchip_p3phy_ops *ops;
|
||||
+ void __iomem *mmio;
|
||||
+ /* mode: RC, EP */
|
||||
+ int mode;
|
||||
+ /* pcie30_phymode: Aggregation, Bifurcation */
|
||||
+ int pcie30_phymode;
|
||||
+ struct regmap *phy_grf;
|
||||
+ struct regmap *pipe_grf;
|
||||
+ struct reset_control *p30phy;
|
||||
+ struct phy *phy;
|
||||
+ struct clk_bulk_data *clks;
|
||||
+ int num_clks;
|
||||
+ int num_lanes;
|
||||
+ u32 lanes[4];
|
||||
+};
|
||||
+
|
||||
+struct rockchip_p3phy_ops {
|
||||
+ int (*phy_init)(struct rockchip_p3phy_priv *priv);
|
||||
+};
|
||||
+
|
||||
+static int rockchip_p3phy_set_mode(struct phy *phy, enum phy_mode mode, int submode)
|
||||
+{
|
||||
+ struct rockchip_p3phy_priv *priv = phy_get_drvdata(phy);
|
||||
+
|
||||
+ /* Actually We don't care EP/RC mode, but just record it */
|
||||
+ switch (submode) {
|
||||
+ case PHY_MODE_PCIE_RC:
|
||||
+ priv->mode = PHY_MODE_PCIE_RC;
|
||||
+ break;
|
||||
+ case PHY_MODE_PCIE_EP:
|
||||
+ priv->mode = PHY_MODE_PCIE_EP;
|
||||
+ break;
|
||||
+ default:
|
||||
+ dev_err(&phy->dev, "%s, invalid mode\n", __func__);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rockchip_p3phy_rk3568_init(struct rockchip_p3phy_priv *priv)
|
||||
+{
|
||||
+ struct phy *phy = priv->phy;
|
||||
+ bool bifurcation = false;
|
||||
+ int ret, i;
|
||||
+ u32 reg;
|
||||
+
|
||||
+ /* Deassert PCIe PMA output clamp mode */
|
||||
+ regmap_write(priv->phy_grf, GRF_PCIE30PHY_CON9, GRF_PCIE30PHY_DA_OCM);
|
||||
+
|
||||
+ for (i = 0; i < priv->num_lanes; i++) {
|
||||
+ dev_info(&phy->dev, "lane number %d, val %d\n", i, priv->lanes[i]);
|
||||
+ if (priv->lanes[i] > 1)
|
||||
+ bifurcation = true;
|
||||
+ }
|
||||
+
|
||||
+ /* Set bifurcation if needed, and it doesn't care RC/EP */
|
||||
+ if (bifurcation) {
|
||||
+ dev_info(&phy->dev, "bifurcation enabled\n");
|
||||
+ regmap_write(priv->phy_grf, GRF_PCIE30PHY_CON6,
|
||||
+ GRF_PCIE30PHY_WR_EN | RK3568_BIFURCATION_LANE_0_1);
|
||||
+ regmap_write(priv->phy_grf, GRF_PCIE30PHY_CON1,
|
||||
+ GRF_PCIE30PHY_DA_OCM);
|
||||
+ } else {
|
||||
+ dev_dbg(&phy->dev, "bifurcation disabled\n");
|
||||
+ regmap_write(priv->phy_grf, GRF_PCIE30PHY_CON6,
|
||||
+ GRF_PCIE30PHY_WR_EN & ~RK3568_BIFURCATION_LANE_0_1);
|
||||
+ }
|
||||
+
|
||||
+ reset_control_deassert(priv->p30phy);
|
||||
+
|
||||
+ ret = regmap_read_poll_timeout(priv->phy_grf,
|
||||
+ GRF_PCIE30PHY_STATUS0,
|
||||
+ reg, SRAM_INIT_DONE(reg),
|
||||
+ 0, 500);
|
||||
+ if (ret)
|
||||
+ dev_err(&priv->phy->dev, "%s: lock failed 0x%x, check input refclk and power supply\n",
|
||||
+ __func__, reg);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static const struct rockchip_p3phy_ops rk3568_ops = {
|
||||
+ .phy_init = rockchip_p3phy_rk3568_init,
|
||||
+};
|
||||
+
|
||||
+static int rockchip_p3phy_rk3588_init(struct rockchip_p3phy_priv *priv)
|
||||
+{
|
||||
+ u32 reg = 0;
|
||||
+ u8 mode = 0;
|
||||
+ int i, ret;
|
||||
+
|
||||
+ /* Deassert PCIe PMA output clamp mode */
|
||||
+ regmap_write(priv->phy_grf, RK3588_PCIE3PHY_GRF_CMN_CON0, BIT(8) | BIT(24));
|
||||
+
|
||||
+ /* Set bifurcation if needed */
|
||||
+ for (i = 0; i < priv->num_lanes; i++) {
|
||||
+ if (!priv->lanes[i])
|
||||
+ mode |= (BIT(i) << 3);
|
||||
+
|
||||
+ if (priv->lanes[i] > 1)
|
||||
+ mode |= (BIT(i) >> 1);
|
||||
+ }
|
||||
+
|
||||
+ if (!mode)
|
||||
+ reg = RK3588_LANE_AGGREGATION;
|
||||
+ else {
|
||||
+ if (mode & (BIT(0) | BIT(1)))
|
||||
+ reg |= RK3588_BIFURCATION_LANE_0_1;
|
||||
+
|
||||
+ if (mode & (BIT(2) | BIT(3)))
|
||||
+ reg |= RK3588_BIFURCATION_LANE_2_3;
|
||||
+ }
|
||||
+
|
||||
+ regmap_write(priv->phy_grf, RK3588_PCIE3PHY_GRF_CMN_CON0, (0x7<<16) | reg);
|
||||
+
|
||||
+ /* Set pcie1ln_sel in PHP_GRF_PCIESEL_CON */
|
||||
+ if (!IS_ERR(priv->pipe_grf)) {
|
||||
+ reg = (mode & (BIT(6) | BIT(7))) >> 6;
|
||||
+ if (reg)
|
||||
+ regmap_write(priv->pipe_grf, PHP_GRF_PCIESEL_CON,
|
||||
+ (reg << 16) | reg);
|
||||
+ }
|
||||
+
|
||||
+ reset_control_deassert(priv->p30phy);
|
||||
+
|
||||
+ ret = regmap_read_poll_timeout(priv->phy_grf,
|
||||
+ RK3588_PCIE3PHY_GRF_PHY0_STATUS1,
|
||||
+ reg, RK3588_SRAM_INIT_DONE(reg),
|
||||
+ 0, 500);
|
||||
+ ret |= regmap_read_poll_timeout(priv->phy_grf,
|
||||
+ RK3588_PCIE3PHY_GRF_PHY1_STATUS1,
|
||||
+ reg, RK3588_SRAM_INIT_DONE(reg),
|
||||
+ 0, 500);
|
||||
+ if (ret)
|
||||
+ dev_err(&priv->phy->dev, "lock failed 0x%x, check input refclk and power supply\n",
|
||||
+ reg);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static const struct rockchip_p3phy_ops rk3588_ops = {
|
||||
+ .phy_init = rockchip_p3phy_rk3588_init,
|
||||
+};
|
||||
+
|
||||
+static int rochchip_p3phy_init(struct phy *phy)
|
||||
+{
|
||||
+ struct rockchip_p3phy_priv *priv = phy_get_drvdata(phy);
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = clk_bulk_prepare_enable(priv->num_clks, priv->clks);
|
||||
+ if (ret) {
|
||||
+ dev_err(&priv->phy->dev, "failed to enable PCIe bulk clks %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ reset_control_assert(priv->p30phy);
|
||||
+ udelay(1);
|
||||
+
|
||||
+ if (priv->ops->phy_init) {
|
||||
+ ret = priv->ops->phy_init(priv);
|
||||
+ if (ret)
|
||||
+ clk_bulk_disable_unprepare(priv->num_clks, priv->clks);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int rochchip_p3phy_exit(struct phy *phy)
|
||||
+{
|
||||
+ struct rockchip_p3phy_priv *priv = phy_get_drvdata(phy);
|
||||
+
|
||||
+ clk_bulk_disable_unprepare(priv->num_clks, priv->clks);
|
||||
+ reset_control_assert(priv->p30phy);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct phy_ops rochchip_p3phy_ops = {
|
||||
+ .init = rochchip_p3phy_init,
|
||||
+ .exit = rochchip_p3phy_exit,
|
||||
+ .set_mode = rockchip_p3phy_set_mode,
|
||||
+ .owner = THIS_MODULE,
|
||||
+};
|
||||
+
|
||||
+static int rockchip_p3phy_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct phy_provider *phy_provider;
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct rockchip_p3phy_priv *priv;
|
||||
+ struct device_node *np = dev->of_node;
|
||||
+ struct resource *res;
|
||||
+ int ret;
|
||||
+
|
||||
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
+ if (!priv)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ priv->mmio = devm_ioremap_resource(dev, res);
|
||||
+ if (IS_ERR(priv->mmio)) {
|
||||
+ ret = PTR_ERR(priv->mmio);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ priv->ops = of_device_get_match_data(&pdev->dev);
|
||||
+ if (!priv->ops) {
|
||||
+ dev_err(dev, "no of match data provided\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ priv->phy_grf = syscon_regmap_lookup_by_phandle(np, "rockchip,phy-grf");
|
||||
+ if (IS_ERR(priv->phy_grf)) {
|
||||
+ dev_err(dev, "failed to find rockchip,phy_grf regmap\n");
|
||||
+ return PTR_ERR(priv->phy_grf);
|
||||
+ }
|
||||
+
|
||||
+ priv->pipe_grf = syscon_regmap_lookup_by_phandle(dev->of_node,
|
||||
+ "rockchip,pipe-grf");
|
||||
+ if (IS_ERR(priv->pipe_grf))
|
||||
+ dev_info(dev, "failed to find rockchip,pipe_grf regmap\n");
|
||||
+
|
||||
+ priv->num_lanes = of_property_read_variable_u32_array(dev->of_node, "data-lanes",
|
||||
+ priv->lanes, 2,
|
||||
+ ARRAY_SIZE(priv->lanes));
|
||||
+
|
||||
+ /* if no data-lanes assume aggregation */
|
||||
+ if (priv->num_lanes == -EINVAL) {
|
||||
+ dev_dbg(dev, "no data-lanes property found\n");
|
||||
+ priv->num_lanes = 1;
|
||||
+ priv->lanes[0] = 1;
|
||||
+ } else if (priv->num_lanes < 0) {
|
||||
+ dev_err(dev, "failed to read data-lanes property %d\n", priv->num_lanes);
|
||||
+ return priv->num_lanes;
|
||||
+ }
|
||||
+
|
||||
+ priv->phy = devm_phy_create(dev, NULL, &rochchip_p3phy_ops);
|
||||
+ if (IS_ERR(priv->phy)) {
|
||||
+ dev_err(dev, "failed to create combphy\n");
|
||||
+ return PTR_ERR(priv->phy);
|
||||
+ }
|
||||
+
|
||||
+ priv->p30phy = devm_reset_control_get_optional_exclusive(dev, "phy");
|
||||
+ if (IS_ERR(priv->p30phy)) {
|
||||
+ return dev_err_probe(dev, PTR_ERR(priv->p30phy),
|
||||
+ "failed to get phy reset control\n");
|
||||
+ }
|
||||
+ if (!priv->p30phy)
|
||||
+ dev_info(dev, "no phy reset control specified\n");
|
||||
+
|
||||
+ priv->num_clks = devm_clk_bulk_get_all(dev, &priv->clks);
|
||||
+ if (priv->num_clks < 1)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ dev_set_drvdata(dev, priv);
|
||||
+ phy_set_drvdata(priv->phy, priv);
|
||||
+ phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
|
||||
+ return PTR_ERR_OR_ZERO(phy_provider);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id rockchip_p3phy_of_match[] = {
|
||||
+ { .compatible = "rockchip,rk3568-pcie3-phy", .data = &rk3568_ops },
|
||||
+ { .compatible = "rockchip,rk3588-pcie3-phy", .data = &rk3588_ops },
|
||||
+ { },
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rockchip_p3phy_of_match);
|
||||
+
|
||||
+static struct platform_driver rockchip_p3phy_driver = {
|
||||
+ .probe = rockchip_p3phy_probe,
|
||||
+ .driver = {
|
||||
+ .name = "rockchip-snps-pcie3-phy",
|
||||
+ .of_match_table = rockchip_p3phy_of_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(rockchip_p3phy_driver);
|
||||
+MODULE_DESCRIPTION("Rockchip Synopsys PCIe 3.0 PHY driver");
|
||||
+MODULE_LICENSE("GPL");
|
||||
--- /dev/null
|
||||
+++ b/include/linux/phy/pcie.h
|
||||
@@ -0,0 +1,12 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+/*
|
||||
+ * Copyright (c) 2022 Rockchip Electronics Co., Ltd.
|
||||
+ */
|
||||
+#ifndef __PHY_PCIE_H
|
||||
+#define __PHY_PCIE_H
|
||||
+
|
||||
+#define PHY_MODE_PCIE_RC 20
|
||||
+#define PHY_MODE_PCIE_EP 21
|
||||
+#define PHY_MODE_PCIE_BIFURCATION 22
|
||||
+
|
||||
+#endif
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
From faedfa5b40f095d09040c3a040e2f8dee4a36b4b Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Thu, 25 Aug 2022 21:38:35 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: Add PCIe v3 nodes to rk3568
|
||||
|
||||
Add nodes to rk356x devicetree to support PCIe v3.
|
||||
|
||||
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
|
||||
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Link: https://lore.kernel.org/r/20220825193836.54262-5-linux@fw-web.de
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3568.dtsi | 122 +++++++++++++++++++++++
|
||||
1 file changed, 122 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
@@ -42,6 +42,128 @@
|
||||
reg = <0x0 0xfe190200 0x0 0x20>;
|
||||
};
|
||||
|
||||
+ pcie30_phy_grf: syscon@fdcb8000 {
|
||||
+ compatible = "rockchip,rk3568-pcie3-phy-grf", "syscon";
|
||||
+ reg = <0x0 0xfdcb8000 0x0 0x10000>;
|
||||
+ };
|
||||
+
|
||||
+ pcie30phy: phy@fe8c0000 {
|
||||
+ compatible = "rockchip,rk3568-pcie3-phy";
|
||||
+ reg = <0x0 0xfe8c0000 0x0 0x20000>;
|
||||
+ #phy-cells = <0>;
|
||||
+ clocks = <&pmucru CLK_PCIE30PHY_REF_M>, <&pmucru CLK_PCIE30PHY_REF_N>,
|
||||
+ <&cru PCLK_PCIE30PHY>;
|
||||
+ clock-names = "refclk_m", "refclk_n", "pclk";
|
||||
+ resets = <&cru SRST_PCIE30PHY>;
|
||||
+ reset-names = "phy";
|
||||
+ rockchip,phy-grf = <&pcie30_phy_grf>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pcie3x1: pcie@fe270000 {
|
||||
+ compatible = "rockchip,rk3568-pcie";
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+ bus-range = <0x0 0xf>;
|
||||
+ clocks = <&cru ACLK_PCIE30X1_MST>, <&cru ACLK_PCIE30X1_SLV>,
|
||||
+ <&cru ACLK_PCIE30X1_DBI>, <&cru PCLK_PCIE30X1>,
|
||||
+ <&cru CLK_PCIE30X1_AUX_NDFT>;
|
||||
+ clock-names = "aclk_mst", "aclk_slv",
|
||||
+ "aclk_dbi", "pclk", "aux";
|
||||
+ device_type = "pci";
|
||||
+ interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 156 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "sys", "pmc", "msg", "legacy", "err";
|
||||
+ #interrupt-cells = <1>;
|
||||
+ interrupt-map-mask = <0 0 0 7>;
|
||||
+ interrupt-map = <0 0 0 1 &pcie3x1_intc 0>,
|
||||
+ <0 0 0 2 &pcie3x1_intc 1>,
|
||||
+ <0 0 0 3 &pcie3x1_intc 2>,
|
||||
+ <0 0 0 4 &pcie3x1_intc 3>;
|
||||
+ linux,pci-domain = <1>;
|
||||
+ num-ib-windows = <6>;
|
||||
+ num-ob-windows = <2>;
|
||||
+ max-link-speed = <3>;
|
||||
+ msi-map = <0x0 &gic 0x1000 0x1000>;
|
||||
+ num-lanes = <1>;
|
||||
+ phys = <&pcie30phy>;
|
||||
+ phy-names = "pcie-phy";
|
||||
+ power-domains = <&power RK3568_PD_PIPE>;
|
||||
+ reg = <0x3 0xc0400000 0x0 0x00400000>,
|
||||
+ <0x0 0xfe270000 0x0 0x00010000>,
|
||||
+ <0x3 0x7f000000 0x0 0x01000000>;
|
||||
+ ranges = <0x01000000 0x0 0x3ef00000 0x3 0x7ef00000 0x0 0x00100000>,
|
||||
+ <0x02000000 0x0 0x00000000 0x3 0x40000000 0x0 0x3ef00000>;
|
||||
+ reg-names = "dbi", "apb", "config";
|
||||
+ resets = <&cru SRST_PCIE30X1_POWERUP>;
|
||||
+ reset-names = "pipe";
|
||||
+ /* bifurcation; lane1 when using 1+1 */
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ pcie3x1_intc: legacy-interrupt-controller {
|
||||
+ interrupt-controller;
|
||||
+ #address-cells = <0>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+ interrupt-parent = <&gic>;
|
||||
+ interrupts = <GIC_SPI 157 IRQ_TYPE_EDGE_RISING>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pcie3x2: pcie@fe280000 {
|
||||
+ compatible = "rockchip,rk3568-pcie";
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+ bus-range = <0x0 0xf>;
|
||||
+ clocks = <&cru ACLK_PCIE30X2_MST>, <&cru ACLK_PCIE30X2_SLV>,
|
||||
+ <&cru ACLK_PCIE30X2_DBI>, <&cru PCLK_PCIE30X2>,
|
||||
+ <&cru CLK_PCIE30X2_AUX_NDFT>;
|
||||
+ clock-names = "aclk_mst", "aclk_slv",
|
||||
+ "aclk_dbi", "pclk", "aux";
|
||||
+ device_type = "pci";
|
||||
+ interrupts = <GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "sys", "pmc", "msg", "legacy", "err";
|
||||
+ #interrupt-cells = <1>;
|
||||
+ interrupt-map-mask = <0 0 0 7>;
|
||||
+ interrupt-map = <0 0 0 1 &pcie3x2_intc 0>,
|
||||
+ <0 0 0 2 &pcie3x2_intc 1>,
|
||||
+ <0 0 0 3 &pcie3x2_intc 2>,
|
||||
+ <0 0 0 4 &pcie3x2_intc 3>;
|
||||
+ linux,pci-domain = <2>;
|
||||
+ num-ib-windows = <6>;
|
||||
+ num-ob-windows = <2>;
|
||||
+ max-link-speed = <3>;
|
||||
+ msi-map = <0x0 &gic 0x2000 0x1000>;
|
||||
+ num-lanes = <2>;
|
||||
+ phys = <&pcie30phy>;
|
||||
+ phy-names = "pcie-phy";
|
||||
+ power-domains = <&power RK3568_PD_PIPE>;
|
||||
+ reg = <0x3 0xc0800000 0x0 0x00400000>,
|
||||
+ <0x0 0xfe280000 0x0 0x00010000>,
|
||||
+ <0x3 0xbf000000 0x0 0x01000000>;
|
||||
+ ranges = <0x01000000 0x0 0x3ef00000 0x3 0xbef00000 0x0 0x00100000>,
|
||||
+ <0x02000000 0x0 0x00000000 0x3 0x80000000 0x0 0x3ef00000>;
|
||||
+ reg-names = "dbi", "apb", "config";
|
||||
+ resets = <&cru SRST_PCIE30X2_POWERUP>;
|
||||
+ reset-names = "pipe";
|
||||
+ /* bifurcation; lane0 when using 1+1 */
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ pcie3x2_intc: legacy-interrupt-controller {
|
||||
+ interrupt-controller;
|
||||
+ #address-cells = <0>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+ interrupt-parent = <&gic>;
|
||||
+ interrupts = <GIC_SPI 162 IRQ_TYPE_EDGE_RISING>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
gmac0: ethernet@fe2a0000 {
|
||||
compatible = "rockchip,rk3568-gmac", "snps,dwmac-4.20a";
|
||||
reg = <0x0 0xfe2a0000 0x0 0x10000>;
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,138 @@
|
|||
From 813abcd98fb1b2cccf850cdfa092a4bfc50b2363 Mon Sep 17 00:00:00 2001
|
||||
From: Frank <Frank.Sae@motor-comm.com>
|
||||
Date: Tue, 22 Nov 2022 16:42:32 +0800
|
||||
Subject: [PATCH] net: phy: add Motorcomm YT8531S phy id.
|
||||
|
||||
We added patch for motorcomm.c to support YT8531S. This patch has
|
||||
been tested on AM335x platform which has one YT8531S interface
|
||||
card and passed all test cases.
|
||||
The tested cases indluding: YT8531S UTP function with support of
|
||||
10M/100M/1000M; YT8531S Fiber function with support of 100M/1000M;
|
||||
and YT8531S Combo function that supports auto detection of media type.
|
||||
|
||||
Since most functions of YT8531S are similar to YT8521 and we reuse some
|
||||
codes for YT8521 in the patch file.
|
||||
|
||||
Signed-off-by: Frank <Frank.Sae@motor-comm.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/Kconfig | 2 +-
|
||||
drivers/net/phy/motorcomm.c | 52 +++++++++++++++++++++++++++++++++----
|
||||
2 files changed, 48 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -319,7 +319,7 @@ config MOTORCOMM_PHY
|
||||
tristate "Motorcomm PHYs"
|
||||
help
|
||||
Enables support for Motorcomm network PHYs.
|
||||
- Currently supports the YT8511, YT8521 Gigabit Ethernet PHYs.
|
||||
+ Currently supports the YT8511, YT8521, YT8531S Gigabit Ethernet PHYs.
|
||||
|
||||
config NATIONAL_PHY
|
||||
tristate "National Semiconductor PHYs"
|
||||
--- a/drivers/net/phy/motorcomm.c
|
||||
+++ b/drivers/net/phy/motorcomm.c
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
- * Motorcomm 8511/8521 PHY driver.
|
||||
+ * Motorcomm 8511/8521/8531S PHY driver.
|
||||
*
|
||||
* Author: Peter Geis <pgwipeout@gmail.com>
|
||||
* Author: Frank <Frank.Sae@motor-comm.com>
|
||||
@@ -13,8 +13,9 @@
|
||||
|
||||
#define PHY_ID_YT8511 0x0000010a
|
||||
#define PHY_ID_YT8521 0x0000011A
|
||||
+#define PHY_ID_YT8531S 0x4F51E91A
|
||||
|
||||
-/* YT8521 Register Overview
|
||||
+/* YT8521/YT8531S Register Overview
|
||||
* UTP Register space | FIBER Register space
|
||||
* ------------------------------------------------------------
|
||||
* | UTP MII | FIBER MII |
|
||||
@@ -147,7 +148,7 @@
|
||||
#define YT8521_LINK_TIMER_CFG2_REG 0xA5
|
||||
#define YT8521_LTCR_EN_AUTOSEN BIT(15)
|
||||
|
||||
-/* 0xA000, 0xA001, 0xA003 ,and 0xA006 ~ 0xA00A are common ext registers
|
||||
+/* 0xA000, 0xA001, 0xA003, 0xA006 ~ 0xA00A and 0xA012 are common ext registers
|
||||
* of yt8521 phy. There is no need to switch reg space when operating these
|
||||
* registers.
|
||||
*/
|
||||
@@ -221,6 +222,9 @@
|
||||
*/
|
||||
#define YTPHY_WCR_TYPE_PULSE BIT(0)
|
||||
|
||||
+#define YT8531S_SYNCE_CFG_REG 0xA012
|
||||
+#define YT8531S_SCR_SYNCE_ENABLE BIT(6)
|
||||
+
|
||||
/* Extended Register end */
|
||||
|
||||
struct yt8521_priv {
|
||||
@@ -648,6 +652,26 @@ static int yt8521_probe(struct phy_devic
|
||||
}
|
||||
|
||||
/**
|
||||
+ * yt8531s_probe() - read chip config then set suitable polling_mode
|
||||
+ * @phydev: a pointer to a &struct phy_device
|
||||
+ *
|
||||
+ * returns 0 or negative errno code
|
||||
+ */
|
||||
+static int yt8531s_probe(struct phy_device *phydev)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ /* Disable SyncE clock output by default */
|
||||
+ ret = ytphy_modify_ext_with_lock(phydev, YT8531S_SYNCE_CFG_REG,
|
||||
+ YT8531S_SCR_SYNCE_ENABLE, 0);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* same as yt8521_probe */
|
||||
+ return yt8521_probe(phydev);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* ytphy_utp_read_lpa() - read LPA then setup lp_advertising for utp
|
||||
* @phydev: a pointer to a &struct phy_device
|
||||
*
|
||||
@@ -1750,11 +1774,28 @@ static struct phy_driver motorcomm_phy_d
|
||||
.suspend = yt8521_suspend,
|
||||
.resume = yt8521_resume,
|
||||
},
|
||||
+ {
|
||||
+ PHY_ID_MATCH_EXACT(PHY_ID_YT8531S),
|
||||
+ .name = "YT8531S Gigabit Ethernet",
|
||||
+ .get_features = yt8521_get_features,
|
||||
+ .probe = yt8531s_probe,
|
||||
+ .read_page = yt8521_read_page,
|
||||
+ .write_page = yt8521_write_page,
|
||||
+ .get_wol = ytphy_get_wol,
|
||||
+ .set_wol = ytphy_set_wol,
|
||||
+ .config_aneg = yt8521_config_aneg,
|
||||
+ .aneg_done = yt8521_aneg_done,
|
||||
+ .config_init = yt8521_config_init,
|
||||
+ .read_status = yt8521_read_status,
|
||||
+ .soft_reset = yt8521_soft_reset,
|
||||
+ .suspend = yt8521_suspend,
|
||||
+ .resume = yt8521_resume,
|
||||
+ },
|
||||
};
|
||||
|
||||
module_phy_driver(motorcomm_phy_drvs);
|
||||
|
||||
-MODULE_DESCRIPTION("Motorcomm 8511/8521 PHY driver");
|
||||
+MODULE_DESCRIPTION("Motorcomm 8511/8521/8531S PHY driver");
|
||||
MODULE_AUTHOR("Peter Geis");
|
||||
MODULE_AUTHOR("Frank");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -1762,6 +1803,7 @@ MODULE_LICENSE("GPL");
|
||||
static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = {
|
||||
{ PHY_ID_MATCH_EXACT(PHY_ID_YT8511) },
|
||||
{ PHY_ID_MATCH_EXACT(PHY_ID_YT8521) },
|
||||
+ { PHY_ID_MATCH_EXACT(PHY_ID_YT8531S) },
|
||||
{ /* sentinal */ }
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
From 3c1dc22162d673d595855d24f95200ed2643f88f Mon Sep 17 00:00:00 2001
|
||||
From: Frank Sae <Frank.Sae@motor-comm.com>
|
||||
Date: Sat, 28 Jan 2023 14:35:58 +0800
|
||||
Subject: [PATCH] net: phy: motorcomm: change the phy id of yt8521 and yt8531s
|
||||
to lowercase
|
||||
|
||||
The phy id is usually defined in lower case.
|
||||
|
||||
Signed-off-by: Frank Sae <Frank.Sae@motor-comm.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://lore.kernel.org/r/20230128063558.5850-2-Frank.Sae@motor-comm.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/motorcomm.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/motorcomm.c
|
||||
+++ b/drivers/net/phy/motorcomm.c
|
||||
@@ -12,8 +12,8 @@
|
||||
#include <linux/phy.h>
|
||||
|
||||
#define PHY_ID_YT8511 0x0000010a
|
||||
-#define PHY_ID_YT8521 0x0000011A
|
||||
-#define PHY_ID_YT8531S 0x4F51E91A
|
||||
+#define PHY_ID_YT8521 0x0000011a
|
||||
+#define PHY_ID_YT8531S 0x4f51e91a
|
||||
|
||||
/* YT8521/YT8531S Register Overview
|
||||
* UTP Register space | FIBER Register space
|
||||
@@ -1804,7 +1804,7 @@ static const struct mdio_device_id __may
|
||||
{ PHY_ID_MATCH_EXACT(PHY_ID_YT8511) },
|
||||
{ PHY_ID_MATCH_EXACT(PHY_ID_YT8521) },
|
||||
{ PHY_ID_MATCH_EXACT(PHY_ID_YT8531S) },
|
||||
- { /* sentinal */ }
|
||||
+ { /* sentinel */ }
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(mdio, motorcomm_tbl);
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
From 4869a146cd60fc8115230f0a45e15e534c531922 Mon Sep 17 00:00:00 2001
|
||||
From: Frank Sae <Frank.Sae@motor-comm.com>
|
||||
Date: Thu, 2 Feb 2023 11:00:34 +0800
|
||||
Subject: [PATCH] net: phy: Add BIT macro for Motorcomm yt8521/yt8531 gigabit
|
||||
ethernet phy
|
||||
|
||||
Add BIT macro for Motorcomm yt8521/yt8531 gigabit ethernet phy.
|
||||
This is a preparatory patch. Add BIT macro for 0xA012 reg, and
|
||||
supplement for 0xA001 and 0xA003 reg. These will be used to support dts.
|
||||
|
||||
Signed-off-by: Frank Sae <Frank.Sae@motor-comm.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/motorcomm.c | 55 ++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 51 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/motorcomm.c
|
||||
+++ b/drivers/net/phy/motorcomm.c
|
||||
@@ -161,6 +161,11 @@
|
||||
|
||||
#define YT8521_CHIP_CONFIG_REG 0xA001
|
||||
#define YT8521_CCR_SW_RST BIT(15)
|
||||
+/* 1b0 disable 1.9ns rxc clock delay *default*
|
||||
+ * 1b1 enable 1.9ns rxc clock delay
|
||||
+ */
|
||||
+#define YT8521_CCR_RXC_DLY_EN BIT(8)
|
||||
+#define YT8521_CCR_RXC_DLY_1_900_NS 1900
|
||||
|
||||
#define YT8521_CCR_MODE_SEL_MASK (BIT(2) | BIT(1) | BIT(0))
|
||||
#define YT8521_CCR_MODE_UTP_TO_RGMII 0
|
||||
@@ -178,22 +183,41 @@
|
||||
#define YT8521_MODE_POLL 0x3
|
||||
|
||||
#define YT8521_RGMII_CONFIG1_REG 0xA003
|
||||
-
|
||||
+/* 1b0 use original tx_clk_rgmii *default*
|
||||
+ * 1b1 use inverted tx_clk_rgmii.
|
||||
+ */
|
||||
+#define YT8521_RC1R_TX_CLK_SEL_INVERTED BIT(14)
|
||||
/* TX Gig-E Delay is bits 3:0, default 0x1
|
||||
* TX Fast-E Delay is bits 7:4, default 0xf
|
||||
* RX Delay is bits 13:10, default 0x0
|
||||
* Delay = 150ps * N
|
||||
* On = 2250ps, off = 0ps
|
||||
*/
|
||||
-#define YT8521_RC1R_RX_DELAY_MASK (0xF << 10)
|
||||
+#define YT8521_RC1R_RX_DELAY_MASK GENMASK(13, 10)
|
||||
#define YT8521_RC1R_RX_DELAY_EN (0xF << 10)
|
||||
#define YT8521_RC1R_RX_DELAY_DIS (0x0 << 10)
|
||||
-#define YT8521_RC1R_FE_TX_DELAY_MASK (0xF << 4)
|
||||
+#define YT8521_RC1R_FE_TX_DELAY_MASK GENMASK(7, 4)
|
||||
#define YT8521_RC1R_FE_TX_DELAY_EN (0xF << 4)
|
||||
#define YT8521_RC1R_FE_TX_DELAY_DIS (0x0 << 4)
|
||||
-#define YT8521_RC1R_GE_TX_DELAY_MASK (0xF << 0)
|
||||
+#define YT8521_RC1R_GE_TX_DELAY_MASK GENMASK(3, 0)
|
||||
#define YT8521_RC1R_GE_TX_DELAY_EN (0xF << 0)
|
||||
#define YT8521_RC1R_GE_TX_DELAY_DIS (0x0 << 0)
|
||||
+#define YT8521_RC1R_RGMII_0_000_NS 0
|
||||
+#define YT8521_RC1R_RGMII_0_150_NS 1
|
||||
+#define YT8521_RC1R_RGMII_0_300_NS 2
|
||||
+#define YT8521_RC1R_RGMII_0_450_NS 3
|
||||
+#define YT8521_RC1R_RGMII_0_600_NS 4
|
||||
+#define YT8521_RC1R_RGMII_0_750_NS 5
|
||||
+#define YT8521_RC1R_RGMII_0_900_NS 6
|
||||
+#define YT8521_RC1R_RGMII_1_050_NS 7
|
||||
+#define YT8521_RC1R_RGMII_1_200_NS 8
|
||||
+#define YT8521_RC1R_RGMII_1_350_NS 9
|
||||
+#define YT8521_RC1R_RGMII_1_500_NS 10
|
||||
+#define YT8521_RC1R_RGMII_1_650_NS 11
|
||||
+#define YT8521_RC1R_RGMII_1_800_NS 12
|
||||
+#define YT8521_RC1R_RGMII_1_950_NS 13
|
||||
+#define YT8521_RC1R_RGMII_2_100_NS 14
|
||||
+#define YT8521_RC1R_RGMII_2_250_NS 15
|
||||
|
||||
#define YTPHY_MISC_CONFIG_REG 0xA006
|
||||
#define YTPHY_MCR_FIBER_SPEED_MASK BIT(0)
|
||||
@@ -222,6 +246,29 @@
|
||||
*/
|
||||
#define YTPHY_WCR_TYPE_PULSE BIT(0)
|
||||
|
||||
+#define YTPHY_SYNCE_CFG_REG 0xA012
|
||||
+#define YT8521_SCR_SYNCE_ENABLE BIT(5)
|
||||
+/* 1b0 output 25m clock
|
||||
+ * 1b1 output 125m clock *default*
|
||||
+ */
|
||||
+#define YT8521_SCR_CLK_FRE_SEL_125M BIT(3)
|
||||
+#define YT8521_SCR_CLK_SRC_MASK GENMASK(2, 1)
|
||||
+#define YT8521_SCR_CLK_SRC_PLL_125M 0
|
||||
+#define YT8521_SCR_CLK_SRC_UTP_RX 1
|
||||
+#define YT8521_SCR_CLK_SRC_SDS_RX 2
|
||||
+#define YT8521_SCR_CLK_SRC_REF_25M 3
|
||||
+#define YT8531_SCR_SYNCE_ENABLE BIT(6)
|
||||
+/* 1b0 output 25m clock *default*
|
||||
+ * 1b1 output 125m clock
|
||||
+ */
|
||||
+#define YT8531_SCR_CLK_FRE_SEL_125M BIT(4)
|
||||
+#define YT8531_SCR_CLK_SRC_MASK GENMASK(3, 1)
|
||||
+#define YT8531_SCR_CLK_SRC_PLL_125M 0
|
||||
+#define YT8531_SCR_CLK_SRC_UTP_RX 1
|
||||
+#define YT8531_SCR_CLK_SRC_SDS_RX 2
|
||||
+#define YT8531_SCR_CLK_SRC_CLOCK_FROM_DIGITAL 3
|
||||
+#define YT8531_SCR_CLK_SRC_REF_25M 4
|
||||
+#define YT8531_SCR_CLK_SRC_SSC_25M 5
|
||||
#define YT8531S_SYNCE_CFG_REG 0xA012
|
||||
#define YT8531S_SCR_SYNCE_ENABLE BIT(6)
|
||||
|
||||
|
|
@ -0,0 +1,343 @@
|
|||
From a6e68f0f8769f79c67cdcfb6302feecd36197dec Mon Sep 17 00:00:00 2001
|
||||
From: Frank Sae <Frank.Sae@motor-comm.com>
|
||||
Date: Thu, 2 Feb 2023 11:00:35 +0800
|
||||
Subject: [PATCH] net: phy: Add dts support for Motorcomm yt8521 gigabit
|
||||
ethernet phy
|
||||
|
||||
Add dts support for Motorcomm yt8521 gigabit ethernet phy.
|
||||
Add ytphy_rgmii_clk_delay_config function to support dst config for
|
||||
the delay of rgmii clk. This funciont is common for yt8521, yt8531s
|
||||
and yt8531.
|
||||
This patch has been verified on AM335x platform.
|
||||
|
||||
Signed-off-by: Frank Sae <Frank.Sae@motor-comm.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/motorcomm.c | 253 ++++++++++++++++++++++++++++--------
|
||||
1 file changed, 199 insertions(+), 54 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/motorcomm.c
|
||||
+++ b/drivers/net/phy/motorcomm.c
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/phy.h>
|
||||
+#include <linux/of.h>
|
||||
|
||||
#define PHY_ID_YT8511 0x0000010a
|
||||
#define PHY_ID_YT8521 0x0000011a
|
||||
@@ -187,21 +188,9 @@
|
||||
* 1b1 use inverted tx_clk_rgmii.
|
||||
*/
|
||||
#define YT8521_RC1R_TX_CLK_SEL_INVERTED BIT(14)
|
||||
-/* TX Gig-E Delay is bits 3:0, default 0x1
|
||||
- * TX Fast-E Delay is bits 7:4, default 0xf
|
||||
- * RX Delay is bits 13:10, default 0x0
|
||||
- * Delay = 150ps * N
|
||||
- * On = 2250ps, off = 0ps
|
||||
- */
|
||||
#define YT8521_RC1R_RX_DELAY_MASK GENMASK(13, 10)
|
||||
-#define YT8521_RC1R_RX_DELAY_EN (0xF << 10)
|
||||
-#define YT8521_RC1R_RX_DELAY_DIS (0x0 << 10)
|
||||
#define YT8521_RC1R_FE_TX_DELAY_MASK GENMASK(7, 4)
|
||||
-#define YT8521_RC1R_FE_TX_DELAY_EN (0xF << 4)
|
||||
-#define YT8521_RC1R_FE_TX_DELAY_DIS (0x0 << 4)
|
||||
#define YT8521_RC1R_GE_TX_DELAY_MASK GENMASK(3, 0)
|
||||
-#define YT8521_RC1R_GE_TX_DELAY_EN (0xF << 0)
|
||||
-#define YT8521_RC1R_GE_TX_DELAY_DIS (0x0 << 0)
|
||||
#define YT8521_RC1R_RGMII_0_000_NS 0
|
||||
#define YT8521_RC1R_RGMII_0_150_NS 1
|
||||
#define YT8521_RC1R_RGMII_0_300_NS 2
|
||||
@@ -274,6 +263,10 @@
|
||||
|
||||
/* Extended Register end */
|
||||
|
||||
+#define YTPHY_DTS_OUTPUT_CLK_DIS 0
|
||||
+#define YTPHY_DTS_OUTPUT_CLK_25M 25000000
|
||||
+#define YTPHY_DTS_OUTPUT_CLK_125M 125000000
|
||||
+
|
||||
struct yt8521_priv {
|
||||
/* combo_advertising is used for case of YT8521 in combo mode,
|
||||
* this means that yt8521 may work in utp or fiber mode which depends
|
||||
@@ -641,6 +634,142 @@ static int yt8521_write_page(struct phy_
|
||||
};
|
||||
|
||||
/**
|
||||
+ * struct ytphy_cfg_reg_map - map a config value to a register value
|
||||
+ * @cfg: value in device configuration
|
||||
+ * @reg: value in the register
|
||||
+ */
|
||||
+struct ytphy_cfg_reg_map {
|
||||
+ u32 cfg;
|
||||
+ u32 reg;
|
||||
+};
|
||||
+
|
||||
+static const struct ytphy_cfg_reg_map ytphy_rgmii_delays[] = {
|
||||
+ /* for tx delay / rx delay with YT8521_CCR_RXC_DLY_EN is not set. */
|
||||
+ { 0, YT8521_RC1R_RGMII_0_000_NS },
|
||||
+ { 150, YT8521_RC1R_RGMII_0_150_NS },
|
||||
+ { 300, YT8521_RC1R_RGMII_0_300_NS },
|
||||
+ { 450, YT8521_RC1R_RGMII_0_450_NS },
|
||||
+ { 600, YT8521_RC1R_RGMII_0_600_NS },
|
||||
+ { 750, YT8521_RC1R_RGMII_0_750_NS },
|
||||
+ { 900, YT8521_RC1R_RGMII_0_900_NS },
|
||||
+ { 1050, YT8521_RC1R_RGMII_1_050_NS },
|
||||
+ { 1200, YT8521_RC1R_RGMII_1_200_NS },
|
||||
+ { 1350, YT8521_RC1R_RGMII_1_350_NS },
|
||||
+ { 1500, YT8521_RC1R_RGMII_1_500_NS },
|
||||
+ { 1650, YT8521_RC1R_RGMII_1_650_NS },
|
||||
+ { 1800, YT8521_RC1R_RGMII_1_800_NS },
|
||||
+ { 1950, YT8521_RC1R_RGMII_1_950_NS }, /* default tx/rx delay */
|
||||
+ { 2100, YT8521_RC1R_RGMII_2_100_NS },
|
||||
+ { 2250, YT8521_RC1R_RGMII_2_250_NS },
|
||||
+
|
||||
+ /* only for rx delay with YT8521_CCR_RXC_DLY_EN is set. */
|
||||
+ { 0 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_000_NS },
|
||||
+ { 150 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_150_NS },
|
||||
+ { 300 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_300_NS },
|
||||
+ { 450 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_450_NS },
|
||||
+ { 600 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_600_NS },
|
||||
+ { 750 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_750_NS },
|
||||
+ { 900 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_0_900_NS },
|
||||
+ { 1050 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_050_NS },
|
||||
+ { 1200 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_200_NS },
|
||||
+ { 1350 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_350_NS },
|
||||
+ { 1500 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_500_NS },
|
||||
+ { 1650 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_650_NS },
|
||||
+ { 1800 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_800_NS },
|
||||
+ { 1950 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_1_950_NS },
|
||||
+ { 2100 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_2_100_NS },
|
||||
+ { 2250 + YT8521_CCR_RXC_DLY_1_900_NS, YT8521_RC1R_RGMII_2_250_NS }
|
||||
+};
|
||||
+
|
||||
+static u32 ytphy_get_delay_reg_value(struct phy_device *phydev,
|
||||
+ const char *prop_name,
|
||||
+ const struct ytphy_cfg_reg_map *tbl,
|
||||
+ int tb_size,
|
||||
+ u16 *rxc_dly_en,
|
||||
+ u32 dflt)
|
||||
+{
|
||||
+ struct device_node *node = phydev->mdio.dev.of_node;
|
||||
+ int tb_size_half = tb_size / 2;
|
||||
+ u32 val;
|
||||
+ int i;
|
||||
+
|
||||
+ if (of_property_read_u32(node, prop_name, &val))
|
||||
+ goto err_dts_val;
|
||||
+
|
||||
+ /* when rxc_dly_en is NULL, it is get the delay for tx, only half of
|
||||
+ * tb_size is valid.
|
||||
+ */
|
||||
+ if (!rxc_dly_en)
|
||||
+ tb_size = tb_size_half;
|
||||
+
|
||||
+ for (i = 0; i < tb_size; i++) {
|
||||
+ if (tbl[i].cfg == val) {
|
||||
+ if (rxc_dly_en && i < tb_size_half)
|
||||
+ *rxc_dly_en = 0;
|
||||
+ return tbl[i].reg;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ phydev_warn(phydev, "Unsupported value %d for %s using default (%u)\n",
|
||||
+ val, prop_name, dflt);
|
||||
+
|
||||
+err_dts_val:
|
||||
+ /* when rxc_dly_en is not NULL, it is get the delay for rx.
|
||||
+ * The rx default in dts and ytphy_rgmii_clk_delay_config is 1950 ps,
|
||||
+ * so YT8521_CCR_RXC_DLY_EN should not be set.
|
||||
+ */
|
||||
+ if (rxc_dly_en)
|
||||
+ *rxc_dly_en = 0;
|
||||
+
|
||||
+ return dflt;
|
||||
+}
|
||||
+
|
||||
+static int ytphy_rgmii_clk_delay_config(struct phy_device *phydev)
|
||||
+{
|
||||
+ int tb_size = ARRAY_SIZE(ytphy_rgmii_delays);
|
||||
+ u16 rxc_dly_en = YT8521_CCR_RXC_DLY_EN;
|
||||
+ u32 rx_reg, tx_reg;
|
||||
+ u16 mask, val = 0;
|
||||
+ int ret;
|
||||
+
|
||||
+ rx_reg = ytphy_get_delay_reg_value(phydev, "rx-internal-delay-ps",
|
||||
+ ytphy_rgmii_delays, tb_size,
|
||||
+ &rxc_dly_en,
|
||||
+ YT8521_RC1R_RGMII_1_950_NS);
|
||||
+ tx_reg = ytphy_get_delay_reg_value(phydev, "tx-internal-delay-ps",
|
||||
+ ytphy_rgmii_delays, tb_size, NULL,
|
||||
+ YT8521_RC1R_RGMII_1_950_NS);
|
||||
+
|
||||
+ switch (phydev->interface) {
|
||||
+ case PHY_INTERFACE_MODE_RGMII:
|
||||
+ rxc_dly_en = 0;
|
||||
+ break;
|
||||
+ case PHY_INTERFACE_MODE_RGMII_RXID:
|
||||
+ val |= FIELD_PREP(YT8521_RC1R_RX_DELAY_MASK, rx_reg);
|
||||
+ break;
|
||||
+ case PHY_INTERFACE_MODE_RGMII_TXID:
|
||||
+ rxc_dly_en = 0;
|
||||
+ val |= FIELD_PREP(YT8521_RC1R_GE_TX_DELAY_MASK, tx_reg);
|
||||
+ break;
|
||||
+ case PHY_INTERFACE_MODE_RGMII_ID:
|
||||
+ val |= FIELD_PREP(YT8521_RC1R_RX_DELAY_MASK, rx_reg) |
|
||||
+ FIELD_PREP(YT8521_RC1R_GE_TX_DELAY_MASK, tx_reg);
|
||||
+ break;
|
||||
+ default: /* do not support other modes */
|
||||
+ return -EOPNOTSUPP;
|
||||
+ }
|
||||
+
|
||||
+ ret = ytphy_modify_ext(phydev, YT8521_CHIP_CONFIG_REG,
|
||||
+ YT8521_CCR_RXC_DLY_EN, rxc_dly_en);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* Generally, it is not necessary to adjust YT8521_RC1R_FE_TX_DELAY */
|
||||
+ mask = YT8521_RC1R_RX_DELAY_MASK | YT8521_RC1R_GE_TX_DELAY_MASK;
|
||||
+ return ytphy_modify_ext(phydev, YT8521_RGMII_CONFIG1_REG, mask, val);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* yt8521_probe() - read chip config then set suitable polling_mode
|
||||
* @phydev: a pointer to a &struct phy_device
|
||||
*
|
||||
@@ -648,9 +777,12 @@ static int yt8521_write_page(struct phy_
|
||||
*/
|
||||
static int yt8521_probe(struct phy_device *phydev)
|
||||
{
|
||||
+ struct device_node *node = phydev->mdio.dev.of_node;
|
||||
struct device *dev = &phydev->mdio.dev;
|
||||
struct yt8521_priv *priv;
|
||||
int chip_config;
|
||||
+ u16 mask, val;
|
||||
+ u32 freq;
|
||||
int ret;
|
||||
|
||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
@@ -695,7 +827,45 @@ static int yt8521_probe(struct phy_devic
|
||||
return ret;
|
||||
}
|
||||
|
||||
- return 0;
|
||||
+ if (of_property_read_u32(node, "motorcomm,clk-out-frequency-hz", &freq))
|
||||
+ freq = YTPHY_DTS_OUTPUT_CLK_DIS;
|
||||
+
|
||||
+ if (phydev->drv->phy_id == PHY_ID_YT8521) {
|
||||
+ switch (freq) {
|
||||
+ case YTPHY_DTS_OUTPUT_CLK_DIS:
|
||||
+ mask = YT8521_SCR_SYNCE_ENABLE;
|
||||
+ val = 0;
|
||||
+ break;
|
||||
+ case YTPHY_DTS_OUTPUT_CLK_25M:
|
||||
+ mask = YT8521_SCR_SYNCE_ENABLE |
|
||||
+ YT8521_SCR_CLK_SRC_MASK |
|
||||
+ YT8521_SCR_CLK_FRE_SEL_125M;
|
||||
+ val = YT8521_SCR_SYNCE_ENABLE |
|
||||
+ FIELD_PREP(YT8521_SCR_CLK_SRC_MASK,
|
||||
+ YT8521_SCR_CLK_SRC_REF_25M);
|
||||
+ break;
|
||||
+ case YTPHY_DTS_OUTPUT_CLK_125M:
|
||||
+ mask = YT8521_SCR_SYNCE_ENABLE |
|
||||
+ YT8521_SCR_CLK_SRC_MASK |
|
||||
+ YT8521_SCR_CLK_FRE_SEL_125M;
|
||||
+ val = YT8521_SCR_SYNCE_ENABLE |
|
||||
+ YT8521_SCR_CLK_FRE_SEL_125M |
|
||||
+ FIELD_PREP(YT8521_SCR_CLK_SRC_MASK,
|
||||
+ YT8521_SCR_CLK_SRC_PLL_125M);
|
||||
+ break;
|
||||
+ default:
|
||||
+ phydev_warn(phydev, "Freq err:%u\n", freq);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ } else if (phydev->drv->phy_id == PHY_ID_YT8531S) {
|
||||
+ return 0;
|
||||
+ } else {
|
||||
+ phydev_warn(phydev, "PHY id err\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return ytphy_modify_ext_with_lock(phydev, YTPHY_SYNCE_CFG_REG, mask,
|
||||
+ val);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1180,61 +1350,36 @@ static int yt8521_resume(struct phy_devi
|
||||
*/
|
||||
static int yt8521_config_init(struct phy_device *phydev)
|
||||
{
|
||||
+ struct device_node *node = phydev->mdio.dev.of_node;
|
||||
int old_page;
|
||||
int ret = 0;
|
||||
- u16 val;
|
||||
|
||||
old_page = phy_select_page(phydev, YT8521_RSSR_UTP_SPACE);
|
||||
if (old_page < 0)
|
||||
goto err_restore_page;
|
||||
|
||||
- switch (phydev->interface) {
|
||||
- case PHY_INTERFACE_MODE_RGMII:
|
||||
- val = YT8521_RC1R_GE_TX_DELAY_DIS | YT8521_RC1R_FE_TX_DELAY_DIS;
|
||||
- val |= YT8521_RC1R_RX_DELAY_DIS;
|
||||
- break;
|
||||
- case PHY_INTERFACE_MODE_RGMII_RXID:
|
||||
- val = YT8521_RC1R_GE_TX_DELAY_DIS | YT8521_RC1R_FE_TX_DELAY_DIS;
|
||||
- val |= YT8521_RC1R_RX_DELAY_EN;
|
||||
- break;
|
||||
- case PHY_INTERFACE_MODE_RGMII_TXID:
|
||||
- val = YT8521_RC1R_GE_TX_DELAY_EN | YT8521_RC1R_FE_TX_DELAY_EN;
|
||||
- val |= YT8521_RC1R_RX_DELAY_DIS;
|
||||
- break;
|
||||
- case PHY_INTERFACE_MODE_RGMII_ID:
|
||||
- val = YT8521_RC1R_GE_TX_DELAY_EN | YT8521_RC1R_FE_TX_DELAY_EN;
|
||||
- val |= YT8521_RC1R_RX_DELAY_EN;
|
||||
- break;
|
||||
- case PHY_INTERFACE_MODE_SGMII:
|
||||
- break;
|
||||
- default: /* do not support other modes */
|
||||
- ret = -EOPNOTSUPP;
|
||||
- goto err_restore_page;
|
||||
- }
|
||||
-
|
||||
/* set rgmii delay mode */
|
||||
if (phydev->interface != PHY_INTERFACE_MODE_SGMII) {
|
||||
- ret = ytphy_modify_ext(phydev, YT8521_RGMII_CONFIG1_REG,
|
||||
- (YT8521_RC1R_RX_DELAY_MASK |
|
||||
- YT8521_RC1R_FE_TX_DELAY_MASK |
|
||||
- YT8521_RC1R_GE_TX_DELAY_MASK),
|
||||
- val);
|
||||
+ ret = ytphy_rgmii_clk_delay_config(phydev);
|
||||
if (ret < 0)
|
||||
goto err_restore_page;
|
||||
}
|
||||
|
||||
- /* disable auto sleep */
|
||||
- ret = ytphy_modify_ext(phydev, YT8521_EXTREG_SLEEP_CONTROL1_REG,
|
||||
- YT8521_ESC1R_SLEEP_SW, 0);
|
||||
- if (ret < 0)
|
||||
- goto err_restore_page;
|
||||
-
|
||||
- /* enable RXC clock when no wire plug */
|
||||
- ret = ytphy_modify_ext(phydev, YT8521_CLOCK_GATING_REG,
|
||||
- YT8521_CGR_RX_CLK_EN, 0);
|
||||
- if (ret < 0)
|
||||
- goto err_restore_page;
|
||||
+ if (of_property_read_bool(node, "motorcomm,auto-sleep-disabled")) {
|
||||
+ /* disable auto sleep */
|
||||
+ ret = ytphy_modify_ext(phydev, YT8521_EXTREG_SLEEP_CONTROL1_REG,
|
||||
+ YT8521_ESC1R_SLEEP_SW, 0);
|
||||
+ if (ret < 0)
|
||||
+ goto err_restore_page;
|
||||
+ }
|
||||
|
||||
+ if (of_property_read_bool(node, "motorcomm,keep-pll-enabled")) {
|
||||
+ /* enable RXC clock when no wire plug */
|
||||
+ ret = ytphy_modify_ext(phydev, YT8521_CLOCK_GATING_REG,
|
||||
+ YT8521_CGR_RX_CLK_EN, 0);
|
||||
+ if (ret < 0)
|
||||
+ goto err_restore_page;
|
||||
+ }
|
||||
err_restore_page:
|
||||
return phy_restore_page(phydev, old_page, ret);
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
From 36152f87dda4af221b16258751451d9cd3d0fb0b Mon Sep 17 00:00:00 2001
|
||||
From: Frank Sae <Frank.Sae@motor-comm.com>
|
||||
Date: Thu, 2 Feb 2023 11:00:36 +0800
|
||||
Subject: [PATCH] net: phy: Add dts support for Motorcomm yt8531s gigabit
|
||||
ethernet phy
|
||||
|
||||
Add dts support for Motorcomm yt8531s gigabit ethernet phy.
|
||||
Change yt8521_probe to support clk config of yt8531s. Becase
|
||||
yt8521_probe does the things which yt8531s is needed, so
|
||||
removed yt8531s function.
|
||||
This patch has been verified on AM335x platform with yt8531s board.
|
||||
|
||||
Signed-off-by: Frank Sae <Frank.Sae@motor-comm.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/motorcomm.c | 51 ++++++++++++++++++++-----------------
|
||||
1 file changed, 27 insertions(+), 24 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/motorcomm.c
|
||||
+++ b/drivers/net/phy/motorcomm.c
|
||||
@@ -258,8 +258,6 @@
|
||||
#define YT8531_SCR_CLK_SRC_CLOCK_FROM_DIGITAL 3
|
||||
#define YT8531_SCR_CLK_SRC_REF_25M 4
|
||||
#define YT8531_SCR_CLK_SRC_SSC_25M 5
|
||||
-#define YT8531S_SYNCE_CFG_REG 0xA012
|
||||
-#define YT8531S_SCR_SYNCE_ENABLE BIT(6)
|
||||
|
||||
/* Extended Register end */
|
||||
|
||||
@@ -858,7 +856,32 @@ static int yt8521_probe(struct phy_devic
|
||||
return -EINVAL;
|
||||
}
|
||||
} else if (phydev->drv->phy_id == PHY_ID_YT8531S) {
|
||||
- return 0;
|
||||
+ switch (freq) {
|
||||
+ case YTPHY_DTS_OUTPUT_CLK_DIS:
|
||||
+ mask = YT8531_SCR_SYNCE_ENABLE;
|
||||
+ val = 0;
|
||||
+ break;
|
||||
+ case YTPHY_DTS_OUTPUT_CLK_25M:
|
||||
+ mask = YT8531_SCR_SYNCE_ENABLE |
|
||||
+ YT8531_SCR_CLK_SRC_MASK |
|
||||
+ YT8531_SCR_CLK_FRE_SEL_125M;
|
||||
+ val = YT8531_SCR_SYNCE_ENABLE |
|
||||
+ FIELD_PREP(YT8531_SCR_CLK_SRC_MASK,
|
||||
+ YT8531_SCR_CLK_SRC_REF_25M);
|
||||
+ break;
|
||||
+ case YTPHY_DTS_OUTPUT_CLK_125M:
|
||||
+ mask = YT8531_SCR_SYNCE_ENABLE |
|
||||
+ YT8531_SCR_CLK_SRC_MASK |
|
||||
+ YT8531_SCR_CLK_FRE_SEL_125M;
|
||||
+ val = YT8531_SCR_SYNCE_ENABLE |
|
||||
+ YT8531_SCR_CLK_FRE_SEL_125M |
|
||||
+ FIELD_PREP(YT8531_SCR_CLK_SRC_MASK,
|
||||
+ YT8531_SCR_CLK_SRC_PLL_125M);
|
||||
+ break;
|
||||
+ default:
|
||||
+ phydev_warn(phydev, "Freq err:%u\n", freq);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
} else {
|
||||
phydev_warn(phydev, "PHY id err\n");
|
||||
return -EINVAL;
|
||||
@@ -869,26 +892,6 @@ static int yt8521_probe(struct phy_devic
|
||||
}
|
||||
|
||||
/**
|
||||
- * yt8531s_probe() - read chip config then set suitable polling_mode
|
||||
- * @phydev: a pointer to a &struct phy_device
|
||||
- *
|
||||
- * returns 0 or negative errno code
|
||||
- */
|
||||
-static int yt8531s_probe(struct phy_device *phydev)
|
||||
-{
|
||||
- int ret;
|
||||
-
|
||||
- /* Disable SyncE clock output by default */
|
||||
- ret = ytphy_modify_ext_with_lock(phydev, YT8531S_SYNCE_CFG_REG,
|
||||
- YT8531S_SCR_SYNCE_ENABLE, 0);
|
||||
- if (ret < 0)
|
||||
- return ret;
|
||||
-
|
||||
- /* same as yt8521_probe */
|
||||
- return yt8521_probe(phydev);
|
||||
-}
|
||||
-
|
||||
-/**
|
||||
* ytphy_utp_read_lpa() - read LPA then setup lp_advertising for utp
|
||||
* @phydev: a pointer to a &struct phy_device
|
||||
*
|
||||
@@ -1970,7 +1973,7 @@ static struct phy_driver motorcomm_phy_d
|
||||
PHY_ID_MATCH_EXACT(PHY_ID_YT8531S),
|
||||
.name = "YT8531S Gigabit Ethernet",
|
||||
.get_features = yt8521_get_features,
|
||||
- .probe = yt8531s_probe,
|
||||
+ .probe = yt8521_probe,
|
||||
.read_page = yt8521_read_page,
|
||||
.write_page = yt8521_write_page,
|
||||
.get_wol = ytphy_get_wol,
|
||||
|
|
@ -0,0 +1,302 @@
|
|||
From 4ac94f728a588e7096dd5010cd7141a309ea7805 Mon Sep 17 00:00:00 2001
|
||||
From: Frank Sae <Frank.Sae@motor-comm.com>
|
||||
Date: Thu, 2 Feb 2023 11:00:37 +0800
|
||||
Subject: [PATCH] net: phy: Add driver for Motorcomm yt8531 gigabit ethernet
|
||||
phy
|
||||
|
||||
Add a driver for the motorcomm yt8531 gigabit ethernet phy. We have
|
||||
verified the driver on AM335x platform with yt8531 board. On the
|
||||
board, yt8531 gigabit ethernet phy works in utp mode, RGMII
|
||||
interface, supports 1000M/100M/10M speeds, and wol(magic package).
|
||||
|
||||
Signed-off-by: Frank Sae <Frank.Sae@motor-comm.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/Kconfig | 2 +-
|
||||
drivers/net/phy/motorcomm.c | 208 +++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 207 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -319,7 +319,7 @@ config MOTORCOMM_PHY
|
||||
tristate "Motorcomm PHYs"
|
||||
help
|
||||
Enables support for Motorcomm network PHYs.
|
||||
- Currently supports the YT8511, YT8521, YT8531S Gigabit Ethernet PHYs.
|
||||
+ Currently supports YT85xx Gigabit Ethernet PHYs.
|
||||
|
||||
config NATIONAL_PHY
|
||||
tristate "National Semiconductor PHYs"
|
||||
--- a/drivers/net/phy/motorcomm.c
|
||||
+++ b/drivers/net/phy/motorcomm.c
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
- * Motorcomm 8511/8521/8531S PHY driver.
|
||||
+ * Motorcomm 8511/8521/8531/8531S PHY driver.
|
||||
*
|
||||
* Author: Peter Geis <pgwipeout@gmail.com>
|
||||
* Author: Frank <Frank.Sae@motor-comm.com>
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#define PHY_ID_YT8511 0x0000010a
|
||||
#define PHY_ID_YT8521 0x0000011a
|
||||
+#define PHY_ID_YT8531 0x4f51e91b
|
||||
#define PHY_ID_YT8531S 0x4f51e91a
|
||||
|
||||
/* YT8521/YT8531S Register Overview
|
||||
@@ -517,6 +518,61 @@ err_restore_page:
|
||||
return phy_restore_page(phydev, old_page, ret);
|
||||
}
|
||||
|
||||
+static int yt8531_set_wol(struct phy_device *phydev,
|
||||
+ struct ethtool_wolinfo *wol)
|
||||
+{
|
||||
+ const u16 mac_addr_reg[] = {
|
||||
+ YTPHY_WOL_MACADDR2_REG,
|
||||
+ YTPHY_WOL_MACADDR1_REG,
|
||||
+ YTPHY_WOL_MACADDR0_REG,
|
||||
+ };
|
||||
+ const u8 *mac_addr;
|
||||
+ u16 mask, val;
|
||||
+ int ret;
|
||||
+ u8 i;
|
||||
+
|
||||
+ if (wol->wolopts & WAKE_MAGIC) {
|
||||
+ mac_addr = phydev->attached_dev->dev_addr;
|
||||
+
|
||||
+ /* Store the device address for the magic packet */
|
||||
+ for (i = 0; i < 3; i++) {
|
||||
+ ret = ytphy_write_ext_with_lock(phydev, mac_addr_reg[i],
|
||||
+ ((mac_addr[i * 2] << 8)) |
|
||||
+ (mac_addr[i * 2 + 1]));
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /* Enable WOL feature */
|
||||
+ mask = YTPHY_WCR_PULSE_WIDTH_MASK | YTPHY_WCR_INTR_SEL;
|
||||
+ val = YTPHY_WCR_ENABLE | YTPHY_WCR_INTR_SEL;
|
||||
+ val |= YTPHY_WCR_TYPE_PULSE | YTPHY_WCR_PULSE_WIDTH_672MS;
|
||||
+ ret = ytphy_modify_ext_with_lock(phydev, YTPHY_WOL_CONFIG_REG,
|
||||
+ mask, val);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* Enable WOL interrupt */
|
||||
+ ret = phy_modify(phydev, YTPHY_INTERRUPT_ENABLE_REG, 0,
|
||||
+ YTPHY_IER_WOL);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+ } else {
|
||||
+ /* Disable WOL feature */
|
||||
+ mask = YTPHY_WCR_ENABLE | YTPHY_WCR_INTR_SEL;
|
||||
+ ret = ytphy_modify_ext_with_lock(phydev, YTPHY_WOL_CONFIG_REG,
|
||||
+ mask, 0);
|
||||
+
|
||||
+ /* Disable WOL interrupt */
|
||||
+ ret = phy_modify(phydev, YTPHY_INTERRUPT_ENABLE_REG,
|
||||
+ YTPHY_IER_WOL, 0);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int yt8511_read_page(struct phy_device *phydev)
|
||||
{
|
||||
return __phy_read(phydev, YT8511_PAGE_SELECT);
|
||||
@@ -767,6 +823,17 @@ static int ytphy_rgmii_clk_delay_config(
|
||||
return ytphy_modify_ext(phydev, YT8521_RGMII_CONFIG1_REG, mask, val);
|
||||
}
|
||||
|
||||
+static int ytphy_rgmii_clk_delay_config_with_lock(struct phy_device *phydev)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ phy_lock_mdio_bus(phydev);
|
||||
+ ret = ytphy_rgmii_clk_delay_config(phydev);
|
||||
+ phy_unlock_mdio_bus(phydev);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* yt8521_probe() - read chip config then set suitable polling_mode
|
||||
* @phydev: a pointer to a &struct phy_device
|
||||
@@ -891,6 +958,43 @@ static int yt8521_probe(struct phy_devic
|
||||
val);
|
||||
}
|
||||
|
||||
+static int yt8531_probe(struct phy_device *phydev)
|
||||
+{
|
||||
+ struct device_node *node = phydev->mdio.dev.of_node;
|
||||
+ u16 mask, val;
|
||||
+ u32 freq;
|
||||
+
|
||||
+ if (of_property_read_u32(node, "motorcomm,clk-out-frequency-hz", &freq))
|
||||
+ freq = YTPHY_DTS_OUTPUT_CLK_DIS;
|
||||
+
|
||||
+ switch (freq) {
|
||||
+ case YTPHY_DTS_OUTPUT_CLK_DIS:
|
||||
+ mask = YT8531_SCR_SYNCE_ENABLE;
|
||||
+ val = 0;
|
||||
+ break;
|
||||
+ case YTPHY_DTS_OUTPUT_CLK_25M:
|
||||
+ mask = YT8531_SCR_SYNCE_ENABLE | YT8531_SCR_CLK_SRC_MASK |
|
||||
+ YT8531_SCR_CLK_FRE_SEL_125M;
|
||||
+ val = YT8531_SCR_SYNCE_ENABLE |
|
||||
+ FIELD_PREP(YT8531_SCR_CLK_SRC_MASK,
|
||||
+ YT8531_SCR_CLK_SRC_REF_25M);
|
||||
+ break;
|
||||
+ case YTPHY_DTS_OUTPUT_CLK_125M:
|
||||
+ mask = YT8531_SCR_SYNCE_ENABLE | YT8531_SCR_CLK_SRC_MASK |
|
||||
+ YT8531_SCR_CLK_FRE_SEL_125M;
|
||||
+ val = YT8531_SCR_SYNCE_ENABLE | YT8531_SCR_CLK_FRE_SEL_125M |
|
||||
+ FIELD_PREP(YT8531_SCR_CLK_SRC_MASK,
|
||||
+ YT8531_SCR_CLK_SRC_PLL_125M);
|
||||
+ break;
|
||||
+ default:
|
||||
+ phydev_warn(phydev, "Freq err:%u\n", freq);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return ytphy_modify_ext_with_lock(phydev, YTPHY_SYNCE_CFG_REG, mask,
|
||||
+ val);
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* ytphy_utp_read_lpa() - read LPA then setup lp_advertising for utp
|
||||
* @phydev: a pointer to a &struct phy_device
|
||||
@@ -1387,6 +1491,94 @@ err_restore_page:
|
||||
return phy_restore_page(phydev, old_page, ret);
|
||||
}
|
||||
|
||||
+static int yt8531_config_init(struct phy_device *phydev)
|
||||
+{
|
||||
+ struct device_node *node = phydev->mdio.dev.of_node;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = ytphy_rgmii_clk_delay_config_with_lock(phydev);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ if (of_property_read_bool(node, "motorcomm,auto-sleep-disabled")) {
|
||||
+ /* disable auto sleep */
|
||||
+ ret = ytphy_modify_ext_with_lock(phydev,
|
||||
+ YT8521_EXTREG_SLEEP_CONTROL1_REG,
|
||||
+ YT8521_ESC1R_SLEEP_SW, 0);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ if (of_property_read_bool(node, "motorcomm,keep-pll-enabled")) {
|
||||
+ /* enable RXC clock when no wire plug */
|
||||
+ ret = ytphy_modify_ext_with_lock(phydev,
|
||||
+ YT8521_CLOCK_GATING_REG,
|
||||
+ YT8521_CGR_RX_CLK_EN, 0);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * yt8531_link_change_notify() - Adjust the tx clock direction according to
|
||||
+ * the current speed and dts config.
|
||||
+ * @phydev: a pointer to a &struct phy_device
|
||||
+ *
|
||||
+ * NOTE: This function is only used to adapt to VF2 with JH7110 SoC. Please
|
||||
+ * keep "motorcomm,tx-clk-adj-enabled" not exist in dts when the soc is not
|
||||
+ * JH7110.
|
||||
+ */
|
||||
+static void yt8531_link_change_notify(struct phy_device *phydev)
|
||||
+{
|
||||
+ struct device_node *node = phydev->mdio.dev.of_node;
|
||||
+ bool tx_clk_adj_enabled = false;
|
||||
+ bool tx_clk_1000_inverted;
|
||||
+ bool tx_clk_100_inverted;
|
||||
+ bool tx_clk_10_inverted;
|
||||
+ u16 val = 0;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (of_property_read_bool(node, "motorcomm,tx-clk-adj-enabled"))
|
||||
+ tx_clk_adj_enabled = true;
|
||||
+
|
||||
+ if (!tx_clk_adj_enabled)
|
||||
+ return;
|
||||
+
|
||||
+ if (of_property_read_bool(node, "motorcomm,tx-clk-10-inverted"))
|
||||
+ tx_clk_10_inverted = true;
|
||||
+ if (of_property_read_bool(node, "motorcomm,tx-clk-100-inverted"))
|
||||
+ tx_clk_100_inverted = true;
|
||||
+ if (of_property_read_bool(node, "motorcomm,tx-clk-1000-inverted"))
|
||||
+ tx_clk_1000_inverted = true;
|
||||
+
|
||||
+ if (phydev->speed < 0)
|
||||
+ return;
|
||||
+
|
||||
+ switch (phydev->speed) {
|
||||
+ case SPEED_1000:
|
||||
+ if (tx_clk_1000_inverted)
|
||||
+ val = YT8521_RC1R_TX_CLK_SEL_INVERTED;
|
||||
+ break;
|
||||
+ case SPEED_100:
|
||||
+ if (tx_clk_100_inverted)
|
||||
+ val = YT8521_RC1R_TX_CLK_SEL_INVERTED;
|
||||
+ break;
|
||||
+ case SPEED_10:
|
||||
+ if (tx_clk_10_inverted)
|
||||
+ val = YT8521_RC1R_TX_CLK_SEL_INVERTED;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ ret = ytphy_modify_ext_with_lock(phydev, YT8521_RGMII_CONFIG1_REG,
|
||||
+ YT8521_RC1R_TX_CLK_SEL_INVERTED, val);
|
||||
+ if (ret < 0)
|
||||
+ phydev_warn(phydev, "Modify TX_CLK_SEL err:%d\n", ret);
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* yt8521_prepare_fiber_features() - A small helper function that setup
|
||||
* fiber's features.
|
||||
@@ -1970,6 +2162,17 @@ static struct phy_driver motorcomm_phy_d
|
||||
.resume = yt8521_resume,
|
||||
},
|
||||
{
|
||||
+ PHY_ID_MATCH_EXACT(PHY_ID_YT8531),
|
||||
+ .name = "YT8531 Gigabit Ethernet",
|
||||
+ .probe = yt8531_probe,
|
||||
+ .config_init = yt8531_config_init,
|
||||
+ .suspend = genphy_suspend,
|
||||
+ .resume = genphy_resume,
|
||||
+ .get_wol = ytphy_get_wol,
|
||||
+ .set_wol = yt8531_set_wol,
|
||||
+ .link_change_notify = yt8531_link_change_notify,
|
||||
+ },
|
||||
+ {
|
||||
PHY_ID_MATCH_EXACT(PHY_ID_YT8531S),
|
||||
.name = "YT8531S Gigabit Ethernet",
|
||||
.get_features = yt8521_get_features,
|
||||
@@ -1990,7 +2193,7 @@ static struct phy_driver motorcomm_phy_d
|
||||
|
||||
module_phy_driver(motorcomm_phy_drvs);
|
||||
|
||||
-MODULE_DESCRIPTION("Motorcomm 8511/8521/8531S PHY driver");
|
||||
+MODULE_DESCRIPTION("Motorcomm 8511/8521/8531/8531S PHY driver");
|
||||
MODULE_AUTHOR("Peter Geis");
|
||||
MODULE_AUTHOR("Frank");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -1998,6 +2201,7 @@ MODULE_LICENSE("GPL");
|
||||
static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = {
|
||||
{ PHY_ID_MATCH_EXACT(PHY_ID_YT8511) },
|
||||
{ PHY_ID_MATCH_EXACT(PHY_ID_YT8521) },
|
||||
+ { PHY_ID_MATCH_EXACT(PHY_ID_YT8531) },
|
||||
{ PHY_ID_MATCH_EXACT(PHY_ID_YT8531S) },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
From 9753613f7399601f9bae6ee81e9d4274246c98ab Mon Sep 17 00:00:00 2001
|
||||
From: Dan Carpenter <error27@gmail.com>
|
||||
Date: Wed, 15 Feb 2023 07:21:47 +0300
|
||||
Subject: [PATCH] net: phy: motorcomm: uninitialized variables in
|
||||
yt8531_link_change_notify()
|
||||
|
||||
These booleans are never set to false, but are just used without being
|
||||
initialized.
|
||||
|
||||
Fixes: 4ac94f728a58 ("net: phy: Add driver for Motorcomm yt8531 gigabit ethernet phy")
|
||||
Signed-off-by: Dan Carpenter <error27@gmail.com>
|
||||
Reviewed-by: Frank Sae <Frank.Sae@motor-comm.com>
|
||||
Link: https://lore.kernel.org/r/Y+xd2yJet2ImHLoQ@kili
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/motorcomm.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/motorcomm.c
|
||||
+++ b/drivers/net/phy/motorcomm.c
|
||||
@@ -1533,10 +1533,10 @@ static int yt8531_config_init(struct phy
|
||||
static void yt8531_link_change_notify(struct phy_device *phydev)
|
||||
{
|
||||
struct device_node *node = phydev->mdio.dev.of_node;
|
||||
+ bool tx_clk_1000_inverted = false;
|
||||
+ bool tx_clk_100_inverted = false;
|
||||
+ bool tx_clk_10_inverted = false;
|
||||
bool tx_clk_adj_enabled = false;
|
||||
- bool tx_clk_1000_inverted;
|
||||
- bool tx_clk_100_inverted;
|
||||
- bool tx_clk_10_inverted;
|
||||
u16 val = 0;
|
||||
int ret;
|
||||
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
From 3b6c472822f8bdeaa3cea8290f5b4a210dca5585 Mon Sep 17 00:00:00 2001
|
||||
From: Ulf Hansson <ulf.hansson@linaro.org>
|
||||
Date: Thu, 3 Mar 2022 17:45:22 +0100
|
||||
Subject: [PATCH] mmc: core: Improve fallback to speed modes if eMMC HS200
|
||||
fails
|
||||
|
||||
In the error path of mmc_select_hs200() we are trying our best to restore
|
||||
the card/host into a valid state. This makes sense, especially if we
|
||||
encounter a simple switch error (-EBADMSG). However, rather than then
|
||||
continue with using the legacy speed mode, let's try the other better speed
|
||||
modes first. Additionally, let's update the card->mmc_avail_type to avoid
|
||||
us from trying a broken HS200 mode again.
|
||||
|
||||
In an Amlogic S905W based TV box where the switch to HS200 mode fails for
|
||||
the eMMC, this allows us to use the eMMC in DDR mode in favor of the legacy
|
||||
mode, which greatly improves the performance.
|
||||
|
||||
Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
|
||||
Tested-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20220303164522.129583-1-ulf.hansson@linaro.org
|
||||
---
|
||||
drivers/mmc/core/mmc.c | 16 +++++++++++++---
|
||||
1 file changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/mmc/core/mmc.c
|
||||
+++ b/drivers/mmc/core/mmc.c
|
||||
@@ -1530,13 +1530,23 @@ static int mmc_select_timing(struct mmc_
|
||||
if (!mmc_can_ext_csd(card))
|
||||
goto bus_speed;
|
||||
|
||||
- if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES)
|
||||
+ if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES) {
|
||||
err = mmc_select_hs400es(card);
|
||||
- else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200)
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200) {
|
||||
err = mmc_select_hs200(card);
|
||||
- else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS)
|
||||
+ if (err == -EBADMSG)
|
||||
+ card->mmc_avail_type &= ~EXT_CSD_CARD_TYPE_HS200;
|
||||
+ else
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS)
|
||||
err = mmc_select_hs(card);
|
||||
|
||||
+out:
|
||||
if (err && err != -EBADMSG)
|
||||
return err;
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
From 6731d2c9039fbe1ecf21915eab3acee0a999508a Mon Sep 17 00:00:00 2001
|
||||
From: David Bauer <mail@david-bauer.net>
|
||||
Date: Fri, 10 Jul 2020 21:38:20 +0200
|
||||
Subject: [PATCH] rockchip: use system LED for OpenWrt
|
||||
|
||||
Use the SYS LED on the casing for showing system status.
|
||||
|
||||
This patch is kept separate from the NanoPi R2S support patch, as i plan
|
||||
on submitting the device support upstream.
|
||||
|
||||
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
|
||||
@@ -16,6 +16,11 @@
|
||||
aliases {
|
||||
ethernet1 = &rtl8153;
|
||||
mmc0 = &sdmmc;
|
||||
+
|
||||
+ led-boot = &sys_led;
|
||||
+ led-failsafe = &sys_led;
|
||||
+ led-running = &sys_led;
|
||||
+ led-upgrade = &sys_led;
|
||||
};
|
||||
|
||||
chosen {
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
|
||||
@@ -19,6 +19,13 @@
|
||||
model = "FriendlyElec NanoPi R4S";
|
||||
compatible = "friendlyarm,nanopi-r4s", "rockchip,rk3399";
|
||||
|
||||
+ aliases {
|
||||
+ led-boot = &sys_led;
|
||||
+ led-failsafe = &sys_led;
|
||||
+ led-running = &sys_led;
|
||||
+ led-upgrade = &sys_led;
|
||||
+ };
|
||||
+
|
||||
/delete-node/ display-subsystem;
|
||||
|
||||
gpio-leds {
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/phy.h>
|
||||
+#include <linux/of.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/io.h>
|
||||
@@ -183,6 +184,7 @@ enum rtl_registers {
|
||||
MAR0 = 8, /* Multicast filter. */
|
||||
CounterAddrLow = 0x10,
|
||||
CounterAddrHigh = 0x14,
|
||||
+ CustomLED = 0x18,
|
||||
TxDescStartAddrLow = 0x20,
|
||||
TxDescStartAddrHigh = 0x24,
|
||||
TxHDescStartAddrLow = 0x28,
|
||||
@@ -5274,6 +5276,22 @@ done:
|
||||
rtl_rar_set(tp, mac_addr);
|
||||
}
|
||||
|
||||
+static int rtl_led_configuration(struct rtl8169_private *tp)
|
||||
+{
|
||||
+ u32 led_data;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = of_property_read_u32(tp->pci_dev->dev.of_node,
|
||||
+ "realtek,led-data", &led_data);
|
||||
+
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ RTL_W16(tp, CustomLED, led_data);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
{
|
||||
struct rtl8169_private *tp;
|
||||
@@ -5438,6 +5456,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct
|
||||
if (!tp->counters)
|
||||
return -ENOMEM;
|
||||
|
||||
+ rtl_led_configuration(tp);
|
||||
pci_set_drvdata(pdev, tp);
|
||||
|
||||
rc = r8169_mdio_register(tp);
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
From 2795c8b31a686bdb8338f9404d18ef7a154f0d75 Mon Sep 17 00:00:00 2001
|
||||
From: David Bauer <mail@david-bauer.net>
|
||||
Date: Sun, 26 Jul 2020 13:32:59 +0200
|
||||
Subject: [PATCH] arm64: rockchip: add OF node for USB eth on NanoPi R2S
|
||||
|
||||
This adds the OF node for the USB3 ethernet adapter on the FriendlyARM
|
||||
NanoPi R2S. Add the correct value for the RTL8153 LED configuration
|
||||
register to match the blink behavior of the other port on the device.
|
||||
|
||||
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
|
||||
@@ -404,6 +404,8 @@
|
||||
rtl8153: device@2 {
|
||||
compatible = "usbbda,8153";
|
||||
reg = <2>;
|
||||
+
|
||||
+ realtek,led-data = <0x87>;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
--- a/arch/arm64/boot/dts/rockchip/Makefile
|
||||
+++ b/arch/arm64/boot/dts/rockchip/Makefile
|
||||
@@ -26,6 +26,8 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gr
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-kevin.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-scarlet-inx.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-scarlet-kd.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-guangmiao-g4c.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-r4se.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-hugsun-x99.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-khadas-edge.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-khadas-edge-captain.dtb
|
||||
@@ -42,6 +44,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-pi
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-mezzanine.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4a.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4b.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4c.dtb
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts
|
||||
@@ -0,0 +1,13 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2019 Akash Gajjar <Akash_Gajjar@mentor.com>
|
||||
+ * Copyright (c) 2019 Pragnesh Patel <Pragnesh_Patel@mentor.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "rk3399-rock-pi-4.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ model = "Radxa ROCK Pi 4";
|
||||
+ compatible = "radxa,rockpi4", "rockchip,rk3399";
|
||||
+};
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
|
||||
@@ -96,6 +96,19 @@
|
||||
max-link-speed = <1>;
|
||||
num-lanes = <1>;
|
||||
vpcie3v3-supply = <&vcc3v3_sys>;
|
||||
+
|
||||
+ pcie@0 {
|
||||
+ reg = <0x00000000 0 0 0 0>;
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+
|
||||
+ pcie-eth@0,0 {
|
||||
+ compatible = "pci10ec,8168";
|
||||
+ reg = <0x000000 0 0 0 0>;
|
||||
+
|
||||
+ realtek,led-data = <0x870>;
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
From 0d329112c709d6cfedf0fffb19f0cc6b19043f6b Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Wed, 20 Feb 2019 07:38:34 +0000
|
||||
Subject: [PATCH] mmc: core: set initial signal voltage on power off
|
||||
|
||||
Some boards have SD card connectors where the power rail cannot be switched
|
||||
off by the driver. If the card has not been power cycled, it may still be
|
||||
using 1.8V signaling after a warm re-boot. Bootroms expecting 3.3V signaling
|
||||
will fail to boot from a UHS card that continue to use 1.8V signaling.
|
||||
|
||||
Set initial signal voltage in mmc_power_off() to allow re-boot to function.
|
||||
|
||||
This fixes re-boot with UHS cards on Asus Tinker Board (Rockchip RK3288),
|
||||
same issue have been seen on some Rockchip RK3399 boards.
|
||||
|
||||
I am sending this as a RFC because I have no insights into SD/MMC subsystem,
|
||||
this change fix a re-boot issue on my boards and does not break emmc/sdio.
|
||||
Is this an acceptable workaround? Any advice is appreciated.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
drivers/mmc/core/core.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/drivers/mmc/core/core.c
|
||||
+++ b/drivers/mmc/core/core.c
|
||||
@@ -1364,6 +1364,8 @@ void mmc_power_off(struct mmc_host *host
|
||||
|
||||
mmc_pwrseq_power_off(host);
|
||||
|
||||
+ mmc_set_initial_signal_voltage(host);
|
||||
+
|
||||
host->ios.clock = 0;
|
||||
host->ios.vdd = 0;
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
From 0cdf37b755feda3aaceb749750613b5e563e7284 Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Powers-Holmes <aholmes@omnom.net>
|
||||
Date: Sat, 12 Nov 2022 22:41:26 +1100
|
||||
Subject: [PATCH] arm64: dts: rockchip: rk356x: Fix PCIe register and
|
||||
range mappings
|
||||
|
||||
The register and range mappings for the PCIe controller in Rockchip's
|
||||
RK356x SoCs are incorrect. Replace them with corrected values from the
|
||||
vendor BSP sources, updated to match current DT schema.
|
||||
|
||||
Tested-by: Ondrej Jirman <megi@xff.cz>
|
||||
Signed-off-by: Andrew Powers-Holmes <aholmes@omnom.net>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3568.dtsi | 14 ++++++++------
|
||||
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 7 ++++---
|
||||
2 files changed, 12 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -708,7 +708,7 @@
|
||||
compatible = "rockchip,rk3568-pcie";
|
||||
reg = <0x3 0xc0000000 0x0 0x00400000>,
|
||||
<0x0 0xfe260000 0x0 0x00010000>,
|
||||
- <0x3 0x3f000000 0x0 0x01000000>;
|
||||
+ <0x0 0xf4000000 0x0 0x00100000>;
|
||||
reg-names = "dbi", "apb", "config";
|
||||
interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>,
|
||||
@@ -738,8 +738,9 @@
|
||||
phys = <&combphy2 PHY_TYPE_PCIE>;
|
||||
phy-names = "pcie-phy";
|
||||
power-domains = <&power RK3568_PD_PIPE>;
|
||||
- ranges = <0x01000000 0x0 0x3ef00000 0x3 0x3ef00000 0x0 0x00100000
|
||||
- 0x02000000 0x0 0x00000000 0x3 0x00000000 0x0 0x3ef00000>;
|
||||
+ ranges = <0x01000000 0x0 0xf4100000 0x0 0xf4100000 0x0 0x00100000>,
|
||||
+ <0x02000000 0x0 0xf4200000 0x0 0xf4200000 0x0 0x01e00000>,
|
||||
+ <0x03000000 0x0 0x40000000 0x3 0x00000000 0x0 0x40000000>;
|
||||
resets = <&cru SRST_PCIE20_POWERUP>;
|
||||
reset-names = "pipe";
|
||||
#address-cells = <3>;
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
--- a/arch/arm64/Kconfig
|
||||
+++ b/arch/arm64/Kconfig
|
||||
@@ -899,6 +899,14 @@ config SOCIONEXT_SYNQUACER_PREITS
|
||||
|
||||
If unsure, say Y.
|
||||
|
||||
+config ROCKCHIP_ERRATUM_114514
|
||||
+ bool "Rockchip RK3568 force no_local_cache"
|
||||
+ default y
|
||||
+ help
|
||||
+ They consider this as a SoC implement design instead of a bug.
|
||||
+
|
||||
+ If unsure, say Y.
|
||||
+
|
||||
endmenu
|
||||
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
@@ -64,7 +64,7 @@
|
||||
compatible = "rockchip,rk3568-pcie";
|
||||
#address-cells = <3>;
|
||||
#size-cells = <2>;
|
||||
- bus-range = <0x0 0xf>;
|
||||
+ bus-range = <0x10 0x1f>;
|
||||
clocks = <&cru ACLK_PCIE30X1_MST>, <&cru ACLK_PCIE30X1_SLV>,
|
||||
<&cru ACLK_PCIE30X1_DBI>, <&cru PCLK_PCIE30X1>,
|
||||
<&cru CLK_PCIE30X1_AUX_NDFT>;
|
||||
@@ -87,7 +87,7 @@
|
||||
num-ib-windows = <6>;
|
||||
num-ob-windows = <2>;
|
||||
max-link-speed = <3>;
|
||||
- msi-map = <0x0 &gic 0x1000 0x1000>;
|
||||
+ msi-map = <0x1000 &its 0x1000 0x1000>;
|
||||
num-lanes = <1>;
|
||||
phys = <&pcie30phy>;
|
||||
phy-names = "pcie-phy";
|
||||
@@ -116,7 +116,7 @@
|
||||
compatible = "rockchip,rk3568-pcie";
|
||||
#address-cells = <3>;
|
||||
#size-cells = <2>;
|
||||
- bus-range = <0x0 0xf>;
|
||||
+ bus-range = <0x20 0x2f>;
|
||||
clocks = <&cru ACLK_PCIE30X2_MST>, <&cru ACLK_PCIE30X2_SLV>,
|
||||
<&cru ACLK_PCIE30X2_DBI>, <&cru PCLK_PCIE30X2>,
|
||||
<&cru CLK_PCIE30X2_AUX_NDFT>;
|
||||
@@ -139,7 +139,7 @@
|
||||
num-ib-windows = <6>;
|
||||
num-ob-windows = <2>;
|
||||
max-link-speed = <3>;
|
||||
- msi-map = <0x0 &gic 0x2000 0x1000>;
|
||||
+ msi-map = <0x2000 &its 0x2000 0x1000>;
|
||||
num-lanes = <2>;
|
||||
phys = <&pcie30phy>;
|
||||
phy-names = "pcie-phy";
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -260,14 +260,21 @@
|
||||
|
||||
gic: interrupt-controller@fd400000 {
|
||||
compatible = "arm,gic-v3";
|
||||
+ #interrupt-cells = <3>;
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges;
|
||||
+ interrupt-controller;
|
||||
+
|
||||
reg = <0x0 0xfd400000 0 0x10000>, /* GICD */
|
||||
- <0x0 0xfd460000 0 0x80000>; /* GICR */
|
||||
+ <0x0 0xfd460000 0 0xc0000>; /* GICR */
|
||||
interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
|
||||
- interrupt-controller;
|
||||
- #interrupt-cells = <3>;
|
||||
- mbi-alias = <0x0 0xfd410000>;
|
||||
- mbi-ranges = <296 24>;
|
||||
- msi-controller;
|
||||
+ its: interrupt-controller@fd440000 {
|
||||
+ compatible = "arm,gic-v3-its";
|
||||
+ msi-controller;
|
||||
+ #msi-cells = <1>;
|
||||
+ reg = <0x0 0xfd440000 0x0 0x20000>;
|
||||
+ };
|
||||
};
|
||||
|
||||
usb_host0_ehci: usb@fd800000 {
|
||||
@@ -733,7 +740,7 @@
|
||||
num-ib-windows = <6>;
|
||||
num-ob-windows = <2>;
|
||||
max-link-speed = <2>;
|
||||
- msi-map = <0x0 &gic 0x0 0x1000>;
|
||||
+ msi-map = <0x0 &its 0x0 0x1000>;
|
||||
num-lanes = <1>;
|
||||
phys = <&combphy2 PHY_TYPE_PCIE>;
|
||||
phy-names = "pcie-phy";
|
||||
|
|
@ -0,0 +1,198 @@
|
|||
From 536378a084c6a4148141e132efee2fa9a464e007 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Geis <pgwipeout@gmail.com>
|
||||
Date: Thu, 3 Jun 2021 11:36:35 -0400
|
||||
Subject: [PATCH] irqchip: gic-v3: add hackaround for rk3568 its
|
||||
|
||||
---
|
||||
drivers/irqchip/irq-gic-v3-its.c | 70 +++++++++++++++++++++++++++++---
|
||||
1 file changed, 65 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/irqchip/irq-gic-v3-its.c
|
||||
+++ b/drivers/irqchip/irq-gic-v3-its.c
|
||||
@@ -45,6 +45,7 @@
|
||||
|
||||
#define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0)
|
||||
#define RDIST_FLAGS_RD_TABLES_PREALLOCATED (1 << 1)
|
||||
+#define RDIST_FLAGS_FORCE_NO_LOCAL_CACHE (1 << 2)
|
||||
|
||||
static u32 lpi_id_bits;
|
||||
|
||||
@@ -2172,6 +2173,11 @@ static struct page *its_allocate_prop_ta
|
||||
{
|
||||
struct page *prop_page;
|
||||
|
||||
+ if (gic_rdists->flags & RDIST_FLAGS_FORCE_NO_LOCAL_CACHE) {
|
||||
+ pr_err("ITS ALLOCATE PROP WORKAROUND\n");
|
||||
+ gfp_flags |= GFP_DMA;
|
||||
+ }
|
||||
+
|
||||
prop_page = alloc_pages(gfp_flags, get_order(LPI_PROPBASE_SZ));
|
||||
if (!prop_page)
|
||||
return NULL;
|
||||
@@ -2295,6 +2301,7 @@ static int its_setup_baser(struct its_no
|
||||
u32 alloc_pages, psz;
|
||||
struct page *page;
|
||||
void *base;
|
||||
+ gfp_t gfp_flags;
|
||||
|
||||
psz = baser->psz;
|
||||
alloc_pages = (PAGE_ORDER_TO_SIZE(order) / psz);
|
||||
@@ -2306,7 +2313,10 @@ static int its_setup_baser(struct its_no
|
||||
order = get_order(GITS_BASER_PAGES_MAX * psz);
|
||||
}
|
||||
|
||||
- page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO, order);
|
||||
+ gfp_flags = GFP_KERNEL | __GFP_ZERO;
|
||||
+ if (gic_rdists->flags & RDIST_FLAGS_FORCE_NO_LOCAL_CACHE)
|
||||
+ gfp_flags |= GFP_DMA;
|
||||
+ page = alloc_pages_node(its->numa_node, gfp_flags, order);
|
||||
if (!page)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -2353,6 +2363,13 @@ retry_baser:
|
||||
its_write_baser(its, baser, val);
|
||||
tmp = baser->val;
|
||||
|
||||
+ if (gic_rdists->flags & RDIST_FLAGS_FORCE_NO_LOCAL_CACHE) {
|
||||
+ if (tmp & GITS_BASER_SHAREABILITY_MASK)
|
||||
+ tmp &= ~GITS_BASER_SHAREABILITY_MASK;
|
||||
+ else
|
||||
+ gic_flush_dcache_to_poc(base, PAGE_ORDER_TO_SIZE(order));
|
||||
+ }
|
||||
+
|
||||
if ((val ^ tmp) & GITS_BASER_SHAREABILITY_MASK) {
|
||||
/*
|
||||
* Shareability didn't stick. Just use
|
||||
@@ -2935,6 +2952,10 @@ static struct page *its_allocate_pending
|
||||
{
|
||||
struct page *pend_page;
|
||||
|
||||
+ if (gic_rdists->flags & RDIST_FLAGS_FORCE_NO_LOCAL_CACHE) {
|
||||
+ gfp_flags |= GFP_DMA;
|
||||
+ }
|
||||
+
|
||||
pend_page = alloc_pages(gfp_flags | __GFP_ZERO,
|
||||
get_order(LPI_PENDBASE_SZ));
|
||||
if (!pend_page)
|
||||
@@ -3092,6 +3113,9 @@ static void its_cpu_init_lpis(void)
|
||||
gicr_write_propbaser(val, rbase + GICR_PROPBASER);
|
||||
tmp = gicr_read_propbaser(rbase + GICR_PROPBASER);
|
||||
|
||||
+ if (gic_rdists->flags & RDIST_FLAGS_FORCE_NO_LOCAL_CACHE)
|
||||
+ tmp &= ~GICR_PROPBASER_SHAREABILITY_MASK;
|
||||
+
|
||||
if ((tmp ^ val) & GICR_PROPBASER_SHAREABILITY_MASK) {
|
||||
if (!(tmp & GICR_PROPBASER_SHAREABILITY_MASK)) {
|
||||
/*
|
||||
@@ -3116,6 +3140,9 @@ static void its_cpu_init_lpis(void)
|
||||
gicr_write_pendbaser(val, rbase + GICR_PENDBASER);
|
||||
tmp = gicr_read_pendbaser(rbase + GICR_PENDBASER);
|
||||
|
||||
+ if (gic_rdists->flags & RDIST_FLAGS_FORCE_NO_LOCAL_CACHE)
|
||||
+ tmp &= ~GICR_PENDBASER_SHAREABILITY_MASK;
|
||||
+
|
||||
if (!(tmp & GICR_PENDBASER_SHAREABILITY_MASK)) {
|
||||
/*
|
||||
* The HW reports non-shareable, we must remove the
|
||||
@@ -3278,7 +3305,12 @@ static bool its_alloc_table_entry(struct
|
||||
|
||||
/* Allocate memory for 2nd level table */
|
||||
if (!table[idx]) {
|
||||
- page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO,
|
||||
+ gfp_t gfp_flags = GFP_KERNEL | __GFP_ZERO;
|
||||
+ if (gic_rdists->flags & RDIST_FLAGS_FORCE_NO_LOCAL_CACHE) {
|
||||
+ gfp_flags |= GFP_DMA;
|
||||
+ }
|
||||
+
|
||||
+ page = alloc_pages_node(its->numa_node, gfp_flags,
|
||||
get_order(baser->psz));
|
||||
if (!page)
|
||||
return false;
|
||||
@@ -3367,6 +3399,7 @@ static struct its_device *its_create_dev
|
||||
int nr_lpis;
|
||||
int nr_ites;
|
||||
int sz;
|
||||
+ gfp_t gfp_flags;
|
||||
|
||||
if (!its_alloc_device_table(its, dev_id))
|
||||
return NULL;
|
||||
@@ -3374,7 +3407,11 @@ static struct its_device *its_create_dev
|
||||
if (WARN_ON(!is_power_of_2(nvecs)))
|
||||
nvecs = roundup_pow_of_two(nvecs);
|
||||
|
||||
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
+ gfp_flags = GFP_KERNEL;
|
||||
+ if (gic_rdists->flags & RDIST_FLAGS_FORCE_NO_LOCAL_CACHE)
|
||||
+ gfp_flags |= GFP_DMA;
|
||||
+
|
||||
+ dev = kzalloc(sizeof(*dev), gfp_flags);
|
||||
/*
|
||||
* Even if the device wants a single LPI, the ITT must be
|
||||
* sized as a power of two (and you need at least one bit...).
|
||||
@@ -3382,7 +3419,7 @@ static struct its_device *its_create_dev
|
||||
nr_ites = max(2, nvecs);
|
||||
sz = nr_ites * (FIELD_GET(GITS_TYPER_ITT_ENTRY_SIZE, its->typer) + 1);
|
||||
sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1;
|
||||
- itt = kzalloc_node(sz, GFP_KERNEL, its->numa_node);
|
||||
+ itt = kzalloc_node(sz, gfp_flags, its->numa_node);
|
||||
if (alloc_lpis) {
|
||||
lpi_map = its_lpi_alloc(nvecs, &lpi_base, &nr_lpis);
|
||||
if (lpi_map)
|
||||
@@ -4705,6 +4742,13 @@ static bool __maybe_unused its_enable_qu
|
||||
return true;
|
||||
}
|
||||
|
||||
+static bool __maybe_unused its_enable_quirk_rk3568(void *data)
|
||||
+{
|
||||
+ gic_rdists->flags |= RDIST_FLAGS_FORCE_NO_LOCAL_CACHE;
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
static const struct gic_quirk its_quirks[] = {
|
||||
#ifdef CONFIG_CAVIUM_ERRATUM_22375
|
||||
{
|
||||
@@ -4751,6 +4795,14 @@ static const struct gic_quirk its_quirks
|
||||
.init = its_enable_quirk_hip07_161600802,
|
||||
},
|
||||
#endif
|
||||
+#ifdef CONFIG_ROCKCHIP_ERRATUM_114514
|
||||
+ {
|
||||
+ .desc = "ITS: Rockchip erratum 114514",
|
||||
+ .iidr = 0x0201743b,
|
||||
+ .mask = 0xffffffff,
|
||||
+ .init = its_enable_quirk_rk3568,
|
||||
+ },
|
||||
+#endif
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -4974,6 +5026,7 @@ static int __init its_probe_one(struct r
|
||||
u64 baser, tmp, typer;
|
||||
struct page *page;
|
||||
int err;
|
||||
+ gfp_t gfp_flags;
|
||||
|
||||
its_base = ioremap(res->start, SZ_64K);
|
||||
if (!its_base) {
|
||||
@@ -5042,7 +5095,9 @@ static int __init its_probe_one(struct r
|
||||
|
||||
its->numa_node = numa_node;
|
||||
|
||||
- page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO,
|
||||
+ gfp_flags = GFP_KERNEL | __GFP_ZERO | GFP_DMA;
|
||||
+
|
||||
+ page = alloc_pages_node(its->numa_node, gfp_flags,
|
||||
get_order(ITS_CMD_QUEUE_SZ));
|
||||
if (!page) {
|
||||
err = -ENOMEM;
|
||||
@@ -5073,6 +5128,9 @@ static int __init its_probe_one(struct r
|
||||
gits_write_cbaser(baser, its->base + GITS_CBASER);
|
||||
tmp = gits_read_cbaser(its->base + GITS_CBASER);
|
||||
|
||||
+ if (gic_rdists->flags & RDIST_FLAGS_FORCE_NO_LOCAL_CACHE)
|
||||
+ tmp &= ~GITS_CBASER_SHAREABILITY_MASK;
|
||||
+
|
||||
if ((tmp ^ baser) & GITS_CBASER_SHAREABILITY_MASK) {
|
||||
if (!(tmp & GITS_CBASER_SHAREABILITY_MASK)) {
|
||||
/*
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
@@ -173,11 +173,13 @@
|
||||
clocks = <&cru SCLK_GMAC0>, <&cru SCLK_GMAC0_RX_TX>,
|
||||
<&cru SCLK_GMAC0_RX_TX>, <&cru CLK_MAC0_REFOUT>,
|
||||
<&cru ACLK_GMAC0>, <&cru PCLK_GMAC0>,
|
||||
- <&cru SCLK_GMAC0_RX_TX>, <&cru CLK_GMAC0_PTP_REF>;
|
||||
+ <&cru SCLK_GMAC0_RX_TX>, <&cru CLK_GMAC0_PTP_REF>,
|
||||
+ <&cru PCLK_XPCS>;
|
||||
clock-names = "stmmaceth", "mac_clk_rx",
|
||||
"mac_clk_tx", "clk_mac_refout",
|
||||
"aclk_mac", "pclk_mac",
|
||||
- "clk_mac_speed", "ptp_ref";
|
||||
+ "clk_mac_speed", "ptp_ref",
|
||||
+ "pclk_xpcs";
|
||||
resets = <&cru SRST_A_GMAC0>;
|
||||
reset-names = "stmmaceth";
|
||||
rockchip,grf = <&grf>;
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||||
@@ -321,6 +321,12 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ xpcs: syscon@fda00000 {
|
||||
+ compatible = "rockchip,rk3568-xpcs", "syscon";
|
||||
+ reg = <0x0 0xfda00000 0x0 0x200000>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
pmugrf: syscon@fdc20000 {
|
||||
compatible = "rockchip,rk3568-pmugrf", "syscon", "simple-mfd";
|
||||
reg = <0x0 0xfdc20000 0x0 0x10000>;
|
||||
|
|
@ -0,0 +1,343 @@
|
|||
From ca89ea7e0760c096c6fd807d321ecb8416f8cd9d Mon Sep 17 00:00:00 2001
|
||||
From: David Wu <david.wu@rock-chips.com>
|
||||
Date: Thu, 31 Dec 2020 18:32:03 +0800
|
||||
Subject: [PATCH] ethernet: stmicro: stmmac: Add SGMII/QSGMII support for
|
||||
RK3568
|
||||
|
||||
After the completion of Clause 37 auto-negotiation, xpcs automatically
|
||||
switches to the negotiated speed for 10/100/1000M.
|
||||
|
||||
Change-Id: Iab9dd6ee61a35bf89fd3a0721f5d398de501a7ec
|
||||
Signed-off-by: David Wu <david.wu@rock-chips.com>
|
||||
---
|
||||
.../net/ethernet/stmicro/stmmac/dwmac-rk.c | 228 +++++++++++++++++-
|
||||
1 file changed, 217 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
|
||||
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/phy.h>
|
||||
+#include <linux/phy/phy.h>
|
||||
#include <linux/of_net.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/module.h>
|
||||
@@ -30,6 +31,8 @@ struct rk_gmac_ops {
|
||||
void (*set_to_rgmii)(struct rk_priv_data *bsp_priv,
|
||||
int tx_delay, int rx_delay);
|
||||
void (*set_to_rmii)(struct rk_priv_data *bsp_priv);
|
||||
+ void (*set_to_sgmii)(struct rk_priv_data *bsp_priv);
|
||||
+ void (*set_to_qsgmii)(struct rk_priv_data *bsp_priv);
|
||||
void (*set_rgmii_speed)(struct rk_priv_data *bsp_priv, int speed);
|
||||
void (*set_rmii_speed)(struct rk_priv_data *bsp_priv, int speed);
|
||||
void (*integrated_phy_powerup)(struct rk_priv_data *bsp_priv);
|
||||
@@ -58,6 +61,7 @@ struct rk_priv_data {
|
||||
struct clk *clk_mac_speed;
|
||||
struct clk *aclk_mac;
|
||||
struct clk *pclk_mac;
|
||||
+ struct clk *pclk_xpcs;
|
||||
struct clk *clk_phy;
|
||||
|
||||
struct reset_control *phy_reset;
|
||||
@@ -66,6 +70,7 @@ struct rk_priv_data {
|
||||
int rx_delay;
|
||||
|
||||
struct regmap *grf;
|
||||
+ struct regmap *xpcs;
|
||||
};
|
||||
|
||||
#define HIWORD_UPDATE(val, mask, shift) \
|
||||
@@ -78,6 +83,128 @@ struct rk_priv_data {
|
||||
(((tx) ? soc##_GMAC_TXCLK_DLY_ENABLE : soc##_GMAC_TXCLK_DLY_DISABLE) | \
|
||||
((rx) ? soc##_GMAC_RXCLK_DLY_ENABLE : soc##_GMAC_RXCLK_DLY_DISABLE))
|
||||
|
||||
+/* XPCS */
|
||||
+#define XPCS_APB_INCREMENT (0x4)
|
||||
+#define XPCS_APB_MASK GENMASK_ULL(20, 0)
|
||||
+
|
||||
+#define SR_MII_BASE (0x1F0000)
|
||||
+#define SR_MII1_BASE (0x1A0000)
|
||||
+
|
||||
+#define VR_MII_DIG_CTRL1 (0x8000)
|
||||
+#define VR_MII_AN_CTRL (0x8001)
|
||||
+#define VR_MII_AN_INTR_STS (0x8002)
|
||||
+#define VR_MII_LINK_TIMER_CTRL (0x800A)
|
||||
+
|
||||
+#define SR_MII_CTRL_AN_ENABLE \
|
||||
+ (BMCR_ANENABLE | BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000)
|
||||
+#define MII_MAC_AUTO_SW (0x0200)
|
||||
+#define PCS_MODE_OFFSET (0x1)
|
||||
+#define MII_AN_INTR_EN (0x1)
|
||||
+#define PCS_SGMII_MODE (0x2 << PCS_MODE_OFFSET)
|
||||
+#define PCS_QSGMII_MODE (0X3 << PCS_MODE_OFFSET)
|
||||
+#define VR_MII_CTRL_SGMII_AN_EN (PCS_SGMII_MODE | MII_AN_INTR_EN)
|
||||
+#define VR_MII_CTRL_QSGMII_AN_EN (PCS_QSGMII_MODE | MII_AN_INTR_EN)
|
||||
+
|
||||
+#define SR_MII_OFFSET(_x) ({ \
|
||||
+ typeof(_x) (x) = (_x); \
|
||||
+ (((x) == 0) ? SR_MII_BASE : (SR_MII1_BASE + ((x) - 1) * 0x10000)); \
|
||||
+}) \
|
||||
+
|
||||
+static int xpcs_read(void *priv, int reg)
|
||||
+{
|
||||
+ struct rk_priv_data *bsp_priv = (struct rk_priv_data *)priv;
|
||||
+ int ret, val;
|
||||
+
|
||||
+ ret = regmap_read(bsp_priv->xpcs,
|
||||
+ (u32)(reg * XPCS_APB_INCREMENT) & XPCS_APB_MASK,
|
||||
+ &val);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ return val;
|
||||
+}
|
||||
+
|
||||
+static int xpcs_write(void *priv, int reg, u16 value)
|
||||
+{
|
||||
+ struct rk_priv_data *bsp_priv = (struct rk_priv_data *)priv;
|
||||
+
|
||||
+ return regmap_write(bsp_priv->xpcs,
|
||||
+ (reg * XPCS_APB_INCREMENT) & XPCS_APB_MASK, value);
|
||||
+}
|
||||
+
|
||||
+static int xpcs_poll_reset(struct rk_priv_data *bsp_priv, int dev)
|
||||
+{
|
||||
+ /* Poll until the reset bit clears (50ms per retry == 0.6 sec) */
|
||||
+ unsigned int retries = 12;
|
||||
+ int ret;
|
||||
+
|
||||
+ do {
|
||||
+ msleep(50);
|
||||
+ ret = xpcs_read(bsp_priv, SR_MII_OFFSET(dev) + MDIO_CTRL1);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+ } while (ret & MDIO_CTRL1_RESET && --retries);
|
||||
+
|
||||
+ return (ret & MDIO_CTRL1_RESET) ? -ETIMEDOUT : 0;
|
||||
+}
|
||||
+
|
||||
+static int xpcs_soft_reset(struct rk_priv_data *bsp_priv, int dev)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = xpcs_write(bsp_priv, SR_MII_OFFSET(dev) + MDIO_CTRL1,
|
||||
+ MDIO_CTRL1_RESET);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ return xpcs_poll_reset(bsp_priv, dev);
|
||||
+}
|
||||
+
|
||||
+static int xpcs_setup(struct rk_priv_data *bsp_priv, int mode)
|
||||
+{
|
||||
+ int ret, i, idx = bsp_priv->id;
|
||||
+ u32 val;
|
||||
+
|
||||
+ if (mode == PHY_INTERFACE_MODE_QSGMII && idx > 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ ret = xpcs_soft_reset(bsp_priv, idx);
|
||||
+ if (ret) {
|
||||
+ dev_err(&bsp_priv->pdev->dev, "xpcs_soft_reset fail %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ xpcs_write(bsp_priv, SR_MII_OFFSET(0) + VR_MII_AN_INTR_STS, 0x0);
|
||||
+ xpcs_write(bsp_priv, SR_MII_OFFSET(0) + VR_MII_LINK_TIMER_CTRL, 0x1);
|
||||
+
|
||||
+ if (mode == PHY_INTERFACE_MODE_SGMII)
|
||||
+ xpcs_write(bsp_priv, SR_MII_OFFSET(0) + VR_MII_AN_CTRL,
|
||||
+ VR_MII_CTRL_SGMII_AN_EN);
|
||||
+ else
|
||||
+ xpcs_write(bsp_priv, SR_MII_OFFSET(0) + VR_MII_AN_CTRL,
|
||||
+ VR_MII_CTRL_QSGMII_AN_EN);
|
||||
+
|
||||
+ if (mode == PHY_INTERFACE_MODE_QSGMII) {
|
||||
+ for (i = 0; i < 4; i++) {
|
||||
+ val = xpcs_read(bsp_priv,
|
||||
+ SR_MII_OFFSET(i) + VR_MII_DIG_CTRL1);
|
||||
+ xpcs_write(bsp_priv,
|
||||
+ SR_MII_OFFSET(i) + VR_MII_DIG_CTRL1,
|
||||
+ val | MII_MAC_AUTO_SW);
|
||||
+ xpcs_write(bsp_priv, SR_MII_OFFSET(i) + MII_BMCR,
|
||||
+ SR_MII_CTRL_AN_ENABLE);
|
||||
+ }
|
||||
+ } else {
|
||||
+ val = xpcs_read(bsp_priv, SR_MII_OFFSET(idx) + VR_MII_DIG_CTRL1);
|
||||
+ xpcs_write(bsp_priv, SR_MII_OFFSET(idx) + VR_MII_DIG_CTRL1,
|
||||
+ val | MII_MAC_AUTO_SW);
|
||||
+ xpcs_write(bsp_priv, SR_MII_OFFSET(idx) + MII_BMCR,
|
||||
+ SR_MII_CTRL_AN_ENABLE);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
#define PX30_GRF_GMAC_CON1 0x0904
|
||||
|
||||
/* PX30_GRF_GMAC_CON1 */
|
||||
@@ -1005,6 +1132,7 @@ static const struct rk_gmac_ops rk3399_o
|
||||
#define RK3568_GRF_GMAC1_CON1 0x038c
|
||||
|
||||
/* RK3568_GRF_GMAC0_CON1 && RK3568_GRF_GMAC1_CON1 */
|
||||
+#define RK3568_GMAC_GMII_MODE GRF_BIT(7)
|
||||
#define RK3568_GMAC_PHY_INTF_SEL_RGMII \
|
||||
(GRF_BIT(4) | GRF_CLR_BIT(5) | GRF_CLR_BIT(6))
|
||||
#define RK3568_GMAC_PHY_INTF_SEL_RMII \
|
||||
@@ -1020,6 +1148,46 @@ static const struct rk_gmac_ops rk3399_o
|
||||
#define RK3568_GMAC_CLK_RX_DL_CFG(val) HIWORD_UPDATE(val, 0x7F, 8)
|
||||
#define RK3568_GMAC_CLK_TX_DL_CFG(val) HIWORD_UPDATE(val, 0x7F, 0)
|
||||
|
||||
+#define RK3568_PIPE_GRF_XPCS_CON0 0X0040
|
||||
+
|
||||
+#define RK3568_PIPE_GRF_XPCS_QGMII_MAC_SEL GRF_BIT(0)
|
||||
+#define RK3568_PIPE_GRF_XPCS_SGMII_MAC_SEL GRF_BIT(1)
|
||||
+#define RK3568_PIPE_GRF_XPCS_PHY_READY GRF_BIT(2)
|
||||
+
|
||||
+static void rk3568_set_to_sgmii(struct rk_priv_data *bsp_priv)
|
||||
+{
|
||||
+ struct device *dev = &bsp_priv->pdev->dev;
|
||||
+ u32 con1;
|
||||
+
|
||||
+ if (IS_ERR(bsp_priv->grf)) {
|
||||
+ dev_err(dev, "Missing rockchip,grf property\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ con1 = (bsp_priv->id == 1) ? RK3568_GRF_GMAC1_CON1 :
|
||||
+ RK3568_GRF_GMAC0_CON1;
|
||||
+ regmap_write(bsp_priv->grf, con1, RK3568_GMAC_GMII_MODE);
|
||||
+
|
||||
+ xpcs_setup(bsp_priv, PHY_INTERFACE_MODE_SGMII);
|
||||
+}
|
||||
+
|
||||
+static void rk3568_set_to_qsgmii(struct rk_priv_data *bsp_priv)
|
||||
+{
|
||||
+ struct device *dev = &bsp_priv->pdev->dev;
|
||||
+ u32 con1;
|
||||
+
|
||||
+ if (IS_ERR(bsp_priv->grf)) {
|
||||
+ dev_err(dev, "Missing rockchip,grf property\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ con1 = (bsp_priv->id == 1) ? RK3568_GRF_GMAC1_CON1 :
|
||||
+ RK3568_GRF_GMAC0_CON1;
|
||||
+ regmap_write(bsp_priv->grf, con1, RK3568_GMAC_GMII_MODE);
|
||||
+
|
||||
+ xpcs_setup(bsp_priv, PHY_INTERFACE_MODE_QSGMII);
|
||||
+}
|
||||
+
|
||||
static void rk3568_set_to_rgmii(struct rk_priv_data *bsp_priv,
|
||||
int tx_delay, int rx_delay)
|
||||
{
|
||||
@@ -1091,6 +1259,8 @@ static void rk3568_set_gmac_speed(struct
|
||||
static const struct rk_gmac_ops rk3568_ops = {
|
||||
.set_to_rgmii = rk3568_set_to_rgmii,
|
||||
.set_to_rmii = rk3568_set_to_rmii,
|
||||
+ .set_to_sgmii = rk3568_set_to_sgmii,
|
||||
+ .set_to_qsgmii = rk3568_set_to_qsgmii,
|
||||
.set_rgmii_speed = rk3568_set_gmac_speed,
|
||||
.set_rmii_speed = rk3568_set_gmac_speed,
|
||||
.regs_valid = true,
|
||||
@@ -1243,6 +1413,12 @@ static int rk_gmac_clk_init(struct plat_
|
||||
dev_err(dev, "cannot get clock %s\n",
|
||||
"clk_mac_refout");
|
||||
}
|
||||
+ } else if (bsp_priv->phy_iface == PHY_INTERFACE_MODE_SGMII ||
|
||||
+ bsp_priv->phy_iface == PHY_INTERFACE_MODE_QSGMII) {
|
||||
+ bsp_priv->pclk_xpcs = devm_clk_get(dev, "pclk_xpcs");
|
||||
+ if (IS_ERR(bsp_priv->pclk_xpcs))
|
||||
+ dev_err(dev, "cannot get clock %s\n",
|
||||
+ "pclk_xpcs");
|
||||
}
|
||||
|
||||
bsp_priv->clk_mac_speed = devm_clk_get(dev, "clk_mac_speed");
|
||||
@@ -1298,6 +1474,9 @@ static int gmac_clk_enable(struct rk_pri
|
||||
if (!IS_ERR(bsp_priv->pclk_mac))
|
||||
clk_prepare_enable(bsp_priv->pclk_mac);
|
||||
|
||||
+ if (!IS_ERR(bsp_priv->pclk_xpcs))
|
||||
+ clk_prepare_enable(bsp_priv->pclk_xpcs);
|
||||
+
|
||||
if (!IS_ERR(bsp_priv->mac_clk_tx))
|
||||
clk_prepare_enable(bsp_priv->mac_clk_tx);
|
||||
|
||||
@@ -1327,6 +1506,8 @@ static int gmac_clk_enable(struct rk_pri
|
||||
|
||||
clk_disable_unprepare(bsp_priv->pclk_mac);
|
||||
|
||||
+ clk_disable_unprepare(bsp_priv->pclk_xpcs);
|
||||
+
|
||||
clk_disable_unprepare(bsp_priv->mac_clk_tx);
|
||||
|
||||
clk_disable_unprepare(bsp_priv->clk_mac_speed);
|
||||
@@ -1341,7 +1522,7 @@ static int gmac_clk_enable(struct rk_pri
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int phy_power_on(struct rk_priv_data *bsp_priv, bool enable)
|
||||
+static int rk_gmac_phy_power_on(struct rk_priv_data *bsp_priv, bool enable)
|
||||
{
|
||||
struct regulator *ldo = bsp_priv->regulator;
|
||||
int ret;
|
||||
@@ -1444,6 +1625,18 @@ static struct rk_priv_data *rk_gmac_setu
|
||||
|
||||
bsp_priv->grf = syscon_regmap_lookup_by_phandle(dev->of_node,
|
||||
"rockchip,grf");
|
||||
+ bsp_priv->xpcs = syscon_regmap_lookup_by_phandle(dev->of_node,
|
||||
+ "rockchip,xpcs");
|
||||
+ if (!IS_ERR(bsp_priv->xpcs)) {
|
||||
+ struct phy *comphy;
|
||||
+
|
||||
+ comphy = devm_of_phy_get(&pdev->dev, dev->of_node, NULL);
|
||||
+ if (IS_ERR(comphy))
|
||||
+ dev_err(dev, "devm_of_phy_get error\n");
|
||||
+ ret = phy_init(comphy);
|
||||
+ if (ret)
|
||||
+ dev_err(dev, "phy_init error\n");
|
||||
+ }
|
||||
|
||||
if (plat->phy_node) {
|
||||
bsp_priv->integrated_phy = of_property_read_bool(plat->phy_node,
|
||||
@@ -1521,11 +1714,19 @@ static int rk_gmac_powerup(struct rk_pri
|
||||
dev_info(dev, "init for RMII\n");
|
||||
bsp_priv->ops->set_to_rmii(bsp_priv);
|
||||
break;
|
||||
+ case PHY_INTERFACE_MODE_SGMII:
|
||||
+ dev_info(dev, "init for SGMII\n");
|
||||
+ bsp_priv->ops->set_to_sgmii(bsp_priv);
|
||||
+ break;
|
||||
+ case PHY_INTERFACE_MODE_QSGMII:
|
||||
+ dev_info(dev, "init for QSGMII\n");
|
||||
+ bsp_priv->ops->set_to_qsgmii(bsp_priv);
|
||||
+ break;
|
||||
default:
|
||||
dev_err(dev, "NO interface defined!\n");
|
||||
}
|
||||
|
||||
- ret = phy_power_on(bsp_priv, true);
|
||||
+ ret = rk_gmac_phy_power_on(bsp_priv, true);
|
||||
if (ret) {
|
||||
gmac_clk_enable(bsp_priv, false);
|
||||
return ret;
|
||||
@@ -1546,7 +1747,7 @@ static void rk_gmac_powerdown(struct rk_
|
||||
|
||||
pm_runtime_put_sync(&gmac->pdev->dev);
|
||||
|
||||
- phy_power_on(gmac, false);
|
||||
+ rk_gmac_phy_power_on(gmac, false);
|
||||
gmac_clk_enable(gmac, false);
|
||||
}
|
||||
|
||||
@@ -1567,6 +1768,9 @@ static void rk_fix_speed(void *priv, uns
|
||||
if (bsp_priv->ops->set_rmii_speed)
|
||||
bsp_priv->ops->set_rmii_speed(bsp_priv, speed);
|
||||
break;
|
||||
+ case PHY_INTERFACE_MODE_SGMII:
|
||||
+ case PHY_INTERFACE_MODE_QSGMII:
|
||||
+ break;
|
||||
default:
|
||||
dev_err(dev, "unsupported interface %d", bsp_priv->phy_iface);
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
From b4aeb93e697e4dbe2d336d01290e92e98acfd83c Mon Sep 17 00:00:00 2001
|
||||
From: jensen <jensenhuang@friendlyarm.com>
|
||||
Date: Sat, 15 Oct 2022 18:47:24 +0800
|
||||
Subject: [PATCH] rfkill: gpio: add of_match_table support
|
||||
|
||||
Signed-off-by: jensen <jensenhuang@friendlyarm.com>
|
||||
---
|
||||
net/rfkill/rfkill-gpio.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
--- a/net/rfkill/rfkill-gpio.c
|
||||
+++ b/net/rfkill/rfkill-gpio.c
|
||||
@@ -156,6 +156,13 @@ static const struct acpi_device_id rfkil
|
||||
};
|
||||
MODULE_DEVICE_TABLE(acpi, rfkill_acpi_match);
|
||||
#endif
|
||||
+#ifdef CONFIG_OF
|
||||
+static struct of_device_id rfkill_gpio_of_match[] = {
|
||||
+ { .compatible = "rfkill-gpio" },
|
||||
+ { },
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rfkill_gpio_of_match);
|
||||
+#endif
|
||||
|
||||
static struct platform_driver rfkill_gpio_driver = {
|
||||
.probe = rfkill_gpio_probe,
|
||||
@@ -163,6 +170,7 @@ static struct platform_driver rfkill_gpi
|
||||
.driver = {
|
||||
.name = "rfkill_gpio",
|
||||
.acpi_match_table = ACPI_PTR(rfkill_acpi_match),
|
||||
+ .of_match_table = of_match_ptr(rfkill_gpio_of_match),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
From 3b7eb946b1d640d684a921e53e1e50985ab7eb89 Mon Sep 17 00:00:00 2001
|
||||
From: QiuSimons <45143996+QiuSimons@users.noreply.github.com>
|
||||
Date: Tue, 4 Aug 2020 20:17:53 +0800
|
||||
Subject: [PATCH] rockchip: rk3328: add i2c0 controller for nanopi r2s
|
||||
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts | 4 ++++
|
||||
1 files changed, 4 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
|
||||
@@ -173,6 +173,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&i2c0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&i2c1 {
|
||||
status = "okay";
|
||||
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
--- a/arch/arm64/boot/dts/rockchip/Makefile
|
||||
+++ b/arch/arm64/boot/dts/rockchip/Makefile
|
||||
@@ -10,6 +10,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3326-od
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-a1.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-evb.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2s.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-orangepi-r1-plus.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock64.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock-pi-e.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-roc-cc.dtb
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts
|
||||
@@ -0,0 +1,39 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+#include "rk3328-nanopi-r2s.dts"
|
||||
+
|
||||
+/ {
|
||||
+ model = "Xunlong Orange Pi R1 Plus";
|
||||
+ compatible = "xunlong,orangepi-r1-plus", "rockchip,rk3328";
|
||||
+};
|
||||
+
|
||||
+&lan_led {
|
||||
+ label = "orangepi-r1-plus:green:lan";
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ max-freq = <48000000>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ flash@0 {
|
||||
+ compatible = "jedec,spi-nor";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <10000000>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&sys_led {
|
||||
+ gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
|
||||
+ label = "orangepi-r1-plus:red:sys";
|
||||
+};
|
||||
+
|
||||
+&sys_led_pin {
|
||||
+ rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&wan_led {
|
||||
+ label = "orangepi-r1-plus:green:wan";
|
||||
+};
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
--- a/arch/arm64/boot/dts/rockchip/Makefile
|
||||
+++ b/arch/arm64/boot/dts/rockchip/Makefile
|
||||
@@ -11,6 +11,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-a1
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-evb.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2s.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-orangepi-r1-plus.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-orangepi-r1-plus-lts.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock64.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock-pi-e.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-roc-cc.dtb
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus-lts.dts
|
||||
@@ -0,0 +1,71 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2016 Xunlong Software. Co., Ltd.
|
||||
+ * (http://www.orangepi.org)
|
||||
+ *
|
||||
+ * Copyright (c) 2021 Tianling Shen <cnsztl@immortalwrt.org>
|
||||
+ */
|
||||
+
|
||||
+#include "rk3328-orangepi-r1-plus.dts"
|
||||
+
|
||||
+/ {
|
||||
+ model = "Xunlong Orange Pi R1 Plus LTS";
|
||||
+ compatible = "xunlong,orangepi-r1-plus-lts", "rockchip,rk3328";
|
||||
+};
|
||||
+
|
||||
+&dmc_opp_table {
|
||||
+ opp-798000000 {
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+ opp-840000000 {
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+ opp-924000000 {
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+ opp-1056000000 {
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&gmac2io {
|
||||
+ phy-handle = <&yt8531c>;
|
||||
+ tx_delay = <0x19>;
|
||||
+ rx_delay = <0x05>;
|
||||
+
|
||||
+ mdio {
|
||||
+ /delete-node/ ethernet-phy@1;
|
||||
+
|
||||
+ yt8531c: ethernet-phy@0 {
|
||||
+ compatible = "ethernet-phy-id4f51.e91b",
|
||||
+ "ethernet-phy-ieee802.3-c22";
|
||||
+ reg = <0>;
|
||||
+
|
||||
+ motorcomm,clk-out-frequency-hz = <125000000>;
|
||||
+ motorcomm,keep-pll-enabled;
|
||||
+ motorcomm,auto-sleep-disabled;
|
||||
+
|
||||
+ pinctrl-0 = <ð_phy_reset_pin>;
|
||||
+ pinctrl-names = "default";
|
||||
+ reset-assert-us = <15000>;
|
||||
+ reset-deassert-us = <50000>;
|
||||
+ reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&lan_led {
|
||||
+ label = "orangepi-r1-plus-lts:green:lan";
|
||||
+};
|
||||
+
|
||||
+&rtl8153 {
|
||||
+ realtek,led-data = <0x78>;
|
||||
+};
|
||||
+
|
||||
+&sys_led {
|
||||
+ label = "orangepi-r1-plus-lts:red:sys";
|
||||
+};
|
||||
+
|
||||
+&wan_led {
|
||||
+ label = "orangepi-r1-plus-lts:green:wan";
|
||||
+};
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
--- a/arch/arm64/boot/dts/rockchip/Makefile
|
||||
+++ b/arch/arm64/boot/dts/rockchip/Makefile
|
||||
@@ -9,6 +9,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3318-a9
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3326-odroid-go2.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-a1.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-evb.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2c.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2s.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-orangepi-r1-plus.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-orangepi-r1-plus-lts.dtb
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2c.dts
|
||||
@@ -0,0 +1,60 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2021 FriendlyElec Computer Tech. Co., Ltd.
|
||||
+ * (http://www.friendlyarm.com)
|
||||
+ *
|
||||
+ * Copyright (c) 2021 Tianling Shen <cnsztl@immortalwrt.org>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "rk3328-nanopi-r2s.dts"
|
||||
+
|
||||
+/ {
|
||||
+ model = "FriendlyElec NanoPi R2C";
|
||||
+ compatible = "friendlyarm,nanopi-r2c", "rockchip,rk3328";
|
||||
+};
|
||||
+
|
||||
+&gmac2io {
|
||||
+ phy-handle = <&yt8521s>;
|
||||
+ tx_delay = <0x22>;
|
||||
+ rx_delay = <0x12>;
|
||||
+
|
||||
+ mdio {
|
||||
+ /delete-node/ ethernet-phy@1;
|
||||
+
|
||||
+ yt8521s: ethernet-phy@3 {
|
||||
+ compatible = "ethernet-phy-id0000.011a",
|
||||
+ "ethernet-phy-ieee802.3-c22";
|
||||
+ reg = <3>;
|
||||
+
|
||||
+ motorcomm,clk-out-frequency-hz = <125000000>;
|
||||
+ motorcomm,keep-pll-enabled;
|
||||
+ motorcomm,auto-sleep-disabled;
|
||||
+
|
||||
+ interrupt-parent = <&gpio2>;
|
||||
+ interrupts = <RK_PC4 IRQ_TYPE_EDGE_FALLING>;
|
||||
+ pinctrl-0 = <ð_phy_reset_pin>;
|
||||
+ pinctrl-names = "default";
|
||||
+ reset-assert-us = <10000>;
|
||||
+ reset-deassert-us = <50000>;
|
||||
+ reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&lan_led {
|
||||
+ label = "nanopi-r2c:green:lan";
|
||||
+};
|
||||
+
|
||||
+&rtl8153 {
|
||||
+ realtek,led-data = <0x78>;
|
||||
+};
|
||||
+
|
||||
+&sys_led {
|
||||
+ label = "nanopi-r2c:red:sys";
|
||||
+};
|
||||
+
|
||||
+&wan_led {
|
||||
+ label = "nanopi-r2c:green:wan";
|
||||
+};
|
||||
|
|
@ -0,0 +1,442 @@
|
|||
From 0f989817a4c1d2c3d196d550ff05cda98bc91324 Mon Sep 17 00:00:00 2001
|
||||
From: Julian Pidancet <julian@pidancet.net>
|
||||
Date: Sun, 23 Jan 2022 16:34:08 +0100
|
||||
Subject: [PATCH v2] rockchip: rk3328: add support for FriendlyARM NanoPi NEO3
|
||||
|
||||
This patch adds support for FriendlyARM NanoPi NEO3
|
||||
|
||||
Soc: RockChip RK3328
|
||||
RAM: 1GB/2GB DDR4
|
||||
LAN: 10/100/1000M Ethernet with unique MAC
|
||||
USB Host: 1x USB3.0 Type A and 2x USB2.0 on 2.54mm pin header
|
||||
MicroSD: x 1 for system boot and storage
|
||||
LED: Power LED x 1, System LED x 1
|
||||
Key: User Button x 1
|
||||
Fan: 2 Pin JST ZH 1.5mm Connector for 5V Fan
|
||||
GPIO: 26 pin-header, include I2C, UART, SPI, I2S, GPIO
|
||||
Power: 5V/1A, via Type-C or GPIO
|
||||
|
||||
Signed-off-by: Julian Pidancet <julian@pidancet.net>
|
||||
---
|
||||
|
||||
This is another shot at previous work submitted by Marty Jones
|
||||
<mj8263788@gmail.com> (https://lore.kernel.org/linux-arm-kernel/20201228152836.02795e09.mj8263788@gmail.com/),
|
||||
which is now a year old.
|
||||
|
||||
v2: Following up on Robin Murphy's comments, the NEO3 DTS is now
|
||||
standalone and no longer includes the nanopi R2S one. The lan_led and
|
||||
wan_len nodes have been removed, and the sys_led node has been renamed
|
||||
to status_led in accordance with the board schematics.
|
||||
|
||||
arch/arm64/boot/dts/rockchip/Makefile | 1 +
|
||||
.../boot/dts/rockchip/rk3328-nanopi-neo3.dts | 396 ++++++++++++++++++
|
||||
2 files changed, 397 insertions(+)
|
||||
create mode 100644 arch/arm64/boot/dts/rockchip/rk3328-nanopi-neo3.dts
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/Makefile
|
||||
+++ b/arch/arm64/boot/dts/rockchip/Makefile
|
||||
@@ -11,6 +11,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-a1
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-evb.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2c.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2s.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-neo3.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-orangepi-r1-plus.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-orangepi-r1-plus-lts.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock64.dtb
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-neo3.dts
|
||||
@@ -0,0 +1,394 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2020 David Bauer <mail@david-bauer.net>
|
||||
+ * Copyright (c) 2022 Julian Pidancet <julian@pidancet.net>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include <dt-bindings/input/input.h>
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include "rk3328.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ model = "FriendlyElec NanoPi NEO3";
|
||||
+ compatible = "friendlyarm,nanopi-neo3", "rockchip,rk3328";
|
||||
+
|
||||
+ aliases {
|
||||
+ led-boot = &status_led;
|
||||
+ led-failsafe = &status_led;
|
||||
+ led-running = &status_led;
|
||||
+ led-upgrade = &status_led;
|
||||
+ };
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = "serial2:1500000n8";
|
||||
+ };
|
||||
+
|
||||
+ gmac_clk: gmac-clock {
|
||||
+ compatible = "fixed-clock";
|
||||
+ clock-frequency = <125000000>;
|
||||
+ clock-output-names = "gmac_clkin";
|
||||
+ #clock-cells = <0>;
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+ pinctrl-0 = <&reset_button_pin>;
|
||||
+ pinctrl-names = "default";
|
||||
+
|
||||
+ reset {
|
||||
+ label = "reset";
|
||||
+ gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ debounce-interval = <50>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+ pinctrl-0 = <&status_led_pin>;
|
||||
+ pinctrl-names = "default";
|
||||
+
|
||||
+ status_led: led-0 {
|
||||
+ gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
|
||||
+ label = "nanopi-neo3:green:status";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc_io_sdio: sdmmcio-regulator {
|
||||
+ compatible = "regulator-gpio";
|
||||
+ enable-active-high;
|
||||
+ gpios = <&gpio1 RK_PD4 GPIO_ACTIVE_HIGH>;
|
||||
+ pinctrl-0 = <&sdio_vcc_pin>;
|
||||
+ pinctrl-names = "default";
|
||||
+ regulator-name = "vcc_io_sdio";
|
||||
+ regulator-always-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-settling-time-us = <5000>;
|
||||
+ regulator-type = "voltage";
|
||||
+ startup-delay-us = <2000>;
|
||||
+ states = <1800000 0x1>,
|
||||
+ <3300000 0x0>;
|
||||
+ vin-supply = <&vcc_io_33>;
|
||||
+ };
|
||||
+
|
||||
+ vcc_sd: sdmmc-regulator {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>;
|
||||
+ pinctrl-0 = <&sdmmc0m1_pin>;
|
||||
+ pinctrl-names = "default";
|
||||
+ regulator-name = "vcc_sd";
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ vin-supply = <&vcc_io_33>;
|
||||
+ };
|
||||
+
|
||||
+ vdd_5v: vdd-5v {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vdd_5v";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ };
|
||||
+
|
||||
+ vcc_rtl8153: vcc-rtl8153-regulator {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&rtl8153_en_drv>;
|
||||
+ regulator-always-on;
|
||||
+ regulator-name = "vcc_rtl8153";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ enable-active-high;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&cpu0 {
|
||||
+ cpu-supply = <&vdd_arm>;
|
||||
+};
|
||||
+
|
||||
+&cpu1 {
|
||||
+ cpu-supply = <&vdd_arm>;
|
||||
+};
|
||||
+
|
||||
+&cpu2 {
|
||||
+ cpu-supply = <&vdd_arm>;
|
||||
+};
|
||||
+
|
||||
+&cpu3 {
|
||||
+ cpu-supply = <&vdd_arm>;
|
||||
+};
|
||||
+
|
||||
+&display_subsystem {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+&gmac2io {
|
||||
+ assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>;
|
||||
+ assigned-clock-parents = <&gmac_clk>, <&gmac_clk>;
|
||||
+ clock_in_out = "input";
|
||||
+ phy-handle = <&rtl8211e>;
|
||||
+ phy-mode = "rgmii";
|
||||
+ phy-supply = <&vcc_io_33>;
|
||||
+ pinctrl-0 = <&rgmiim1_pins>;
|
||||
+ pinctrl-names = "default";
|
||||
+ rx_delay = <0x18>;
|
||||
+ snps,aal;
|
||||
+ tx_delay = <0x24>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ mdio {
|
||||
+ compatible = "snps,dwmac-mdio";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ rtl8211e: ethernet-phy@1 {
|
||||
+ reg = <1>;
|
||||
+ pinctrl-0 = <ð_phy_reset_pin>;
|
||||
+ pinctrl-names = "default";
|
||||
+ reset-assert-us = <10000>;
|
||||
+ reset-deassert-us = <50000>;
|
||||
+ reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&i2c1 {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ rk805: pmic@18 {
|
||||
+ compatible = "rockchip,rk805";
|
||||
+ reg = <0x18>;
|
||||
+ interrupt-parent = <&gpio1>;
|
||||
+ interrupts = <24 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ #clock-cells = <1>;
|
||||
+ clock-output-names = "xin32k", "rk805-clkout2";
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+ pinctrl-0 = <&pmic_int_l>;
|
||||
+ pinctrl-names = "default";
|
||||
+ rockchip,system-power-controller;
|
||||
+ wakeup-source;
|
||||
+
|
||||
+ vcc1-supply = <&vdd_5v>;
|
||||
+ vcc2-supply = <&vdd_5v>;
|
||||
+ vcc3-supply = <&vdd_5v>;
|
||||
+ vcc4-supply = <&vdd_5v>;
|
||||
+ vcc5-supply = <&vcc_io_33>;
|
||||
+ vcc6-supply = <&vdd_5v>;
|
||||
+
|
||||
+ regulators {
|
||||
+ vdd_log: DCDC_REG1 {
|
||||
+ regulator-name = "vdd_log";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <712500>;
|
||||
+ regulator-max-microvolt = <1450000>;
|
||||
+ regulator-ramp-delay = <12500>;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1000000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vdd_arm: DCDC_REG2 {
|
||||
+ regulator-name = "vdd_arm";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <712500>;
|
||||
+ regulator-max-microvolt = <1450000>;
|
||||
+ regulator-ramp-delay = <12500>;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <950000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc_ddr: DCDC_REG3 {
|
||||
+ regulator-name = "vcc_ddr";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc_io_33: DCDC_REG4 {
|
||||
+ regulator-name = "vcc_io_33";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <3300000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc_18: LDO_REG1 {
|
||||
+ regulator-name = "vcc_18";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1800000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vcc18_emmc: LDO_REG2 {
|
||||
+ regulator-name = "vcc18_emmc";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1800000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vdd_10: LDO_REG3 {
|
||||
+ regulator-name = "vdd_10";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <1000000>;
|
||||
+ regulator-max-microvolt = <1000000>;
|
||||
+
|
||||
+ regulator-state-mem {
|
||||
+ regulator-on-in-suspend;
|
||||
+ regulator-suspend-microvolt = <1000000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&io_domains {
|
||||
+ pmuio-supply = <&vcc_io_33>;
|
||||
+ vccio1-supply = <&vcc_io_33>;
|
||||
+ vccio2-supply = <&vcc18_emmc>;
|
||||
+ vccio3-supply = <&vcc_io_sdio>;
|
||||
+ vccio4-supply = <&vcc_18>;
|
||||
+ vccio5-supply = <&vcc_io_33>;
|
||||
+ vccio6-supply = <&vcc_io_33>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ button {
|
||||
+ reset_button_pin: reset-button-pin {
|
||||
+ rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ ethernet-phy {
|
||||
+ eth_phy_reset_pin: eth-phy-reset-pin {
|
||||
+ rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ status_led_pin: status-led-pin {
|
||||
+ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pmic {
|
||||
+ pmic_int_l: pmic-int-l {
|
||||
+ rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ sd {
|
||||
+ sdio_vcc_pin: sdio-vcc-pin {
|
||||
+ rockchip,pins = <1 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ usb {
|
||||
+ rtl8153_en_drv: rtl8153-en-drv {
|
||||
+ rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pwm2 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&sdmmc {
|
||||
+ bus-width = <4>;
|
||||
+ cap-sd-highspeed;
|
||||
+ disable-wp;
|
||||
+ pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>;
|
||||
+ pinctrl-names = "default";
|
||||
+ sd-uhs-sdr12;
|
||||
+ sd-uhs-sdr25;
|
||||
+ sd-uhs-sdr50;
|
||||
+ sd-uhs-sdr104;
|
||||
+ vmmc-supply = <&vcc_sd>;
|
||||
+ vqmmc-supply = <&vcc_io_sdio>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&tsadc {
|
||||
+ rockchip,hw-tshut-mode = <0>;
|
||||
+ rockchip,hw-tshut-polarity = <0>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&u2phy {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&u2phy_host {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&u2phy_otg {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart2 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb20_otg {
|
||||
+ status = "okay";
|
||||
+ dr_mode = "host";
|
||||
+};
|
||||
+
|
||||
+&usb_host0_ehci {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb_host0_ohci {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usbdrd3 {
|
||||
+ dr_mode = "host";
|
||||
+ status = "okay";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ usb-eth@2 {
|
||||
+ compatible = "realtek,rtl8153";
|
||||
+ reg = <2>;
|
||||
+
|
||||
+ realtek,led-data = <0x87>;
|
||||
+ };
|
||||
+};
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
--- a/arch/arm64/boot/dts/rockchip/Makefile
|
||||
+++ b/arch/arm64/boot/dts/rockchip/Makefile
|
||||
@@ -59,3 +59,16 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sa
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire-excavator.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399pro-rock-pi-n10.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-evb1-v10.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-photonicat.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-mrkaio-m68s.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-mrkaio-m68s-plus.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-nanopi-r5c.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-nanopi-r5s.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-radxa-e25.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-opc-h66k.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-opc-h68k.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-opc-h69k.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-rock-3a.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-roc-pc.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-r66s.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-r68s.dtb
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
--- a/arch/arm64/boot/dts/rockchip/Makefile
|
||||
+++ b/arch/arm64/boot/dts/rockchip/Makefile
|
||||
@@ -58,6 +58,10 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-ro
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire-excavator.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399pro-rock-pi-n10.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-king3399.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-mpc1903.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-h3399pc.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-dlfr100.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-evb1-v10.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-photonicat.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-mrkaio-m68s.dtb
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
From e5b5361651940ff5c0c1784dfd0130abec7ab535 Mon Sep 17 00:00:00 2001
|
||||
From: wevsty <ty@wevs.org>
|
||||
Date: Mon, 24 Aug 2020 02:27:11 +0800
|
||||
Subject: [PATCH] char: add support for rockchip hardware random number
|
||||
generator
|
||||
|
||||
This patch provides hardware random number generator support for all rockchip SOC.
|
||||
|
||||
rockchip-rng.c from https://github.com/rockchip-linux/kernel/blob/develop-4.4/drivers/char/hw_random/rockchip-rng.c
|
||||
|
||||
Signed-off-by: wevsty <ty@wevs.org>
|
||||
---
|
||||
|
||||
--- a/drivers/char/hw_random/Kconfig
|
||||
+++ b/drivers/char/hw_random/Kconfig
|
||||
@@ -385,6 +385,19 @@ config HW_RANDOM_STM32
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
+config HW_RANDOM_ROCKCHIP
|
||||
+ tristate "Rockchip Random Number Generator support"
|
||||
+ depends on ARCH_ROCKCHIP
|
||||
+ default HW_RANDOM
|
||||
+ help
|
||||
+ This driver provides kernel-side support for the Random Number
|
||||
+ Generator hardware found on Rockchip cpus.
|
||||
+
|
||||
+ To compile this driver as a module, choose M here: the
|
||||
+ module will be called rockchip-rng.
|
||||
+
|
||||
+ If unsure, say Y.
|
||||
+
|
||||
config HW_RANDOM_PIC32
|
||||
tristate "Microchip PIC32 Random Number Generator support"
|
||||
depends on HW_RANDOM && MACH_PIC32
|
||||
--- a/drivers/char/hw_random/Makefile
|
||||
+++ b/drivers/char/hw_random/Makefile
|
||||
@@ -35,6 +35,7 @@ obj-$(CONFIG_HW_RANDOM_IPROC_RNG200) +=
|
||||
obj-$(CONFIG_HW_RANDOM_ST) += st-rng.o
|
||||
obj-$(CONFIG_HW_RANDOM_XGENE) += xgene-rng.o
|
||||
obj-$(CONFIG_HW_RANDOM_STM32) += stm32-rng.o
|
||||
+obj-$(CONFIG_HW_RANDOM_ROCKCHIP) += rockchip-rng.o
|
||||
obj-$(CONFIG_HW_RANDOM_PIC32) += pic32-rng.o
|
||||
obj-$(CONFIG_HW_RANDOM_MESON) += meson-rng.o
|
||||
obj-$(CONFIG_HW_RANDOM_CAVIUM) += cavium-rng.o cavium-rng-vf.o
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
From e5b5361651940ff5c0c1784dfd0130abec7ab535 Mon Sep 17 00:00:00 2001
|
||||
From: wevsty <ty@wevs.org>
|
||||
Date: Mon, 24 Aug 2020 02:27:11 +0800
|
||||
Subject: [PATCH] arm64: dts: rockchip: add hardware random number generator
|
||||
for RK3328 and RK3399
|
||||
|
||||
Adding Hardware Random Number Generator Resources to the RK3328 and RK3399.
|
||||
|
||||
Signed-off-by: wevsty <ty@wevs.org>
|
||||
---
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
@@ -279,6 +279,17 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ rng: rng@ff060000 {
|
||||
+ compatible = "rockchip,cryptov1-rng";
|
||||
+ reg = <0x0 0xff060000 0x0 0x4000>;
|
||||
+
|
||||
+ clocks = <&cru SCLK_CRYPTO>, <&cru HCLK_CRYPTO_SLV>;
|
||||
+ clock-names = "clk_crypto", "hclk_crypto";
|
||||
+ assigned-clocks = <&cru SCLK_CRYPTO>, <&cru HCLK_CRYPTO_SLV>;
|
||||
+ assigned-clock-rates = <150000000>, <100000000>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
grf: syscon@ff100000 {
|
||||
compatible = "rockchip,rk3328-grf", "syscon", "simple-mfd";
|
||||
reg = <0x0 0xff100000 0x0 0x1000>;
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
@@ -1937,6 +1937,16 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ rng: rng@ff8b8000 {
|
||||
+ compatible = "rockchip,cryptov1-rng";
|
||||
+ reg = <0x0 0xff8b8000 0x0 0x1000>;
|
||||
+ clocks = <&cru SCLK_CRYPTO1>, <&cru HCLK_S_CRYPTO1>;
|
||||
+ clock-names = "clk_crypto", "hclk_crypto";
|
||||
+ assigned-clocks = <&cru SCLK_CRYPTO1>, <&cru HCLK_S_CRYPTO1>;
|
||||
+ assigned-clock-rates = <150000000>, <100000000>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
gpu: gpu@ff9a0000 {
|
||||
compatible = "rockchip,rk3399-mali", "arm,mali-t860";
|
||||
reg = <0x0 0xff9a0000 0x0 0x10000>;
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||||
@@ -213,6 +213,16 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ rng: rng@fe388000 {
|
||||
+ compatible = "rockchip,cryptov2-rng";
|
||||
+ reg = <0x0 0xfe388000 0x0 0x2000>;
|
||||
+ clocks = <&cru CLK_TRNG_NS>, <&cru HCLK_TRNG_NS>;
|
||||
+ clock-names = "clk_trng", "hclk_trng";
|
||||
+ resets = <&cru SRST_TRNG_NS>;
|
||||
+ reset-names = "reset";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
combphy0: phy@fe820000 {
|
||||
compatible = "rockchip,rk3568-naneng-combphy";
|
||||
reg = <0x0 0xfe820000 0x0 0x100>;
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
From fcd9629c05f373771e85920e1c1d0ab252617878 Mon Sep 17 00:00:00 2001
|
||||
From: hmz007 <hmz007@gmail.com>
|
||||
Date: Tue, 19 Nov 2019 13:53:25 +0800
|
||||
Subject: [PATCH] PM / devfreq: rockchip: add devfreq driver for rk3328 dmc
|
||||
|
||||
Signed-off-by: hmz007 <hmz007@gmail.com>
|
||||
---
|
||||
drivers/devfreq/Kconfig | 18 +-
|
||||
drivers/devfreq/Makefile | 1 +
|
||||
drivers/devfreq/rk3328_dmc.c | 846 +++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 862 insertions(+), 3 deletions(-)
|
||||
create mode 100644 drivers/devfreq/rk3328_dmc.c
|
||||
|
||||
--- a/drivers/devfreq/Kconfig
|
||||
+++ b/drivers/devfreq/Kconfig
|
||||
@@ -120,6 +120,18 @@ config ARM_TEGRA_DEVFREQ
|
||||
It reads ACTMON counters of memory controllers and adjusts the
|
||||
operating frequencies and voltages with OPP support.
|
||||
|
||||
+config ARM_RK3328_DMC_DEVFREQ
|
||||
+ tristate "ARM RK3328 DMC DEVFREQ Driver"
|
||||
+ depends on ARCH_ROCKCHIP
|
||||
+ select DEVFREQ_EVENT_ROCKCHIP_DFI
|
||||
+ select DEVFREQ_GOV_SIMPLE_ONDEMAND
|
||||
+ select PM_DEVFREQ_EVENT
|
||||
+ select PM_OPP
|
||||
+ help
|
||||
+ This adds the DEVFREQ driver for the RK3328 DMC(Dynamic Memory Controller).
|
||||
+ It sets the frequency for the memory controller and reads the usage counts
|
||||
+ from hardware.
|
||||
+
|
||||
config ARM_RK3399_DMC_DEVFREQ
|
||||
tristate "ARM RK3399 DMC DEVFREQ Driver"
|
||||
depends on (ARCH_ROCKCHIP && HAVE_ARM_SMCCC) || \
|
||||
--- a/drivers/devfreq/Makefile
|
||||
+++ b/drivers/devfreq/Makefile
|
||||
@@ -11,6 +11,7 @@ obj-$(CONFIG_DEVFREQ_GOV_PASSIVE) += gov
|
||||
obj-$(CONFIG_ARM_EXYNOS_BUS_DEVFREQ) += exynos-bus.o
|
||||
obj-$(CONFIG_ARM_IMX_BUS_DEVFREQ) += imx-bus.o
|
||||
obj-$(CONFIG_ARM_IMX8M_DDRC_DEVFREQ) += imx8m-ddrc.o
|
||||
+obj-$(CONFIG_ARM_RK3328_DMC_DEVFREQ) += rk3328_dmc.o
|
||||
obj-$(CONFIG_ARM_RK3399_DMC_DEVFREQ) += rk3399_dmc.o
|
||||
obj-$(CONFIG_ARM_TEGRA_DEVFREQ) += tegra30-devfreq.o
|
||||
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
From ce6d3614888e6358466f0e84e248177a6bca5258 Mon Sep 17 00:00:00 2001
|
||||
From: Tang Yun ping <typ@rock-chips.com>
|
||||
Date: Thu, 4 May 2017 20:49:58 +0800
|
||||
Subject: [PATCH] clk: rockchip: support setting ddr clock via SIP Version 2
|
||||
APIs
|
||||
|
||||
commit 764e893ee82321938fc6f4349e9e7caf06a04410 rockchip.
|
||||
|
||||
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
|
||||
Signed-off-by: hmz007 <hmz007@gmail.com>
|
||||
---
|
||||
drivers/clk/rockchip/clk-ddr.c | 130 ++++++++++++++++++++++++++++
|
||||
drivers/clk/rockchip/clk-rk3328.c | 7 +-
|
||||
drivers/clk/rockchip/clk.h | 3 +-
|
||||
include/soc/rockchip/rockchip_sip.h | 11 +++
|
||||
4 files changed, 147 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/clk/rockchip/clk-ddr.c
|
||||
+++ b/drivers/clk/rockchip/clk-ddr.c
|
||||
@@ -87,6 +87,133 @@ static const struct clk_ops rockchip_ddr
|
||||
.get_parent = rockchip_ddrclk_get_parent,
|
||||
};
|
||||
|
||||
+/* See v4.4/include/dt-bindings/display/rk_fb.h */
|
||||
+#define SCREEN_NULL 0
|
||||
+#define SCREEN_HDMI 6
|
||||
+
|
||||
+static inline int rk_drm_get_lcdc_type(void)
|
||||
+{
|
||||
+ return SCREEN_NULL;
|
||||
+}
|
||||
+
|
||||
+struct share_params {
|
||||
+ u32 hz;
|
||||
+ u32 lcdc_type;
|
||||
+ u32 vop;
|
||||
+ u32 vop_dclk_mode;
|
||||
+ u32 sr_idle_en;
|
||||
+ u32 addr_mcu_el3;
|
||||
+ /*
|
||||
+ * 1: need to wait flag1
|
||||
+ * 0: never wait flag1
|
||||
+ */
|
||||
+ u32 wait_flag1;
|
||||
+ /*
|
||||
+ * 1: need to wait flag1
|
||||
+ * 0: never wait flag1
|
||||
+ */
|
||||
+ u32 wait_flag0;
|
||||
+ u32 complt_hwirq;
|
||||
+ /* if need, add parameter after */
|
||||
+};
|
||||
+
|
||||
+struct rockchip_ddrclk_data {
|
||||
+ u32 inited_flag;
|
||||
+ void __iomem *share_memory;
|
||||
+};
|
||||
+
|
||||
+static struct rockchip_ddrclk_data ddr_data;
|
||||
+
|
||||
+static void rockchip_ddrclk_data_init(void)
|
||||
+{
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ arm_smccc_smc(ROCKCHIP_SIP_SHARE_MEM,
|
||||
+ 1, SHARE_PAGE_TYPE_DDR, 0,
|
||||
+ 0, 0, 0, 0, &res);
|
||||
+
|
||||
+ if (!res.a0) {
|
||||
+ ddr_data.share_memory = (void __iomem *)ioremap(res.a1, 1<<12);
|
||||
+ ddr_data.inited_flag = 1;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int rockchip_ddrclk_sip_set_rate_v2(struct clk_hw *hw,
|
||||
+ unsigned long drate,
|
||||
+ unsigned long prate)
|
||||
+{
|
||||
+ struct share_params *p;
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ if (!ddr_data.inited_flag)
|
||||
+ rockchip_ddrclk_data_init();
|
||||
+
|
||||
+ p = (struct share_params *)ddr_data.share_memory;
|
||||
+
|
||||
+ p->hz = drate;
|
||||
+ p->lcdc_type = rk_drm_get_lcdc_type();
|
||||
+ p->wait_flag1 = 1;
|
||||
+ p->wait_flag0 = 1;
|
||||
+
|
||||
+ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ,
|
||||
+ SHARE_PAGE_TYPE_DDR, 0,
|
||||
+ ROCKCHIP_SIP_CONFIG_DRAM_SET_RATE,
|
||||
+ 0, 0, 0, 0, &res);
|
||||
+
|
||||
+ if ((int)res.a1 == -6) {
|
||||
+ pr_err("%s: timeout, drate = %lumhz\n", __func__, drate/1000000);
|
||||
+ /* TODO: rockchip_dmcfreq_wait_complete(); */
|
||||
+ }
|
||||
+
|
||||
+ return res.a0;
|
||||
+}
|
||||
+
|
||||
+static unsigned long rockchip_ddrclk_sip_recalc_rate_v2
|
||||
+ (struct clk_hw *hw, unsigned long parent_rate)
|
||||
+{
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ,
|
||||
+ SHARE_PAGE_TYPE_DDR, 0,
|
||||
+ ROCKCHIP_SIP_CONFIG_DRAM_GET_RATE,
|
||||
+ 0, 0, 0, 0, &res);
|
||||
+ if (!res.a0)
|
||||
+ return res.a1;
|
||||
+ else
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static long rockchip_ddrclk_sip_round_rate_v2(struct clk_hw *hw,
|
||||
+ unsigned long rate,
|
||||
+ unsigned long *prate)
|
||||
+{
|
||||
+ struct share_params *p;
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ if (!ddr_data.inited_flag)
|
||||
+ rockchip_ddrclk_data_init();
|
||||
+
|
||||
+ p = (struct share_params *)ddr_data.share_memory;
|
||||
+
|
||||
+ p->hz = rate;
|
||||
+
|
||||
+ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ,
|
||||
+ SHARE_PAGE_TYPE_DDR, 0,
|
||||
+ ROCKCHIP_SIP_CONFIG_DRAM_ROUND_RATE,
|
||||
+ 0, 0, 0, 0, &res);
|
||||
+ if (!res.a0)
|
||||
+ return res.a1;
|
||||
+ else
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct clk_ops rockchip_ddrclk_sip_ops_v2 = {
|
||||
+ .recalc_rate = rockchip_ddrclk_sip_recalc_rate_v2,
|
||||
+ .set_rate = rockchip_ddrclk_sip_set_rate_v2,
|
||||
+ .round_rate = rockchip_ddrclk_sip_round_rate_v2,
|
||||
+ .get_parent = rockchip_ddrclk_get_parent,
|
||||
+};
|
||||
+
|
||||
struct clk *rockchip_clk_register_ddrclk(const char *name, int flags,
|
||||
const char *const *parent_names,
|
||||
u8 num_parents, int mux_offset,
|
||||
@@ -114,6 +241,9 @@ struct clk *rockchip_clk_register_ddrclk
|
||||
case ROCKCHIP_DDRCLK_SIP:
|
||||
init.ops = &rockchip_ddrclk_sip_ops;
|
||||
break;
|
||||
+ case ROCKCHIP_DDRCLK_SIP_V2:
|
||||
+ init.ops = &rockchip_ddrclk_sip_ops_v2;
|
||||
+ break;
|
||||
default:
|
||||
pr_err("%s: unsupported ddrclk type %d\n", __func__, ddr_flag);
|
||||
kfree(ddrclk);
|
||||
--- a/drivers/clk/rockchip/clk-rk3328.c
|
||||
+++ b/drivers/clk/rockchip/clk-rk3328.c
|
||||
@@ -315,9 +315,10 @@ static struct rockchip_clk_branch rk3328
|
||||
RK3328_CLKGATE_CON(14), 1, GFLAGS),
|
||||
|
||||
/* PD_DDR */
|
||||
- COMPOSITE(0, "clk_ddr", mux_ddrphy_p, CLK_IGNORE_UNUSED,
|
||||
- RK3328_CLKSEL_CON(3), 8, 2, MFLAGS, 0, 3, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
|
||||
- RK3328_CLKGATE_CON(0), 4, GFLAGS),
|
||||
+ COMPOSITE_DDRCLK(SCLK_DDRCLK, "sclk_ddrc", mux_ddrphy_p, 0,
|
||||
+ RK3328_CLKSEL_CON(3), 8, 2, 0, 3,
|
||||
+ ROCKCHIP_DDRCLK_SIP_V2),
|
||||
+
|
||||
GATE(0, "clk_ddrmsch", "clk_ddr", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(18), 6, GFLAGS),
|
||||
GATE(0, "clk_ddrupctl", "clk_ddr", CLK_IGNORE_UNUSED,
|
||||
--- a/drivers/clk/rockchip/clk.h
|
||||
+++ b/drivers/clk/rockchip/clk.h
|
||||
@@ -399,7 +399,8 @@ struct clk *rockchip_clk_register_mmc(co
|
||||
* DDRCLK flags, including method of setting the rate
|
||||
* ROCKCHIP_DDRCLK_SIP: use SIP call to bl31 to change ddrclk rate.
|
||||
*/
|
||||
-#define ROCKCHIP_DDRCLK_SIP BIT(0)
|
||||
+#define ROCKCHIP_DDRCLK_SIP 0x01
|
||||
+#define ROCKCHIP_DDRCLK_SIP_V2 0x03
|
||||
|
||||
struct clk *rockchip_clk_register_ddrclk(const char *name, int flags,
|
||||
const char *const *parent_names,
|
||||
--- a/include/soc/rockchip/rockchip_sip.h
|
||||
+++ b/include/soc/rockchip/rockchip_sip.h
|
||||
@@ -16,5 +16,16 @@
|
||||
#define ROCKCHIP_SIP_CONFIG_DRAM_CLR_IRQ 0x06
|
||||
#define ROCKCHIP_SIP_CONFIG_DRAM_SET_PARAM 0x07
|
||||
#define ROCKCHIP_SIP_CONFIG_DRAM_SET_ODT_PD 0x08
|
||||
+#define ROCKCHIP_SIP_CONFIG_DRAM_GET_VERSION 0x08
|
||||
+
|
||||
+#define ROCKCHIP_SIP_SHARE_MEM 0x82000009
|
||||
+
|
||||
+/* Share mem page types */
|
||||
+typedef enum {
|
||||
+ SHARE_PAGE_TYPE_INVALID = 0,
|
||||
+ SHARE_PAGE_TYPE_UARTDBG,
|
||||
+ SHARE_PAGE_TYPE_DDR,
|
||||
+ SHARE_PAGE_TYPE_MAX,
|
||||
+} share_page_type_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,662 @@
|
|||
From 4db93c6dad0c71750b86163df2fdb21c35f00d9a Mon Sep 17 00:00:00 2001
|
||||
From: hmz007 <hmz007@gmail.com>
|
||||
Date: Tue, 19 Nov 2019 12:49:48 +0800
|
||||
Subject: [PATCH] PM / devfreq: rockchip-dfi: add more soc support
|
||||
|
||||
Signed-off-by: hmz007 <hmz007@gmail.com>
|
||||
---
|
||||
drivers/devfreq/event/rockchip-dfi.c | 554 ++++++++++++++++++++++++---
|
||||
1 file changed, 505 insertions(+), 49 deletions(-)
|
||||
|
||||
--- a/drivers/devfreq/event/rockchip-dfi.c
|
||||
+++ b/drivers/devfreq/event/rockchip-dfi.c
|
||||
@@ -18,25 +18,66 @@
|
||||
#include <linux/list.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
-#include <soc/rockchip/rk3399_grf.h>
|
||||
-
|
||||
-#define RK3399_DMC_NUM_CH 2
|
||||
+#define PX30_PMUGRF_OS_REG2 0x208
|
||||
|
||||
+#define RK3128_GRF_SOC_CON0 0x140
|
||||
+#define RK3128_GRF_OS_REG1 0x1cc
|
||||
+#define RK3128_GRF_DFI_WRNUM 0x220
|
||||
+#define RK3128_GRF_DFI_RDNUM 0x224
|
||||
+#define RK3128_GRF_DFI_TIMERVAL 0x22c
|
||||
+#define RK3128_DDR_MONITOR_EN ((1 << (16 + 6)) + (1 << 6))
|
||||
+#define RK3128_DDR_MONITOR_DISB ((1 << (16 + 6)) + (0 << 6))
|
||||
+
|
||||
+#define RK3288_PMU_SYS_REG2 0x9c
|
||||
+#define RK3288_GRF_SOC_CON4 0x254
|
||||
+#define RK3288_GRF_SOC_STATUS(n) (0x280 + (n) * 4)
|
||||
+#define RK3288_DFI_EN (0x30003 << 14)
|
||||
+#define RK3288_DFI_DIS (0x30000 << 14)
|
||||
+#define RK3288_LPDDR_SEL (0x10001 << 13)
|
||||
+#define RK3288_DDR3_SEL (0x10000 << 13)
|
||||
+
|
||||
+#define RK3328_GRF_OS_REG2 0x5d0
|
||||
+
|
||||
+#define RK3368_GRF_DDRC0_CON0 0x600
|
||||
+#define RK3368_GRF_SOC_STATUS5 0x494
|
||||
+#define RK3368_GRF_SOC_STATUS6 0x498
|
||||
+#define RK3368_GRF_SOC_STATUS8 0x4a0
|
||||
+#define RK3368_GRF_SOC_STATUS9 0x4a4
|
||||
+#define RK3368_GRF_SOC_STATUS10 0x4a8
|
||||
+#define RK3368_DFI_EN (0x30003 << 5)
|
||||
+#define RK3368_DFI_DIS (0x30000 << 5)
|
||||
+
|
||||
+#define MAX_DMC_NUM_CH 2
|
||||
+#define READ_DRAMTYPE_INFO(n) (((n) >> 13) & 0x7)
|
||||
+#define READ_CH_INFO(n) (((n) >> 28) & 0x3)
|
||||
/* DDRMON_CTRL */
|
||||
-#define DDRMON_CTRL 0x04
|
||||
-#define CLR_DDRMON_CTRL (0x1f0000 << 0)
|
||||
-#define LPDDR4_EN (0x10001 << 4)
|
||||
-#define HARDWARE_EN (0x10001 << 3)
|
||||
-#define LPDDR3_EN (0x10001 << 2)
|
||||
-#define SOFTWARE_EN (0x10001 << 1)
|
||||
-#define SOFTWARE_DIS (0x10000 << 1)
|
||||
-#define TIME_CNT_EN (0x10001 << 0)
|
||||
+#define DDRMON_CTRL 0x04
|
||||
+#define CLR_DDRMON_CTRL (0x3f0000 << 0)
|
||||
+#define DDR4_EN (0x10001 << 5)
|
||||
+#define LPDDR4_EN (0x10001 << 4)
|
||||
+#define HARDWARE_EN (0x10001 << 3)
|
||||
+#define LPDDR2_3_EN (0x10001 << 2)
|
||||
+#define SOFTWARE_EN (0x10001 << 1)
|
||||
+#define SOFTWARE_DIS (0x10000 << 1)
|
||||
+#define TIME_CNT_EN (0x10001 << 0)
|
||||
|
||||
#define DDRMON_CH0_COUNT_NUM 0x28
|
||||
#define DDRMON_CH0_DFI_ACCESS_NUM 0x2c
|
||||
#define DDRMON_CH1_COUNT_NUM 0x3c
|
||||
#define DDRMON_CH1_DFI_ACCESS_NUM 0x40
|
||||
|
||||
+/* pmu grf */
|
||||
+#define PMUGRF_OS_REG2 0x308
|
||||
+
|
||||
+enum {
|
||||
+ DDR4 = 0,
|
||||
+ DDR3 = 3,
|
||||
+ LPDDR2 = 5,
|
||||
+ LPDDR3 = 6,
|
||||
+ LPDDR4 = 7,
|
||||
+ UNUSED = 0xFF
|
||||
+};
|
||||
+
|
||||
struct dmc_usage {
|
||||
u32 access;
|
||||
u32 total;
|
||||
@@ -50,33 +91,261 @@ struct dmc_usage {
|
||||
struct rockchip_dfi {
|
||||
struct devfreq_event_dev *edev;
|
||||
struct devfreq_event_desc *desc;
|
||||
- struct dmc_usage ch_usage[RK3399_DMC_NUM_CH];
|
||||
+ struct dmc_usage ch_usage[MAX_DMC_NUM_CH];
|
||||
struct device *dev;
|
||||
void __iomem *regs;
|
||||
struct regmap *regmap_pmu;
|
||||
+ struct regmap *regmap_grf;
|
||||
+ struct regmap *regmap_pmugrf;
|
||||
struct clk *clk;
|
||||
+ u32 dram_type;
|
||||
+ /*
|
||||
+ * available mask, 1: available, 0: not available
|
||||
+ * each bit represent a channel
|
||||
+ */
|
||||
+ u32 ch_msk;
|
||||
+};
|
||||
+
|
||||
+static void rk3128_dfi_start_hardware_counter(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+
|
||||
+ regmap_write(info->regmap_grf,
|
||||
+ RK3128_GRF_SOC_CON0,
|
||||
+ RK3128_DDR_MONITOR_EN);
|
||||
+}
|
||||
+
|
||||
+static void rk3128_dfi_stop_hardware_counter(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+
|
||||
+ regmap_write(info->regmap_grf,
|
||||
+ RK3128_GRF_SOC_CON0,
|
||||
+ RK3128_DDR_MONITOR_DISB);
|
||||
+}
|
||||
+
|
||||
+static int rk3128_dfi_disable(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ rk3128_dfi_stop_hardware_counter(edev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3128_dfi_enable(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ rk3128_dfi_start_hardware_counter(edev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3128_dfi_set_event(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3128_dfi_get_event(struct devfreq_event_dev *edev,
|
||||
+ struct devfreq_event_data *edata)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+ unsigned long flags;
|
||||
+ u32 dfi_wr, dfi_rd, dfi_timer;
|
||||
+
|
||||
+ local_irq_save(flags);
|
||||
+
|
||||
+ rk3128_dfi_stop_hardware_counter(edev);
|
||||
+
|
||||
+ regmap_read(info->regmap_grf, RK3128_GRF_DFI_WRNUM, &dfi_wr);
|
||||
+ regmap_read(info->regmap_grf, RK3128_GRF_DFI_RDNUM, &dfi_rd);
|
||||
+ regmap_read(info->regmap_grf, RK3128_GRF_DFI_TIMERVAL, &dfi_timer);
|
||||
+
|
||||
+ edata->load_count = (dfi_wr + dfi_rd) * 4;
|
||||
+ edata->total_count = dfi_timer;
|
||||
+
|
||||
+ rk3128_dfi_start_hardware_counter(edev);
|
||||
+
|
||||
+ local_irq_restore(flags);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct devfreq_event_ops rk3128_dfi_ops = {
|
||||
+ .disable = rk3128_dfi_disable,
|
||||
+ .enable = rk3128_dfi_enable,
|
||||
+ .get_event = rk3128_dfi_get_event,
|
||||
+ .set_event = rk3128_dfi_set_event,
|
||||
+};
|
||||
+
|
||||
+static void rk3288_dfi_start_hardware_counter(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+
|
||||
+ regmap_write(info->regmap_grf, RK3288_GRF_SOC_CON4, RK3288_DFI_EN);
|
||||
+}
|
||||
+
|
||||
+static void rk3288_dfi_stop_hardware_counter(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+
|
||||
+ regmap_write(info->regmap_grf, RK3288_GRF_SOC_CON4, RK3288_DFI_DIS);
|
||||
+}
|
||||
+
|
||||
+static int rk3288_dfi_disable(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ rk3288_dfi_stop_hardware_counter(edev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3288_dfi_enable(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ rk3288_dfi_start_hardware_counter(edev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3288_dfi_set_event(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3288_dfi_get_busier_ch(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+ u32 tmp, max = 0;
|
||||
+ u32 i, busier_ch = 0;
|
||||
+ u32 rd_count, wr_count, total_count;
|
||||
+
|
||||
+ rk3288_dfi_stop_hardware_counter(edev);
|
||||
+
|
||||
+ /* Find out which channel is busier */
|
||||
+ for (i = 0; i < MAX_DMC_NUM_CH; i++) {
|
||||
+ if (!(info->ch_msk & BIT(i)))
|
||||
+ continue;
|
||||
+ regmap_read(info->regmap_grf,
|
||||
+ RK3288_GRF_SOC_STATUS(11 + i * 4), &wr_count);
|
||||
+ regmap_read(info->regmap_grf,
|
||||
+ RK3288_GRF_SOC_STATUS(12 + i * 4), &rd_count);
|
||||
+ regmap_read(info->regmap_grf,
|
||||
+ RK3288_GRF_SOC_STATUS(14 + i * 4), &total_count);
|
||||
+ info->ch_usage[i].access = (wr_count + rd_count) * 4;
|
||||
+ info->ch_usage[i].total = total_count;
|
||||
+ tmp = info->ch_usage[i].access;
|
||||
+ if (tmp > max) {
|
||||
+ busier_ch = i;
|
||||
+ max = tmp;
|
||||
+ }
|
||||
+ }
|
||||
+ rk3288_dfi_start_hardware_counter(edev);
|
||||
+
|
||||
+ return busier_ch;
|
||||
+}
|
||||
+
|
||||
+static int rk3288_dfi_get_event(struct devfreq_event_dev *edev,
|
||||
+ struct devfreq_event_data *edata)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+ int busier_ch;
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ local_irq_save(flags);
|
||||
+ busier_ch = rk3288_dfi_get_busier_ch(edev);
|
||||
+ local_irq_restore(flags);
|
||||
+
|
||||
+ edata->load_count = info->ch_usage[busier_ch].access;
|
||||
+ edata->total_count = info->ch_usage[busier_ch].total;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct devfreq_event_ops rk3288_dfi_ops = {
|
||||
+ .disable = rk3288_dfi_disable,
|
||||
+ .enable = rk3288_dfi_enable,
|
||||
+ .get_event = rk3288_dfi_get_event,
|
||||
+ .set_event = rk3288_dfi_set_event,
|
||||
+};
|
||||
+
|
||||
+static void rk3368_dfi_start_hardware_counter(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+
|
||||
+ regmap_write(info->regmap_grf, RK3368_GRF_DDRC0_CON0, RK3368_DFI_EN);
|
||||
+}
|
||||
+
|
||||
+static void rk3368_dfi_stop_hardware_counter(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+
|
||||
+ regmap_write(info->regmap_grf, RK3368_GRF_DDRC0_CON0, RK3368_DFI_DIS);
|
||||
+}
|
||||
+
|
||||
+static int rk3368_dfi_disable(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ rk3368_dfi_stop_hardware_counter(edev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3368_dfi_enable(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ rk3368_dfi_start_hardware_counter(edev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3368_dfi_set_event(struct devfreq_event_dev *edev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rk3368_dfi_get_event(struct devfreq_event_dev *edev,
|
||||
+ struct devfreq_event_data *edata)
|
||||
+{
|
||||
+ struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
+ unsigned long flags;
|
||||
+ u32 dfi0_wr, dfi0_rd, dfi1_wr, dfi1_rd, dfi_timer;
|
||||
+
|
||||
+ local_irq_save(flags);
|
||||
+
|
||||
+ rk3368_dfi_stop_hardware_counter(edev);
|
||||
+
|
||||
+ regmap_read(info->regmap_grf, RK3368_GRF_SOC_STATUS5, &dfi0_wr);
|
||||
+ regmap_read(info->regmap_grf, RK3368_GRF_SOC_STATUS6, &dfi0_rd);
|
||||
+ regmap_read(info->regmap_grf, RK3368_GRF_SOC_STATUS9, &dfi1_wr);
|
||||
+ regmap_read(info->regmap_grf, RK3368_GRF_SOC_STATUS10, &dfi1_rd);
|
||||
+ regmap_read(info->regmap_grf, RK3368_GRF_SOC_STATUS8, &dfi_timer);
|
||||
+
|
||||
+ edata->load_count = (dfi0_wr + dfi0_rd + dfi1_wr + dfi1_rd) * 2;
|
||||
+ edata->total_count = dfi_timer;
|
||||
+
|
||||
+ rk3368_dfi_start_hardware_counter(edev);
|
||||
+
|
||||
+ local_irq_restore(flags);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct devfreq_event_ops rk3368_dfi_ops = {
|
||||
+ .disable = rk3368_dfi_disable,
|
||||
+ .enable = rk3368_dfi_enable,
|
||||
+ .get_event = rk3368_dfi_get_event,
|
||||
+ .set_event = rk3368_dfi_set_event,
|
||||
};
|
||||
|
||||
static void rockchip_dfi_start_hardware_counter(struct devfreq_event_dev *edev)
|
||||
{
|
||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
void __iomem *dfi_regs = info->regs;
|
||||
- u32 val;
|
||||
- u32 ddr_type;
|
||||
-
|
||||
- /* get ddr type */
|
||||
- regmap_read(info->regmap_pmu, RK3399_PMUGRF_OS_REG2, &val);
|
||||
- ddr_type = (val >> RK3399_PMUGRF_DDRTYPE_SHIFT) &
|
||||
- RK3399_PMUGRF_DDRTYPE_MASK;
|
||||
|
||||
/* clear DDRMON_CTRL setting */
|
||||
writel_relaxed(CLR_DDRMON_CTRL, dfi_regs + DDRMON_CTRL);
|
||||
|
||||
/* set ddr type to dfi */
|
||||
- if (ddr_type == RK3399_PMUGRF_DDRTYPE_LPDDR3)
|
||||
- writel_relaxed(LPDDR3_EN, dfi_regs + DDRMON_CTRL);
|
||||
- else if (ddr_type == RK3399_PMUGRF_DDRTYPE_LPDDR4)
|
||||
+ if (info->dram_type == LPDDR3 || info->dram_type == LPDDR2)
|
||||
+ writel_relaxed(LPDDR2_3_EN, dfi_regs + DDRMON_CTRL);
|
||||
+ else if (info->dram_type == LPDDR4)
|
||||
writel_relaxed(LPDDR4_EN, dfi_regs + DDRMON_CTRL);
|
||||
+ else if (info->dram_type == DDR4)
|
||||
+ writel_relaxed(DDR4_EN, dfi_regs + DDRMON_CTRL);
|
||||
|
||||
/* enable count, use software mode */
|
||||
writel_relaxed(SOFTWARE_EN, dfi_regs + DDRMON_CTRL);
|
||||
@@ -100,12 +369,22 @@ static int rockchip_dfi_get_busier_ch(st
|
||||
rockchip_dfi_stop_hardware_counter(edev);
|
||||
|
||||
/* Find out which channel is busier */
|
||||
- for (i = 0; i < RK3399_DMC_NUM_CH; i++) {
|
||||
- info->ch_usage[i].access = readl_relaxed(dfi_regs +
|
||||
- DDRMON_CH0_DFI_ACCESS_NUM + i * 20) * 4;
|
||||
+ for (i = 0; i < MAX_DMC_NUM_CH; i++) {
|
||||
+ if (!(info->ch_msk & BIT(i)))
|
||||
+ continue;
|
||||
+
|
||||
info->ch_usage[i].total = readl_relaxed(dfi_regs +
|
||||
DDRMON_CH0_COUNT_NUM + i * 20);
|
||||
- tmp = info->ch_usage[i].access;
|
||||
+
|
||||
+ /* LPDDR4 BL = 16,other DDR type BL = 8 */
|
||||
+ tmp = readl_relaxed(dfi_regs +
|
||||
+ DDRMON_CH0_DFI_ACCESS_NUM + i * 20);
|
||||
+ if (info->dram_type == LPDDR4)
|
||||
+ tmp *= 8;
|
||||
+ else
|
||||
+ tmp *= 4;
|
||||
+ info->ch_usage[i].access = tmp;
|
||||
+
|
||||
if (tmp > max) {
|
||||
busier_ch = i;
|
||||
max = tmp;
|
||||
@@ -121,7 +400,8 @@ static int rockchip_dfi_disable(struct d
|
||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
|
||||
rockchip_dfi_stop_hardware_counter(edev);
|
||||
- clk_disable_unprepare(info->clk);
|
||||
+ if (info->clk)
|
||||
+ clk_disable_unprepare(info->clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -131,10 +411,13 @@ static int rockchip_dfi_enable(struct de
|
||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
int ret;
|
||||
|
||||
- ret = clk_prepare_enable(info->clk);
|
||||
- if (ret) {
|
||||
- dev_err(&edev->dev, "failed to enable dfi clk: %d\n", ret);
|
||||
- return ret;
|
||||
+ if (info->clk) {
|
||||
+ ret = clk_prepare_enable(info->clk);
|
||||
+ if (ret) {
|
||||
+ dev_err(&edev->dev, "failed to enable dfi clk: %d\n",
|
||||
+ ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
||||
|
||||
rockchip_dfi_start_hardware_counter(edev);
|
||||
@@ -151,8 +434,11 @@ static int rockchip_dfi_get_event(struct
|
||||
{
|
||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
||||
int busier_ch;
|
||||
+ unsigned long flags;
|
||||
|
||||
+ local_irq_save(flags);
|
||||
busier_ch = rockchip_dfi_get_busier_ch(edev);
|
||||
+ local_irq_restore(flags);
|
||||
|
||||
edata->load_count = info->ch_usage[busier_ch].access;
|
||||
edata->total_count = info->ch_usage[busier_ch].total;
|
||||
@@ -167,22 +453,116 @@ static const struct devfreq_event_ops ro
|
||||
.set_event = rockchip_dfi_set_event,
|
||||
};
|
||||
|
||||
-static const struct of_device_id rockchip_dfi_id_match[] = {
|
||||
- { .compatible = "rockchip,rk3399-dfi" },
|
||||
- { },
|
||||
-};
|
||||
-MODULE_DEVICE_TABLE(of, rockchip_dfi_id_match);
|
||||
+static __init int px30_dfi_init(struct platform_device *pdev,
|
||||
+ struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc)
|
||||
+{
|
||||
+ struct device_node *np = pdev->dev.of_node, *node;
|
||||
+ struct resource *res;
|
||||
+ u32 val;
|
||||
|
||||
-static int rockchip_dfi_probe(struct platform_device *pdev)
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ data->regs = devm_ioremap_resource(&pdev->dev, res);
|
||||
+ if (IS_ERR(data->regs))
|
||||
+ return PTR_ERR(data->regs);
|
||||
+
|
||||
+ node = of_parse_phandle(np, "rockchip,pmugrf", 0);
|
||||
+ if (node) {
|
||||
+ data->regmap_pmugrf = syscon_node_to_regmap(node);
|
||||
+ if (IS_ERR(data->regmap_pmugrf))
|
||||
+ return PTR_ERR(data->regmap_pmugrf);
|
||||
+ }
|
||||
+
|
||||
+ regmap_read(data->regmap_pmugrf, PX30_PMUGRF_OS_REG2, &val);
|
||||
+ data->dram_type = READ_DRAMTYPE_INFO(val);
|
||||
+ data->ch_msk = 1;
|
||||
+ data->clk = NULL;
|
||||
+
|
||||
+ desc->ops = &rockchip_dfi_ops;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static __init int rk3128_dfi_init(struct platform_device *pdev,
|
||||
+ struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc)
|
||||
{
|
||||
- struct device *dev = &pdev->dev;
|
||||
- struct rockchip_dfi *data;
|
||||
- struct devfreq_event_desc *desc;
|
||||
struct device_node *np = pdev->dev.of_node, *node;
|
||||
|
||||
- data = devm_kzalloc(dev, sizeof(struct rockchip_dfi), GFP_KERNEL);
|
||||
- if (!data)
|
||||
- return -ENOMEM;
|
||||
+ node = of_parse_phandle(np, "rockchip,grf", 0);
|
||||
+ if (node) {
|
||||
+ data->regmap_grf = syscon_node_to_regmap(node);
|
||||
+ if (IS_ERR(data->regmap_grf))
|
||||
+ return PTR_ERR(data->regmap_grf);
|
||||
+ }
|
||||
+
|
||||
+ desc->ops = &rk3128_dfi_ops;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static __init int rk3288_dfi_init(struct platform_device *pdev,
|
||||
+ struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc)
|
||||
+{
|
||||
+ struct device_node *np = pdev->dev.of_node, *node;
|
||||
+ u32 val;
|
||||
+
|
||||
+ node = of_parse_phandle(np, "rockchip,pmu", 0);
|
||||
+ if (node) {
|
||||
+ data->regmap_pmu = syscon_node_to_regmap(node);
|
||||
+ if (IS_ERR(data->regmap_pmu))
|
||||
+ return PTR_ERR(data->regmap_pmu);
|
||||
+ }
|
||||
+
|
||||
+ node = of_parse_phandle(np, "rockchip,grf", 0);
|
||||
+ if (node) {
|
||||
+ data->regmap_grf = syscon_node_to_regmap(node);
|
||||
+ if (IS_ERR(data->regmap_grf))
|
||||
+ return PTR_ERR(data->regmap_grf);
|
||||
+ }
|
||||
+
|
||||
+ regmap_read(data->regmap_pmu, RK3288_PMU_SYS_REG2, &val);
|
||||
+ data->dram_type = READ_DRAMTYPE_INFO(val);
|
||||
+ data->ch_msk = READ_CH_INFO(val);
|
||||
+
|
||||
+ if (data->dram_type == DDR3)
|
||||
+ regmap_write(data->regmap_grf, RK3288_GRF_SOC_CON4,
|
||||
+ RK3288_DDR3_SEL);
|
||||
+ else
|
||||
+ regmap_write(data->regmap_grf, RK3288_GRF_SOC_CON4,
|
||||
+ RK3288_LPDDR_SEL);
|
||||
+
|
||||
+ desc->ops = &rk3288_dfi_ops;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static __init int rk3368_dfi_init(struct platform_device *pdev,
|
||||
+ struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+
|
||||
+ if (!dev->parent || !dev->parent->of_node)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ data->regmap_grf = syscon_node_to_regmap(dev->parent->of_node);
|
||||
+ if (IS_ERR(data->regmap_grf))
|
||||
+ return PTR_ERR(data->regmap_grf);
|
||||
+
|
||||
+ desc->ops = &rk3368_dfi_ops;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static __init int rockchip_dfi_init(struct platform_device *pdev,
|
||||
+ struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct device_node *np = pdev->dev.of_node, *node;
|
||||
+ u32 val;
|
||||
|
||||
data->regs = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(data->regs))
|
||||
@@ -202,21 +582,97 @@ static int rockchip_dfi_probe(struct pla
|
||||
if (IS_ERR(data->regmap_pmu))
|
||||
return PTR_ERR(data->regmap_pmu);
|
||||
}
|
||||
- data->dev = dev;
|
||||
+
|
||||
+ regmap_read(data->regmap_pmu, PMUGRF_OS_REG2, &val);
|
||||
+ data->dram_type = READ_DRAMTYPE_INFO(val);
|
||||
+ data->ch_msk = READ_CH_INFO(val);
|
||||
+
|
||||
+ desc->ops = &rockchip_dfi_ops;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static __init int rk3328_dfi_init(struct platform_device *pdev,
|
||||
+ struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc)
|
||||
+{
|
||||
+ struct device_node *np = pdev->dev.of_node, *node;
|
||||
+ struct resource *res;
|
||||
+ u32 val;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ data->regs = devm_ioremap_resource(&pdev->dev, res);
|
||||
+ if (IS_ERR(data->regs))
|
||||
+ return PTR_ERR(data->regs);
|
||||
+
|
||||
+ node = of_parse_phandle(np, "rockchip,grf", 0);
|
||||
+ if (node) {
|
||||
+ data->regmap_grf = syscon_node_to_regmap(node);
|
||||
+ if (IS_ERR(data->regmap_grf))
|
||||
+ return PTR_ERR(data->regmap_grf);
|
||||
+ }
|
||||
+
|
||||
+ regmap_read(data->regmap_grf, RK3328_GRF_OS_REG2, &val);
|
||||
+ data->dram_type = READ_DRAMTYPE_INFO(val);
|
||||
+ data->ch_msk = 1;
|
||||
+ data->clk = NULL;
|
||||
+
|
||||
+ desc->ops = &rockchip_dfi_ops;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id rockchip_dfi_id_match[] = {
|
||||
+ { .compatible = "rockchip,px30-dfi", .data = px30_dfi_init },
|
||||
+ { .compatible = "rockchip,rk1808-dfi", .data = px30_dfi_init },
|
||||
+ { .compatible = "rockchip,rk3128-dfi", .data = rk3128_dfi_init },
|
||||
+ { .compatible = "rockchip,rk3288-dfi", .data = rk3288_dfi_init },
|
||||
+ { .compatible = "rockchip,rk3328-dfi", .data = rk3328_dfi_init },
|
||||
+ { .compatible = "rockchip,rk3368-dfi", .data = rk3368_dfi_init },
|
||||
+ { .compatible = "rockchip,rk3399-dfi", .data = rockchip_dfi_init },
|
||||
+ { },
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rockchip_dfi_id_match);
|
||||
+
|
||||
+static int rockchip_dfi_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct rockchip_dfi *data;
|
||||
+ struct devfreq_event_desc *desc;
|
||||
+ struct device_node *np = pdev->dev.of_node;
|
||||
+ const struct of_device_id *match;
|
||||
+ int (*init)(struct platform_device *pdev, struct rockchip_dfi *data,
|
||||
+ struct devfreq_event_desc *desc);
|
||||
+
|
||||
+ data = devm_kzalloc(dev, sizeof(struct rockchip_dfi), GFP_KERNEL);
|
||||
+ if (!data)
|
||||
+ return -ENOMEM;
|
||||
|
||||
desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
|
||||
if (!desc)
|
||||
return -ENOMEM;
|
||||
|
||||
- desc->ops = &rockchip_dfi_ops;
|
||||
+ match = of_match_node(rockchip_dfi_id_match, pdev->dev.of_node);
|
||||
+ if (match) {
|
||||
+ init = match->data;
|
||||
+ if (init) {
|
||||
+ if (init(pdev, data, desc))
|
||||
+ return -EINVAL;
|
||||
+ } else {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ } else {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
desc->driver_data = data;
|
||||
desc->name = np->name;
|
||||
data->desc = desc;
|
||||
+ data->dev = dev;
|
||||
|
||||
- data->edev = devm_devfreq_event_add_edev(&pdev->dev, desc);
|
||||
+ data->edev = devm_devfreq_event_add_edev(dev, desc);
|
||||
if (IS_ERR(data->edev)) {
|
||||
- dev_err(&pdev->dev,
|
||||
- "failed to add devfreq-event device\n");
|
||||
+ dev_err(dev, "failed to add devfreq-event device\n");
|
||||
return PTR_ERR(data->edev);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
From f9ae6e992d3d9e80357fee7d65ba0fe2dd37ae1f Mon Sep 17 00:00:00 2001
|
||||
From: hmz007 <hmz007@gmail.com>
|
||||
Date: Tue, 19 Nov 2019 14:21:51 +0800
|
||||
Subject: [PATCH] arm64: dts: rockchip: rk3328: add dfi node
|
||||
|
||||
Signed-off-by: hmz007 <hmz007@gmail.com>
|
||||
[adjusted commit title]
|
||||
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328.dtsi | 7 +++++++
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
@@ -1010,6 +1010,13 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ dfi: dfi@ff790000 {
|
||||
+ reg = <0x00 0xff790000 0x00 0x400>;
|
||||
+ compatible = "rockchip,rk3328-dfi";
|
||||
+ rockchip,grf = <&grf>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
gic: interrupt-controller@ff811000 {
|
||||
compatible = "arm,gic-400";
|
||||
#interrupt-cells = <3>;
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
From f9ae6e992d3d9e80357fee7d65ba0fe2dd37ae1f Mon Sep 17 00:00:00 2001
|
||||
From: hmz007 <hmz007@gmail.com>
|
||||
Date: Tue, 19 Nov 2019 14:21:51 +0800
|
||||
Subject: [PATCH] arm64: dts: nanopi-r2: add rk3328-dmc relate node
|
||||
|
||||
Signed-off-by: hmz007 <hmz007@gmail.com>
|
||||
---
|
||||
.../rockchip/rk3328-dram-default-timing.dtsi | 311 ++++++++++++++++++
|
||||
.../dts/rockchip/rk3328-nanopi-r2-common.dtsi | 85 ++++-
|
||||
include/dt-bindings/clock/rockchip-ddr.h | 63 ++++
|
||||
include/dt-bindings/memory/rk3328-dram.h | 159 +++++++++
|
||||
4 files changed, 617 insertions(+), 1 deletion(-)
|
||||
create mode 100644 arch/arm64/boot/dts/rockchip/rk3328-dram-default-timing.dtsi
|
||||
create mode 100644 include/dt-bindings/clock/rockchip-ddr.h
|
||||
create mode 100644 include/dt-bindings/memory/rk3328-dram.h
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
+#include "rk3328-dram-default-timing.dtsi"
|
||||
#include "rk3328.dtsi"
|
||||
|
||||
/ {
|
||||
@@ -119,6 +120,72 @@
|
||||
regulator-boot-on;
|
||||
vin-supply = <&vdd_5v>;
|
||||
};
|
||||
+
|
||||
+ dmc: dmc {
|
||||
+ compatible = "rockchip,rk3328-dmc";
|
||||
+ devfreq-events = <&dfi>;
|
||||
+ center-supply = <&vdd_log>;
|
||||
+ clocks = <&cru SCLK_DDRCLK>;
|
||||
+ clock-names = "dmc_clk";
|
||||
+ operating-points-v2 = <&dmc_opp_table>;
|
||||
+ ddr_timing = <&ddr_timing>;
|
||||
+ upthreshold = <40>;
|
||||
+ downdifferential = <20>;
|
||||
+ auto-min-freq = <786000>;
|
||||
+ auto-freq-en = <0>;
|
||||
+ #cooling-cells = <2>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ ddr_power_model: ddr_power_model {
|
||||
+ compatible = "ddr_power_model";
|
||||
+ dynamic-power-coefficient = <120>;
|
||||
+ static-power-coefficient = <200>;
|
||||
+ ts = <32000 4700 (-80) 2>;
|
||||
+ thermal-zone = "soc-thermal";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ dmc_opp_table: dmc-opp-table {
|
||||
+ compatible = "operating-points-v2";
|
||||
+
|
||||
+ rockchip,leakage-voltage-sel = <
|
||||
+ 1 10 0
|
||||
+ 11 254 1
|
||||
+ >;
|
||||
+ nvmem-cells = <&logic_leakage>;
|
||||
+ nvmem-cell-names = "ddr_leakage";
|
||||
+
|
||||
+ opp-786000000 {
|
||||
+ opp-hz = /bits/ 64 <786000000>;
|
||||
+ opp-microvolt = <1075000>;
|
||||
+ opp-microvolt-L0 = <1075000>;
|
||||
+ opp-microvolt-L1 = <1050000>;
|
||||
+ };
|
||||
+ opp-798000000 {
|
||||
+ opp-hz = /bits/ 64 <798000000>;
|
||||
+ opp-microvolt = <1075000>;
|
||||
+ opp-microvolt-L0 = <1075000>;
|
||||
+ opp-microvolt-L1 = <1050000>;
|
||||
+ };
|
||||
+ opp-840000000 {
|
||||
+ opp-hz = /bits/ 64 <840000000>;
|
||||
+ opp-microvolt = <1075000>;
|
||||
+ opp-microvolt-L0 = <1075000>;
|
||||
+ opp-microvolt-L1 = <1050000>;
|
||||
+ };
|
||||
+ opp-924000000 {
|
||||
+ opp-hz = /bits/ 64 <924000000>;
|
||||
+ opp-microvolt = <1100000>;
|
||||
+ opp-microvolt-L0 = <1100000>;
|
||||
+ opp-microvolt-L1 = <1075000>;
|
||||
+ };
|
||||
+ opp-1056000000 {
|
||||
+ opp-hz = /bits/ 64 <1056000000>;
|
||||
+ opp-microvolt = <1175000>;
|
||||
+ opp-microvolt-L0 = <1175000>;
|
||||
+ opp-microvolt-L1 = <1150000>;
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&cpu0 {
|
||||
@@ -137,6 +204,10 @@
|
||||
cpu-supply = <&vdd_arm>;
|
||||
};
|
||||
|
||||
+&dfi {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&display_subsystem {
|
||||
status = "disabled";
|
||||
};
|
||||
@@ -206,6 +277,7 @@
|
||||
regulator-name = "vdd_log";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
+ regulator-init-microvolt = <1075000>;
|
||||
regulator-min-microvolt = <712500>;
|
||||
regulator-max-microvolt = <1450000>;
|
||||
regulator-ramp-delay = <12500>;
|
||||
@@ -220,6 +292,7 @@
|
||||
regulator-name = "vdd_arm";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
+ regulator-init-microvolt = <1225000>;
|
||||
regulator-min-microvolt = <712500>;
|
||||
regulator-max-microvolt = <1450000>;
|
||||
regulator-ramp-delay = <12500>;
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Leonidas P. Papadakos <papadakospan@gmail.com>
|
||||
Date: Fri, 1 Mar 2019 21:55:53 +0200
|
||||
Subject: [PATCH v2] arm64: dts: rockchip: add more cpu operating points for
|
||||
RK3328
|
||||
|
||||
This allows for greater max frequency on rk3328 boards,
|
||||
increasing performance.
|
||||
|
||||
It has been included in Armbian (a linux distibution for ARM boards)
|
||||
for a while now without any reported issues
|
||||
|
||||
https://github.com/armbian/build/blob/master/patch/kernel/rockchip64-default/enable-1392mhz-opp.patch
|
||||
https://github.com/armbian/build/blob/master/patch/kernel/rockchip64-default/enable-1512mhz-opp.patch
|
||||
|
||||
Signed-off-by: Leonidas P. Papadakos <papadakospan@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3328.dtsi | 15 +++++++++++++++
|
||||
1 files changed, 15 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
|
||||
@@ -140,6 +140,21 @@
|
||||
opp-microvolt = <1300000>;
|
||||
clock-latency-ns = <40000>;
|
||||
};
|
||||
+ opp-1392000000 {
|
||||
+ opp-hz = /bits/ 64 <1392000000>;
|
||||
+ opp-microvolt = <1350000>;
|
||||
+ clock-latency-ns = <40000>;
|
||||
+ };
|
||||
+ opp-1512000000 {
|
||||
+ opp-hz = /bits/ 64 <1512000000>;
|
||||
+ opp-microvolt = <1400000>;
|
||||
+ clock-latency-ns = <40000>;
|
||||
+ };
|
||||
+ opp-1608000000 {
|
||||
+ opp-hz = /bits/ 64 <1608000000>;
|
||||
+ opp-microvolt = <1450000>;
|
||||
+ clock-latency-ns = <40000>;
|
||||
+ };
|
||||
};
|
||||
|
||||
analog_sound: analog-sound {
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
From 04202df5cb497b1934c95211cf43784ef62245a4 Mon Sep 17 00:00:00 2001
|
||||
From: Tianling Shen <cnsztl@immortalwrt.org>
|
||||
Date: Mon, 18 Oct 2021 12:47:30 +0800
|
||||
Subject: [PATCH] rockchip: rk3399: overclock to 2.2/1.8 GHz
|
||||
|
||||
It's stable enough to overclock cpu frequency to 2.2/1.8 GHz,
|
||||
and for better performance.
|
||||
|
||||
Co-development-by: gzelvis <gzelvis@gmail.com>
|
||||
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi
|
||||
@@ -33,6 +33,14 @@
|
||||
opp-hz = /bits/ 64 <1416000000>;
|
||||
opp-microvolt = <1125000 1125000 1250000>;
|
||||
};
|
||||
+ opp06 {
|
||||
+ opp-hz = /bits/ 64 <1608000000>;
|
||||
+ opp-microvolt = <1225000>;
|
||||
+ };
|
||||
+ opp07 {
|
||||
+ opp-hz = /bits/ 64 <1800000000>;
|
||||
+ opp-microvolt = <1275000>;
|
||||
+ };
|
||||
};
|
||||
|
||||
cluster1_opp: opp-table1 {
|
||||
@@ -72,6 +80,14 @@
|
||||
opp-hz = /bits/ 64 <1800000000>;
|
||||
opp-microvolt = <1200000 1200000 1250000>;
|
||||
};
|
||||
+ opp08 {
|
||||
+ opp-hz = /bits/ 64 <2016000000>;
|
||||
+ opp-microvolt = <1250000>;
|
||||
+ };
|
||||
+ opp09 {
|
||||
+ opp-hz = /bits/ 64 <2208000000>;
|
||||
+ opp-microvolt = <1325000>;
|
||||
+ };
|
||||
};
|
||||
|
||||
gpu_opp_table: opp-table2 {
|
||||
Loading…
Add table
Add a link
Reference in a new issue