Message ID | uz5k4wl4fka3rxoz2tkvpogiwblokbpo72p3sdjdbakwgfbwfi@bzxazuhkhbps (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | KSZ8795 fixes for v5.15 | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Guessing tree name failed - patch did not apply |
On Sat, Dec 07, 2024 at 09:44:46AM +0100, Jörg Sommer wrote: > Hi, > > it's me again with the KSZ8795 connected to TI_DAVINCI_EMAC. It works on > v5.10.227 and now, I try to get this working on v5.15 (and then later > versions). I found this patch [1] in the Microchip forum [2]. Someone put it > together to make this chip work with v5.15. I applies fine on v5.15.173 and > gets me to a point where the kernel detects the chip during boot. (It still > doesn't work, but it's better with this patch than without.) > > [1] https://forum.microchip.com/sfc/servlet.shepherd/document/download/0693l00000XiIt9AAF > [2] https://forum.microchip.com/s/topic/a5C3l000000MfQkEAK/t388621 > > The driver code was restructured in 9f73e1 which contained some mistakes. > These were fixed later with 4bdf79 (which is part of the patch), but was not > backported to v5.15 as a grep shows: > > $ git grep STATIC_MAC_TABLE_OVERRIDE'.*2[26]' v5.15.173 > v5.15.173:drivers/net/dsa/microchip/ksz8795.c:55: [STATIC_MAC_TABLE_OVERRIDE] = BIT(26), > $ git grep STATIC_MAC_TABLE_OVERRIDE'.*2[26]' v6.6.62 > v6.6.62:drivers/net/dsa/microchip/ksz_common.c:334: [STATIC_MAC_TABLE_OVERRIDE] = BIT(22), > > Can someone review this patch and apply it to the v5.15 branch? Hi Jörg Please see: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html Option 2. Andrew
Andrew Lunn schrieb am Sa 07. Dez, 21:58 (+0100): > On Sat, Dec 07, 2024 at 09:44:46AM +0100, Jörg Sommer wrote: > > Hi, > > > > it's me again with the KSZ8795 connected to TI_DAVINCI_EMAC. It works on > > v5.10.227 and now, I try to get this working on v5.15 (and then later > > versions). I found this patch [1] in the Microchip forum [2]. Someone put it > > together to make this chip work with v5.15. I applies fine on v5.15.173 and > > gets me to a point where the kernel detects the chip during boot. (It still > > doesn't work, but it's better with this patch than without.) > > > > [1] https://forum.microchip.com/sfc/servlet.shepherd/document/download/0693l00000XiIt9AAF > > [2] https://forum.microchip.com/s/topic/a5C3l000000MfQkEAK/t388621 > > > > The driver code was restructured in 9f73e1 which contained some mistakes. > > These were fixed later with 4bdf79 (which is part of the patch), but was not > > backported to v5.15 as a grep shows: > > > > $ git grep STATIC_MAC_TABLE_OVERRIDE'.*2[26]' v5.15.173 > > v5.15.173:drivers/net/dsa/microchip/ksz8795.c:55: [STATIC_MAC_TABLE_OVERRIDE] = BIT(26), > > $ git grep STATIC_MAC_TABLE_OVERRIDE'.*2[26]' v6.6.62 > > v6.6.62:drivers/net/dsa/microchip/ksz_common.c:334: [STATIC_MAC_TABLE_OVERRIDE] = BIT(22), > > > > Can someone review this patch and apply it to the v5.15 branch? > > Hi Jörg > > Please see: > > https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html > > Option 2. I didn't know everyone can request a backport. But, unfortunately, neither 4bdf79d686b49ac49373b36466acfb93972c7d7c from main, nor ce3ec3fc64e0e0f4d148cccba4e31246d50ec910 from v6.1 can be cherry-picked without big conflicts. I think I have to use Option 3 and send a new commit. Kind regards, Jörg
diff --git a/drivers/net/dsa/microchip/ksz8.h b/drivers/net/dsa/microchip/ksz8.h index 9d611895d3cf..bb98cc3d89f6 100644 --- a/drivers/net/dsa/microchip/ksz8.h +++ b/drivers/net/dsa/microchip/ksz8.h @@ -34,8 +34,10 @@ enum ksz_masks { VLAN_TABLE_MEMBERSHIP, VLAN_TABLE_VALID, STATIC_MAC_TABLE_VALID, - STATIC_MAC_TABLE_USE_FID, - STATIC_MAC_TABLE_FID, + STATIC_MAC_TABLE_USE_FID_R, + STATIC_MAC_TABLE_USE_FID_W, + STATIC_MAC_TABLE_FID_R, + STATIC_MAC_TABLE_FID_W, STATIC_MAC_TABLE_OVERRIDE, STATIC_MAC_TABLE_FWD_PORTS, DYNAMIC_MAC_TABLE_ENTRIES_H, @@ -51,7 +53,8 @@ enum ksz_shifts { VLAN_TABLE_MEMBERSHIP_S, VLAN_TABLE, STATIC_MAC_FWD_PORTS, - STATIC_MAC_FID, + STATIC_MAC_FID_R, + STATIC_MAC_FID_W, DYNAMIC_MAC_ENTRIES_H, DYNAMIC_MAC_ENTRIES, DYNAMIC_MAC_FID, diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c index c9c682352ac3..3c6fee9db038 100644 --- a/drivers/net/dsa/microchip/ksz8795.c +++ b/drivers/net/dsa/microchip/ksz8795.c @@ -50,10 +50,12 @@ static const u32 ksz8795_masks[] = { [VLAN_TABLE_MEMBERSHIP] = GENMASK(11, 7), [VLAN_TABLE_VALID] = BIT(12), [STATIC_MAC_TABLE_VALID] = BIT(21), - [STATIC_MAC_TABLE_USE_FID] = BIT(23), - [STATIC_MAC_TABLE_FID] = GENMASK(30, 24), - [STATIC_MAC_TABLE_OVERRIDE] = BIT(26), - [STATIC_MAC_TABLE_FWD_PORTS] = GENMASK(24, 20), + [STATIC_MAC_TABLE_USE_FID_R] = BIT(24), + [STATIC_MAC_TABLE_USE_FID_W] = BIT(23), + [STATIC_MAC_TABLE_FID_R] = GENMASK(31, 25), + [STATIC_MAC_TABLE_FID_W] = GENMASK(30, 24), + [STATIC_MAC_TABLE_OVERRIDE] = BIT(22), + [STATIC_MAC_TABLE_FWD_PORTS] = GENMASK(20, 16), [DYNAMIC_MAC_TABLE_ENTRIES_H] = GENMASK(6, 0), [DYNAMIC_MAC_TABLE_MAC_EMPTY] = BIT(8), [DYNAMIC_MAC_TABLE_NOT_READY] = BIT(7), @@ -67,7 +69,8 @@ static const u8 ksz8795_shifts[] = { [VLAN_TABLE_MEMBERSHIP_S] = 7, [VLAN_TABLE] = 16, [STATIC_MAC_FWD_PORTS] = 16, - [STATIC_MAC_FID] = 24, + [STATIC_MAC_FID_R] = 25, + [STATIC_MAC_FID_W] = 24, [DYNAMIC_MAC_ENTRIES_H] = 3, [DYNAMIC_MAC_ENTRIES] = 29, [DYNAMIC_MAC_FID] = 16, @@ -100,8 +103,10 @@ static const u32 ksz8863_masks[] = { [VLAN_TABLE_MEMBERSHIP] = GENMASK(18, 16), [VLAN_TABLE_VALID] = BIT(19), [STATIC_MAC_TABLE_VALID] = BIT(19), - [STATIC_MAC_TABLE_USE_FID] = BIT(21), - [STATIC_MAC_TABLE_FID] = GENMASK(29, 26), + [STATIC_MAC_TABLE_USE_FID_R] = BIT(21), + [STATIC_MAC_TABLE_USE_FID_W] = BIT(21), + [STATIC_MAC_TABLE_FID_R] = GENMASK(25, 22), + [STATIC_MAC_TABLE_FID_W] = GENMASK(25, 22), [STATIC_MAC_TABLE_OVERRIDE] = BIT(20), [STATIC_MAC_TABLE_FWD_PORTS] = GENMASK(18, 16), [DYNAMIC_MAC_TABLE_ENTRIES_H] = GENMASK(5, 0), @@ -116,7 +121,8 @@ static const u32 ksz8863_masks[] = { static u8 ksz8863_shifts[] = { [VLAN_TABLE_MEMBERSHIP_S] = 16, [STATIC_MAC_FWD_PORTS] = 16, - [STATIC_MAC_FID] = 22, + [STATIC_MAC_FID_R] = 22, + [STATIC_MAC_FID_W] = 22, [DYNAMIC_MAC_ENTRIES_H] = 3, [DYNAMIC_MAC_ENTRIES] = 24, [DYNAMIC_MAC_FID] = 16, @@ -604,9 +610,9 @@ static int ksz8_r_sta_mac_table(struct ksz_device *dev, u16 addr, data_hi >>= 1; alu->is_static = true; alu->is_use_fid = - (data_hi & masks[STATIC_MAC_TABLE_USE_FID]) ? 1 : 0; - alu->fid = (data_hi & masks[STATIC_MAC_TABLE_FID]) >> - shifts[STATIC_MAC_FID]; + (data_hi & masks[STATIC_MAC_TABLE_USE_FID_R]) ? 1 : 0; + alu->fid = (data_hi & masks[STATIC_MAC_TABLE_FID_R]) >> + shifts[STATIC_MAC_FID_R]; return 0; } return -ENXIO; @@ -633,8 +639,8 @@ static void ksz8_w_sta_mac_table(struct ksz_device *dev, u16 addr, if (alu->is_override) data_hi |= masks[STATIC_MAC_TABLE_OVERRIDE]; if (alu->is_use_fid) { - data_hi |= masks[STATIC_MAC_TABLE_USE_FID]; - data_hi |= (u32)alu->fid << shifts[STATIC_MAC_FID]; + data_hi |= masks[STATIC_MAC_TABLE_USE_FID_W]; + data_hi |= ((u32)alu->fid << shifts[STATIC_MAC_FID_W]) & masks[STATIC_MAC_TABLE_FID_W]; } if (alu->is_static) data_hi |= masks[STATIC_MAC_TABLE_VALID];