Skip to contentSkip to conversation

Add PCIe root complex support for AM654x SoC

PATCH Superseded Sekhar Nori 3 participants 14 messages Jun 3, 2019 – Aug 1, 2019

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add PCIe root complex support for AM654x SoC

Hi,

This patch series adds PCIe root complex support for AM654x SoC.

The device-tree files are based on bindings accepted in linux. See files Documentation/devicetree/bindings/phy/ti,phy-am654-serdes.txt and Documentation/devicetree/bindings/pci/pci-keystone.txt in latest mainline master.

I have not posted the actual board-specific device-tree bits yet. The reason is that PCIe slot is on a daughter card on the AM65x EVM. I want to see how we can support that as an overlay in U-Boot. That needs some more attention. Meanwhile I have tested this using a patch that simply enables PCIe in the baseboard device-tree file itself.

v2:
- add unit tests for new clock and dm APIs introduced
- add Lokesh's Reviewed-by: for patches #1 and #2

Sekhar Nori (7):
clk: add support for clk_is_match()
dm: core: add support for getting register address and size
pcie: ti: add driver for AM65x PCIe RC
phy: add support for AM654x SERDES
configs: am65x_evm_a53: enable PCIe support
arm: dts: k3-am65: add support for PCIe and SERDES
configs: am65x_evm_a53: enable support for PCIe ethernet cards

 arch/arm/dts/k3-am65-main.dtsi             | 108 +++++
 arch/arm/dts/k3-am65.dtsi                  |   1 +
 configs/am65x_evm_a53_defconfig            |   9 +
 drivers/clk/clk-uclass.c                   |  13 +
 drivers/core/fdtaddr.c                     |  17 +
 drivers/core/read.c                        |  20 +
 drivers/pci/Kconfig                        |   6 +
 drivers/pci/Makefile                       |   1 +
 drivers/pci/pcie_dw_ti.c                   | 725 +++++++++++++++++++++++++++++
 drivers/phy/Kconfig                        |   9 +
 drivers/phy/Makefile                       |   1 +
 drivers/phy/phy-ti-am654.c                 | 411 ++++++++++++++++
 include/clk.h                              |  13 +
 include/dm/fdtaddr.h                       |  18 +
 include/dm/read.h                          |  41 ++
 include/dt-bindings/phy/phy-am654-serdes.h |  13 +
 test/dm/clk.c                              |   1 +
 test/dm/test-fdt.c                         |  16 +-
 18 files changed, 1419 insertions(+), 4 deletions(-)
 create mode 100644 drivers/pci/pcie_dw_ti.c
 create mode 100644 drivers/phy/phy-ti-am654.c
 create mode 100644 include/dt-bindings/phy/phy-am654-serdes.h
Signature · 1 line
2.16.2
#1 lore raw

PATCH v2 1/7 clk: add support for clk_is_match()

Add support for clk_is_match() which is required to know if two clock pointers point to the same exact physical clock.

Also add a unit test for the new API.

---
 drivers/clk/clk-uclass.c | 13 +++++++++++++
 include/clk.h            | 13 +++++++++++++
 test/dm/clk.c            |  1 +
 3 files changed, 27 insertions(+)
drivers/clk/clk-uclass.c +13 -0
index 79b3b0494c65..823be2bcb624 100644
@@ -453,6 +453,19 @@ int clk_disable_bulk(struct clk_bulk *bulk)
 	return 0;
 }
 
