linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Baolin Wang <baolin.wang7@gmail.com>
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
Date: Fri, 24 Apr 2020 09:11:38 +0100	[thread overview]
Message-ID: <20200424081138.GP3612@dell> (raw)
In-Reply-To: <96d444cd73239e0166316bd8f44082031cf72491.1587088646.git.baolin.wang7@gmail.com>

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 <baolin.wang7@gmail.com>
> ---
>  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 <linux/slab.h>
>  
>  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

  reply	other threads:[~2020-04-24  8:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17  2:14 [PATCH 0/2] Add new reg_update_bits() support Baolin Wang
2020-04-17  2:14 ` [PATCH 1/2] mfd: syscon: Support physical regmap bus Baolin Wang
2020-04-24  8:11   ` Lee Jones [this message]
2020-04-24  8:24     ` Arnd Bergmann
2020-04-24  8:32       ` Lee Jones
2020-04-24  8:42         ` Baolin Wang
2020-04-24  8:43           ` Baolin Wang
2020-04-17  2:14 ` [PATCH 2/2] soc: sprd: Add Spreadtrum special bits updating support Baolin Wang
2020-04-17 13:38   ` Arnd Bergmann
2020-04-17 14:10     ` Baolin Wang
2020-04-17 15:03       ` Arnd Bergmann
2020-04-18  1:52         ` Baolin Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200424081138.GP3612@dell \
    --to=lee.jones@linaro.org \
    --cc=arnd@arndb.de \
    --cc=baolin.wang7@gmail.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).