Commit graph

156 commits

Author SHA1 Message Date
Gabor Juhos
a8371ad566 generic: ar8216: add a separate structure for chip specific stuff
Also add a hw_init function into that.

SVN-Revision: 30997
2012-03-18 22:06:12 +00:00
Gabor Juhos
d18133b32d generic: ar8216: rename chip field of struct ar8216
SVN-Revision: 30996
2012-03-18 22:06:08 +00:00
Gabor Juhos
6e143e467f generic: ar8216: move ar8216_id_chip function
Also remove the inline annotation.

SVN-Revision: 30995
2012-03-18 22:06:05 +00:00
Gabor Juhos
1c99979b2c generic: ar8216: rename ar8216_ops to ar8216_sw_ops
SVN-Revision: 30994
2012-03-18 22:06:03 +00:00
Felix Fietkau
b957208807 swconfig: use a mutex instead of a spinlock, many swconfig calls sleep
SVN-Revision: 30952
2012-03-15 19:32:31 +00:00
Felix Fietkau
404a4c1fcd ar8216: fix a MTU related regression
Switch reset on AR8316 appears to clobber the MTU configuration register
and possibly other global config registers. Move global configuration
register init writes back to the reset callback.

SVN-Revision: 30951
2012-03-15 16:57:27 +00:00
Gabor Juhos
c00b53f3d0 ar71xx: move micrel PHY driver to the generic linux target
SVN-Revision: 30946
2012-03-15 09:25:53 +00:00
Gabor Juhos
e3af7c82f8 generic: ar8216: merge multiple if statements in ar8216_hw_apply
SVN-Revision: 30928
2012-03-13 17:33:12 +00:00
Gabor Juhos
2149facb53 generic: ar8216: use usleep_range in ar8216_mii_{read,write}
msleep(1) can sleep for up to 20ms.

SVN-Revision: 30885
2012-03-11 17:19:14 +00:00
Gabor Juhos
77d0a8ca85 generic: ar8216: add a helper function for writing PHY debug registers
SVN-Revision: 30884
2012-03-11 16:49:35 +00:00
Gabor Juhos
dad19ac8b2 generic: ar8216: add lockep assertion to ar8216_rmw
SVN-Revision: 30883
2012-03-11 16:49:33 +00:00
Gabor Juhos
1ad06d4c3a generic: ar8216: coding style cleanup
SVN-Revision: 30857
2012-03-08 10:21:14 +00:00
Gabor Juhos
e2d3cb69a1 generic: ar8216: don't use static variable in ar8236_hw_init
SVN-Revision: 30856
2012-03-08 10:21:12 +00:00
Gabor Juhos
291e2dd583 generic: ar8216: move register inititalization into hw_init
SVN-Revision: 30855
2012-03-08 10:21:11 +00:00
Gabor Juhos
e3538fa852 generic: ar8216: set chip type directly in ar8216_id_chip
SVN-Revision: 30854
2012-03-08 10:21:10 +00:00
Gabor Juhos
a6c69e63b6 generic: ar8216: simplify ar8216_config_init
SVN-Revision: 30853
2012-03-08 10:21:08 +00:00
Gabor Juhos
52a89cd95c generic: ar8216: move port initialization into a separate function
SVN-Revision: 30848
2012-03-07 16:32:46 +00:00
Gabor Juhos
0097cf7161 generic: ar8216: improve ar8216_wait_bit function
SVN-Revision: 30847
2012-03-07 16:32:45 +00:00
Gabor Juhos
2370828599 generic: ar8216: use ar8216_read_port_link to get the CPU port link parameters
SVN-Revision: 30846
2012-03-07 16:32:43 +00:00
Gabor Juhos
d8a8df51ca generic: ar8216: use the generic get_port_link implementation
SVN-Revision: 30845
2012-03-07 16:32:42 +00:00
Gabor Juhos
215e07177e generic: rtl8367: use the generic get_port_link implementation
SVN-Revision: 30844
2012-03-07 16:32:40 +00:00
Gabor Juhos
9e1be3b809 generic: rtl8366s: use the generic get_port_link implementation
SVN-Revision: 30843
2012-03-07 16:32:38 +00:00
Gabor Juhos
e2f0264afe generic: rtl8366rb: use the generic get_port_link implementation
SVN-Revision: 30842
2012-03-07 16:32:37 +00:00
Gabor Juhos
759c341e68 generic: swconfig: add a generic get_port_link implementation
SVN-Revision: 30839
2012-03-07 16:32:33 +00:00
Gabor Juhos
fc9db6f410 generic: ar8216: use mdiobus_write in ar8236_hw_init
SVN-Revision: 30838
2012-03-07 16:32:31 +00:00
Gabor Juhos
7112130105 generic: ar8216: use bus->mdio_lock directly in ar8216_mii_{read,write}
SVN-Revision: 30837
2012-03-07 16:32:30 +00:00
Gabor Juhos
a31e090255 generic: ar8216: fix phy driver name
SVN-Revision: 30836
2012-03-07 16:32:28 +00:00
Jo-Philipp Wich
e5b04d57ef revert unrelated change in previous commit
SVN-Revision: 30738
2012-02-27 09:34:31 +00:00
Jo-Philipp Wich
47b27500cf partly revert r30708, it breaks various arches
SVN-Revision: 30737
2012-02-27 09:33:36 +00:00
Gabor Juhos
4625c9b5a4 generic: rtl8366: add rtl8366_smi_write_reg_noack helper
After issuing a soft reset on the RT8366{S,RB}
switch, waiting for the last acknowlegement fails
in rtl8366_smi_write_reg. Add a _noack version of
the function and use that for issuing a soft reset.

