summaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers/net/phy/ar8216.c
Commit message (Collapse)AuthorAgeFilesLines
* generic: ar8216: use phydev instead of pdev everywhereGabor Juhos2013-02-111-33/+33
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35555
* generic: ar8216: use pr_* macros for kernel messagesGabor Juhos2013-02-111-8/+7
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35554
* generic: ar8216: fix PHY features setupGabor Juhos2013-02-111-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | Sujith says: This commit breaks the WAN port on my AP96 - DHCP fails. Reverting it fixes the issue. commit b67cc3a0cdd02973610d4d5a63226d1c44841e94 Author: juhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73> Date: Fri Feb 8 09:13:18 2013 +0000 generic: ar8216: simplify phy features setup Signed-off-by: Gabor Juhos <juhosg@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@355183c298f89-4303-0410-b956-a3cf2f4a3e73 This change restores the previous behaviour and moves the code into the ar8216_probe function. Reported-by: Sujith Manoharan <sujith@msujith.org> Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Tested-by: Sujith Manoharan <sujith@msujith.org> SVN-Revision: 35549
* generic: ar8216: add ar8xxx_probe_switch helperGabor Juhos2013-02-101-31/+42
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35547
* generic: ar8216: rename ar8xxx_mib_cleanup to ar8xxx_mib_stopGabor Juhos2013-02-101-2/+2
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35546
* generic: ar8216: free mib counters from ar8xxx_freeGabor Juhos2013-02-101-4/+2
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35545
* generic: ar8216: add ar8xxx_free helperGabor Juhos2013-02-101-6/+12
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35544
* generic: ar8216: add ar8xxx_create{,mii} helpersGabor Juhos2013-02-101-14/+33
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35543
* generic: ar8216: remove redundant phy address checkGabor Juhos2013-02-101-1/+1
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35542
* generic: ar8216: only set phy_ptr if packet mangling is usedGabor Juhos2013-02-101-2/+1
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35541
* generic: ar8216: add defines for the AR8316 POSTRIP registerGabor Juhos2013-02-101-2/+2
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35539
* generic: ar8216: don't probe the chip multiple timesGabor Juhos2013-02-101-8/+8
| | | | | | | | It is only needed when the private data is allocated. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35538
* generic: ar8216: add sanity check to ar8216_probeGabor Juhos2013-02-101-0/+41
| | | | | | | | | Verify that the mdio bus has PHY devices with a supported PHY ID at address 0-4. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35537
* generic: ar8216: skip probe on unused PHY addressesGabor Juhos2013-02-101-0/+4
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35536
* generic: ar8216: move sleep out of the loopGabor Juhos2013-02-091-1/+2
| | | | | | | | | | It is enough to sleep once after ANEG is enabled on all PHYs. This reduces boot time on boards with AR8316 switch. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35532
* generic: ar8216: simplify phy features setupGabor Juhos2013-02-081-11/+6
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35518
* generic: ar8216: don't use mdio bus specific functions in ar8216_id_chipGabor Juhos2013-02-081-8/+9
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35517
* generic: ar8216: use inline function to convert swdev to ar8216Gabor Juhos2013-02-071-15/+19
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35514
* generic: ar8216: add mii_bus field to struct ar8216_privGabor Juhos2013-02-071-11/+12
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35513
* generic: ar8216: add detach callbackGabor Juhos2013-02-071-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code uses the 'remove' callback to disable packet mangle on the underlying ethernet device. However the attached_dev is always NULL when the 'remove' callback is called by phylib, and this causes NULL pointer dereference, like this: [ 475.300000] CPU 0 Unable to handle kernel paging request at virtual address 000000f0, epc == 801cdcf0, ra == 801c7eac [ 475.310000] Oops[#1]: [ 475.310000] Cpu 0 [ 475.310000] $ 0 : 00000000 00000000 00000000 00000001 [ 475.310000] $ 4 : 828dde00 00000005 828dde08 ffffffff [ 475.310000] $ 8 : 00380081 00380081 82902a40 00000001 [ 475.310000] $12 : 00000037 00370081 00000001 00000000 [ 475.310000] $16 : 82865000 828dde08 828dde00 00000001 [ 475.310000] $20 : 00000080 00460000 00000002 77151448 [ 475.310000] $24 : 00000000 801abfd4 [ 475.310000] $28 : 82cc2000 82cc3d58 0053c3c4 801c7eac [ 475.310000] Hi : 00000007 [ 475.310000] Lo : 00000004 [ 475.310000] epc : 801cdcf0 ar8216_remove+0x1c/0x94 [ 475.310000] Tainted: G O [ 475.310000] ra : 801c7eac phy_remove+0x4c/0x6c [ 475.310000] Status: 1000cc03 KERNEL EXL IE [ 475.310000] Cause : 00800008 [ 475.310000] BadVA : 000000f0 [ 475.310000] PrId : 00019750 (MIPS 74Kc) [ 475.310000] Modules linked in: ath79_wdt ledtrig_usbdev ledtrig_netdev ag71xx(-) nf_nat_irc nf_nat_ftp nf_conntrack_irc nf_conntrack_ft p ipt_MASQUERADE iptable_nat xt_nat nf_nat_ipv4 nf_nat pppoext_conntrack xt_CT iptable_raw xt_state nf_conntrack_ipv4 nf_defrag_ipv4 nf_co nntrack ehci_hcd pppox ipt_REJECT xt_TCPMSS xt_LOG xt_comment xt_multiport xt_mac xt_limit iptable_mangle iptable_filter ip_tables xt_tcpu dp x_tables ppp_async ppp_generic slhc ath9k(O) ath9k_common(O) ath9k_hw(O) ath(O) mac80211(O) usbcore usb_common nls_base crc_ccitt cfg80 211(O) compat(O) arc4 crypto_blkcipher aead ledtrig_timer ledtrig_default_on leds_gpio gpio_button_hotplug(O) [ 475.310000] Process rmmod (pid: 1160, threadinfo=82cc2000, task=83969920, tls=7747c440) [ 475.310000] Stack : 828dde08 802f5004 802f4680 00000001 828ddf70 801c7eac 802f4680 801ad6d8 82902940 00000000 828dde08 802f5004 802f4680 801ad770 00000002 80269d94 00000000 00000001 00000080 828dde08 828dde3c 801ad7fc 82902940 00000000 83859100 00000000 8384dd2c 8384dd2c 828dde08 801ad230 82902800 00000000 00000000 001a0041 828dde08 828dde08 802e80e8 801aac44 00000080 00460000 ... [ 475.310000] Call Trace: [ 475.310000] [<801cdcf0>] ar8216_remove+0x1c/0x94 [ 475.310000] [<801c7eac>] phy_remove+0x4c/0x6c [ 475.310000] [<801ad770>] __device_release_driver+0x6c/0xd0 [ 475.310000] [<801ad7fc>] device_release_driver+0x28/0x40 [ 475.310000] [<801ad230>] bus_remove_device+0xd8/0x10c [ 475.310000] [<801aac44>] device_del+0x110/0x170 [ 475.310000] [<801aacb8>] device_unregister+0x14/0x28 [ 475.310000] [<801c92b0>] mdiobus_unregister+0x4c/0x70 [ 475.310000] [<82913060>] ag71xx_remove_ar8216_header+0xdc/0x5a8 [ag71xx] [ 475.310000] [ 475.310000] Code: 1200001c 8c82017c ac800128 <8c4500f0> 3c03ffdf 3463ffff 00a31824 ac4300f0 ac4000e0 Add a detach callback and disable packet mangling in that to fix the problem. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35511
* generic: ar8216: clear driver specific data pointer in phy_deviceGabor Juhos2013-02-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is needed to avoid a NULL pointer dereference: [ 19.525270] Unable to handle kernel paging request for data at address 0x00000018 [ 19.532750] Faulting instruction address: 0xc016e104 [ 19.537714] Oops: Kernel access of bad area, sig: 11 [#1] [ 19.543102] P1010 RDB [ 19.545365] Modules linked in: booke_wdt nf_nat_irc nf_nat_ftp nf_conntrack_irc nf_conntrack_ftp ipt_MASQUERADE iptable_nat xt_nat d [ 19.590725] NIP: c016e104 LR: c0171490 CTR: 00000000 [ 19.595681] REGS: c4bc3c10 TRAP: 0300 Tainted: G W O (3.7.6) [ 19.602284] MSR: 00029000 <CE,EE,ME> CR: 82002022 XER: 20000000 [ 19.608381] DEAR: 00000018, ESR: 00000000 [ 19.612382] TASK = c4cd9c80[2070] 'ifconfig' THREAD: c4bc2000 GPR00: 00000001 c4bc3cc0 c4cd9c80 00000000 c7811000 00000000 00000000 0000e8ec GPR08: 0000e8eb 00000000 00029000 00000001 00000000 100801f8 1005c51c 1005c514 GPR16: 1005c468 1005c54c 1005c258 1005c530 10060000 00000000 c7811000 ffff8914 GPR24: c7815030 c793e400 10063adb 00000000 c7811000 c045594c c78ca600 c7815000 [ 19.646352] NIP [c016e104] register_switch+0x98/0x2d0 [ 19.651397] LR [c0171490] ar8216_config_init+0x2d8/0x3f4 [ 19.656697] Call Trace: [ 19.659138] [c4bc3cc0] [c0170490] ar8216_mii_read+0x64/0xc4 (unreliable) [ 19.665835] [c4bc3d00] [c0171490] ar8216_config_init+0x2d8/0x3f4 [ 19.671835] [c4bc3d20] [c016cf8c] phy_init_hw+0x50/0x6c [ 19.677053] [c4bc3d30] [c016d078] phy_attach_direct+0xd0/0xf8 [ 19.682793] [c4bc3d50] [c016d154] phy_connect_direct+0x24/0x68 [ 19.688621] [c4bc3d70] [c0183b70] of_phy_connect+0x48/0x6c [ 19.694102] [c4bc3d90] [c0175aac] gfar_enet_open+0x254/0x3d8 [ 19.699755] [c4bc3db0] [c019acc4] __dev_open+0xc0/0x120 [ 19.704975] [c4bc3dd0] [c019af98] __dev_change_flags+0xd4/0x15c [ 19.710888] [c4bc3df0] [c019b0d4] dev_change_flags+0x1c/0x60 [ 19.716544] [c4bc3e10] [c01ebb94] devinet_ioctl+0x290/0x690 [ 19.722111] [c4bc3e70] [c01ec8d4] inet_ioctl+0x88/0xbc [ 19.727245] [c4bc3e80] [c0186b98] sock_ioctl+0x258/0x294 [ 19.732551] [c4bc3ea0] [c009c00c] do_vfs_ioctl+0x6a4/0x728 [ 19.738031] [c4bc3f10] [c009c0d4] sys_ioctl+0x44/0x70 [ 19.743077] [c4bc3f40] [c000c74c] ret_from_syscall+0x0/0x3c [ 19.748646] --- Exception: c01 at 0x48091b34 [ 19.748646] LR = 0x480e4b64 [ 19.756033] Instruction dump: [ 19.758991] 2f830000 907f0050 3860fff4 419e021c 837f0000 38000000 901f0038 901f0040 [ 19.766744] 901f003c 7f600034 5400d97e 0f000000 <801b0018> 2f800000 40be0010 801b001c Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35497
* generic: ar8216: unregister switch on error pathGabor Juhos2013-02-051-4/+6
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35496
* generic: ar8216: add sgmii_delay_en field to ar8327_platform_dataGabor Juhos2012-12-251-0/+3
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34881
* generic: ar8216: don't use 0 as default VID on AR8327Gabor Juhos2012-12-221-1/+3
| | | | | | | | VID0 is reserved for priority-tagged packets. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34862
* generic: ar8316: allow to configure port 6 via platform data on AR8327Gabor Juhos2012-12-221-17/+18
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34847
* generic: ar8216: rename cpuport_cfg to port0_cfg in ar8327_platform_dataGabor Juhos2012-12-221-1/+1
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34846
* generic: ar8216: set delay values for SGMII mode on AR8327Gabor Juhos2012-11-231-0/+14
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34315
* generic: ar8216: introduce ar8216_mib_op helperGabor Juhos2012-11-221-26/+9
| | | | | | | | | | | | | The ar8216_mib_{capture,flush} functions are similar. Move the common code into a helper and use that from the original functions. This change also fixes a lockdep warning in ar8216_mib_flush. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34297
* generic: ar8216: fix port number check in 'ar8xxx_mib_work_func'Gabor Juhos2012-11-201-1/+3
| | | | | | | | Also add a WARN_ON to 'ar8216_mib_fetch_port_stat' Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34283
* generic: ar8216: remove an unblanced mutex_unlock callGabor Juhos2012-11-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes the following warning: [ 94.080000] [ 94.080000] ===================================== [ 94.080000] [ BUG: bad unlock balance detected! ] [ 94.080000] 3.3.8 #2 Tainted: G O [ 94.080000] ------------------------------------- [ 94.080000] swconfig/1220 is trying to release lock (&priv->mib_lock) at: [ 94.080000] [<801df8f4>] ar8216_sw_get_port_mib+0x138/0x16c [ 94.080000] but there are no more locks to release! [ 94.080000] [ 94.080000] other info that might help us debug this: [ 94.080000] 2 locks held by swconfig/1220: [ 94.080000] #0: (genl_mutex){+.+...}, at: [<80222430>] genl_rcv+0x14/0x34 [ 94.080000] #1: (&dev->sw_mutex){+.+...}, at: [<801da018>] swconfig_get_dev+0x88/0xb4 [ 94.080000] [ 94.080000] stack backtrace: [ 94.080000] Call Trace: [ 94.080000] [<8028dc58>] dump_stack+0x8/0x34 [ 94.080000] [<800a5128>] print_unlock_inbalance_bug+0xe0/0xfc [ 94.080000] [<800a82c0>] lock_release+0x18c/0x1c8 [ 94.080000] [<80292074>] __mutex_unlock_slowpath+0xd8/0x17c [ 94.080000] [<801df8f4>] ar8216_sw_get_port_mib+0x138/0x16c [ 94.080000] [<801db688>] swconfig_get_attr+0xbc/0x394 [ 94.080000] [<8022261c>] genl_rcv_msg+0x1cc/0x214 [ 94.080000] [<80221a18>] netlink_rcv_skb+0x6c/0xe8 [ 94.080000] [<80222440>] genl_rcv+0x24/0x34 [ 94.080000] [<80221370>] netlink_unicast+0x15c/0x22c [ 94.080000] [<8022175c>] netlink_sendmsg+0x240/0x2d0 [ 94.080000] [<801ef544>] sock_sendmsg+0x84/0x9c [ 94.080000] [<801f0648>] __sys_sendmsg+0x1cc/0x270 [ 94.080000] [<801f207c>] sys_sendmsg+0x48/0x7c [ 94.080000] [<8006ad78>] stack_done+0x20/0x40 [ 94.080000] Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34282
* generic: ar8216: add missing locking callsGabor Juhos2012-11-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes the following lockdep warning: [ 19.160000] ------------[ cut here ]------------ [ 19.160000] WARNING: at drivers/net/phy/ar8216.c:322 ar8216_rmw+0x54/0xa4() [ 19.170000] Modules linked in: nf_defrag_ipv4 nf_conntrack ehci_hcd sd_mod pppox ipt_REJECT xt_TCPMSS ipt_LOG xt_comment xt_multip ort xt_mac xt_limit iptable_mangle iptable_filter ip_tables xt_tcpudp x_tables ppp_async ppp_generic slhc ath9k(O) ath9k_common(O) at h9k_hw(O) ath(O) mac80211(O) usbcore usb_common scsi_mod nls_base crc7 crc_itu_t crc_ccitt cfg80211(O) compat(O) arc4 aes_generic cry pto_blkcipher cryptomgr aead crypto_hash crypto_algapi ledtrig_timer ledtrig_default_on leds_gpio gpio_button_hotplug(O) [ 19.210000] Call Trace: [ 19.220000] [<8028dc38>] dump_stack+0x8/0x34 [ 19.220000] [<80072da0>] warn_slowpath_common+0x78/0xa4 [ 19.230000] [<80072de4>] warn_slowpath_null+0x18/0x24 [ 19.230000] [<801de820>] ar8216_rmw+0x54/0xa4 [ 19.240000] [<801df460>] ar8216_mib_capture+0x70/0xd0 [ 19.240000] [<801df944>] ar8xxx_mib_work_func+0x34/0x98 [ 19.250000] [<80089a7c>] process_one_work+0x28c/0x460 [ 19.250000] [<8008a630>] worker_thread+0x22c/0x334 [ 19.260000] [<8008e544>] kthread+0x88/0x90 [ 19.260000] [<80065020>] kernel_thread_helper+0x10/0x18 [ 19.270000] [ 19.270000] ---[ end trace 22e9d696adfa6a08 ]--- Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34281
* generic: ar8216: add MIB counter support for the AR8216 switch as wellGabor Juhos2012-11-181-1/+49
| | | | | | | | Thanks to Jonas Gorski for the reference URL. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34245
* generic: ar8216: rename AR8216_*_STATS_* definesGabor Juhos2012-11-181-40/+40
| | | | | | | | | | | The names are misleading, those are only valid from AR8236. The AR8216 chip uses different offsets. Thanks to Jonas Gorski for the report. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34244
* generic ar8216: allow to read/reset MIB counters via swconfigGabor Juhos2012-11-181-7/+431
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34243
* generic: ar8216: use dynamically allocated private data in ar8216_probeGabor Juhos2012-11-181-3/+12
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34242
* generic: ar8216: start aneg on each PHY of the AR8327Gabor Juhos2012-07-051-1/+13
| | | | SVN-Revision: 32604
* generic: ar8216: allow to configure AR8327 LEDs via platform dataGabor Juhos2012-06-191-1/+22
| | | | SVN-Revision: 32456
* generic: ar8216: add revision specific PHY fixups for AR8327Gabor Juhos2012-05-291-8/+39
| | | | SVN-Revision: 32000
* generic: ar8216: replace chip_type field with chip_{ver,rev} in ar8216_privGabor Juhos2012-05-291-22/+25
| | | | SVN-Revision: 31999
* generic: ar8216: add chip_is_ar8{216,236,316,327} helpersGabor Juhos2012-05-291-8/+28
| | | | SVN-Revision: 31998
* kernel: rewrite the phy packet hook, put it in the network stack to avoid ↵Felix Fietkau2012-05-061-49/+17
| | | | | | having to keep non-upstream ethernet driver changes SVN-Revision: 31637
* ar8216: enable forwarding of multicast frames to the cpu port on ar8327 ↵Felix Fietkau2012-04-221-0/+1
| | | | | | (thx, SeG) SVN-Revision: 31441
* fixes breakage introduced in 776722ce36ac95877efb7fd771dde2f6ffc96433John Crispin2012-03-221-2/+2
| | | | SVN-Revision: 31054
* generic: ar8216: add support for the AR8327 chipGabor Juhos2012-03-181-2/+322
| | | | SVN-Revision: 31011
* generic: ar8216: allow to use more portsGabor Juhos2012-03-181-2/+3
| | | | SVN-Revision: 31010
* generic: ar8216: reorder chip specific functionsGabor Juhos2012-03-181-72/+72
| | | | SVN-Revision: 31009
* generic: ar8216: reorder switch_dev specific functionsGabor Juhos2012-03-181-218/+216
| | | | SVN-Revision: 31008
* generic: ar8216: use ar8216_sw_ prefix for switchdev related functionsGabor Juhos2012-03-181-29/+29
| | | | SVN-Revision: 31007
* generic: ar8216: use switch_dev->ports in for loopsGabor Juhos2012-03-181-6/+6
| | | | SVN-Revision: 31006
* generic: ar8216: add read_port_status field to ar8xxx_chipGabor Juhos2012-03-181-1/+11
| | | | SVN-Revision: 31005