Linux-Watchdog Archive mirror
 help / color / mirror / Atom feed
From: Peter Griffin <peter.griffin@linaro.org>
To: Sam Protsenko <semen.protsenko@linaro.org>
Cc: arnd@arndb.de, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org,  linux@roeck-us.net,
	wim@linux-watchdog.org, conor+dt@kernel.org,
	 alim.akhtar@samsung.com, jaewon02.kim@samsung.com,
	chanho61.park@samsung.com,  kernel-team@android.com,
	tudor.ambarus@linaro.org, andre.draszik@linaro.org,
	 saravanak@google.com, willmcvicker@google.com,
	linux-fsd@tesla.com,  linux-watchdog@vger.kernel.org,
	devicetree@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH 2/9] soc: samsung: exynos-pmu: Add exynos_pmu_update/read/write APIs and SoC quirks
Date: Wed, 24 Jan 2024 10:02:27 +0000	[thread overview]
Message-ID: <CADrjBPqbToXYUBx=reE5_W4U4aUUJRFs+FC5AHsrQ6mRYB9iAA@mail.gmail.com> (raw)
In-Reply-To: <CAPLW+4=G5YiTZaZ5k=H1YciUwOEjKSF0w9Hd8rwymA71UmJnRQ@mail.gmail.com>

Hi Sam,

Thanks for the review feedback.

On Tue, 23 Jan 2024 at 18:56, Sam Protsenko <semen.protsenko@linaro.org> wrote:
>
> On Mon, Jan 22, 2024 at 4:57 PM Peter Griffin <peter.griffin@linaro.org> wrote:
> >
> > Newer Exynos SoCs have atomic set/clear bit hardware for PMU registers as
> > these registers can be accessed by multiple masters. Some platforms also
> > protect the PMU registers for security hardening reasons so they can't be
> > written by normal world and are only write acessible in el3 via a SMC call.
> >
> > Add support for both of these usecases using SoC specific quirks that are
> > determined from the DT compatible string.
> >
> > Drivers which need to read and write PMU registers should now use these
> > new exynos_pmu_*() APIs instead of obtaining a regmap using
> > syscon_regmap_lookup_by_phandle()
> >
> > Depending on the SoC specific quirks, the exynos_pmu_*() APIs will access
> > the PMU register in the appropriate way.
> >
> > Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> > ---
> >  drivers/soc/samsung/exynos-pmu.c       | 209 ++++++++++++++++++++++++-
> >  drivers/soc/samsung/exynos-pmu.h       |   4 +
> >  include/linux/soc/samsung/exynos-pmu.h |  28 ++++
> >  3 files changed, 234 insertions(+), 7 deletions(-)
> >
>
> [snip]
>
> > +
> > +int exynos_pmu_update_bits(unsigned int offset, unsigned int mask,
> > +                          unsigned int val)
> > +{
> > +       if (pmu_context->pmu_data &&
> > +           pmu_context->pmu_data->quirks & QUIRK_PMU_ALIVE_WRITE_SEC)
> > +               return rmw_priv_reg(pmu_context->pmu_base_pa + offset,
> > +                                   mask, val);
> > +
> > +       return regmap_update_bits(pmu_context->pmureg, offset, mask, val);
> > +}
> > +EXPORT_SYMBOL(exynos_pmu_update_bits);
> > +
>
> This seems a bit hacky, from the design perspective. This way the user
> will have to worry about things like driver dependencies, making sure
> everything is instantiated in a correct order, etc. It also hides the
> details otherwise visible through "syscon-phandle" property in the
> device tree.

In v2 I will keep the phandle to pmu_system_controller in DT, and add
some -EPROBE_DEFER logic (See my email with Krzysztof).

> Can we instead rework it by overriding regmap
> implementation for Exynos specifics, and then continue to use it in
> the leaf drivers via "syscon-phandle" property?

