soc: ti: add k3 platforms chipid module driver
Subsystems (2)
v3 cover soc: ti: add k3 platforms chipid module driver
Hi All,
This series introduces TI K3 Multicore SoC platforms chipid module driver which provides identification support of the TI K3 SoCs (family, revision) and register this information with the SoC bus. It is available under /sys/devices/soc0/ for user space, and can be checked, where needed, in Kernel using soc_device_match().
It is also required for introducing support for new revisions of K3 AM65x/J721E SoCs.
Example J721E:
# cat /sys/devices/soc0/{machine,family,revision}
Texas Instruments K3 J721E SoC
J721E
SR1.0Example AM65x:
# cat /sys/devices/soc0/{machine,family,revision}
Texas Instruments AM654 Base Board
AM65X
SR1.0Changes in v3:
- add handling of kasprintf() fail
Changes in v2:
- pr_debug() replaced with pr_info() to show SoC info on init
- minor format change
- split series on driver and platform changes
- add Reviewed-by: Lokesh Vutla <[email protected]>
v2: https://lkml.org/lkml/2020/5/5/1193
v1: https://lwn.net/Articles/818577/
Grygorii Strashko (2):
dt-bindings: soc: ti: add binding for k3 platforms chipid module
soc: ti: add k3 platforms chipid module driver
.../bindings/soc/ti/k3-socinfo.yaml | 40 +++++ drivers/soc/ti/Kconfig | 10 ++ drivers/soc/ti/Makefile | 1 + drivers/soc/ti/k3-socinfo.c | 140 ++++++++++++++++++ 4 files changed, 191 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/ti/k3-socinfo.yaml create mode 100644 drivers/soc/ti/k3-socinfo.c
Signature · 1 line
2.17.1
PATCH v3 1/2 dt-bindings: soc: ti: add binding for k3 platforms chipid module
Add DT binding for Texas Instruments K3 Multicore SoC platforms chipid module which is represented by CTRLMMR_xxx_JTAGID register and contains information about SoC id and revision.
--- .../bindings/soc/ti/k3-socinfo.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/ti/k3-socinfo.yaml
Documentation/devicetree/bindings/soc/ti/k3-socinfo.yaml new file +40 -0
@@ -0,0 +1,40 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/ti/k3-socinfo.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Texas Instruments K3 Multicore SoC platforms chipid module + +maintainers: + - Tero Kristo <[email protected]> + - Nishanth Menon <[email protected]> + +description: | + Texas Instruments (ARM64) K3 Multicore SoC platforms chipid module is + represented by CTRLMMR_xxx_JTAGID register which contains information about + SoC id and revision. + +properties: + $nodename: + pattern: "^chipid@[0-9a-f]+$" + + compatible: + items: + - const: ti,am654-chipid + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + chipid@43000014 { + compatible = "ti,am654-chipid"; + reg = <0x43000014 0x4>; + };
Signature · 1 line
2.17.1
PATCH v3 2/2 soc: ti: add k3 platforms chipid module driver
In reply to Grygorii StrashkoThe Texas Instruments K3 Multicore SoC platforms have chipid module which is represented by CTRLMMR_xxx_JTAGID register and contains information about SoC id and revision.
Bits:
31-28 VARIANT Device variant
27-12 PARTNO Part number 11-1 MFG Indicates TI as manufacturer (0x17) 1 Always 1
This patch adds corresponding driver to identify the TI K3 SoC family and revision, and registers this information with the SoC bus. It is available under /sys/devices/soc0/ for user space, and can be checked, where needed, in Kernel using soc_device_match().
Identification is done by:
- checking MFG to be TI ID
- retrieving Device variant (revision)
- retrieving Part number and convert it to the family
- retrieving machine from DT "/model"
Example J721E:
# cat /sys/devices/soc0/{machine,family,revision}
Texas Instruments K3 J721E SoC
J721E
SR1.0Example AM65x:
# cat /sys/devices/soc0/{machine,family,revision}
Texas Instruments AM654 Base Board
AM65X
SR1.0--- drivers/soc/ti/Kconfig | 10 +++ drivers/soc/ti/Makefile | 1 + drivers/soc/ti/k3-socinfo.c | 140 ++++++++++++++++++++++++++++++++++++ 3 files changed, 151 insertions(+) create mode 100644 drivers/soc/ti/k3-socinfo.c
drivers/soc/ti/Kconfig +10 -0
@@ -91,6 +91,16 @@ config TI_K3_RINGACC and a consumer. There is one RINGACC module per NAVSS on TI AM65x SoCs If unsure, say N. +config TI_K3_SOCINFO + bool + depends on ARCH_K3 || COMPILE_TEST + select SOC_BUS + select MFD_SYSCON + help + Include support for the SoC bus socinfo for the TI K3 Multicore SoC + platforms to provide information about the SoC family and + variant to user space. + endif # SOC_TI config TI_SCI_INTA_MSI_DOMAIN
drivers/soc/ti/Makefile +1 -0
@@ -11,3 +11,4 @@ obj-$(CONFIG_WKUP_M3_IPC) += wkup_m3_ipc.o obj-$(CONFIG_TI_SCI_PM_DOMAINS) += ti_sci_pm_domains.o obj-$(CONFIG_TI_SCI_INTA_MSI_DOMAIN) += ti_sci_inta_msi.o obj-$(CONFIG_TI_K3_RINGACC) += k3-ringacc.o +obj-$(CONFIG_TI_K3_SOCINFO) += k3-socinfo.o
drivers/soc/ti/k3-socinfo.c new file +140 -0
140 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 5 lines · Grygorii Strashko
drivers/soc/ti/k3-socinfo.c new file +5
-0+static int __init k3_chipinfo_init (void ) +{ +struct soc_device_attribute *soc_dev_attr; +struct soc_device *soc_dev; +struct device_node *node;
drivers/soc/ti/k3-socinfo.c line 73
Quoted 10 lines
drivers/soc/ti/k3-socinfo.c new file +10
-0+struct regmap *regmap; +u32 partno_id; +u32 variant; +u32 jtag_id; +u32 mfg; +int ret; + + node =of_find_compatible_node (NULL ,NULL ,"ti,am654-chipid" ); +if (!node) +return -ENODEV ;
This will fail the initcall and print a warning when the kernel runs on any other SoC. Would it be possible to just make this a platform_driver?
If not, I think you should silently return success when the device node is absent.
Arnd
Hi Arnd,
Quoted 22 lines · Arnd Bergmann
Quoted 5 lines · Grygorii Strashko
drivers/soc/ti/k3-socinfo.c new file +5
-0+static int __init k3_chipinfo_init (void ) +{ +struct soc_device_attribute *soc_dev_attr; +struct soc_device *soc_dev; +struct device_node *node;drivers/soc/ti/k3-socinfo.c line 73
Quoted 10 lines
drivers/soc/ti/k3-socinfo.c new file +10
-0+struct regmap *regmap; +u32 partno_id; +u32 variant; +u32 jtag_id; +u32 mfg; +int ret; + + node =of_find_compatible_node (NULL ,NULL ,"ti,am654-chipid" ); +if (!node) +return -ENODEV ;This will fail the initcall and print a warning when the kernel runs on any other SoC. Would it be possible to just make this a
platform_driver?
Quoted 2 lines
If not, I think you should silently return success when the device node is absent.
Thank you for your report.
Can' make it platform drv., as te SoC info need to be accessible by divers early. I'll fix it to return success.
Signature · 2 lines
Best regards, grygorii
Quoted 26 lines · Grygorii Strashko
Hi Arnd,
Quoted 22 lines · Arnd Bergmann
Quoted 5 lines · Grygorii Strashko
drivers/soc/ti/k3-socinfo.c new file +5
-0+static int __init k3_chipinfo_init (void ) +{ +struct soc_device_attribute *soc_dev_attr; +struct soc_device *soc_dev; +struct device_node *node;drivers/soc/ti/k3-socinfo.c line 73
Quoted 10 lines
drivers/soc/ti/k3-socinfo.c new file +10
-0+struct regmap *regmap; +u32 partno_id; +u32 variant; +u32 jtag_id; +u32 mfg; +int ret; + + node =of_find_compatible_node (NULL ,NULL ,"ti,am654-chipid" ); +if (!node) +return -ENODEV ;This will fail the initcall and print a warning when the kernel runs on any other SoC. Would it be possible to just make this a
platform_driver?
Quoted 5 lines
Quoted 2 lines
If not, I think you should silently return success when the device node is absent.
Thank you for your report.
Can' make it platform drv., as the SoC info need to be accessible by divers early.
Which drivers in particular? In most cases you should be able to still do this right by relying on initcall ordering as long as this one can only be built-in (or possibly only a module for compile-testing).
Arnd
Hi Arnd,
Quoted 31 lines · Arnd Bergmann
Quoted 29 lines · Grygorii Strashko
Hi Arnd,
Quoted 24 lines · Arnd Bergmann
Quoted 5 lines · Grygorii Strashko
drivers/soc/ti/k3-socinfo.c new file +5
-0+static int __init k3_chipinfo_init (void ) +{ +struct soc_device_attribute *soc_dev_attr; +struct soc_device *soc_dev; +struct device_node *node;drivers/soc/ti/k3-socinfo.c line 73
Quoted 10 lines
drivers/soc/ti/k3-socinfo.c new file +10
-0+struct regmap *regmap; +u32 partno_id; +u32 variant; +u32 jtag_id; +u32 mfg; +int ret; + + node =of_find_compatible_node (NULL ,NULL ,"ti,am654-chipid" ); +if (!node) +return -ENODEV ;This will fail the initcall and print a warning when the kernel runs on any other SoC. Would it be possible to just make this a
platform_driver?If not, I think you should silently return success when the device node is absent.
Quoted 6 lines
Quoted 2 lines
Thank you for your report.
Can' make it platform drv., as the SoC info need to be accessible by divers early.Which drivers in particular? In most cases you should be able to still do this right by relying on initcall ordering as long as this one can only be built-in (or possibly only a module for compile-testing).
Thanks for you review.
As I'm aware of right now, it's going to be: ringacc, dma, net drv and mmc. So, It seems should work with platform_driver and subsys_initcall. I'll try it.
Signature · 2 lines
Best regards, grygorii