diff --git a/linux-5.10/rk3568_patch/kernel.patch b/linux-5.10/rk3568_patch/kernel.patch index 8fefae9ce58cc30e0729ed42afc35c3e00355aca..926fc8fb469fd148c575eee5e3a861132eace89c 100644 --- a/linux-5.10/rk3568_patch/kernel.patch +++ b/linux-5.10/rk3568_patch/kernel.patch @@ -931475,10 +931475,10 @@ index 6ef30252b..bb0c0e44b 100644 #include #include #include -@@ -21,22 +22,30 @@ - #include +@@ -22,22 +23,30 @@ #include #include + #include - +#include #include "stmmac_platform.h" @@ -931507,7 +931507,7 @@ index 6ef30252b..bb0c0e44b 100644 struct regulator *regulator; bool suspended; const struct rk_gmac_ops *ops; -@@ -55,6 +64,7 @@ struct rk_priv_data { +@@ -56,6 +65,7 @@ struct rk_priv_data { struct clk *aclk_mac; struct clk *pclk_mac; struct clk *clk_phy; @@ -931515,7 +931515,7 @@ index 6ef30252b..bb0c0e44b 100644 struct reset_control *phy_reset; -@@ -62,8 +72,132 @@ struct rk_priv_data { +@@ -63,8 +73,132 @@ struct rk_priv_data { int rx_delay; struct regmap *grf; @@ -931648,7 +931648,7 @@ index 6ef30252b..bb0c0e44b 100644 #define HIWORD_UPDATE(val, mask, shift) \ ((val) << (shift) | (mask) << ((shift) + 16)) -@@ -71,8 +205,16 @@ struct rk_priv_data { +@@ -72,8 +206,16 @@ struct rk_priv_data { #define GRF_CLR_BIT(nr) (BIT(nr+16)) #define DELAY_ENABLE(soc, tx, rx) \ @@ -931667,7 +931667,7 @@ index 6ef30252b..bb0c0e44b 100644 #define PX30_GRF_GMAC_CON1 0x0904 -@@ -132,6 +274,127 @@ static const struct rk_gmac_ops px30_ops = { +@@ -133,6 +275,127 @@ static const struct rk_gmac_ops px30_ops = { .set_rmii_speed = px30_set_rmii_speed, }; @@ -931795,7 +931795,7 @@ index 6ef30252b..bb0c0e44b 100644 #define RK3128_GRF_MAC_CON0 0x0168 #define RK3128_GRF_MAC_CON1 0x016c -@@ -175,8 +438,7 @@ static void rk3128_set_to_rgmii(struct rk_priv_data *bsp_priv, +@@ -176,8 +439,7 @@ static void rk3128_set_to_rgmii(struct rk_priv_data *bsp_priv, RK3128_GMAC_RMII_MODE_CLR); regmap_write(bsp_priv->grf, RK3128_GRF_MAC_CON0, DELAY_ENABLE(RK3128, tx_delay, rx_delay) | @@ -931805,7 +931805,7 @@ index 6ef30252b..bb0c0e44b 100644 } static void rk3128_set_to_rmii(struct rk_priv_data *bsp_priv) -@@ -292,8 +554,7 @@ static void rk3228_set_to_rgmii(struct rk_priv_data *bsp_priv, +@@ -293,8 +555,7 @@ static void rk3228_set_to_rgmii(struct rk_priv_data *bsp_priv, DELAY_ENABLE(RK3228, tx_delay, rx_delay)); regmap_write(bsp_priv->grf, RK3228_GRF_MAC_CON0, @@ -931815,7 +931815,7 @@ index 6ef30252b..bb0c0e44b 100644 } static void rk3228_set_to_rmii(struct rk_priv_data *bsp_priv) -@@ -413,8 +674,7 @@ static void rk3288_set_to_rgmii(struct rk_priv_data *bsp_priv, +@@ -414,8 +675,7 @@ static void rk3288_set_to_rgmii(struct rk_priv_data *bsp_priv, RK3288_GMAC_RMII_MODE_CLR); regmap_write(bsp_priv->grf, RK3288_GRF_SOC_CON3, DELAY_ENABLE(RK3288, tx_delay, rx_delay) | @@ -931825,7 +931825,7 @@ index 6ef30252b..bb0c0e44b 100644 } static void rk3288_set_to_rmii(struct rk_priv_data *bsp_priv) -@@ -481,6 +741,64 @@ static const struct rk_gmac_ops rk3288_ops = { +@@ -482,6 +742,64 @@ static const struct rk_gmac_ops rk3288_ops = { .set_rmii_speed = rk3288_set_rmii_speed, }; @@ -931890,7 +931890,7 @@ index 6ef30252b..bb0c0e44b 100644 #define RK3328_GRF_MAC_CON0 0x0900 #define RK3328_GRF_MAC_CON1 0x0904 #define RK3328_GRF_MAC_CON2 0x0908 -@@ -527,12 +845,10 @@ static void rk3328_set_to_rgmii(struct rk_priv_data *bsp_priv, +@@ -528,12 +846,10 @@ static void rk3328_set_to_rgmii(struct rk_priv_data *bsp_priv, regmap_write(bsp_priv->grf, RK3328_GRF_MAC_CON1, RK3328_GMAC_PHY_INTF_SEL_RGMII | RK3328_GMAC_RMII_MODE_CLR | @@ -931905,7 +931905,7 @@ index 6ef30252b..bb0c0e44b 100644 } static void rk3328_set_to_rmii(struct rk_priv_data *bsp_priv) -@@ -657,8 +973,7 @@ static void rk3366_set_to_rgmii(struct rk_priv_data *bsp_priv, +@@ -658,8 +974,7 @@ static void rk3366_set_to_rgmii(struct rk_priv_data *bsp_priv, RK3366_GMAC_RMII_MODE_CLR); regmap_write(bsp_priv->grf, RK3366_GRF_SOC_CON7, DELAY_ENABLE(RK3366, tx_delay, rx_delay) | @@ -931915,7 +931915,7 @@ index 6ef30252b..bb0c0e44b 100644 } static void rk3366_set_to_rmii(struct rk_priv_data *bsp_priv) -@@ -768,8 +1083,7 @@ static void rk3368_set_to_rgmii(struct rk_priv_data *bsp_priv, +@@ -769,8 +1084,7 @@ static void rk3368_set_to_rgmii(struct rk_priv_data *bsp_priv, RK3368_GMAC_RMII_MODE_CLR); regmap_write(bsp_priv->grf, RK3368_GRF_SOC_CON16, DELAY_ENABLE(RK3368, tx_delay, rx_delay) | @@ -931925,7 +931925,7 @@ index 6ef30252b..bb0c0e44b 100644 } static void rk3368_set_to_rmii(struct rk_priv_data *bsp_priv) -@@ -879,8 +1193,7 @@ static void rk3399_set_to_rgmii(struct rk_priv_data *bsp_priv, +@@ -880,8 +1194,7 @@ static void rk3399_set_to_rgmii(struct rk_priv_data *bsp_priv, RK3399_GMAC_RMII_MODE_CLR); regmap_write(bsp_priv->grf, RK3399_GRF_SOC_CON6, DELAY_ENABLE(RK3399, tx_delay, rx_delay) | @@ -931935,7 +931935,7 @@ index 6ef30252b..bb0c0e44b 100644 } static void rk3399_set_to_rmii(struct rk_priv_data *bsp_priv) -@@ -947,6 +1260,283 @@ static const struct rk_gmac_ops rk3399_ops = { +@@ -948,6 +1261,283 @@ static const struct rk_gmac_ops rk3399_ops = { .set_rmii_speed = rk3399_set_rmii_speed, }; @@ -932219,7 +932219,7 @@ index 6ef30252b..bb0c0e44b 100644 #define RV1108_GRF_GMAC_CON0 0X0900 /* RV1108_GRF_GMAC_CON0 */ -@@ -999,6 +1589,123 @@ static const struct rk_gmac_ops rv1108_ops = { +@@ -1000,6 +1590,123 @@ static const struct rk_gmac_ops rv1108_ops = { .set_rmii_speed = rv1108_set_rmii_speed, }; @@ -932343,7 +932343,7 @@ index 6ef30252b..bb0c0e44b 100644 #define RK_GRF_MACPHY_CON0 0xb00 #define RK_GRF_MACPHY_CON1 0xb04 #define RK_GRF_MACPHY_CON2 0xb08 -@@ -1089,6 +1796,12 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat) +@@ -1090,6 +1797,12 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat) dev_err(dev, "cannot get clock %s\n", "clk_mac_refout"); } @@ -932356,7 +932356,7 @@ index 6ef30252b..bb0c0e44b 100644 } bsp_priv->clk_mac_speed = devm_clk_get(dev, "clk_mac_speed"); -@@ -1102,14 +1815,17 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat) +@@ -1103,14 +1816,17 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat) clk_set_rate(bsp_priv->clk_mac, 50000000); } @@ -932380,7 +932380,7 @@ index 6ef30252b..bb0c0e44b 100644 } return 0; -@@ -1150,11 +1866,18 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable) +@@ -1151,11 +1867,18 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable) if (!IS_ERR(bsp_priv->clk_mac_speed)) clk_prepare_enable(bsp_priv->clk_mac_speed); @@ -932400,7 +932400,7 @@ index 6ef30252b..bb0c0e44b 100644 bsp_priv->clk_enabled = true; } } else { -@@ -1176,6 +1899,12 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable) +@@ -1177,6 +1900,12 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable) clk_disable_unprepare(bsp_priv->mac_clk_tx); clk_disable_unprepare(bsp_priv->clk_mac_speed); @@ -932413,7 +932413,7 @@ index 6ef30252b..bb0c0e44b 100644 /** * if (!IS_ERR(bsp_priv->clk_mac)) * clk_disable_unprepare(bsp_priv->clk_mac); -@@ -1187,7 +1916,7 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable) +@@ -1188,7 +1917,7 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable) return 0; } @@ -932422,7 +932422,7 @@ index 6ef30252b..bb0c0e44b 100644 { struct regulator *ldo = bsp_priv->regulator; int ret; -@@ -1225,6 +1954,7 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, +@@ -1226,6 +1955,7 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, of_get_phy_mode(dev->of_node, &bsp_priv->phy_iface); bsp_priv->ops = ops; @@ -932430,7 +932430,7 @@ index 6ef30252b..bb0c0e44b 100644 bsp_priv->regulator = devm_regulator_get_optional(dev, "phy"); if (IS_ERR(bsp_priv->regulator)) { -@@ -1251,7 +1981,7 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, +@@ -1252,7 +1982,7 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, ret = of_property_read_u32(dev->of_node, "tx_delay", &value); if (ret) { @@ -932439,7 +932439,7 @@ index 6ef30252b..bb0c0e44b 100644 dev_err(dev, "Can not read property: tx_delay."); dev_err(dev, "set tx_delay to 0x%x\n", bsp_priv->tx_delay); -@@ -1262,7 +1992,7 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, +@@ -1263,7 +1993,7 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, ret = of_property_read_u32(dev->of_node, "rx_delay", &value); if (ret) { @@ -932448,7 +932448,7 @@ index 6ef30252b..bb0c0e44b 100644 dev_err(dev, "Can not read property: rx_delay."); dev_err(dev, "set rx_delay to 0x%x\n", bsp_priv->rx_delay); -@@ -1273,6 +2003,20 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, +@@ -1274,6 +2004,20 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, bsp_priv->grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf"); @@ -932469,7 +932469,7 @@ index 6ef30252b..bb0c0e44b 100644 if (plat->phy_node) { bsp_priv->integrated_phy = of_property_read_bool(plat->phy_node, -@@ -1306,30 +2050,45 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv) +@@ -1307,30 +2051,45 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv) switch (bsp_priv->phy_iface) { case PHY_INTERFACE_MODE_RGMII: dev_info(dev, "init for RGMII\n"); @@ -932522,16 +932522,16 @@ index 6ef30252b..bb0c0e44b 100644 if (ret) { gmac_clk_enable(bsp_priv, false); return ret; -@@ -1346,7 +2105,7 @@ static void rk_gmac_powerdown(struct rk_priv_data *gmac) - if (gmac->integrated_phy) - rk_gmac_integrated_phy_powerdown(gmac); +@@ -1351,7 +2110,7 @@ static void rk_gmac_powerdown(struct rk_priv_data *gmac) + + pm_runtime_put_sync(&gmac->pdev->dev); - phy_power_on(gmac, false); + rk_gmac_phy_power_on(gmac, false); gmac_clk_enable(gmac, false); } -@@ -1360,16 +2119,96 @@ static void rk_fix_speed(void *priv, unsigned int speed) +@@ -1365,16 +2124,96 @@ static void rk_fix_speed(void *priv, unsigned int speed) case PHY_INTERFACE_MODE_RGMII_ID: case PHY_INTERFACE_MODE_RGMII_RXID: case PHY_INTERFACE_MODE_RGMII_TXID: @@ -932630,7 +932630,7 @@ index 6ef30252b..bb0c0e44b 100644 static int rk_gmac_probe(struct platform_device *pdev) { struct plat_stmmacenet_data *plat_dat; -@@ -1391,8 +2230,11 @@ static int rk_gmac_probe(struct platform_device *pdev) +@@ -1396,8 +2235,11 @@ static int rk_gmac_probe(struct platform_device *pdev) if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); @@ -932643,7 +932643,7 @@ index 6ef30252b..bb0c0e44b 100644 plat_dat->bsp_priv = rk_gmac_setup(pdev, plat_dat, data); if (IS_ERR(plat_dat->bsp_priv)) { -@@ -1412,6 +2254,10 @@ static int rk_gmac_probe(struct platform_device *pdev) +@@ -1417,6 +2259,10 @@ static int rk_gmac_probe(struct platform_device *pdev) if (ret) goto err_gmac_powerdown; @@ -932654,7 +932654,7 @@ index 6ef30252b..bb0c0e44b 100644 return 0; err_gmac_powerdown: -@@ -1428,6 +2274,7 @@ static int rk_gmac_remove(struct platform_device *pdev) +@@ -1433,6 +2279,7 @@ static int rk_gmac_remove(struct platform_device *pdev) int ret = stmmac_dvr_remove(&pdev->dev); rk_gmac_powerdown(bsp_priv); @@ -932662,7 +932662,7 @@ index 6ef30252b..bb0c0e44b 100644 return ret; } -@@ -1465,14 +2312,19 @@ static SIMPLE_DEV_PM_OPS(rk_gmac_pm_ops, rk_gmac_suspend, rk_gmac_resume); +@@ -1470,14 +2317,19 @@ static SIMPLE_DEV_PM_OPS(rk_gmac_pm_ops, rk_gmac_suspend, rk_gmac_resume); static const struct of_device_id rk_gmac_dwmac_match[] = { { .compatible = "rockchip,px30-gmac", .data = &px30_ops },