SVN-Revision: 29844
2012-01-21 22:44:09 +00:00
Jo-Philipp Wich
9d497cb132 rtl8366: fix rtl8366_smi_detect() after r29677
SVN-Revision: 29732
2012-01-13 19:17:58 +00:00
Felix Fietkau
e87bb77966 ar8216: use vlan configuration for connecting ports (forced to be untagged) even with vlan_enable=0, but keep them isolated before the switch has been configured this makes enable_vlan=0 practical for vlan passthrough
SVN-Revision: 29719
2012-01-12 10:15:11 +00:00
Felix Fietkau
c33e016fa5 ar8216: do not strip vlan tags when running with vlan_enable=0
SVN-Revision: 29718
2012-01-12 10:15:08 +00:00
Gabor Juhos
8b567fb508 generic: add driver for the RTL8367R/M switches
SVN-Revision: 29678
2012-01-07 19:36:31 +00:00
Gabor Juhos
87fb92ee03 generic: rtl8366: preparing for RTL8367 support
* make clock delay configurable
* make read,write commands configurable
* use u16 for member and untag fields

SVN-Revision: 29677
2012-01-07 19:36:30 +00:00
Gabor Juhos
43196813d7 generic: rtl8366_smi: add timeout message
SVN-Revision: 29676
2012-01-07 19:36:25 +00:00
Gabor Juhos
5fa65cba6e kernel: swconfig: introduce a generic switch LED trigger
SVN-Revision: 29627
2011-12-31 15:02:30 +00:00
Gabor Juhos
bbfaaeffd6 kernel: ar8216: add support for the AR8236 switch
SVN-Revision: 28993
2011-11-12 14:09:52 +00:00
Gabor Juhos
ecb3690d0a kernel: ar8216: move port vlan setup into a separate function
SVN-Revision: 28992
2011-11-12 14:09:50 +00:00
Gabor Juhos
297ac9a7f1 kernel: swconfig: add a missing unlock in error path
SVN-Revision: 28753
2011-11-04 14:38:31 +00:00
Jonas Gorski
b7a2a74823 ar8216: use mdiobus_{read,write} to ensure proper locking
SVN-Revision: 28421
2011-10-11 23:05:10 +00:00
Gabor Juhos
93c093057d generic: jumbo frames support for rtl8366s
This patch adds the option to enable jumbo frames on the rtl8366s
switch. This is almost exactly the same as the first patch at
https://dev.openwrt.org/ticket/7977 and it has been requested
in a comment there.

I have tested this and it successfully allows devices on the switch
using jumbo frames to communicate.

Signed-off-by: Ash Hughes <ashley.hughes@blueyonder.co.uk>

SVN-Revision: 28267
2011-09-21 11:47:38 +00:00
Gabor Juhos
bb64fb2e58 generic: ar8216: add support for get link status
SVN-Revision: 27989
2011-08-15 14:11:41 +00:00
Jonas Gorski
eaa935658b swconfig: Add generic switch identifiers
Also make switches available under a generic name "switch<num>" for device
name agnostic access. The old device name is used as an alias for backward
compatibility.

