Add PCIe root complex support for AM654x SoC
Subsystems (5)
v3 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.
v3:
- fix unit test for clk_is_match()
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 | 8 + 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 | 12 + 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, 1417 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
PATCH v3 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 | 12 ++++++++++++ test/dm/clk.c | 1 + 3 files changed, 26 insertions(+)
drivers/clk/clk-uclass.c +13 -0
@@ -515,6 +515,19 @@ int clk_get_by_id(ulong id, struct clk **clkp)return -ENOENT ; } +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 +12 -0
@@ -333,6 +333,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 );/**
test/dm/clk.c +1 -0
@@ -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_asserteq (clk_is_match (&clk_method1, &clk_method2), true);ut_asserteq (clk_method1.id, clk_method2.id);return 0 ;
Signature · 1 line
2.16.2
PATCH v3 1/7 clk: add support for clk_is_match()
Hi Sekhar,
Quoted 4 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.
I would suggest adding a note that this is inspired from the clk_is_match() implementation from the Linux kernel.
Thanks
PATCH v3 1/7 clk: add support for clk_is_match()
Hi Fabio,
Quoted 10 lines · Fabio Estevam
Hi Sekhar,
Quoted 4 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.I would suggest adding a note that this is inspired from the
clk_is_match()implementation from the Linux kernel.
Sure. I assume this goes into the commit description?
Tom, should I resend or this is something that you can fix while applying?
Thanks,
Sekhar
PATCH v3 1/7 clk: add support for clk_is_match()
Hi Sekhar,
Quoted 1 line · Sekhar Nori
Sure. I assume this goes into the commit description?
Yes, correct. Thanks
PATCH v3 1/7 clk: add support for clk_is_match()
In reply to Sekhar NoriQuoted 11 lines · Sekhar Nori
Hi Fabio,
Quoted 8 lines · Fabio Estevam
Hi Sekhar,
Quoted 4 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.
Quoted 6 lines
Quoted 2 lines
I would suggest adding a note that this is inspired from the
clk_is_match()implementation from the Linux kernel.Sure. I assume this goes into the commit description?
Tom, should I resend or this is something that you can fix while applying?
Please v4 this part as I'm sure I'll otherwise forget, 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/20190801/c115fd6e/attachment.sig>
PATCH v3 1/7 clk: add support for clk_is_match()
In reply to Sekhar NoriQuoted 8 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.
Reviewed-by Lokesh Vutla <[email protected]>Signed-off-by Sekhar Nori <[email protected]>
Applied to u-boot/master, 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/20190813/914dadcb/attachment.sig>
PATCH v3 2/7 dm: core: add support for getting register address and size
In reply to Sekhar NoriCurrent 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
@@ -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
@@ -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
@@ -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
@@ -549,12 +549,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);
@@ -569,12 +571,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);
@@ -609,12 +613,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);
@@ -629,12 +635,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
PATCH v3 2/7 dm: core: add support for getting register address and size
Quoted 68 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.
Reviewed-by Lokesh Vutla <[email protected]>Signed-off-by Sekhar Nori <[email protected]>--- 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@@ -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 +9
-0@@ -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);
drivers/core/read.c fdt_addr_t dev_read_addr_name(struct udevice *dev, const char *name) · line 112
Quoted 2 lines
drivers/core/read.c +0
-0@@ -102,6 +111,17 @@ fdt_addr_t dev_read_addr_name(struct udevice *dev, const char *name)return dev_read_addr_index (dev, index); }
maybe it makes sense to update the dev_remap_* variants to utilise the new dev_read_addr_* to be able to pass a valid size to map_physmem()? Currently a size of 0 is passed due to the lack of function which you are adding now.
Quoted 189 lines
drivers/core/read.c +11
-0+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@@ -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@@ -144,6 +144,19 @@ int dev_read_size(struct udevice *dev, const char *propname);*/ fdt_addr_t dev_read_addr_index (struct udevice *dev,int index); +/** +* dev_read_addr_size_index() - Get the indexed reg property of a device +* +* @dev: Device to read from +* @index: the 'reg' property can hold a list of <addr, size> pairs +* and @index is used to select which one is required +* @size: place to put size value (on success) +* +* @return address or FDT_ADDR_T_NONE if not found +*/ +fdt_addr_t dev_read_addr_size_index (struct udevice *dev,int index, +fdt_size_t *size); +/** * dev_remap_addr_index() - Get the indexed reg property of a device * as a memory-mapped I/O pointer @@ -168,6 +181,20 @@ void *dev_remap_addr_index(struct udevice *dev, int index);*/ fdt_addr_t dev_read_addr_name (struct udevice *dev,const char * name); +/** +* dev_read_addr_size_name() - Get the reg property of a device, indexed by name +* +* @dev: Device to read from +* @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: place to put size value (on success) +* +* @return address or FDT_ADDR_T_NONE if not found +*/ +fdt_addr_t dev_read_addr_size_name (struct udevice *dev,const char *name, +fdt_size_t *size); +/** * dev_remap_addr_name() - Get the reg property of a device, indexed by name, * as a memory-mapped I/O pointer @@ -601,12 +628,26 @@ static inline fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)return devfdt_get_addr_index (dev, index); } +static inline fdt_addr_t dev_read_addr_size_index (struct udevice *dev, +int index, +fdt_size_t *size) +{ +return devfdt_get_addr_size_index (dev, index, size); +} +static inline fdt_addr_t dev_read_addr_name (struct udevice *dev,const char *name) {return devfdt_get_addr_name (dev, name); } +static inline fdt_addr_t dev_read_addr_size_name (struct udevice *dev, +const char *name, +fdt_size_t *size) +{ +return devfdt_get_addr_size_name (dev, name, size); +} +static inline fdt_addr_t dev_read_addr (struct udevice *dev) {return devfdt_get_addr (dev);test/dm/test-fdt.c +12
-5@@ -549,12 +549,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);@@ -569,12 +571,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);@@ -609,12 +613,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);@@ -629,12 +635,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); --2.16.2
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Signature · 1 line
- Daniel
PATCH v3 2/7 dm: core: add support for getting register address and size
Hi Daniel,
Quoted 20 lines · Daniel Schwierzeck
Quoted 20 lines
drivers/core/read.c +9
-0@@ -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);
Quoted 8 lines
drivers/core/read.c fdt_addr_t dev_read_addr_name(struct udevice *dev, const char *name) · line 112
Quoted 3 lines
drivers/core/read.c +0
-0@@ -102,6 +111,17 @@ fdt_addr_t dev_read_addr_name(struct udevice *dev, const char *name)return dev_read_addr_index (dev, index); }maybe it makes sense to update the dev_remap_* variants to utilise the new dev_read_addr_* to be able to pass a valid size to
map_physmem()? Currently a size of 0 is passed due to the lack of function which you are adding now.
Thanks for pointing that out. I think this is something that can come as a follow-on series. This series itself was supposed to go into 2019.10, but held up due to a stupid bug I introduced.
I will send a v4 today with a commit message change that was asked with the hope that it can get into 2019.10 still.
Thanks,
Sekhar
PATCH v3 2/7 dm: core: add support for getting register address and size
In reply to Sekhar NoriQuoted 10 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.
Reviewed-by Lokesh Vutla <[email protected]>Signed-off-by Sekhar Nori <[email protected]>
Applied to u-boot/master, 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/20190813/bd4f8a4f/attachment.sig>
PATCH v3 3/7 pcie: ti: add driver for AM65x PCIe RC
In reply to Sekhar NoriAdd 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
@@ -145,4 +145,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
@@ -38,3 +38,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
PATCH v3 3/7 pcie: ti: add driver for AM65x PCIe RC
Quoted 4 lines · Sekhar Nori
Add driver supporting PCIe root-complex available
on TI's AM65x SoC.Signed-off-by Sekhar Nori <[email protected]>
Applied to u-boot/master, 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/20190813/3114939a/attachment.sig>
PATCH v3 4/7 phy: add support for AM654x SERDES
In reply to Sekhar NoriAdd 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
@@ -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
@@ -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
PATCH v3 4/7 phy: add support for AM654x SERDES
Quoted 13 lines · 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.
Quoted 4 lines
The driver has support to select PLL mux and left/right output mux as specified in device tree.
Signed-off-by Sekhar Nori <[email protected]>
Applied to u-boot/master, 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/20190813/7f842ab5/attachment.sig>
PATCH v3 5/7 configs: am65x_evm_a53: enable PCIe support
In reply to Sekhar NoriEnable support for PCIe and related configurations on AM654 EVM platform.
--- configs/am65x_evm_a53_defconfig | 5 +++++ 1 file changed, 5 insertions(+)
configs/am65x_evm_a53_defconfig +5 -0
@@ -35,6 +35,7 @@ CONFIG_CMD_ASKENV=y CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_PCI=y CONFIG_CMD_REMOTEPROC=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_TIME=y
@@ -72,6 +73,10 @@ CONFIG_PHY_FIXED=y CONFIG_DM_ETH=y CONFIG_TI_AM65_CPSW_NUSS=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
PATCH v3 5/7 configs: am65x_evm_a53: enable PCIe support
Quoted 4 lines · Sekhar Nori
Enable support for PCIe and related configurations on AM654 EVM platform.
Signed-off-by Sekhar Nori <[email protected]>
Applied to u-boot/master, 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/20190813/0ffed016/attachment.sig>
PATCH v3 6/7 arm: dts: k3-am65: add support for PCIe and SERDES
In reply to Sekhar NoriAdd 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
@@ -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";
@@ -143,4 +146,109 @@ clocks = <&k3_clks 113 1>; power-domains = <&k3_pds 113 TI_SCI_PD_EXCLUSIVE>; }; + + 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 TI_SCI_PD_EXCLUSIVE>; + 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 TI_SCI_PD_EXCLUSIVE>; + 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 TI_SCI_PD_EXCLUSIVE>; + #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
@@ -69,6 +69,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
@@ -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
PATCH v3 6/7 arm: dts: k3-am65: add support for PCIe and SERDES
Quoted 5 lines · Sekhar Nori
Add needed device-tree nodes to support PCIe 0
and SERDES on AM65x SoC. The nodes are kept
disabled by default.Signed-off-by Sekhar Nori <[email protected]>
Applied to u-boot/master, 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/20190813/d58eefcd/attachment.sig>
PATCH v3 7/7 configs: am65x_evm_a53: enable support for PCIe ethernet cards
In reply to Sekhar NoriEnable 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
@@ -73,6 +73,9 @@ CONFIG_PHY_FIXED=y CONFIG_DM_ETH=y CONFIG_TI_AM65_CPSW_NUSS=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
PATCH v3 7/7 configs: am65x_evm_a53: enable support for PCIe ethernet cards
Quoted 4 lines · Sekhar Nori
Enable support for Intel E1000 based PCIe ethernet cards that can be used to test PCIe RC functionality on AM65x EVM.
Signed-off-by Sekhar Nori <[email protected]>
Applied to u-boot/master, 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/20190813/167f03ed/attachment.sig>