]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: sparx5: add function for RGMII port check
authorDaniel Machon <daniel.machon@microchip.com>
Fri, 20 Dec 2024 13:48:41 +0000 (14:48 +0100)
committerJakub Kicinski <kuba@kernel.org>
Mon, 23 Dec 2024 18:57:54 +0000 (10:57 -0800)
The lan969x device contains two RGMII port interfaces, sitting at port
28 and 29. Add function: is_port_rgmii() to the match data ops, that
checks if a given port is an RGMII port or not. For Sparx5, this
function always returns false.

Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com>
Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Tested-by: Robert Marko <robert.marko@sartura.hr>
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://patch.msgid.link/20241220-sparx5-lan969x-switch-driver-4-v5-2-fa8ba5dff732@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.c
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.h
drivers/net/ethernet/microchip/sparx5/sparx5_main.c
drivers/net/ethernet/microchip/sparx5/sparx5_main.h
drivers/net/ethernet/microchip/sparx5/sparx5_port.h

index c2afa2176b08f3c44465016938b3dd559c27e1af..76f0c8635eb982ba6c3f65550036cabfb7b52ed0 100644 (file)
@@ -329,6 +329,7 @@ static const struct sparx5_ops lan969x_ops = {
        .is_port_5g              = &lan969x_port_is_5g,
        .is_port_10g             = &lan969x_port_is_10g,
        .is_port_25g             = &lan969x_port_is_25g,
+       .is_port_rgmii           = &lan969x_port_is_rgmii,
        .get_port_dev_index      = &lan969x_port_dev_mapping,
        .get_port_dev_bit        = &lan969x_get_dev_mode_bit,
        .get_hsch_max_group_rate = &lan969x_get_hsch_max_group_rate,
index 2489d0d32dfd1d3929bfa0b4dcf079a0b4a80b5c..4b91c47d6d216a1b015edd181c7c76b63c70722c 100644 (file)
@@ -59,6 +59,11 @@ static inline bool lan969x_port_is_25g(int portno)
        return false;
 }
 
+static inline bool lan969x_port_is_rgmii(int portno)
+{
+       return portno == 28 || portno == 29;
+}
+
 /* lan969x_calendar.c */
 int lan969x_dsm_calendar_calc(struct sparx5 *sparx5, u32 taxi,
                              struct sparx5_calendar_data *data);
index f61aa15beab7c677d243261d855d08a4922e7925..4be717ba7d3731e40bf91cee06209dc485be08ee 100644 (file)
@@ -1072,6 +1072,7 @@ static const struct sparx5_ops sparx5_ops = {
        .is_port_5g              = &sparx5_port_is_5g,
        .is_port_10g             = &sparx5_port_is_10g,
        .is_port_25g             = &sparx5_port_is_25g,
+       .is_port_rgmii           = &sparx5_port_is_rgmii,
        .get_port_dev_index      = &sparx5_port_dev_mapping,
        .get_port_dev_bit        = &sparx5_port_dev_mapping,
        .get_hsch_max_group_rate = &sparx5_get_hsch_max_group_rate,
index d5dd953b0a71d9b60c932b561dc51955c6e62e54..c58d7841638efee112cd7dfac0e927b6380303aa 100644 (file)
@@ -313,6 +313,7 @@ struct sparx5_ops {
        bool (*is_port_5g)(int portno);
        bool (*is_port_10g)(int portno);
        bool (*is_port_25g)(int portno);
+       bool (*is_port_rgmii)(int portno);
        u32  (*get_port_dev_index)(struct sparx5 *sparx5, int port);
        u32  (*get_port_dev_bit)(struct sparx5 *sparx5, int port);
        u32  (*get_hsch_max_group_rate)(int grp);
index 9b9bcc6834bcb8ea205e1d382b93a95edbaf8bf8..c8a37468a3d1d96c670520d028736765352bc8fe 100644 (file)
@@ -40,6 +40,11 @@ static inline bool sparx5_port_is_25g(int portno)
        return portno >= 56 && portno <= 63;
 }
 
+static inline bool sparx5_port_is_rgmii(int portno)
+{
+       return false;
+}
+
 static inline u32 sparx5_to_high_dev(struct sparx5 *sparx5, int port)
 {
        const struct sparx5_ops *ops = sparx5->data->ops;