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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 17 May 2020 08:08:29 +0800
From:   Orson Zhai <orsonzhai@...il.com>
To:     Baolin Wang <baolin.wang7@...il.com>
Cc:     "lee.jones@...aro.org" <lee.jones@...aro.org>,
        "arnd@...db.de" <arnd@...db.de>, Mark Brown <broonie@...nel.org>,
        Lyra Zhang <zhang.lyra@...il.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 1/2] mfd: syscon: Support physical regmap bus

On Sat, May 16, 2020 at 6:13 PM Baolin Wang <baolin.wang7@...il.com> 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 a __weak function  for the syscon driver to allow to register

Typo -- duplicated "a".

It seems to be a better idea than before.

-Orson

> a physical regmap bus to support this new requirement.
>
> Signed-off-by: Baolin Wang <baolin.wang7@...il.com>
> ---
>  drivers/mfd/syscon.c       |  9 ++++++++-
>  include/linux/mfd/syscon.h | 11 +++++++++++
>  2 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
> index 3a97816d0cba..dc92f3177ceb 100644
> --- a/drivers/mfd/syscon.c
> +++ b/drivers/mfd/syscon.c
> @@ -40,6 +40,13 @@ static const struct regmap_config syscon_regmap_config = {
>         .reg_stride = 4,
>  };
>
> +struct regmap * __weak syscon_regmap_init(struct device_node *np,
> +                                         void __iomem *base,
> +                                         struct regmap_config *syscon_config)
> +{
> +       return regmap_init_mmio(NULL, base, syscon_config);
> +}
> +
>  static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
>  {
>         struct clk *clk;
> @@ -106,7 +113,7 @@ 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);
> +       regmap = syscon_regmap_init(np, base, &syscon_config);
>         if (IS_ERR(regmap)) {
>                 pr_err("regmap init failed\n");
>                 ret = PTR_ERR(regmap);
> diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h
> index 7f20e9b502a5..85088e44fe7c 100644
> --- a/include/linux/mfd/syscon.h
> +++ b/include/linux/mfd/syscon.h
> @@ -13,6 +13,7 @@
>
>  #include <linux/err.h>
>  #include <linux/errno.h>
> +#include <linux/regmap.h>
>
>  struct device_node;
>
> @@ -28,6 +29,9 @@ extern struct regmap *syscon_regmap_lookup_by_phandle_args(
>                                         const char *property,
>                                         int arg_count,
>                                         unsigned int *out_args);
> +extern struct regmap *syscon_regmap_init(struct device_node *np,
> +                                        void __iomem *base,
> +                                        struct regmap_config *syscon_config);
>  #else
>  static inline struct regmap *device_node_to_regmap(struct device_node *np)
>  {
> @@ -59,6 +63,13 @@ static inline struct regmap *syscon_regmap_lookup_by_phandle_args(
>  {
>         return ERR_PTR(-ENOTSUPP);
>  }
> +
> +static inline struct regmap *syscon_regmap_init(struct device_node *np,
> +                                               void __iomem *base,
> +                                               struct regmap_config *syscon_config)
> +{
> +       return ERR_PTR(-ENOTSUPP);
> +}
>  #endif
>
>  #endif /* __LINUX_MFD_SYSCON_H__ */
> --
> 2.17.1
>

Powered by blists - more mailing lists