Skip to contentSkip to conversation

nvmem: ocotp: Fix writing of second mac address fuses on imx6ul

PATCH Applied Stefan Riedmueller 2 participants 2 messages Dec 19, 2018 – Jan 3, 2019 NVMEM framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/nvmem/ocotp.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/nvmem/ocotp.c +11 -2
index e0cf35f0b73c..d904bd08f0c5 100644
@@ -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);
Signature · 7 lines
2.7.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 9 lines · Stefan Riedmueller

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.

---
 drivers/nvmem/ocotp.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

Quoted 35 lines
drivers/nvmem/ocotp.c +11 -2
index e0cf35f0b73c..d904bd08f0c5 100644
@@ -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);
Signature · 7 lines
2.7.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox