23
23
#include <linux/pm_runtime.h>
24
24
#include <linux/regmap.h>
25
25
#include <linux/mfd/syscon.h>
26
+ #include <linux/sys_soc.h>
26
27
#include <linux/dma/ti-cppi5.h>
27
28
#include <linux/dma/k3-udma-glue.h>
28
29
@@ -148,10 +149,11 @@ static void am65_cpsw_nuss_get_ver(struct am65_cpsw_common *common)
148
149
common -> nuss_ver = readl (common -> ss_base );
149
150
common -> cpsw_ver = readl (common -> cpsw_base );
150
151
dev_info (common -> dev ,
151
- "initializing am65 cpsw nuss version 0x%08X, cpsw version 0x%08X Ports: %u\n" ,
152
+ "initializing am65 cpsw nuss version 0x%08X, cpsw version 0x%08X Ports: %u quirks:%08x \n" ,
152
153
common -> nuss_ver ,
153
154
common -> cpsw_ver ,
154
- common -> port_num + 1 );
155
+ common -> port_num + 1 ,
156
+ common -> pdata .quirks );
155
157
}
156
158
157
159
void am65_cpsw_nuss_adjust_link (struct net_device * ndev )
@@ -1877,7 +1879,7 @@ static int am65_cpsw_nuss_init_ndev_2g(struct am65_cpsw_common *common)
1877
1879
port -> ndev -> ethtool_ops = & am65_cpsw_ethtool_ops_slave ;
1878
1880
1879
1881
/* Disable TX checksum offload by default due to HW bug */
1880
- if (common -> pdata -> quirks & AM65_CPSW_QUIRK_I2027_NO_TX_CSUM )
1882
+ if (common -> pdata . quirks & AM65_CPSW_QUIRK_I2027_NO_TX_CSUM )
1881
1883
port -> ndev -> features &= ~NETIF_F_HW_CSUM ;
1882
1884
1883
1885
ndev_priv -> stats = netdev_alloc_pcpu_stats (struct am65_cpsw_ndev_stats );
@@ -1981,21 +1983,50 @@ static void am65_cpsw_nuss_cleanup_ndev(struct am65_cpsw_common *common)
1981
1983
}
1982
1984
}
1983
1985
1986
+ struct am65_cpsw_soc_pdata {
1987
+ u32 quirks_dis ;
1988
+ };
1989
+
1990
+ static const struct am65_cpsw_soc_pdata am65x_soc_sr2_0 = {
1991
+ .quirks_dis = AM65_CPSW_QUIRK_I2027_NO_TX_CSUM ,
1992
+ };
1993
+
1994
+ static const struct soc_device_attribute am65_cpsw_socinfo [] = {
1995
+ { .family = "AM65X" ,
1996
+ .revision = "SR2.0" ,
1997
+ .data = & am65x_soc_sr2_0
1998
+ },
1999
+ {/* sentinel */ }
2000
+ };
2001
+
1984
2002
static const struct am65_cpsw_pdata am65x_sr1_0 = {
1985
2003
.quirks = AM65_CPSW_QUIRK_I2027_NO_TX_CSUM ,
1986
2004
};
1987
2005
1988
- static const struct am65_cpsw_pdata j721e_sr1_0 = {
2006
+ static const struct am65_cpsw_pdata j721e_pdata = {
1989
2007
.quirks = 0 ,
1990
2008
};
1991
2009
1992
2010
static const struct of_device_id am65_cpsw_nuss_of_mtable [] = {
1993
- { .compatible = "ti,am654-cpsw-nuss" , .data = & am65x_sr1_0 },
1994
- { .compatible = "ti,j721e-cpsw-nuss" , .data = & j721e_sr1_0 },
2011
+ { .compatible = "ti,am654-cpsw-nuss" , .data = & am65x_sr1_0 },
2012
+ { .compatible = "ti,j721e-cpsw-nuss" , .data = & j721e_pdata },
1995
2013
{ /* sentinel */ },
1996
2014
};
1997
2015
MODULE_DEVICE_TABLE (of , am65_cpsw_nuss_of_mtable );
1998
2016
2017
+ static void am65_cpsw_nuss_apply_socinfo (struct am65_cpsw_common * common )
2018
+ {
2019
+ const struct soc_device_attribute * soc ;
2020
+
2021
+ soc = soc_device_match (am65_cpsw_socinfo );
2022
+ if (soc && soc -> data ) {
2023
+ const struct am65_cpsw_soc_pdata * socdata = soc -> data ;
2024
+
2025
+ /* disable quirks */
2026
+ common -> pdata .quirks &= ~socdata -> quirks_dis ;
2027
+ }
2028
+ }
2029
+
1999
2030
static int am65_cpsw_nuss_probe (struct platform_device * pdev )
2000
2031
{
2001
2032
struct cpsw_ale_params ale_params = { 0 };
@@ -2014,7 +2045,9 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
2014
2045
of_id = of_match_device (am65_cpsw_nuss_of_mtable , dev );
2015
2046
if (!of_id )
2016
2047
return - EINVAL ;
2017
- common -> pdata = of_id -> data ;
2048
+ common -> pdata = * (const struct am65_cpsw_pdata * )of_id -> data ;
2049
+
2050
+ am65_cpsw_nuss_apply_socinfo (common );
2018
2051
2019
2052
res = platform_get_resource_byname (pdev , IORESOURCE_MEM , "cpsw_nuss" );
2020
2053
common -> ss_base = devm_ioremap_resource (& pdev -> dev , res );
0 commit comments