Commit graph

16 commits

Author SHA1 Message Date
Gabor Juhos
a7301c57a4 ip17xx: New chip detection
Clean up get_model() and make it recognize IP175D using yet another
chip ID register. Log the detected model.

Also fix a bug in the interface between the PHY layer and our probe function,
which caused IP175A devices to be ignored.

Signed-off-by: Martin Mares <mj@ucw.cz>
Signed-off-by: Patrick Horn <patrick.horn@gmail.com>

SVN-Revision: 21719
2010-06-08 20:18:42 +00:00
Gabor Juhos
d577cfa397 ip17xx: Add VLAN tag field
Since IP175D uses tag-based VLANs, we need an ability to set VLAN tag
of every VLAN.

Signed-off-by: Martin Mares <mj@ucw.cz>
Signed-off-by: Patrick Horn <patrick.horn@gmail.com>

SVN-Revision: 21718
2010-06-08 20:18:38 +00:00
Gabor Juhos
d08093b8b3 ip17xx: Maintain state->remove_tag incrementally
So far, state->remove_tag was sometimes updated incrementally, sometimes
left to correct_vlan_state() to recalculate. Since I want to avoid use of
correct_vlan_state() for IP175D, this patch fixes the only two remaining
places which leave state->remove_tag inconsistent with state->add_tag
and it drops the recalculation.

Signed-off-by: Martin Mares <mj@ucw.cz>
Signed-off-by: Patrick Horn <patrick.horn@gmail.com>

SVN-Revision: 21717
2010-06-08 20:18:34 +00:00
Gabor Juhos
e04dd645f2 ip17xx: Initialize VLAN state upon reset
Let VLAN state variables be initialized not only when the enable VLAN bit
is toggled, but also upon reset.

At this point, this should be a no-op, since the driver reads the current
hardware state before doing any modifications anyway, but I plan to keep
some state locally in the subsequent patches.

Signed-off-by: Martin Mares <mj@ucw.cz>
Signed-off-by: Patrick Horn <patrick.horn@gmail.com>

SVN-Revision: 21716
2010-06-08 20:18:30 +00:00
Gabor Juhos
3c213b14ed ip17xx: Introduce vlan array
Replace vlan_ports array in struct ip175c_state by an array of structures.

Signed-off-by: Martin Mares <mj@ucw.cz>
Signed-off-by: Patrick Horn <patrick.horn@gmail.com>

SVN-Revision: 21715
2010-06-08 20:18:25 +00:00
Gabor Juhos
065bc60f37 ip17xx: Introduce indirection of low-level operations
This patch introduces seperation between low-level and high-level parts
of the driver. The low-level functions are now called via pointers stored
in struct ip175c_regs.

The only functional changes are:

  o  correct_vlan_state() is now called as a part of every update_state().

  o  The order of setting of MODE_REG and resetting switch ports
     has changed. (These are independent actions, so it should not matter.)

  o  ip175c_set_tagged() sets the tags via update_state() instead of writing
     directly to the registers.

  o  The same for ip175c_set_pvid().

The only gaps in this abstraction are operations on ports (get_port_speed
and friends), which access PHY registers directly.

Signed-off-by: Martin Mares <mj@ucw.cz>
Signed-off-by: Patrick Horn <patrick.horn@gmail.com>

SVN-Revision: 21714
2010-06-08 20:18:20 +00:00
Gabor Juhos
09be47cf90 ip17xx: Fix use of MODE_VAL
The value written to MODE_REG in ip175c_reset() should be obviously MODE_VAL,
not RESET_VAL. Actually, this change is a NOP, because in the only case where
the MODE_REG is used, the two values are identical, but it makes the code
more readable.

Signed-off-by: Martin Mares <mj@ucw.cz>
Signed-off-by: Patrick Horn <patrick.horn@gmail.com>

SVN-Revision: 21713
2010-06-08 20:18:15 +00:00
Gabor Juhos
f09e3fb65b ip17xx: Fix indentation in get_state() and update_state()
Signed-off-by: Martin Mares <mj@ucw.cz>
Signed-off-by: Patrick Horn <patrick.horn@gmail.com>

SVN-Revision: 21712
2010-06-08 20:18:10 +00:00
Gabor Juhos
7b5a77fa39 ip17xx: Fixed error handling in ip175c_set_val()
Upon error, ip175c_set_val() returned 0 instead of -EINVAL.

Signed-off-by: Martin Mares <mj@ucw.cz>
Signed-off-by: Patrick Horn <patrick.horn@gmail.com>

SVN-Revision: 21711
2010-06-08 20:18:05 +00:00
Gabor Juhos
b3073617a5 ip17xx: Cosmetic cleanups
Trying to unify capitalization and formatting of comments. Writing of periods
at the end of comments is however still inconsistent.

Signed-off-by: Martin Mares <mj@ucw.cz>
Signed-off-by: Patrick Horn <patrick.horn@gmail.com>

SVN-Revision: 21710
2010-06-08 20:18:00 +00:00
Gabor Juhos
f96f1cd16f ip17xx: Consolidate operations with PHY registers
Call mdiobus_{read,write} instead of duplicating their code.

Introduce ip_phy_write_masked(), which changes a part of a register. Will
be used later in this patch series. Please note that it does not hold any
lock between reading and writing, so it is up to the caller to serialize.

Also add DUMP_MII_IO, which enables logging of all MII accesses.

Signed-off-by: Martin Mares <mj@ucw.cz>
Signed-off-by: Patrick Horn <patrick.horn@gmail.com>

SVN-Revision: 21709
2010-06-08 20:17:55 +00:00
Felix Fietkau
e4a6acf9b8 enable IP175A support in the IP175C PHY driver (based on patch from jh in #6733)
SVN-Revision: 20551
2010-03-28 18:57:42 +00:00
Felix Fietkau
4e12c9d210 fix a crash in ip175c attribute enumeration
SVN-Revision: 15506
2009-04-30 13:57:22 +00:00
Felix Fietkau
8ec2ad91ad swconfig: add a generic switch reset call
SVN-Revision: 15470
2009-04-28 19:16:17 +00:00
Felix Fietkau
3fce73ce46 clean up the ip175c driver some more, add support for setting the pvid and fix querying the phy status
SVN-Revision: 15308
2009-04-20 21:26:44 +00:00
Felix Fietkau
4320a28228 add IC+ IP175C driver (based on Patrick Horn's driver, see #4050)
SVN-Revision: 15305
2009-04-20 18:57:55 +00:00