Skip to content

Commit 72cb4f2

Browse files
committed
tgupdate: merge t/upstream base into t/upstream
2 parents 31fa8d1 + dad983a commit 72cb4f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+5651
-1625
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
# Copyright 2021-2024 NXP
3+
%YAML 1.2
4+
---
5+
$id: http://devicetree.org/schemas/net/nxp,s32-dwmac.yaml#
6+
$schema: http://devicetree.org/meta-schemas/core.yaml#
7+
8+
title: NXP S32G2xx/S32G3xx/S32R45 GMAC ethernet controller
9+
10+
maintainers:
11+
- Jan Petrous (OSS) <[email protected]>
12+
13+
description:
14+
This device is a Synopsys DWC IP, integrated on NXP S32G/R SoCs.
15+
The SoC series S32G2xx and S32G3xx feature one DWMAC instance,
16+
the SoC S32R45 has two instances. The devices can use RGMII/RMII/MII
17+
interface over Pinctrl device or the output can be routed
18+
to the embedded SerDes for SGMII connectivity.
19+
20+
properties:
21+
compatible:
22+
oneOf:
23+
- const: nxp,s32g2-dwmac
24+
- items:
25+
- enum:
26+
- nxp,s32g3-dwmac
27+
- nxp,s32r45-dwmac
28+
- const: nxp,s32g2-dwmac
29+
30+
reg:
31+
items:
32+
- description: Main GMAC registers
33+
- description: GMAC PHY mode control register
34+
35+
interrupts:
36+
maxItems: 1
37+
38+
interrupt-names:
39+
const: macirq
40+
41+
clocks:
42+
items:
43+
- description: Main GMAC clock
44+
- description: Transmit clock
45+
- description: Receive clock
46+
- description: PTP reference clock
47+
48+
clock-names:
49+
items:
50+
- const: stmmaceth
51+
- const: tx
52+
- const: rx
53+
- const: ptp_ref
54+
55+
required:
56+
- clocks
57+
- clock-names
58+
59+
allOf:
60+
- $ref: snps,dwmac.yaml#
61+
62+
unevaluatedProperties: false
63+
64+
examples:
65+
- |
66+
#include <dt-bindings/interrupt-controller/arm-gic.h>
67+
#include <dt-bindings/interrupt-controller/irq.h>
68+
#include <dt-bindings/phy/phy.h>
69+
bus {
70+
#address-cells = <2>;
71+
#size-cells = <2>;
72+
73+
ethernet@4033c000 {
74+
compatible = "nxp,s32g2-dwmac";
75+
reg = <0x0 0x4033c000 0x0 0x2000>, /* gmac IP */
76+
<0x0 0x4007c004 0x0 0x4>; /* GMAC_0_CTRL_STS */
77+
interrupt-parent = <&gic>;
78+
interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
79+
interrupt-names = "macirq";
80+
snps,mtl-rx-config = <&mtl_rx_setup>;
81+
snps,mtl-tx-config = <&mtl_tx_setup>;
82+
clocks = <&clks 24>, <&clks 17>, <&clks 16>, <&clks 15>;
83+
clock-names = "stmmaceth", "tx", "rx", "ptp_ref";
84+
phy-mode = "rgmii-id";
85+
phy-handle = <&phy0>;
86+
87+
mtl_rx_setup: rx-queues-config {
88+
snps,rx-queues-to-use = <5>;
89+
};
90+
91+
mtl_tx_setup: tx-queues-config {
92+
snps,tx-queues-to-use = <5>;
93+
};
94+
95+
mdio {
96+
#address-cells = <1>;
97+
#size-cells = <0>;
98+
compatible = "snps,dwmac-mdio";
99+
100+
phy0: ethernet-phy@0 {
101+
reg = <0>;
102+
};
103+
};
104+
};
105+
};

Documentation/devicetree/bindings/net/snps,dwmac.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ properties:
6767
- ingenic,x2000-mac
6868
- loongson,ls2k-dwmac
6969
- loongson,ls7a-dwmac
70+
- nxp,s32g2-dwmac
7071
- qcom,qcs404-ethqos
7172
- qcom,sa8775p-ethqos
7273
- qcom,sc8280xp-ethqos

MAINTAINERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2836,6 +2836,13 @@ S: Maintained
28362836
F: arch/arm64/boot/dts/freescale/s32g*.dts*
28372837
F: drivers/pinctrl/nxp/
28382838

