Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/810505/?format=api
{ "id": 810505, "url": "http://patchwork.ozlabs.org/api/patches/810505/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/CE371C1263339941885964188A0225FA333381@CHN-SV-EXMX03.mchp-main.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<CE371C1263339941885964188A0225FA333381@CHN-SV-EXMX03.mchp-main.com>", "list_archive_url": null, "date": "2017-09-06T10:51:44", "name": "[net,2/4] lan78xx: Add fixed_phy device support for LAN7801 device", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "b42589e127014937224111c3e566e129c5463e13", "submitter": { "id": 71648, "url": "http://patchwork.ozlabs.org/api/people/71648/?format=api", "name": "Nisar Sayed", "email": "Nisar.Sayed@microchip.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/CE371C1263339941885964188A0225FA333381@CHN-SV-EXMX03.mchp-main.com/mbox/", "series": [ { "id": 1761, "url": "http://patchwork.ozlabs.org/api/series/1761/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=1761", "date": "2017-09-06T10:49:39", "name": "lan78xx: Fixes and Enhancements to lan78xx driver", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1761/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/810505/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810505/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xnL4h6mn1z9s3T\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 6 Sep 2017 20:52:04 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753005AbdIFKwC convert rfc822-to-8bit (ORCPT\n\t<rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 6 Sep 2017 06:52:02 -0400", "from esa1.microchip.iphmx.com ([68.232.147.91]:1468 \"EHLO\n\tesa1.microchip.iphmx.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752734AbdIFKwB (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 6 Sep 2017 06:52:01 -0400", "from smtpout.microchip.com (HELO email.microchip.com)\n\t([198.175.253.82])\n\tby esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA;\n\t06 Sep 2017 03:51:45 -0700", "from CHN-SV-EXMX03.mchp-main.com ([fe80::58f5:b949:4b1:3df4]) by\n\tCHN-SV-EXCH06.mchp-main.com ([fe80::5404:4dc9:559:e436%16]) with mapi\n\tid 14.03.0352.000; Wed, 6 Sep 2017 03:51:45 -0700" ], "X-IronPort-AV": "E=Sophos;i=\"5.41,483,1498546800\"; d=\"scan'208\";a=\"7142147\"", "From": "<Nisar.Sayed@microchip.com>", "To": "<davem@davemloft.net>, <UNGLinuxDriver@microchip.com>", "CC": "<netdev@vger.kernel.org>", "Subject": "[PATCH net 2/4] lan78xx: Add fixed_phy device support for LAN7801\n\tdevice", "Thread-Topic": "[PATCH net 2/4] lan78xx: Add fixed_phy device support for\n\tLAN7801 device", "Thread-Index": "AdMm/LZOqnS7B9DcRRKnIfFx0SYr9g==", "Date": "Wed, 6 Sep 2017 10:51:44 +0000", "Message-ID": "<CE371C1263339941885964188A0225FA333381@CHN-SV-EXMX03.mchp-main.com>", "Accept-Language": "en-US", "Content-Language": "en-US", "X-MS-Has-Attach": "", "X-MS-TNEF-Correlator": "", "x-originating-ip": "[10.10.215.90]", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "8BIT", "MIME-Version": "1.0", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "From: Nisar Sayed <Nisar.Sayed@microchip.com>\n\nAdd fixed_phy device support for LAN7801 device\n\nWhen LAN7801 device connected to PHY Device which does not have\nMDIO/MDC access, fixex_phy device will be added.\n\nSigned-off-by: Nisar Sayed <Nisar.Sayed@microchip.com>\n---\n drivers/net/usb/Kconfig | 10 ++++++++\n drivers/net/usb/lan78xx.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++-\n 2 files changed, 68 insertions(+), 1 deletion(-)", "diff": "diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig\nindex f28bd74..34ef670 100644\n--- a/drivers/net/usb/Kconfig\n+++ b/drivers/net/usb/Kconfig\n@@ -123,6 +123,16 @@ config USB_LAN78XX\n \t To compile this driver as a module, choose M here: the\n \t module will be called lan78xx.\n \n+\tif USB_LAN78XX\n+\t \tconfig LAN7801_NO_MDIO_DEVICE\n+\t \tbool \"NO MDIO Device Support\"\n+\t \tselect FIXED_PHY\n+\t \t---help---\n+\t \tIf LAN7801 connected to a PHY device which does not\n+\t \thave MDIO/MDC access this option adds support to LAN7801\n+\t \twith fixed_phy support\n+\tendif\n+\n config USB_USBNET\n \ttristate \"Multi-purpose USB Networking Framework\"\n \tselect MII\ndiff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c\nindex 955ab3b..6242cb7 100644\n--- a/drivers/net/usb/lan78xx.c\n+++ b/drivers/net/usb/lan78xx.c\n@@ -30,6 +30,7 @@\n #include <linux/ipv6.h>\n #include <linux/mdio.h>\n #include <linux/phy.h>\n+#include <linux/phy_fixed.h>\n #include <net/ip6_checksum.h>\n #include <linux/interrupt.h>\n #include <linux/irqdomain.h>\n@@ -42,7 +43,7 @@\n #define DRIVER_AUTHOR\t\"WOOJUNG HUH <woojung.huh@microchip.com>\"\n #define DRIVER_DESC\t\"LAN78XX USB 3.0 Gigabit Ethernet Devices\"\n #define DRIVER_NAME\t\"lan78xx\"\n-#define DRIVER_VERSION\t\"1.0.6\"\n+#define DRIVER_VERSION\t\"1.0.7\"\n \n #define TX_TIMEOUT_JIFFIES\t\t(5 * HZ)\n #define THROTTLE_JIFFIES\t\t(HZ / 8)\n@@ -335,6 +336,7 @@ struct statstage {\n \tstruct lan78xx_statstage64\tcurr_stat;\n };\n \n+#ifndef CONFIG_LAN7801_NO_MDIO_DEVICE\n struct irq_domain_data {\n \tstruct irq_domain\t*irqdomain;\n \tunsigned int\t\tphyirq;\n@@ -343,6 +345,7 @@ struct irq_domain_data {\n \tu32\t\t\tirqenable;\n \tstruct mutex\t\tirq_lock;\t\t/* for irq bus access */\n };\n+#endif\n \n struct lan78xx_net {\n \tstruct net_device\t*net;\n@@ -401,7 +404,9 @@ struct lan78xx_net {\n \tint\t\t\tdelta;\n \tstruct statstage\tstats;\n \n+#ifndef CONFIG_LAN7801_NO_MDIO_DEVICE\n \tstruct irq_domain_data\tdomain_data;\n+#endif\n };\n \n /* define external phy id */\n@@ -1169,6 +1174,9 @@ static int lan78xx_link_reset(struct lan78xx_net *dev)\n \t\tret = lan78xx_write_reg(dev, MAC_CR, buf);\n \t\tif (unlikely(ret < 0))\n \t\t\treturn -EIO;\n+#ifdef CONFIG_LAN7801_NO_MDIO_DEVICE\n+\t\tphy_mac_interrupt(phydev, 0);\n+#endif\n \n \t\tdel_timer(&dev->stat_monitor);\n \t} else if (phydev->link && !dev->link_on) {\n@@ -1209,6 +1217,9 @@ static int lan78xx_link_reset(struct lan78xx_net *dev)\n \n \t\tret = lan78xx_update_flowcontrol(dev, ecmd.base.duplex, ladv,\n \t\t\t\t\t\t radv);\n+#ifdef CONFIG_LAN7801_NO_MDIO_DEVICE\n+\t\tphy_mac_interrupt(phydev, 1);\n+#endif\n \n \t\tif (!timer_pending(&dev->stat_monitor)) {\n \t\t\tdev->delta = 1;\n@@ -1249,8 +1260,10 @@ static void lan78xx_status(struct lan78xx_net *dev, struct urb *urb)\n \t\tnetif_dbg(dev, link, dev->net, \"PHY INTR: 0x%08x\\n\", intdata);\n \t\tlan78xx_defer_kevent(dev, EVENT_LINK_RESET);\n \n+#ifndef CONFIG_LAN7801_NO_MDIO_DEVICE\n \t\tif (dev->domain_data.phyirq > 0)\n \t\t\tgeneric_handle_irq(dev->domain_data.phyirq);\n+#endif\n \t} else\n \t\tnetdev_warn(dev->net,\n \t\t\t \"unexpected interrupt: 0x%08x\\n\", intdata);\n@@ -1825,6 +1838,7 @@ static void lan78xx_link_status_change(struct net_device *net)\n \t}\n }\n \n+#ifndef CONFIG_LAN7801_NO_MDIO_DEVICE\n static int irq_map(struct irq_domain *d, unsigned int irq,\n \t\t irq_hw_number_t hwirq)\n {\n@@ -1945,6 +1959,7 @@ static void lan78xx_remove_irq_domain(struct lan78xx_net *dev)\n \tdev->domain_data.phyirq = 0;\n \tdev->domain_data.irqdomain = NULL;\n }\n+#endif\n \n static int lan8835_fixup(struct phy_device *phydev)\n {\n@@ -1987,12 +2002,37 @@ static int ksz9031rnx_fixup(struct phy_device *phydev)\n \treturn 1;\n }\n \n+#ifdef CONFIG_LAN7801_NO_MDIO_DEVICE\n+static struct fixed_phy_status fphy_status = {\n+\t.link = 1,\n+\t.speed = SPEED_1000,\n+\t.duplex = DUPLEX_FULL,\n+};\n+#endif\n+\n static int lan78xx_phy_init(struct lan78xx_net *dev)\n {\n \tint ret;\n \tu32 mii_adv;\n \tstruct phy_device *phydev = dev->net->phydev;\n \n+#ifdef CONFIG_LAN7801_NO_MDIO_DEVICE\n+\tif (dev->chipid != ID_REV_CHIP_ID_7801_) {\n+\t\tnetdev_err(dev->net, \"Invalid chip id : %x\\n\", dev->chipid);\n+\t\treturn -EIO;\n+\t}\n+\tphydev = fixed_phy_register(PHY_POLL, &fphy_status,\n+\t\t\t\t -1, NULL);\n+\tif (IS_ERR(phydev)) {\n+\t\tnetdev_err(dev->net, \"LAN7801 Fixed PHY register failed\\n\");\n+\t\treturn -EIO;\n+\t}\n+\tnetdev_info(dev->net, \"LAN7801 fixed PHY registered\\n\");\n+\n+\tdev->interface = PHY_INTERFACE_MODE_RGMII;\n+\n+\tphydev->irq = PHY_IGNORE_INTERRUPT;\n+#else\n \tphydev = phy_find_first(dev->mdiobus);\n \tif (!phydev) {\n \t\tnetdev_err(dev->net, \"no PHY found\\n\");\n@@ -2041,6 +2081,7 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)\n \t\tphydev->irq = dev->domain_data.phyirq;\n \telse\n \t\tphydev->irq = 0;\n+#endif\n \tnetdev_dbg(dev->net, \"phydev->irq = %d\\n\", phydev->irq);\n \n \t/* set to AUTOMDIX */\n@@ -2053,8 +2094,10 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)\n \t\tnetdev_err(dev->net, \"can't attach PHY to %s\\n\",\n \t\t\t dev->mdiobus->id);\n \t\tret = -EIO;\n+#ifndef CONFIG_LAN7801_NO_MDIO_DEVICE\n \t\tif (dev->chipid == ID_REV_CHIP_ID_7801_)\n \t\t\tgoto error;\n+#endif\n \t\treturn ret;\n \t}\n \n@@ -2499,8 +2542,10 @@ static int lan78xx_open(struct net_device *net)\n \tif (ret < 0)\n \t\tgoto done;\n \n+#ifndef CONFIG_LAN7801_NO_MDIO_DEVICE\n \tif (dev->domain_data.phyirq > 0)\n \t\tphy_start_interrupts(dev->net->phydev);\n+#endif\n \tphy_start(dev->net->phydev);\n \n \t/* for Link Check */\n@@ -2563,8 +2608,10 @@ static int lan78xx_stop(struct net_device *net)\n \t\tdel_timer_sync(&dev->stat_monitor);\n \n \tif (net->phydev) {\n+#ifndef CONFIG_LAN7801_NO_MDIO_DEVICE\n \t\tif (dev->domain_data.phyirq > 0)\n \t\t\tphy_stop_interrupts(net->phydev);\n+#endif\n \t\tphy_stop(net->phydev);\n \t}\n \n@@ -2844,6 +2891,7 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)\n \n \tdev->net->hw_features = dev->net->features;\n \n+#ifndef CONFIG_LAN7801_NO_MDIO_DEVICE\n \tret = lan78xx_setup_irq_domain(dev);\n \tif (ret < 0) {\n \t\tnetdev_warn(dev->net,\n@@ -2851,6 +2899,7 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)\n \t\tkfree(pdata);\n \t\treturn ret;\n \t}\n+#endif\n \n \tdev->net->hard_header_len += TX_OVERHEAD;\n \tdev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;\n@@ -2871,8 +2920,10 @@ static void lan78xx_unbind(struct lan78xx_net *dev, struct usb_interface *intf)\n {\n \tstruct lan78xx_priv *pdata = (struct lan78xx_priv *)(dev->data[0]);\n \n+#ifndef CONFIG_LAN7801_NO_MDIO_DEVICE\n \tlan78xx_remove_irq_domain(dev);\n \n+#endif\n \tlan78xx_remove_mdio(dev);\n \n \tif (pdata) {\n@@ -3464,11 +3515,15 @@ static void lan78xx_disconnect(struct usb_interface *intf)\n \tudev = interface_to_usbdev(intf);\n \n \tnet = dev->net;\n+#ifdef CONFIG_LAN7801_NO_MDIO_DEVICE\n+\tfixed_phy_unregister(net->phydev);\n+#else\n \tif (dev->chipid == ID_REV_CHIP_ID_7801_) {\n \t\tphy_unregister_fixup_for_uid(PHY_KSZ9031RNX, 0xfffffff0);\n \t\tphy_unregister_fixup_for_uid(PHY_LAN8835, 0xfffffff0);\n \t}\n \tphy_disconnect(net->phydev);\n+#endif\n \tnet->phydev = NULL;\n \tunregister_netdev(net);\n \n@@ -3982,8 +4037,10 @@ static int lan78xx_reset_resume(struct usb_interface *intf)\n \n \tlan78xx_reset(dev);\n \n+#ifndef CONFIG_LAN7801_NO_MDIO_DEVICE\n \tif (dev->domain_data.phyirq > 0)\n \t\tphy_start_interrupts(dev->net->phydev);\n+#endif\n \tphy_start(dev->net->phydev);\n \n \treturn lan78xx_resume(intf);\n", "prefixes": [ "net", "2/4" ] }