From nobody Wed Oct 30 22:15:14 2024 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 6861FC77B7A for ; Fri, 26 May 2023 07:35:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242431AbjEZHfw (ORCPT ); Fri, 26 May 2023 03:35:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240830AbjEZHfi (ORCPT ); Fri, 26 May 2023 03:35:38 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 725C0E51 for ; Fri, 26 May 2023 00:35:05 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q2RyL-0005lZ-Dw; Fri, 26 May 2023 09:34:49 +0200 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1q2RyJ-002u6l-7M; Fri, 26 May 2023 09:34:47 +0200 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q2RyI-002nuF-8Z; Fri, 26 May 2023 09:34:46 +0200 From: Oleksij Rempel To: "David S. Miller" , Andrew Lunn , Eric Dumazet , Florian Fainelli , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , Woojung Huh , Arun Ramadoss Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com, "Russell King (Oracle)" Subject: [PATCH net-next v2 4/5] net: dsa: microchip: ksz8: Prepare ksz8863_smi for regmap register access validation Date: Fri, 26 May 2023 09:34:44 +0200 Message-Id: <20230526073445.668430-5-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230526073445.668430-1-o.rempel@pengutronix.de> References: <20230526073445.668430-1-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This patch prepares the ksz8863_smi part of ksz8 driver to utilize the regmap register access validation feature. Signed-off-by: Oleksij Rempel Reviewed-by: Vladimir Oltean --- drivers/net/dsa/microchip/ksz8863_smi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz8863_smi.c b/drivers/net/dsa/micr= ochip/ksz8863_smi.c index 2af807db0b45..fd6e2e69a42a 100644 --- a/drivers/net/dsa/microchip/ksz8863_smi.c +++ b/drivers/net/dsa/microchip/ksz8863_smi.c @@ -104,6 +104,7 @@ static const struct regmap_config ksz8863_regmap_config= [] =3D { .cache_type =3D REGCACHE_NONE, .lock =3D ksz_regmap_lock, .unlock =3D ksz_regmap_unlock, + .max_register =3D U8_MAX, }, { .name =3D "#16", @@ -113,6 +114,7 @@ static const struct regmap_config ksz8863_regmap_config= [] =3D { .cache_type =3D REGCACHE_NONE, .lock =3D ksz_regmap_lock, .unlock =3D ksz_regmap_unlock, + .max_register =3D U8_MAX, }, { .name =3D "#32", @@ -122,11 +124,14 @@ static const struct regmap_config ksz8863_regmap_conf= ig[] =3D { .cache_type =3D REGCACHE_NONE, .lock =3D ksz_regmap_lock, .unlock =3D ksz_regmap_unlock, + .max_register =3D U8_MAX, } }; =20 static int ksz8863_smi_probe(struct mdio_device *mdiodev) { + struct device *ddev =3D &mdiodev->dev; + const struct ksz_chip_data *chip; struct regmap_config rc; struct ksz_device *dev; int ret; @@ -136,9 +141,15 @@ static int ksz8863_smi_probe(struct mdio_device *mdiod= ev) if (!dev) return -ENOMEM; =20 + chip =3D device_get_match_data(ddev); + if (!chip) + return -EINVAL; + for (i =3D 0; i < __KSZ_NUM_REGMAPS; i++) { rc =3D ksz8863_regmap_config[i]; rc.lock_arg =3D &dev->regmap_mutex; + rc.wr_table =3D chip->wr_table; + rc.rd_table =3D chip->rd_table; dev->regmap[i] =3D devm_regmap_init(&mdiodev->dev, ®map_smi[i], dev, &rc); --=20 2.39.2