1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-02 14:25:20 +02:00
Commit Graph

72 Commits

Author SHA1 Message Date
juhosg
5e0f4e5bfc generic: rtl8366: use struct rtl8366_smi for phy_reg_{read,write} calls
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21912 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-26 19:16:06 +00:00
juhosg
5e66606678 generic: rtl8366: move mii bus handling to the rtl8366_smi code
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21911 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-26 19:16:01 +00:00
juhosg
d2c03b9bff generic: rtl8366: introduce rtl8366_smi_ops
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21910 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-26 19:15:57 +00:00
juhosg
36c0080775 generic: rtl8366: change format string for debugfs error messages
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21909 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-26 19:15:52 +00:00
juhosg
062819b9cb generic: rtl8366: don't show link parameters if the link is down
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21908 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-26 19:15:48 +00:00
juhosg
d9272169b8 generic: rtl8366: fix register offset and size of MIB counters
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21907 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-26 19:15:43 +00:00
juhosg
b710df9d9a generic: rtl8366: prevent modifications of VLAN 0
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21906 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-26 19:15:38 +00:00
juhosg
f03c775c62 swconfig: fix lock imbalance in unregister_switch()
Signed-off-by: Karl Beldan <karl.beldan@sagemcom.com>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21780 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-13 11:37:35 +00:00
juhosg
b4566a37d1 swconfig: release switch in error path of swconfig_get_attr
Signed-off-by: Karl Beldan <karl.beldan@sagemcom.com>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21779 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-13 11:37:32 +00:00
juhosg
3106e73c42 ip17xx: fix autonegotioation issues
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21727 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:19:14 +00:00
juhosg
595d2512d1 ip17xx: Update the copyright message
Update the copyright message to reflect my changes.

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


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21725 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:19:08 +00:00
juhosg
c3b78ad426 ip17xx: Rename the driver to ip17xx.c
Following the big internal rename, this is the external rename.
Rename the source file to ip17xx.c and adjust Makefile and Kconfig.

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


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21724 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:19:05 +00:00
juhosg
3360def59f ip17xx: The big rename
Recognize that the driver supports many more devices than the ip175c.

The driver itself is now called ip17xx, all generic functions have been
renamed to ip17xx_*. The model-dependent functions have prefixes ip175c_
and ip175d_.

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


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21723 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:58 +00:00
juhosg
08171f79fc ip17xx: Keep all state locally
Instead of reading the hardware state every time we want to inspect it or
to modify it, maintain it in struct ip175c_state.

This simplifies the code significantly.

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


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21722 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:55 +00:00
juhosg
b105730015 ip17xx: Add support for IP175D
Add support for the IP175D chip. Since the register set is vastly different
from the previous models, we cannot not use the register number tables in struct
register_mappings (except for VLAN_DEFAULT_TAG_REG), so we supply a different
set of low-level functions.

Unlike with the previous models, we keep the VLAN setup in our state structure
instead of querying the hardware (it would be much harder in case of IP175D,
because the mapping between hardware and software state is not 1:1). Therefore,
get_flags() and get_state() are no-ops.

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


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21721 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:51 +00:00
juhosg
714e378fed ip17xx: Avoid auto-negotiation
Let ip175c_config_init() initialize the link state of the PHY and set the
PHY state machine directly to the PHY_RUNNING state in order to skip the
auto-negotiation phase.

Previously, auto-negotiation on PHY 0 (switch port 0) influenced the ethernet
driver connected to the CPU port, causing all sorts of weird effects.

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


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21720 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:47 +00:00
juhosg
b2b1cad62e 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>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21719 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:42 +00:00
juhosg
27c4924de8 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>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21718 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:38 +00:00
juhosg
d46e7c8da5 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>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21717 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:34 +00:00
juhosg
29b4b3c009 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>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21716 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:30 +00:00
juhosg
f59df48228 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>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21715 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:25 +00:00
juhosg
398de7c230 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>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21714 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:20 +00:00
juhosg
0b041db319 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>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21713 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:15 +00:00
juhosg
148966bc19 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>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21712 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:10 +00:00
juhosg
9e494614a1 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>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21711 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:05 +00:00
juhosg
6c0e4e5864 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>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21710 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:18:00 +00:00
juhosg
2624270e11 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>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21709 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:17:55 +00:00
juhosg
2edc592f33 swconfig: Fix a bug in use of SWITCH_PORT_FLAG_TAGGED
SWITCH_PORT_FLAG_TAGGED is a bit index, not a bit mask.

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


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21708 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-06-08 20:17:03 +00:00
juhosg
56f15bb5f9 swconfig: Add cpu port index to help output.
Let swconfig provide the cpu port index in its help page. This is
needed as e.g. Atheros switches have their cpu port at port 0, not
port 5.

This could allow e.g. luci to get a rough overview of the layout of
the switch.

Signed-off-by: Jonas Gorski <jonas.gorski+openwrt@gmail.com>


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20939 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-04-16 19:32:40 +00:00
florian
b02fa11a17 [kernel] swconfig: Check vlan/port indexes for validity.
Swconfig needs to make sure that requested vlans/ports actually exist,
else it might read or modify memory not belonging to itself.

