Loading Documentation/devicetree/bindings/arm/msm/jtag-fuse.txt +4 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,10 @@ by jtag save and restore driver(s) to query whether the Hardware they manage is functionally disabled or not and take corresponding steps. Required Properties: compatible: component name used for driver matching, should be "qcom,jtag-fuse" compatible: component name used for driver matching, should be one of the following: "qcom,jtag-fuse" for jtag fuse device "qcom,jtag-fuse-v3" for jtag fuse v3 device reg: physical base address and length of the register set reg-names: should be "fuse-base" Loading drivers/soc/qcom/jtag-fuse.c +65 −22 Original line number Diff line number Diff line /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -19,6 +19,7 @@ #include <linux/io.h> #include <linux/err.h> #include <linux/slab.h> #include <linux/of_device.h> #include <soc/qcom/jtag.h> #define fuse_writel(drvdata, val, off) __raw_writel((val), drvdata->base + off) Loading @@ -26,7 +27,9 @@ #define OEM_CONFIG0 (0x000) #define OEM_CONFIG1 (0x004) #define OEM_CONFIG2 (0x008) /* CoreSight FUSE V1 */ #define ALL_DEBUG_DISABLE BIT(21) #define APPS_DBGEN_DISABLE BIT(0) #define APPS_NIDEN_DISABLE BIT(1) Loading @@ -34,9 +37,21 @@ #define APPS_SPNIDEN_DISABLE BIT(3) #define DAP_DEVICEEN_DISABLE BIT(8) /* CoreSight FUSE V3 */ #define ALL_DEBUG_DISABLE_V3 BIT(29) #define APPS_DBGEN_DISABLE_V3 BIT(8) #define APPS_NIDEN_DISABLE_V3 BIT(21) #define APPS_SPIDEN_DISABLE_V3 BIT(5) #define APPS_SPNIDEN_DISABLE_V3 BIT(31) #define DAP_DEVICEEN_DISABLE_V3 BIT(7) #define JTAG_FUSE_VERSION_V1 "qcom,jtag-fuse" #define JTAG_FUSE_VERSION_V3 "qcom,jtag-fuse-v3" struct fuse_drvdata { void __iomem *base; struct device *dev; bool fuse_v3; }; static struct fuse_drvdata *fusedrvdata; Loading @@ -44,8 +59,8 @@ static struct fuse_drvdata *fusedrvdata; bool msm_jtag_fuse_apps_access_disabled(void) { struct fuse_drvdata *drvdata = fusedrvdata; uint32_t config0, config1; bool ret; uint32_t config0, config1, config2; bool ret = false; if (!drvdata) return false; Loading @@ -56,6 +71,26 @@ bool msm_jtag_fuse_apps_access_disabled(void) dev_dbg(drvdata->dev, "apps config0: %lx\n", (unsigned long)config0); dev_dbg(drvdata->dev, "apps config1: %lx\n", (unsigned long)config1); if (drvdata->fuse_v3) { config2 = fuse_readl(drvdata, OEM_CONFIG2); dev_dbg(drvdata->dev, "apps config2: %lx\n", (unsigned long)config2); } if (drvdata->fuse_v3) { if (config0 & ALL_DEBUG_DISABLE_V3) ret = true; else if (config1 & APPS_DBGEN_DISABLE_V3) ret = true; else if (config1 & APPS_NIDEN_DISABLE_V3) ret = true; else if (config2 & APPS_SPIDEN_DISABLE_V3) ret = true; else if (config1 & APPS_SPNIDEN_DISABLE_V3) ret = true; else if (config1 & DAP_DEVICEEN_DISABLE_V3) ret = true; } else { if (config0 & ALL_DEBUG_DISABLE) ret = true; else if (config1 & APPS_DBGEN_DISABLE) Loading @@ -68,8 +103,7 @@ bool msm_jtag_fuse_apps_access_disabled(void) ret = true; else if (config1 & DAP_DEVICEEN_DISABLE) ret = true; else ret = false; } if (ret) dev_dbg(drvdata->dev, "apps fuse disabled\n"); Loading @@ -78,11 +112,18 @@ bool msm_jtag_fuse_apps_access_disabled(void) } EXPORT_SYMBOL(msm_jtag_fuse_apps_access_disabled); static struct of_device_id jtag_fuse_match[] = { {.compatible = JTAG_FUSE_VERSION_V1 }, {.compatible = JTAG_FUSE_VERSION_V3 }, {} }; static int jtag_fuse_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct fuse_drvdata *drvdata; struct resource *res; const struct of_device_id *match; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) Loading @@ -92,6 +133,13 @@ static int jtag_fuse_probe(struct platform_device *pdev) drvdata->dev = &pdev->dev; platform_set_drvdata(pdev, drvdata); match = of_match_device(jtag_fuse_match, dev); if (!match) return -EINVAL; if (!strcmp(match->compatible, JTAG_FUSE_VERSION_V3)) drvdata->fuse_v3 = true; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fuse-base"); if (!res) return -ENODEV; Loading @@ -109,11 +157,6 @@ static int jtag_fuse_remove(struct platform_device *pdev) return 0; } static struct of_device_id jtag_fuse_match[] = { {.compatible = "qcom,jtag-fuse"}, {} }; static struct platform_driver jtag_fuse_driver = { .probe = jtag_fuse_probe, .remove = jtag_fuse_remove, Loading Loading
Documentation/devicetree/bindings/arm/msm/jtag-fuse.txt +4 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,10 @@ by jtag save and restore driver(s) to query whether the Hardware they manage is functionally disabled or not and take corresponding steps. Required Properties: compatible: component name used for driver matching, should be "qcom,jtag-fuse" compatible: component name used for driver matching, should be one of the following: "qcom,jtag-fuse" for jtag fuse device "qcom,jtag-fuse-v3" for jtag fuse v3 device reg: physical base address and length of the register set reg-names: should be "fuse-base" Loading
drivers/soc/qcom/jtag-fuse.c +65 −22 Original line number Diff line number Diff line /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -19,6 +19,7 @@ #include <linux/io.h> #include <linux/err.h> #include <linux/slab.h> #include <linux/of_device.h> #include <soc/qcom/jtag.h> #define fuse_writel(drvdata, val, off) __raw_writel((val), drvdata->base + off) Loading @@ -26,7 +27,9 @@ #define OEM_CONFIG0 (0x000) #define OEM_CONFIG1 (0x004) #define OEM_CONFIG2 (0x008) /* CoreSight FUSE V1 */ #define ALL_DEBUG_DISABLE BIT(21) #define APPS_DBGEN_DISABLE BIT(0) #define APPS_NIDEN_DISABLE BIT(1) Loading @@ -34,9 +37,21 @@ #define APPS_SPNIDEN_DISABLE BIT(3) #define DAP_DEVICEEN_DISABLE BIT(8) /* CoreSight FUSE V3 */ #define ALL_DEBUG_DISABLE_V3 BIT(29) #define APPS_DBGEN_DISABLE_V3 BIT(8) #define APPS_NIDEN_DISABLE_V3 BIT(21) #define APPS_SPIDEN_DISABLE_V3 BIT(5) #define APPS_SPNIDEN_DISABLE_V3 BIT(31) #define DAP_DEVICEEN_DISABLE_V3 BIT(7) #define JTAG_FUSE_VERSION_V1 "qcom,jtag-fuse" #define JTAG_FUSE_VERSION_V3 "qcom,jtag-fuse-v3" struct fuse_drvdata { void __iomem *base; struct device *dev; bool fuse_v3; }; static struct fuse_drvdata *fusedrvdata; Loading @@ -44,8 +59,8 @@ static struct fuse_drvdata *fusedrvdata; bool msm_jtag_fuse_apps_access_disabled(void) { struct fuse_drvdata *drvdata = fusedrvdata; uint32_t config0, config1; bool ret; uint32_t config0, config1, config2; bool ret = false; if (!drvdata) return false; Loading @@ -56,6 +71,26 @@ bool msm_jtag_fuse_apps_access_disabled(void) dev_dbg(drvdata->dev, "apps config0: %lx\n", (unsigned long)config0); dev_dbg(drvdata->dev, "apps config1: %lx\n", (unsigned long)config1); if (drvdata->fuse_v3) { config2 = fuse_readl(drvdata, OEM_CONFIG2); dev_dbg(drvdata->dev, "apps config2: %lx\n", (unsigned long)config2); } if (drvdata->fuse_v3) { if (config0 & ALL_DEBUG_DISABLE_V3) ret = true; else if (config1 & APPS_DBGEN_DISABLE_V3) ret = true; else if (config1 & APPS_NIDEN_DISABLE_V3) ret = true; else if (config2 & APPS_SPIDEN_DISABLE_V3) ret = true; else if (config1 & APPS_SPNIDEN_DISABLE_V3) ret = true; else if (config1 & DAP_DEVICEEN_DISABLE_V3) ret = true; } else { if (config0 & ALL_DEBUG_DISABLE) ret = true; else if (config1 & APPS_DBGEN_DISABLE) Loading @@ -68,8 +103,7 @@ bool msm_jtag_fuse_apps_access_disabled(void) ret = true; else if (config1 & DAP_DEVICEEN_DISABLE) ret = true; else ret = false; } if (ret) dev_dbg(drvdata->dev, "apps fuse disabled\n"); Loading @@ -78,11 +112,18 @@ bool msm_jtag_fuse_apps_access_disabled(void) } EXPORT_SYMBOL(msm_jtag_fuse_apps_access_disabled); static struct of_device_id jtag_fuse_match[] = { {.compatible = JTAG_FUSE_VERSION_V1 }, {.compatible = JTAG_FUSE_VERSION_V3 }, {} }; static int jtag_fuse_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct fuse_drvdata *drvdata; struct resource *res; const struct of_device_id *match; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) Loading @@ -92,6 +133,13 @@ static int jtag_fuse_probe(struct platform_device *pdev) drvdata->dev = &pdev->dev; platform_set_drvdata(pdev, drvdata); match = of_match_device(jtag_fuse_match, dev); if (!match) return -EINVAL; if (!strcmp(match->compatible, JTAG_FUSE_VERSION_V3)) drvdata->fuse_v3 = true; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fuse-base"); if (!res) return -ENODEV; Loading @@ -109,11 +157,6 @@ static int jtag_fuse_remove(struct platform_device *pdev) return 0; } static struct of_device_id jtag_fuse_match[] = { {.compatible = "qcom,jtag-fuse"}, {} }; static struct platform_driver jtag_fuse_driver = { .probe = jtag_fuse_probe, .remove = jtag_fuse_remove, Loading