lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200424081138.GP3612@dell>
Date:   Fri, 24 Apr 2020 09:11:38 +0100
From:   Lee Jones <lee.jones@...aro.org>
To:     Baolin Wang <baolin.wang7@...il.com>
Cc:     arnd@...db.de, broonie@...nel.org, orsonzhai@...il.com,
        zhang.lyra@...il.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] mfd: syscon: Support physical regmap bus

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@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