History

ARM: 8838/1: drivers: amba: Updates to component identification for driver matching.

The CoreSight specification (ARM IHI 0029E), updates the ID register requirements for components on an AMBA bus, to cover both traditional ARM Primecell type devices, and newer CoreSight and other components. The Peripheral ID (PID) / Component ID (CID) pair is extended in certain cases to uniquely identify components. CoreSight components related to a single function can share Peripheral ID values, and must be further identified using a Unique Component Identifier (UCI). e.g. the ETM, CTI, PMU and Debug hardware of the A35 all share the same PID. Bits 15:12 of the CID are defined to be the device class. Class 0xF remains for PrimeCell and legacy components. Class 0x9 defines the component as CoreSight (CORESIGHT_CID above) Class 0x0, 0x1, 0xB, 0xE define components that do not have driver support at present. Class 0x2-0x8,0xA and 0xD-0xD are presently reserved. The specification futher defines which classes of device use the standard CID/PID pair, and when additional ID registers are required. This patch introduces the amba_cs_uci_id structure which will be used in all coresight drivers for indentification via the private data pointer in the amba_id structure. Existing drivers that currently use the amba_id->data pointer for private data are updated to use the amba_cs_uci_id->data pointer. Macros and inline functions are added to simplify this code.

Mike Leach committed 7 years ago

Commit e85fa281 parent de9c0d45 files · +90 −63Browse files

Unified · Split

5 files
  1. drivers/hwtracing/coresight/coresight-etm3x.c +13 −31
  2. drivers/hwtracing/coresight/coresight-priv.h +32 −0
  3. drivers/hwtracing/coresight/coresight-stm.c +3 −11
  4. drivers/hwtracing/coresight/coresight-tmc.c +9 −21
  5. include/linux/amba/bus.h +33 −0