I did look at that possibility first, as like you say it would avoid
updating the leaf drivers to use the new API. Unfortunately a SMC
backend to regmap was already tried and nacked upstream pretty hard.
See here https://lore.kernel.org/lkml/20210723163759.GI5221@sirena.org.uk/T/

regards,

Peter.

  reply	other threads:[~2024-01-24 10:02 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 22:57 [PATCH 0/9] Add exynos_pmu_update/read/write() APIs to exynos-pmu Peter Griffin
2024-01-22 22:57 ` [PATCH 1/9] dt-bindings: watchdog: samsung-wdt: deprecate samsung,syscon-phandle Peter Griffin
2024-01-23 11:09   ` Krzysztof Kozlowski
2024-01-22 22:57 ` [PATCH 2/9] soc: samsung: exynos-pmu: Add exynos_pmu_update/read/write APIs and SoC quirks Peter Griffin
2024-01-23  8:10   ` Arnd Bergmann
2024-01-24 10:21     ` Peter Griffin
2024-01-23 11:17   ` Krzysztof Kozlowski
2024-01-24 10:41     ` Peter Griffin
2024-01-23 18:56   ` Sam Protsenko
2024-01-24 10:02     ` Peter Griffin [this message]
2024-01-24 20:23       ` Sam Protsenko
2024-01-25 10:48         ` Peter Griffin
2024-01-26 17:26   ` kernel test robot
2024-01-26 23:07   ` kernel test robot
2024-01-22 22:57 ` [PATCH 3/9] watchdog: s3c2410_wdt: update to use new exynos_pmu_*() apis Peter Griffin
2024-01-23 10:33   ` Guenter Roeck
2024-01-23 15:35     ` Peter Griffin
2024-01-23 11:19   ` Krzysztof Kozlowski
2024-01-23 17:30     ` Peter Griffin
2024-01-23 18:12       ` Krzysztof Kozlowski
2024-01-24  3:37         ` Saravana Kannan
2024-01-24  6:27           ` Krzysztof Kozlowski
2024-01-24 21:27             ` Saravana Kannan
2024-01-25  7:37               ` Krzysztof Kozlowski
2024-01-25 11:46                 ` Lee Jones
2024-01-26  2:23                   ` Saravana Kannan
2024-01-26  8:43                     ` Lee Jones
2024-01-26  2:17                 ` Saravana Kannan
2024-01-25 13:19               ` Peter Griffin
2024-01-30 20:27               ` Rob Herring
2024-01-26 17:04   ` kernel test robot
2024-01-22 22:57 ` [PATCH 4/9] arm64: dts: fsd: remove deprecated samsung,syscon-phandle Peter Griffin
2024-01-22 22:57 ` [PATCH 5/9] arm64: dts: exynosautov9: " Peter Griffin
2024-01-22 22:57 ` [PATCH 6/9] arm64: dts: exynos850: " Peter Griffin
2024-01-22 22:57 ` [PATCH 7/9] arm64: dts: exynos7: " Peter Griffin
2024-01-22 22:57 ` [PATCH 8/9] ARM: dts: samsung: exynos4: " Peter Griffin
2024-01-22 22:57 ` [PATCH 9/9] ARM: dts: exynos5250: " Peter Griffin
2024-01-23  7:41   ` Arnd Bergmann

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='CADrjBPqbToXYUBx=reE5_W4U4aUUJRFs+FC5AHsrQ6mRYB9iAA@mail.gmail.com' \
    --to=peter.griffin@linaro.org \
    --cc=alim.akhtar@samsung.com \
    --cc=andre.draszik@linaro.org \
    --cc=arnd@arndb.de \
    --cc=chanho61.park@samsung.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jaewon02.kim@samsung.com \
    --cc=kernel-team@android.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fsd@tesla.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@kernel.org \
    --cc=saravanak@google.com \
    --cc=semen.protsenko@linaro.org \
    --cc=tudor.ambarus@linaro.org \
    --cc=willmcvicker@google.com \
    --cc=wim@linux-watchdog.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 read-only IMAP folder(s) and NNTP newsgroup(s).