SVN-Revision: 27800
2011-07-27 18:00:18 +00:00
Felix Fietkau
5b32d62fcf rtl8366_smi: implement a function for detecting whether the attached switch is RTL8366S or RTL8366RB
SVN-Revision: 27755
2011-07-24 14:40:31 +00:00
Felix Fietkau
1afe8a0726 rtl8366: unify rtl8366s and rtl8366rb platform data
SVN-Revision: 27754
2011-07-24 14:40:23 +00:00
John Crispin
60c125b8e6 (respin) 802.1Q VLAN support for ADM6996M/ADM6996FC
This patch adds 802.1Q VLAN support for the ADM6996M chip.

The driver is loaded for both the FC and M model. It will detect which of the
two chips is connected. The FC model is initialised, but no further
functionality is offered.

The PHY driver will always report "100 Mbit/s, link up", for both the M and FC
models. This reflects the fact that the link between switch chip and Ethernet
MAC is always on[1].

Further documentation can be found in the kernel's
Documentation/networking/adm6996.txt

Signed-of-By: Peter Lebbing <peter@digitalbrains.com>

SVN-Revision: 26865
2011-05-09 15:21:58 +00:00
Felix Fietkau
eb270c4d33 ar8316: automatically detect whether port4 is used as PHY or as a switch port
SVN-Revision: 26778
2011-04-28 21:27:37 +00:00
Felix Fietkau
2336d4b438 ar8216: support AR8316 rev 0 devices
SVN-Revision: 26776
2011-04-28 19:30:43 +00:00
Felix Fietkau
9e8cd78944 swconfig: Replace SPIN_LOCK_UNLOCKED with DEFINE_SPINLOCK
SPIN_LOCK_UNLOCKED has been deprecated since 2.6.19 and will get removed
in 2.6.39, so replace it with DEFINE_SPINLOCK().

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

SVN-Revision: 26770
2011-04-26 23:05:29 +00:00
Gabor Juhos
f358166236 generic: rtl8366{s,rb}: remove the PHY driver.
Since the PHY driver is only used for the WAN port and there is virtually
no difference between it and the generic PHY driver, we can sefely remove
it.

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

