Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp345634ybz; Fri, 24 Apr 2020 01:13:47 -0700 (PDT) X-Google-Smtp-Source: APiQypLdTGGSICvMQ1v+mvt7RBP5bZjOPHDQNJZqvxC0TlzM910+rzW+eSEIV1ordt3IVJykqoJx X-Received: by 2002:a17:906:68d7:: with SMTP id y23mr6339891ejr.85.1587716027700; Fri, 24 Apr 2020 01:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587716027; cv=none; d=google.com; s=arc-20160816; b=ssJSKb1LbYybsfnIP8TgwO+vmxJR5hXNdhHTRhhVs6qZB0YqdhnvWY7YW1iSCCFztC Hy7w5RAFgaMMGYKcoC1BMfRapGH493bbxP2XMQ2uhxnwc9HZQ1QrFMG6nF0PTtZgh6BN 1eNWuzP3J3oqlRYyLaW6/ZyR0RkXTSWJaX7nju7Kegh+COFBcauCe8mAu4WrMmikOwLd ykNsgkGmHpkGyGvpaT/AVQYlbcG8U0aUaqLf8OvmqOaIgs+lZrR+oUe8/QiDfDSEVqef 8sFgou8W29GDUooN7Bs4sTF1H6MkpxsPVhrXBsVnJkAPvwKZbl9U3OSwg5f+vaS5p70O Qk0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hiE27VPhmZb7xhRucKTopRYedmpv9Tlk0yQXbcKINMo=; b=F94ZU19X4N/So+6Qnp8xUaeBXcHGQHMXgk0Ukydtv1RxUVgYmToIbSW5Yu88QhRfZ4 5+xTrPMJrzj+y0nu8AkBNRtCY0ZEOFqdjdfdHwI/OcvDBpmPVCmUYQ5cRo3iXoPtvHvM nhv24xtJ8MnGZ+NvuWxCB0wJNyT/zYgtAyd/HNksUzSqHD9WVJm/9BcG3O7y6qcAzNq+ LZAkPbFRx36rgHqiXU1eGPdKferpJEDY2XKEMpZ96GsQmHFhG5/rqzP2VRXZ1a2uvoTc YGjCUEoT+5k/T3hCjN+WnK7C+iarA5gzrk5amDSlf4x1oGQ2m1/cDr9QriCO/OUaZR5V jozw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SSDEm3dh; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do9si3377945ejc.515.2020.04.24.01.13.24; Fri, 24 Apr 2020 01:13:47 -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=@linaro.org header.s=google header.b=SSDEm3dh; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726648AbgDXILm (ORCPT + 99 others); Fri, 24 Apr 2020 04:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726028AbgDXILm (ORCPT ); Fri, 24 Apr 2020 04:11:42 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36647C09B045 for ; Fri, 24 Apr 2020 01:11:42 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id e26so9424537wmk.5 for ; Fri, 24 Apr 2020 01:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=hiE27VPhmZb7xhRucKTopRYedmpv9Tlk0yQXbcKINMo=; b=SSDEm3dhHrERptiGlqEfdVxgtY6zgNxL1VHMMmjQ/ueete9/H30cRCznUKkCBJsX7S r0ykQfWgh04nFs/p2IUrMidZvjFD8Ejzd/u3NUJO9212/06rsl8YcMBUqMsJ241q/gjC yXpXPIuvAG9auH6zJ996EgF18J3+Dinar7k/kbBsJsrxkdPaDLYIp3+3/h/BZIFAxmEv 654ldb3F5rYoJwRGNLaOD3S3f1ssqI1t2bX/ar6esZnMSk1y3qtl+hvJUplJoE6YlIlf 8e40gJpLxNKcYznfh6fZeEHTq4kAR9+tzjaGa8+J0GlFu4ZWCcg1xnzdoNKcIjtC8P4X awYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=hiE27VPhmZb7xhRucKTopRYedmpv9Tlk0yQXbcKINMo=; b=mFBeuegsymuWBkc9w5JQ7Qm8ArxfHcrJVbIBlwUpOBPJJxxony6/7IcKmYEkGW+Rbi GD8j7fHRks9RVj7hWipP6wfc/M2z7MfQNKCbh+nq7lZ1a4qKQfg1Xv1qB5Yv8arCglzv ZN/THOJ5PzAf3t33DxW6jq5wNDFunXaeG2rMyadOFK6j0vCxjgTW/UYiSukuhww8vfG+ U32iocvIzIdAqEBE49x2k0kVlEtbLuuSDavACUzmCo5GOKQ3PpKc5aAjcppzUWnlxTC1 3O2RE7AsVTYvsuDXRsPIpwqwYHxC0G88dQ9r8NJzN0HK0ZxrZbckiCflJtNpX1VyJM0m z4yg== X-Gm-Message-State: AGi0PuZZoRQIxVNJvw8u4a++Ll4BpZVb38oif/6mLtfgDgxcFYrgcqbx 2m2P9aKvw21xIm9+botR+uRPTw== X-Received: by 2002:a7b:c14b:: with SMTP id z11mr8443479wmi.44.1587715900759; Fri, 24 Apr 2020 01:11:40 -0700 (PDT) Received: from dell ([2.31.163.63]) by smtp.gmail.com with ESMTPSA id j68sm7335309wrj.32.2020.04.24.01.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 01:11:39 -0700 (PDT) Date: Fri, 24 Apr 2020 09:11:38 +0100 From: Lee Jones To: Baolin Wang Cc: arnd@arndb.de, broonie@kernel.org, orsonzhai@gmail.com, zhang.lyra@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] mfd: syscon: Support physical regmap bus Message-ID: <20200424081138.GP3612@dell> References: <96d444cd73239e0166316bd8f44082031cf72491.1587088646.git.baolin.wang7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <96d444cd73239e0166316bd8f44082031cf72491.1587088646.git.baolin.wang7@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 17 Apr 2020, Baolin Wang wrote: > Some platforms such as Spreadtrum platform, define a special method to > update bits of the registers instead of reading and writing, which means > we should use a physical regmap bus to define the reg_update_bits() > operation instead of the MMIO regmap bus. > > Thus add a new helper for the syscon driver to allow to register a physical > regmap bus to support this new requirement. > > Signed-off-by: Baolin Wang > --- > drivers/mfd/syscon.c | 23 +++++++++++++++++++++-- > include/linux/mfd/syscon.h | 7 +++++++ > 2 files changed, 28 insertions(+), 2 deletions(-) > > diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c > index 3a97816d0cba..92bfe87038ca 100644 > --- a/drivers/mfd/syscon.c > +++ b/drivers/mfd/syscon.c > @@ -24,6 +24,7 @@ > #include > > static struct platform_driver syscon_driver; > +static struct regmap_bus *syscon_phy_regmap_bus; > > static DEFINE_SPINLOCK(syscon_list_slock); > static LIST_HEAD(syscon_list); > @@ -106,14 +107,25 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk) > syscon_config.val_bits = reg_io_width * 8; > syscon_config.max_register = resource_size(&res) - reg_io_width; > > - regmap = regmap_init_mmio(NULL, base, &syscon_config); > + /* > + * The Spreadtrum syscon need register a real physical regmap bus > + * with new atomic bits updating operation instead of using > + * read-modify-write. > + */ > + if (IS_ENABLED(CONFIG_ARCH_SPRD) && > + of_device_is_compatible(np, "sprd,atomic-syscon") && Please find a more generic way of supporting your use-case. This is a generic driver, and as such I am vehemently against adding any sort of vendor specific code in here. > + syscon_phy_regmap_bus) > + regmap = regmap_init(NULL, syscon_phy_regmap_bus, base, > + &syscon_config); > + else > + regmap = regmap_init_mmio(NULL, base, &syscon_config); -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog