* [U-Boot] [PATCH 0/2] imx: ventana: Add pci fixup for PLX switch
@ 2014-08-08 5:49 Tim Harvey
2014-08-08 5:49 ` [U-Boot] [PATCH 1/2] pci: add support for board_pci_fixup_dev function Tim Harvey
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Tim Harvey @ 2014-08-08 5:49 UTC (permalink / raw)
To: u-boot
Many of the Gateworks Ventana boards have a PLX PCIe switch where GPIO
on the switch is used as the PERST# of the downstream ports. In the Linux
kernel there is a PCI fixup that asserts these properly when the upstream
port is enumerated.
The first patch in this serial adds a board_pci_fixup_dev function define
to allow hooking similarly to the kernel pci fixup functionality.
The second patch uses the board_pci_fixup_dev function to perform the
GPIO configuration on the switch for the downstream ports.
Tim Harvey (2):
pci: add support for board_pci_fixup_dev function
imx: ventana: add pci fixup for PLX PEX860x switch GPIO
board/gateworks/gw_ventana/gw_ventana.c | 30 ++++++++++++++++++++++++++++++
drivers/pci/pci.c | 4 ++++
include/configs/gw_ventana.h | 1 +
include/pci.h | 7 +++++++
4 files changed, 42 insertions(+)
--
1.8.3.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] pci: add support for board_pci_fixup_dev function
2014-08-08 5:49 [U-Boot] [PATCH 0/2] imx: ventana: Add pci fixup for PLX switch Tim Harvey
@ 2014-08-08 5:49 ` Tim Harvey
2014-09-09 14:17 ` Stefano Babic
2014-08-08 5:49 ` [U-Boot] [PATCH 2/2] imx: ventana: add pci fixup for PLX PEX860x switch GPIO Tim Harvey
2014-08-21 6:37 ` [U-Boot] [PATCH 0/2] imx: ventana: Add pci fixup for PLX switch Tim Harvey
2 siblings, 1 reply; 7+ messages in thread
From: Tim Harvey @ 2014-08-08 5:49 UTC (permalink / raw)
To: u-boot
Some board-level drivers may wish to have per-device fixup functions
for PCI devices.
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
drivers/pci/pci.c | 4 ++++
include/pci.h | 7 +++++++
2 files changed, 11 insertions(+)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index ed113bf..e269468 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -648,6 +648,10 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)
pci_hose_read_config_word(hose, dev, PCI_DEVICE_ID, &device);
pci_hose_read_config_word(hose, dev, PCI_CLASS_DEVICE, &class);
+#ifdef CONFIG_PCI_FIXUP_DEV
+ board_pci_fixup_dev(hose, dev, vendor, device, class);
+#endif
+
#ifdef CONFIG_PCI_SCAN_SHOW
indent++;
diff --git a/include/pci.h b/include/pci.h
index 461f17c..2ff7365 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -659,6 +659,13 @@ extern int pci_hose_find_cap_start(struct pci_controller *hose, pci_dev_t dev,
extern int pci_find_cap(struct pci_controller *hose, pci_dev_t dev, int pos,
int cap);
+#ifdef CONFIG_PCI_FIXUP_DEV
+extern void board_pci_fixup_dev(struct pci_controller *hose, pci_dev_t dev,
+ unsigned short vendor,
+ unsigned short device,
+ unsigned short class);
+#endif
+
const char * pci_class_str(u8 class);
int pci_last_busno(void);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] imx: ventana: add pci fixup for PLX PEX860x switch GPIO
2014-08-08 5:49 [U-Boot] [PATCH 0/2] imx: ventana: Add pci fixup for PLX switch Tim Harvey
2014-08-08 5:49 ` [U-Boot] [PATCH 1/2] pci: add support for board_pci_fixup_dev function Tim Harvey
@ 2014-08-08 5:49 ` Tim Harvey
2014-09-09 14:17 ` Stefano Babic
2014-08-21 6:37 ` [U-Boot] [PATCH 0/2] imx: ventana: Add pci fixup for PLX switch Tim Harvey
2 siblings, 1 reply; 7+ messages in thread
From: Tim Harvey @ 2014-08-08 5:49 UTC (permalink / raw)
To: u-boot
Most Gateworks Ventana boards use a PLX PEX860x PCIe switch for PCIe expansion.
These boards use GPIO on the PLX device as PERST# for the downstream ports
thus we assert this when the PLX is enumerated.
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
board/gateworks/gw_ventana/gw_ventana.c | 30 ++++++++++++++++++++++++++++++
include/configs/gw_ventana.h | 1 +
2 files changed, 31 insertions(+)
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 70b90d8..186cd38 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -31,6 +31,7 @@
#include <mmc.h>
#include <mtd_node.h>
#include <netdev.h>
+#include <pci.h>
#include <power/pmic.h>
#include <power/ltc3676_pmic.h>
#include <power/pfuze100_pmic.h>
@@ -1092,6 +1093,35 @@ int imx6_pcie_toggle_reset(void)
}
return 0;
}
+
+/*
+ * Most Ventana boards have a PLX PEX860x PCIe switch onboard and use its
+ * GPIO's as PERST# signals for its downstream ports - configure the GPIO's
+ * properly and assert reset for 100ms.
+ */
+void board_pci_fixup_dev(struct pci_controller *hose, pci_dev_t dev,
+ unsigned short vendor, unsigned short device,
+ unsigned short class)
+{
+ u32 dw;
+
+ debug("%s: %02d:%02d.%02d: %04x:%04x\n", __func__,
+ PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev), vendor, device);
+ if (vendor == PCI_VENDOR_ID_PLX &&
+ (device & 0xfff0) == 0x8600 &&
+ PCI_DEV(dev) == 0 && PCI_FUNC(dev) == 0) {
+ debug("configuring PLX 860X downstream PERST#\n");
+ pci_hose_read_config_dword(hose, dev, 0x62c, &dw);
+ dw |= 0xaaa8; /* GPIO1-7 outputs */
+ pci_hose_write_config_dword(hose, dev, 0x62c, dw);
+
+ pci_hose_read_config_dword(hose, dev, 0x644, &dw);
+ dw |= 0xfe; /* GPIO1-7 output high */
+ pci_hose_write_config_dword(hose, dev, 0x644, dw);
+
+ mdelay(100);
+ }
+}
#endif /* CONFIG_CMD_PCI */
#ifdef CONFIG_SERIAL_TAG
diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h
index b991b09..0e5c200 100644
--- a/include/configs/gw_ventana.h
+++ b/include/configs/gw_ventana.h
@@ -141,6 +141,7 @@
#define CONFIG_PCI
#define CONFIG_PCI_PNP
#define CONFIG_PCI_SCAN_SHOW
+#define CONFIG_PCI_FIXUP_DEV
#define CONFIG_PCIE_IMX
#endif
--
1.8.3.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 0/2] imx: ventana: Add pci fixup for PLX switch
2014-08-08 5:49 [U-Boot] [PATCH 0/2] imx: ventana: Add pci fixup for PLX switch Tim Harvey
2014-08-08 5:49 ` [U-Boot] [PATCH 1/2] pci: add support for board_pci_fixup_dev function Tim Harvey
2014-08-08 5:49 ` [U-Boot] [PATCH 2/2] imx: ventana: add pci fixup for PLX PEX860x switch GPIO Tim Harvey
@ 2014-08-21 6:37 ` Tim Harvey
2014-09-09 14:14 ` Stefano Babic
2 siblings, 1 reply; 7+ messages in thread
From: Tim Harvey @ 2014-08-21 6:37 UTC (permalink / raw)
To: u-boot
On Thu, Aug 7, 2014 at 10:49 PM, Tim Harvey <tharvey@gateworks.com> wrote:
> Many of the Gateworks Ventana boards have a PLX PCIe switch where GPIO
> on the switch is used as the PERST# of the downstream ports. In the Linux
> kernel there is a PCI fixup that asserts these properly when the upstream
> port is enumerated.
>
> The first patch in this serial adds a board_pci_fixup_dev function define
> to allow hooking similarly to the kernel pci fixup functionality.
>
> The second patch uses the board_pci_fixup_dev function to perform the
> GPIO configuration on the switch for the downstream ports.
>
> Tim Harvey (2):
> pci: add support for board_pci_fixup_dev function
> imx: ventana: add pci fixup for PLX PEX860x switch GPIO
>
> board/gateworks/gw_ventana/gw_ventana.c | 30 ++++++++++++++++++++++++++++++
> drivers/pci/pci.c | 4 ++++
> include/configs/gw_ventana.h | 1 +
> include/pci.h | 7 +++++++
> 4 files changed, 42 insertions(+)
>
> --
> 1.8.3.2
>
Any comments on these? I'm wondering if there is someone else I should
be including with regards to reviewing pci changes.
Regards,
Tim
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 0/2] imx: ventana: Add pci fixup for PLX switch
2014-08-21 6:37 ` [U-Boot] [PATCH 0/2] imx: ventana: Add pci fixup for PLX switch Tim Harvey
@ 2014-09-09 14:14 ` Stefano Babic
0 siblings, 0 replies; 7+ messages in thread
From: Stefano Babic @ 2014-09-09 14:14 UTC (permalink / raw)
To: u-boot
On 21/08/2014 08:37, Tim Harvey wrote:
> On Thu, Aug 7, 2014 at 10:49 PM, Tim Harvey <tharvey@gateworks.com> wrote:
>> Many of the Gateworks Ventana boards have a PLX PCIe switch where GPIO
>> on the switch is used as the PERST# of the downstream ports. In the Linux
>> kernel there is a PCI fixup that asserts these properly when the upstream
>> port is enumerated.
>>
>> The first patch in this serial adds a board_pci_fixup_dev function define
>> to allow hooking similarly to the kernel pci fixup functionality.
>>
>> The second patch uses the board_pci_fixup_dev function to perform the
>> GPIO configuration on the switch for the downstream ports.
>>
>> Tim Harvey (2):
>> pci: add support for board_pci_fixup_dev function
>> imx: ventana: add pci fixup for PLX PEX860x switch GPIO
>>
>> board/gateworks/gw_ventana/gw_ventana.c | 30 ++++++++++++++++++++++++++++++
>> drivers/pci/pci.c | 4 ++++
>> include/configs/gw_ventana.h | 1 +
>> include/pci.h | 7 +++++++
>> 4 files changed, 42 insertions(+)
>>
>> --
>> 1.8.3.2
>>
>
> Any comments on these? I'm wondering if there is someone else I should
> be including with regards to reviewing pci changes.
>
No comment, and I do not see any bad influence on other boards - I am
going to apply them.
Regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] pci: add support for board_pci_fixup_dev function
2014-08-08 5:49 ` [U-Boot] [PATCH 1/2] pci: add support for board_pci_fixup_dev function Tim Harvey
@ 2014-09-09 14:17 ` Stefano Babic
0 siblings, 0 replies; 7+ messages in thread
From: Stefano Babic @ 2014-09-09 14:17 UTC (permalink / raw)
To: u-boot
Hi Tim,
On 08/08/2014 07:49, Tim Harvey wrote:
> Some board-level drivers may wish to have per-device fixup functions
> for PCI devices.
>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] imx: ventana: add pci fixup for PLX PEX860x switch GPIO
2014-08-08 5:49 ` [U-Boot] [PATCH 2/2] imx: ventana: add pci fixup for PLX PEX860x switch GPIO Tim Harvey
@ 2014-09-09 14:17 ` Stefano Babic
0 siblings, 0 replies; 7+ messages in thread
From: Stefano Babic @ 2014-09-09 14:17 UTC (permalink / raw)
To: u-boot
Hi Tim,
On 08/08/2014 07:49, Tim Harvey wrote:
> Most Gateworks Ventana boards use a PLX PEX860x PCIe switch for PCIe expansion.
> These boards use GPIO on the PLX device as PERST# for the downstream ports
> thus we assert this when the PLX is enumerated.
>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-09-09 14:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-08 5:49 [U-Boot] [PATCH 0/2] imx: ventana: Add pci fixup for PLX switch Tim Harvey
2014-08-08 5:49 ` [U-Boot] [PATCH 1/2] pci: add support for board_pci_fixup_dev function Tim Harvey
2014-09-09 14:17 ` Stefano Babic
2014-08-08 5:49 ` [U-Boot] [PATCH 2/2] imx: ventana: add pci fixup for PLX PEX860x switch GPIO Tim Harvey
2014-09-09 14:17 ` Stefano Babic
2014-08-21 6:37 ` [U-Boot] [PATCH 0/2] imx: ventana: Add pci fixup for PLX switch Tim Harvey
2014-09-09 14:14 ` Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox