1 From db797ae0542220a98658229397da464c383c991c Mon Sep 17 00:00:00 2001
2 From: Lorenzo Bianconi <lorenzo@kernel.org>
3 Date: Tue, 25 Jul 2023 01:53:13 +0100
4 Subject: [PATCH 103/250] net: ethernet: mtk_eth_soc: convert caps in
5 mtk_soc_data struct to u64
7 This is a preliminary patch to introduce support for MT7988 SoC.
9 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
10 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
11 Link: https://lore.kernel.org/r/9499ac3670b2fc5b444404b84e8a4a169beabbf2.1690246066.git.daniel@makrotopia.org
12 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
14 drivers/net/ethernet/mediatek/mtk_eth_path.c | 22 ++++----
15 drivers/net/ethernet/mediatek/mtk_eth_soc.h | 56 ++++++++++----------
16 2 files changed, 39 insertions(+), 39 deletions(-)
18 --- a/drivers/net/ethernet/mediatek/mtk_eth_path.c
19 +++ b/drivers/net/ethernet/mediatek/mtk_eth_path.c
24 - int (*set_path)(struct mtk_eth *eth, int path);
25 + int (*set_path)(struct mtk_eth *eth, u64 path);
28 -static const char *mtk_eth_path_name(int path)
29 +static const char *mtk_eth_path_name(u64 path)
32 case MTK_ETH_PATH_GMAC1_RGMII:
33 @@ -40,7 +40,7 @@ static const char *mtk_eth_path_name(int
37 -static int set_mux_gdm1_to_gmac1_esw(struct mtk_eth *eth, int path)
38 +static int set_mux_gdm1_to_gmac1_esw(struct mtk_eth *eth, u64 path)
42 @@ -71,7 +71,7 @@ static int set_mux_gdm1_to_gmac1_esw(str
46 -static int set_mux_gmac2_gmac0_to_gephy(struct mtk_eth *eth, int path)
47 +static int set_mux_gmac2_gmac0_to_gephy(struct mtk_eth *eth, u64 path)
51 @@ -94,7 +94,7 @@ static int set_mux_gmac2_gmac0_to_gephy(
55 -static int set_mux_u3_gmac2_to_qphy(struct mtk_eth *eth, int path)
56 +static int set_mux_u3_gmac2_to_qphy(struct mtk_eth *eth, u64 path)
58 unsigned int val = 0, mask = 0, reg = 0;
60 @@ -125,7 +125,7 @@ static int set_mux_u3_gmac2_to_qphy(stru
64 -static int set_mux_gmac1_gmac2_to_sgmii_rgmii(struct mtk_eth *eth, int path)
65 +static int set_mux_gmac1_gmac2_to_sgmii_rgmii(struct mtk_eth *eth, u64 path)
69 @@ -163,7 +163,7 @@ static int set_mux_gmac1_gmac2_to_sgmii_
73 -static int set_mux_gmac12_to_gephy_sgmii(struct mtk_eth *eth, int path)
74 +static int set_mux_gmac12_to_gephy_sgmii(struct mtk_eth *eth, u64 path)
78 @@ -218,7 +218,7 @@ static const struct mtk_eth_muxc mtk_eth
82 -static int mtk_eth_mux_setup(struct mtk_eth *eth, int path)
83 +static int mtk_eth_mux_setup(struct mtk_eth *eth, u64 path)
87 @@ -249,7 +249,7 @@ out:
89 int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id)
94 path = (mac_id == 0) ? MTK_ETH_PATH_GMAC1_SGMII :
95 MTK_ETH_PATH_GMAC2_SGMII;
96 @@ -260,7 +260,7 @@ int mtk_gmac_sgmii_path_setup(struct mtk
98 int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id)
104 path = MTK_ETH_PATH_GMAC2_GEPHY;
105 @@ -274,7 +274,7 @@ int mtk_gmac_gephy_path_setup(struct mtk
107 int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id)
112 path = (mac_id == 0) ? MTK_ETH_PATH_GMAC1_RGMII :
113 MTK_ETH_PATH_GMAC2_RGMII;
114 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
115 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
116 @@ -866,41 +866,41 @@ enum mkt_eth_capabilities {
119 /* Supported hardware group on SoCs */
120 -#define MTK_RGMII BIT(MTK_RGMII_BIT)
121 -#define MTK_TRGMII BIT(MTK_TRGMII_BIT)
122 -#define MTK_SGMII BIT(MTK_SGMII_BIT)
123 -#define MTK_ESW BIT(MTK_ESW_BIT)
124 -#define MTK_GEPHY BIT(MTK_GEPHY_BIT)
125 -#define MTK_MUX BIT(MTK_MUX_BIT)
126 -#define MTK_INFRA BIT(MTK_INFRA_BIT)
127 -#define MTK_SHARED_SGMII BIT(MTK_SHARED_SGMII_BIT)
128 -#define MTK_HWLRO BIT(MTK_HWLRO_BIT)
129 -#define MTK_SHARED_INT BIT(MTK_SHARED_INT_BIT)
130 -#define MTK_TRGMII_MT7621_CLK BIT(MTK_TRGMII_MT7621_CLK_BIT)
131 -#define MTK_QDMA BIT(MTK_QDMA_BIT)
132 -#define MTK_SOC_MT7628 BIT(MTK_SOC_MT7628_BIT)
133 -#define MTK_RSTCTRL_PPE1 BIT(MTK_RSTCTRL_PPE1_BIT)
134 -#define MTK_U3_COPHY_V2 BIT(MTK_U3_COPHY_V2_BIT)
135 +#define MTK_RGMII BIT_ULL(MTK_RGMII_BIT)
136 +#define MTK_TRGMII BIT_ULL(MTK_TRGMII_BIT)
137 +#define MTK_SGMII BIT_ULL(MTK_SGMII_BIT)
138 +#define MTK_ESW BIT_ULL(MTK_ESW_BIT)
139 +#define MTK_GEPHY BIT_ULL(MTK_GEPHY_BIT)
140 +#define MTK_MUX BIT_ULL(MTK_MUX_BIT)
141 +#define MTK_INFRA BIT_ULL(MTK_INFRA_BIT)
142 +#define MTK_SHARED_SGMII BIT_ULL(MTK_SHARED_SGMII_BIT)
143 +#define MTK_HWLRO BIT_ULL(MTK_HWLRO_BIT)
144 +#define MTK_SHARED_INT BIT_ULL(MTK_SHARED_INT_BIT)
145 +#define MTK_TRGMII_MT7621_CLK BIT_ULL(MTK_TRGMII_MT7621_CLK_BIT)
146 +#define MTK_QDMA BIT_ULL(MTK_QDMA_BIT)
147 +#define MTK_SOC_MT7628 BIT_ULL(MTK_SOC_MT7628_BIT)
148 +#define MTK_RSTCTRL_PPE1 BIT_ULL(MTK_RSTCTRL_PPE1_BIT)
149 +#define MTK_U3_COPHY_V2 BIT_ULL(MTK_U3_COPHY_V2_BIT)
151 #define MTK_ETH_MUX_GDM1_TO_GMAC1_ESW \
152 - BIT(MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT)
153 + BIT_ULL(MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT)
154 #define MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY \
155 - BIT(MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY_BIT)
156 + BIT_ULL(MTK_ETH_MUX_GMAC2_GMAC0_TO_GEPHY_BIT)
157 #define MTK_ETH_MUX_U3_GMAC2_TO_QPHY \
158 - BIT(MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT)
159 + BIT_ULL(MTK_ETH_MUX_U3_GMAC2_TO_QPHY_BIT)
160 #define MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII \
161 - BIT(MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT)
162 + BIT_ULL(MTK_ETH_MUX_GMAC1_GMAC2_TO_SGMII_RGMII_BIT)
163 #define MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII \
164 - BIT(MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII_BIT)
165 + BIT_ULL(MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII_BIT)
167 /* Supported path present on SoCs */
168 -#define MTK_ETH_PATH_GMAC1_RGMII BIT(MTK_ETH_PATH_GMAC1_RGMII_BIT)
169 -#define MTK_ETH_PATH_GMAC1_TRGMII BIT(MTK_ETH_PATH_GMAC1_TRGMII_BIT)
170 -#define MTK_ETH_PATH_GMAC1_SGMII BIT(MTK_ETH_PATH_GMAC1_SGMII_BIT)
171 -#define MTK_ETH_PATH_GMAC2_RGMII BIT(MTK_ETH_PATH_GMAC2_RGMII_BIT)
172 -#define MTK_ETH_PATH_GMAC2_SGMII BIT(MTK_ETH_PATH_GMAC2_SGMII_BIT)
173 -#define MTK_ETH_PATH_GMAC2_GEPHY BIT(MTK_ETH_PATH_GMAC2_GEPHY_BIT)
174 -#define MTK_ETH_PATH_GDM1_ESW BIT(MTK_ETH_PATH_GDM1_ESW_BIT)
175 +#define MTK_ETH_PATH_GMAC1_RGMII BIT_ULL(MTK_ETH_PATH_GMAC1_RGMII_BIT)
176 +#define MTK_ETH_PATH_GMAC1_TRGMII BIT_ULL(MTK_ETH_PATH_GMAC1_TRGMII_BIT)
177 +#define MTK_ETH_PATH_GMAC1_SGMII BIT_ULL(MTK_ETH_PATH_GMAC1_SGMII_BIT)
178 +#define MTK_ETH_PATH_GMAC2_RGMII BIT_ULL(MTK_ETH_PATH_GMAC2_RGMII_BIT)
179 +#define MTK_ETH_PATH_GMAC2_SGMII BIT_ULL(MTK_ETH_PATH_GMAC2_SGMII_BIT)
180 +#define MTK_ETH_PATH_GMAC2_GEPHY BIT_ULL(MTK_ETH_PATH_GMAC2_GEPHY_BIT)
181 +#define MTK_ETH_PATH_GDM1_ESW BIT_ULL(MTK_ETH_PATH_GDM1_ESW_BIT)
183 #define MTK_GMAC1_RGMII (MTK_ETH_PATH_GMAC1_RGMII | MTK_RGMII)
184 #define MTK_GMAC1_TRGMII (MTK_ETH_PATH_GMAC1_TRGMII | MTK_TRGMII)
185 @@ -1045,7 +1045,7 @@ struct mtk_reg_map {
186 struct mtk_soc_data {
187 const struct mtk_reg_map *reg_map;