+bool clk_is_match(const struct clk *p, const struct clk *q)
+{
+	/* trivial case: identical struct clk's or both NULL */
+	if (p == q)
+		return true;
+
+	/* same device, id and data */
+	if (p->dev == q->dev && p->id == q->id && p->data == q->data)
+		return true;
+
+	return false;
+}
+
 UCLASS_DRIVER(clk) = {
 	.id		= UCLASS_CLK,
 	.name		= "clk",
include/clk.h +13 -0
index d24e99713a35..e657da038398 100644
@@ -309,6 +309,18 @@ int clk_disable(struct clk *clk);
  */
 int clk_disable_bulk(struct clk_bulk *bulk);
 
+/**
+ * clk_is_match - check if two clk's point to the same hardware clock
+ * @p: clk compared against q
+ * @q: clk compared against p
+ *
+ * Returns true if the two struct clk pointers both point to the same hardware
+ * clock node.
+ *
+ * Returns false otherwise. Note that two NULL clks are treated as matching.
+ */
+bool clk_is_match(const struct clk *p, const struct clk *q);
+
 int soc_clk_dump(void);
 
 /**
@@ -321,4 +333,5 @@ static inline bool clk_valid(struct clk *clk)
 {
 	return !!clk->dev;
 }
+
 #endif
test/dm/clk.c +1 -0
index f301ecbb459d..8468fd45d464 100644
@@ -24,6 +24,7 @@ static int dm_test_clk_base(struct unit_test_state *uts)
 	/* Get the same clk port in 2 different ways and compare */
 	ut_assertok(clk_get_by_index(dev, 1, &clk_method1));
 	ut_assertok(clk_get_by_index_nodev(dev_ofnode(dev), 1, &clk_method2));
+	ut_assertok(clk_is_match(&clk_method1, &clk_method2));
 	ut_asserteq(clk_method1.id, clk_method2.id);
 
 	return 0;
Signature · 1 line
2.16.2
#2 lore raw

PATCH v2 1/7 clk: add support for clk_is_match()

Quoted 7 lines · Sekhar Nori

Add support for clk_is_match() which is required to know if two clock pointers point to the same exact physical clock.

Also add a unit test for the new API.

Quoted 7 lines
---
 drivers/clk/clk-uclass.c | 13 +++++++++++++
 include/clk.h            | 13 +++++++++++++
 test/dm/clk.c            |  1 +
 3 files changed, 27 insertions(+)
#3 lore raw

PATCH v2 1/7 clk: add support for clk_is_match()

In reply to Sekhar Nori
Quoted 6 lines · Sekhar Nori

Add support for clk_is_match() which is required to know if two clock pointers point to the same exact physical clock.

Also add a unit test for the new API.

Quoted 8 lines
---
 drivers/clk/clk-uclass.c | 13 +++++++++++++
 include/clk.h            | 13 +++++++++++++
 test/dm/clk.c            |  1 +
 3 files changed, 27 insertions(+)

This test currently fails in sandbox, please address, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190726/69f566d1/attachment.sig>
#4 lore raw

PATCH v2 1/7 clk: add support for clk_is_match()

Hi Tom,

Quoted 17 lines · Tom Rini
Quoted 6 lines · Sekhar Nori

Add support for clk_is_match() which is required to know if two clock pointers point to the same exact physical clock.

Also add a unit test for the new API.

Quoted 8 lines
---
 drivers/clk/clk-uclass.c | 13 +++++++++++++
 include/clk.h            | 13 +++++++++++++
 test/dm/clk.c            |  1 +
 3 files changed, 27 insertions(+)
Quoted 1 line

This test currently fails in sandbox, please address, thanks!

Do you have this patch applied?

https://patchwork.ozlabs.org/patch/1130714/

The test had passed for me when I submitted the patches. Later on I discovered the issue the patch above fixes (on actual hardware).

This might be the same thing you are seeing on sandbox too.

Thanks,
Sekhar

#5 lore raw

PATCH v2 1/7 clk: add support for clk_is_match()

Quoted 22 lines · Sekhar Nori

Hi Tom,

Quoted 17 lines · Tom Rini
Quoted 6 lines · Sekhar Nori

Add support for clk_is_match() which is required to know if two clock pointers point to the same exact physical clock.

Also add a unit test for the new API.

Quoted 8 lines
---
 drivers/clk/clk-uclass.c | 13 +++++++++++++
 include/clk.h            | 13 +++++++++++++
 test/dm/clk.c            |  1 +
 3 files changed, 27 insertions(+)
Quoted 1 line

This test currently fails in sandbox, please address, thanks!

Quoted 8 lines

Do you have this patch applied?

https://patchwork.ozlabs.org/patch/1130714/

The test had passed for me when I submitted the patches. Later on I discovered the issue the patch above fixes (on actual hardware).

This might be the same thing you are seeing on sandbox too.

Yes, that patch is applied (I just re-checked), thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190729/07dc43fd/attachment.sig>
#6 lore raw

PATCH v2 1/7 clk: add support for clk_is_match()

Quoted 25 lines · Tom Rini
Quoted 24 lines · Sekhar Nori

Hi Tom,

Quoted 17 lines · Tom Rini
Quoted 6 lines · Sekhar Nori

Add support for clk_is_match() which is required to know if two clock pointers point to the same exact physical clock.

Also add a unit test for the new API.

Quoted 8 lines
---
 drivers/clk/clk-uclass.c | 13 +++++++++++++
 include/clk.h            | 13 +++++++++++++
 test/dm/clk.c            |  1 +
 3 files changed, 27 insertions(+)
Quoted 1 line

This test currently fails in sandbox, please address, thanks!

Do you have this patch applied?

Quoted 8 lines
Quoted 6 lines

https://patchwork.ozlabs.org/patch/1130714/

The test had passed for me when I submitted the patches. Later on I discovered the issue the patch above fixes (on actual hardware).

This might be the same thing you are seeing on sandbox too.

Yes, that patch is applied (I just re-checked), thanks!

Tom, this was a real issue. I sent a v3. Not sure how it passed when I originally added the unit test. Anyway..

Thanks,
Sekhar

#7 lore raw

PATCH v2 2/7 dm: core: add support for getting register address and size

In reply to Sekhar Nori

Current dev_read_*() API lacks support to get address and size of a "reg" property by name or index. Add support for the same.

Livetree support has been added but not tested on real hardware.

The existing unit tests testing reading address from device-tree have been updated to test address as well as size.

---
 drivers/core/fdtaddr.c | 17 +++++++++++++++++
 drivers/core/read.c    | 20 ++++++++++++++++++++
 include/dm/fdtaddr.h   | 18 ++++++++++++++++++
 include/dm/read.h      | 41 +++++++++++++++++++++++++++++++++++++++++
 test/dm/test-fdt.c     | 16 ++++++++++++----
 5 files changed, 108 insertions(+), 4 deletions(-)
drivers/core/fdtaddr.c +17 -0
index c2873861dacd..6850003a287b 100644
@@ -129,6 +129,23 @@ fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name)
 #endif
 }
 
