507 lines
14 KiB
Diff
507 lines
14 KiB
Diff
|
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||
|
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
|
||
|
@@ -247,6 +247,98 @@
|
||
|
};
|
||
|
};
|
||
|
|
||
|
+ sata1: sata@fc400000 {
|
||
|
+ compatible = "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>;
|
||
|
+ interrupt-names = "hostc";
|
||
|
+ phys = <&combphy1 PHY_TYPE_SATA>;
|
||
|
+ phy-names = "sata-phy";
|
||
|
+ ports-implemented = <0x1>;
|
||
|
+ power-domains = <&power RK3568_PD_PIPE>;
|
||
|
+ status = "disabled";
|
||
|
+ };
|
||
|
+
|
||
|
+ sata2: sata@fc800000 {
|
||
|
+ compatible = "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>;
|
||
|
+ interrupt-names = "hostc";
|
||
|
+ phys = <&combphy2 PHY_TYPE_SATA>;
|
||
|
+ phy-names = "sata-phy";
|
||
|
+ ports-implemented = <0x1>;
|
||
|
+ power-domains = <&power RK3568_PD_PIPE>;
|
||
|
+ status = "disabled";
|
||
|
+ };
|
||
|
+
|
||
|
+ usbdrd30: usbdrd {
|
||
|
+ compatible = "rockchip,rk3399-dwc3", "snps,dwc3";
|
||
|
+ clocks = <&cru CLK_USB3OTG0_REF>, <&cru CLK_USB3OTG0_SUSPEND>,
|
||
|
+ <&cru ACLK_USB3OTG0>, <&cru PCLK_PIPE>;
|
||
|
+ clock-names = "ref_clk", "suspend_clk",
|
||
|
+ "bus_clk", "pipe_clk";
|
||
|
+ #address-cells = <2>;
|
||
|
+ #size-cells = <2>;
|
||
|
+ ranges;
|
||
|
+ status = "disabled";
|
||
|
+
|
||
|
+ usbdrd_dwc3: dwc3@fcc00000 {
|
||
|
+ compatible = "snps,dwc3";
|
||
|
+ reg = <0x0 0xfcc00000 0x0 0x400000>;
|
||
|
+ interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>;
|
||
|
+ dr_mode = "host";
|
||
|
+ phy_type = "utmi_wide";
|
||
|
+ power-domains = <&power RK3568_PD_PIPE>;
|
||
|
+ resets = <&cru SRST_USB3OTG0>;
|
||
|
+ reset-names = "usb3-otg";
|
||
|
+ snps,dis_enblslpm_quirk;
|
||
|
+ snps,dis-u2-freeclk-exists-quirk;
|
||
|
+ snps,dis-del-phy-power-chg-quirk;
|
||
|
+ snps,dis-tx-ipgap-linecheck-quirk;
|
||
|
+ snps,xhci-trb-ent-quirk;
|
||
|
+ status = "disabled";
|
||
|
+ };
|
||
|
+ };
|
||
|
+
|
||
|
+ usbhost30: usbhost {
|
||
|
+ compatible = "rockchip,rk3399-dwc3", "snps,dwc3";
|
||
|
+ clocks = <&cru CLK_USB3OTG1_REF>, <&cru CLK_USB3OTG1_SUSPEND>,
|
||
|
+ <&cru ACLK_USB3OTG1>, <&cru PCLK_PIPE>;
|
||
|
+ clock-names = "ref_clk", "suspend_clk",
|
||
|
+ "bus_clk", "pipe_clk";
|
||
|
+ #address-cells = <2>;
|
||
|
+ #size-cells = <2>;
|
||
|
+ assigned-clocks = <&cru CLK_PCIEPHY1_REF>;
|
||
|
+ assigned-clock-rates = <25000000>;
|
||
|
+ ranges;
|
||
|
+ status = "disabled";
|
||
|
+
|
||
|
+ usbhost_dwc3: dwc3@fd000000 {
|
||
|
+ compatible = "snps,dwc3";
|
||
|
+ reg = <0x0 0xfd000000 0x0 0x400000>;
|
||
|
+ interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>;
|
||
|
+ dr_mode = "host";
|
||
|
+ phys = <&u2phy0_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>;
|
||
|
+ reset-names = "usb3-host";
|
||
|
+ snps,dis_enblslpm_quirk;
|
||
|
+ snps,dis-u2-freeclk-exists-quirk;
|
||
|
+ snps,dis_u2_susphy_quirk;
|
||
|
+ snps,dis-del-phy-power-chg-quirk;
|
||
|
+ snps,dis-tx-ipgap-linecheck-quirk;
|
||
|
+ status = "disabled";
|
||
|
+ };
|
||
|
+ };
|
||
|
+
|
||
|
gic: interrupt-controller@fd400000 {
|
||
|
compatible = "arm,gic-v3";
|
||
|
reg = <0x0 0xfd400000 0 0x10000>, /* GICD */
|
||
|
@@ -365,6 +472,7 @@
|
||
|
clocks = <&pmucru SCLK_UART0>, <&pmucru PCLK_UART0>;
|
||
|
clock-names = "baudclk", "apb_pclk";
|
||
|
dmas = <&dmac0 0>, <&dmac0 1>;
|
||
|
+ dma-names = "tx", "rx";
|
||
|
pinctrl-0 = <&uart0_xfer>;
|
||
|
pinctrl-names = "default";
|
||
|
reg-io-width = <4>;
|
||
|
@@ -770,6 +879,61 @@
|
||
|
qos_vop_m1: qos@fe1a8100 {
|
||
|
compatible = "rockchip,rk3568-qos", "syscon";
|
||
|
reg = <0x0 0xfe1a8100 0x0 0x20>;
|
||
|
+ };
|
||
|
+
|
||
|
+ pcie2x1: pcie@fe260000 {
|
||
|
+ compatible = "rockchip,rk3568-pcie";
|
||
|
+ #address-cells = <3>;
|
||
|
+ #size-cells = <2>;
|
||
|
+ bus-range = <0x0 0xf>;
|
||
|
+ assigned-clocks = <&cru ACLK_PCIE20_MST>, <&cru ACLK_PCIE20_SLV>,
|
||
|
+ <&cru ACLK_PCIE20_DBI>, <&cru PCLK_PCIE20>,
|
||
|
+ <&cru CLK_PCIE20_AUX_NDFT>;
|
||
|
+ 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";
|
||
|
+ 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";
|
||
|
+ #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 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>;
|
||
|
+ reg = <0x3 0xc0000000 0x0 0x400000>,
|
||
|
+ <0x0 0xfe260000 0x0 0x10000>,
|
||
|
+ <0x3 0x3f800000 0x0 0x800000>;
|
||
|
+ ranges = <0x1000000 0x0 0x7f700000 0x3 0x3f700000 0x0 0x00100000
|
||
|
+ 0x2000000 0x0 0x40000000 0x3 0x00000000 0x0 0x3f700000>;
|
||
|
+ reg-names = "dbi", "apb", "config";
|
||
|
+ resets = <&cru SRST_PCIE20_POWERUP>;
|
||
|
+ reset-names = "pipe";
|
||
|
+ 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 {
|
||
|
@@ -797,6 +961,17 @@
|
||
|
max-frequency = <150000000>;
|
||
|
resets = <&cru SRST_SDMMC1>;
|
||
|
reset-names = "reset";
|
||
|
+ 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";
|
||
|
};
|
||
|
|
||
|
@@ -971,6 +1146,7 @@
|
||
|
clocks = <&cru SCLK_UART1>, <&cru PCLK_UART1>;
|
||
|
clock-names = "baudclk", "apb_pclk";
|
||
|
dmas = <&dmac0 2>, <&dmac0 3>;
|
||
|
+ dma-names = "tx", "rx";
|
||
|
pinctrl-0 = <&uart1m0_xfer>;
|
||
|
pinctrl-names = "default";
|
||
|
reg-io-width = <4>;
|
||
|
@@ -985,6 +1161,7 @@
|
||
|
clocks = <&cru SCLK_UART2>, <&cru PCLK_UART2>;
|
||
|
clock-names = "baudclk", "apb_pclk";
|
||
|
dmas = <&dmac0 4>, <&dmac0 5>;
|
||
|
+ dma-names = "tx", "rx";
|
||
|
pinctrl-0 = <&uart2m0_xfer>;
|
||
|
pinctrl-names = "default";
|
||
|
reg-io-width = <4>;
|
||
|
@@ -999,6 +1176,7 @@
|
||
|
clocks = <&cru SCLK_UART3>, <&cru PCLK_UART3>;
|
||
|
clock-names = "baudclk", "apb_pclk";
|
||
|
dmas = <&dmac0 6>, <&dmac0 7>;
|
||
|
+ dma-names = "tx", "rx";
|
||
|
pinctrl-0 = <&uart3m0_xfer>;
|
||
|
pinctrl-names = "default";
|
||
|
reg-io-width = <4>;
|
||
|
@@ -1013,6 +1191,7 @@
|
||
|
clocks = <&cru SCLK_UART4>, <&cru PCLK_UART4>;
|
||
|
clock-names = "baudclk", "apb_pclk";
|
||
|
dmas = <&dmac0 8>, <&dmac0 9>;
|
||
|
+ dma-names = "tx", "rx";
|
||
|
pinctrl-0 = <&uart4m0_xfer>;
|
||
|
pinctrl-names = "default";
|
||
|
reg-io-width = <4>;
|
||
|
@@ -1027,6 +1206,7 @@
|
||
|
clocks = <&cru SCLK_UART5>, <&cru PCLK_UART5>;
|
||
|
clock-names = "baudclk", "apb_pclk";
|
||
|
dmas = <&dmac0 10>, <&dmac0 11>;
|
||
|
+ dma-names = "tx", "rx";
|
||
|
pinctrl-0 = <&uart5m0_xfer>;
|
||
|
pinctrl-names = "default";
|
||
|
reg-io-width = <4>;
|
||
|
@@ -1041,6 +1221,7 @@
|
||
|
clocks = <&cru SCLK_UART6>, <&cru PCLK_UART6>;
|
||
|
clock-names = "baudclk", "apb_pclk";
|
||
|
dmas = <&dmac0 12>, <&dmac0 13>;
|
||
|
+ dma-names = "tx", "rx";
|
||
|
pinctrl-0 = <&uart6m0_xfer>;
|
||
|
pinctrl-names = "default";
|
||
|
reg-io-width = <4>;
|
||
|
@@ -1055,6 +1236,7 @@
|
||
|
clocks = <&cru SCLK_UART7>, <&cru PCLK_UART7>;
|
||
|
clock-names = "baudclk", "apb_pclk";
|
||
|
dmas = <&dmac0 14>, <&dmac0 15>;
|
||
|
+ dma-names = "tx", "rx";
|
||
|
pinctrl-0 = <&uart7m0_xfer>;
|
||
|
pinctrl-names = "default";
|
||
|
reg-io-width = <4>;
|
||
|
@@ -1069,6 +1251,7 @@
|
||
|
clocks = <&cru SCLK_UART8>, <&cru PCLK_UART8>;
|
||
|
clock-names = "baudclk", "apb_pclk";
|
||
|
dmas = <&dmac0 16>, <&dmac0 17>;
|
||
|
+ dma-names = "tx", "rx";
|
||
|
pinctrl-0 = <&uart8m0_xfer>;
|
||
|
pinctrl-names = "default";
|
||
|
reg-io-width = <4>;
|
||
|
@@ -1083,6 +1266,7 @@
|
||
|
clocks = <&cru SCLK_UART9>, <&cru PCLK_UART9>;
|
||
|
clock-names = "baudclk", "apb_pclk";
|
||
|
dmas = <&dmac0 18>, <&dmac0 19>;
|
||
|
+ dma-names = "tx", "rx";
|
||
|
pinctrl-0 = <&uart9m0_xfer>;
|
||
|
pinctrl-names = "default";
|
||
|
reg-io-width = <4>;
|
||
|
|
||
|
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||
|
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
|
||
|
@@ -7,6 +7,21 @@
|
||
|
|
||
|
/ {
|
||
|
compatible = "rockchip,rk3568";
|
||
|
+
|
||
|
+ sata0: sata@fc000000 {
|
||
|
+ compatible = "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>;
|
||
|
+ interrupt-names = "hostc";
|
||
|
+ phys = <&combphy0 PHY_TYPE_SATA>;
|
||
|
+ phy-names = "sata-phy";
|
||
|
+ ports-implemented = <0x1>;
|
||
|
+ power-domains = <&power RK3568_PD_PIPE>;
|
||
|
+ status = "disabled";
|
||
|
+ };
|
||
|
|
||
|
qos_pcie3x1: qos@fe190080 {
|
||
|
compatible = "rockchip,rk3568-qos", "syscon";
|
||
|
@@ -78,6 +109,10 @@
|
||
|
opp-hz = /bits/ 64 <1992000000>;
|
||
|
opp-microvolt = <1150000 1150000 1150000>;
|
||
|
};
|
||
|
+};
|
||
|
+
|
||
|
+&pipegrf {
|
||
|
+ compatible = "rockchip,rk3568-pipegrf", "syscon";
|
||
|
};
|
||
|
|
||
|
&power {
|
||
|
@@ -95,3 +130,8 @@
|
||
|
#power-domain-cells = <0>;
|
||
|
};
|
||
|
};
|
||
|
+
|
||
|
+&usbdrd_dwc3 {
|
||
|
+ phys = <&u2phy0_otg>, <&combphy0 PHY_TYPE_USB3>;
|
||
|
+ phy-names = "usb2-phy", "usb3-phy";
|
||
|
+};
|
||
|
|
||
|
--- a/arch/arm64/boot/dts/rockchip/rk3566.dtsi
|
||
|
+++ b/arch/arm64/boot/dts/rockchip/rk3566.dtsi
|
||
|
@@ -4,6 +4,10 @@
|
||
|
|
||
|
/ {
|
||
|
compatible = "rockchip,rk3566";
|
||
|
+};
|
||
|
+
|
||
|
+&pipegrf {
|
||
|
+ compatible = "rockchip,rk3566-pipegrf", "syscon";
|
||
|
};
|
||
|
|
||
|
&power {
|
||
|
@@ -18,3 +22,11 @@
|
||
|
#power-domain-cells = <0>;
|
||
|
};
|
||
|
};
|
||
|
+
|
||
|
+&usbdrd_dwc3 {
|
||
|
+ phys = <&u2phy0_otg>;
|
||
|
+ phy-names = "usb2-phy";
|
||
|
+ extcon = <&u2phy0>;
|
||
|
+ maximum-speed = "high-speed";
|
||
|
+ snps,dis_u2_susphy_quirk;
|
||
|
+};
|
||
|
|
||
|
--- 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)
|
||
|
|
||
|
|
||
|
--- a/drivers/usb/dwc3/core.c
|
||
|
+++ b/drivers/usb/dwc3/core.c
|
||
|
@@ -1087,6 +1087,10 @@
|
||
|
|
||
|
if (dwc->parkmode_disable_ss_quirk)
|
||
|
reg |= DWC3_GUCTL1_PARKMODE_DISABLE_SS;
|
||
|
+
|
||
|
+ if (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/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>
|
||
|
@@ -36,10 +39,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_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_LEGACY_INT_ENABLE GENMASK(7, 0)
|
||
|
+#define PCIE_LTSSM_ENABLE_ENHANCE BIT(4)
|
||
|
#define PCIE_LTSSM_STATUS_MASK GENMASK(5, 0)
|
||
|
|
||
|
struct rockchip_pcie {
|
||
|
@@ -51,6 +56,7 @@
|
||
|
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,
|
||
|
@@ -63,6 +69,68 @@
|
||
|
u32 val, u32 reg)
|
||
|
{
|
||
|
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);
|
||
|
+ struct device *dev = rockchip->pci.dev;
|
||
|
+ u32 reg;
|
||
|
+ u32 hwirq;
|
||
|
+ u32 virq;
|
||
|
+
|
||
|
+ chained_irq_enter(chip, desc);
|
||
|
+
|
||
|
+ reg = rockchip_pcie_readl_apb(rockchip, 0x8);
|
||
|
+
|
||
|
+ while (reg) {
|
||
|
+ hwirq = ffs(reg) - 1;
|
||
|
+ reg &= ~BIT(hwirq);
|
||
|
+
|
||
|
+ virq = irq_find_mapping(rockchip->irq_domain, hwirq);
|
||
|
+ if (virq)
|
||
|
+ generic_handle_irq(virq);
|
||
|
+ else
|
||
|
+ dev_err(dev, "unexpected IRQ, INT%d\n", hwirq);
|
||
|
+ }
|
||
|
+
|
||
|
+ chained_irq_exit(chip, desc);
|
||
|
+}
|
||
|
+
|
||
|
+static int rockchip_pcie_intx_map(struct irq_domain *domain, unsigned int irq,
|
||
|
+ irq_hw_number_t hwirq)
|
||
|
+{
|
||
|
+ irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_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)
|
||
|
@@ -111,9 +179,27 @@
|
||
|
{
|
||
|
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
|
||
|
struct rockchip_pcie *rockchip = to_rockchip_pcie(pci);
|
||
|
- u32 val = HIWORD_UPDATE_BIT(PCIE_LTSSM_ENABLE_ENHANCE);
|
||
|
+ struct device *dev = rockchip->pci.dev;
|
||
|
+ int irq, ret;
|
||
|
+ u32 val;
|
||
|
+
|
||
|
+ irq = of_irq_get_byname(dev->of_node, "legacy");
|
||
|
+ if (irq < 0)
|
||
|
+ return irq;
|
||
|
+
|
||
|
+ irq_set_chained_handler_and_data(irq, rockchip_pcie_legacy_int_handler, rockchip);
|
||
|
+
|
||
|
+ ret = rockchip_pcie_init_irq_domain(rockchip);
|
||
|
+ if (ret < 0)
|
||
|
+ dev_err(dev, "failed to init irq domain\n");
|
||
|
+
|
||
|
+ /* enable legacy interrupts */
|
||
|
+ val = HIWORD_UPDATE_BIT(PCIE_LEGACY_INT_ENABLE);
|
||
|
+ val &= ~PCIE_LEGACY_INT_ENABLE;
|
||
|
+ rockchip_pcie_writel_apb(rockchip, val, PCIE_CLIENT_INTR_MASK_LEGACY);
|
||
|
|
||
|
/* LTSSM enable control mode */
|
||
|
+ val = HIWORD_UPDATE_BIT(PCIE_LTSSM_ENABLE_ENHANCE);
|
||
|
rockchip_pcie_writel_apb(rockchip, val, PCIE_CLIENT_HOT_RESET_CTRL);
|
||
|
|
||
|
rockchip_pcie_writel_apb(rockchip, PCIE_CLIENT_RC_MODE,
|
||
|
@@ -214,6 +300,10 @@
|
||
|
|
||
|
rockchip->pci.dev = dev;
|
||
|
rockchip->pci.ops = &dw_pcie_ops;
|
||
|
+
|
||
|
+ ret = dma_set_mask(rockchip->pci.dev, DMA_BIT_MASK(32));
|
||
|
+ if (ret)
|
||
|
+ dev_warn(rockchip->pci.dev, "Failed to set DMA mask to 32-bit. Devices with only 32-bit MSI support may not work properly\n");
|
||
|
|
||
|
pp = &rockchip->pci.pp;
|
||
|
pp->ops = &rockchip_pcie_host_ops;
|
||
|
|