From: Alexander Dahl <ada@thorsis.com>
To: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH 1/1] nvmem: microchip-otpc: Add support for SAM9X60
Date: Fri, 12 Apr 2024 16:08:02 +0200 [thread overview]
Message-ID: <20240412140802.1571935-2-ada@thorsis.com> (raw)
In-Reply-To: <20240412140802.1571935-1-ada@thorsis.com>
---
.../dts/microchip/at91-sam9x60_curiosity.dts | 4 ++++
arch/arm/boot/dts/microchip/sam9x60.dtsi | 7 +++++++
drivers/nvmem/microchip-otpc.c | 16 +++++++++++++---
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boot/dts/microchip/at91-sam9x60_curiosity.dts b/arch/arm/boot/dts/microchip/at91-sam9x60_curiosity.dts
index c6fbdd29019f..754ce8134f73 100644
--- a/arch/arm/boot/dts/microchip/at91-sam9x60_curiosity.dts
+++ b/arch/arm/boot/dts/microchip/at91-sam9x60_curiosity.dts
@@ -254,6 +254,10 @@ ethernet-phy@0 {
};
};
+&otpc {
+ status = "okay";
+};
+
&pinctrl {
adc {
pinctrl_adc_default: adc-default {
diff --git a/arch/arm/boot/dts/microchip/sam9x60.dtsi b/arch/arm/boot/dts/microchip/sam9x60.dtsi
index 291540e5d81e..010c45f533fe 100644
--- a/arch/arm/boot/dts/microchip/sam9x60.dtsi
+++ b/arch/arm/boot/dts/microchip/sam9x60.dtsi
@@ -156,6 +156,13 @@ sdmmc1: sdio-host@90000000 {
status = "disabled";
};
+ otpc: efuse@eff00000 {
+ compatible = "microchip,sam9x60-otpc", "syscon";
+ reg = <0xeff00000 0xec>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ };
+
apb {
compatible = "simple-bus";
#address-cells = <1>;
diff --git a/drivers/nvmem/microchip-otpc.c b/drivers/nvmem/microchip-otpc.c
index 7cf81738a3e0..af9ab1158a2b 100644
--- a/drivers/nvmem/microchip-otpc.c
+++ b/drivers/nvmem/microchip-otpc.c
@@ -8,6 +8,7 @@
*/
#include <linux/bitfield.h>
+#include <linux/dev_printk.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/nvmem-provider.h>
@@ -248,29 +249,38 @@ static int mchp_otpc_probe(struct platform_device *pdev)
int ret;
otpc = devm_kzalloc(&pdev->dev, sizeof(*otpc), GFP_KERNEL);
- if (!otpc)
+ if (!otpc) {
+ dev_err(&pdev->dev, "devm_kzalloc() error\n");
return -ENOMEM;
+ }
otpc->base = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(otpc->base))
+ if (IS_ERR(otpc->base)) {
+ dev_err(&pdev->dev, "devm_platform_ioremap_resource() error\n");
return PTR_ERR(otpc->base);
+ }
otpc->dev = &pdev->dev;
ret = mchp_otpc_init_packets_list(otpc, &size);
- if (ret)
+ if (ret) {
+ dev_err(&pdev->dev, "mchp_otpc_init_packets_list() error (%d)\n", ret);
return ret;
+ }
mchp_nvmem_config.dev = otpc->dev;
mchp_nvmem_config.add_legacy_fixed_of_cells = true;
mchp_nvmem_config.size = size;
mchp_nvmem_config.priv = otpc;
nvmem = devm_nvmem_register(&pdev->dev, &mchp_nvmem_config);
+ if (!nvmem)
+ dev_err(&pdev->dev, "devm_nvmem_register() error\n");
return PTR_ERR_OR_ZERO(nvmem);
}
static const struct of_device_id __maybe_unused mchp_otpc_ids[] = {
{ .compatible = "microchip,sama7g5-otpc", },
+ { .compatible = "microchip,sam9x60-otpc", },
{ },
};
MODULE_DEVICE_TABLE(of, mchp_otpc_ids);
--
2.39.2
next prev parent reply other threads:[~2024-04-12 14:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-12 14:08 [RFC PATCH 0/1] Timeout error with Microchip OTPC driver on SAM9X60 Alexander Dahl
2024-04-12 14:08 ` Alexander Dahl [this message]
2024-04-24 7:32 ` claudiu beznea
2024-07-01 7:40 ` Alexander Dahl
2024-08-13 8:55 ` Alexander Dahl
2024-08-20 11:59 ` claudiu beznea
2024-08-20 13:48 ` Alexander Dahl
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=20240412140802.1571935-2-ada@thorsis.com \
--to=ada@thorsis.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®