Messages in this thread | | | Subject | Re: [PATCH 5/5] arm/arm64: smccc: Add ARCH_SOC_ID support | From | John Garry <> | Date | Fri, 1 May 2020 16:25:27 +0100 |
| |
On 30/04/2020 12:48, Sudeep Holla wrote: > +static int __init smccc_soc_init(void) > +{ > + struct device *dev; > + int ret, soc_id_rev; > + struct arm_smccc_res res; > + static char soc_id_str[8], soc_id_rev_str[12]; > + > + if (arm_smccc_get_version() < ARM_SMCCC_VERSION_1_2) > + return 0; > + > + ret = smccc_soc_id_support_check(); > + if (ret) > + return ret; > + > + arm_smccc_1_1_invoke(ARM_SMCCC_ARCH_SOC_ID, 0, &res); > + > + ret = smccc_map_error_codes(res.a0); > + if (ret) > + return ret; > + > + soc_id_version = res.a0; > + > + arm_smccc_1_1_invoke(ARM_SMCCC_ARCH_SOC_ID, 1, &res); > + > + ret = smccc_map_error_codes(res.a0); > + if (ret) > + return ret; > + > + soc_id_rev = res.a0; > + > + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); > + if (!soc_dev_attr) > + return -ENOMEM; > + > + sprintf(soc_id_str, "0x%04x", IMP_DEF_SOC_ID(soc_id_version)); > + sprintf(soc_id_rev_str, "0x%08x", soc_id_rev); > + > + soc_dev_attr->soc_id = soc_id_str; > + soc_dev_attr->revision = soc_id_rev_str; > + > + soc_dev = soc_device_register(soc_dev_attr); > + if (IS_ERR(soc_dev)) { > + ret = PTR_ERR(soc_dev); > + goto free_soc; > + } > + > + dev = soc_device_to_device(soc_dev); > +
Just wondering, what about if the platform already had a SoC driver - now it could have another one, such that we may have multiple sysfs soc devices, right?
Thanks, John
> + ret = devm_device_add_groups(dev, jep106_id_groups); > + if (ret) { > + dev_err(dev, "sysfs create failed: %d\n", ret); > + goto unregister_soc; > + } > + > + pr_info("SMCCC SoC ID: %s Revision %s\n", soc_dev_attr->soc_id, > + soc_dev_attr->revision); > + > + return 0;
| |