+fdt_addr_t devfdt_get_addr_size_name(struct udevice *dev, const char *name,
+				     fdt_size_t *size)
+{
+#if CONFIG_IS_ENABLED(OF_CONTROL)
+	int index;
+
+	index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
+				      "reg-names", name);
+	if (index < 0)
+		return index;
+
+	return devfdt_get_addr_size_index(dev, index, size);
+#else
+	return FDT_ADDR_T_NONE;
+#endif
+}
+
 fdt_addr_t devfdt_get_addr(struct udevice *dev)
 {
 	return devfdt_get_addr_index(dev, 0);
drivers/core/read.c +20 -0
index 6bda077a34b9..0fcd20874610 100644
@@ -82,6 +82,15 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)
 		return devfdt_get_addr_index(dev, index);
 }
 
+fdt_addr_t dev_read_addr_size_index(struct udevice *dev, int index,
+				    fdt_size_t *size)
+{
+	if (ofnode_is_np(dev_ofnode(dev)))
+		return ofnode_get_addr_size_index(dev_ofnode(dev), index, size);
+	else
+		return devfdt_get_addr_size_index(dev, index, size);
+}
+
 void *dev_remap_addr_index(struct udevice *dev, int index)
 {
 	fdt_addr_t addr = dev_read_addr_index(dev, index);
@@ -102,6 +111,17 @@ fdt_addr_t dev_read_addr_name(struct udevice *dev, const char *name)
 		return dev_read_addr_index(dev, index);
 }
 
