soc/tegra: pmc: Fix reset sources and levels
authorJon Hunter <jonathanh@nvidia.com>
Tue, 16 Apr 2019 16:48:06 +0000 (17:48 +0100)
committerThierry Reding <treding@nvidia.com>
Wed, 17 Apr 2019 08:30:08 +0000 (10:30 +0200)
commit00cdaa1b811f36afa52a5956350c263ded4944a6
tree771a6eaf1ec82617f75afe1bf2387f5d5fdd496d
parent7fe5719b4364fe9b673c3763007915877f3922c0
soc/tegra: pmc: Fix reset sources and levels

Commit 5f84bb1a4099 ("soc/tegra: pmc: Add sysfs entries for reset info")
added support for reading the Tegra reset source and level from sysfs.
However, there are a few issues with this commit which are ...
1. The number of reset sources for Tegra210 is defined as 5 but it
   should be 6.
2. The number of reset sources for Tegra186 is defined as 13 but it
   should be 15.
3. The SoC data variables num_reset_sources and num_reset_levels are
   defined but never used.

Fix the above by ...

1. Removing the reset source 'AOTAG' from the tegra30_reset_sources
   because this is only applicable for Tegra210.
2. Adding a new tegra210_reset_sources structure for Tegra210 reset
   sources.
3. Correct the number of reset sources for Tegra210 and Tegra186 by
   using the ARRAY_SIZE macro.
4. Updating the functions reset_reason_show() and reset_level_show()
   to check whether the value read is valid. While we are at it
   clean-up these functions to remove an unnecessary u32 variable.

Fixes: 5f84bb1a4099 ("soc/tegra: pmc: Add sysfs entries for reset info")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/soc/tegra/pmc.c