SVN-Revision: 26600
2011-04-12 09:29:07 +00:00
Felix Fietkau
0508ee0c00 rtl8306: do not overwrite registers in the phy fixup, it could mess up other switches (fixes #8911)
SVN-Revision: 26410
2011-04-02 16:35:22 +00:00
Gabor Juhos
4f1f672d9e generic: rtl8366s: allow initial register values to be passed via platform_data
SVN-Revision: 25120
2011-01-26 20:35:46 +00:00
Gabor Juhos
5641e8233e generic: rtl8366: fix build error
SVN-Revision: 24943
2011-01-09 05:36:44 +00:00
Gabor Juhos
792a1fb2c0 generic: rtl8366: enable vlans before enabling the ports
SVN-Revision: 24939
2011-01-08 20:24:29 +00:00
Gabor Juhos
c16715f8d2 generic: rtl8366: enable ports only after VLAN configuration is done
SVN-Revision: 24938
2011-01-08 20:24:26 +00:00
Gabor Juhos
0bcc97ac26 generic: rtl8366: add enable_port helper
SVN-Revision: 24937
2011-01-08 20:24:22 +00:00
Gabor Juhos
5120660512 generic: rtl8366_smi: init VLANs only in first switch initialization
SVN-Revision: 24936
2011-01-08 20:24:18 +00:00
Gabor Juhos
d88fc86fca generic: rtl8366s: use correct bitmasks in sanity checks
SVN-Revision: 24935
2011-01-08 18:04:04 +00:00
Gabor Juhos
ec9b5d6243 generic: rtl8366s: add vlan fid support
SVN-Revision: 24934
2011-01-08 18:04:00 +00:00
Gabor Juhos
72779e560b generic: rtl8366: add debugfs file for VLAN4K table
SVN-Revision: 24933
2011-01-08 18:03:57 +00:00
Gabor Juhos
a4472870bd generic: rtl8366rb: use correct bitmasks in sanity checks
SVN-Revision: 24930
2011-01-08 11:28:35 +00:00
Gabor Juhos
90c0618011 generic: add rtl8366rb switch vlan fid support
Allows to use fids 0 to 7. Default is 0.
Those who will use this don't forget to `set vlan fid` every time
after `set vlan ports` if you want non default behavior.
Minor changes. Version bump.

Signed-off-by: Roman Yeryomin <roman@advem.lv>

SVN-Revision: 24125
2010-11-24 10:01:21 +00:00
Florian Fainelli
edcbafc836 fix mvswitch PHY polling setting (#8133)
SVN-Revision: 23862
2010-11-04 14:09:20 +00:00
Felix Fietkau
0ee2fda5e1 rt8366*: use __devinit instead of __init for the probe function to fix a section mismatch
SVN-Revision: 23573
2010-10-21 18:42:05 +00:00
Jo-Philipp Wich
352fea83d9 unify extended vlan id swconfig attributes. AR8216 and PSB6970 used "pvid", IP17xx used "tag" and RTL8306 called it "vid". Change all to "vid" and annotate the description with the valid ID range.
SVN-Revision: 23419
2010-10-12 20:49:35 +00:00
Gabor Juhos
dc4df4ca65 generic: RTL8366S/RB: Fix autonegotiation for the WAN port.
The RTL8366S/RB support connecting a second mac to it and using the 5th
port as an independent phy. Therefore we need to handle autonegotiation
changes for phy 4 like on a single phy device.

This fixes #7980, verified on a WNDR3700.

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

SVN-Revision: 23127
2010-09-27 14:42:05 +00:00
Gabor Juhos
5721f06fe1 generic: add rtl8366rb switch port rate, port and qos enable/disable support
Patch-by: Roman Yeryomin <roman@advem.lv>

SVN-Revision: 23126
2010-09-27 14:41:54 +00:00
Florian Fainelli
0ca31140aa add switch driver for Lantiq PSB6970
Tested on ifxmips based board. The PSB6970 is also known as the Infineon Tantos switch.

Signed-off-by: Ithamar R. Adema <ithamar.adema@team-embedded.nl>

SVN-Revision: 22914
2010-09-04 18:06:01 +00:00
Felix Fietkau
08755b8858 rtl8366_smi: when setting VLAN ports, always initialize the PVID to ensure that the VLAN MC entry gets allocated. Fixes problems with tagged-only ports (#7795)
SVN-Revision: 22856
2010-08-31 19:04:02 +00:00
Gabor Juhos
0826570bc4 generic: rtl8366: allow use of VIDs 16-4095 if vlan4k is enabled
SVN-Revision: 22704
2010-08-18 16:00:39 +00:00
Gabor Juhos
08c5588cd2 generic: rtl8366: add generic code to enable VLANs
SVN-Revision: 22703
2010-08-18 16:00:37 +00:00
Gabor Juhos
77d6cd0feb generic: rtl8366: add enable_vlan{,4k} to smi_ops
SVN-Revision: 22702
2010-08-18 16:00:34 +00:00
Gabor Juhos
e01649c7cc generic: fix LED control on the RTL8366 switches
* patch from #7713

SVN-Revision: 22656
2010-08-15 06:47:42 +00:00
Felix Fietkau
f8c4bf89b9 rtl8366: re-enable learning by default, disabling it broke switching functionality. add a configuration option for dynamically enabling/disabling this feature. based on patch from #7637
SVN-Revision: 22545
2010-08-08 20:15:10 +00:00
Felix Fietkau
bd6324190f swconfig: cleanup of kernel drivers and interface - add some comments to a few data structures - add a switch_dev_ops data structure for attributes and callback to replace the stupid template memcpy - get rid of the switch_dev.priv pointer - using container_of() is better
SVN-Revision: 22476
2010-08-04 00:43:40 +00:00
Jo-Philipp Wich
bf1db57017 ip17xx: r21709 broke VLAN functionality on the IP175C switch, add back mdelay() to wait before reading back the phy state, fixes ethernet on the DIR-300 and possibly others
SVN-Revision: 22468
2010-08-03 03:04:34 +00:00
Gabor Juhos
9445ce43a6 generic: rtl8366: add debugfs file to show PVIDs
SVN-Revision: 22206
2010-07-15 13:05:56 +00:00
Gabor Juhos
9a92e1a32c generic: rtl8366: make rtl8366_set_vlan static
SVN-Revision: 22205
2010-07-15 13:05:53 +00:00
Gabor Juhos
48934bbd88 generic: rtl8366: add common rtl8366_sw_{get,set}_vlan_ports functions
SVN-Revision: 22204
2010-07-15 13:05:50 +00:00
Gabor Juhos
d4e0b75dda generic: rtl8366: add common rtl8366_sw_get_vlan_info
SVN-Revision: 22203
2010-07-15 13:05:47 +00:00
Gabor Juhos
a59fa57985 generic: rtl8366: use smi->num_ports and smi->ops->get_vlan_4k
SVN-Revision: 22202
2010-07-15 13:05:43 +00:00
Gabor Juhos
ce7eca2dff generic: rtl8366: add is_vlan_valid function to smi_ops
SVN-Revision: 22201
2010-07-15 13:05:39 +00:00
Gabor Juhos
dffd45dc61 generic: rtl8366: add common rtl8366_sw_get_port_mib function
SVN-Revision: 22200
2010-07-15 13:05:36 +00:00
Gabor Juhos
0049e74882 generic: rtl8366: generealize rtl8366{s,rb}_sw_get_port_mib functions
SVN-Revision: 22199
2010-07-15 13:05:32 +00:00
Gabor Juhos
e110321fce generic: rtl8366: make rtl8366_{g,s}et_pvid static
SVN-Revision: 22198
2010-07-15 13:05:29 +00:00
Gabor Juhos
e561b18521 generic: rtl8366: add common rtl8366_sw_{get,set}_port_pvid functions
SVN-Revision: 22197
2010-07-15 13:05:25 +00:00
Gabor Juhos
534480d3fb generic: rtl8366: add setup to rtl8366_smi_ops struct
SVN-Revision: 22196
2010-07-15 13:05:21 +00:00
Gabor Juhos
b093cec6cc generic: rtl8366: introduce rtl8366_smi_alloc
SVN-Revision: 22195
2010-07-15 13:05:16 +00:00
Gabor Juhos
c7bc8fb46c generic: rtl8366: get rid of private rtl8366{s,rb} structs
SVN-Revision: 22194
2010-07-15 13:05:10 +00:00
Gabor Juhos
008c81b859 generic: rtl8366: move switch device to the rtl8366_smi struct
SVN-Revision: 22193
2010-07-15 13:05:06 +00:00
Gabor Juhos
5508b23aaf generic: rtl8366: get rid of private vlan_{mc,4k} structs
The usage of bitfields causes problems in Little-Endian mode. Remove
them and manipulate the bits directly in the appropriate functions. This
change also reduces the size of the binary a bit.

SVN-Revision: 22192
2010-07-15 13:05:02 +00:00
Gabor Juhos
540b3e6419 generic: rtl8366: use SWITCH_TYPE_NOVAL for reset_mib attributes
SVN-Revision: 22191
2010-07-15 13:04:57 +00:00
Gabor Juhos
86b4b5e1e9 generic: rtl8366: enable VLAN ingress filtering
SVN-Revision: 22044
2010-07-02 09:55:57 +00:00
Gabor Juhos
50d88ac7d4 generic: rtl8366: minor cleanup
SVN-Revision: 21985
2010-06-28 17:24:05 +00:00
Gabor Juhos
e19838e04c generic: rtl8366: add common read_debugfs_mibs function
SVN-Revision: 21984
2010-06-28 17:24:02 +00:00
Gabor Juhos
393f0bda89 generic: rtl8366: standardize read_debugfs_mibs functions
SVN-Revision: 21983
2010-06-28 17:23:59 +00:00
Gabor Juhos
5986c1f2d0 generic: rtl8366: use common rtl8366_mib_counter structure
SVN-Revision: 21982
2010-06-28 17:23:56 +00:00
Gabor Juhos
672018a30d generic: rtl8366: move common debugfs code to rtl8366_smi.c
SVN-Revision: 21981
2010-06-28 17:23:52 +00:00
Gabor Juhos
19ed040c62 generic: rtl8366: move buf to struct rtl8366_smi
SVN-Revision: 21980
2010-06-28 17:23:48 +00:00