Received: by 10.192.165.156 with SMTP id m28csp2060441imm; Thu, 12 Apr 2018 08:00:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx49S26RRb6e+gSfJX04BCeI/AaIaFipeLd2Ux4l0RAEVR1OL3RaS3gH3FeUX7hx/C/bVYsq9 X-Received: by 10.99.117.20 with SMTP id q20mr989693pgc.16.1523545258640; Thu, 12 Apr 2018 08:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523545258; cv=none; d=google.com; s=arc-20160816; b=f7/jlP1hkim/AE5Nyh5UCBSM6pqJUtuEi3XXFnCoTE+v2awNxke4Lrbz1YoCpTJMYQ mszQRRjCnRUsT/fpK1X7yzd4ITUK4Vj62jZ0zjgezX2+2F5iQyNcT4/1o9O3AX5PcbYm 5IQLqHC4zNS5FCek4NnZ0LDCaNc9TP6YkFECesPZCvO3Q2OnlDv1qFGCiWy0fzR6FkRl 64OIkhCaozeN5ryItZ1OF6ovEvFsS2xjVr2pyz5RNZyeTDrVoQN5cHeqD73ZeLxJALIS TkKq+SUog0jdFGSOCBmtTKmmCiiwAdsLNyw35kGchQtnq43csZZwi2P6myHI/Yr+FWZU BLFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=/fsj10noIaw8pNaS7K/+ZYORBV55gwNU46pgP5Xu7is=; b=lICnIwbLnIHPQuw/9nvnIUL1j9RLTGYBSl7/dMnMv6xgbUeJMVFQgNW93C74PuUyNA g+VBqI1G3rd1qbM98oSkezfXgoUIkr3Tzr5Kgmfklnnn/WnLtmr/OCeSbmN717sE0cGS JHRTn5RidFy+w67+h82qn9hw80WC7RmXkSgiHam7/GE0zijKY8JPY/cfBNQP21WJykvd 65A/UhbL7tjU0cNZj/vWJUzlxVqCHZqMDg2PnS/VnXxxkU/8ylJke/Yjwu+ZNEOKXhRt ZT8GVcW7AZCTNBKmJccVgQboFz9wo3tFqd9wXAHBRmXSuKjipQ3RCo9rEj8QSBzE4XVW Smxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9-v6si3525064pll.67.2018.04.12.08.00.20; Thu, 12 Apr 2018 08:00:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752952AbeDLO4n (ORCPT + 99 others); Thu, 12 Apr 2018 10:56:43 -0400 Received: from mail.bootlin.com ([62.4.15.54]:57125 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752432AbeDLO4m (ORCPT ); Thu, 12 Apr 2018 10:56:42 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 429442037A; Thu, 12 Apr 2018 16:56:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (unknown [185.94.189.187]) by mail.bootlin.com (Postfix) with ESMTPSA id 04188200FB; Thu, 12 Apr 2018 16:56:29 +0200 (CEST) Date: Thu, 12 Apr 2018 16:56:28 +0200 From: Maxime Ripard To: Icenowy Zheng Cc: Rob Herring , Chen-Yu Tsai , Giuseppe Cavallaro , Corentin Labbe , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: Re: [PATCH 3/5] net: stmmac: dwmac-sun8i: Allow getting syscon regmap from device Message-ID: <20180412145628.iaaeue2imiijwx5d@flea> References: <20180411141641.14675-1-icenowy@aosc.io> <20180411141641.14675-4-icenowy@aosc.io> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rlwjjthzx46dcgln" Content-Disposition: inline In-Reply-To: <20180411141641.14675-4-icenowy@aosc.io> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --rlwjjthzx46dcgln Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 11, 2018 at 10:16:39PM +0800, Icenowy Zheng wrote: > From: Chen-Yu Tsai >=20 > On the Allwinner R40 SoC, the "GMAC clock" register is in the CCU > address space; on the A64 SoC this register is in the SRAM controller > address space, and with a different offset. >=20 > To access the register from another device and hide the internal > difference between the device, let it register a regmap named > "emac-clock". We can then get the device from the phandle, and > retrieve the regmap with dev_get_regmap(); in this situation the > regmap_field will be set up to access the only register in the regmap. >=20 > Signed-off-by: Chen-Yu Tsai > [Icenowy: change to use regmaps with single register, change commit > message] > Signed-off-by: Icenowy Zheng > --- > drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 48 +++++++++++++++++= +++++- > 1 file changed, 46 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-sun8i.c > index 1037f6c78bca..b61210c0d415 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > @@ -85,6 +85,13 @@ const struct reg_field old_syscon_reg_field =3D { > .msb =3D 31, > }; > =20 > +/* Specially exported regmap which contains only EMAC register */ > +const struct reg_field single_reg_field =3D { > + .reg =3D 0, > + .lsb =3D 0, > + .msb =3D 31, > +}; > + I'm not sure this would be wise. If we ever need some other register exported through the regmap, will have to change all the calling sites everywhere in the kernel, which will be a pain and will break bisectability. Chen-Yu's (or was it yours?) initial solution with a custom writeable hook only allowing a single register seemed like a better one. Maxime --=20 Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com --rlwjjthzx46dcgln Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAlrPc5sACgkQ0rTAlCFN r3Sfbg//cOLG/DT3g2+ze/UD63phm0FdBQpF9binOv9/geLQNTBfvMHYuxnrDv2p j1o3+rssM01VnQmA3D3xPfT+Q53j23l78X4E+5EZF2ow1nLrJ2Yw/VbnLquKclLn waQySC66t5eYqvgowgzfLJ0KOmv6W31olmMHimRu0axD55zbfL+6t33DVM4SBE8L U2aRL6NX3QF4K0bk+0fN8bWaeNbCtc0wlMh1gxqzDBxQO0XO4aTFkLdbQojwU9Xn NFAncEZYdUBjUVPtny+QTBp2NaGGEtKsysIItownueB8O8RvVnn0pCKsTToKgQZx 7zUy6QjP7yl5B1fSyGclDOi1O6+dUF3F/YgMhZNhhjpkRu3DcuHhy+3nDu/4ZH6l D1qi0Hnlc/asYl3rwyOwc1LYAzz5SVdLdjzJNaJeCxZrS7yTPsBUO82K9wy1+S0M /CeGQIAn9xHkgIilZLtzAexQGlSlo5n52OKK5xgeocoJd60GzGuJFLLSXYFX4y2G C9cI7C9Gbmh0bWPBbVHUJbRp26udKiBtpyvhCHE5Eo+C0y0BqFGtwyncmyglhwEv insJihyCqPF88XluhLUMdm8SEHLqpqhHsiDBcpPEItwCsGLu8mUF7whqecyfGESb FxcO4qaPpVLG165EDC0aZLgz/CBCa7cD0qIXWLXvpQfn5lwQGzk= =XQMc -----END PGP SIGNATURE----- --rlwjjthzx46dcgln--