drivers/hwtracing/coresight/coresight-etm3x.c+13−31
@@ -871,7 +871,7 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) · 870 unmodified lines
871 }871 }
872 872
873 pm_runtime_put(&adev->dev);873 pm_runtime_put(&adev->dev);
874 dev_info(dev, "%s initialized\n", (char *)id->data);874 dev_info(dev, "%s initialized\n", (char *)coresight_get_uci_data(id));
875 if (boot_enable) {875 if (boot_enable) {
876 coresight_enable(drvdata->csdev);876 coresight_enable(drvdata->csdev);
877 drvdata->boot_enable = true;877 drvdata->boot_enable = true;
@@ -915,36 +915,18 @@ static const struct dev_pm_ops etm_dev_pm_ops = { · 37 unmodified lines
915};915};
916 916
917static const struct amba_id etm_ids[] = {917static const struct amba_id etm_ids[] = {
918 { /* ETM 3.3 */918 /* ETM 3.3 */
919 .id = 0x000bb921,919 CS_AMBA_ID_DATA(0x000bb921, "ETM 3.3"),
920 .mask = 0x000fffff,920 /* ETM 3.5 - Cortex-A5 */
921 .data = "ETM 3.3",921 CS_AMBA_ID_DATA(0x000bb955, "ETM 3.5"),
922 },922 /* ETM 3.5 */
923 { /* ETM 3.5 - Cortex-A5 */923 CS_AMBA_ID_DATA(0x000bb956, "ETM 3.5"),
924 .id = 0x000bb955,924 /* PTM 1.0 */
925 .mask = 0x000fffff,925 CS_AMBA_ID_DATA(0x000bb950, "PTM 1.0"),
926 .data = "ETM 3.5",926 /* PTM 1.1 */
927 },927 CS_AMBA_ID_DATA(0x000bb95f, "PTM 1.1"),
928 { /* ETM 3.5 */928 /* PTM 1.1 Qualcomm */
929 .id = 0x000bb956,929 CS_AMBA_ID_DATA(0x000b006f, "PTM 1.1"),
930 .mask = 0x000fffff,
931 .data = "ETM 3.5",
932 },
933 { /* PTM 1.0 */
934 .id = 0x000bb950,
935 .mask = 0x000fffff,
936 .data = "PTM 1.0",
937 },
938 { /* PTM 1.1 */
939 .id = 0x000bb95f,
940 .mask = 0x000fffff,
941 .data = "PTM 1.1",
942 },
943 { /* PTM 1.1 Qualcomm */
944 .id = 0x000b006f,
945 .mask = 0x000fffff,
946 .data = "PTM 1.1",
947 },
948 { 0, 0},930 { 0, 0},
949};931};
950 932
drivers/hwtracing/coresight/coresight-priv.h+32−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
6#ifndef _CORESIGHT_PRIV_H6#ifndef _CORESIGHT_PRIV_H
7#define _CORESIGHT_PRIV_H7#define _CORESIGHT_PRIV_H
8 8
9#include <linux/amba/bus.h>
9#include <linux/bitops.h>10#include <linux/bitops.h>
10#include <linux/io.h>11#include <linux/io.h>
11#include <linux/coresight.h>12#include <linux/coresight.h>
@@ -159,4 +160,35 @@ static inline int etm_readl_cp14(u32 off, unsigned int *val) { return 0; } · 147 unmodified lines
159static inline int etm_writel_cp14(u32 off, u32 val) { return 0; }160static inline int etm_writel_cp14(u32 off, u32 val) { return 0; }
160#endif161#endif
161 162
163/*
164 * Macros and inline functions to handle CoreSight UCI data and driver
165 * private data in AMBA ID table entries, and extract data values.
166 */
167
168/* coresight AMBA ID, no UCI, no driver data: id table entry */
169#define CS_AMBA_ID(pid) \
170 { \
171 .id = pid, \
172 .mask = 0x000fffff, \
173 }
174
175/* coresight AMBA ID, UCI with driver data only: id table entry. */
176#define CS_AMBA_ID_DATA(pid, dval) \
177 { \
178 .id = pid, \
179 .mask = 0x000fffff, \
180 .data = (void *)&(struct amba_cs_uci_id) \
181 { \
182 .data = (void *)dval, \
183 } \
184 }
185
186/* extract the data value from a UCI structure given amba_id pointer. */
187static inline void *coresight_get_uci_data(const struct amba_id *id)
188{
189 if (id->data)
190 return ((struct amba_cs_uci_id *)(id->data))->data;
191 return 0;
192}
193
162#endif194#endif
drivers/hwtracing/coresight/coresight-stm.c+3−11
@@ -874,7 +874,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) · 873 unmodified lines
874 874
875 pm_runtime_put(&adev->dev);875 pm_runtime_put(&adev->dev);
876 876
877 dev_info(dev, "%s initialized\n", (char *)id->data);877 dev_info(dev, "%s initialized\n", (char *)coresight_get_uci_data(id));
878 return 0;878 return 0;
879 879
880stm_unregister:880stm_unregister:
@@ -909,16 +909,8 @@ static const struct dev_pm_ops stm_dev_pm_ops = { · 28 unmodified lines
909};909};
910 910
911static const struct amba_id stm_ids[] = {911static const struct amba_id stm_ids[] = {
912 {912 CS_AMBA_ID_DATA(0x000bb962, "STM32"),
913 .id = 0x000bb962,913 CS_AMBA_ID_DATA(0x000bb963, "STM500"),
914 .mask = 0x000fffff,
915 .data = "STM32",
916 },
917 {
918 .id = 0x000bb963,
919 .mask = 0x000fffff,
920 .data = "STM500",
921 },
922 { 0, 0},914 { 0, 0},
923};915};
924 916
drivers/hwtracing/coresight/coresight-tmc.c+9−21
@@ -443,7 +443,8 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) · 442 unmodified lines
443 desc.type = CORESIGHT_DEV_TYPE_SINK;443 desc.type = CORESIGHT_DEV_TYPE_SINK;
444 desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER;444 desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER;
445 desc.ops = &tmc_etr_cs_ops;445 desc.ops = &tmc_etr_cs_ops;
446 ret = tmc_etr_setup_caps(drvdata, devid, id->data);446 ret = tmc_etr_setup_caps(drvdata, devid,
447 coresight_get_uci_data(id));
447 if (ret)448 if (ret)
448 goto out;449 goto out;
449 break;450 break;
@@ -475,26 +476,13 @@ out: · 25 unmodified lines
475}476}
476 477
477static const struct amba_id tmc_ids[] = {478static const struct amba_id tmc_ids[] = {
478 {479 CS_AMBA_ID(0x000bb961),
479 .id = 0x000bb961,480 /* Coresight SoC 600 TMC-ETR/ETS */
480 .mask = 0x000fffff,481 CS_AMBA_ID_DATA(0x000bb9e8, (unsigned long)CORESIGHT_SOC_600_ETR_CAPS),
481 },482 /* Coresight SoC 600 TMC-ETB */
482 {483 CS_AMBA_ID(0x000bb9e9),
483 /* Coresight SoC 600 TMC-ETR/ETS */484 /* Coresight SoC 600 TMC-ETF */
484 .id = 0x000bb9e8,485 CS_AMBA_ID(0x000bb9ea),
485 .mask = 0x000fffff,
486 .data = (void *)(unsigned long)CORESIGHT_SOC_600_ETR_CAPS,
487 },
488 {
489 /* Coresight SoC 600 TMC-ETB */
490 .id = 0x000bb9e9,
491 .mask = 0x000fffff,
492 },
493 {
494 /* Coresight SoC 600 TMC-ETF */
495 .id = 0x000bb9ea,
496 .mask = 0x000fffff,
497 },
498 { 0, 0},486 { 0, 0},
499};487};
500 488
include/linux/amba/bus.h+33−0
@@ -25,6 +25,39 @@ · 24 unmodified lines
25#define AMBA_CID 0xb105f00d25#define AMBA_CID 0xb105f00d
26#define CORESIGHT_CID 0xb105900d26#define CORESIGHT_CID 0xb105900d
27 27
28/*
29 * CoreSight Architecture specification updates the ID specification
30 * for components on the AMBA bus. (ARM IHI 0029E)
31 *
32 * Bits 15:12 of the CID are the device class.
33 *
34 * Class 0xF remains for PrimeCell and legacy components. (AMBA_CID above)
35 * Class 0x9 defines the component as CoreSight (CORESIGHT_CID above)
36 * Class 0x0, 0x1, 0xB, 0xE define components that do not have driver support
37 * at present.
38 * Class 0x2-0x8,0xA and 0xD-0xD are presently reserved.
39 *
40 * Remaining CID bits stay as 0xb105-00d
41 */
42
43/**
44 * Class 0x9 components use additional values to form a Unique Component
45 * Identifier (UCI), where peripheral ID values are identical for different
46 * components. Passed to the amba bus code from the component driver via
47 * the amba_id->data pointer.
48 * @devarch : coresight devarch register value
49 * @devarch_mask: mask bits used for matching. 0 indicates UCI not used.
50 * @devtype : coresight device type value
51 * @data : additional driver data. As we have usurped the original
52 * pointer some devices may still need additional data
53 */
54struct amba_cs_uci_id {
55 unsigned int devarch;
56 unsigned int devarch_mask;
57 unsigned int devtype;
58 void *data;
59};
60
28struct clk;61struct clk;
29 62
30struct amba_device {63struct amba_device {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t