Tegra Fuse Nvmem Interface Update
cover Tegra Fuse Nvmem Interface Update
This series of patches make various enhancements and updates to Tegra Fuse nvmem interface, that includes:
1. Using per SOC nvmem cells. As, tegra fuse availability and size can vary from once SOC to another.
2. Fixes an issue with nvmem binary interface which could result in RAS errors.
3. Add opt-dla-disable nvmem cell for Tegra234 SOC, this is used by Tegra Deep Learning Accelerator driver to correctly identify internal and production boards.
NOTE: Patch "soc/tegra: fuse: use soc specific nvmem cells" had already been sent out for review. Please ignore the previous patch.
Kartik (3):
soc/tegra: fuse: use soc specific nvmem cells
soc/tegra: fuse: add fuse nvmem keepout list
soc/tegra: fuse: add opt-dla-disable nvmem cell
drivers/soc/tegra/fuse/fuse-tegra.c | 112 +--------- drivers/soc/tegra/fuse/fuse-tegra30.c | 294 +++++++++++++++++++++++++- drivers/soc/tegra/fuse/fuse.h | 4 + 3 files changed, 299 insertions(+), 111 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/3 soc/tegra: fuse: use soc specific nvmem cells
Tegra fuse block size, availability and offsets can vary from one SOC to another.
Fix Tegra fuse size and use SOC specific nvmem cells.
--- drivers/soc/tegra/fuse/fuse-tegra.c | 110 +----------- drivers/soc/tegra/fuse/fuse-tegra30.c | 240 +++++++++++++++++++++++++- drivers/soc/tegra/fuse/fuse.h | 2 + 3 files changed, 241 insertions(+), 111 deletions(-)
drivers/soc/tegra/fuse/fuse-tegra.c +2 -108
@@ -94,112 +94,6 @@ static int tegra_fuse_read(void *priv, unsigned int offset, void *value,return 0 ; } -static const struct nvmem_cell_info tegra_fuse_cells[] = { - { - .name ="tsensor-cpu1" , - .offset =0x084 , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="tsensor-cpu2" , - .offset =0x088 , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="tsensor-cpu0" , - .offset =0x098 , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="xusb-pad-calibration" , - .offset =0x0f0 , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="tsensor-cpu3" , - .offset =0x12c , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="sata-calibration" , - .offset =0x124 , - .bytes =1 , - .bit_offset =0 , - .nbits =2 , - }, { - .name ="tsensor-gpu" , - .offset =0x154 , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="tsensor-mem0" , - .offset =0x158 , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="tsensor-mem1" , - .offset =0x15c , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="tsensor-pllx" , - .offset =0x160 , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="tsensor-common" , - .offset =0x180 , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="gpu-gcplex-config-fuse" , - .offset =0x1c8 , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="tsensor-realignment" , - .offset =0x1fc , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="gpu-calibration" , - .offset =0x204 , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="xusb-pad-calibration-ext" , - .offset =0x250 , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="gpu-pdi0" , - .offset =0x300 , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, { - .name ="gpu-pdi1" , - .offset =0x304 , - .bytes =4 , - .bit_offset =0 , - .nbits =32 , - }, -}; -static void tegra_fuse_restore (void *base) { fuse->base = (void __iomem *)base;
@@ -253,8 +147,8 @@ static int tegra_fuse_probe(struct platform_device *pdev) nvmem.name ="fuse" ; nvmem.id =-1 ; nvmem.owner =THIS_MODULE ; - nvmem.cells = tegra_fuse_cells; - nvmem.ncells =ARRAY_SIZE (tegra_fuse_cells); + nvmem.cells = fuse->soc->cells; + nvmem.ncells = fuse->soc->num_cells; nvmem.type =NVMEM_TYPE_OTP ; nvmem.read_only = true; nvmem.root_only = true;
drivers/soc/tegra/fuse/fuse-tegra30.c +237 -3
318 lines not on this page · raw message
drivers/soc/tegra/fuse/fuse.h +2 -0
@@ -32,6 +32,8 @@ struct tegra_fuse_soc {const struct nvmem_cell_lookup *lookups;unsigned int num_lookups; +const struct nvmem_cell_info *cells; +unsigned int num_cells;const struct attribute_group *soc_attr_group;
Signature · 1 line
2.17.1
PATCH 2/3 soc/tegra: fuse: add fuse nvmem keepout list
In reply to KartikTegra186 onwards, various fuse offsets are restricted and cannot be accessed from CCPLEX. Currently nvmem binary interface allows reading such offsets from userspace, which results in RAS errors.
Add nvmem keepout lists to avoid any reads to restricted offsets.
--- drivers/soc/tegra/fuse/fuse-tegra.c | 2 ++ drivers/soc/tegra/fuse/fuse-tegra30.c | 38 +++++++++++++++++++++++++++ drivers/soc/tegra/fuse/fuse.h | 2 ++ 3 files changed, 42 insertions(+)
drivers/soc/tegra/fuse/fuse-tegra.c +2 -0
@@ -149,6 +149,8 @@ static int tegra_fuse_probe(struct platform_device *pdev) nvmem.owner =THIS_MODULE ; nvmem.cells = fuse->soc->cells; nvmem.ncells = fuse->soc->num_cells; + nvmem.keepout = fuse->soc->keepouts; + nvmem.nkeepout = fuse->soc->num_keepouts; nvmem.type =NVMEM_TYPE_OTP ; nvmem.read_only = true; nvmem.root_only = true;
drivers/soc/tegra/fuse/fuse-tegra30.c +38 -0
@@ -9,6 +9,7 @@#include <linux/io.h> #include <linux/kernel.h> #include <linux/nvmem-consumer.h> +#include <linux/nvmem-provider.h> #include <linux/of_device.h> #include <linux/of_address.h> #include <linux/platform_device.h>
@@ -494,6 +495,14 @@ static const struct nvmem_cell_lookup tegra186_fuse_lookups[] = { }, }; +static const struct nvmem_keepout tegra186_fuse_keepouts[] = { + { .start =0x01c , .end =0x0f0 }, + { .start =0x138 , .end =0x198 }, + { .start =0x1d8 , .end =0x250 }, + { .start =0x280 , .end =0x290 }, + { .start =0x340 , .end =0x344 } +}; +static const struct tegra_fuse_info tegra186_fuse_info = { .read = tegra30_fuse_read, .size =0x478 ,
@@ -507,6 +516,8 @@ const struct tegra_fuse_soc tegra186_fuse_soc = { .num_lookups = ARRAY_SIZE(tegra186_fuse_lookups), .cells = tegra186_fuse_cells, .num_cells = ARRAY_SIZE(tegra186_fuse_cells), + .keepouts = tegra186_fuse_keepouts, + .num_keepouts = ARRAY_SIZE(tegra186_fuse_keepouts), .soc_attr_group = &tegra_soc_attr_group, .clk_suspend_on = false, };
@@ -576,6 +587,15 @@ static const struct nvmem_cell_lookup tegra194_fuse_lookups[] = { }, }; +static const struct nvmem_keepout tegra194_fuse_keepouts[] = { + { .start =0x01c , .end =0x0b8 }, + { .start =0x12c , .end =0x198 }, + { .start =0x1a0 , .end =0x1bc }, + { .start =0x1d8 , .end =0x250 }, + { .start =0x270 , .end =0x290 }, + { .start =0x310 , .end =0x45c } +}; +static const struct tegra_fuse_info tegra194_fuse_info = { .read = tegra30_fuse_read, .size =0x650 ,
@@ -589,6 +609,8 @@ const struct tegra_fuse_soc tegra194_fuse_soc = { .num_lookups = ARRAY_SIZE(tegra194_fuse_lookups), .cells = tegra194_fuse_cells, .num_cells = ARRAY_SIZE(tegra194_fuse_cells), + .keepouts = tegra194_fuse_keepouts, + .num_keepouts = ARRAY_SIZE(tegra194_fuse_keepouts), .soc_attr_group = &tegra194_soc_attr_group, .clk_suspend_on = false, };
@@ -625,6 +647,20 @@ static const struct nvmem_cell_lookup tegra234_fuse_lookups[] = { }, }; +static const struct nvmem_keepout tegra234_fuse_keepouts[] = { + { .start =0x01c , .end =0x0c8 }, + { .start =0x12c , .end =0x184 }, + { .start =0x190 , .end =0x198 }, + { .start =0x1a0 , .end =0x204 }, + { .start =0x21c , .end =0x250 }, + { .start =0x25c , .end =0x2f0 }, + { .start =0x310 , .end =0x3d8 }, + { .start =0x400 , .end =0x4f0 }, + { .start =0x4f8 , .end =0x7e8 }, + { .start =0x8d0 , .end =0x8d8 }, + { .start =0xacc , .end =0xf00 } +}; +static const struct tegra_fuse_info tegra234_fuse_info = { .read = tegra30_fuse_read, .size =0x98c ,
@@ -638,6 +674,8 @@ const struct tegra_fuse_soc tegra234_fuse_soc = { .num_lookups = ARRAY_SIZE(tegra234_fuse_lookups), .cells = tegra234_fuse_cells, .num_cells = ARRAY_SIZE(tegra234_fuse_cells), + .keepouts = tegra234_fuse_keepouts, + .num_keepouts = ARRAY_SIZE(tegra234_fuse_keepouts), .soc_attr_group = &tegra194_soc_attr_group, .clk_suspend_on = false, };
drivers/soc/tegra/fuse/fuse.h +2 -0
@@ -34,6 +34,8 @@ struct tegra_fuse_soc {unsigned int num_lookups;const struct nvmem_cell_info *cells;unsigned int num_cells; +const struct nvmem_keepout *keepouts; +unsigned int num_keepouts;const struct attribute_group *soc_attr_group;
Signature · 1 line
2.17.1
PATCH 3/3 soc/tegra: fuse: add opt-dla-disable nvmem cell
In reply to KartikTegra234 DLA (Deep Learning Accelerator) driver requires access to opt_dla_disable fuse to correctly identify internal or production boards.
Add nvmem cell "opt-dla-disable" for Tegra234 SOC, this allows DLA driver to read opt_dla_disable fuse via nvmem interface.
--- drivers/soc/tegra/fuse/fuse-tegra30.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/soc/tegra/fuse/fuse-tegra30.c +16 -0
@@ -630,6 +630,12 @@ static const struct nvmem_cell_info tegra234_fuse_cells[] = { .bytes = 4, .bit_offset = 0, .nbits = 32, + }, { + .name = "opt-dla-disable", + .offset = 0x3f0, + .bytes = 4, + .bit_offset = 0, + .nbits = 32, }, };
@@ -644,6 +650,16 @@ static const struct nvmem_cell_lookup tegra234_fuse_lookups[] = { .cell_name = "xusb-pad-calibration-ext", .dev_id = "3520000.padctl", .con_id = "calibration-ext", + }, { + .nvmem_name = "fuse", + .cell_name = "opt-dla-disable", + .dev_id = "15880000.nvdla0", + .con_id = "dla-disable", + }, { + .nvmem_name = "fuse", + .cell_name = "opt-dla-disable", + .dev_id = "158c0000.nvdla1", + .con_id = "dla-disable", }, };
Signature · 1 line
2.17.1