From patchwork Thu Sep 22 04:00:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984521 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80738ECAAD8 for ; Thu, 22 Sep 2022 04:02:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230206AbiIVECZ (ORCPT ); Thu, 22 Sep 2022 00:02:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbiIVECT (ORCPT ); Thu, 22 Sep 2022 00:02:19 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2093.outbound.protection.outlook.com [40.107.94.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4DD8ABF1B; Wed, 21 Sep 2022 21:01:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DEom0gi1xsxgWQoHCmAwZclEO51Ni9zU2aOort7prwM1ivXY/Zx9jPPHDuKIzJaxC3l7pjx0zuHJHfRjLBsKB5llP0DqmtoUKzcjdxtxJo6TwH5e/eoPdB1L4y5nloqJIJYOQc8JS7w0C4W54sHoovqWBHbVQ72KDj03XpQJvi5XOqGbpnGa3a2hJ/PZpVVaJ/+OEqsgoN8Op8cfIPVuDIVU6vE9qWlj0Y4XuECXveWOex8AMdUVBwruDeTP6W9OE85C9ZVtI8sElWdRMP4LsxP7QeE2DKQrViWoGaHffHPYCHSXxXpjyW9T4ea7e1oHBu7R2epkz/0QK8jb4cJnDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ONGQW62+yNyoZT3WnR5IAKDU5JdjQ2yDFLrDWUVUYLQ=; b=DPd8f519570vtrqHe2phjf8MAv53csPpoz9Sz9kP4b52Wa9ILe7r5m1ZwoRtBW5pTxnpWA2NagPxVoIfPHw9btFczO0DscaVH3sMAaSEsPaSytayYFd0MTrwuNDfpAiWgSPpEHyyqQPpiWvM0917CC3wYtvKTJWUq/dXrdvMFidO2ulWCG3VVe0WdsSaoZz6Q62GQYEpmJl+jeXl2HtpGXmbzUMEgz1kbBjKjGKuea0dSPmZ/saLPdtblKeTdhw+PnHxZmaG33tPsyqjGZ/nNNwjDoL/nTv6NCj7XpeguVYYMBhzOkd4BGuFYVg6uw23nCmRztsau2ihaAqk9x5uOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ONGQW62+yNyoZT3WnR5IAKDU5JdjQ2yDFLrDWUVUYLQ=; b=VoUp0Vy/qVR/s0GHCj7c6ts9G8xnPs2S65gr8t0pQKAiXZBtRNAu4WNYZXYvWkFxvo6umOAG57PDYxvDbKVMvnBvPfU542Q4okTB1CU0hvszSuJR+eRjI5c9AImODxoDvY1TmSkpbSaazNQTEPKlqokcAjS/mB4R2DPqW3yATNM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by BN0PR10MB5158.namprd10.prod.outlook.com (2603:10b6:408:120::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 04:01:27 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:27 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn , Vladimir Oltean Subject: [PATCH v2 net-next 06/14] net: dsa: felix: add configurable device quirks Date: Wed, 21 Sep 2022 21:00:54 -0700 Message-Id: <20220922040102.1554459-7-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|BN0PR10MB5158:EE_ X-MS-Office365-Filtering-Correlation-Id: 15fd9cb1-acc8-44ea-191c-08da9c4f1f58 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JVq4meG3R4XwgL8ZmRW3H7kdhUYyK9p+FLuuM9IBE5SFII2MiIP6VNvUq7qMAN5FgiJI3ySvAhIYuswMHJEK4TgS3bKc91EyZi9utKKw1mDnZVVIwR3fV930vfPxpujymSqkAppf1w0LEZSlJHmJVZKHiHf7sVjcdspx4Qp09m77sWuxavrpA3lGrMcLJAtuuKH4ZTfvjbpzkCfPWX3oDjNuttQPn8/3RmTXtkBnMOMliX2EKyxRbP67tTVRVjIIvOCvWf8+N7DKeeW6lWnBmNIG51FW0+kUYcrOZZUJXA+i+FhD2tw+VbcEhVx8IKzOhcj84LuIL3vGdYG6ORAubxUc0v1HoEock1MKU5qdrEkCTGj8fkYrJaHbFhxP24lsyCpADvUjj63AYH3fgk0qu3Hs5LgLD8U7kaY9uW/O4sREeK8OIaF9azGv6fl8sqwaV/6jG65RptTTan2C+WaOakg4Onx7C61bEvC3W2ANg3Q8u/ya6eyHQX3w+LDaN/+9kRrOakNF8iWDWYHS+O2Mp28yGvKD9RyuO3fvixqjhveSapGXUm3rvkziYhhA7eOZtagxbHS7wv/Ye5hBmIv4W0GI2WTxCuQ4vZ6d+/Tq078ku0zY7n7X0F7evia0nwBh3xCwp+UPjGxSHfrIkZkVWwj3Ek/9C3eg4KFZNAX+qbz/Y5690b4PD0vdUmyvdpNSCLZOLEH0OZXXcTj4ixlccN9UjaTQqod9iiV7CeyeAqXxDBSN8D6RUl+UCm/AAf21 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(396003)(39840400004)(366004)(136003)(346002)(451199015)(6666004)(36756003)(41300700001)(8936002)(44832011)(26005)(6512007)(7416002)(6506007)(5660300002)(316002)(478600001)(54906003)(6486002)(38100700002)(8676002)(66476007)(66556008)(38350700002)(4326008)(66946007)(83380400001)(52116002)(1076003)(186003)(2616005)(86362001)(2906002);DIR:OUT;SFP:1102; X-MS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phDz65sQPEV5xTgSfsY22h2UT9tdaiWG9RPRXwXXHQRde3eHVgEYCmJJSrwEulBKRZNk2izBWNQYq60imgX48806U1CRxS1UjGmGHaNEVYLUkchsLSUiUkyym37ckal4IceZX+GHD4htnMheZTOYPNFWp6SaNY1qlOIaM1XyTQLJ1VgsSrx45flNr4Lz05UoxNBmr/R/lCA6qBmOtSDh5CIQkVTFLBbUOtSFdAY8S76eF4mcJyvtfkRNXUEn/nb8SffSXyFUQhl5iENbXUd5PsvpI2YV8/OauJebWQ3oGTEBhznATUtOmr/2RKrgObipz4SpZ3vJiB52NzX8BX6cVdl9lSaHSdtWC2mPDun6/QujqEeGv5VR6MzsuKMeSYTdyecnwXMgG7ZBZii/t3h0DByBKCVjrBD3t730B6zLBEN204XUHqTCetjt6AD9fFw9EByyZpuIQJrJrjjuiScGxWVx7ujKp5Ku8s7Q5Zmj6BArxIbSmwvtwgua5h3GETNMRQ6UCU9JJW9bTavHlTIvhCFFU66HO2czjR0sVav9IYQjKG68jFg3MaMptSOtI8EVLrb2Hl80/nAJGcxtQ== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15fd9cb1-acc8-44ea-191c-08da9c4f1f58 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:27.2781 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iN9x2nxNAcEuMdbdXc6RO1juCg4OsgDkiksJqXIRyPsE5aypIVi8piioINZB6TJ36tv3hV1g7S8JCasXeQpNAFGt4x7qLay0TaAz3WG76dk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5158 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The define FELIX_MAC_QUIRKS was used directly in the felix.c shared driver. Other devices (VSC7512 for example) don't require the same quirks, so they need to be configured on a per-device basis. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean --- v2 * No changes v1 from previous RFC: * No changes --- drivers/net/dsa/ocelot/felix.c | 7 +++++-- drivers/net/dsa/ocelot/felix.h | 1 + drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + drivers/net/dsa/ocelot/seville_vsc9953.c | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index d2a9d292160c..07c2f1b6913d 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1082,9 +1082,12 @@ static void felix_phylink_mac_link_down(struct dsa_switch *ds, int port, phy_interface_t interface) { struct ocelot *ocelot = ds->priv; + struct felix *felix; + + felix = ocelot_to_felix(ocelot); ocelot_phylink_mac_link_down(ocelot, port, link_an_mode, interface, - FELIX_MAC_QUIRKS); + felix->info->quirks); } static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, @@ -1099,7 +1102,7 @@ static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, ocelot_phylink_mac_link_up(ocelot, port, phydev, link_an_mode, interface, speed, duplex, tx_pause, rx_pause, - FELIX_MAC_QUIRKS); + felix->info->quirks); if (felix->info->port_sched_speed_set) felix->info->port_sched_speed_set(ocelot, port, speed); diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index e4fd5eef57a0..f94a445c2542 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -33,6 +33,7 @@ struct felix_info { u16 vcap_pol_base2; u16 vcap_pol_max2; const struct ptp_clock_info *ptp_caps; + unsigned long quirks; /* Some Ocelot switches are integrated into the SoC without the * extraction IRQ line connected to the ARM GIC. By enabling this diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 459288d6222c..4adb109c2e77 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -2605,6 +2605,7 @@ static const struct felix_info felix_info_vsc9959 = { .num_mact_rows = 2048, .num_ports = VSC9959_NUM_PORTS, .num_tx_queues = OCELOT_NUM_TC, + .quirks = FELIX_MAC_QUIRKS, .quirk_no_xtr_irq = true, .ptp_caps = &vsc9959_ptp_caps, .mdio_bus_alloc = vsc9959_mdio_bus_alloc, diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 3ce1cd1a8d4a..ba71e5fa5921 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1071,6 +1071,7 @@ static const struct felix_info seville_info_vsc9953 = { .vcap_pol_max = VSC9953_VCAP_POLICER_MAX, .vcap_pol_base2 = VSC9953_VCAP_POLICER_BASE2, .vcap_pol_max2 = VSC9953_VCAP_POLICER_MAX2, + .quirks = FELIX_MAC_QUIRKS, .num_mact_rows = 2048, .num_ports = VSC9953_NUM_PORTS, .num_tx_queues = OCELOT_NUM_TC,