mbox series

[v7,0/8] soc/tegra: fuse: Add ACPI support

Message ID 20231017052322.2636-1-kkartik@nvidia.com (mailing list archive)
Headers show
Series soc/tegra: fuse: Add ACPI support | expand

Message

Kartik Oct. 17, 2023, 5:23 a.m. UTC
This series of patches add ACPI support for Tegra194 and Tegra234 in
Tegra fuse and apbmisc drivers. It also adds support for Tegra241
which uses ACPI boot.

Kartik (8):
  mm/util: Introduce kmemdup_array()
  soc/tegra: fuse: Use dev_err_probe for probe failures
  soc/tegra: fuse: Refactor resource mapping
  soc/tegra: fuse: Add tegra_acpi_init_apbmisc()
  soc/tegra: fuse: Add function to add lookups
  soc/tegra: fuse: Add function to print SKU info
  soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234
  soc/tegra: fuse: Add support for Tegra241

 drivers/soc/tegra/Kconfig              |   5 ++
 drivers/soc/tegra/fuse/fuse-tegra.c    | 112 ++++++++++++++++++-------
 drivers/soc/tegra/fuse/fuse-tegra30.c  |  20 +++++
 drivers/soc/tegra/fuse/fuse.h          |   5 ++
 drivers/soc/tegra/fuse/tegra-apbmisc.c | 110 ++++++++++++++++++++----
 include/linux/string.h                 |   1 +
 include/soc/tegra/fuse.h               |   1 +
 mm/util.c                              |  17 ++++
 8 files changed, 227 insertions(+), 44 deletions(-)

---
v3 -> v4:
	* Added following patch to introduce kmemdup_array:
	  "mm/util: Introduce kmemdup_array() to duplicate an array"
	* Add "soc/tegra: fuse: Use dev_err_probe for probe failures".
v2 -> v3:
	* Minor changes in following patches:
	  soc/tegra: fuse: Add tegra_acpi_init_apbmisc()
	  soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234

v1 -> v2:
	* Used '--patience' while formatting patches.
	* Added "soc/tegra: fuse: Refactor resource mapping" to share
	  the common code between tegra_init_apbmisc() and
	  tegra_acpi_init_apbmisc() functions.
	* Dropped "soc/tegra: fuse: Add function to register nvmem"
	  as ACPI and device-tree boot are sharing the same probe.
	  So, no need to refactor the code here.
---

Comments

Thierry Reding Dec. 14, 2023, 5:08 p.m. UTC | #1
On Tue, Oct 17, 2023 at 10:53:14AM +0530, Kartik wrote:
> This series of patches add ACPI support for Tegra194 and Tegra234 in
> Tegra fuse and apbmisc drivers. It also adds support for Tegra241
> which uses ACPI boot.
> 
> Kartik (8):
>   mm/util: Introduce kmemdup_array()
>   soc/tegra: fuse: Use dev_err_probe for probe failures
>   soc/tegra: fuse: Refactor resource mapping
>   soc/tegra: fuse: Add tegra_acpi_init_apbmisc()
>   soc/tegra: fuse: Add function to add lookups
>   soc/tegra: fuse: Add function to print SKU info
>   soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234
>   soc/tegra: fuse: Add support for Tegra241
> 
>  drivers/soc/tegra/Kconfig              |   5 ++
>  drivers/soc/tegra/fuse/fuse-tegra.c    | 112 ++++++++++++++++++-------
>  drivers/soc/tegra/fuse/fuse-tegra30.c  |  20 +++++
>  drivers/soc/tegra/fuse/fuse.h          |   5 ++
>  drivers/soc/tegra/fuse/tegra-apbmisc.c | 110 ++++++++++++++++++++----
>  include/linux/string.h                 |   1 +
>  include/soc/tegra/fuse.h               |   1 +
>  mm/util.c                              |  17 ++++
>  8 files changed, 227 insertions(+), 44 deletions(-)

