summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandy.hu <andy.hu@starfivetech.com>2023-07-27 04:59:34 +0300
committerandy.hu <andy.hu@starfivetech.com>2023-07-27 04:59:34 +0300
commita5ea3229203511bade5d45270b91be854756f0f3 (patch)
tree99727305af169f6ee52f72822c372569ee64483c
parentb0ae09ed153f63de116d542d1fa4a1261de7d5fe (diff)
parent7457b963eead92eef0f6ea4c67828fb5f7899934 (diff)
downloadu-boot-a5ea3229203511bade5d45270b91be854756f0f3.tar.xz
Merge branch 'CR_6728_active_pci_xhci_minda' into 'vf2-devel'
CR_6728 pci: Get te correct config addr to support multi PCI See merge request sbc/u-boot!57
-rw-r--r--arch/riscv/dts/starfive_visionfive2.dts4
-rw-r--r--configs/starfive_visionfive2_defconfig4
-rw-r--r--drivers/pci/pcie_starfive.c16
3 files changed, 13 insertions, 11 deletions
diff --git a/arch/riscv/dts/starfive_visionfive2.dts b/arch/riscv/dts/starfive_visionfive2.dts
index d0268fbfeb..34bdd57eab 100644
--- a/arch/riscv/dts/starfive_visionfive2.dts
+++ b/arch/riscv/dts/starfive_visionfive2.dts
@@ -383,7 +383,7 @@
};
&usbdrd_cdns3 {
- dr_mode = "host";
+ dr_mode = "peripheral";
};
&pcie0 {
@@ -392,7 +392,7 @@
pinctrl-1 = <&pcie0_perst_active>;
pinctrl-2 = <&pcie0_wake_default>;
pinctrl-3 = <&pcie0_clkreq_default>;
- status = "disabled";
+ status = "okay";
};
&pcie1 {
diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig
index 6fd68b3071..73c56982c9 100644
--- a/configs/starfive_visionfive2_defconfig
+++ b/configs/starfive_visionfive2_defconfig
@@ -62,6 +62,7 @@ CONFIG_CMD_I2C=y
CONFIG_CMD_MISC=y
CONFIG_CMD_PART=y
CONFIG_CMD_PCI=y
+CONFIG_CMD_USB=y
CONFIG_CMD_TFTPPUT=y
CONFIG_CMD_EFIDEBUG=y
CONFIG_CMD_SYSBOOT=y
@@ -128,8 +129,9 @@ CONFIG_SYSRESET=y
CONFIG_SYSRESET_SBI=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_PCI=y
CONFIG_USB_CDNS3=y
-CONFIG_USB_CDNS3_HOST=y
+# CONFIG_USB_CDNS3_TI is not set
CONFIG_USB_CDNS3_STARFIVE=y
CONFIG_USB_STORAGE=y
CONFIG_DM_VIDEO=y
diff --git a/drivers/pci/pcie_starfive.c b/drivers/pci/pcie_starfive.c
index 82eb3a99f0..d9de50d191 100644
--- a/drivers/pci/pcie_starfive.c
+++ b/drivers/pci/pcie_starfive.c
@@ -110,9 +110,9 @@ static int starfive_pcie_addr_valid(pci_dev_t bdf, int first_busno)
return 1;
}
-static int starfive_pcie_off_conf(pci_dev_t bdf, uint offset)
+static int starfive_pcie_off_conf(pci_dev_t bdf, uint offset, int first_busno)
{
- unsigned int bus = PCI_BUS(bdf);
+ unsigned int bus = PCI_BUS(bdf) - first_busno;
unsigned int dev = PCI_DEV(bdf);
unsigned int func = PCI_FUNC(bdf);
@@ -120,10 +120,10 @@ static int starfive_pcie_off_conf(pci_dev_t bdf, uint offset)
(func << ECAM_FUNC_SHIFT) | (offset & ~0x3);
}
-static bool plda_pcie_hide_rc_bar(pci_dev_t bdf, int offset)
+static bool plda_pcie_hide_rc_bar(pci_dev_t bdf, int offset, int first_busno)
{
- if ((PCI_BUS(bdf) == 0) &&
- (offset == PCI_BASE_ADDRESS_0 || offset == PCI_BASE_ADDRESS_1))
+ if ((PCI_BUS(bdf) == first_busno) &&
+ (offset == PCI_BASE_ADDRESS_0 || offset == PCI_BASE_ADDRESS_1))
return true;
return false;
@@ -136,7 +136,7 @@ static int starfive_pcie_config_read(const struct udevice *udev, pci_dev_t bdf,
void __iomem *addr;
ulong value;
struct starfive_pcie *priv = dev_get_priv(udev);
- int where = starfive_pcie_off_conf(bdf, offset);
+ int where = starfive_pcie_off_conf(bdf, offset, priv->first_busno);
if (!starfive_pcie_addr_valid(bdf, priv->first_busno)) {
pr_debug("Out of range\n");
@@ -168,9 +168,9 @@ int starfive_pcie_config_write(struct udevice *udev, pci_dev_t bdf,
void __iomem *addr;
ulong old;
struct starfive_pcie *priv = dev_get_priv(udev);
- int where = starfive_pcie_off_conf(bdf, offset);
+ int where = starfive_pcie_off_conf(bdf, offset, priv->first_busno);
- if (plda_pcie_hide_rc_bar(bdf, offset))
+ if (plda_pcie_hide_rc_bar(bdf, offset, priv->first_busno))
return -1;
if (!starfive_pcie_addr_valid(bdf, priv->first_busno)) {