summaryrefslogtreecommitdiffstats
path: root/drivers/nvmem
diff options
context:
space:
mode:
authorStefan Riedmueller <s.riedmueller@phytec.de>2018-12-19 15:07:03 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-01-03 12:00:46 +0100
commit59344263a9df2b80645620a1353a78101d314747 (patch)
treede9212308f434fbccfc7f12afa10f112b8a8402f /drivers/nvmem
parent326ba717dd34bc12cd6c67d52f9c2471f0e91603 (diff)
downloadbarebox-59344263a9df2b80645620a1353a78101d314747.tar.gz
barebox-59344263a9df2b80645620a1353a78101d314747.tar.xz
nvmem: ocotp: Fix writing of second mac address fuses on imx6ul
Commit 19a32c0f6bf0 ("nvmem: ocotp: Add support for second mac address fuses on imx6ul") added support for correctly reading the second MAC address from fuses of the i.MX 6UL/ULL but not for writing. So also fit writing of the second MAC address fuses to the correct method. Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/nvmem')
-rw-r--r--drivers/nvmem/ocotp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/nvmem/ocotp.c b/drivers/nvmem/ocotp.c
index e0cf35f0b7..d904bd08f0 100644
--- a/drivers/nvmem/ocotp.c
+++ b/drivers/nvmem/ocotp.c
@@ -446,9 +446,18 @@ static int imx_ocotp_set_mac(struct param_d *param, void *priv)
{
char buf[MAC_BYTES];
struct ocotp_priv_ethaddr *ethaddr = priv;
+ int ret;
- ethaddr->data->format_mac(buf, ethaddr->value,
- OCOTP_MAC_TO_HW);
+ ret = regmap_bulk_read(ethaddr->map, ethaddr->offset, buf, MAC_BYTES);
+ if (ret < 0)
+ return ret;
+
+ if (ethaddr->offset != IMX6UL_MAC_OFFSET_1)
+ ethaddr->data->format_mac(buf, ethaddr->value,
+ OCOTP_MAC_TO_HW);
+ else
+ ethaddr->data->format_mac(buf + 2, ethaddr->value,
+ OCOTP_MAC_TO_HW);
return regmap_bulk_write(ethaddr->map, ethaddr->offset,
buf, MAC_BYTES);