From: Kamal Mostafa <kamal@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@lists.ubuntu.com
Cc: "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>,
"Willy Tarreau" <w@1wt.eu>,
"Jochen De Smet" <jochen.armkernel@leahnim.org>,
"Peter Sanford" <psanford@nearbuy.io>,
"Ethan Tuttle" <ethan@ethantuttle.com>,
"Chény Yves-Gael" <yves@cheny.fr>,
"Ryan Press" <ryan@presslab.us>,
"Simon Guinot" <simon.guinot@sequanux.org>,
vdonnefort@lacie.com, "David S. Miller" <davem@davemloft.net>,
"Kamal Mostafa" <kamal@canonical.com>
Subject: [PATCH 79/93] net: mvneta: properly disable HW PHY polling and ensure adjust_link() works
Date: Fri, 20 Sep 2013 13:09:14 -0700 [thread overview]
Message-ID: <1379707768-1804-80-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1379707768-1804-1-git-send-email-kamal@canonical.com>
3.8.13.10 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
commit 714086029116b6b0a34e67ba1dd2f0d1cf26770c upstream.
This commit fixes a long-standing bug that has been reported by many
users: on some Armada 370 platforms, only the network interface that
has been used in U-Boot to tftp the kernel works properly in
Linux. The other network interfaces can see a 'link up', but are
unable to transmit data. The reports were generally made on the Armada
370-based Mirabox, but have also been given on the Armada 370-RD
board.
The network MAC in the Armada 370/XP (supported by the mvneta driver
in Linux) has a functionality that allows it to continuously poll the
PHY and directly update the MAC configuration accordingly (speed,
duplex, etc.). The very first versions of the driver submitted for
review were using this hardware mechanism, but due to this, the driver
was not integrated with the kernel phylib. Following reviews, the
driver was changed to use the phylib, and therefore a software based
polling. In software based polling, Linux regularly talks to the PHY
over the MDIO bus, and sees if the link status has changed. If it's
the case then the adjust_link() callback of the driver is called to
update the MAC configuration accordingly.
However, it turns out that the adjust_link() callback was not
configuring the hardware in a completely correct way: while it was
setting the speed and duplex bits correctly, it wasn't telling the
hardware to actually take into account those bits rather than what the
hardware-based PHY polling mechanism has concluded. So, in fact the
adjust_link() callback was basically a no-op.
However, the network happened to be working because on the network
interfaces used by U-Boot for tftp on Armada 370 platforms because the
hardware PHY polling was enabled by the bootloader, and left enabled
by Linux. However, the second network interface not used for tftp (or
both network interfaces if the kernel is loaded from USB, NAND or SD
card) didn't had the hardware PHY polling enabled.
This patch fixes this situation by:
(1) Making sure that the hardware PHY polling is disabled by clearing
the MVNETA_PHY_POLLING_ENABLE bit in the MVNETA_UNIT_CONTROL
register in the driver ->probe() function.
(2) Making sure that the duplex and speed selections made by the
adjust_link() callback are taken into account by clearing the
MVNETA_GMAC_AN_SPEED_EN and MVNETA_GMAC_AN_DUPLEX_EN bits in the
MVNETA_GMAC_AUTONEG_CONFIG register.
This patch has been tested on Armada 370 Mirabox, and now both network
interfaces are usable after boot.
[ Problem introduced by commit c5aff18 ("net: mvneta: driver for
Marvell Armada 370/XP network unit") ]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Willy Tarreau <w@1wt.eu>
Cc: Jochen De Smet <jochen.armkernel@leahnim.org>
Cc: Peter Sanford <psanford@nearbuy.io>
Cc: Ethan Tuttle <ethan@ethantuttle.com>
Cc: Chény Yves-Gael <yves@cheny.fr>
Cc: Ryan Press <ryan@presslab.us>
Cc: Simon Guinot <simon.guinot@sequanux.org>
Cc: vdonnefort@lacie.com
Acked-by: Jason Cooper <jason@lakedaemon.net>
Tested-by: Vincent Donnefort <vdonnefort@gmail.com>
Tested-by: Yves-Gael Cheny <yves@cheny.fr>
Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
drivers/net/ethernet/marvell/mvneta.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 84b312ea..81d57e9 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -137,7 +137,9 @@
#define MVNETA_GMAC_FORCE_LINK_PASS BIT(1)
#define MVNETA_GMAC_CONFIG_MII_SPEED BIT(5)
#define MVNETA_GMAC_CONFIG_GMII_SPEED BIT(6)
+#define MVNETA_GMAC_AN_SPEED_EN BIT(7)
#define MVNETA_GMAC_CONFIG_FULL_DUPLEX BIT(12)
+#define MVNETA_GMAC_AN_DUPLEX_EN BIT(13)
#define MVNETA_MIB_COUNTERS_BASE 0x3080
#define MVNETA_MIB_LATE_COLLISION 0x7c
#define MVNETA_DA_FILT_SPEC_MCAST 0x3400
@@ -912,6 +914,13 @@ static void mvneta_defaults_set(struct mvneta_port *pp)
/* Assign port SDMA configuration */
mvreg_write(pp, MVNETA_SDMA_CONFIG, val);
+ /* Disable PHY polling in hardware, since we're using the
+ * kernel phylib to do this.
+ */
+ val = mvreg_read(pp, MVNETA_UNIT_CONTROL);
+ val &= ~MVNETA_PHY_POLLING_ENABLE;
+ mvreg_write(pp, MVNETA_UNIT_CONTROL, val);
+
mvneta_set_ucast_table(pp, -1);
mvneta_set_special_mcast_table(pp, -1);
mvneta_set_other_mcast_table(pp, -1);
@@ -2299,7 +2308,9 @@ static void mvneta_adjust_link(struct net_device *ndev)
val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED |
MVNETA_GMAC_CONFIG_GMII_SPEED |
- MVNETA_GMAC_CONFIG_FULL_DUPLEX);
+ MVNETA_GMAC_CONFIG_FULL_DUPLEX |
+ MVNETA_GMAC_AN_SPEED_EN |
+ MVNETA_GMAC_AN_DUPLEX_EN);
if (phydev->duplex)
val |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;
--
1.8.1.2
next prev parent reply other threads:[~2013-09-20 20:12 UTC|newest]
Thread overview: 94+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-20 20:07 [ 3.8.y.z extended stable ] Linux 3.8.13.10 stable review Kamal Mostafa
2013-09-20 20:07 ` [PATCH 01/93] Revert "net/core/sock.c: add missing VSOCK string in af_family_*_key_strings" Kamal Mostafa
2013-09-20 20:07 ` [PATCH 02/93] Revert "zram: use zram->lock to protect zram_free_page() in swap free notify path" Kamal Mostafa
2013-09-20 20:07 ` [PATCH 03/93] zram: allow request end to coincide with disksize Kamal Mostafa
2013-09-20 20:07 ` [PATCH 04/93] mtd: nand: fix NAND_BUSWIDTH_AUTO for x16 devices Kamal Mostafa
2013-09-20 20:08 ` [PATCH 05/93] HID: hidraw: correctly deallocate memory on device disconnect Kamal Mostafa
2013-09-20 20:08 ` [PATCH 06/93] xen-gnt: prevent adding duplicate gnt callbacks Kamal Mostafa
2013-09-20 20:08 ` [PATCH 07/93] ath9k: always clear ps filter bit on new assoc Kamal Mostafa
2013-09-20 20:08 ` [PATCH 08/93] ceph: Don't forget the 'up_read(&osdc->map_sem)' if met error Kamal Mostafa
2013-09-20 20:08 ` [PATCH 09/93] libceph: unregister request in __map_request failed and nofail == false Kamal Mostafa
2013-09-20 20:08 ` [PATCH 10/93] usb: config->desc.bLength may not exceed amount of data returned by the device Kamal Mostafa
2013-09-20 20:08 ` [PATCH 11/93] USB: cdc-wdm: fix race between interrupt handler and tasklet Kamal Mostafa
2013-09-20 20:08 ` [PATCH 12/93] powerpc: Handle unaligned ldbrx/stdbrx Kamal Mostafa
2013-09-20 20:08 ` [PATCH 13/93] intel-iommu: Fix leaks in pagetable freeing Kamal Mostafa
2013-09-20 20:08 ` [PATCH 14/93] drivers/misc/hpilo: Correct panic when an AUX iLO is detected Kamal Mostafa
2013-09-20 20:08 ` [PATCH 15/93] USB: handle LPM errors during device suspend correctly Kamal Mostafa
2013-09-20 20:08 ` [PATCH 16/93] xhci-plat: Don't enable legacy PCI interrupts Kamal Mostafa
2013-09-20 20:08 ` [PATCH 17/93] ath9k: fix rx descriptor related race condition Kamal Mostafa
2013-09-20 20:08 ` [PATCH 18/93] ath9k: avoid accessing MRC registers on single-chain devices Kamal Mostafa
2013-09-20 20:08 ` [PATCH 19/93] brcmsmac: Fix WARNING caused by lack of calls to dma_mapping_error() Kamal Mostafa
2013-09-20 20:08 ` [PATCH 20/93] ext4: simplify truncation code in ext4_setattr() Kamal Mostafa
2013-09-20 20:08 ` [PATCH 21/93] ext4: fix lost truncate due to race with writeback Kamal Mostafa
2013-09-20 20:08 ` [PATCH 22/93] ASoC: wm8960: Fix PLL register writes Kamal Mostafa
2013-09-20 20:08 ` [PATCH 23/93] rculist: list_first_or_null_rcu() should use list_entry_rcu() Kamal Mostafa
2013-09-20 20:08 ` [PATCH 24/93] USB: mos7720: use GFP_ATOMIC under spinlock Kamal Mostafa
2013-09-20 20:08 ` [PATCH 25/93] USB: mos7720: fix big-endian control requests Kamal Mostafa
2013-09-20 20:08 ` [PATCH 26/93] arm64: perf: fix group validation when using enable_on_exec Kamal Mostafa
2013-09-20 20:08 ` [PATCH 27/93] arm64: perf: fix ARMv8 EVTYPE_MASK to include NSH bit Kamal Mostafa
2013-09-20 20:08 ` [PATCH 28/93] staging: comedi: dt282x: dt282x_ai_insn_read() always fails Kamal Mostafa
2013-09-20 20:08 ` [PATCH 29/93] usb: ehci-mxc: check for pdata before dereferencing Kamal Mostafa
2013-09-20 20:08 ` [PATCH 30/93] mmc: tmio_mmc_dma: fix PIO fallback on SDHI Kamal Mostafa
2013-09-20 20:08 ` [PATCH 31/93] proc: Restrict mounting the proc filesystem Kamal Mostafa
2013-09-20 20:08 ` [PATCH 32/93] usb: xhci: Disable runtime PM suspend for quirky controllers Kamal Mostafa
2013-09-20 20:08 ` [PATCH 33/93] USB: OHCI: Allow runtime PM without system sleep Kamal Mostafa
2013-09-20 20:08 ` [PATCH 34/93] pinctrl: at91: fix get_pullup/down function return Kamal Mostafa
2013-09-20 20:08 ` [PATCH 35/93] ACPI / EC: Add HP Folio 13 to ec_dmi_table in order to skip DSDT scan Kamal Mostafa
2013-09-20 20:08 ` [PATCH 36/93] ACPI / EC: Add ASUSTEK L4R to quirk list in order to validate ECDT Kamal Mostafa
2013-09-20 20:08 ` [PATCH 37/93] HID: validate HID report id size Kamal Mostafa
2013-09-20 20:08 ` [PATCH 38/93] cpuidle: coupled: abort idle if pokes are pending Kamal Mostafa
2013-09-20 20:08 ` [PATCH 39/93] cpuidle: coupled: disable interrupts after entering safe state Kamal Mostafa
2013-09-20 20:08 ` [PATCH 40/93] cpuidle: coupled: fix race condition between pokes and " Kamal Mostafa
2013-09-20 20:08 ` [PATCH 41/93] of: Fix missing memory initialization on FDT unflattening Kamal Mostafa
2013-09-20 20:08 ` [PATCH 42/93] leds: wm831x-status: Request a REG resource Kamal Mostafa
2013-09-20 20:08 ` [PATCH 43/93] USB: fix build error when CONFIG_PM_SLEEP isn't enabled Kamal Mostafa
2013-09-20 20:08 ` [PATCH 44/93] clk: wm831x: Initialise wm831x pointer on init Kamal Mostafa
2013-09-20 20:08 ` [PATCH 45/93] drm/edid: add quirk for Medion MD30217PG Kamal Mostafa
2013-09-20 20:08 ` [PATCH 46/93] drm/radeon: fix endian bugs in hw i2c atom routines Kamal Mostafa
2013-09-20 20:08 ` [PATCH 47/93] drm/radeon: update line buffer allocation for dce4.1/5 Kamal Mostafa
2013-09-20 20:08 ` [PATCH 48/93] drm/radeon: update line buffer allocation for dce6 Kamal Mostafa
2013-09-20 20:08 ` [PATCH 49/93] drm/radeon: fix LCD record parsing Kamal Mostafa
2013-09-20 20:08 ` [PATCH 50/93] drm/radeon: fix resume on some rs4xx boards (v2) Kamal Mostafa
2013-09-20 20:08 ` [PATCH 51/93] drm/radeon: fix handling of variable sized arrays for router objects Kamal Mostafa
2013-09-20 20:08 ` [PATCH 52/93] radeon kms: fix uninitialised hotplug work usage in r100_irq_process() Kamal Mostafa
2013-09-20 20:08 ` [PATCH 53/93] pidns: Fix hang in zap_pid_ns_processes by sending a potentially extra wakeup Kamal Mostafa
2013-09-20 20:08 ` [PATCH 54/93] x86, smap: Handle csum_partial_copy_*_user() Kamal Mostafa
2013-09-20 20:08 ` [PATCH 55/93] Introduce [compat_]save_altstack_ex() to unbreak x86 SMAP Kamal Mostafa
2013-09-20 20:08 ` [PATCH 56/93] drm: fix DRM_IOCTL_MODE_GETFB handle-leak Kamal Mostafa
2013-09-20 20:08 ` [PATCH 57/93] HID: picolcd: Prevent NULL pointer dereference on _remove() Kamal Mostafa
2013-09-20 20:08 ` [PATCH 58/93] HID: battery: don't do DMA from stack Kamal Mostafa
2013-09-20 20:08 ` [PATCH 59/93] ALSA: hda - hdmi: Fallback to ALSA allocation when selecting CA Kamal Mostafa
2013-09-20 20:08 ` [PATCH 60/93] fuse: postpone end_page_writeback() in fuse_writepage_locked() Kamal Mostafa
2013-09-20 20:08 ` [PATCH 61/93] fuse: invalidate inode attributes on xattr modification Kamal Mostafa
2013-09-20 20:08 ` [PATCH 62/93] [media] media: coda: Fix DT driver data pointer for i.MX27 Kamal Mostafa
2013-09-20 20:08 ` [PATCH 63/93] [media] s5p-g2d: Fix registration failure Kamal Mostafa
2013-09-20 20:08 ` [PATCH 64/93] [media] DocBook: upgrade media_api DocBook version to 4.2 Kamal Mostafa
2013-09-20 20:09 ` [PATCH 65/93] [media] v4l2: added missing mutex.h include to v4l2-ctrls.h Kamal Mostafa
2013-09-20 20:09 ` [PATCH 66/93] [media] hdpvr: fix iteration over uninitialized lists in hdpvr_probe() Kamal Mostafa
2013-09-20 20:09 ` [PATCH 67/93] [media] exynos-gsc: Register v4l2 device Kamal Mostafa
2013-09-20 20:09 ` [PATCH 68/93] fuse: readdir: check for slash in names Kamal Mostafa
2013-09-20 20:09 ` [PATCH 69/93] MIPS: ath79: Fix ar933x watchdog clock Kamal Mostafa
2013-09-20 20:09 ` [PATCH 70/93] libceph: use pg_num_mask instead of pgp_num_mask for pg.seed calc Kamal Mostafa
2013-09-20 20:09 ` [PATCH 71/93] HID: pantherlord: validate output report details Kamal Mostafa
2013-09-20 20:09 ` [PATCH 72/93] HID: ntrig: validate feature " Kamal Mostafa
2013-09-20 20:09 ` [PATCH 73/93] HID: sensor-hub: " Kamal Mostafa
2013-09-20 20:09 ` [PATCH 74/93] HID: picolcd_core: validate output " Kamal Mostafa
2013-09-20 20:09 ` [PATCH 75/93] HID: check for NULL field when setting values Kamal Mostafa
2013-09-20 20:09 ` [PATCH 76/93] ARM: PCI: versatile: Fix map_irq function to match hardware Kamal Mostafa
2013-09-20 20:09 ` [PATCH 77/93] ARM: PCI: versatile: Fix PCI I/O Kamal Mostafa
2013-09-20 20:09 ` [PATCH 78/93] ARM: PCI: versatile: Fix SMAP register offsets Kamal Mostafa
2013-09-20 20:09 ` Kamal Mostafa [this message]
2013-09-20 20:09 ` [PATCH 80/93] drm/i915: try not to lose backlight CBLV precision Kamal Mostafa
2013-09-20 20:09 ` [PATCH 81/93] crypto: api - Fix race condition in larval lookup Kamal Mostafa
2013-09-20 20:09 ` [PATCH 82/93] cifs: ensure that srv_mutex is held when dealing with ssocket pointer Kamal Mostafa
2013-09-20 20:09 ` [PATCH 83/93] CIFS: Fix a memory leak when a lease break comes Kamal Mostafa
2013-09-20 20:09 ` [PATCH 84/93] ALSA: hda - Add Toshiba Satellite C870 to MSI blacklist Kamal Mostafa
2013-09-20 20:09 ` [PATCH 85/93] lguest: Point to the right directory for the lguest launcher Kamal Mostafa
2013-09-20 20:09 ` [PATCH 86/93] powerpc: Default arch idle could cede processor on pseries Kamal Mostafa
2013-09-20 20:09 ` [PATCH 87/93] ASoC: mc13783: add spi errata fix Kamal Mostafa
2013-09-20 20:09 ` [PATCH 88/93] [SCSI] sd: Fix potential out-of-bounds access Kamal Mostafa
2013-09-20 20:09 ` [PATCH 89/93] pidns: fix vfork() after unshare(CLONE_NEWPID) Kamal Mostafa
2013-09-20 20:09 ` [PATCH 90/93] ocfs2: fix the end cluster offset of FIEMAP Kamal Mostafa
2013-09-20 20:09 ` [PATCH 91/93] mm/huge_memory.c: fix potential NULL pointer dereference Kamal Mostafa
2013-09-20 20:09 ` [PATCH 92/93] mm: fix aio performance regression for database caused by THP Kamal Mostafa
2013-09-20 20:09 ` [PATCH 93/93] memcg: fix multiple large threshold notifications Kamal Mostafa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1379707768-1804-80-git-send-email-kamal@canonical.com \
--to=kamal@canonical.com \
--cc=davem@davemloft.net \
--cc=ethan@ethantuttle.com \
--cc=jochen.armkernel@leahnim.org \
--cc=kernel-team@lists.ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=psanford@nearbuy.io \
--cc=ryan@presslab.us \
--cc=simon.guinot@sequanux.org \
--cc=stable@vger.kernel.org \
--cc=thomas.petazzoni@free-electrons.com \
--cc=vdonnefort@lacie.com \
--cc=w@1wt.eu \
--cc=yves@cheny.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®