From: Manivannan Sadhasivam <mani@kernel.org> To: Cristian Ciocaltea <cristian.ciocaltea@gmail.com> Cc: "Rob Herring" <robh+dt@kernel.org>, "Andreas Färber" <afaerber@suse.de>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/6] soc: actions: Add Actions Semi Owl socinfo driver Date: Fri, 2 Apr 2021 23:46:24 +0530 [thread overview] Message-ID: <20210402181624.GC31906@thinkpad> (raw) In-Reply-To: <75ec4eff3e6113f4e72daa1b428c355b28005297.1617110420.git.cristian.ciocaltea@gmail.com> On Tue, Mar 30, 2021 at 04:48:18PM +0300, Cristian Ciocaltea wrote: > The driver provides information about the Action Semi Owl family of > SoCs (S500, S700 and S900) to user space via sysfs: machine, family, > soc_id, serial_number. > > Note the serial number is currently provided only for the S500 SoC > variant. > > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com> > --- > drivers/soc/actions/Kconfig | 8 + > drivers/soc/actions/Makefile | 1 + > drivers/soc/actions/owl-socinfo.c | 152 ++++++++++++++++++ > include/linux/soc/actions/owl-serial-number.h | 20 +++ > 4 files changed, 181 insertions(+) > create mode 100644 drivers/soc/actions/owl-socinfo.c > create mode 100644 include/linux/soc/actions/owl-serial-number.h > > diff --git a/drivers/soc/actions/Kconfig b/drivers/soc/actions/Kconfig > index 1aca2058a40c..15faade9282d 100644 > --- a/drivers/soc/actions/Kconfig > +++ b/drivers/soc/actions/Kconfig > @@ -14,4 +14,12 @@ config OWL_PM_DOMAINS > power-gating on Actions Semiconductor S500, S700 and S900 SoCs. > If unsure, say 'n'. > > +config OWL_SOCINFO > + bool "Actions Semi Owl SoC info driver" > + default ARCH_ACTIONS > + select SOC_BUS > + help > + Say 'y' here to support the Action Semiconductor Owl socinfo Actions Semi > + driver, providing information about the SoC to user space. > + > endif > diff --git a/drivers/soc/actions/Makefile b/drivers/soc/actions/Makefile > index 4db9e7b050e5..4b2591d3089f 100644 > --- a/drivers/soc/actions/Makefile > +++ b/drivers/soc/actions/Makefile > @@ -2,3 +2,4 @@ > > obj-$(CONFIG_OWL_PM_DOMAINS_HELPER) += owl-sps-helper.o > obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o > +obj-$(CONFIG_OWL_SOCINFO) += owl-socinfo.o > diff --git a/drivers/soc/actions/owl-socinfo.c b/drivers/soc/actions/owl-socinfo.c > new file mode 100644 > index 000000000000..f28eafac3792 > --- /dev/null > +++ b/drivers/soc/actions/owl-socinfo.c > @@ -0,0 +1,152 @@ [...] > + * Access SoC's serial number stored by the bootloader in DDR memory. > + */ > +static int owl_socinfo_read_serial_rmem(struct device *dev) > +{ > + struct reserved_mem *rmem; > + struct device_node *np; > + int ret = 0; > + > + np = of_find_compatible_node(NULL, NULL, "actions,owl-soc-serial"); > + if (!np) > + return -ENXIO; > + > + rmem = of_reserved_mem_lookup(np); If you do this correctly, you could use "pdev->dev.of_node" here instead of using "of_find_compatible_node()" for getting np. > + if (!rmem) { > + dev_err(dev, "failed to acquire reserved memory region\n"); > + ret = -EINVAL; > + goto out_put; > + } > + [...] > +static const struct of_device_id owl_socinfo_of_match[] = { > + { .compatible = "actions,s500-soc", .data = &s500_soc_info, }, > + { .compatible = "actions,s700-soc", .data = &s700_soc_info, }, > + { .compatible = "actions,s900-soc", .data = &s900_soc_info, }, Please don't add S700/S900 for now. > + { } > +}; > + > +static struct platform_driver owl_socinfo_platform_driver = { > + .probe = owl_socinfo_probe, > + .driver = { > + .name = "owl-socinfo", > + .of_match_table = owl_socinfo_of_match, > + }, > +}; > + > +static int __init owl_socinfo_init(void) > +{ > + return platform_driver_register(&owl_socinfo_platform_driver); > +} > +subsys_initcall(owl_socinfo_init); > diff --git a/include/linux/soc/actions/owl-serial-number.h b/include/linux/soc/actions/owl-serial-number.h > new file mode 100644 > index 000000000000..f8595417668f > --- /dev/null > +++ b/include/linux/soc/actions/owl-serial-number.h > @@ -0,0 +1,20 @@ > +/* SPDX-License-Identifier: GPL-2.0+ */ > +/* > + * Copyright (c) 2021 Cristian Ciocaltea <cristian.ciocaltea@gmail.com> > + */ > + > +#ifndef __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ > +#define __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ > + > +#if IS_ENABLED(CONFIG_OWL_SOCINFO) > +u32 owl_get_soc_serial_low(void); > +u32 owl_get_soc_serial_high(void); Where are these APIs used? Thanks, Mani > +#else > +static inline u32 owl_get_soc_serial_low(void) > +{ return 0; } > + > +static inline u32 owl_get_soc_serial_high(void) > +{ return 0; } > +#endif /* CONFIG_OWL_SOCINFO */ > + > +#endif /* __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ */ > -- > 2.31.1 >
WARNING: multiple messages have this Message-ID (diff)
From: Manivannan Sadhasivam <mani@kernel.org> To: Cristian Ciocaltea <cristian.ciocaltea@gmail.com> Cc: "Rob Herring" <robh+dt@kernel.org>, "Andreas Färber" <afaerber@suse.de>, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/6] soc: actions: Add Actions Semi Owl socinfo driver Date: Fri, 2 Apr 2021 23:46:24 +0530 [thread overview] Message-ID: <20210402181624.GC31906@thinkpad> (raw) In-Reply-To: <75ec4eff3e6113f4e72daa1b428c355b28005297.1617110420.git.cristian.ciocaltea@gmail.com> On Tue, Mar 30, 2021 at 04:48:18PM +0300, Cristian Ciocaltea wrote: > The driver provides information about the Action Semi Owl family of > SoCs (S500, S700 and S900) to user space via sysfs: machine, family, > soc_id, serial_number. > > Note the serial number is currently provided only for the S500 SoC > variant. > > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com> > --- > drivers/soc/actions/Kconfig | 8 + > drivers/soc/actions/Makefile | 1 + > drivers/soc/actions/owl-socinfo.c | 152 ++++++++++++++++++ > include/linux/soc/actions/owl-serial-number.h | 20 +++ > 4 files changed, 181 insertions(+) > create mode 100644 drivers/soc/actions/owl-socinfo.c > create mode 100644 include/linux/soc/actions/owl-serial-number.h > > diff --git a/drivers/soc/actions/Kconfig b/drivers/soc/actions/Kconfig > index 1aca2058a40c..15faade9282d 100644 > --- a/drivers/soc/actions/Kconfig > +++ b/drivers/soc/actions/Kconfig > @@ -14,4 +14,12 @@ config OWL_PM_DOMAINS > power-gating on Actions Semiconductor S500, S700 and S900 SoCs. > If unsure, say 'n'. > > +config OWL_SOCINFO > + bool "Actions Semi Owl SoC info driver" > + default ARCH_ACTIONS > + select SOC_BUS > + help > + Say 'y' here to support the Action Semiconductor Owl socinfo Actions Semi > + driver, providing information about the SoC to user space. > + > endif > diff --git a/drivers/soc/actions/Makefile b/drivers/soc/actions/Makefile > index 4db9e7b050e5..4b2591d3089f 100644 > --- a/drivers/soc/actions/Makefile > +++ b/drivers/soc/actions/Makefile > @@ -2,3 +2,4 @@ > > obj-$(CONFIG_OWL_PM_DOMAINS_HELPER) += owl-sps-helper.o > obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o > +obj-$(CONFIG_OWL_SOCINFO) += owl-socinfo.o > diff --git a/drivers/soc/actions/owl-socinfo.c b/drivers/soc/actions/owl-socinfo.c > new file mode 100644 > index 000000000000..f28eafac3792 > --- /dev/null > +++ b/drivers/soc/actions/owl-socinfo.c > @@ -0,0 +1,152 @@ [...] > + * Access SoC's serial number stored by the bootloader in DDR memory. > + */ > +static int owl_socinfo_read_serial_rmem(struct device *dev) > +{ > + struct reserved_mem *rmem; > + struct device_node *np; > + int ret = 0; > + > + np = of_find_compatible_node(NULL, NULL, "actions,owl-soc-serial"); > + if (!np) > + return -ENXIO; > + > + rmem = of_reserved_mem_lookup(np); If you do this correctly, you could use "pdev->dev.of_node" here instead of using "of_find_compatible_node()" for getting np. > + if (!rmem) { > + dev_err(dev, "failed to acquire reserved memory region\n"); > + ret = -EINVAL; > + goto out_put; > + } > + [...] > +static const struct of_device_id owl_socinfo_of_match[] = { > + { .compatible = "actions,s500-soc", .data = &s500_soc_info, }, > + { .compatible = "actions,s700-soc", .data = &s700_soc_info, }, > + { .compatible = "actions,s900-soc", .data = &s900_soc_info, }, Please don't add S700/S900 for now. > + { } > +}; > + > +static struct platform_driver owl_socinfo_platform_driver = { > + .probe = owl_socinfo_probe, > + .driver = { > + .name = "owl-socinfo", > + .of_match_table = owl_socinfo_of_match, > + }, > +}; > + > +static int __init owl_socinfo_init(void) > +{ > + return platform_driver_register(&owl_socinfo_platform_driver); > +} > +subsys_initcall(owl_socinfo_init); > diff --git a/include/linux/soc/actions/owl-serial-number.h b/include/linux/soc/actions/owl-serial-number.h > new file mode 100644 > index 000000000000..f8595417668f > --- /dev/null > +++ b/include/linux/soc/actions/owl-serial-number.h > @@ -0,0 +1,20 @@ > +/* SPDX-License-Identifier: GPL-2.0+ */ > +/* > + * Copyright (c) 2021 Cristian Ciocaltea <cristian.ciocaltea@gmail.com> > + */ > + > +#ifndef __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ > +#define __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ > + > +#if IS_ENABLED(CONFIG_OWL_SOCINFO) > +u32 owl_get_soc_serial_low(void); > +u32 owl_get_soc_serial_high(void); Where are these APIs used? Thanks, Mani > +#else > +static inline u32 owl_get_soc_serial_low(void) > +{ return 0; } > + > +static inline u32 owl_get_soc_serial_high(void) > +{ return 0; } > +#endif /* CONFIG_OWL_SOCINFO */ > + > +#endif /* __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ */ > -- > 2.31.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-04-02 18:16 UTC|newest] Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-30 13:48 [PATCH v2 0/6] Add support for Actions Semi Owl socinfo Cristian Ciocaltea 2021-03-30 13:48 ` Cristian Ciocaltea 2021-03-30 13:48 ` [PATCH v2 1/6] dt-bindings: reserved-memory: Add Owl SoC serial number binding Cristian Ciocaltea 2021-03-30 13:48 ` Cristian Ciocaltea 2021-04-01 17:07 ` Rob Herring 2021-04-01 17:07 ` Rob Herring 2021-04-01 17:40 ` Cristian Ciocaltea 2021-04-01 17:40 ` Cristian Ciocaltea 2021-04-02 18:06 ` Manivannan Sadhasivam 2021-04-02 18:06 ` Manivannan Sadhasivam 2021-04-02 19:44 ` Cristian Ciocaltea 2021-04-02 19:44 ` Cristian Ciocaltea 2021-03-30 13:48 ` [PATCH v2 2/6] dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding Cristian Ciocaltea 2021-03-30 13:48 ` Cristian Ciocaltea 2021-04-01 17:08 ` Rob Herring 2021-04-01 17:08 ` Rob Herring 2021-04-01 17:57 ` Cristian Ciocaltea 2021-04-01 17:57 ` Cristian Ciocaltea 2021-04-02 18:04 ` Manivannan Sadhasivam 2021-04-02 18:04 ` Manivannan Sadhasivam 2021-04-02 19:25 ` Cristian Ciocaltea 2021-04-02 19:25 ` Cristian Ciocaltea 2021-03-30 13:48 ` [PATCH v2 3/6] soc: actions: Add Actions Semi Owl socinfo driver Cristian Ciocaltea 2021-03-30 13:48 ` Cristian Ciocaltea 2021-04-02 18:16 ` Manivannan Sadhasivam [this message] 2021-04-02 18:16 ` Manivannan Sadhasivam 2021-04-02 19:36 ` Cristian Ciocaltea 2021-04-02 19:36 ` Cristian Ciocaltea 2021-03-30 13:48 ` [PATCH v2 4/6] arm: dts: owl-s500: Add reserved-memory range for Owl SoC serial number Cristian Ciocaltea 2021-03-30 13:48 ` Cristian Ciocaltea 2021-03-30 13:48 ` [PATCH v2 5/6] arm: dts: owl-s500: Add socinfo support Cristian Ciocaltea 2021-03-30 13:48 ` Cristian Ciocaltea 2021-03-30 13:48 ` [PATCH v2 6/6] MAINTAINERS: Add entries for Owl reserved-memory and socinfo bindings Cristian Ciocaltea 2021-03-30 13:48 ` Cristian Ciocaltea 2021-04-01 5:24 ` [PATCH v2 0/6] Add support for Actions Semi Owl socinfo Manivannan Sadhasivam 2021-04-01 5:24 ` Manivannan Sadhasivam 2021-04-01 9:40 ` Cristian Ciocaltea 2021-04-01 9:40 ` Cristian Ciocaltea 2021-04-01 10:27 ` Manivannan Sadhasivam 2021-04-01 10:27 ` Manivannan Sadhasivam 2021-04-01 10:49 ` Andreas Färber 2021-04-01 10:49 ` Andreas Färber 2021-04-01 10:58 ` Cristian Ciocaltea 2021-04-01 10:58 ` Cristian Ciocaltea 2021-04-01 11:07 ` Manivannan Sadhasivam 2021-04-01 11:07 ` Manivannan Sadhasivam 2021-04-01 13:19 ` Cristian Ciocaltea 2021-04-01 13:19 ` Cristian Ciocaltea
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210402181624.GC31906@thinkpad \ --to=mani@kernel.org \ --cc=afaerber@suse.de \ --cc=cristian.ciocaltea@gmail.com \ --cc=devicetree@vger.kernel.org \ --cc=linux-actions@lists.infradead.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=robh+dt@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.