Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1706252pxv; Sat, 10 Jul 2021 12:28:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm0QlFWL4onzFwTAB5pa9WfJ0tJSihwi/1mHm3nNCibkhmGjz4b8F9YF3+8OVle4onNIXb X-Received: by 2002:a05:6638:6a6:: with SMTP id d6mr5234942jad.118.1625945320868; Sat, 10 Jul 2021 12:28:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1625945320; cv=pass; d=google.com; s=arc-20160816; b=V7pFd3R5fVIQJ80pgL3nJeO0FYLAIQkgKnkCJ/B2NbzOBV8v/21u+T9zKwjkpCwepM gsaoloQnS8umx0ZQQtADIgDaU7NXPNhxf1clevn5FcIAbm51dAcqWzzu2yz6sgJkxVLh AvmnDMS6Wsho5rYaItXKdw3wrtNZ/i0hu85lRHrokjm4L1DNNi5TMgXtoYSfxeqiYBCT 7X5xb8NmJoeO6EHLgBLmjMhthCKcDth1fTwGhJtksF0C7G+YKI4oS0xOcOdldvnxiDkJ PCrBDJmQaLEJMzpahdOkkp+16mzMLs2CoWSruhj8LLhKMUY09Xh1RgvlVvdY5FLhEqtP Almw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=haGDF6utMR0NRHVAWsXQLK3t+CT5JeyKOm5VYtRbnAE=; b=BV8cgvwZdGT+VCfDtlRnBedc2GBUesDgh8XmX1ifDSLQ2DqRkllxtDshF+mJbalyvc GOOb2SvINrDlXKtE9yGu/QtRkR2mn/+TeEfJ7hEDtwPg1vxVsweFwhcXt3ZIjDUBSoQO tGalTGz/8A/32Vgz9uEKTTKX8ZAqMB4OwaClpwn8+69BbaP+cvj5+b0Y05cuGtL/SdAz tUPOEc/PULtnmhcu3z1EwWV1aadPgjA/7L0o9GTmUYlC2v7NMIUa+vWr2o/PO8WZz0wF 6O4HQ5hXX0fPmPVchTLUb8qU4ZJ+O9f/xKBuLfEh/xmM9vH2Y6wRVaNPLY0rnRs5MP+t YSgA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=dThMGPpp; arc=pass (i=1 spf=pass spfdomain=in-advantage.com dkim=pass dkdomain=in-advantage.com dmarc=pass fromdomain=in-advantage.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=in-advantage.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w132si10311126jab.61.2021.07.10.12.28.29; Sat, 10 Jul 2021 12:28:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=dThMGPpp; arc=pass (i=1 spf=pass spfdomain=in-advantage.com dkim=pass dkdomain=in-advantage.com dmarc=pass fromdomain=in-advantage.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=in-advantage.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231913AbhGJT3a (ORCPT + 99 others); Sat, 10 Jul 2021 15:29:30 -0400 Received: from mail-bn7nam10on2107.outbound.protection.outlook.com ([40.107.92.107]:9249 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231183AbhGJT3L (ORCPT ); Sat, 10 Jul 2021 15:29:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B4wVgXL1KlZ07jRT9UH6yTpgx1PffDWX9HbpB9eHkPoB/2tKce9tXOfPStm2sjAVX15tHL47uWvq0qez7aBOmWqsn25pk1HKlPk4OYq6kmh3rheHSy+61M71uAo5QSzQsjwsyfaBQ9hfv/c5jawq/A5+niKfUgSlO3Pcr4kYvO1oNBwlq8rXMcvDZvv+1f7uHKEwNJocUxmoyckTvT+CynTFzc4rBbWVuMOWqiMRlqBlFmLmputbH17xOFQJYTAQXb49XEvh4AapVZeKN+aSPNQAR3oAZCUuOoMGslWNZ8PozJEE6Gl1MdfRn73fzHqNcig7UU7IBMlH43silpCb1w== 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-SenderADCheck; bh=haGDF6utMR0NRHVAWsXQLK3t+CT5JeyKOm5VYtRbnAE=; b=mNisK6c/DwuhkOedPnZ+SeTKn17dw0ZLNlojgStjvdt9llKjr4V7T888GRkzIXbEtKfx1k2BidBFRyvjV9GniNttwGNJYllIA2RsAGSL1YWelJVtMmVDMVnVW2Yf51XFks96WkALcbw4a3h1toYCkQ0MwiBr3eTTw20Z9SeENVvs49yYZeSlK/Uzn7sv8uJgvMf3tAGNoAMkjTX99OMNHgGXQC6tzQWUmRltYeqlCZYvF/4ZuQqvHWfmfgMAMt/BRFWYAyWsdRr9Zgs96DzHaXVJ0H0UqACmkXYS7fNN68Z+PnHODVEymqmboC4qAo9tKQGUdg5Y5vOxbARgH3Vxfw== 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=haGDF6utMR0NRHVAWsXQLK3t+CT5JeyKOm5VYtRbnAE=; b=dThMGPppGECX6TmerjQYM+qVHLx4Wh/kJamGXym4kWib5GxEnt+myAclNLrV0pggAYpWxu0KbavqcbwVM1Rejaap0mVcj+YGc4eqGxb+msskkKsoaGzTPUeqAkJdc9a0+pL2JdnU9xoh/6R0TotVmZBxxpNeL20per8MZoECoEg= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by MWHPR10MB1709.namprd10.prod.outlook.com (2603:10b6:301:7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.22; Sat, 10 Jul 2021 19:26:19 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::e81f:cf8e:6ad6:d24d]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::e81f:cf8e:6ad6:d24d%3]) with mapi id 15.20.4287.033; Sat, 10 Jul 2021 19:26:19 +0000 From: Colin Foster To: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org, claudiu.manoil@nxp.com, alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com, linux@armlinux.org.uk Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 net-next 4/8] net: dsa: ocelot: felix: add interface for custom regmaps Date: Sat, 10 Jul 2021 12:25:58 -0700 Message-Id: <20210710192602.2186370-5-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210710192602.2186370-1-colin.foster@in-advantage.com> References: <20210710192602.2186370-1-colin.foster@in-advantage.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MWHPR12CA0042.namprd12.prod.outlook.com (2603:10b6:301:2::28) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.185.175.147) by MWHPR12CA0042.namprd12.prod.outlook.com (2603:10b6:301:2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.19 via Frontend Transport; Sat, 10 Jul 2021 19:26:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 82d10a0d-03bb-4738-b081-08d943d897c9 X-MS-TrafficTypeDiagnostic: MWHPR10MB1709: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iL6qJizkdoCgJ4uryOfk/iGMz8UuWb+6sL22Jri/sWQPwGn9mWDr5Ev6i8m5jwH4nX6J4PNXfRsNqWo4ruiegxr0d9Rw9yWmuPfZstLUOEcNCY3TyeMVUxjwPooGZk3RfiShOIK9gAzps+9wH2HKJoFUD0wEi95RziEq/l5gwHSZ7gfQUTSiz0Q+n+2zEHm2lqtn6sMCaS5q349KvJJ0FnQdcvklApQvV95G9UjphuVC95A/QbslWWrZiCYJmpP+kD1snmwxMWmvDUzULiaE6S/JSZqw/PSzkZEL0gx6hWgxFU4Yicg2YHX3+nrG/5jYRB/00/R3yM7pNf9cQqsDUuyInrfiVotfoOPKTTUMlsO6c1V8Jf+OaX6TG1ZgCEr/+8lh2hUCKcaLKY4T/ssNNukHNWahKvTIq1PVLGKAew01e0cYhktFsVjer5Yk1NEWyWsFN/jfg4Q7+en9taxaRb1QG6XgXnv1OOOszSxopFXTD6K3mdtEqt3XbaHsD+JM4ITE32Xe4rU+hw6LcXLkpQ09jR8HJyzlUaKtbJF2IVxM5YEPqAfUr9dHIzPB0CKLthogB4RIzVN1uUQ0HU767JV+oKLIQEcCdxdqyySElJMCn84MtFm/zCJ6LHlWIqQudcopHRaOXoqgEVigM3uNrADSxuJMRhYRK4jgo9/7Z4FodkB+StuRJc08iTfhNnD5bTF93kgjNB/5Wts/F7IqQ6KNvU+dwUJj1hS0Ln/oY1o= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(396003)(376002)(39830400003)(136003)(366004)(8936002)(7416002)(6506007)(5660300002)(2906002)(66556008)(26005)(2616005)(8676002)(44832011)(6486002)(6512007)(66476007)(6666004)(38100700002)(38350700002)(52116002)(66946007)(921005)(4326008)(956004)(83380400001)(1076003)(316002)(36756003)(86362001)(186003)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?twsCcOfPocWpVzhA1oQUWnAnevy6zR6emL0vLy7Jsc1tfPMfXfdwZjyPd2cR?= =?us-ascii?Q?61lcT3Bc3VT7pPZmWrbTDdwQSt17XJvQxmCG2qCcbYMRaUmCYeiBGtCH3Z+k?= =?us-ascii?Q?Wg9Dbo8n3dxgZrtCTm8oow0rOSfhREnpSWZFUNRzwoWaCJF7XEbMEt3xdfc8?= =?us-ascii?Q?BWSwkO82lsmiEDWk308BW0PD/C4APs5/GQ5OtCtGMtxKWr9ewCeN1Kk61jsb?= =?us-ascii?Q?SVlf/4cgV8xfSvklrfK8YWdnfN2dbBVDpHzy3Sq2t978cXROluy8KX2eiNcO?= =?us-ascii?Q?WHtMlhzhSesl/mq0NUun3B1UkfE2f09AC8STRV7Y2D18oMvWf3lNWVwxAkzm?= =?us-ascii?Q?nvt57xzi+4tQc63i6s+OQ1EopKtttWkL9+wohy0PVrxQBQWE5YeQAgtQo7UX?= =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WU+hMNYmY7XN8vwh9uED?= =?us-ascii?Q?JceZFfTtwOZmYZ1+yMQhUUmQ?= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82d10a0d-03bb-4738-b081-08d943d897c9 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2021 19:26:18.9749 (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: A7KmysJDQDXjdkzvDE2NUOBo9392XFwVNQnHV+CJsH1vChMeyavCzA/hqIMHYKjDcwIV5tzqm8vmTnxgdOPTcvj2w0C2K57ZzHzCa2pHiys= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1709 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add an interface so that non-mmio regmaps can be used Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/felix.c | 4 ++-- drivers/net/dsa/ocelot/felix.h | 2 ++ drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + drivers/net/dsa/ocelot/seville_vsc9953.c | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 74ae322b2126..77644deb4a35 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1124,7 +1124,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) res.start += felix->switch_base; res.end += felix->switch_base; - target = ocelot_regmap_init(ocelot, &res); + target = felix->info->init_regmap(ocelot, &res); if (IS_ERR(target)) { dev_err(ocelot->dev, "Failed to map device memory space\n"); @@ -1161,7 +1161,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) res.start += felix->switch_base; res.end += felix->switch_base; - target = ocelot_regmap_init(ocelot, &res); + target = felix->info->init_regmap(ocelot, &res); if (IS_ERR(target)) { dev_err(ocelot->dev, "Failed to map memory space for port %d\n", diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index 47769dd386db..25f664ef4947 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -45,6 +45,8 @@ struct felix_info { enum tc_setup_type type, void *type_data); void (*port_sched_speed_set)(struct ocelot *ocelot, int port, u32 speed); + struct regmap *(*init_regmap)(struct ocelot *ocelot, + struct resource *res); }; extern const struct dsa_switch_ops felix_switch_ops; diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 182ca749c8e2..31712a77f4b4 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1367,6 +1367,7 @@ static const struct felix_info felix_info_vsc9959 = { .prevalidate_phy_mode = vsc9959_prevalidate_phy_mode, .port_setup_tc = vsc9959_port_setup_tc, .port_sched_speed_set = vsc9959_sched_speed_set, + .init_regmap = ocelot_regmap_init, }; static irqreturn_t felix_irq_handler(int irq, void *data) diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 0e06750db264..540cf5bc9c54 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1089,6 +1089,7 @@ static const struct felix_info seville_info_vsc9953 = { .mdio_bus_free = vsc9953_mdio_bus_free, .phylink_validate = vsc9953_phylink_validate, .prevalidate_phy_mode = vsc9953_prevalidate_phy_mode, + .init_regmap = ocelot_regmap_init, }; static int seville_probe(struct platform_device *pdev) -- 2.25.1