treewide: backport support for nvmem on non platform devices

In the current state, nvmem cells are only detected on platform device.
To quickly fix the problem, we register the affected problematic driver
with the of_platform but that is more an hack than a real solution.
Backport from net-next the required patch so that nvmem can work also
with non-platform devices and rework our current patch.
Drop the mediatek and dsa workaround and rework the ath10k patches.
Rework every driver that use the of_get_mac_address api.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
This commit is contained in:
Ansuel Smith
2021-07-23 20:19:43 +02:00
committed by David Bauer
parent edb6bc1990
commit 91a52f22a1
35 changed files with 4460 additions and 500 deletions

View File

@@ -10514,7 +10514,7 @@ Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
+module_exit(dpa_ptp_unload);
--- /dev/null
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/mac-api.c
@@ -0,0 +1,909 @@
@@ -0,0 +1,907 @@
+/* Copyright 2008-2012 Freescale Semiconductor, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
@@ -11582,7 +11582,6 @@ Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
+ struct mac_device *mac_dev;
+ struct platform_device *of_dev;
+ struct resource res;
+ const uint8_t *mac_addr;
+ const char *char_prop;
+ int nph;
+ u32 cell_index;
@@ -11701,14 +11700,13 @@ Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
+ mac_dev->cell_index -= 8;
+
+ /* Get the MAC address */
+ mac_addr = of_get_mac_address(mac_node);
+ if (unlikely(mac_addr == NULL)) {
+ of_get_mac_address(mac_node, mac_dev->addr);
+ if (unlikely(!is_valid_ether_addr(mac_dev->addr))) {
+ dev_err(dev, "of_get_mac_address(%s) failed\n",
+ mac_node->full_name);
+ _errno = -EINVAL;
+ goto _return_dev_set_drvdata;
+ }
+ memcpy(mac_dev->addr, mac_addr, sizeof(mac_dev->addr));
+
+ /* Verify the number of port handles */
+ nph = of_count_phandle_with_args(mac_node, "fsl,fman-ports", NULL);

View File

@@ -6638,7 +6638,7 @@ Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
+}
--- /dev/null
+++ b/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
@@ -0,0 +1,394 @@
@@ -0,0 +1,388 @@
+/*
+ * Copyright 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
@@ -6680,7 +6680,6 @@ Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
+ int size;
+ int ii = 0, phy_id = 0;
+ const u32 *addr;
+ const void *mac_addr;
+
+ for (ii = 0; ii < if_cnt; ii++) {
+ gem = of_get_next_child(parent, gem);
@@ -6699,12 +6698,7 @@ Signed-off-by: Anjaneyulu Jagarlmudi <anji.jagarlmudi@nxp.com>
+
+ pdata->ls1012a_eth_pdata[port].gem_id = port;
+
+ mac_addr = of_get_mac_address(gem);
+
+ if (mac_addr) {
+ memcpy(pdata->ls1012a_eth_pdata[port].mac_addr, mac_addr,
+ ETH_ALEN);
+ }
+ of_get_mac_address(gem, pdata->ls1012a_eth_pdata[port].mac_addr);
+
+ pdata->ls1012a_eth_pdata[port].mii_config = of_get_phy_mode(gem);
+

View File

@@ -33,15 +33,9 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
int size;
int ii = 0, phy_id = 0;
const u32 *addr;
@@ -49,18 +49,11 @@ static int pfe_get_gemac_if_proprties(st
pdata->ls1012a_eth_pdata[port].gem_id = port;
@@ -49,12 +49,6 @@ static int pfe_get_gemac_if_proprties(st
mac_addr = of_get_mac_address(gem);
-
if (mac_addr) {
memcpy(pdata->ls1012a_eth_pdata[port].mac_addr, mac_addr,
ETH_ALEN);
}
of_get_mac_address(gem, pdata->ls1012a_eth_pdata[port].mac_addr);
- pdata->ls1012a_eth_pdata[port].mii_config = of_get_phy_mode(gem);
-

View File

@@ -30,9 +30,3 @@ Signed-off-by: Anji Jagarlmudi <anji.jagarlmudi@nxp.com>
pdata->ls1012a_eth_pdata[port].gem_id = port;
mac_addr = of_get_mac_address(gem);
- if (mac_addr) {
+ if (!IS_ERR_OR_NULL(mac_addr)) {
memcpy(pdata->ls1012a_eth_pdata[port].mac_addr, mac_addr,
ETH_ALEN);
}