linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang7@gmail.com>
To: Orson Zhai <orsonzhai@gmail.com>
Cc: "lee.jones@linaro.org" <lee.jones@linaro.org>,
	"arnd@arndb.de" <arnd@arndb.de>, Mark Brown <broonie@kernel.org>,
	Lyra Zhang <zhang.lyra@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 1/2] mfd: syscon: Support physical regmap bus
Date: Sun, 17 May 2020 16:56:53 +0800	[thread overview]
Message-ID: <CADBw62rt6ABu5A9ex2PkND-XYXNLV7b=HhG0RX-qxUUBphvSAQ@mail.gmail.com> (raw)
In-Reply-To: <CA+H2tpEJo3a7N5Sq0BzkGrGSrtBY61egZo9Xfc=nOMp2igKGFA@mail.gmail.com>

On Sun, May 17, 2020 at 8:08 AM Orson Zhai <orsonzhai@gmail.com> wrote:
>
> On Sat, May 16, 2020 at 6:13 PM Baolin Wang <baolin.wang7@gmail.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".

Ah, right, will fix.

>
> It seems to be a better idea than before.

Let's see Arnd and Lee's opinion.

>
> -Orson
>
> > a physical regmap bus to support this new requirement.
> >
> > Signed-off-by: Baolin Wang <baolin.wang7@gmail.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
> >



-- 
Baolin Wang

  reply	other threads:[~2020-05-17  8:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-16 10:12 [PATCH v4 0/2] Add new physical regmap bus support Baolin Wang
2020-05-16 10:12 ` [PATCH v4 1/2] mfd: syscon: Support physical regmap bus Baolin Wang
2020-05-17  0:08   ` Orson Zhai
2020-05-17  8:56     ` Baolin Wang [this message]
2020-05-19 13:18   ` Arnd Bergmann
2020-05-21  1:08     ` Orson Zhai
2020-05-16 10:12 ` [PATCH v4 2/2] soc: sprd: Add Spreadtrum special bits updating support 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='CADBw62rt6ABu5A9ex2PkND-XYXNLV7b=HhG0RX-qxUUBphvSAQ@mail.gmail.com' \
    --to=baolin.wang7@gmail.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=lee.jones@linaro.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).