This patch adds a quick range check in swconfig's kernel part to
prevent accidential or intentional memory modification.

Signed-off-by: Jonas Gorski <jonas.gorski+openwrt@gmail.com>

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20811 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-04-11 20:51:37 +00:00
juhosg
3c6e0e0859 Generic: Clean up output of AR8216 driver.
This patch is rather a cosmetic patch. It fixes the following issues:

 * Demote the unknown device message to debug level to not spam
   the log.
 * Fix the version print of the unknown device message.
 * Output the 'attach' message only when attaching as switch driver,
   not when attaching as phy driver.
 * Correctly return NET_RX_DROP when dropping packets.

Signed-off-by: Jonas Gorski <jonas.gorski+openwrt@gmail.com>
Cc: bacfire@openwrt.org


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20773 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-04-10 11:34:11 +00:00
juhosg
9823d2fc7e generic: make chip detection more reliable in the AR8216 driver
Fixes broken ethernet on the Planex MZK-W04NU/W300NH boards.

Cc: bacfire@openwrt.org


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20753 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-04-09 08:40:12 +00:00
jow
58618dfb3d [PATCH 1/2] Add support for the ar8316 switch.
This patch enhances the ar8216 driver with ar8316 support and fixes some minor
issues with the ar8216 driver itself. It should not break anything, but isn't
tested on ar8216 devices.

[PATCH 2/2] ar71xx: Add the ar8316 driver to rs pro/rb-450g.
Add the ar8216 driver to the ar71xx target, and add network
configurations for the RouterStation Pro and the RouterBoard RB-450G.


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20722 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-04-05 23:03:16 +00:00
nbd
bc3d4f5dfd enable IP175A support in the IP175C PHY driver (based on patch from jh in #6733)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20551 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-03-28 18:57:42 +00:00
nbd
02c404ea21 ar8216: fix the mtu register definition
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20110 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-03-09 21:43:16 +00:00
nbd
455e74f063 Several small fixes for ar8216 driver (patch by Jonas Gorski)
* Create defines for some magic values/masks.

 * Change vlan_id to u16, to allow VIDs > 255.

 * Add a range check to set_pvid as it isn't a VID, but the index
   in the vlan table.

 * Set the max VID to 4094, since 4095 is a reserved value and
   should not be used.

 * In mangle_rx replace the provided VID with the VID of the table
   entry of the port, not the index of the table.

 * In hw_apply, remove a redundant emptyness check (was already
   checked several lines above).

 * In no vlan mode do not set the ingress mode to secure, as there
   are no vlan table entries, but to use the port's destination
   masks. Otherwise the switch won't forward anything.

 * In read_status tell that the phy is up (taken from the rtl8306
   driver).

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20083 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-03-09 14:35:41 +00:00
juhosg
a5af4ae7d5 kernel: add driver for the RTL8366RB switch
Thanks to Andrew Tarabaras.


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19837 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-02-24 13:39:02 +00:00
juhosg
2c16cf4acb kernel: fix typos in the AR8216 header file
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19834 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-02-24 13:38:48 +00:00
juhosg
48e652dc63 rtl8366_smi: sanitize gpio values to a 0/1 boolean
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19402 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-01-30 15:25:12 +00:00
juhosg
8a3eb00804 rtl8366s: reset the chip early, this allows ethernet to work as soon as possible
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19355 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-01-27 21:01:48 +00:00
juhosg
d7d76ebff9 rtl8366: make it available on all platforms
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19329 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-01-25 15:13:38 +00:00
nbd
00ebe9d87a rtl8306: manage the wan port as a separate phy device with proper link status reading and autonegotiation - the genphy driver does not handle it properly
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18709 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-12-09 03:25:33 +00:00
nbd
1b18fb38dc ar71xx: make the rtl8306 switch attach to eth0 instead of eth1 on the wrt160nl, fixes wan port detection (#6309)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18699 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-12-08 14:06:18 +00:00
nbd
b9c2e351d5 fix link status detection in various switch drivers
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18698 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-12-08 14:06:09 +00:00
nbd
8bdac63e6f move the updated version (for 2.6.30+) of ar8216/mvswitch to the generic files directory and remove patches for older kernel versions (no longer in use)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17594 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-09-16 12:24:46 +00:00
nbd
1881cb34ec add a driver for rtl8306 switches
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17248 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-08-14 00:52:17 +00:00
nbd
71f5d93ef9 ar8216: rename the vlan attribute to enable_vlan to keep it consistent with other drivers
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16770 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-07-11 01:21:01 +00:00
nbd
109963bd6d ar8216: fix transmission of large frames by setting the switch mtu
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16629 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-06-29 21:54:16 +00:00
nbd
66fc7bca04 ar8216: add delay for page switching to work around register setting corruption. use packet mangling to fix up the vlan for incoming packets (workaround for hardware bug, which renders normal 802.1q support unusable)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16442 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-06-14 03:32:01 +00:00
nbd
887ce09dca fix a crash in ip175c attribute enumeration
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@15506 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-04-30 13:57:22 +00:00