From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CB7E0C0015E for ; Wed, 9 Aug 2023 15:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:CC:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0gU30d5sEyvBaHLxkau/4szcfmWJIn0NzdB+tJRqyw4=; b=qnZf0bTDAWZZcM XWqZVs8/qgJjvSME0KQLTCcFXuT84YJRzu4hk/ZQWgYc+VTHXCH1w6GS/BhYcgp7VSGquFByuk5h2 pUqQM1LQDQPKhIFDKhZ/uJdYBEbqwT33ymsitKX4TxWXMgjorj/CY8FfOjAvnRd/ze2/UnMn1NGdr oI80kVqNqNx5D0alrfKODcAQ6HhvSJ9YdPnDYgHSyDWDZSijDcDxhc1GCpbBOIHDtDmoFqqIojHQ1 AR7Vbjxrwf/xp4Ekge5PqYFyTN+0ZEF61XfSmRzjB46hnKwaFPi7spzo8wnXpT/4rK306u9YkAqJD jd6duh1IO7zKuCrru+gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTkfu-005FjL-0Z; Wed, 09 Aug 2023 15:00:38 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTkfr-005Fiv-2u for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 15:00:37 +0000 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 379F0Dbs007717; Wed, 9 Aug 2023 10:00:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1691593213; bh=i7bVCI+bG8yEkvK35K3cSP5/2aCwy76gPfSYzYfAe9k=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=DY40GdSO3gGinENEsD+wo4qhSAQ4Yh/Zh7fzsSBrnHd55ucWXGFIWEz3ICZqOsdSR 9qd15qSCMEroMBYRk3iuN+Iq4B1dYf7xryM2Imtf3LZ5u58KSmUeZoDuyuULQamhmj f6SmIlj3Tebj/Y9dPd+umScVxV/AiLKnKhfjC884= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 379F0Dtv029675 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 9 Aug 2023 10:00:13 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 9 Aug 2023 10:00:12 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Wed, 9 Aug 2023 10:00:13 -0500 Received: from [10.250.38.120] (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 379F0BWH057964; Wed, 9 Aug 2023 10:00:11 -0500 Message-ID: Date: Wed, 9 Aug 2023 10:00:11 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v3 3/5] net: ti: icss-iep: Add IEP driver Content-Language: en-US To: MD Danish Anwar , Randy Dunlap , Roger Quadros , Simon Horman , Vignesh Raghavendra , Andrew Lunn , Richard Cochran , Conor Dooley , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" CC: , , , , , , References: <20230809114906.21866-1-danishanwar@ti.com> <20230809114906.21866-4-danishanwar@ti.com> From: Andrew Davis In-Reply-To: <20230809114906.21866-4-danishanwar@ti.com> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_080036_021039_D37FC32D X-CRM114-Status: GOOD ( 26.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 8/9/23 6:49 AM, MD Danish Anwar wrote: > From: Roger Quadros > > Add a driver for Industrial Ethernet Peripheral (IEP) block of PRUSS to > support timestamping of ethernet packets and thus support PTP and PPS > for PRU ethernet ports. > > Signed-off-by: Roger Quadros > Signed-off-by: Lokesh Vutla > Signed-off-by: Murali Karicheri > Signed-off-by: Vignesh Raghavendra > Signed-off-by: MD Danish Anwar > --- > drivers/net/ethernet/ti/Kconfig | 12 + > drivers/net/ethernet/ti/Makefile | 1 + > drivers/net/ethernet/ti/icssg/icss_iep.c | 935 +++++++++++++++++++++++ > drivers/net/ethernet/ti/icssg/icss_iep.h | 38 + > 4 files changed, 986 insertions(+) > create mode 100644 drivers/net/ethernet/ti/icssg/icss_iep.c > create mode 100644 drivers/net/ethernet/ti/icssg/icss_iep.h > > diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig > index 63e510b6860f..88b5b1b47779 100644 > --- a/drivers/net/ethernet/ti/Kconfig > +++ b/drivers/net/ethernet/ti/Kconfig > @@ -186,6 +186,7 @@ config CPMAC > config TI_ICSSG_PRUETH > tristate "TI Gigabit PRU Ethernet driver" > select PHYLIB > + select TI_ICSS_IEP Why not save selecting this until you add its use in the ICSSG_PRUETH driver in the next patch. [...] > + > +static u32 icss_iep_readl(struct icss_iep *iep, int reg) > +{ > + return readl(iep->base + iep->plat_data->reg_offs[reg]); > +} Do these one line functions really add anything? Actually why not use the regmap you have here. [...] > +static void icss_iep_enable(struct icss_iep *iep) > +{ > + regmap_update_bits(iep->map, ICSS_IEP_GLOBAL_CFG_REG, > + IEP_GLOBAL_CFG_CNT_ENABLE, > + IEP_GLOBAL_CFG_CNT_ENABLE); Have you looked into regmap_fields? [...] > + > + if (!!(iep->latch_enable & BIT(index)) == !!on) > + goto exit; > + There has to be a better way to write this logic.. [...] > + > +static const struct of_device_id icss_iep_of_match[]; > + Why the forward declaration? > +static int icss_iep_probe(struct platform_device *pdev) > +{ > + struct device *dev = &pdev->dev; > + struct icss_iep *iep; > + struct clk *iep_clk; > + > + iep = devm_kzalloc(dev, sizeof(*iep), GFP_KERNEL); > + if (!iep) > + return -ENOMEM; > + > + iep->dev = dev; > + iep->base = devm_platform_ioremap_resource(pdev, 0); > + if (IS_ERR(iep->base)) > + return -ENODEV; > + > + iep_clk = devm_clk_get(dev, NULL); > + if (IS_ERR(iep_clk)) > + return PTR_ERR(iep_clk); > + > + iep->refclk_freq = clk_get_rate(iep_clk); > + > + iep->def_inc = NSEC_PER_SEC / iep->refclk_freq; /* ns per clock tick */ > + if (iep->def_inc > IEP_MAX_DEF_INC) { > + dev_err(dev, "Failed to set def_inc %d. IEP_clock is too slow to be supported\n", > + iep->def_inc); > + return -EINVAL; > + } > + > + iep->plat_data = of_device_get_match_data(dev); Directly using of_*() functions is often wrong, try just device_get_match_data(). [...] > +static struct platform_driver icss_iep_driver = { > + .driver = { > + .name = "icss-iep", > + .of_match_table = of_match_ptr(icss_iep_of_match), This driver cannot work without OF, using of_match_ptr() is not needed. Andrew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel