‎2021-09-22 12:14 AM
Hi,
we have designed a custom board, based on STM32MP151 and OpenSTLinux 5.10. On this board we use the switch NXP SJA1105S with 3 phys and a MAC-MAC interface between the MPU and the switch. All ports are configured for RGMII mode. At startup(via modprobe) the SJA1105 driver tries to load a default configuration that assigns multiple vlan ids to the ports. Unfortunately it looks like, that the stm32-dwmac driver does not support this by default, because it outputs the message "Only single VLAN ID supported". Is there a possibility to change this behavior of the stm32-dwmac driver?
Example Output:
[ 80.801160] sja1105 spi2.0: Probed switch chip: SJA1105S
[ 80.934971] sja1105 spi2.0: Updating VLAN 1025
[ 80.943584] sja1105 spi2.0: Updating VLAN 1025
[ 80.952858] sja1105 spi2.0: Updating VLAN 1025
[ 80.961709] sja1105 spi2.0: Updating VLAN 1025
[ 80.967525] sja1105 spi2.0: Updating VLAN 1025
[ 80.977959] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
[ 80.983877] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
[ 80.995737] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
[ 81.004256] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
[ 81.012844] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
[ 81.021277] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
[ 81.030518] sja1105 spi2.0: Updating VLAN 2049
[ 81.039485] sja1105 spi2.0: Updating VLAN 2049
[ 81.048265] sja1105 spi2.0: Updating VLAN 1026
[ 81.057550] sja1105 spi2.0: Updating VLAN 1026
[ 81.066966] sja1105 spi2.0: Updating VLAN 1026
[ 81.076340] sja1105 spi2.0: Updating VLAN 1026
[ 81.085989] sja1105 spi2.0: Updating VLAN 1026
[ 81.091785] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
[ 81.102420] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
[ 81.110977] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
[ 81.119447] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
[ 81.127888] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
[ 81.136362] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
[ 81.144868] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
[ 81.153432] stm32-dwmac 5800a000.ethernet eth0: Only single VLAN ID supported
...
Thanks a lot and best regards
Solved! Go to Solution.
‎2021-10-15 12:34 AM
Hi,
The cause of the problems was an incompatibility between the SJA1105 DSA driver and the MAC driver from ST. We are now using this a bit older driver and were able to put the switch into operation.
Thank you and best regards
choll
‎2021-09-24 09:03 AM
Hello CHoll.2 (Community Member)
I am no VLAN expert, but do you actually need to allocate one VLAN on each port of the NXP switch in your application?
This comes from the fact that in drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
/* Single Rx VLAN Filter */
if (hw->num_vlan == 1) {
/* For single VLAN filter, VID 0 means VLAN promiscuous */
if (vid == 0) {
netdev_warn(dev, "Adding VLAN ID 0 is not supported\n");
return -EPERM;
}
if (hw->vlan_filter[0] & GMAC_VLAN_TAG_VID) {
netdev_err(dev, "Only single VLAN ID supported\n");
Several options are possible, increase the number of num_vlan, disable the VLAN filtering, or do not let the switch to allocate one VLAN per port.
In the linux menuconfig some options could be twicked regarding VLAN filtering or regarding the NXP SJA1105.
https://wiki.st.com/stm32mpu/wiki/Menuconfig_or_how_to_configure_kernel
Regards,
Olivier
‎2021-09-27 01:05 AM
Good morning OlivierK,
thank you for your answer, it brought me a step further.:grinning_face: Your solution approaches sound comprehensible. If I want to increase the number of num_vlan, how should I proceed? Is there a property in the device tree, a option in Linux menuconfig or do I need to modify the source code of the stmmac driver?
Best regards
CHoll.2
‎2021-09-27 10:57 AM
Hi CHoll.2 (Community Member)
First of all, make sure the several occurences of VLAN config are enabled as built-in or as module in the linux menuconfig.
You may also try to disable the VLAN filtering (in menuconfig) to get rid of the VLAN ID support msg.
VLAN configuration seems not only related to the stmmac driver nor the device tree, but rather an ethernet network commands as I could read on the net.
Ethtool might help in reporting VLAN settings of Eth0
https://wiki.st.com/stm32mpu/wiki/Ethtool
Best Regards,
Olivier
‎2021-09-29 06:28 AM
Hi Olivier,
I tried to consider your comments. In menuconfig I have already enabled all VLAN related options. Unfortunately I can not either disable the VLAN filtering options in menuconfig, because the driver of the SJA1105 switch depends on it.
The command ethtool -k eth0 gives me the following VLAN related output:
rx-vlan-offload: on [fixed]
tx-vlan-offload: on [fixed]
rx-vlan-filter: on [fixed]
vlan-challenged: off [fixed]
tx-vlan-stag-hw-insert: on [fixed]
rx-vlan-stag-hw-parse: on [fixed]
rx-vlan-stag-filter: on [fixed]
As you can see, almost all VLAN settings are enabled and I am not able to disable any of them.
After all, by further debugging I can confirm, that num_vlan never becomes greater than 1 in the dwmac4-driver. :worried_face:
At the end, this is my current network-related device tree, maybe it will help to get a deeper insight.
ðernet0{
pinctrl-names = "default", "sleep";
pinctrl-0 = <ð1_pins_mx>;
pinctrl-1 = <ð1_sleep_pins_mx>;
status = "okay";
/* USER CODE BEGIN ethernet0 */
st,eth-clk-sel;
phy-connection-type = "rgmii-txid";
fixed-link {
speed = <1000>;
full-duplex;
};
mdio0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "snps,dwmac-mdio";
rgmii_phy5: ethernet-phy@5 {
compatible = "ethernet-phy-id2000.a284", "ethernet-phy-ieee802.3-c22";
reg = <5>;
};
rgmii_phy4: ethernet-phy@4 {
compatible = "ethernet-phy-id2000.a284", "ethernet-phy-ieee802.3-c22";
reg = <4>;
};
rgmii_phy0: ethernet-phy@0 {
rx-internal-delay-ps = <2000>;
tx-internal-delay-ps = <2000>;
reg = <0>;
};
};
....
&spi4{
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi4_pins_mx>;
pinctrl-1 = <&spi4_sleep_pins_mx>;
status = "okay";
/* USER CODE BEGIN spi4 */
cs-gpios = <&gpiob 12 GPIO_ACTIVE_LOW>,
<&gpiof 15 GPIO_ACTIVE_LOW>;
sja1105@0 {
compatible = "nxp,sja1105s";
reg = <0>;
spi-max-frequency = <16000000>;/* max 24 MHz according to the data sheet */
#address-cells = <1>;
#size-cells = <0>;
fsl,spi-cs-sck-delay = <1000>;
fsl,spi-sck-cs-delay = <1000>;
spi-cpha;
status = "okay";
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
label = "cpu";
ethernet = <ðernet0>;
phy-mode = "rgmii-rxid"; /* no PCB serpentine traces on the board */
reg = <0>;
/* Implicit "sja1105,role-phy;" */
fixed-link {
speed = <1000>;
full-duplex;
};
};
port@1 {
label = "swp1";
phy-handle = <&rgmii_phy5>;
phy-mode = "rgmii-id";
reg = <1>;
/* Implicit "sja1105,role-mac;" */
};
port@2 {
label = "swp2";
phy-handle = <&rgmii_phy4>;
phy-mode = "rgmii-id";
reg = <2>;
/* Implicit "sja1105,role-mac;" */
};
port@3 {
label = "swp3";
phy-handle = <&rgmii_phy0>;
phy-mode = "rgmii-rxid";
reg = <3>;
/* Implicit "sja1105,role-mac;" */
};
port@4 {
label = "swp4";
phy-mode = "rgmii-id";
sja1105,role-mac;
reg = <4>;
fixed-link {
speed = <1000>;
full-duplex;
};
/* this port is unused*/
};
};
};
fram: cy15v102qn@1 {
compatible = "jedec,spi-nor";
reg = <1>;
spi-max-frequency = <32000000>;
#address-cells = <1>;
#size-cells = <1>;
m25p,fast-read;
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "spi-fram";
reg = <0x0 0x40000>; /* 2 Mbit => 256k * 8 => 262144 * 8 */
};
};
};
/* USER CODE END spi4 */
};
Thank you and best regards,
Choll.2
‎2021-10-15 12:34 AM
Hi,
The cause of the problems was an incompatibility between the SJA1105 DSA driver and the MAC driver from ST. We are now using this a bit older driver and were able to put the switch into operation.
Thank you and best regards
choll
‎2021-10-15 05:06 AM
Hi CHoll.2.
Thank you for the update, we were about to dig into the subject internally. So we will close the case.
Best Regards,
Olivier