Applied, thanks.

Thierry
Arnd Bergmann Dec. 14, 2023, 6:43 p.m. UTC | #2
On Thu, Dec 14, 2023, at 17:08, Thierry Reding wrote:
> On Tue, Oct 17, 2023 at 10:53:14AM +0530, Kartik wrote:
>> This series of patches add ACPI support for Tegra194 and Tegra234 in
>> Tegra fuse and apbmisc drivers. It also adds support for Tegra241
>> which uses ACPI boot.
>
> Applied, thanks.

I'm still a bit puzzled by this series, can you provide some more background?

Why does an ACPI based system require access to SoC drivers? Shouldn't
this all be abstracted by the BIOS in some form so the device drivers
can work standalone rather than calling into this driver?

      Arnd
Thierry Reding Dec. 15, 2023, 4:43 p.m. UTC | #3
On Thu, Dec 14, 2023 at 06:43:47PM +0000, Arnd Bergmann wrote:
> On Thu, Dec 14, 2023, at 17:08, Thierry Reding wrote:
> > On Tue, Oct 17, 2023 at 10:53:14AM +0530, Kartik wrote:
> >> This series of patches add ACPI support for Tegra194 and Tegra234 in
> >> Tegra fuse and apbmisc drivers. It also adds support for Tegra241
> >> which uses ACPI boot.
> >
> > Applied, thanks.
> 
> I'm still a bit puzzled by this series, can you provide some more background?
> 
> Why does an ACPI based system require access to SoC drivers? Shouldn't
> this all be abstracted by the BIOS in some form so the device drivers
> can work standalone rather than calling into this driver?

This driver exposes a couple of things such as SoC family and SKU
information that is not otherwise available. It also exposes FUSE
data which can be used to calibrate certain devices. Most of the
region that contains the fuses is in the keep-out, so perhaps they
aren't needed on Tegra241.

I suppose things like SoC family and such could be exposed differently.
Not sure if ACPI has other ways to expose that.

Let's see if Kartik can shed some light on this.

Thierry
Kartik Dec. 18, 2023, 10:45 a.m. UTC | #4
On Fri, 2023-12-15 at 17:43 +0100, Thierry Reding wrote
> On Thu, Dec 14, 2023 at 06:43:47PM +0000, Arnd Bergmann wrote:
> > On Thu, Dec 14, 2023, at 17:08, Thierry Reding wrote:
> > > On Tue, Oct 17, 2023 at 10:53:14AM +0530, Kartik wrote:
> > >> This series of patches add ACPI support for Tegra194 and Tegra234 in
> > >> Tegra fuse and apbmisc drivers. It also adds support for Tegra241
> > >> which uses ACPI boot.
> > >
> > > Applied, thanks.
> > 
> > I'm still a bit puzzled by this series, can you provide some more background?
> > 
> > Why does an ACPI based system require access to SoC drivers? Shouldn't
> > this all be abstracted by the BIOS in some form so the device drivers
> > can work standalone rather than calling into this driver?
> 
> This driver exposes a couple of things such as SoC family and SKU
> information that is not otherwise available. It also exposes FUSE
> data which can be used to calibrate certain devices. Most of the
> region that contains the fuses is in the keep-out, so perhaps they
> aren't needed on Tegra241.
> 
> I suppose things like SoC family and such could be exposed differently.
> Not sure if ACPI has other ways to expose that.
> 
> Let's see if Kartik can shed some light on this.
> 
> Thierry

Hi Thierry, Arnd,

Although the keep-out contains most of the FUSE region. The driver still
expose FUSE data with tegra_fuse_readl(), which can be used by drivers to
get the required calibration data. Hence the reason to add ACPI support.

The keep-out region is only used by nvmem interface, which allows reading the
FUSE data from userspace as well as kernel modules. Currently on Tegra241,
there are no users needing this information via nvmem interface.

Regards,
Kartik