[ 8.388007] RAMDISK: image too big! (5484KiB/4096KiB)
WTF: The freaking default is still just 4MB. Can you remind me what year we have? Argh...
Voila, now we're talking.
BusyBox v1.34.1 (2022-01-09 11:08:07 UTC) built-in shell (ash)
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
OpenWrt SNAPSHOT, r18532-474df71bf0
-----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@(none):/# uname -a
Linux (none) 5.16.0-next-20220114-dirty #36 SMP PREEMPT Fri Jan 14 23:41:50 CET 2022 aarch64 GNU/Linux
root@(none):/#
Just gona have to integrate your switch reset now. Let's see...
Well, kind of, it's the switch property.
This will sort it out: mdio f212a200.mdio-mii 0x1c 0x1a 0x8200
Note that you gotta have the mdio-netlink/tools packaged until the driver is adapted to this as the default SMI pinctrl in it doesn't work for Amethyst
Then great, for me it still doesn't work with the QCA8081 driver at all.
With the generic one it does, weird.
Anyway, I would really like to get networking working in U-boot but gotta go watch some Youtube and sleep, traveling again tomorrow so I doubt that I will be working on RB5009
From 40aa82107e7b1e7f20cbf6e644005c0c606f9f79 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 14 Jan 2022 15:17:37 +0100
Subject: [PATCH] net: dsa: mv88e6xxx: add Amethyst specific SMI GPIO function
The existing mv88e6xxx_g2_scratch_gpio_set_smi() cannot be used on the
88E6393X as it requires certain P0_MODE, it also checks the CPU mode
as it impacts the bit setting value.
This is all irrelevant for Amethyst (MV88E6191X/6193X/6393X) as only
the default value of the SMI_PHY Config bit is set to CPU_MGD bootstrap
pin value but it can be changed without restrictions so that GPIO pins
9 and 10 are used as SMI pins.
So, introduce Amethyst specific function and call that if the Amethyst
family wants to setup the external PHY.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 5 +++-
drivers/net/dsa/mv88e6xxx/global2.h | 2 ++
drivers/net/dsa/mv88e6xxx/global2_scratch.c | 31 +++++++++++++++++++++
3 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 43d126628610..b3803101d612 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3409,7 +3409,10 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,
if (external) {
mv88e6xxx_reg_lock(chip);
- err = mv88e6xxx_g2_scratch_gpio_set_smi(chip, true);
+ if (chip->info->family == MV88E6XXX_FAMILY_6393)
+ err = mv88e6393x_g2_scratch_gpio_set_smi(chip, true);
+ else
+ err = mv88e6xxx_g2_scratch_gpio_set_smi(chip, true);
mv88e6xxx_reg_unlock(chip);
if (err)
diff --git a/drivers/net/dsa/mv88e6xxx/global2.h b/drivers/net/dsa/mv88e6xxx/global2.h
index f3e27573a386..e0649f21f28e 100644
--- a/drivers/net/dsa/mv88e6xxx/global2.h
+++ b/drivers/net/dsa/mv88e6xxx/global2.h
@@ -370,6 +370,8 @@ extern const struct mv88e6xxx_gpio_ops mv88e6352_gpio_ops;
int mv88e6xxx_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip,
bool external);
+int mv88e6393x_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip,
+ bool external);
int mv88e6xxx_g2_atu_stats_set(struct mv88e6xxx_chip *chip, u16 kind, u16 bin);
int mv88e6xxx_g2_atu_stats_get(struct mv88e6xxx_chip *chip, u16 *stats);
diff --git a/drivers/net/dsa/mv88e6xxx/global2_scratch.c b/drivers/net/dsa/mv88e6xxx/global2_scratch.c
index eda710062933..dc3f4645fa52 100644
--- a/drivers/net/dsa/mv88e6xxx/global2_scratch.c
+++ b/drivers/net/dsa/mv88e6xxx/global2_scratch.c
@@ -289,3 +289,34 @@ int mv88e6xxx_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip,
return mv88e6xxx_g2_scratch_write(chip, misc_cfg, val);
}
+
+/**
+ * mv88e6393x_g2_scratch_gpio_set_smi - set gpio muxing for external smi
+ * @chip: chip private data
+ * @external: set mux for external smi, or free for gpio usage
+ *
+ * MV88E6191X/6193X/6393X GPIO pins 9 and 10 can be configured as an
+ * external SMI interface or as regular GPIO-s.
+ *
+ * They however have a different register layout then the existing
+ * function.
+ */
+
+int mv88e6393x_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip,
+ bool external)
+{
+ int misc_cfg = MV88E6352_G2_SCRATCH_MISC_CFG;
+ int err;
+ u8 val;
+
+ err = mv88e6xxx_g2_scratch_read(chip, misc_cfg, &val);
+ if (err)
+ return err;
+
+ if (external)
+ val &= ~MV88E6352_G2_SCRATCH_MISC_CFG_NORMALSMI;
+ else
+ val |= MV88E6352_G2_SCRATCH_MISC_CFG_NORMALSMI;
+
+ return mv88e6xxx_g2_scratch_write(chip, misc_cfg, val);
+}
--
2.34.1
Gotta cleanup my OpenWrt tree a bit, its a mess now.
Anyway, off to sleep now
The switch itself after the reset works fine, but the LEDs pinout map is lost.
It looks like it is setuped by the RouterBoot at startup. We need to find out which register of the switch chip is responsible for this. What does your datasheet say about LEDs on this switch ?
It's not just the LED pinout, it lacks SMI pinctrl as CPU_MGD is set properly, so it means that the PHY-s are by default off as well and port 9 (The 2.5G one) has wrong C_MODE etc.
So, this is just the tip of what needs to be configured and that I found yesterday.
PHY and Serdes registers are separate datasheets with only 152 pages on top of the 714 of the switch datasheet.
It also looks like the SERDES is by default turned off on boot and to enable it you must use C45 via the internal MDIO.
This means that some kind of a switch driver is must-have for U-boot as well
Now the U-boot is driving me crazy.
I want to get the MDIO bus to automate the switch setup, but for whatever reason it will panic if mvmdio
is the returned uclass device.
If I request any other device, then it doesn't panic.
I found what was the reason for the non-working network in U-Boot. There, the driver(mvpp2) does not correctly initialize the MPCS and XPCS registers. Now I have achieved a stable start of the network. Later I will write what exactly needs to be changed in the U-Boot sources.
Awesome, thanks.
Can you just share the raw value so that I can work on the switch with working ethernet controller?
I will keep on working on the switch code.