11f879de1c407f6cc0adb11748f05c52b4c4eee8
[openwrt/staging/wigyori.git] /
1 From c28b8375f6d02ef3b5e8c51234cc3f6d47d9fb7f Mon Sep 17 00:00:00 2001
2 From: Lorenzo Bianconi <lorenzo@kernel.org>
3 Date: Fri, 28 Feb 2025 11:54:17 +0100
4 Subject: [PATCH 09/15] net: airoha: Rename airoha_set_gdm_port_fwd_cfg() in
5 airoha_set_vip_for_gdm_port()
6
7 Rename airoha_set_gdm_port() in airoha_set_vip_for_gdm_port().
8 Get rid of airoha_set_gdm_ports routine.
9
10 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
11 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
12 ---
13 drivers/net/ethernet/airoha/airoha_eth.c | 49 ++++++------------------
14 drivers/net/ethernet/airoha/airoha_eth.h | 8 ----
15 2 files changed, 11 insertions(+), 46 deletions(-)
16
17 --- a/drivers/net/ethernet/airoha/airoha_eth.c
18 +++ b/drivers/net/ethernet/airoha/airoha_eth.c
19 @@ -105,25 +105,23 @@ static void airoha_set_gdm_port_fwd_cfg(
20 FIELD_PREP(GDM_UCFQ_MASK, val));
21 }
22
23 -static int airoha_set_gdm_port(struct airoha_eth *eth, int port, bool enable)
24 +static int airoha_set_vip_for_gdm_port(struct airoha_gdm_port *port,
25 + bool enable)
26 {
27 + struct airoha_eth *eth = port->qdma->eth;
28 u32 vip_port;
29
30 - switch (port) {
31 - case XSI_PCIE0_PORT:
32 + switch (port->id) {
33 + case 3:
34 + /* FIXME: handle XSI_PCIE1_PORT */
35 vip_port = XSI_PCIE0_VIP_PORT_MASK;
36 break;
37 - case XSI_PCIE1_PORT:
38 - vip_port = XSI_PCIE1_VIP_PORT_MASK;
39 - break;
40 - case XSI_USB_PORT:
41 - vip_port = XSI_USB_VIP_PORT_MASK;
42 - break;
43 - case XSI_ETH_PORT:
44 + case 4:
45 + /* FIXME: handle XSI_USB_PORT */
46 vip_port = XSI_ETH_VIP_PORT_MASK;
47 break;
48 default:
49 - return -EINVAL;
50 + return 0;
51 }
52
53 if (enable) {
54 @@ -137,31 +135,6 @@ static int airoha_set_gdm_port(struct ai
55 return 0;
56 }
57
58 -static int airoha_set_gdm_ports(struct airoha_eth *eth, bool enable)
59 -{
60 - const int port_list[] = {
61 - XSI_PCIE0_PORT,
62 - XSI_PCIE1_PORT,
63 - XSI_USB_PORT,
64 - XSI_ETH_PORT
65 - };
66 - int i, err;
67 -
68 - for (i = 0; i < ARRAY_SIZE(port_list); i++) {
69 - err = airoha_set_gdm_port(eth, port_list[i], enable);
70 - if (err)
71 - goto error;
72 - }
73 -
74 - return 0;
75 -
76 -error:
77 - for (i--; i >= 0; i--)
78 - airoha_set_gdm_port(eth, port_list[i], false);
79 -
80 - return err;
81 -}
82 -
83 static void airoha_fe_maccr_init(struct airoha_eth *eth)
84 {
85 int p;
86 @@ -1540,7 +1513,7 @@ static int airoha_dev_open(struct net_de
87 int err;
88
89 netif_tx_start_all_queues(dev);
90 - err = airoha_set_gdm_ports(qdma->eth, true);
91 + err = airoha_set_vip_for_gdm_port(port, true);
92 if (err)
93 return err;
94
95 @@ -1566,7 +1539,7 @@ static int airoha_dev_stop(struct net_de
96 int i, err;
97
98 netif_tx_disable(dev);
99 - err = airoha_set_gdm_ports(qdma->eth, false);
100 + err = airoha_set_vip_for_gdm_port(port, false);
101 if (err)
102 return err;
103
104 --- a/drivers/net/ethernet/airoha/airoha_eth.h
105 +++ b/drivers/net/ethernet/airoha/airoha_eth.h
106 @@ -58,14 +58,6 @@ enum {
107 };
108
109 enum {
110 - XSI_PCIE0_PORT,
111 - XSI_PCIE1_PORT,
112 - XSI_USB_PORT,
113 - XSI_AE_PORT,
114 - XSI_ETH_PORT,
115 -};
116 -
117 -enum {
118 XSI_PCIE0_VIP_PORT_MASK = BIT(22),
119 XSI_PCIE1_VIP_PORT_MASK = BIT(23),
120 XSI_USB_VIP_PORT_MASK = BIT(25),