summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-11-07 16:04:16 -0600
committerTom Rini <[email protected]>2025-11-07 16:45:09 -0600
commit5e5b630eef2eecfe898b2ce3e719a6dc79211569 (patch)
tree587e87d84e5251e9667e95c8c3c9ec58ee1409d9 /drivers/net
parent928af44314a1a086e946ef3c0901d40bdb3e19a9 (diff)
parent475dec28805bf0c84ce83ec06d452b4ee8b5f9a9 (diff)
Merge patch series "arm: airoha: add support for en7523 based boards"
Mikhail Kshevetskiy <[email protected]> says: This patch series adds basic support for the boards based on Airoha EN7523/EN7529/EN7562 SoCs. Due to ATF restrictions these boards are able to run 32-bit OS only. This patch series adds support for the following hardware: * console UART * ethernet controller/switch * spinand flash (in non-dma mode) The following issues may be expected: * Extra slow UBI attaching in U-Boot (up to 20 sec with fastmap enabled). This is caused by the lack of DMA support in the U-Boot airoha-snfi driver. * Linux airoha-snfi driver in some cases might damage you flash data (see: https://lore.kernel.org/lkml/[email protected]/) * Latest linux kernel is recommended to properly support flashes with more than one plane per lun (see: https://lore.kernel.org/lkml/[email protected]/) * It's NOT recommended to use flashes working in continuous mode because U-Boot airoha-snfi driver does not support such flashes properly. The patches was tested on the board: - SoC: Airoha EN7562 - RAM: 512 MB - SPI NAND: 4 Gbit, made by Toshiba - Linux boot: was NOT tested The U-Boot was chain-loaded from the running U-Boot. Airoha ATF-2.3 does not allow easily chain-loading of U-Boot from U-Boot, so a special FIT image (mimic linux kernel) was created 1) Create u-boot.its file with the following contents: === cut here === /dts-v1/; / { description = "ARM OpenWrt FIT (Flattened Image Tree)"; #address-cells = <1>; images { u-boot-ram { description = "OpenWrt U-Boot RAM image"; data = /incbin/("u-boot.bin.lzma"); type = "kernel"; arch = "arm"; os = "linux"; compression = "lzma"; load = <0x81e00000>; entry = <0x81e00000>; hash@1 { algo = "crc32"; }; hash@2 { algo = "sha1"; }; }; fdt-1 { description = "OpenWrt device tree blob"; data = /incbin/("dts/upstream/src/arm/airoha/en7523-evb.dtb"); type = "flat_dt"; arch = "arm"; compression = "none"; hash@1 { algo = "crc32"; }; hash@2 { algo = "sha1"; }; }; }; configurations { default = "config-ram-uboot"; config-ram-uboot { description = "OpenWrt RAM U-Boot"; kernel = "u-boot-ram"; fdt = "fdt-1"; }; }; }; ================== 2) Create u-boot.itb image to chain-load new u-boot from the old one lzma_alone e u-boot.bin u-boot.bin.lzma mkimage -f u-boot.its u-boot.itb 3) Load new u-boot from the old one U-Boot> tftpboot u-boot.itb && bootm Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/airoha_eth.c78
1 files changed, 52 insertions, 26 deletions
diff --git a/drivers/net/airoha_eth.c b/drivers/net/airoha_eth.c
index 19c3d60044c..3234d875887 100644
--- a/drivers/net/airoha_eth.c
+++ b/drivers/net/airoha_eth.c
@@ -21,6 +21,7 @@
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/time.h>
+#include <asm/arch/scu-regmap.h>
#define AIROHA_MAX_NUM_GDM_PORTS 1
#define AIROHA_MAX_NUM_QDMA 1
@@ -312,6 +313,25 @@ struct airoha_eth {
struct airoha_gdm_port *ports[AIROHA_MAX_NUM_GDM_PORTS];
};
+struct airoha_eth_soc_data {
+ int num_xsi_rsts;
+ const char * const *xsi_rsts_names;
+ const char *switch_compatible;
+};
+
+static const char * const en7523_xsi_rsts_names[] = {
+ "hsi0-mac",
+ "hsi1-mac",
+ "hsi-mac",
+};
+
+static const char * const en7581_xsi_rsts_names[] = {
+ "hsi0-mac",
+ "hsi1-mac",
+ "hsi-mac",
+ "xfp-mac",
+};
+
static u32 airoha_rr(void __iomem *base, u32 offset)
{
return readl(base + offset);
@@ -678,10 +698,12 @@ static int airoha_hw_init(struct udevice *dev,
static int airoha_switch_init(struct udevice *dev, struct airoha_eth *eth)
{
+ struct airoha_eth_soc_data *data = (void *)dev_get_driver_data(dev);
ofnode switch_node;
fdt_addr_t addr;
- switch_node = ofnode_by_compatible(ofnode_null(), "airoha,en7581-switch");
+ switch_node = ofnode_by_compatible(ofnode_null(),
+ data->switch_compatible);
if (!ofnode_valid(switch_node))
return -EINVAL;
@@ -718,16 +740,12 @@ static int airoha_switch_init(struct udevice *dev, struct airoha_eth *eth)
static int airoha_eth_probe(struct udevice *dev)
{
+ struct airoha_eth_soc_data *data = (void *)dev_get_driver_data(dev);
struct airoha_eth *eth = dev_get_priv(dev);
struct regmap *scu_regmap;
- ofnode scu_node;
- int ret;
+ int i, ret;
- scu_node = ofnode_by_compatible(ofnode_null(), "airoha,en7581-scu");
- if (!ofnode_valid(scu_node))
- return -EINVAL;
-
- scu_regmap = syscon_node_to_regmap(scu_node);
+ scu_regmap = airoha_get_scu_regmap();
if (IS_ERR(scu_regmap))
return PTR_ERR(scu_regmap);
@@ -747,11 +765,11 @@ static int airoha_eth_probe(struct udevice *dev)
return -ENOMEM;
eth->rsts.count = AIROHA_MAX_NUM_RSTS;
- eth->xsi_rsts.resets = devm_kcalloc(dev, AIROHA_MAX_NUM_XSI_RSTS,
+ eth->xsi_rsts.resets = devm_kcalloc(dev, data->num_xsi_rsts,
sizeof(struct reset_ctl), GFP_KERNEL);
if (!eth->xsi_rsts.resets)
return -ENOMEM;
- eth->xsi_rsts.count = AIROHA_MAX_NUM_XSI_RSTS;
+ eth->xsi_rsts.count = data->num_xsi_rsts;
ret = reset_get_by_name(dev, "fe", &eth->rsts.resets[0]);
if (ret)
@@ -765,21 +783,12 @@ static int airoha_eth_probe(struct udevice *dev)
if (ret)
return ret;
- ret = reset_get_by_name(dev, "hsi0-mac", &eth->xsi_rsts.resets[0]);
- if (ret)
- return ret;
-
- ret = reset_get_by_name(dev, "hsi1-mac", &eth->xsi_rsts.resets[1]);
- if (ret)
- return ret;
-
- ret = reset_get_by_name(dev, "hsi-mac", &eth->xsi_rsts.resets[2]);
- if (ret)
- return ret;
-
- ret = reset_get_by_name(dev, "xfp-mac", &eth->xsi_rsts.resets[3]);
- if (ret)
- return ret;
+ for (i = 0; i < data->num_xsi_rsts; i++) {
+ ret = reset_get_by_name(dev, data->xsi_rsts_names[i],
+ &eth->xsi_rsts.resets[i]);
+ if (ret)
+ return ret;
+ }
ret = airoha_hw_init(dev, eth);
if (ret)
@@ -973,8 +982,25 @@ static int arht_eth_write_hwaddr(struct udevice *dev)
return 0;
}
+static const struct airoha_eth_soc_data en7523_data = {
+ .xsi_rsts_names = en7523_xsi_rsts_names,
+ .num_xsi_rsts = ARRAY_SIZE(en7523_xsi_rsts_names),
+ .switch_compatible = "airoha,en7523-switch",
+};
+
+static const struct airoha_eth_soc_data en7581_data = {
+ .xsi_rsts_names = en7581_xsi_rsts_names,
+ .num_xsi_rsts = ARRAY_SIZE(en7581_xsi_rsts_names),
+ .switch_compatible = "airoha,en7581-switch",
+};
+
static const struct udevice_id airoha_eth_ids[] = {
- { .compatible = "airoha,en7581-eth" },
+ { .compatible = "airoha,en7523-eth",
+ .data = (ulong)&en7523_data,
+ },
+ { .compatible = "airoha,en7581-eth",
+ .data = (ulong)&en7581_data,
+ },
{ }
};