From: Thierry Reding <thierry.reding@gmail•com>
To: Thierry Reding <thierry.reding@gmail•com>
Cc: linux-tegra@vger•kernel.org,
Nagarjuna Kristam <nkristam@nvidia•com>,
linux-arm-kernel@lists•infradead.org,
Jon Hunter <jonathanh@nvidia•com>
Subject: [PATCH 5/7] drm/nouveau: tegra: Use nvmem API
Date: Fri, 30 Aug 2019 00:19:09 +0200 [thread overview]
Message-ID: <20190829221911.24876-6-thierry.reding@gmail.com> (raw)
In-Reply-To: <20190829221911.24876-1-thierry.reding@gmail.com>
From: Thierry Reding <treding@nvidia•com>
Instead of using the custom Tegra FUSE API to read the calibration fuse
for the clock on GM20B, use the nvmem API. This makes the dependency
between the two devices more explicit and decouples the driver from one
another.
Signed-off-by: Thierry Reding <treding@nvidia•com>
---
drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c
index b284e949f732..096a8b4b9bb5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c
@@ -20,6 +20,8 @@
* DEALINGS IN THE SOFTWARE.
*/
+#include <linux/nvmem-consumer.h>
+
#include <subdev/clk.h>
#include <subdev/volt.h>
#include <subdev/timer.h>
@@ -929,7 +931,6 @@ gm20b_clk_new_speedo0(struct nvkm_device *device, int index,
}
/* FUSE register */
-#define FUSE_RESERVED_CALIB0 0x204
#define FUSE_RESERVED_CALIB0_INTERCEPT_FRAC_SHIFT 0
#define FUSE_RESERVED_CALIB0_INTERCEPT_FRAC_WIDTH 4
#define FUSE_RESERVED_CALIB0_INTERCEPT_INT_SHIFT 4
@@ -945,14 +946,17 @@ static int
gm20b_clk_init_fused_params(struct gm20b_clk *clk)
{
struct nvkm_subdev *subdev = &clk->base.base.subdev;
+ struct nvkm_device *device = subdev->device;
u32 val = 0;
u32 rev = 0;
+ int ret;
+
+ ret = nvmem_cell_read_u32(device->dev, "calibration", &val);
+ if (ret < 0)
+ return ret;
-#if IS_ENABLED(CONFIG_ARCH_TEGRA)
- tegra_fuse_readl(FUSE_RESERVED_CALIB0, &val);
rev = (val >> FUSE_RESERVED_CALIB0_FUSE_REV_SHIFT) &
MASK(FUSE_RESERVED_CALIB0_FUSE_REV_WIDTH);
-#endif
/* No fused parameters, we will calibrate later */
if (rev == 0)
--
2.22.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-08-29 22:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-29 22:19 [PATCH 0/7] Replace Tegra FUSE API by nvmem API Thierry Reding
2019-08-29 22:19 ` [PATCH 1/7] soc/tegra: fuse: Restore base on sysfs failure Thierry Reding
2019-08-29 22:19 ` [PATCH 2/7] soc/tegra: fuse: Implement nvmem device Thierry Reding
2019-08-29 22:19 ` [PATCH 3/7] soc/tegra: fuse: Add cell information Thierry Reding
2019-08-29 22:19 ` [PATCH 4/7] soc/tegra: fuse: Register cell lookups for compatibility Thierry Reding
2019-08-29 22:19 ` Thierry Reding [this message]
2019-08-29 22:19 ` [PATCH 6/7] phy: tegra: xusb: Use nvmem API Thierry Reding
2019-08-29 22:19 ` [PATCH 7/7] thermal: tegra: " Thierry Reding
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=20190829221911.24876-6-thierry.reding@gmail.com \
--to=thierry.reding@gmail$(echo .)com \
--cc=jonathanh@nvidia$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-tegra@vger$(echo .)kernel.org \
--cc=nkristam@nvidia$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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