@@ -254,6 +254,10 @@ ethernet-phy@0 {
};
};
+&otpc {
+ status = "okay";
+};
+
&pinctrl {
adc {
pinctrl_adc_default: adc-default {
@@ -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>;
@@ -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);