Merge tag 'ti-driver-soc-for-v6.8' of https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux into soc/drivers
TI SoC driver updates for v6.8 - ti_sci: Minor fixup for off by one error in debugfs_create - k3-socinfo: Refactoring and add j721e detection, j722s * tag 'ti-driver-soc-for-v6.8' of https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux: soc: ti: k3-socinfo: Add JTAG ID for J722S soc: ti: k3-socinfo: Revamp driver to accommodate different rev structs firmware: ti_sci: Fix an off-by-one in ti_sci_debugfs_create() Link: https://lore.kernel.org/r/20231218153043.r5psxbjjpccusjg4@september Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
@@ -164,7 +164,7 @@ static int ti_sci_debugfs_create(struct platform_device *pdev,
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct resource *res;
|
||||
char debug_name[50] = "ti_sci_debug@";
|
||||
char debug_name[50];
|
||||
|
||||
/* Debug region is optional */
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
|
||||
@@ -181,10 +181,10 @@ static int ti_sci_debugfs_create(struct platform_device *pdev,
|
||||
/* Setup NULL termination */
|
||||
info->debug_buffer[info->debug_region_size] = 0;
|
||||
|
||||
info->d = debugfs_create_file(strncat(debug_name, dev_name(dev),
|
||||
sizeof(debug_name) -
|
||||
sizeof("ti_sci_debug@")),
|
||||
0444, NULL, info, &ti_sci_debug_fops);
|
||||
snprintf(debug_name, sizeof(debug_name), "ti_sci_debug@%s",
|
||||
dev_name(dev));
|
||||
info->d = debugfs_create_file(debug_name, 0444, NULL, info,
|
||||
&ti_sci_debug_fops);
|
||||
if (IS_ERR(info->d))
|
||||
return PTR_ERR(info->d);
|
||||
|
||||
|
||||
+58
-17
@@ -33,19 +33,35 @@
|
||||
|
||||
#define CTRLMMR_WKUP_JTAGID_MFG_TI 0x17
|
||||
|
||||
#define JTAG_ID_PARTNO_AM65X 0xBB5A
|
||||
#define JTAG_ID_PARTNO_J721E 0xBB64
|
||||
#define JTAG_ID_PARTNO_J7200 0xBB6D
|
||||
#define JTAG_ID_PARTNO_AM64X 0xBB38
|
||||
#define JTAG_ID_PARTNO_J721S2 0xBB75
|
||||
#define JTAG_ID_PARTNO_AM62X 0xBB7E
|
||||
#define JTAG_ID_PARTNO_J784S4 0xBB80
|
||||
#define JTAG_ID_PARTNO_AM62AX 0xBB8D
|
||||
#define JTAG_ID_PARTNO_AM62PX 0xBB9D
|
||||
#define JTAG_ID_PARTNO_J722S 0xBBA0
|
||||
|
||||
static const struct k3_soc_id {
|
||||
unsigned int id;
|
||||
const char *family_name;
|
||||
} k3_soc_ids[] = {
|
||||
{ 0xBB5A, "AM65X" },
|
||||
{ 0xBB64, "J721E" },
|
||||
{ 0xBB6D, "J7200" },
|
||||
{ 0xBB38, "AM64X" },
|
||||
{ 0xBB75, "J721S2"},
|
||||
{ 0xBB7E, "AM62X" },
|
||||
{ 0xBB80, "J784S4" },
|
||||
{ 0xBB8D, "AM62AX" },
|
||||
{ 0xBB9D, "AM62PX" },
|
||||
{ JTAG_ID_PARTNO_AM65X, "AM65X" },
|
||||
{ JTAG_ID_PARTNO_J721E, "J721E" },
|
||||
{ JTAG_ID_PARTNO_J7200, "J7200" },
|
||||
{ JTAG_ID_PARTNO_AM64X, "AM64X" },
|
||||
{ JTAG_ID_PARTNO_J721S2, "J721S2"},
|
||||
{ JTAG_ID_PARTNO_AM62X, "AM62X" },
|
||||
{ JTAG_ID_PARTNO_J784S4, "J784S4" },
|
||||
{ JTAG_ID_PARTNO_AM62AX, "AM62AX" },
|
||||
{ JTAG_ID_PARTNO_AM62PX, "AM62PX" },
|
||||
{ JTAG_ID_PARTNO_J722S, "J722S" },
|
||||
};
|
||||
|
||||
static const char * const j721e_rev_string_map[] = {
|
||||
"1.0", "1.1",
|
||||
};
|
||||
|
||||
static int
|
||||
@@ -63,6 +79,32 @@ k3_chipinfo_partno_to_names(unsigned int partno,
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static int
|
||||
k3_chipinfo_variant_to_sr(unsigned int partno, unsigned int variant,
|
||||
struct soc_device_attribute *soc_dev_attr)
|
||||
{
|
||||
switch (partno) {
|
||||
case JTAG_ID_PARTNO_J721E:
|
||||
if (variant >= ARRAY_SIZE(j721e_rev_string_map))
|
||||
goto err_unknown_variant;
|
||||
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%s",
|
||||
j721e_rev_string_map[variant]);
|
||||
break;
|
||||
default:
|
||||
variant++;
|
||||
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%x.0",
|
||||
variant);
|
||||
}
|
||||
|
||||
if (!soc_dev_attr->revision)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
|
||||
err_unknown_variant:
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static int k3_chipinfo_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
@@ -94,7 +136,6 @@ static int k3_chipinfo_probe(struct platform_device *pdev)
|
||||
|
||||
variant = (jtag_id & CTRLMMR_WKUP_JTAGID_VARIANT_MASK) >>
|
||||
CTRLMMR_WKUP_JTAGID_VARIANT_SHIFT;
|
||||
variant++;
|
||||
|
||||
partno_id = (jtag_id & CTRLMMR_WKUP_JTAGID_PARTNO_MASK) >>
|
||||
CTRLMMR_WKUP_JTAGID_PARTNO_SHIFT;
|
||||
@@ -103,16 +144,16 @@ static int k3_chipinfo_probe(struct platform_device *pdev)
|
||||
if (!soc_dev_attr)
|
||||
return -ENOMEM;
|
||||
|
||||
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%x.0", variant);
|
||||
if (!soc_dev_attr->revision) {
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = k3_chipinfo_partno_to_names(partno_id, soc_dev_attr);
|
||||
if (ret) {
|
||||
dev_err(dev, "Unknown SoC JTAGID[0x%08X]: %d\n", jtag_id, ret);
|
||||
goto err_free_rev;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = k3_chipinfo_variant_to_sr(partno_id, variant, soc_dev_attr);
|
||||
if (ret) {
|
||||
dev_err(dev, "Unknown SoC SR[0x%08X]: %d\n", jtag_id, ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
node = of_find_node_by_path("/");
|
||||
|
||||
Reference in New Issue
Block a user