Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

soc/tegra: Set ERD bit to mask inband errors

Add a function to set the ERD (Error Response Disable) bit in the
MISCREG_CCROC_ERR_CONFIG register from the Control Backbone (CBB) error
handler driver.

ERD bit allows masking of SError due to inband errors which are caused
by illegal register accesses through CBB. When the bit is set, interrupt
is used for reporting errors and magic code '0xdead2003' is returned.
This change is only required for Tegra194 SoC as the config is moved to
CBB register space for future SoC's. Also, remove unmapping the
apbmisc_base as it's required to get the base address for accessing the
misc register.

Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Sumit Gupta and committed by
Thierry Reding
96765cc4 568035b0

+33 -2
+27 -2
drivers/soc/tegra/fuse/tegra-apbmisc.c
··· 16 16 17 17 #define FUSE_SKU_INFO 0x10 18 18 19 + #define ERD_ERR_CONFIG 0x120c 20 + #define ERD_MASK_INBAND_ERR 0x1 21 + 19 22 #define PMC_STRAPPING_OPT_A_RAM_CODE_SHIFT 4 20 23 #define PMC_STRAPPING_OPT_A_RAM_CODE_MASK_LONG \ 21 24 (0xf << PMC_STRAPPING_OPT_A_RAM_CODE_SHIFT) 22 25 #define PMC_STRAPPING_OPT_A_RAM_CODE_MASK_SHORT \ 23 26 (0x3 << PMC_STRAPPING_OPT_A_RAM_CODE_SHIFT) 24 27 28 + static void __iomem *apbmisc_base; 25 29 static bool long_ram_code; 26 30 static u32 strapping; 27 31 static u32 chipid; ··· 97 93 } 98 94 EXPORT_SYMBOL_GPL(tegra_read_ram_code); 99 95 96 + /* 97 + * The function sets ERD(Error Response Disable) bit. 98 + * This allows to mask inband errors and always send an 99 + * OKAY response from CBB to the master which caused error. 100 + */ 101 + int tegra194_miscreg_mask_serror(void) 102 + { 103 + if (!apbmisc_base) 104 + return -EPROBE_DEFER; 105 + 106 + if (!of_machine_is_compatible("nvidia,tegra194")) { 107 + WARN(1, "Only supported for Tegra194 devices!\n"); 108 + return -EOPNOTSUPP; 109 + } 110 + 111 + writel_relaxed(ERD_MASK_INBAND_ERR, 112 + apbmisc_base + ERD_ERR_CONFIG); 113 + 114 + return 0; 115 + } 116 + EXPORT_SYMBOL(tegra194_miscreg_mask_serror); 117 + 100 118 static const struct of_device_id apbmisc_match[] __initconst = { 101 119 { .compatible = "nvidia,tegra20-apbmisc", }, 102 120 { .compatible = "nvidia,tegra186-misc", }, ··· 160 134 161 135 void __init tegra_init_apbmisc(void) 162 136 { 163 - void __iomem *apbmisc_base, *strapping_base; 137 + void __iomem *strapping_base; 164 138 struct resource apbmisc, straps; 165 139 struct device_node *np; 166 140 ··· 222 196 pr_err("failed to map APBMISC registers\n"); 223 197 } else { 224 198 chipid = readl_relaxed(apbmisc_base + 4); 225 - iounmap(apbmisc_base); 226 199 } 227 200 228 201 strapping_base = ioremap(straps.start, resource_size(&straps));
+6
include/soc/tegra/fuse.h
··· 58 58 u8 tegra_get_chip_id(void); 59 59 u8 tegra_get_platform(void); 60 60 bool tegra_is_silicon(void); 61 + int tegra194_miscreg_mask_serror(void); 61 62 #else 62 63 static struct tegra_sku_info tegra_sku_info __maybe_unused; 63 64 ··· 93 92 } 94 93 95 94 static inline bool tegra_is_silicon(void) 95 + { 96 + return false; 97 + } 98 + 99 + static inline int tegra194_miscreg_mask_serror(void) 96 100 { 97 101 return false; 98 102 }