mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-03-14 19:39:48 +01:00
realtek: dsa: make pcs a port attribute
pcs is currently a standalone array for the pcs of each port. Convert it to an attribute of the port structure and thus move it where it belongs. Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Link: https://github.com/openwrt/openwrt/pull/22255 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
f45235cc7c
commit
3f65aca850
5 changed files with 14 additions and 14 deletions
|
|
@ -305,11 +305,11 @@ static int rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv)
|
|||
}
|
||||
|
||||
if (pcs_node) {
|
||||
priv->pcs[pn] = rtpcs_create(priv->dev, pcs_node, pn);
|
||||
if (IS_ERR(priv->pcs[pn])) {
|
||||
priv->ports[pn].pcs = rtpcs_create(priv->dev, pcs_node, pn);
|
||||
if (IS_ERR(priv->ports[pn].pcs)) {
|
||||
dev_err(priv->dev, "port %u failed to create PCS instance: %ld\n",
|
||||
pn, PTR_ERR(priv->pcs[pn]));
|
||||
priv->pcs[pn] = NULL;
|
||||
pn, PTR_ERR(priv->ports[pn].pcs));
|
||||
priv->ports[pn].pcs = NULL;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -338,7 +338,7 @@ static int rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv)
|
|||
}
|
||||
|
||||
if (!phy_node) {
|
||||
if (priv->pcs[pn])
|
||||
if (priv->ports[pn].pcs)
|
||||
priv->ports[pn].phy_is_integrated = true;
|
||||
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ static void rtldsa_enable_phy_polling(struct rtl838x_switch_priv *priv)
|
|||
msleep(1000);
|
||||
/* Enable all ports with a PHY, including the SFP-ports */
|
||||
for (int i = 0; i < priv->cpu_port; i++) {
|
||||
if (priv->ports[i].phy || priv->pcs[i])
|
||||
if (priv->ports[i].phy || priv->ports[i].pcs)
|
||||
v |= BIT_ULL(i);
|
||||
}
|
||||
|
||||
|
|
@ -180,7 +180,7 @@ static int rtldsa_83xx_setup(struct dsa_switch *ds)
|
|||
* they will work in isolated mode (only traffic between port and CPU).
|
||||
*/
|
||||
for (int i = 0; i < priv->cpu_port; i++) {
|
||||
if (priv->ports[i].phy || priv->pcs[i]) {
|
||||
if (priv->ports[i].phy || priv->ports[i].pcs) {
|
||||
priv->ports[i].pm = BIT_ULL(priv->cpu_port);
|
||||
priv->r->traffic_set(i, BIT_ULL(i));
|
||||
}
|
||||
|
|
@ -253,7 +253,7 @@ static int rtldsa_93xx_setup(struct dsa_switch *ds)
|
|||
* they will work in isolated mode (only traffic between port and CPU).
|
||||
*/
|
||||
for (int i = 0; i < priv->cpu_port; i++) {
|
||||
if (priv->ports[i].phy || priv->pcs[i]) {
|
||||
if (priv->ports[i].phy || priv->ports[i].pcs) {
|
||||
priv->ports[i].pm = BIT_ULL(priv->cpu_port);
|
||||
priv->r->traffic_set(i, BIT_ULL(i));
|
||||
}
|
||||
|
|
@ -291,7 +291,7 @@ static struct phylink_pcs *rtldsa_phylink_mac_select_pcs(struct dsa_switch *ds,
|
|||
{
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
|
||||
return priv->pcs[port];
|
||||
return priv->ports[port].pcs;
|
||||
}
|
||||
|
||||
static void rtldsa_83xx_phylink_get_caps(struct dsa_switch *ds, int port,
|
||||
|
|
@ -767,7 +767,7 @@ static void rtldsa_poll_counters(struct work_struct *work)
|
|||
counters_work);
|
||||
|
||||
for (int port = 0; port < priv->cpu_port; port++) {
|
||||
if (!priv->ports[port].phy && !priv->pcs[port])
|
||||
if (!priv->ports[port].phy && !priv->ports[port].pcs)
|
||||
continue;
|
||||
|
||||
rtldsa_counters_lock(priv, port);
|
||||
|
|
@ -784,7 +784,7 @@ static void rtldsa_init_counters(struct rtl838x_switch_priv *priv)
|
|||
struct rtldsa_counter_state *counters;
|
||||
|
||||
for (int port = 0; port < priv->cpu_port; port++) {
|
||||
if (!priv->ports[port].phy && !priv->pcs[port])
|
||||
if (!priv->ports[port].phy && !priv->ports[port].pcs)
|
||||
continue;
|
||||
|
||||
counters = &priv->ports[port].counters;
|
||||
|
|
|
|||
|
|
@ -886,6 +886,7 @@ struct rtl838x_port {
|
|||
u16 pvid;
|
||||
bool eee_enabled;
|
||||
enum phy_type phy;
|
||||
struct phylink_pcs *pcs;
|
||||
int led_set;
|
||||
int leds_on_this_port;
|
||||
struct rtldsa_counter_state counters;
|
||||
|
|
@ -1375,7 +1376,6 @@ struct rtl838x_switch_priv {
|
|||
u16 id;
|
||||
u16 family_id;
|
||||
struct rtl838x_port ports[57];
|
||||
struct phylink_pcs *pcs[57];
|
||||
struct mutex reg_mutex; /* Mutex for individual register manipulations */
|
||||
struct mutex pie_mutex; /* Mutex for Packet Inspection Engine */
|
||||
int link_state_irq;
|
||||
|
|
|
|||
|
|
@ -2637,7 +2637,7 @@ static void rtl930x_led_init(struct rtl838x_switch_priv *priv)
|
|||
sw_w32_mask(0x3 << pos, 0, RTL930X_LED_PORT_FIB_SET_SEL_CTRL(i));
|
||||
sw_w32_mask(0x3 << pos, 0, RTL930X_LED_PORT_COPR_SET_SEL_CTRL(i));
|
||||
|
||||
if (!priv->ports[i].phy && !priv->pcs[i] && !(forced_leds_per_port[i]))
|
||||
if (!priv->ports[i].phy && !priv->ports[i].pcs && !(forced_leds_per_port[i]))
|
||||
continue;
|
||||
|
||||
if (forced_leds_per_port[i] > 0)
|
||||
|
|
|
|||
|
|
@ -1749,7 +1749,7 @@ static void rtldsa_931x_led_init(struct rtl838x_switch_priv *priv)
|
|||
sw_w32_mask(0x3 << pos, 0, RTL931X_LED_PORT_COPR_SET_SEL_CTRL(i));
|
||||
|
||||
/* Skip port if not present (auto-detect) or not in forced mask */
|
||||
if (!priv->ports[i].phy && !priv->pcs[i] && !(forced_leds_per_port[i]))
|
||||
if (!priv->ports[i].phy && !priv->ports[i].pcs && !(forced_leds_per_port[i]))
|
||||
continue;
|
||||
|
||||
if (forced_leds_per_port[i] > 0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue