ipq9574: Add PCIE support

Change-Id: I7272cf5bd27a7b62ae35f23cda7f980e177e2fd5
Signed-off-by: anusha <anusharao@codeaurora.org>
This commit is contained in:
anusha 2021-03-10 09:41:19 +05:30
parent be18366519
commit dab796560d
7 changed files with 192 additions and 7 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -66,8 +66,43 @@
};
};
xhci@8a00000 {
qcom,emulation = <1>;
};
pci0: pci@28000000 {
status = "disabled";
perst_gpio = <39>;
pci_gpio {
pci_rst {
};
};
};
pci1: pci@20000000 {
status = "disabled";
perst_gpio = <41>;
pci_gpio {
pci_rst {
};
};
};
pci2: pci@18000000 {
status = "disabled";
perst_gpio = <42>;
pci_gpio {
pci_rst {
};
};
};
pci3: pci@10000000 {
status = "disabled";
perst_gpio = <40>;
pci_gpio {
pci_rst {
};
};
};
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -73,6 +73,86 @@
reg = <0x8a00000 0xcd00>;
};
pci@28000000 {
compatible = "qcom,ipq9574-pcie";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x28000000 0xf1d
0x80000 0x3000
0x28000F20 0xa8
0x28001000 0x1000
0x28300000 0xd00000
0x28100000 0x100000
0x1828000 0x60
0x84000 0x1000>;
reg-names = "pci_dbi", "parf", "elbi","dm_iatu", "axi_bars",
"axi_conf", "pci_rst", "pci_phy";
gen3 = <1>;
lane = <1>;
status = "disabled";
skip_phy_int = <1>;
};
pci@20000000 {
compatible = "qcom,ipq9574-pcie";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x20000000 0xf1d
0x88000 0x3000
0x20000F20 0xa8
0x20001000 0x1000
0x20300000 0xd00000
0x20100000 0x100000
0x1829000 0x60
0x8c000 0x1000>;
reg-names = "pci_dbi", "parf", "elbi","dm_iatu", "axi_bars",
"axi_conf", "pci_rst", "pci_phy";
gen3 = <1>;
lane = <2>;
status = "disabled";
skip_phy_int = <1>;
};
pci@18000000 {
compatible = "qcom,ipq9574-pcie";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x18000000 0xf1d
0xF0000 0x3000
0x18000F20 0xa8
0x18001000 0x1000
0x18300000 0xd00000
0x18100000 0x100000
0x182A000 0x60
0xF4000 0x1000>;
reg-names = "pci_dbi", "parf", "elbi","dm_iatu", "axi_bars",
"axi_conf", "pci_rst", "pci_phy";
gen3 = <1>;
lane = <2>;
status = "disabled";
skip_phy_int = <1>;
};
pci@10000000 {
compatible = "qcom,ipq9574-pcie";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x10000000 0xf1d
0xF8000 0x3000
0x10000F20 0xa8
0x10001000 0x1000
0x10300000 0xd00000
0x10100000 0x100000
0x182B000 0x60
0xFC000 0x1000>;
reg-names = "pci_dbi", "parf", "elbi","dm_iatu", "axi_bars",
"axi_conf", "pci_rst", "pci_phy";
gen3 = <1>;
lane = <1>;
status = "disabled";
skip_phy_int = <1>;
};
timer {
gcnt_cntcv_lo = <0x4a2000>;
gcnt_cntcv_hi = <0x4a2004>;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -541,6 +541,60 @@ void ipq_fdt_fixup_usb_device_mode(void *blob)
printf("%s: invalid param for usb_mode\n", __func__);
}
#ifdef CONFIG_PCI_IPQ
void board_pci_init(int id)
{
int node, gpio_node;
char name[16];
snprintf(name, sizeof(name), "pci%d", id);
node = fdt_path_offset(gd->fdt_blob, name);
if (node < 0) {
printf("Could not find PCI%d in device tree\n", id);
return;
}
gpio_node = fdt_subnode_offset(gd->fdt_blob, node, "pci_gpio");
if (gpio_node >= 0)
qca_gpio_init(gpio_node);
return;
}
void board_pci_deinit()
{
int node, gpio_node, i, err;
char name[16];
struct fdt_resource parf;
struct fdt_resource pci_phy;
for (i = 0; i < PCI_MAX_DEVICES; i++) {
snprintf(name, sizeof(name), "pci%d", i);
node = fdt_path_offset(gd->fdt_blob, name);
if (node < 0) {
printf("Could not find PCI%d in device tree\n", i);
continue;
}
err = fdt_get_named_resource(gd->fdt_blob, node, "reg", "reg-names", "parf",
&parf);
writel(0x0, parf.start + 0x358);
writel(0x1, parf.start + 0x40);
err = fdt_get_named_resource(gd->fdt_blob, node, "reg", "reg-names", "pci_phy",
&pci_phy);
if (err < 0)
continue;
writel(0x1, pci_phy.start + 800);
writel(0x0, pci_phy.start + 804);
gpio_node = fdt_subnode_offset(gd->fdt_blob, node, "pci_gpio");
if (gpio_node >= 0)
qca_gpio_deinit(gpio_node);
}
return ;
}
#endif
void enable_caches(void)
{

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -206,6 +206,11 @@
#define USB3_PHY_SW_RESET 0x800
#define NOC_HANDSHAKE_FSM_EN (1 << 15)
#ifdef CONFIG_PCI_IPQ
void board_pci_init(int id);
__weak void board_pcie_clock_init(int id) {}
#endif
unsigned int __invoke_psci_fn_smc(unsigned int, unsigned int,
unsigned int, unsigned int);

View file

@ -222,6 +222,7 @@ CONFIG_QPIC_SERIAL=y
# PCI
#
# CONFIG_DM_PCI is not set
CONFIG_PCI_IPQ=y
#
# Pin controllers

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2015-2017, 2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2014, 2015-2017, 2020-2021 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -607,6 +607,7 @@ static const struct udevice_id pcie_ver_ids[] = {
{ .compatible = "qcom,ipq807x-pcie", .data = PCIE_V2 },
{ .compatible = "qcom,ipq6018-pcie", .data = PCIE_V2 },
{ .compatible = "qcom,ipq5018-pcie", .data = PCIE_V2 },
{ .compatible = "qcom,ipq9574-pcie", .data = PCIE_V2 },
{ },
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018,2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2018,2020-2021 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -156,6 +156,15 @@ extern loff_t board_env_size;
#define CONFIG_USB_MAX_CONTROLLER_COUNT 1
#endif
/*
* PCIE Enable
*/
#define PCI_MAX_DEVICES 4
#if defined(CONFIG_PCI_IPQ)
#define CONFIG_PCI
#define CONFIG_CMD_PCI
#define CONFIG_PCI_SCAN_SHOW
#endif
/*
* NAND Flash Configs