net: sparx5: add port module support
This add configuration of the Sparx5 port module instances.
Sparx5 has in total 65 logical ports (denoted D0 to D64) and 33
physical SerDes connections (S0 to S32). The 65th port (D64) is fixed
allocated to SerDes0 (S0). The remaining 64 ports can in various
multiplexing scenarios be connected to the remaining 32 SerDes using
QSGMII, or USGMII or USXGMII extenders. 32 of the ports can have a 1:1
mapping to the 32 SerDes.
Some additional ports (D65 to D69) are internal to the device and do not
connect to port modules or SerDes macros. For example, internal ports are
used for frame injection and extraction to the CPU queues.
The 65 logical ports are split up into the following blocks.
- 13 x 5G ports (D0-D11, D64)
- 32 x 2G5 ports (D16-D47)
- 12 x 10G ports (D12-D15, D48-D55)
- 8 x 25G ports (D56-D63)
Each logical port supports different line speeds, and depending on the
speeds supported, different port modules (MAC+PCS) are needed. A port
supporting 5 Gbps, 10 Gbps, or 25 Gbps as maximum line speed, will have a
DEV5G, DEV10G, or DEV25G module to support the 5 Gbps, 10 Gbps (incl 5
Gbps), or 25 Gbps (including 10 Gbps and 5 Gbps) speeds. As well as, it
will have a shadow DEV2G5 port module to support the lower speeds
(10/100/1000/2500Mbps). When a port needs to operate at lower speed and the
shadow DEV2G5 needs to be connected to its corresponding SerDes
Not all interface modes are supported in this series, but will be added at
a later stage.
Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: Bjarni Jonasson <bjarni.jonasson@microchip.com>
Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-06-24 07:07:52 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
|
|
/* Microchip Sparx5 Switch driver
|
|
|
|
*
|
|
|
|
* Copyright (c) 2021 Microchip Technology Inc. and its subsidiaries.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SPARX5_PORT_H__
|
|
|
|
#define __SPARX5_PORT_H__
|
|
|
|
|
|
|
|
#include "sparx5_main.h"
|
|
|
|
|
|
|
|
static inline bool sparx5_port_is_2g5(int portno)
|
|
|
|
{
|
|
|
|
return portno >= 16 && portno <= 47;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool sparx5_port_is_5g(int portno)
|
|
|
|
{
|
|
|
|
return portno <= 11 || portno == 64;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool sparx5_port_is_10g(int portno)
|
|
|
|
{
|
|
|
|
return (portno >= 12 && portno <= 15) || (portno >= 48 && portno <= 55);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool sparx5_port_is_25g(int portno)
|
|
|
|
{
|
|
|
|
return portno >= 56 && portno <= 63;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u32 sparx5_to_high_dev(int port)
|
|
|
|
{
|
|
|
|
if (sparx5_port_is_5g(port))
|
|
|
|
return TARGET_DEV5G;
|
|
|
|
if (sparx5_port_is_10g(port))
|
|
|
|
return TARGET_DEV10G;
|
|
|
|
return TARGET_DEV25G;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u32 sparx5_to_pcs_dev(int port)
|
|
|
|
{
|
|
|
|
if (sparx5_port_is_5g(port))
|
|
|
|
return TARGET_PCS5G_BR;
|
|
|
|
if (sparx5_port_is_10g(port))
|
|
|
|
return TARGET_PCS10G_BR;
|
|
|
|
return TARGET_PCS25G_BR;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int sparx5_port_dev_index(int port)
|
|
|
|
{
|
|
|
|
if (sparx5_port_is_2g5(port))
|
|
|
|
return port;
|
|
|
|
if (sparx5_port_is_5g(port))
|
|
|
|
return (port <= 11 ? port : 12);
|
|
|
|
if (sparx5_port_is_10g(port))
|
|
|
|
return (port >= 12 && port <= 15) ?
|
|
|
|
port - 12 : port - 44;
|
|
|
|
return (port - 56);
|
|
|
|
}
|
|
|
|
|
|
|
|
int sparx5_port_init(struct sparx5 *sparx5,
|
|
|
|
struct sparx5_port *spx5_port,
|
|
|
|
struct sparx5_port_config *conf);
|
|
|
|
|
|
|
|
int sparx5_port_config(struct sparx5 *sparx5,
|
|
|
|
struct sparx5_port *spx5_port,
|
|
|
|
struct sparx5_port_config *conf);
|
|
|
|
|
|
|
|
int sparx5_port_pcs_set(struct sparx5 *sparx5,
|
|
|
|
struct sparx5_port *port,
|
|
|
|
struct sparx5_port_config *conf);
|
|
|
|
|
|
|
|
int sparx5_serdes_set(struct sparx5 *sparx5,
|
|
|
|
struct sparx5_port *spx5_port,
|
|
|
|
struct sparx5_port_config *conf);
|
|
|
|
|
|
|
|
struct sparx5_port_status {
|
|
|
|
bool link;
|
|
|
|
bool link_down;
|
|
|
|
int speed;
|
|
|
|
bool an_complete;
|
|
|
|
int duplex;
|
|
|
|
int pause;
|
|
|
|
};
|
|
|
|
|
|
|
|
int sparx5_get_port_status(struct sparx5 *sparx5,
|
|
|
|
struct sparx5_port *port,
|
|
|
|
struct sparx5_port_status *status);
|
|
|
|
|
|
|
|
void sparx5_port_enable(struct sparx5_port *port, bool enable);
|
2021-08-19 07:39:39 +00:00
|
|
|
int sparx5_port_fwd_urg(struct sparx5 *sparx5, u32 speed);
|
net: sparx5: add port module support
This add configuration of the Sparx5 port module instances.
Sparx5 has in total 65 logical ports (denoted D0 to D64) and 33
physical SerDes connections (S0 to S32). The 65th port (D64) is fixed
allocated to SerDes0 (S0). The remaining 64 ports can in various
multiplexing scenarios be connected to the remaining 32 SerDes using
QSGMII, or USGMII or USXGMII extenders. 32 of the ports can have a 1:1
mapping to the 32 SerDes.
Some additional ports (D65 to D69) are internal to the device and do not
connect to port modules or SerDes macros. For example, internal ports are
used for frame injection and extraction to the CPU queues.
The 65 logical ports are split up into the following blocks.
- 13 x 5G ports (D0-D11, D64)
- 32 x 2G5 ports (D16-D47)
- 12 x 10G ports (D12-D15, D48-D55)
- 8 x 25G ports (D56-D63)
Each logical port supports different line speeds, and depending on the
speeds supported, different port modules (MAC+PCS) are needed. A port
supporting 5 Gbps, 10 Gbps, or 25 Gbps as maximum line speed, will have a
DEV5G, DEV10G, or DEV25G module to support the 5 Gbps, 10 Gbps (incl 5
Gbps), or 25 Gbps (including 10 Gbps and 5 Gbps) speeds. As well as, it
will have a shadow DEV2G5 port module to support the lower speeds
(10/100/1000/2500Mbps). When a port needs to operate at lower speed and the
shadow DEV2G5 needs to be connected to its corresponding SerDes
Not all interface modes are supported in this series, but will be added at
a later stage.
Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: Bjarni Jonasson <bjarni.jonasson@microchip.com>
Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-06-24 07:07:52 +00:00
|
|
|
|
|
|
|
#endif /* __SPARX5_PORT_H__ */
|