coresight: stm: Remove debug fuse status check for stm

STM should work on both non-secure and secure device. So remove the debug
fuse check.

Change-Id: If3ff461fec1dca2165ceaaf3750af7338332c486
Signed-off-by: Mao Jinlong <jinlmao@codeaurora.org>
This commit is contained in:
Mao Jinlong 2020-03-15 11:13:53 +08:00
parent ad6d422c8b
commit bffaf5256d
3 changed files with 4 additions and 49 deletions

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2018, 2020 The Linux Foundation. All rights reserved.
*/ */
#include <linux/device.h> #include <linux/device.h>
@ -172,9 +172,6 @@ static inline int __stm_trace(uint32_t flags, uint8_t entity_id,
uint32_t ch; uint32_t ch;
void __iomem *ch_addr; void __iomem *ch_addr;
if (!(drvdata && drvdata->master_enable))
return 0;
/* allocate channel and get the channel address */ /* allocate channel and get the channel address */
ch = stm_channel_alloc(); ch = stm_channel_alloc();
if (unlikely(ch >= drvdata->numsp)) { if (unlikely(ch >= drvdata->numsp)) {

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
* *
* Description: CoreSight System Trace Macrocell driver * Description: CoreSight System Trace Macrocell driver
* *
@ -26,7 +26,6 @@
#include <linux/perf_event.h> #include <linux/perf_event.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/stm.h> #include <linux/stm.h>
#include <linux/nvmem-consumer.h>
#include "coresight-ost.h" #include "coresight-ost.h"
#include "coresight-priv.h" #include "coresight-priv.h"
@ -73,9 +72,6 @@
/* Reserve the first 10 channels for kernel usage */ /* Reserve the first 10 channels for kernel usage */
#define STM_CHANNEL_OFFSET 0 #define STM_CHANNEL_OFFSET 0
#define APPS_NIDEN_SHIFT 17
#define APPS_DBGEN_SHIFT 16
static int boot_nr_channel; static int boot_nr_channel;
/* /*
@ -361,9 +357,6 @@ static ssize_t notrace stm_generic_packet(struct stm_data *stm_data,
if (!(drvdata && local_read(&drvdata->mode))) if (!(drvdata && local_read(&drvdata->mode)))
return -EACCES; return -EACCES;
if (!drvdata->master_enable)
return -EPERM;
if (channel >= drvdata->numsp) if (channel >= drvdata->numsp)
return -EINVAL; return -EINVAL;
@ -779,13 +772,6 @@ static void stm_init_generic_data(struct stm_drvdata *drvdata)
drvdata->stm.set_options = stm_generic_set_options; drvdata->stm.set_options = stm_generic_set_options;
} }
static bool is_apps_debug_disabled(u32 val)
{
val &= BIT(APPS_NIDEN_SHIFT);
return val == 0;
}
static int stm_probe(struct amba_device *adev, const struct amba_id *id) static int stm_probe(struct amba_device *adev, const struct amba_id *id)
{ {
int ret; int ret;
@ -796,11 +782,9 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
struct stm_drvdata *drvdata; struct stm_drvdata *drvdata;
struct resource *res = &adev->res; struct resource *res = &adev->res;
struct resource ch_res; struct resource ch_res;
struct resource debug_ch_res;
size_t res_size, bitmap_size; size_t res_size, bitmap_size;
struct coresight_desc desc = { 0 }; struct coresight_desc desc = { 0 };
struct device_node *np = adev->dev.of_node; struct device_node *np = adev->dev.of_node;
u32 val;
if (np) { if (np) {
pdata = of_get_coresight_platform_data(dev, np); pdata = of_get_coresight_platform_data(dev, np);
@ -836,29 +820,6 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
return PTR_ERR(base); return PTR_ERR(base);
drvdata->chs.base = base; drvdata->chs.base = base;
ret = stm_get_resource_byname(np, "stm-debug-status", &debug_ch_res);
/*
* By default, master enable is true, means not controlled
* by debug status register
*/
if (!ret) {
drvdata->debug_status_chs.phys = debug_ch_res.start;
base = devm_ioremap_resource(dev, &debug_ch_res);
if (!IS_ERR(base)) {
drvdata->debug_status_chs.base = base;
val = readl_relaxed(drvdata->debug_status_chs.base);
drvdata->master_enable =
!is_apps_debug_disabled(val);
}
} else {
ret = nvmem_cell_read_u32(&adev->dev, "debug_fuse", &val);
if (!ret) {
drvdata->master_enable =
!is_apps_debug_disabled(val);
} else
drvdata->master_enable = true;
}
drvdata->write_bytes = stm_fundamental_data_size(drvdata); drvdata->write_bytes = stm_fundamental_data_size(drvdata);
if (boot_nr_channel) { if (boot_nr_channel) {
@ -907,8 +868,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
pm_runtime_put(&adev->dev); pm_runtime_put(&adev->dev);
dev_info(dev, "%s initialized with master %s\n", (char *)id->data, dev_info(dev, "%s initialized\n", (char *)id->data);
drvdata->master_enable ? "Enabled" : "Disabled");
return 0; return 0;
stm_unregister: stm_unregister:

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
/* /*
* Copyright (c) 2011-2012, 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2011-2012, 2017, 2020 The Linux Foundation. All rights reserved.
*/ */
#ifndef __LINUX_CORESIGHT_STM_H_ #ifndef __LINUX_CORESIGHT_STM_H_
#define __LINUX_CORESIGHT_STM_H_ #define __LINUX_CORESIGHT_STM_H_
@ -84,8 +84,6 @@ struct stm_drvdata {
spinlock_t spinlock; spinlock_t spinlock;
struct channel_space chs; struct channel_space chs;
bool enable; bool enable;
struct channel_space debug_status_chs;
bool master_enable;
DECLARE_BITMAP(entities, OST_ENTITY_MAX); DECLARE_BITMAP(entities, OST_ENTITY_MAX);
struct stm_data stm; struct stm_data stm;
local_t mode; local_t mode;