@@ -775,12 +775,19 @@ static int __init ks_pcie_init_id(struct keystone_pcie *ks_pcie)
775
775
struct dw_pcie * pci = ks_pcie -> pci ;
776
776
struct device * dev = pci -> dev ;
777
777
struct device_node * np = dev -> of_node ;
778
+ struct of_phandle_args args ;
779
+ unsigned int offset = 0 ;
778
780
779
781
devctrl_regs = syscon_regmap_lookup_by_phandle (np , "ti,syscon-pcie-id" );
780
782
if (IS_ERR (devctrl_regs ))
781
783
return PTR_ERR (devctrl_regs );
782
784
783
- ret = regmap_read (devctrl_regs , 0 , & id );
785
+ /* Do not error out to maintain old DT compatibility */
786
+ ret = of_parse_phandle_with_fixed_args (np , "ti,syscon-pcie-id" , 1 , 0 , & args );
787
+ if (!ret )
788
+ offset = args .args [0 ];
789
+
790
+ ret = regmap_read (devctrl_regs , offset , & id );
784
791
if (ret )
785
792
return ret ;
786
793
@@ -989,6 +996,8 @@ static int ks_pcie_enable_phy(struct keystone_pcie *ks_pcie)
989
996
static int ks_pcie_set_mode (struct device * dev )
990
997
{
991
998
struct device_node * np = dev -> of_node ;
999
+ struct of_phandle_args args ;
1000
+ unsigned int offset = 0 ;
992
1001
struct regmap * syscon ;
993
1002
u32 val ;
994
1003
u32 mask ;
@@ -998,10 +1007,15 @@ static int ks_pcie_set_mode(struct device *dev)
998
1007
if (IS_ERR (syscon ))
999
1008
return 0 ;
1000
1009
1010
+ /* Do not error out to maintain old DT compatibility */
1011
+ ret = of_parse_phandle_with_fixed_args (np , "ti,syscon-pcie-mode" , 1 , 0 , & args );
1012
+ if (!ret )
1013
+ offset = args .args [0 ];
1014
+
1001
1015
mask = KS_PCIE_DEV_TYPE_MASK | KS_PCIE_SYSCLOCKOUTEN ;
1002
1016
val = KS_PCIE_DEV_TYPE (RC ) | KS_PCIE_SYSCLOCKOUTEN ;
1003
1017
1004
- ret = regmap_update_bits (syscon , 0 , mask , val );
1018
+ ret = regmap_update_bits (syscon , offset , mask , val );
1005
1019
if (ret ) {
1006
1020
dev_err (dev , "failed to set pcie mode\n" );
1007
1021
return ret ;
@@ -1014,6 +1028,8 @@ static int ks_pcie_am654_set_mode(struct device *dev,
1014
1028
enum dw_pcie_device_mode mode )
1015
1029
{
1016
1030
struct device_node * np = dev -> of_node ;
1031
+ struct of_phandle_args args ;
1032
+ unsigned int offset = 0 ;
1017
1033
struct regmap * syscon ;
1018
1034
u32 val ;
1019
1035
u32 mask ;
@@ -1023,6 +1039,11 @@ static int ks_pcie_am654_set_mode(struct device *dev,
1023
1039
if (IS_ERR (syscon ))
1024
1040
return 0 ;
1025
1041
1042
+ /* Do not error out to maintain old DT compatibility */
1043
+ ret = of_parse_phandle_with_fixed_args (np , "ti,syscon-pcie-mode" , 1 , 0 , & args );
1044
+ if (!ret )
1045
+ offset = args .args [0 ];
1046
+
1026
1047
mask = AM654_PCIE_DEV_TYPE_MASK ;
1027
1048
1028
1049
switch (mode ) {
@@ -1037,7 +1058,7 @@ static int ks_pcie_am654_set_mode(struct device *dev,
1037
1058
return - EINVAL ;
1038
1059
}
1039
1060
1040
- ret = regmap_update_bits (syscon , 0 , mask , val );
1061
+ ret = regmap_update_bits (syscon , offset , mask , val );
1041
1062
if (ret ) {
1042
1063
dev_err (dev , "failed to set pcie mode\n" );
1043
1064
return ret ;
0 commit comments