+fdt_addr_t dev_read_addr_size_name(struct udevice *dev, const char *name,
+				   fdt_size_t *size)
+{
+	int index = dev_read_stringlist_search(dev, "reg-names", name);
+
+	if (index < 0)
+		return FDT_ADDR_T_NONE;
+	else
+		return dev_read_addr_size_index(dev, index, size);
+}
+
 void *dev_remap_addr_name(struct udevice *dev, const char *name)
 {
 	fdt_addr_t addr = dev_read_addr_name(dev, name);
include/dm/fdtaddr.h +18 -0
index 3bc2599b6cbd..57b326cb3362 100644
@@ -120,4 +120,22 @@ fdt_addr_t devfdt_get_addr_size_index(struct udevice *dev, int index,
  */
 fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name);
 
+/**
+ * devfdt_get_addr_size_name() - Get the reg property and its size for a device,
+ *				 indexed by name
+ *
+ * Returns the address and size specified in the 'reg' property of a device.
+ *
+ * @dev: Pointer to a device
+ * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
+ *	  'reg-names' property providing named-based identification. @index
+ *	  indicates the value to search for in 'reg-names'.
+ * @size: Pointer to size variable - this function returns the size
+ *        specified in the 'reg' property here
+ *
+ * @return addr
+ */
+fdt_addr_t devfdt_get_addr_size_name(struct udevice *dev, const char *name,
+				     fdt_size_t *size);
+
 #endif
include/dm/read.h +41 -0

65 lines not on this page · raw message

test/dm/test-fdt.c +12 -4
index be16c99e170e..939144afe61f 100644
@@ -537,12 +537,14 @@ static int dm_test_fdt_remap_addr_index_flat(struct unit_test_state *uts)
 {
 	struct udevice *dev;
 	fdt_addr_t addr;
+	fdt_size_t size;
 	void *paddr;
 
 	ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
 
-	addr = devfdt_get_addr_index(dev, 0);
+	addr = devfdt_get_addr_size_index(dev, 0, &size);
 	ut_asserteq(0x8000, addr);
+	ut_asserteq(0x1000, size);
 
 	paddr = map_physmem(addr, 0, MAP_NOCACHE);
 	ut_assertnonnull(paddr);
@@ -557,12 +559,14 @@ static int dm_test_fdt_remap_addr_name_flat(struct unit_test_state *uts)
 {
 	struct udevice *dev;
 	fdt_addr_t addr;
+	fdt_size_t size;
 	void *paddr;
 
 	ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
 
-	addr = devfdt_get_addr_name(dev, "sandbox-dummy-0");
+	addr = devfdt_get_addr_size_name(dev, "sandbox-dummy-0", &size);
 	ut_asserteq(0x8000, addr);
+	ut_asserteq(0x1000, size);
 
 	paddr = map_physmem(addr, 0, MAP_NOCACHE);
 	ut_assertnonnull(paddr);
@@ -597,12 +601,14 @@ static int dm_test_fdt_remap_addr_index_live(struct unit_test_state *uts)
 {
 	struct udevice *dev;
 	fdt_addr_t addr;
+	fdt_size_t size;
 	void *paddr;
 
 	ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
 
-	addr = dev_read_addr_index(dev, 0);
+	addr = dev_read_addr_size_index(dev, 0, &size);
 	ut_asserteq(0x8000, addr);
+	ut_asserteq(0x1000, size);
 
 	paddr = map_physmem(addr, 0, MAP_NOCACHE);
 	ut_assertnonnull(paddr);
@@ -617,12 +623,14 @@ static int dm_test_fdt_remap_addr_name_live(struct unit_test_state *uts)
 {
 	struct udevice *dev;
 	fdt_addr_t addr;
+	fdt_size_t size;
 	void *paddr;
 
 	ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
 
-	addr = dev_read_addr_name(dev, "sandbox-dummy-0");
+	addr = dev_read_addr_size_name(dev, "sandbox-dummy-0", &size);
 	ut_asserteq(0x8000, addr);
+	ut_asserteq(0x1000, size);
 
 	paddr = map_physmem(addr, 0, MAP_NOCACHE);
 	ut_assertnonnull(paddr);
Signature · 1 line
2.16.2
#8 lore raw

PATCH v2 2/7 dm: core: add support for getting register address and size

Quoted 11 lines · Sekhar Nori

Current dev_read_*() API lacks support to get address and size of a "reg" property by name or index. Add support for the same.

Livetree support has been added but not tested on real hardware.

The existing unit tests testing reading address from device-tree have been updated to test address as well as size.

Quoted 8 lines
---
 drivers/core/fdtaddr.c | 17 +++++++++++++++++
 drivers/core/read.c    | 20 ++++++++++++++++++++
 include/dm/fdtaddr.h   | 18 ++++++++++++++++++
 include/dm/read.h      | 41 +++++++++++++++++++++++++++++++++++++++++
 test/dm/test-fdt.c     | 16 ++++++++++++----
 5 files changed, 108 insertions(+), 4 deletions(-)
#9 lore raw

PATCH v2 3/7 pcie: ti: add driver for AM65x PCIe RC

In reply to Sekhar Nori

Add driver supporting PCIe root-complex available
on TI's AM65x SoC.

---
 drivers/pci/Kconfig      |   6 +
 drivers/pci/Makefile     |   1 +
 drivers/pci/pcie_dw_ti.c | 725 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 732 insertions(+)
 create mode 100644 drivers/pci/pcie_dw_ti.c
drivers/pci/Kconfig +6 -0
index 429bb836a8a0..1cb96634e7fe 100644
@@ -137,4 +137,10 @@ config PCI_MVEBU
 	  Say Y here if you want to enable PCIe controller support on
 	  Armada XP/38x SoCs.
 
+config PCI_KEYSTONE
+	bool "TI Keystone PCIe controller"
+	depends on DM_PCI
+	help
+	  Say Y here if you want to enable PCI controller support on AM654 SoC.
+
 endif
drivers/pci/Makefile +1 -0
index bd392edba179..151aa3f1569d 100644
@@ -37,3 +37,4 @@ obj-$(CONFIG_PCIE_LAYERSCAPE_GEN4) += pcie_layerscape_gen4.o \
 				pcie_layerscape_gen4_fixup.o
 obj-$(CONFIG_PCI_XILINX) += pcie_xilinx.o
 obj-$(CONFIG_PCIE_INTEL_FPGA) += pcie_intel_fpga.o
+obj-$(CONFIG_PCI_KEYSTONE) += pcie_dw_ti.o
drivers/pci/pcie_dw_ti.c new file +725 -0

725 lines not on this page · raw message

Signature · 1 line
2.16.2
#10 lore raw

PATCH v2 4/7 phy: add support for AM654x SERDES

In reply to Sekhar Nori

Add a new SERDES driver for TI's AM654x SoC which configures the SERDES only for PCIe. Support fo USB3 can be added later.

SERDES in am654x has three input clocks (left input, external reference clock and right input) and two output clocks (left output and right output) in addition to a PLL mux clock which the SERDES uses for Clock Multiplier Unit (CMU refclock).

The PLL mux clock can select from one of the three input clocks. The right output can select between left input and external reference clock while the left output can select between the right input and external reference clock.

The driver has support to select PLL mux and left/right output mux as specified in device tree.

---
 drivers/phy/Kconfig        |   9 +
 drivers/phy/Makefile       |   1 +
 drivers/phy/phy-ti-am654.c | 411 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 421 insertions(+)
 create mode 100644 drivers/phy/phy-ti-am654.c
drivers/phy/Kconfig +9 -0
index 957efb3984bf..cce98448a4b5 100644
@@ -102,6 +102,15 @@ config SPL_PIPE3_PHY
 	  This PHY is found on omap devices supporting SATA such as dra7, am57x
 	  and omap5
 
+config AM654_PHY
+	tristate "TI AM654 SERDES support"
+	depends on PHY && ARCH_K3
+	select REGMAP
+	select SYSCON
+	help
+	  This option enables support for TI AM654 SerDes PHY used for
+	  PCIe.
+
 config STI_USB_PHY
 	bool "STMicroelectronics USB2 picoPHY driver for STiH407 family"
 	depends on PHY && ARCH_STI
drivers/phy/Makefile +1 -0
index 90646ca55b9d..39da13c4c941 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_BCM6358_USBH_PHY) += bcm6358-usbh-phy.o
 obj-$(CONFIG_BCM6368_USBH_PHY) += bcm6368-usbh-phy.o
 obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o
 obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.o
+obj-$(CONFIG_AM654_PHY) += phy-ti-am654.o
 obj-$(CONFIG_STI_USB_PHY) += sti_usb_phy.o
 obj-$(CONFIG_PHY_RCAR_GEN2) += phy-rcar-gen2.o
 obj-$(CONFIG_PHY_RCAR_GEN3) += phy-rcar-gen3.o
drivers/phy/phy-ti-am654.c new file +411 -0

411 lines not on this page · raw message

Signature · 1 line
2.16.2
#11 lore raw

PATCH v2 5/7 configs: am65x_evm_a53: enable PCIe support

In reply to Sekhar Nori

Enable support for PCIe and related configurations on AM654 EVM platform.

---
 configs/am65x_evm_a53_defconfig | 6 ++++++
 1 file changed, 6 insertions(+)
configs/am65x_evm_a53_defconfig +6 -0
index 41cf0100fa3a..7745e2038790 100644
@@ -31,6 +31,7 @@ CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_CMD_ASKENV=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
 CONFIG_CMD_REMOTEPROC=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_TIME=y
@@ -58,6 +59,11 @@ CONFIG_K3_SEC_PROXY=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_K3_ARASAN=y
+CONFIG_PHY=y
+CONFIG_PCI=y
+CONFIG_DM_PCI=y
+CONFIG_PCI_KEYSTONE=y
+CONFIG_AM654_PHY=y
 CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_GENERIC is not set
 CONFIG_SPL_PINCTRL=y
Signature · 1 line
2.16.2
#12 lore raw

PATCH v2 6/7 arm: dts: k3-am65: add support for PCIe and SERDES

In reply to Sekhar Nori

Add needed device-tree nodes to support PCIe 0
and SERDES on AM65x SoC. The nodes are kept
disabled by default.

---
 arch/arm/dts/k3-am65-main.dtsi             | 108 +++++++++++++++++++++++++++++
 arch/arm/dts/k3-am65.dtsi                  |   1 +
 include/dt-bindings/phy/phy-am654-serdes.h |  13 ++++
 3 files changed, 122 insertions(+)
 create mode 100644 include/dt-bindings/phy/phy-am654-serdes.h
arch/arm/dts/k3-am65-main.dtsi +108 -0
index adcd6341e40c..a564b277c357 100644
@@ -5,6 +5,9 @@
  * Copyright (C) 2016-2018 Texas Instruments Incorporated - http://www.ti.com/
  */
 
+#include <dt-bindings/phy/phy-am654-serdes.h>
+#include <dt-bindings/phy/phy.h>
+
 &cbass_main {
 	gic500: interrupt-controller at 1800000 {
 		compatible = "arm,gic-v3";
@@ -69,4 +72,109 @@
 		clock-frequency = <48000000>;
 		current-speed = <115200>;
 	};
+
+	scm_conf: scm_conf at 100000 {
+		compatible = "syscon", "simple-mfd";
+		reg = <0 0x00100000 0 0x1c000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0x0 0x0 0x00100000 0x1c000>;
+
+		serdes_mux: mux-controller {
+			compatible = "mmio-mux";
+			#mux-control-cells = <1>;
+			mux-reg-masks = <0x4080 0x3>, /* SERDES0 lane select */
+					<0x4090 0x3>; /* SERDES1 lane select */
+		};
+
+		pcie0_mode: pcie-mode at 4060 {
+			compatible = "syscon";
+			reg = <0x00004060 0x4>;
+		};
+
+		pcie1_mode: pcie-mode at 4070 {
+			compatible = "syscon";
+			reg = <0x00004070 0x4>;
+		};
+
+		serdes0_clk: serdes_clk at 4080 {
+			compatible = "syscon";
+			reg = <0x00004080 0x4>;
+		};
+
+		serdes1_clk: serdes_clk at 4090 {
+			compatible = "syscon";
+			reg = <0x00004090 0x4>;
+		};
+
+		pcie_devid: pcie-devid at 210 {
+			compatible = "syscon";
+			reg = <0x00000210 0x4>;
+		};
+	};
+
+	serdes0: serdes at 900000 {
+		compatible = "ti,phy-am654-serdes";
+		reg = <0x0 0x900000 0x0 0x2000>;
+		reg-names = "serdes";
+		#phy-cells = <2>;
+		power-domains = <&k3_pds 153>;
+		clocks = <&k3_clks 153 4>, <&k3_clks 153 1>, <&serdes1 AM654_SERDES_LO_REFCLK>;
+		clock-output-names = "serdes0_cmu_refclk", "serdes0_lo_refclk", "serdes0_ro_refclk";
+		assigned-clocks = <&k3_clks 153 4>, <&serdes0 AM654_SERDES_CMU_REFCLK>;
+		assigned-clock-parents = <&k3_clks 153 8>, <&k3_clks 153 4>;
+		ti,serdes-clk = <&serdes0_clk>;
+		mux-controls = <&serdes_mux 0>;
+		#clock-cells = <1>;
+	};
+
+	serdes1: serdes at 910000 {
+		compatible = "ti,phy-am654-serdes";
+		reg = <0x0 0x910000 0x0 0x2000>;
+		reg-names = "serdes";
+		#phy-cells = <2>;
+		power-domains = <&k3_pds 154>;
+		clocks = <&serdes0 AM654_SERDES_RO_REFCLK>, <&k3_clks 154 1>, <&k3_clks 154 5>;
+		clock-output-names = "serdes1_cmu_refclk", "serdes1_lo_refclk", "serdes1_ro_refclk";
+		assigned-clocks = <&k3_clks 154 5>, <&serdes1 AM654_SERDES_CMU_REFCLK>;
+		assigned-clock-parents = <&k3_clks 154 9>, <&k3_clks 154 5>;
+		ti,serdes-clk = <&serdes1_clk>;
+		mux-controls = <&serdes_mux 1>;
+		#clock-cells = <1>;
+	};
+
+	pcie0_rc: pcie at 5500000 {
+		compatible = "ti,am654-pcie-rc";
+		reg =  <0x0 0x5500000 0x0 0x1000>, <0x0 0x5501000 0x0 0x1000>, <0x0 0x10000000 0x0 0x2000>, <0x0 0x5506000 0x0 0x1000>;
+		reg-names = "app", "dbics", "config", "atu";
+		power-domains = <&k3_pds 120>;
+		#address-cells = <3>;
+		#size-cells = <2>;
+		ranges = <0x81000000 0 0          0x0   0x10020000 0 0x00010000
+			  0x82000000 0 0x10030000 0x0   0x10030000 0 0x07FD0000>;
+		ti,syscon-pcie-id = <&pcie_devid>;
+		ti,syscon-pcie-mode = <&pcie0_mode>;
+		bus-range = <0x0 0xff>;
+		status = "disabled";
+		device_type = "pci";
+		num-lanes = <1>;
+		num-ob-windows = <16>;
+		num-viewport = <16>;
+		max-link-speed = <3>;
+		interrupts = <GIC_SPI 340 IRQ_TYPE_EDGE_RISING>;
+		#interrupt-cells = <1>;
+		interrupt-map-mask = <0 0 0 7>;
+		interrupt-map = <0 0 0 1 &pcie0_intc 0>, /* INT A */
+				<0 0 0 2 &pcie0_intc 0>, /* INT B */
+				<0 0 0 3 &pcie0_intc 0>, /* INT C */
+				<0 0 0 4 &pcie0_intc 0>; /* INT D */
+		msi-map = <0x0 &gic_its 0x0 0x10000>;
+
+		pcie0_intc: legacy-interrupt-controller at 1 {
+			interrupt-controller;
+			#interrupt-cells = <1>;
+			interrupt-parent = <&gic500>;
+			interrupts = <GIC_SPI 328 IRQ_TYPE_EDGE_RISING>;
+		};
+	};
 };
arch/arm/dts/k3-am65.dtsi +1 -0
index 3d4bf369d030..b87081765894 100644
@@ -61,6 +61,7 @@
 			 <0x00 0x00900000 0x00 0x00900000 0x00 0x00012000>, /* serdes */
 			 <0x00 0x01000000 0x00 0x01000000 0x00 0x0af02400>, /* Most peripherals */
 			 <0x00 0x30800000 0x00 0x30800000 0x00 0x0bc00000>, /* MAIN NAVSS */
+			 <0x00 0x10000000 0x00 0x10000000 0x00 0x10000000>, /* PCIe DAT */
 			 /* MCUSS Range */
 			 <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>,
 			 <0x00 0x40200000 0x00 0x40200000 0x00 0x00900100>,
include/dt-bindings/phy/phy-am654-serdes.h new file +13 -0
new file mode 100644
index 000000000000..e8d901729ed9
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * This header provides constants for AM654 SERDES.
+ */
+
+#ifndef _DT_BINDINGS_AM654_SERDES
+#define _DT_BINDINGS_AM654_SERDES
+
+#define AM654_SERDES_CMU_REFCLK	0
+#define AM654_SERDES_LO_REFCLK	1
+#define AM654_SERDES_RO_REFCLK	2
+
+#endif /* _DT_BINDINGS_AM654_SERDES */
Signature · 1 line
2.16.2
#13 lore raw

PATCH v2 7/7 configs: am65x_evm_a53: enable support for PCIe ethernet cards

In reply to Sekhar Nori

Enable support for Intel E1000 based PCIe ethernet cards that can be used to test PCIe RC functionality on AM65x EVM.

---
 configs/am65x_evm_a53_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/am65x_evm_a53_defconfig +3 -0
index 7745e2038790..c1a04257769f 100644
@@ -60,6 +60,9 @@ CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_K3_ARASAN=y
 CONFIG_PHY=y
+CONFIG_DM_ETH=y
+CONFIG_E1000=y
+CONFIG_CMD_E1000=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_PCI_KEYSTONE=y
Signature · 1 line
2.16.2