2839+
ARM/NXP S32G/S32R DWMAC ETHERNET DRIVER
2840+
M: Jan Petrous <[email protected]>
2841+
L: NXP S32 Linux Team <[email protected]>
2842+
S: Maintained
2843+
F: Documentation/devicetree/bindings/net/nxp,s32-dwmac.yaml
2844+
F: drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c
2845+
28392846
ARM/Orion SoC/Technologic Systems TS-78xx platform support
28402847
M: Alexander Clouter <[email protected]>
28412848
L: [email protected] (moderated for non-subscribers)
@@ -13942,6 +13949,7 @@ M: Sunil Goutham <[email protected]>
1394213949
M: Geetha sowjanya <[email protected]>
1394313950
M: Subbaraya Sundeep <[email protected]>
1394413951
M: hariprasad <[email protected]>
13952+
M: Bharat Bhushan <[email protected]>
1394513953
1394613954
S: Supported
1394713955
F: drivers/net/ethernet/marvell/octeontx2/nic/

drivers/net/dsa/microchip/ksz_common.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2550,7 +2550,11 @@ static int ksz_mdio_register(struct ksz_device *dev)
25502550
bus->read = ksz_sw_mdio_read;
25512551
bus->write = ksz_sw_mdio_write;
25522552
bus->name = "ksz user smi";
2553-
snprintf(bus->id, MII_BUS_ID_SIZE, "SMI-%d", ds->index);
2553+
if (ds->dst->index != 0) {
2554+
snprintf(bus->id, MII_BUS_ID_SIZE, "SMI-%d-%d", ds->dst->index, ds->index);
2555+
} else {
2556+
snprintf(bus->id, MII_BUS_ID_SIZE, "SMI-%d", ds->index);
2557+
}
25542558
}
25552559

25562560
ret = ksz_parse_dt_phy_config(dev, bus, mdio_np);

drivers/net/ethernet/apm/xgene/xgene_enet_hw.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -421,18 +421,12 @@ static void xgene_enet_configure_clock(struct xgene_enet_pdata *pdata)
421421

