kernel: bump 5.4 to 5.4.165
[openwrt/staging/mkresin.git] / target / linux / layerscape / patches-5.4 / 701-net-0241-net-mscc-ocelot-change-prototypes-of-hwtstamping-ioc.patch
1 From 1ba674f7023761476dc39b7b112b780bb86f2f66 Mon Sep 17 00:00:00 2001
2 From: Vladimir Oltean <vladimir.oltean@nxp.com>
3 Date: Sat, 9 Nov 2019 15:02:50 +0200
4 Subject: [PATCH] net: mscc: ocelot: change prototypes of hwtstamping ioctls
5
6 This is needed in order to present a simpler prototype to the DSA
7 front-end of ocelot.
8
9 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
10 Signed-off-by: David S. Miller <davem@davemloft.net>
11 ---
12 drivers/net/ethernet/mscc/ocelot.c | 25 +++++++++++++------------
13 1 file changed, 13 insertions(+), 12 deletions(-)
14
15 --- a/drivers/net/ethernet/mscc/ocelot.c
16 +++ b/drivers/net/ethernet/mscc/ocelot.c
17 @@ -1062,17 +1062,17 @@ static int ocelot_get_port_parent_id(str
18 return 0;
19 }
20
21 -static int ocelot_hwstamp_get(struct ocelot_port *port, struct ifreq *ifr)
22 +static int ocelot_hwstamp_get(struct ocelot *ocelot, int port,
23 + struct ifreq *ifr)
24 {
25 - struct ocelot *ocelot = port->ocelot;
26 -
27 return copy_to_user(ifr->ifr_data, &ocelot->hwtstamp_config,
28 sizeof(ocelot->hwtstamp_config)) ? -EFAULT : 0;
29 }
30
31 -static int ocelot_hwstamp_set(struct ocelot_port *port, struct ifreq *ifr)
32 +static int ocelot_hwstamp_set(struct ocelot *ocelot, int port,
33 + struct ifreq *ifr)
34 {
35 - struct ocelot *ocelot = port->ocelot;
36 + struct ocelot_port *ocelot_port = ocelot->ports[port];
37 struct hwtstamp_config cfg;
38
39 if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)))
40 @@ -1085,16 +1085,16 @@ static int ocelot_hwstamp_set(struct oce
41 /* Tx type sanity check */
42 switch (cfg.tx_type) {
43 case HWTSTAMP_TX_ON:
44 - port->ptp_cmd = IFH_REW_OP_TWO_STEP_PTP;
45 + ocelot_port->ptp_cmd = IFH_REW_OP_TWO_STEP_PTP;
46 break;
47 case HWTSTAMP_TX_ONESTEP_SYNC:
48 /* IFH_REW_OP_ONE_STEP_PTP updates the correctional field, we
49 * need to update the origin time.
50 */
51 - port->ptp_cmd = IFH_REW_OP_ORIGIN_PTP;
52 + ocelot_port->ptp_cmd = IFH_REW_OP_ORIGIN_PTP;
53 break;
54 case HWTSTAMP_TX_OFF:
55 - port->ptp_cmd = 0;
56 + ocelot_port->ptp_cmd = 0;
57 break;
58 default:
59 return -ERANGE;
60 @@ -1130,8 +1130,9 @@ static int ocelot_hwstamp_set(struct oce
61
62 static int ocelot_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
63 {
64 - struct ocelot_port *port = netdev_priv(dev);
65 - struct ocelot *ocelot = port->ocelot;
66 + struct ocelot_port *ocelot_port = netdev_priv(dev);
67 + struct ocelot *ocelot = ocelot_port->ocelot;
68 + int port = ocelot_port->chip_port;
69
70 /* The function is only used for PTP operations for now */
71 if (!ocelot->ptp)
72 @@ -1139,9 +1140,9 @@ static int ocelot_ioctl(struct net_devic
73
74 switch (cmd) {
75 case SIOCSHWTSTAMP:
76 - return ocelot_hwstamp_set(port, ifr);
77 + return ocelot_hwstamp_set(ocelot, port, ifr);
78 case SIOCGHWTSTAMP:
79 - return ocelot_hwstamp_get(port, ifr);
80 + return ocelot_hwstamp_get(ocelot, port, ifr);
81 default:
82 return -EOPNOTSUPP;
83 }