mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy@black.fi.intel.com>
To: Patrick Rudolph <patrick.rudolph@9elements.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	naresh.solanki@9elements.com, andy.shevchenko@gmail.com,
	broonie@kernel.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] pinctrl: cy8c95x0: Use regmap ranges
Date: Fri, 9 Aug 2024 15:13:37 +0300	[thread overview]
Message-ID: <ZrYH8QlXH5Gfvnz_@black.fi.intel.com> (raw)
In-Reply-To: <20240521152602.1097764-2-patrick.rudolph@9elements.com>

On Tue, May 21, 2024 at 05:25:58PM +0200, Patrick Rudolph wrote:
> Instead of implementing a custom register paging mechanism in
> the driver use the existing regmap ranges feature.

...

> +#define MUXED_STRIDE		(CY8C95X0_DRV_HIZ - CY8C95X0_INTMASK)

> +#define CY8C95X0_MUX_REGMAP_TO_OFFSET(x, p) \
> +	(CY8C95X0_VIRTUAL + (x) - CY8C95X0_INTMASK + (p) * MUXED_STRIDE)

> +static const struct regmap_range_cfg cy8c95x0_ranges[] = {
> +	{
> +		.range_min = CY8C95X0_VIRTUAL,
> +		.range_max = 0,		/* Updated at runtime */
> +		.selector_reg = CY8C95X0_PORTSEL,
> +		.selector_mask = 0x07,
> +		.selector_shift = 0x0,
> +		.window_start = CY8C95X0_INTMASK,
> +		.window_len = MUXED_STRIDE,

Looking at this again, are you sure you have no off-by-one error in
MUXED_STRIDE value?

Also a comment in the regmap core suggests that we may include selector
in each of the window.

With this, we probably should simply use PORTSEL as window start with a
fixed window len of 16, having a few more (reserved) registers in the
dump seems not a big deal to me, but it will be much easier to decipher
a port number based on (virtual) offset.

Besides above, why virtual start is not well aligned? I would expect not
0x31, but 0x40 or alike. It might explain some bugs with cache you have
seen.

P.S. It might still be bugs in regmap core, if it is the case, they
need to be addressed.

> +	}
>  };

-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2024-08-09 12:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-21 15:25 [PATCH 1/3] pinctrl: cy8c95x0: Use single I2C lock Patrick Rudolph
2024-05-21 15:25 ` [PATCH 2/3] pinctrl: cy8c95x0: Use regmap ranges Patrick Rudolph
2024-05-21 17:34   ` Andy Shevchenko
2024-06-07 20:29     ` Andy Shevchenko
2024-08-09 12:13   ` Andy Shevchenko [this message]
2024-08-20  8:30     ` Patrick Rudolph
2024-08-20 16:18       ` Andy Shevchenko
2024-08-26  8:26   ` Linus Walleij
2024-05-21 15:25 ` [PATCH 3/3] pinctrl: cy8c95x0: Use REGCACHE_MAPLE Patrick Rudolph
2024-05-21 17:35   ` Andy Shevchenko
2024-05-21 17:24 ` [PATCH 1/3] pinctrl: cy8c95x0: Use single I2C lock Andy Shevchenko
2024-05-28 11:58   ` Linus Walleij
2024-06-07 20:26 ` Andy Shevchenko
2024-06-07 20:38 ` Linus Walleij

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=ZrYH8QlXH5Gfvnz_@black.fi.intel.com \
    --to=andy@black.fi.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=broonie@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naresh.solanki@9elements.com \
    --cc=patrick.rudolph@9elements.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

all inboxes | Powered by JetHome®