linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH 2/3] pinctrl: sh-pfc: r8a7778: Add bias (pull-up) pinconf support
Date: Tue, 24 Mar 2015 17:13:53 +0000	[thread overview]
Message-ID: <CAMuHMdVYp0Df4z4T-bK6ocg47Zrpncza-yMWXCozWAAHWbwncA@mail.gmail.com> (raw)
In-Reply-To: <1426854638-9187-3-git-send-email-ulrich.hecht+renesas@gmail.com>

Hi Ulrich,


On Fri, Mar 20, 2015 at 1:30 PM, Ulrich Hecht
<ulrich.hecht+renesas@gmail.com> wrote:
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7778.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7778.c

> @@ -2905,8 +2912,218 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
>         { },
>  };
>
> +#define PUPR0  0x100
> +#define PUPR1  0x104
> +#define PUPR2  0x108
> +#define PUPR3  0x10c
> +#define PUPR4  0x110
> +#define PUPR5  0x114
> +
> +static const struct {
> +       u16 reg;

This value is in the range 0x100..0x114.

> +       u16 bit;

This value is in the range 0..31, so you need only 5 bits.

To save memory, what about using bit fields instead?

        u16 reg : 11;
        u16 bit : 5;

By switching to PUPRx indices instead of register offsets, it can even
fit in a u8, as we have only 6 PUPRx registers.
R-Car V2H has more than 8 PUPRx registers, we there we're stuck with
at least 16 bits per pin.

> +} pullups[] = {
> +       [RCAR_GP_PIN(0,  6)] = { PUPR0,  0 },   /* A0 */

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2015-03-24 17:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 12:30 [PATCH 2/3] pinctrl: sh-pfc: r8a7778: Add bias (pull-up) pinconf support Ulrich Hecht
2015-03-24 17:13 ` Geert Uytterhoeven [this message]
2015-03-30 10:04 ` Geert Uytterhoeven
2015-04-17 15:30 ` Laurent Pinchart

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=CAMuHMdVYp0Df4z4T-bK6ocg47Zrpncza-yMWXCozWAAHWbwncA@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=linux-sh@vger.kernel.org \
    /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).