422422
if (dev->of_node) {
423423
struct clk *parent = clk_get_parent(pdata->clk);
424+
long rate = rgmii_clock(pdata->phy_speed);
424425

425-
switch (pdata->phy_speed) {
426-
case SPEED_10:
427-
clk_set_rate(parent, 2500000);
428-
break;
429-
case SPEED_100:
430-
clk_set_rate(parent, 25000000);
431-
break;
432-
default:
433-
clk_set_rate(parent, 125000000);
434-
break;
435-
}
426+
if (rate < 0)
427+
rate = 125000000;
428+
429+
clk_set_rate(parent, rate);
436430
}
437431
#ifdef CONFIG_ACPI
438432
else {

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -530,19 +530,9 @@ static void macb_set_tx_clk(struct macb *bp, int speed)
530530
if (bp->phy_interface == PHY_INTERFACE_MODE_MII)
531531
return;
532532

533-
switch (speed) {
534-
case SPEED_10:
535-
rate = 2500000;
536-
break;
537-
case SPEED_100:
538-
rate = 25000000;
539-
break;
540-
case SPEED_1000:
541-
rate = 125000000;
542-
break;
543-
default:
533+
rate = rgmii_clock(speed);
534+
if (rate < 0)
544535
return;
545-
}
546536

547537
rate_rounded = clk_round_rate(bp->tx_clk, rate);
548538
if (rate_rounded < 0)

drivers/net/ethernet/marvell/octeon_ep/octep_main.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,43 @@ static int octep_set_features(struct net_device *dev, netdev_features_t features
11371137
return err;
11381138
}
11391139

1140+
static int octep_get_vf_config(struct net_device *dev, int vf,
1141+
struct ifla_vf_info *ivi)
1142+
{
1143+
struct octep_device *oct = netdev_priv(dev);
1144+
1145+
ivi->vf = vf;
1146+
ether_addr_copy(ivi->mac, oct->vf_info[vf].mac_addr);
1147+
ivi->spoofchk = true;
1148+
ivi->linkstate = IFLA_VF_LINK_STATE_ENABLE;
1149+
ivi->trusted = false;
1150+
1151+
return 0;
1152+
}
1153+
1154+
static int octep_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
1155+
{
1156+
struct octep_device *oct = netdev_priv(dev);
1157+
int err;
1158+
1159+
if (!is_valid_ether_addr(mac)) {
1160+
dev_err(&oct->pdev->dev, "Invalid MAC Address %pM\n", mac);
1161+
return -EADDRNOTAVAIL;
1162+
}
1163+
1164+
dev_dbg(&oct->pdev->dev, "set vf-%d mac to %pM\n", vf, mac);
1165+
ether_addr_copy(oct->vf_info[vf].mac_addr, mac);
1166+
oct->vf_info[vf].flags |= OCTEON_PFVF_FLAG_MAC_SET_BY_PF;
1167+
1168+
err = octep_ctrl_net_set_mac_addr(oct, vf, mac, true);
1169+
if (err)
1170+
dev_err(&oct->pdev->dev,
1171+
"Set VF%d MAC address failed via host control Mbox\n",
1172+
vf);
1173+
1174+
return err;
1175+
}
1176+
11401177
static const struct net_device_ops octep_netdev_ops = {
11411178
.ndo_open = octep_open,
11421179
.ndo_stop = octep_stop,
@@ -1146,6 +1183,8 @@ static const struct net_device_ops octep_netdev_ops = {
11461183
.ndo_set_mac_address = octep_set_mac,
11471184
.ndo_change_mtu = octep_change_mtu,
11481185
.ndo_set_features = octep_set_features,
1186+
.ndo_get_vf_config = octep_get_vf_config,
1187+
.ndo_set_vf_mac = octep_set_vf_mac
11491188
};
11501189

11511190
/**

drivers/net/ethernet/marvell/octeon_ep/octep_main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ struct octep_iface_link_info {
220220
/* The Octeon VF device specific info data structure.*/
221221
struct octep_pfvf_info {
222222
u8 mac_addr[ETH_ALEN];
223+
u32 flags;
223224
u32 mbox_version;
224225
};
225226

drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,23 @@ static void octep_pfvf_set_mac_addr(struct octep_device *oct, u32 vf_id,
156156
{
157157
int err;
158158

159+
if (oct->vf_info[vf_id].flags & OCTEON_PFVF_FLAG_MAC_SET_BY_PF) {
160+
dev_err(&oct->pdev->dev,
161+
"VF%d attempted to override administrative set MAC address\n",
162+
vf_id);
163+
rsp->s_set_mac.type = OCTEP_PFVF_MBOX_TYPE_RSP_NACK;
164+
return;
165+
}
166+
159167
err = octep_ctrl_net_set_mac_addr(oct, vf_id, cmd.s_set_mac.mac_addr, true);
160168
if (err) {
161169
rsp->s_set_mac.type = OCTEP_PFVF_MBOX_TYPE_RSP_NACK;
162-
dev_err(&oct->pdev->dev, "Set VF MAC address failed via host control Mbox\n");
170+
dev_err(&oct->pdev->dev, "Set VF%d MAC address failed via host control Mbox\n",
171+
vf_id);
163172
return;
164173
}
174+
175+
ether_addr_copy(oct->vf_info[vf_id].mac_addr, cmd.s_set_mac.mac_addr);
165176
rsp->s_set_mac.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK;
166177
}
167178

@@ -171,10 +182,18 @@ static void octep_pfvf_get_mac_addr(struct octep_device *oct, u32 vf_id,
171182
{
172183
int err;
173184

185+
if (oct->vf_info[vf_id].flags & OCTEON_PFVF_FLAG_MAC_SET_BY_PF) {
186+
dev_dbg(&oct->pdev->dev, "VF%d MAC address set by PF\n", vf_id);
187+
ether_addr_copy(rsp->s_set_mac.mac_addr,
188+
oct->vf_info[vf_id].mac_addr);
189+
rsp->s_set_mac.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK;
190+
return;
191+
}
174192
err = octep_ctrl_net_get_mac_addr(oct, vf_id, rsp->s_set_mac.mac_addr);
175193
if (err) {
176194
rsp->s_set_mac.type = OCTEP_PFVF_MBOX_TYPE_RSP_NACK;
177-
dev_err(&oct->pdev->dev, "Get VF MAC address failed via host control Mbox\n");
195+
dev_err(&oct->pdev->dev, "Get VF%d MAC address failed via host control Mbox\n",
196+
vf_id);
178197
return;
179198
}
180199
rsp->s_set_mac.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK;

drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#ifndef _OCTEP_PFVF_MBOX_H_
99
#define _OCTEP_PFVF_MBOX_H_
1010

11-
/* VF flags */
12-
#define OCTEON_PFVF_FLAG_MAC_SET_BY_PF BIT_ULL(0) /* PF has set VF MAC address */
1311
#define OCTEON_SDP_16K_HW_FRS 16380UL
1412
#define OCTEON_SDP_64K_HW_FRS 65531UL
1513

@@ -23,6 +21,10 @@ enum octep_pfvf_mbox_version {
2321

2422
#define OCTEP_PFVF_MBOX_VERSION_CURRENT OCTEP_PFVF_MBOX_VERSION_V2
2523

24+
/* VF flags */
25+
/* PF has set VF MAC address */
26+
#define OCTEON_PFVF_FLAG_MAC_SET_BY_PF BIT(0)
27+
2628
enum octep_pfvf_mbox_opcode {
2729
OCTEP_PFVF_MBOX_CMD_VERSION,
2830
OCTEP_PFVF_MBOX_CMD_SET_MTU,

0 commit comments

Comments
 (0)