Messages in this thread | | | From | Baolin Wang <> | Date | Sun, 17 May 2020 16:56:53 +0800 | Subject | Re: [PATCH v4 1/2] mfd: syscon: Support physical regmap bus |
| |
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
| |