All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
To: u-boot@lists.denx.de
Subject: [PATCH v1 1/3] drivers: pinctrl-single: handle different register width
Date: Thu, 30 Apr 2020 15:36:38 +0530	[thread overview]
Message-ID: <CAHO=5PGPSP1GO0qP=tYvuYSbwy1DtzCPnaVKx+EKHXzSGw_1rw@mail.gmail.com> (raw)
In-Reply-To: <CAPnjgZ3zN-Sxsuo47YOfPTOOmatiggupdFk6ZY18+J+3gSefJA@mail.gmail.com>

On Wed, Apr 29, 2020 at 11:34 PM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Rayagonda,
>
> +Stephen Warren
>
> On Wed, 29 Apr 2020 at 10:35, Rayagonda Kokatanur
> <rayagonda.kokatanur@broadcom.com> wrote:
> >
> > Add support to use different register read/write api's
> > based on register width.
> >
> > Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
> > ---
> >  drivers/pinctrl/pinctrl-single.c | 98 ++++++++++++++++++++++++--------
> >  1 file changed, 74 insertions(+), 24 deletions(-)
> >
> > diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
> > index 738f5bd636..aed113b083 100644
> > --- a/drivers/pinctrl/pinctrl-single.c
> > +++ b/drivers/pinctrl/pinctrl-single.c
> > @@ -10,12 +10,24 @@
> >  #include <linux/libfdt.h>
> >  #include <asm/io.h>
> >
> > +/**
> > + * struct single_pdata - pinctrl device instance
> > + * @base       first configuration register
> > + * @offset     index of last configuration register
> > + * @mask       configuration-value mask bits
> > + * @width      configuration register bit width
> > + * @bits_per_mux
> > + * @read       register read function to use
> > + * @write      register write function to use
> > + */
> >  struct single_pdata {
> >         fdt_addr_t base;        /* first configuration register */
> >         int offset;             /* index of last configuration register */
> >         u32 mask;               /* configuration-value mask bits */
> >         int width;              /* configuration register bit width */
> >         bool bits_per_mux;
> > +       u32 (*read)(phys_addr_t reg);
> > +       void (*write)(u32 val, phys_addr_t reg);
>
> Can't we just have a read & write function with a switch statement?
> Why do we need function pointers?

I referred to the linux pinctrl-single.c and kept code similar to linux.
Please let me know.

>
> Regards,
> Simon

  reply	other threads:[~2020-04-30 10:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29 16:34 [PATCH v1 0/3] extend pinctrl-single driver with APIs Rayagonda Kokatanur
2020-04-29 16:34 ` [PATCH v1 1/3] drivers: pinctrl-single: handle different register width Rayagonda Kokatanur
2020-04-29 18:04   ` Simon Glass
2020-04-30 10:06     ` Rayagonda Kokatanur [this message]
2020-05-08  1:36       ` Simon Glass
2020-05-24 10:46         ` Rayagonda Kokatanur
2020-05-25  2:15           ` Simon Glass
2020-05-26 18:57             ` Rayagonda Kokatanur
2020-04-29 16:34 ` [PATCH v1 2/3] drivers: pinctrl-single: add support to parse gpio properties Rayagonda Kokatanur
2020-04-29 18:04   ` Simon Glass
2020-04-30 11:10     ` Rayagonda Kokatanur
2020-05-08  1:36       ` Simon Glass
2020-04-29 16:34 ` [PATCH v1 3/3] drivers: pinctrl-single: add request api Rayagonda Kokatanur
2020-04-29 18:04   ` Simon Glass
2020-04-30 11:03     ` Rayagonda Kokatanur
2020-05-08  1:36       ` Simon Glass

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='CAHO=5PGPSP1GO0qP=tYvuYSbwy1DtzCPnaVKx+EKHXzSGw_1rw@mail.gmail.com' \
    --to=rayagonda.kokatanur@broadcom.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.