* [Patch v1] ax88179_178a: add reset functionality in reset_resume
@ 2015-06-21 6:11 Vivek Bhagat
2015-06-23 13:41 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Vivek Bhagat @ 2015-06-21 6:11 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA
>From d178065c9e3cfa8a45ef537fae7412775339beb0 Mon Sep 17 00:00:00 2001
From: Vivek Kumar Bhagat <vivek.bhagat-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Date: Thu, 11 Jun 2015 07:23:46 -0700
Subject: [PATCH] ax88179_178a: add reset functionality in reset_resume
Without reset functionality in reset_resume, iperf connection does not
establish after suspend/resume however ping works at the same time.
iperf connection fails with wrong checksum error shown by tcpdump.
reset function inside reset_resume solves above bug. We have verified
this issue on ASIX based ST Lab, Cadyce dongle.
Signed-off-by: Vivek Kumar Bhagat <vivek.bhagat-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Praveen Kumar <praveen.k09-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
drivers/net/usb/ax88179_178a.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index e6338c1..00928c0 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1630,6 +1630,18 @@ static int ax88179_stop(struct usbnet *dev)
return 0;
}
+static int ax88179_reset_resume(struct usb_interface *intf)
+{
+ struct usbnet *dev = usb_get_intfdata(intf);
+ int ret;
+
+ ret = ax88179_reset(dev);
+ if (ret < 0)
+ return ret;
+
+ return ax88179_resume(intf);
+}
+
static const struct driver_info ax88179_info = {
.description = "ASIX AX88179 USB 3.0 Gigabit Ethernet",
.bind = ax88179_bind,
@@ -1744,7 +1756,7 @@ static struct usb_driver ax88179_178a_driver = {
.probe = usbnet_probe,
.suspend = ax88179_suspend,
.resume = ax88179_resume,
- .reset_resume = ax88179_resume,
+ .reset_resume = ax88179_reset_resume,
.disconnect = usbnet_disconnect,
.supports_autosuspend = 1,
.disable_hub_initiated_lpm = 1,
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Patch v1] ax88179_178a: add reset functionality in reset_resume
2015-06-21 6:11 [Patch v1] ax88179_178a: add reset functionality in reset_resume Vivek Bhagat
@ 2015-06-23 13:41 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-06-23 13:41 UTC (permalink / raw)
To: vivek.bhagat89; +Cc: netdev, linux-usb
From: Vivek Bhagat <vivek.bhagat89@gmail.com>
Date: Sun, 21 Jun 2015 11:41:43 +0530
> From d178065c9e3cfa8a45ef537fae7412775339beb0 Mon Sep 17 00:00:00 2001
> From: Vivek Kumar Bhagat <vivek.bhagat@samsung.com>
> Date: Thu, 11 Jun 2015 07:23:46 -0700
> Subject: [PATCH] ax88179_178a: add reset functionality in reset_resume
>
> Without reset functionality in reset_resume, iperf connection does not
> establish after suspend/resume however ping works at the same time.
> iperf connection fails with wrong checksum error shown by tcpdump.
>
> reset function inside reset_resume solves above bug. We have verified
> this issue on ASIX based ST Lab, Cadyce dongle.
>
> Signed-off-by: Vivek Kumar Bhagat <vivek.bhagat@samsung.com>
> Signed-off-by: Praveen Kumar <praveen.k09@samsung.com>
Your email client has corrupted the patch, turning TAB characters into
spaces etc.
Please fix this up and resubmit.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch v1] ax88179_178a: add reset functionality in reset_resume
[not found] ` <CA+vmRF7nC2Ndzzt+QRj2YG7yQEtHw=3ZBuNBCqyM7nqErFoU-g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-06-22 10:33 ` Oliver Neukum
0 siblings, 0 replies; 4+ messages in thread
From: Oliver Neukum @ 2015-06-22 10:33 UTC (permalink / raw)
To: Vivek Bhagat
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA
On Sun, 2015-06-21 at 11:46 +0530, Vivek Bhagat wrote:
> Without reset functionality in reset_resume, iperf connection does not
> establish after suspend/resume however ping works at the same time.
> iperf connection fails with wrong checksum error shown by tcpdump.
>
> reset function inside reset_resume solves above bug. We have verified
> this issue on ASIX based ST Lab, Cadyce dongle.
Well, you the experiment rules. This highlights, however, a lot
of duplication in the code paths for reset and bind.
Does this patch on top of yours work for you?
Regards
Oliver
>From 0ae01a2eacf4db10d5d299c6567fd3272ad9a1c2 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum-l3A5Bk7waGM@public.gmane.org>
Date: Mon, 22 Jun 2015 12:28:55 +0200
Subject: [PATCH] ax88179: unify common code in bind and reset
In both code paths the device is set up anew.
So let's unify them.
Signed-off-by: Oliver Neukum <oneukum-IBi9RG/b67k@public.gmane.org>
---
drivers/net/usb/ax88179_178a.c | 152 ++++++++++++++---------------------------
1 file changed, 52 insertions(+), 100 deletions(-)
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index 00928c0..02c9f5c 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1220,21 +1220,15 @@ static int ax88179_led_setting(struct usbnet *dev)
return 0;
}
-static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)
+static void setup_chip(struct usbnet *dev, bool phy_auto_detach)
{
u8 buf[5];
u16 *tmp16;
u8 *tmp;
- struct ax88179_data *ax179_data = (struct ax88179_data *)dev->data;
- struct ethtool_eee eee_data;
-
- usbnet_get_endpoints(dev, intf);
tmp16 = (u16 *)buf;
tmp = (u8 *)buf;
- memset(ax179_data, 0, sizeof(*ax179_data));
-
/* Power up ethernet PHY */
*tmp16 = 0;
ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, tmp16);
@@ -1246,6 +1240,11 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)
ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, tmp);
msleep(100);
+ if (phy_auto_detach) {
+ /* Ethernet PHY Auto Detach*/
+ ax88179_auto_detach(dev, 0);
+ }
+
ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN,
ETH_ALEN, dev->net->dev_addr);
memcpy(dev->net->perm_addr, dev->net->dev_addr, ETH_ALEN);
@@ -1254,27 +1253,24 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)
memcpy(tmp, &AX88179_BULKIN_SIZE[0], 5);
ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_BULKIN_QCTRL, 5, 5, tmp);
- dev->rx_urb_size = 1024 * 20;
-
*tmp = 0x34;
ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PAUSE_WATERLVL_LOW, 1, 1, tmp);
*tmp = 0x52;
ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PAUSE_WATERLVL_HIGH,
1, 1, tmp);
+}
- dev->net->netdev_ops = &ax88179_netdev_ops;
- dev->net->ethtool_ops = &ax88179_ethtool_ops;
- dev->net->needed_headroom = 8;
+static void start_chip(struct usbnet *dev)
+{
+ u8 buf[5];
+ u16 *tmp16;
+ u8 *tmp;
+ struct ethtool_eee eee_data;
+ struct ax88179_data *ax179_data = (struct ax88179_data *)dev->data;
- /* Initialize MII structure */
- dev->mii.dev = dev->net;
- dev->mii.mdio_read = ax88179_mdio_read;
- dev->mii.mdio_write = ax88179_mdio_write;
- dev->mii.phy_id_mask = 0xff;
- dev->mii.reg_num_mask = 0xff;
- dev->mii.phy_id = 0x03;
- dev->mii.supports_gmii = 1;
+ tmp16 = (u16 *)buf;
+ tmp = (u8 *)buf;
dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_RXCSUM;
@@ -1322,6 +1318,40 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)
mii_nway_restart(&dev->mii);
usbnet_link_change(dev, 0, 0);
+}
+
+static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)
+{
+ u8 buf[5];
+ u16 *tmp16;
+ u8 *tmp;
+ struct ax88179_data *ax179_data = (struct ax88179_data *)dev->data;
+
+ usbnet_get_endpoints(dev, intf);
+
+ tmp16 = (u16 *)buf;
+ tmp = (u8 *)buf;
+
+ memset(ax179_data, 0, sizeof(*ax179_data));
+
+ setup_chip(dev, false);
+
+ dev->rx_urb_size = 1024 * 20;
+
+ dev->net->netdev_ops = &ax88179_netdev_ops;
+ dev->net->ethtool_ops = &ax88179_ethtool_ops;
+ dev->net->needed_headroom = 8;
+
+ /* Initialize MII structure */
+ dev->mii.dev = dev->net;
+ dev->mii.mdio_read = ax88179_mdio_read;
+ dev->mii.mdio_write = ax88179_mdio_write;
+ dev->mii.phy_id_mask = 0xff;
+ dev->mii.reg_num_mask = 0xff;
+ dev->mii.phy_id = 0x03;
+ dev->mii.supports_gmii = 1;
+
+ start_chip(dev);
return 0;
}
@@ -1529,90 +1559,12 @@ static int ax88179_reset(struct usbnet *dev)
u8 buf[5];
u16 *tmp16;
u8 *tmp;
- struct ax88179_data *ax179_data = (struct ax88179_data *)dev->data;
- struct ethtool_eee eee_data;
tmp16 = (u16 *)buf;
tmp = (u8 *)buf;
- /* Power up ethernet PHY */
- *tmp16 = 0;
- ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, tmp16);
-
- *tmp16 = AX_PHYPWR_RSTCTL_IPRL;
- ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, tmp16);
- msleep(200);
-
- *tmp = AX_CLK_SELECT_ACS | AX_CLK_SELECT_BCS;
- ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, tmp);
- msleep(100);
-
- /* Ethernet PHY Auto Detach*/
- ax88179_auto_detach(dev, 0);
-
- ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN, ETH_ALEN,
- dev->net->dev_addr);
- memcpy(dev->net->perm_addr, dev->net->dev_addr, ETH_ALEN);
-
- /* RX bulk configuration */
- memcpy(tmp, &AX88179_BULKIN_SIZE[0], 5);
- ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_BULKIN_QCTRL, 5, 5, tmp);
-
- dev->rx_urb_size = 1024 * 20;
-
- *tmp = 0x34;
- ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PAUSE_WATERLVL_LOW, 1, 1, tmp);
-
- *tmp = 0x52;
- ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PAUSE_WATERLVL_HIGH,
- 1, 1, tmp);
-
- dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
- NETIF_F_RXCSUM;
-
- dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
- NETIF_F_RXCSUM;
-
- /* Enable checksum offload */
- *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP |
- AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6;
- ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RXCOE_CTL, 1, 1, tmp);
-
- *tmp = AX_TXCOE_IP | AX_TXCOE_TCP | AX_TXCOE_UDP |
- AX_TXCOE_TCPV6 | AX_TXCOE_UDPV6;
- ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, tmp);
-
- /* Configure RX control register => start operation */
- *tmp16 = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_IPE | AX_RX_CTL_START |
- AX_RX_CTL_AP | AX_RX_CTL_AMALL | AX_RX_CTL_AB;
- ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, tmp16);
-
- *tmp = AX_MONITOR_MODE_PMETYPE | AX_MONITOR_MODE_PMEPOL |
- AX_MONITOR_MODE_RWMP;
- ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MONITOR_MOD, 1, 1, tmp);
-
- /* Configure default medium type => giga */
- *tmp16 = AX_MEDIUM_RECEIVE_EN | AX_MEDIUM_TXFLOW_CTRLEN |
- AX_MEDIUM_RXFLOW_CTRLEN | AX_MEDIUM_FULL_DUPLEX |
- AX_MEDIUM_GIGAMODE;
- ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
- 2, 2, tmp16);
-
- ax88179_led_setting(dev);
-
- ax179_data->eee_enabled = 0;
- ax179_data->eee_active = 0;
-
- ax88179_disable_eee(dev);
-
- ax88179_ethtool_get_eee(dev, &eee_data);
- eee_data.advertised = 0;
- ax88179_ethtool_set_eee(dev, &eee_data);
-
- /* Restart autoneg */
- mii_nway_restart(&dev->mii);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Patch v1] ax88179_178a: add reset functionality in reset_resume
@ 2015-06-21 6:16 Vivek Bhagat
[not found] ` <CA+vmRF7nC2Ndzzt+QRj2YG7yQEtHw=3ZBuNBCqyM7nqErFoU-g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Vivek Bhagat @ 2015-06-21 6:16 UTC (permalink / raw)
To: netdev, linux-usb
Without reset functionality in reset_resume, iperf connection does not
establish after suspend/resume however ping works at the same time.
iperf connection fails with wrong checksum error shown by tcpdump.
reset function inside reset_resume solves above bug. We have verified
this issue on ASIX based ST Lab, Cadyce dongle.
Signed-off-by: Vivek Kumar Bhagat <vivek.bhagat@samsung.com>
Signed-off-by: Praveen Kumar <praveen.k09@samsung.com>
---
drivers/net/usb/ax88179_178a.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index e6338c1..00928c0 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1630,6 +1630,18 @@ static int ax88179_stop(struct usbnet *dev)
return 0;
}
+static int ax88179_reset_resume(struct usb_interface *intf)
+{
+ struct usbnet *dev = usb_get_intfdata(intf);
+ int ret;
+
+ ret = ax88179_reset(dev);
+ if (ret < 0)
+ return ret;
+
+ return ax88179_resume(intf);
+}
+
static const struct driver_info ax88179_info = {
.description = "ASIX AX88179 USB 3.0 Gigabit Ethernet",
.bind = ax88179_bind,
@@ -1744,7 +1756,7 @@ static struct usb_driver ax88179_178a_driver = {
.probe = usbnet_probe,
.suspend = ax88179_suspend,
.resume = ax88179_resume,
- .reset_resume = ax88179_resume,
+ .reset_resume = ax88179_reset_resume,
.disconnect = usbnet_disconnect,
.supports_autosuspend = 1,
.disable_hub_initiated_lpm = 1,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-23 13:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-21 6:11 [Patch v1] ax88179_178a: add reset functionality in reset_resume Vivek Bhagat
2015-06-23 13:41 ` David Miller
2015-06-21 6:16 Vivek Bhagat
[not found] ` <CA+vmRF7nC2Ndzzt+QRj2YG7yQEtHw=3ZBuNBCqyM7nqErFoU-g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-22 10:33 ` Oliver Neukum
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.