Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On 7 April 2011 12:04, Peter Lebbing pe...@digitalbrains.com wrote: Any chance that you can get a datasheet for the FC chip? It would help implementing FC functionality a lot. I can ask them, but I doubt it. For what they care, I am not much more than a random guy on the internet ;-) Also since I don't have access to either device, I won't be able to do much more than giving advice (and I seriously doubt they will allow me to pass on the datasheet even if I get it). Jonas ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
Hi Jonas, On 06/04/11 13:34, Jonas Gorski wrote: On 5 April 2011 14:00, Jonas Gorski jonas.gorski+open...@gmail.com wrote: Probably you should dump the (default) register values of the FC and the M and compare them and try to find a difference (best if it's some RO register). Good candidates are the Queue Weight/IGMP registers 0x25 to 0x27 - The bits 12 to 15 are read only on the FC, but writable on the M, so a test if they can be modified should tell whether it's a FC. Also the registers default to 0x2000/4000/8000 on the FC, while the default on the M is 0x1000 for all three. Thank you! Now we're really getting somewhere! I must say: they can create 4 billion Chip Identifiers in a 32-bit ID, did ADMtek /really/ have to use the same ID for the two chips? ;) Any chance that you can get a datasheet for the FC chip? It would help implementing FC functionality a lot. Peter. -- I use the GNU Privacy Guard (GnuPG) in combination with Enigmail. You can send me encrypted mail if you want some privacy. My key is available at http://wwwhome.cs.utwente.nl/~lebbing/pubkey.txt ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On 5 April 2011 14:00, Jonas Gorski jonas.gorski+open...@gmail.com wrote: I talked with the Lantiq guys, and they said there should be differences in the default reset values of some registers, so only indirect hints. Probably you should dump the (default) register values of the FC and the M and compare them and try to find a difference (best if it's some RO register). Good candidates are the Queue Weight/IGMP registers 0x25 to 0x27 - The bits 12 to 15 are read only on the FC, but writable on the M, so a test if they can be modified should tell whether it's a FC. Also the registers default to 0x2000/4000/8000 on the FC, while the default on the M is 0x1000 for all three. Regards Jonas ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
Hi, On 3 April 2011 15:28, Peter Lebbing pe...@digitalbrains.com wrote: Yeah, that's the whole problem. If I look at the datasheets I can find about the F model, it would seem the chip identification will not match at all. In practice, it turns out people with a chip labeled as FC have a register set very similar to what is in the M datasheet, *including* Chip Identification on A0h/A1h with value 0007:1023h! Read the thread for more details and a good deal of confusion. I talked with the Lantiq guys, and they said there should be differences in the default reset values of some registers, so only indirect hints. Probably you should dump the (default) register values of the FC and the M and compare them and try to find a difference (best if it's some RO register). Regards Jonas ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
Hi Jonas, yes, we are trying to find out the needed info. i will start by setting up a testbed today for the I version to get to know the codebase and then move on to find out the info we are missing. John @John: Since the ADM6996FC and -M are still marketed by Lantiq, perhaps you can shed some light on this? Jonas ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
could oyu resent the all in one patch to the list so patchwork grabs the full version, currently only the fix is listed in patchwork A new version of the patch. Please note it is a patch on latest backfire. The patch should apply to trunk, but the directory generic-2.6 was renamed to generic! This driver implements support for 802.1Q VLANs. It is written for the ADM6996M switch chip, but there are currently problems with the chip detection. It also triggers on other ADM6996 models, and before this patch can be committed, it needs to be figured out how to avoid people getting a driver autoloaded that is not suitable for their switch hardware. Please see the mailing list thread that starts at https://lists.openwrt.org/pipermail/openwrt-devel/2011-January/009100.html for details. Changes compared to the original patch submission: - mutex handling bugfix patch incorporated - Kconfig now declares the dependency on SWCONFIG - Added copyright message to adm6996.h - Added myself to MODULE_AUTHOR Signed-off-by: Peter Lebbing pe...@digitalbrains.com --- files/drivers/net/phy/adm6996.c | 497 +-- files/drivers/net/phy/adm6996.h | 56 +++ patches-2.6.32/620-phy_adm6996.patch |3 3 files changed, 536 insertions(+), 20 deletions(-) Index: backfire/target/linux/generic-2.6/files/drivers/net/phy/adm6996.c === --- backfire/target/linux/generic-2.6/files/drivers/net/phy/adm6996.c (revision 26437) +++ backfire/target/linux/generic-2.6/files/drivers/net/phy/adm6996.c (working copy) @@ -1,12 +1,18 @@ /* * ADM6996 switch driver * + * swconfig interface based on ar8216.c + * * Copyright (c) 2008 Felix Fietkau n...@openwrt.org + * VLAN support Copyright (c) 2010, 2011 Peter Lebbing pe...@digitalbrains.com * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License v2 as published by the * Free Software Foundation */ + +/*#define DEBUG 1 */ + #include linux/kernel.h #include linux/string.h #include linux/errno.h @@ -24,6 +30,7 @@ #include linux/mii.h #include linux/ethtool.h #include linux/phy.h +#include linux/switch.h #include asm/io.h #include asm/irq.h @@ -31,28 +38,46 @@ #include adm6996.h MODULE_DESCRIPTION(Infineon ADM6996 Switch); -MODULE_AUTHOR(Felix Fietkau); +MODULE_AUTHOR(Felix Fietkau, Peter Lebbing pe...@digitalbrains.com); MODULE_LICENSE(GPL); struct adm6996_priv { + struct switch_dev dev; + struct phy_device *phydev; + + bool enable_vlan; + bool vlan_enabled; /* Current hardware state */ + +#ifdef DEBUG + u16 addr; /* Debugging: register address to operate on */ +#endif + + u16 pvid[ADM_PHY_PORTS];/* Primary VLAN ID */ + + u16 vlan_id[ADM_NUM_VLANS]; + u8 vlan_table[ADM_NUM_VLANS]; /* bitmap, 1 = port is member */ + u8 vlan_tagged[ADM_NUM_VLANS]; /* bitmap, 1 = tagged member */ + + struct mutex reg_mutex; + /* use abstraction for regops, we want to add gpio support in the future */ u16 (*read)(struct phy_device *phydev, enum admreg reg); void (*write)(struct phy_device *phydev, enum admreg reg, u16 val); }; -#define to_adm(_phy) ((struct adm6996_priv *) (_phy)-priv) +#define to_adm(_dev) container_of(_dev, struct adm6996_priv, dev) +#define phy_to_adm(_phy) ((struct adm6996_priv *) (_phy)-priv) - static inline u16 r16(struct phy_device *pdev, enum admreg reg) { - return to_adm(pdev)-read(pdev, reg); + return phy_to_adm(pdev)-read(pdev, reg); } static inline void w16(struct phy_device *pdev, enum admreg reg, u16 val) { - to_adm(pdev)-write(pdev, reg, val); + phy_to_adm(pdev)-write(pdev, reg, val); } @@ -68,27 +93,474 @@ phydev-bus-write(phydev-bus, PHYADDR(reg), val); } +static int +adm6996_set_enable_vlan(struct switch_dev *dev, const struct switch_attr *attr, + struct switch_val *val) +{ + struct adm6996_priv *priv = to_adm(dev); -static int adm6996_config_init(struct phy_device *pdev) + if (val-value.i 1) + return -EINVAL; + + priv-enable_vlan = val-value.i; + + return 0; +}; + +static int +adm6996_get_enable_vlan(struct switch_dev *dev, const struct switch_attr *attr, + struct switch_val *val) { + struct adm6996_priv *priv = to_adm(dev); + + val-value.i = priv-enable_vlan; + + return 0; +}; + +#ifdef DEBUG + +static int +adm6996_set_addr(struct switch_dev *dev, const struct switch_attr *attr, +struct switch_val *val) +{ + struct adm6996_priv *priv = to_adm(dev); + + if (val-value.i 1023) + return -EINVAL; + + priv-addr = val-value.i; + + return 0; +}; + +static int +adm6996_get_addr(struct switch_dev *dev, const struct switch_attr *attr, +
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On 3 April 2011 14:16, Peter Lebbing pe...@digitalbrains.com wrote: This driver implements support for 802.1Q VLANs. It is written for the ADM6996M switch chip, but there are currently problems with the chip detection. It also triggers on other ADM6996 models, and before this patch can be committed, it needs to be figured out how to avoid people getting a driver autoloaded that is not suitable for their switch hardware. Looking at the datasheet, the chip seems to have Chip ID registers at A0/A1 (p. 161). You can try to read them in the adm6996_probe and use them to verify the chip is an ADM6996M (or do chip identification based on them). At least the ADM6996F datasheet has a different content in its Chip ID register (assuming the 32bit register at 0x00 corresponds to the two 16 bit registers). Jonas ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
Hi, On 03/04/11 14:37, Jonas Gorski wrote: Looking at the datasheet, the chip seems to have Chip ID registers at A0/A1 (p. 161). You can try to read them in the adm6996_probe and use them to verify the chip is an ADM6996M (or do chip identification based on them). At least the ADM6996F datasheet has a different content in its Chip ID register (assuming the 32bit register at 0x00 corresponds to the two 16 bit registers). Yeah, that's the whole problem. If I look at the datasheets I can find about the F model, it would seem the chip identification will not match at all. In practice, it turns out people with a chip labeled as FC have a register set very similar to what is in the M datasheet, *including* Chip Identification on A0h/A1h with value 0007:1023h! Read the thread for more details and a good deal of confusion. The Chip ID is read in the _fixup routine, because it is a non-standard method of identification. Normally, PHYs are identified differently. By the way, I didn't write the chip detection. Ironically, it was written to match the F model :). Peter. -- I use the GNU Privacy Guard (GnuPG) in combination with Enigmail. You can send me encrypted mail if you want some privacy. My key is available at http://wwwhome.cs.utwente.nl/~lebbing/pubkey.txt ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On 3 April 2011 15:28, Peter Lebbing pe...@digitalbrains.com wrote: Hi, On 03/04/11 14:37, Jonas Gorski wrote: Looking at the datasheet, the chip seems to have Chip ID registers at A0/A1 (p. 161). You can try to read them in the adm6996_probe and use them to verify the chip is an ADM6996M (or do chip identification based on them). At least the ADM6996F datasheet has a different content in its Chip ID register (assuming the 32bit register at 0x00 corresponds to the two 16 bit registers). Yeah, that's the whole problem. If I look at the datasheets I can find about the F model, it would seem the chip identification will not match at all. In practice, it turns out people with a chip labeled as FC have a register set very similar to what is in the M datasheet, *including* Chip Identification on A0h/A1h with value 0007:1023h! Read the thread for more details and a good deal of confusion. The Chip ID is read in the _fixup routine, because it is a non-standard method of identification. Normally, PHYs are identified differently. By the way, I didn't write the chip detection. Ironically, it was written to match the F model :). Ah, I begin to recall (I read the old thread then, but forgot most of it). @John: Since the ADM6996FC and -M are still marketed by Lantiq, perhaps you can shed some light on this? Jonas ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
I suppose we need to figure out this chip identification/detection before the patch can be accepted. So, David: - Have you tried using the driver, the VLANs? Did it happen to work, did it fail catastrophically, dit it just do nothing? :) - Could you perhaps compile the ADM6996 driver with #define DEBUG 1, and run the attached script on your device. It dumps all the MDIO-accessible registers. I'd like to see what it is like on your device. Especially because of the Chip Identifier register, which the driver tries to use to determine if a compatible chip is attached. Perhaps I will even recognise some registers by their initial value. Thanks, Peter. -- I use the GNU Privacy Guard (GnuPG) in combination with Enigmail. You can send me encrypted mail if you want some privacy. My key is available at http://wwwhome.cs.utwente.nl/~lebbing/pubkey.txt (new, larger key created on Nov 12, 2009) #!/bin/sh echo -n regs for x in $(seq 0 1023); do swconfig dev eth0 set addr $x echo $x $(swconfig dev eth0 get data) regs done ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On 11/01/11 14:30, David Goodenough wrote: OK, so does your code check to see if this is an M, or do we need to add that? Do you think we should have two different drivers, one for the M the other for the F and L, or can we interweave the code? The detection and initialization part of the driver was already written, by Felix Fietkau. Since the M is a completely different chip than the F and L models, it only detects the M model, using the Chip Identification registers. I don't see any reason to interweave code for the M and the F. I see plenty of reason not to. They are wholly different. They deserve spearate drivers. Like I said, seems pretty much the only thing they have in common is part of the name of the chip. Peter. -- I use the GNU Privacy Guard (GnuPG) in combination with Enigmail. You can send me encrypted mail if you want some privacy. My key is available at http://wwwhome.cs.utwente.nl/~lebbing/pubkey.txt (new, larger key created on Nov 12, 2009) ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On Wednesday 12 January 2011, Peter Lebbing wrote: On 11/01/11 14:30, David Goodenough wrote: OK, so does your code check to see if this is an M, or do we need to add that? Do you think we should have two different drivers, one for the M the other for the F and L, or can we interweave the code? The detection and initialization part of the driver was already written, by Felix Fietkau. Since the M is a completely different chip than the F and L models, it only detects the M model, using the Chip Identification registers. I don't see any reason to interweave code for the M and the F. I see plenty of reason not to. They are wholly different. They deserve spearate drivers. Like I said, seems pretty much the only thing they have in common is part of the name of the chip. Peter. The odd thing is that the current code (before your patch) detects my ADM6996FC. It does not do much with it, but it detects it. Given that they are do different, perhaps your driver should be named as the adm6996m.c rather than just adm6996.c, and then we can have an adm6996fl.c for the F, FC and L versions. David ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On 12/01/11 13:19, David Goodenough wrote: The odd thing is that the current code (before your patch) detects my ADM6996FC. It does not do much with it, but it detects it. That is very odd indeed. I did not change the detection. Are you sure it is my patch that changes the behaviour, and not some other change? For instance, with backfire 10.03, the MAC driver used by the D-Link DSL-G624T, cpmac.c, would not detect the switch chip at all. In backfire SVN, this has changed; it is now detected correctly. So I basically have it the other way round if I don't patch anything but go from stable to backfire SVN. Given that they are do different, perhaps your driver should be named as the adm6996m.c rather than just adm6996.c, and then we can have an adm6996fl.c for the F, FC and L versions. I agree. But the detection code of adm6996.c (named as such) looks for Chip Identification registers that *are* mentioned in the datasheet for the M model, and very much *are not* in the datasheet for the F and L models. And I didn't write the detection nor name the file. Are you sure it is adm6996.c that detects your FC? It seems so odd to me, looking at the datasheets. Perhaps you could add some debug print statements to adm6996.c in the chip detection code to see what it reads and writes from the chip. Peter. -- I use the GNU Privacy Guard (GnuPG) in combination with Enigmail. You can send me encrypted mail if you want some privacy. My key is available at http://wwwhome.cs.utwente.nl/~lebbing/pubkey.txt (new, larger key created on Nov 12, 2009) ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On Wednesday 12 January 2011, Peter Lebbing wrote: On 12/01/11 13:19, David Goodenough wrote: The odd thing is that the current code (before your patch) detects my ADM6996FC. It does not do much with it, but it detects it. That is very odd indeed. I did not change the detection. Are you sure it is my patch that changes the behaviour, and not some other change? No, my point was that the code always has detected my FC, your code does not change that. For instance, with backfire 10.03, the MAC driver used by the D-Link DSL-G624T, cpmac.c, would not detect the switch chip at all. In backfire SVN, this has changed; it is now detected correctly. So I basically have it the other way round if I don't patch anything but go from stable to backfire SVN. Given that they are do different, perhaps your driver should be named as the adm6996m.c rather than just adm6996.c, and then we can have an adm6996fl.c for the F, FC and L versions. I agree. But the detection code of adm6996.c (named as such) looks for Chip Identification registers that *are* mentioned in the datasheet for the M model, and very much *are not* in the datasheet for the F and L models. And I didn't write the detection nor name the file. Are you sure it is adm6996.c that detects your FC? It seems so odd to me, looking at the datasheets. Perhaps you could add some debug print statements to adm6996.c in the chip detection code to see what it reads and writes from the chip. Well adm6996.c is the only code that I could find that puts out a syslog entry saying it has found an ADM6996 PHY. I am in the middle of another project at the moment, so it will be a few days before I can do any experiments, but I will try over the weekend. David Peter. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On 12/01/11 13:43, David Goodenough wrote: On Wednesday 12 January 2011, Peter Lebbing wrote: On 12/01/11 13:19, David Goodenough wrote: Given that they are do different, perhaps your driver should be named as the adm6996m.c rather than just adm6996.c, and then we can have an adm6996fl.c for the F, FC and L versions. I agree. But the detection code of adm6996.c (named as such) looks for Chip Identification registers that *are* mentioned in the datasheet for the M model, and very much *are not* in the datasheet for the F and L models. And I didn't write the detection nor name the file. Are you sure it is adm6996.c that detects your FC? It seems so odd to me, looking at the datasheets. Perhaps you could add some debug print statements to adm6996.c in the chip detection code to see what it reads and writes from the chip. Well adm6996.c is the only code that I could find that puts out a syslog entry saying it has found an ADM6996 PHY. Yeah, and I see the Kconfig says: config ADM6996_PHY tristate Driver for ADM6996 switches ---help--- Currently supports the ADM6996F switch I'm thinking there's something odd going on here with regard to datasheets. I added Felix Fietkau to the recipients of this message, since he wrote the detection code in adm6996.c. Felix, if I look at the datasheet for the ADM6996F [1], in particular the register descriptions, I don't see the code in adm6996_fixup() matching on that chip. Instead, it matches the datasheet for the ADM6996M/MX [2], with the Chip ID registers at register addresses 0xA0 and 0xA1. I used [2] to implement the VLAN stuff and it works on the ADM6996M. I don't have an F model. Still, the Kconfig says adm6996.c works for the F model. I'm thinking I have the wrong datasheet for the F model. Could you give a pointer to the documentation you used, or possibly help out otherwise in this confusion? Peter. [1] http://www.datasheetcatalog.org/datasheets2/21/2150254_1.pdf [2] http://media.digikey.com/PDF/Data%20Sheets/Infineon%20PDFs/Samurai%206M,MX,%20ADM6996M,MX.pdf -- I use the GNU Privacy Guard (GnuPG) in combination with Enigmail. You can send me encrypted mail if you want some privacy. My key is available at http://wwwhome.cs.utwente.nl/~lebbing/pubkey.txt (new, larger key created on Nov 12, 2009) ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On 10/01/11 20:32, David Goodenough wrote: Perhaps I should restate my question, that is unclear. Are there any register values or other way programatically to tell which of the ADM6996 chips is being used as the PHY on a particular system? ADM6996F and ADM6996M are very different. The M is programmed through the MDIO interface that is also used by regular Ethernet PHYs. It occupies the whole address space, though. Normally, there is 5 bits adressing a particular PHY and 5 bits addressing a register in that PHY. The ADM6996M has a 10-bit register address, which is split between the normal two 5-bit addresses. The M has two chip identifier registers, Chip Identifier 0 and Chip Identifier 1, at addresses 0xA0 and 0xA1 respectively. The lowest four bits of identifier 0 are a version number; 0x3 in the datasheet. The higher bits are a product code, 0x102. Chip Identifier 1 reads back as 0x0007. The ADM6996F and ADM6996L are accessed through an SPI interface, it seems, the same bus where the serial config EEPROM is located. I'm not 100% sure of the protocol used to access the switch chip from the CPU, the datasheet isn't very definitive on this, and I do not have equipment with that chip. But the chips don't seem to have an MDIO interface, so that's a very obvious identifying difference. Anyway, at register address 0 the F and L have a Chip Identifier Register. The lowest 4 bits is a version number. The whole register is specified as 0x00071010 for both F and L (!). The M is obviously more advanced that the F and L. Programmatically, the F and L might even be the same. But the difference between the M on the one side and F and L on the other is very large. The only thing they seem to have in common is the chip name. So I'm sorry, but the driver I wrote will not work even one bit for the F and L chips. Peter. -- I use the GNU Privacy Guard (GnuPG) in combination with Enigmail. You can send me encrypted mail if you want some privacy. My key is available at http://wwwhome.cs.utwente.nl/~lebbing/pubkey.txt (new, larger key created on Nov 12, 2009) ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On 11/01/11 12:49, Peter Lebbing wrote: The ADM6996F and ADM6996L are accessed through an SPI interface, it seems, the same bus where the serial config EEPROM is located. I'm not 100% sure of the protocol used to access the switch chip from the CPU, the datasheet isn't very definitive on this, and I do not have equipment with that chip. Scratch that. The specification of the management bus comes after the register description in the datasheet, not before :). I just noticed that. It *is* a sort of MDIO, sorry about that. But they send 32 bits of data instead of the regular 16 of MDIO. Anyway, identification of the F and L chips is at PHY address 0, register 0, and is 0x00071010 as I said. But because they send 32 databits instead of 16, I'm not sure what you would actually see if you just search the MDIO bus from your MAC. Still, it's completely different from the chip ID of the ADM6996M. Peter. -- I use the GNU Privacy Guard (GnuPG) in combination with Enigmail. You can send me encrypted mail if you want some privacy. My key is available at http://wwwhome.cs.utwente.nl/~lebbing/pubkey.txt (new, larger key created on Nov 12, 2009) ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On Tuesday 11 January 2011, Peter Lebbing wrote: On 11/01/11 12:49, Peter Lebbing wrote: The ADM6996F and ADM6996L are accessed through an SPI interface, it seems, the same bus where the serial config EEPROM is located. I'm not 100% sure of the protocol used to access the switch chip from the CPU, the datasheet isn't very definitive on this, and I do not have equipment with that chip. Scratch that. The specification of the management bus comes after the register description in the datasheet, not before :). I just noticed that. It *is* a sort of MDIO, sorry about that. But they send 32 bits of data instead of the regular 16 of MDIO. Anyway, identification of the F and L chips is at PHY address 0, register 0, and is 0x00071010 as I said. But because they send 32 databits instead of 16, I'm not sure what you would actually see if you just search the MDIO bus from your MAC. Still, it's completely different from the chip ID of the ADM6996M. Peter. OK, so does your code check to see if this is an M, or do we need to add that? Do you think we should have two different drivers, one for the M the other for the F and L, or can we interweave the code? David ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On -10/01/37 20:59, David Goodenough wrote: http://wwwhome.cs.utwente.nl/~lebbing/Samurai%206M,MX,%20ADM6996M,MX.pdf Can I ask where you got this datasheet. The only ones I have managed to find are only viewable through a dreadful web interface. In particular do you know if there is an ADM6996F (mine is actually an FC) datasheet anywhere? It turned up in a web search. Don't know the particulars anymore. But a trick I learned from a friend is to google for part name vcc, without quotes. Because datasheets often mention a supply voltage with the symbol vcc. It often helps to narrow down the list of results quickly. In fact, I think a good datasheet for the ADM6996F is: http://www.datasheetcatalog.org/datasheets2/21/2150254_1.pdf It's actually the first result from https://encrypted.google.com/search?q=adm6996f+vcc I can easily tell it's not compatible with the 6996M with regard to the VLANs, though. Interestingly, the datasheet for the F doesn't mention the FC model, but the datasheet for the M/MX does: 3.5 The Hardware Difference between ADM6996M/MX and ADM6996F ADM6996FC is a power-down version to replace ADM6996F and ADM6996M/MX is advanced function version for new applications. Good luck! Peter. -- I use the GNU Privacy Guard (GnuPG) in combination with Enigmail. You can send me encrypted mail if you want some privacy. My key is available at http://wwwhome.cs.utwente.nl/~lebbing/pubkey.txt (new, larger key created on Nov 12, 2009) ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
Peter Lebbing peter at digitalbrains.com writes: It turned up in a web search. Don't know the particulars anymore. But a trick I learned from a friend is to google for part name vcc, without quotes. Because datasheets often mention a supply voltage with the symbol vcc. It often helps to narrow down the list of results quickly. I'm more interested in the ADM6996L: http://pdf.pfind.ru/A/ADM6996L.pdf It's used in more devices. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On Monday 10 January 2011, Peter Lebbing wrote: On -10/01/37 20:59, David Goodenough wrote: http://wwwhome.cs.utwente.nl/~lebbing/Samurai%206M,MX,%20ADM6996M,MX.pd f Can I ask where you got this datasheet. The only ones I have managed to find are only viewable through a dreadful web interface. In particular do you know if there is an ADM6996F (mine is actually an FC) datasheet anywhere? It turned up in a web search. Don't know the particulars anymore. But a trick I learned from a friend is to google for part name vcc, without quotes. Because datasheets often mention a supply voltage with the symbol vcc. It often helps to narrow down the list of results quickly. In fact, I think a good datasheet for the ADM6996F is: http://www.datasheetcatalog.org/datasheets2/21/2150254_1.pdf It's actually the first result from https://encrypted.google.com/search?q=adm6996f+vcc I can easily tell it's not compatible with the 6996M with regard to the VLANs, though. Interestingly, the datasheet for the F doesn't mention the FC model, but the datasheet for the M/MX does: 3.5 The Hardware Difference between ADM6996M/MX and ADM6996F ADM6996FC is a power-down version to replace ADM6996F and ADM6996M/MX is advanced function version for new applications. Good luck! Peter. Did you notice anywhere that seemed to differentiate the various chips in the the family? David ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On Monday 10 January 2011, David Goodenough wrote: On Monday 10 January 2011, Peter Lebbing wrote: On -10/01/37 20:59, David Goodenough wrote: http://wwwhome.cs.utwente.nl/~lebbing/Samurai%206M,MX,%20ADM6996M,MX. pd f Can I ask where you got this datasheet. The only ones I have managed to find are only viewable through a dreadful web interface. In particular do you know if there is an ADM6996F (mine is actually an FC) datasheet anywhere? It turned up in a web search. Don't know the particulars anymore. But a trick I learned from a friend is to google for part name vcc, without quotes. Because datasheets often mention a supply voltage with the symbol vcc. It often helps to narrow down the list of results quickly. In fact, I think a good datasheet for the ADM6996F is: http://www.datasheetcatalog.org/datasheets2/21/2150254_1.pdf It's actually the first result from https://encrypted.google.com/search?q=adm6996f+vcc I can easily tell it's not compatible with the 6996M with regard to the VLANs, though. Interestingly, the datasheet for the F doesn't mention the FC model, but the datasheet for the M/MX does: 3.5 The Hardware Difference between ADM6996M/MX and ADM6996F ADM6996FC is a power-down version to replace ADM6996F and ADM6996M/MX is advanced function version for new applications. Good luck! Peter. Did you notice anywhere that seemed to differentiate the various chips in the the family? David ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel Perhaps I should restate my question, that is unclear. Are there any register values or other way programatically to tell which of the ADM6996 chips is being used as the PHY on a particular system? David ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
Excellent. This chip is used on the Ubiquity Routerstation (not the Pro) and I have some of those and I will test this code. As has been pointed out elsewhere there are several variants on the AMD6996, the Routerstation uses the F variant. David On Saturday 08 January 2011, Peter Lebbing wrote: Hello developers, I have written a switch driver for the Infineon ADM6996 switch chip, which in my case is in a D-Link DSL-G624T modem/router. It implements 802.1Q based VLAN support, via the swconfig interface. Other fancy features of the switch chip are not (yet) implemented. Because the datasheet isn't that well written, it took some experimentation to get the functionality right. The real functionality of the driver is obviously in the setting of the necessary bits in the configuration registers of the chip. Everything else is pretty much boilerplate code, and can easily be changed if something is deemed not to be the best way. So let's move to one such design decision which really is debatable. The switch chip allows 16 VLAN definitions. But any such definition can be for any 12-bits VLAN ID. The swconfig infrastructure seems to unify the concept of an entry in the list of VLAN definitions and it's VLAN ID. This shows strongest in the fact that when you do the following invocation, for example: # swconfig dev eth0 vlan 2 set ports '0 1 2 3t 4t 5t' It will not only invoke the responsible handler set_vlan_ports from the struct switch_dev_ops, but also automatically the handler set_port_pvid from same struct, setting the Primary VLAN ID for the untagged ports 0, 1 and 2 to VLAN ID 2. Mind you, that is the actual 12-bit identifier from 802.1Q, which is independent of the fact that it is entry number 2 in the table of VLAN definitions. This is all fine if all the VLAN IDs we need are 0-15, but it is a perfectly valid use case to have VLAN IDs with much higher numbers. The ADM6996 chip can handle that use case fine, so I did not want to exclude it. I've seen similar things in other switch chips in OpenWRT while browsing, where it was coined 4k VLANs. It wasn't completely clear to me how it was handled there, however. I chose to handle this case as follows: In addition to the standard attributes, vlan in switch_dev_ops has an attribute named vid, which gives the VLAN ID for that entry in the table of VLAN definitions. By default it is set to the number of the entry. So by default it is: # swconfig dev eth0 show ... VLAN 0: vid: 0 ports: VLAN 1: vid: 1 ports: VLAN 2: vid: 2 ports: ... VLAN 15: vid: 15 ports: This means that as long as people don't change the vid, presumably because they don't need more than the 16 lowest VLAN IDs, it all works completely intuitively, and Primary VLAN IDs for the ports are set correctly automatically. Once you change the vid for a vlan, you become responsible for correcting the mistakes the automatic invocation of set_port_pvid makes. But as I said, if there is a more elegant solution, it is easily changed in the code. A change with respect to the original code (which only detected the switch chip, but had almost no functionality), is that I moved allocation of the phy_device-priv structure from adm6996_probe() to adm6996_config_init(). The reason is that config_init() now has a chance to fail (registering swconfig interface), and I wasn't sure about free()ing of the private structure. So I simply copied the behaviour from ar8216.c. Another change is that I changed the number of ports from 5 to 6. The thing is, it has 6 ports, of which number 5 (zero-based counting) is connected to the CPU. You want to be able to config VLANs for that port as well. On the D-Link modem, port number 4 is not connected to anything. The datasheet of the ADM6996 chip suggests using that port as WAN port, and the D-Link does not have an Ethernet WAN port, so it makes sense. The original code sets the Primary VLAN ID of port 0, which it assumes is the WAN port, to 1, and the others to 0. I have left it like this; I also initialize the swconfig Primary VLAN ID to that. But I wonder why this was done; in the original code, it was effectively a no-op, since it would not make a difference unless a bunch of other registers were also changed. Finally, I'd like to make a little personal note. To my great regret, I have very little free time. So it might take a while before I get back to you when you ask something or wish me to make an adjustment or improvement. This is very unfortunate, and obviously I do not ask you to wait for me on anything; I only wish to contribute, not stall. I cannot change my circumstances, and simply have to accept them. Nonetheless, I hope to give the community useful code. Oh, and this is my first code contribution to a community project. Do not hesitate to point out what I should do differently, if
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
2011/1/9 Scott Nicholas scott.nicho...@scottn.us On Sun, Jan 9, 2011 at 2:54 AM, Peter Lebbing pe...@digitalbrains.com wrote: Hello developers, I have written a switch driver for the Infineon ADM6996 switch chip, which in my case is in a D-Link DSL-G624T modem/router. It implements 802.1Q based VLAN support, via the swconfig interface. Other fancy features of the switch chip are not (yet) implemented. My machine also uses an ADM6996, but there are at least two very different ones. 6996F and 6996M are two which I came across. Can you tell me which this is for? I haven't looked at my datasheet in some months to recall enough to identify if this would work. But hopefully, eventually, this will help my target as well down the line. Thank you very much for your contributions. The DSL-G624T uses an 6996M. There are also I and F Variants. However they all seem to be very similar. I'd love to see it working on 6996I (Samsung G3010). - jan ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
Hello, On 09/01/11 07:41, Scott Nicholas wrote: My machine also uses an ADM6996, but there are at least two very different ones. 6996F and 6996M are two which I came across. Can you tell me which this is for? Silly of me to forget to mention this. The datasheet I consulted was for the ADM6996M/MX. I've put my copy on the web[1] if you would like to see the exact version of the datasheet I used. I'd like to remove the PDF in a few weeks as my webspace at the university isn't meant for this :). And the chip that worked with the code is a 6996M in the D-Link DSL-G624T. Peter. [1] http://wwwhome.cs.utwente.nl/~lebbing/Samurai%206M,MX,%20ADM6996M,MX.pdf -- I use the GNU Privacy Guard (GnuPG) in combination with Enigmail. You can send me encrypted mail if you want some privacy. My key is available at http://wwwhome.cs.utwente.nl/~lebbing/pubkey.txt (new, larger key created on Nov 12, 2009) ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
Oops. There was a mutex handling bug in the code I submitted. I tested all kinds of things, but forgot to enable VLAN, disable it again and /enable it/ /again/. The final step, that I forgot, was of course where it went wrong. Disabling the VLAN never released the mutex. Attached patch should fix that. Signed-Off by: Peter Lebbing pe...@digitalbrains.com --- --- backfire/target/linux/generic-2.6/files/drivers/net/phy/adm6996.c.old 2011-01-09 11:18:18.631976648 +0100 +++ backfire/target/linux/generic-2.6/files/drivers/net/phy/adm6996.c 2011-01-09 11:18:51.035975864 +0100 @@ -431,7 +431,7 @@ if (!priv-enable_vlan priv-vlan_enabled) { adm6996_disable_vlan(priv); priv-vlan_enabled = 0; - return 0; + goto out; } else if (priv-enable_vlan !priv-vlan_enabled) { adm6996_enable_vlan(priv); priv-vlan_enabled = 1; @@ -440,6 +440,7 @@ adm6996_apply_port_pvids (priv); adm6996_apply_vlan_filters (priv); +out: mutex_unlock(priv-reg_mutex); return 0; ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
On Sunday 09 January 2011, Peter Lebbing wrote: Hello, On 09/01/11 07:41, Scott Nicholas wrote: My machine also uses an ADM6996, but there are at least two very different ones. 6996F and 6996M are two which I came across. Can you tell me which this is for? Silly of me to forget to mention this. The datasheet I consulted was for the ADM6996M/MX. I've put my copy on the web[1] if you would like to see the exact version of the datasheet I used. I'd like to remove the PDF in a few weeks as my webspace at the university isn't meant for this :). And the chip that worked with the code is a 6996M in the D-Link DSL-G624T. Peter. [1] http://wwwhome.cs.utwente.nl/~lebbing/Samurai%206M,MX,%20ADM6996M,MX.pdf Can I ask where you got this datasheet. The only ones I have managed to find are only viewable through a dreadful web interface. In particular do you know if there is an ADM6996F (mine is actually an FC) datasheet anywhere? David ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
Hello developers, I have written a switch driver for the Infineon ADM6996 switch chip, which in my case is in a D-Link DSL-G624T modem/router. It implements 802.1Q based VLAN support, via the swconfig interface. Other fancy features of the switch chip are not (yet) implemented. Because the datasheet isn't that well written, it took some experimentation to get the functionality right. The real functionality of the driver is obviously in the setting of the necessary bits in the configuration registers of the chip. Everything else is pretty much boilerplate code, and can easily be changed if something is deemed not to be the best way. So let's move to one such design decision which really is debatable. The switch chip allows 16 VLAN definitions. But any such definition can be for any 12-bits VLAN ID. The swconfig infrastructure seems to unify the concept of an entry in the list of VLAN definitions and it's VLAN ID. This shows strongest in the fact that when you do the following invocation, for example: # swconfig dev eth0 vlan 2 set ports '0 1 2 3t 4t 5t' It will not only invoke the responsible handler set_vlan_ports from the struct switch_dev_ops, but also automatically the handler set_port_pvid from same struct, setting the Primary VLAN ID for the untagged ports 0, 1 and 2 to VLAN ID 2. Mind you, that is the actual 12-bit identifier from 802.1Q, which is independent of the fact that it is entry number 2 in the table of VLAN definitions. This is all fine if all the VLAN IDs we need are 0-15, but it is a perfectly valid use case to have VLAN IDs with much higher numbers. The ADM6996 chip can handle that use case fine, so I did not want to exclude it. I've seen similar things in other switch chips in OpenWRT while browsing, where it was coined 4k VLANs. It wasn't completely clear to me how it was handled there, however. I chose to handle this case as follows: In addition to the standard attributes, vlan in switch_dev_ops has an attribute named vid, which gives the VLAN ID for that entry in the table of VLAN definitions. By default it is set to the number of the entry. So by default it is: # swconfig dev eth0 show ... VLAN 0: vid: 0 ports: VLAN 1: vid: 1 ports: VLAN 2: vid: 2 ports: ... VLAN 15: vid: 15 ports: This means that as long as people don't change the vid, presumably because they don't need more than the 16 lowest VLAN IDs, it all works completely intuitively, and Primary VLAN IDs for the ports are set correctly automatically. Once you change the vid for a vlan, you become responsible for correcting the mistakes the automatic invocation of set_port_pvid makes. But as I said, if there is a more elegant solution, it is easily changed in the code. A change with respect to the original code (which only detected the switch chip, but had almost no functionality), is that I moved allocation of the phy_device-priv structure from adm6996_probe() to adm6996_config_init(). The reason is that config_init() now has a chance to fail (registering swconfig interface), and I wasn't sure about free()ing of the private structure. So I simply copied the behaviour from ar8216.c. Another change is that I changed the number of ports from 5 to 6. The thing is, it has 6 ports, of which number 5 (zero-based counting) is connected to the CPU. You want to be able to config VLANs for that port as well. On the D-Link modem, port number 4 is not connected to anything. The datasheet of the ADM6996 chip suggests using that port as WAN port, and the D-Link does not have an Ethernet WAN port, so it makes sense. The original code sets the Primary VLAN ID of port 0, which it assumes is the WAN port, to 1, and the others to 0. I have left it like this; I also initialize the swconfig Primary VLAN ID to that. But I wonder why this was done; in the original code, it was effectively a no-op, since it would not make a difference unless a bunch of other registers were also changed. Finally, I'd like to make a little personal note. To my great regret, I have very little free time. So it might take a while before I get back to you when you ask something or wish me to make an adjustment or improvement. This is very unfortunate, and obviously I do not ask you to wait for me on anything; I only wish to contribute, not stall. I cannot change my circumstances, and simply have to accept them. Nonetheless, I hope to give the community useful code. Oh, and this is my first code contribution to a community project. Do not hesitate to point out what I should do differently, if I got something wrong. Thank you for OpenWRT! Signed-off-by: Peter Lebbing pe...@digitalbrains.com --- Index: backfire/target/linux/generic-2.6/files/drivers/net/phy/adm6996.c === --- backfire/target/linux/generic-2.6/files/drivers/net/phy/adm6996.c (revision 24930) +++
Re: [OpenWrt-Devel] [PATCH] 802.1Q VLAN support for Infineon ADM6996 switch chip
Hello, On Sun, Jan 9, 2011 at 2:54 AM, Peter Lebbing pe...@digitalbrains.com wrote: Hello developers, I have written a switch driver for the Infineon ADM6996 switch chip, which in my case is in a D-Link DSL-G624T modem/router. It implements 802.1Q based VLAN support, via the swconfig interface. Other fancy features of the switch chip are not (yet) implemented. My machine also uses an ADM6996, but there are at least two very different ones. 6996F and 6996M are two which I came across. Can you tell me which this is for? I haven't looked at my datasheet in some months to recall enough to identify if this would work. But hopefully, eventually, this will help my target as well down the line. Thank you very much for your contributions. Regards, Scott Nicholas. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel