From patchwork Thu Apr 19 14:32:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Elwell X-Patchwork-Id: 901234 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=raspberrypi.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=raspberrypi.org header.i=@raspberrypi.org header.b="cop6sTFD"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi-org.20150623.gappssmtp.com header.i=@raspberrypi-org.20150623.gappssmtp.com header.b="JUCc/Sgn"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40RhLV4FYyz9s2M for ; Fri, 20 Apr 2018 00:33:38 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752848AbeDSOdW (ORCPT ); Thu, 19 Apr 2018 10:33:22 -0400 Received: from mx07-00252a01.pphosted.com ([62.209.51.214]:15727 "EHLO mx07-00252a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752838AbeDSOcW (ORCPT ); Thu, 19 Apr 2018 10:32:22 -0400 Received: from pps.filterd (m0102628.ppops.net [127.0.0.1]) by mx07-00252a01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3JENEuJ013229 for ; Thu, 19 Apr 2018 15:32:21 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp; bh=mmNUTqdrhxd56nihAZs/bUCP5Q/ZqHW0uhTUY85/Bms=; b=cop6sTFDHU/LuyuJ6aBkb9EXMU5mnhUh+fdbXuB7VoMnGcoMfhtdWG5iJBgFoKKpjTXp Nd151VoY62IWG5DZYUqhBPWppU/AJFHS1mYoeXDZMnaA+HJLmdJHJp2RVf+CJJTEP3FV papYoieCX9STDF1pDMix9Ds9qydjnZZK2FXEm4kNZjdOGZr0bJYXadRw5iiivVPU6kzy rqijr0XVDxj7+v+vjsVEhkysyxAunuLJ+bOcKnn2iVmowLa4OBEtOi/PVjiUjUscFe3L peZcYGQBBV3Xlh2huxt3AWYmG+L6ZTSKpyo3bcbl2E7rOxcSnTUzTBJGoUxQl2keutrs YA== Received: from mail-wr0-f200.google.com (mail-wr0-f200.google.com [209.85.128.200]) by mx07-00252a01.pphosted.com with ESMTP id 2hdrya8wwg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Thu, 19 Apr 2018 15:32:21 +0100 Received: by mail-wr0-f200.google.com with SMTP id o8-v6so5262603wra.12 for ; Thu, 19 Apr 2018 07:32:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mmNUTqdrhxd56nihAZs/bUCP5Q/ZqHW0uhTUY85/Bms=; b=JUCc/Sgnb+eQsTXHTSvtUrUYikqPcDaTI7QhO/R6xbSp6ypaoC5dWcDoX6S/5RL5WN /igtfm2coun78mofjau4oDboYAHhla+ar0n3rlCafIEainHV2yeEhpFA6Ezi37VArzdf yvFkYNN01G5Cz+rQakk1FiMYpBvCkG2xcvpl3FSZVd5bR4YnBwe+7jsDoWgtW4aRkTr+ mtfs5YortqDyJPSIJo1nebQ2S7UcNlXbuIByNSbzbJwOR3rU6kvdWr38UC3qootCbwBa jT+qEUhxmuMvL1ldB11mwtWFAXeUjIvXjLAq0Kl6QxfmjFG+1++6m9/mTrjlrsTGqusz 8K3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mmNUTqdrhxd56nihAZs/bUCP5Q/ZqHW0uhTUY85/Bms=; b=Zd6QPcYQ6ERfyOLeexjWMCD6/GE7miZrQmN/WNB8iV/iVt9lDErq58Az7LMj+vDILE OtBdHboBoZyJ4wS/3oibcnPTpDvsqWKCfzyaGJ+IEoT78ndOMXYLlq9Zx7y6C5qTSgVy jE5w1q2F4RCRbqkQaKjIlZqQ3jndhGkUmDkXVnXYQtoB95bc8atOgnEIMjvycYtI7X0U J9e3J66nbbYeWdMgPLEjwfac/+0NV/LEahWyjAWCayoszPLqMLJQbJXQrLKIIPRsSDWF M0q40lyKInQfcsb0/oB9/uDKP4eJolHhwHuxC/uuPd98Lf2x6HGx2xcmDD4e9+jQqaDK qlJw== X-Gm-Message-State: ALQs6tAOTy65mxBUOtma5snGmBeXRo9mZ5T+4uJA/Vgr6reitRezn8z0 jVy/axrJ515U3HzDgFlXR1rgasLOpHWCvEy1TFyNqIYeLNXHz124W9D+UAcVHxgh383Ez2T5GaZ zHNbvCjM5O1MM19HiKE7bcQ== X-Received: by 10.28.196.139 with SMTP id u133mr5115823wmf.161.1524148340794; Thu, 19 Apr 2018 07:32:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+g2cJ15Ok+73siRrXzbdkRrPlWGXxrH6fv2yWfNfNCoojzjTAV0TjVtn1s/HMA/SzwC2VIPQ== X-Received: by 10.28.196.139 with SMTP id u133mr5115806wmf.161.1524148340429; Thu, 19 Apr 2018 07:32:20 -0700 (PDT) Received: from buildbot.pitowers.org ([2a00:2381:fdf7:14:3509:880e:14cc:3c11]) by smtp.gmail.com with ESMTPSA id i44-v6sm3465473wri.17.2018.04.19.07.32.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Apr 2018 07:32:19 -0700 (PDT) From: Phil Elwell To: Woojung Huh , Microchip Linux Driver Support , Rob Herring , Mark Rutland , "David S. Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Linus Walleij , Andrew Morton , Randy Dunlap , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: Phil Elwell Subject: [PATCH v3 2/3] lan78xx: Read LED states from Device Tree Date: Thu, 19 Apr 2018 15:32:04 +0100 Message-Id: <1524148325-78945-4-git-send-email-phil@raspberrypi.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524148325-78945-1-git-send-email-phil@raspberrypi.org> References: <1524148325-78945-1-git-send-email-phil@raspberrypi.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-19_05:, , signatures=0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add support for DT property "microchip,led-modes", a vector of zero to four cells (u32s) in the range 0-15, each of which sets the mode for one of the LEDs. Some possible values are: 0=link/activity 1=link1000/activity 2=link100/activity 3=link10/activity 4=link100/1000/activity 5=link10/1000/activity 6=link10/100/activity 14=off 15=on These values are given symbolic constants in a dt-bindings header. Also use the presence of the DT property to indicate that the LEDs should be enabled - necessary in the event that no valid OTP or EEPROM is available. Signed-off-by: Phil Elwell Reviewed-by: Andrew Lunn --- MAINTAINERS | 1 + drivers/net/phy/microchip.c | 25 ++++++++++++++++++++++ drivers/net/usb/lan78xx.c | 32 ++++++++++++++++++++++++++++- include/dt-bindings/net/microchip-lan78xx.h | 21 +++++++++++++++++++ include/linux/microchipphy.h | 3 +++ 5 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 include/dt-bindings/net/microchip-lan78xx.h diff --git a/MAINTAINERS b/MAINTAINERS index b60179d..23735d9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14573,6 +14573,7 @@ M: Microchip Linux Driver Support L: netdev@vger.kernel.org S: Maintained F: drivers/net/usb/lan78xx.* +F: include/dt-bindings/net/microchip-lan78xx.h USB MASS STORAGE DRIVER M: Alan Stern diff --git a/drivers/net/phy/microchip.c b/drivers/net/phy/microchip.c index 0f293ef..ef5e160 100644 --- a/drivers/net/phy/microchip.c +++ b/drivers/net/phy/microchip.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include #define DRIVER_AUTHOR "WOOJUNG HUH " #define DRIVER_DESC "Microchip LAN88XX PHY driver" @@ -70,6 +72,8 @@ static int lan88xx_probe(struct phy_device *phydev) { struct device *dev = &phydev->mdio.dev; struct lan88xx_priv *priv; + u32 led_modes[4]; + int len; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -77,6 +81,27 @@ static int lan88xx_probe(struct phy_device *phydev) priv->wolopts = 0; + len = of_property_read_variable_u32_array(dev->of_node, + "microchip,led-modes", + led_modes, + 0, + ARRAY_SIZE(led_modes)); + if (len >= 0) { + u32 reg = 0; + int i; + + for (i = 0; i < len; i++) { + if (led_modes[i] > 15) + return -EINVAL; + reg |= led_modes[i] << (i * 4); + } + for (; i < ARRAY_SIZE(led_modes); i++) + reg |= LAN78XX_FORCE_LED_OFF << (i * 4); + (void)phy_write(phydev, LAN78XX_PHY_LED_MODE_SELECT, reg); + } else if (len == -EOVERFLOW) { + return -EINVAL; + } + /* these values can be used to identify internal PHY */ priv->chip_id = phy_read_mmd(phydev, 3, LAN88XX_MMD3_CHIP_ID); priv->chip_rev = phy_read_mmd(phydev, 3, LAN88XX_MMD3_CHIP_REV); diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index a823f01..6b03b97 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include "lan78xx.h" @@ -1760,6 +1761,7 @@ static int lan78xx_mdiobus_write(struct mii_bus *bus, int phy_id, int idx, static int lan78xx_mdio_init(struct lan78xx_net *dev) { + struct device_node *node; int ret; dev->mdiobus = mdiobus_alloc(); @@ -1788,7 +1790,13 @@ static int lan78xx_mdio_init(struct lan78xx_net *dev) break; } - ret = mdiobus_register(dev->mdiobus); + node = of_get_child_by_name(dev->udev->dev.of_node, "mdio"); + if (node) { + ret = of_mdiobus_register(dev->mdiobus, node); + of_node_put(node); + } else { + ret = mdiobus_register(dev->mdiobus); + } if (ret) { netdev_err(dev->net, "can't register MDIO bus\n"); goto exit1; @@ -2077,6 +2085,28 @@ static int lan78xx_phy_init(struct lan78xx_net *dev) mii_adv = (u32)mii_advertise_flowctrl(dev->fc_request_control); phydev->advertising |= mii_adv_to_ethtool_adv_t(mii_adv); + if (phydev->mdio.dev.of_node) { + u32 reg; + int len; + + len = of_property_count_elems_of_size(phydev->mdio.dev.of_node, + "microchip,led-modes", + sizeof(u32)); + if (len >= 0) { + /* Ensure the appropriate LEDs are enabled */ + lan78xx_read_reg(dev, HW_CFG, ®); + reg &= ~(HW_CFG_LED0_EN_ | + HW_CFG_LED1_EN_ | + HW_CFG_LED2_EN_ | + HW_CFG_LED3_EN_); + reg |= (len > 0) * HW_CFG_LED0_EN_ | + (len > 1) * HW_CFG_LED1_EN_ | + (len > 2) * HW_CFG_LED2_EN_ | + (len > 3) * HW_CFG_LED3_EN_; + lan78xx_write_reg(dev, HW_CFG, reg); + } + } + genphy_config_aneg(phydev); dev->fc_autoneg = phydev->autoneg; diff --git a/include/dt-bindings/net/microchip-lan78xx.h b/include/dt-bindings/net/microchip-lan78xx.h new file mode 100644 index 0000000..0742ff0 --- /dev/null +++ b/include/dt-bindings/net/microchip-lan78xx.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _DT_BINDINGS_MICROCHIP_LAN78XX_H +#define _DT_BINDINGS_MICROCHIP_LAN78XX_H + +/* LED modes for LAN7800/LAN7850 embedded PHY */ + +#define LAN78XX_LINK_ACTIVITY 0 +#define LAN78XX_LINK_1000_ACTIVITY 1 +#define LAN78XX_LINK_100_ACTIVITY 2 +#define LAN78XX_LINK_10_ACTIVITY 3 +#define LAN78XX_LINK_100_1000_ACTIVITY 4 +#define LAN78XX_LINK_10_1000_ACTIVITY 5 +#define LAN78XX_LINK_10_100_ACTIVITY 6 +#define LAN78XX_DUPLEX_COLLISION 8 +#define LAN78XX_COLLISION 9 +#define LAN78XX_ACTIVITY 10 +#define LAN78XX_AUTONEG_FAULT 12 +#define LAN78XX_FORCE_LED_OFF 14 +#define LAN78XX_FORCE_LED_ON 15 + +#endif diff --git a/include/linux/microchipphy.h b/include/linux/microchipphy.h index eb492d4..8e4015e 100644 --- a/include/linux/microchipphy.h +++ b/include/linux/microchipphy.h @@ -70,4 +70,7 @@ #define LAN88XX_MMD3_CHIP_ID (32877) #define LAN88XX_MMD3_CHIP_REV (32878) +/* Registers specific to the LAN7800/LAN7850 embedded phy */ +#define LAN78XX_PHY_LED_MODE_SELECT (0x1D) + #endif /* _MICROCHIPPHY_H */ From patchwork Thu Apr 19 14:32:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Elwell X-Patchwork-Id: 901230 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=raspberrypi.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=raspberrypi.org header.i=@raspberrypi.org header.b="shDcZsAU"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi-org.20150623.gappssmtp.com header.i=@raspberrypi-org.20150623.gappssmtp.com header.b="Va8S0xDM"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40RhKB50fMz9s3D for ; Fri, 20 Apr 2018 00:32:30 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753170AbeDSOc1 (ORCPT ); Thu, 19 Apr 2018 10:32:27 -0400 Received: from mx08-00252a01.pphosted.com ([91.207.212.211]:54028 "EHLO mx08-00252a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753028AbeDSOcZ (ORCPT ); Thu, 19 Apr 2018 10:32:25 -0400 Received: from pps.filterd (m0102629.ppops.net [127.0.0.1]) by mx08-00252a01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3JEMqnU022547 for ; Thu, 19 Apr 2018 15:32:23 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp; bh=xSSD9SvLCvUPLV3TsLO9yFBlCax29EsDDiA9e9toJmo=; b=shDcZsAURJl9j5Qmij4o1DuWAePdxmR05Ktd35GzZ32KALSqeMJHcIDY1eXM+KXmEeW6 gYdeXuLj2tfm0i/EDbG1XstjaPKVS5y1CMfnZ1D/pBsxFCOI8honbLZFwVK1UdPMaW9I S2EE6ty9qIC2hzSYw2pJYWNfx0+8l/LuxMLXXNVHVb+JnOjd7HY0gKjGlbD5e4NjFXaA CcdLFzEFdbXFUifBwJEeqh1KKv9+LEkK6FxCkrFcOp6nnOGFvBq4TEAArnI7GEazYBvN EYRbf2BC6Jir23UZzJhWz91HQigravIBy/agrVWT9eNTNPI/UOMn3qKwSsiqw6Qi4Zfh iQ== Received: from mail-wr0-f198.google.com (mail-wr0-f198.google.com [209.85.128.198]) by mx08-00252a01.pphosted.com with ESMTP id 2hdry78wtu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Thu, 19 Apr 2018 15:32:23 +0100 Received: by mail-wr0-f198.google.com with SMTP id y10-v6so5468269wrg.9 for ; Thu, 19 Apr 2018 07:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xSSD9SvLCvUPLV3TsLO9yFBlCax29EsDDiA9e9toJmo=; b=Va8S0xDMUExnUhtXMWb8OHenp52JQUiI9G9/6TZ8H4Wca0/9e80yyqyqLOsA628TzP M2BXlGR27rkNiAIY6SyxyYqwPvXPrNf/b5jKAOGBBmnyLqz4fjJac8wzX4VwcrxdS+vF 4HTfV0stmQeg0Pyc1UqfLQQdjyn3b7ox6lDfC0S8BfFyvkQssZksffZ9Kzk9y5UzFL8p 6BFNjWMdXkVF6OgolEKvdg0LNvgGSs/IHS2bGG1jht/BEtvzVFWaSCc80ZcXkYVum3Qu CiCGI4ISGagB/P741CCfj4yE6PGftw1w8d7anzChGtW8jJBWlvin92u2v4tiikbl1nYJ jRkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xSSD9SvLCvUPLV3TsLO9yFBlCax29EsDDiA9e9toJmo=; b=Nh6N6env46+J1bAPatUSNFlPxnzDwlcVXSqLzLlo6Lt0TpnmpOEIODvihlslcThpgQ z4CeSZz4YTXy07KdBqwWBYlojlafJ1Qf85jVWFrhg3+2aRgWtCkjkcEJKLckXxkNJPFs wSw53LcUal4xAAWqdI2ZrH9ZwnnaUvbFjgYbpnJ5RDmyB6rZlVUoVdy+2Jv+A9bmpiaB EKLs4OF8yJ602WilWtptFlrhCdLjSvKuHj6WjuyRBe7827w6oUA+5knKK0x/zboSFD7v B5ZEtG/I/i7OISqPo65B+aqFSbyFquQYLb5diB2Gj2RC99LzfP2LxzV8SCNlDkeTmFsl LQAg== X-Gm-Message-State: ALQs6tDrJSpAlUlNW8IltJAjdftg6/wYUz388MsaDRwhZMQOhDDpYCJ6 0CZdQMUmn+DE7pCPKPGMR3XFl/HwPNn8eU3rgNZ62QPNHbai/+5W5ZFi1IrcenEnroGzKU+f+eZ F/OZRPGxq2a+JLpAqM6ReiQ== X-Received: by 10.28.179.196 with SMTP id c187mr4494317wmf.21.1524148342448; Thu, 19 Apr 2018 07:32:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx48e1M+GVXx8c1EAdGaNFWIS8H+JOZqY8nkd0lZVmZt/wyxoIr9T61y8e71d1AS8XJUHRen2EQ== X-Received: by 10.28.179.196 with SMTP id c187mr4494301wmf.21.1524148342179; Thu, 19 Apr 2018 07:32:22 -0700 (PDT) Received: from buildbot.pitowers.org ([2a00:2381:fdf7:14:3509:880e:14cc:3c11]) by smtp.gmail.com with ESMTPSA id i44-v6sm3465473wri.17.2018.04.19.07.32.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Apr 2018 07:32:20 -0700 (PDT) From: Phil Elwell To: Woojung Huh , Microchip Linux Driver Support , Rob Herring , Mark Rutland , "David S. Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Linus Walleij , Andrew Morton , Randy Dunlap , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: Phil Elwell Subject: [PATCH v3 3/3] dt-bindings: Document the DT bindings for lan78xx Date: Thu, 19 Apr 2018 15:32:05 +0100 Message-Id: <1524148325-78945-5-git-send-email-phil@raspberrypi.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524148325-78945-1-git-send-email-phil@raspberrypi.org> References: <1524148325-78945-1-git-send-email-phil@raspberrypi.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-19_05:, , signatures=0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The Microchip LAN78XX family of devices are Ethernet controllers with a USB interface. Despite being discoverable devices it can be useful to be able to configure them from Device Tree, particularly in low-cost applications without an EEPROM or programmed OTP. Document the supported properties in a bindings file. Signed-off-by: Phil Elwell Reviewed-by: Andrew Lunn --- .../devicetree/bindings/net/microchip,lan78xx.txt | 54 ++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 55 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/microchip,lan78xx.txt diff --git a/Documentation/devicetree/bindings/net/microchip,lan78xx.txt b/Documentation/devicetree/bindings/net/microchip,lan78xx.txt new file mode 100644 index 0000000..a5d701b --- /dev/null +++ b/Documentation/devicetree/bindings/net/microchip,lan78xx.txt @@ -0,0 +1,54 @@ +Microchip LAN78xx Gigabit Ethernet controller + +The LAN78XX devices are usually configured by programming their OTP or with +an external EEPROM, but some platforms (e.g. Raspberry Pi 3 B+) have neither. +The Device Tree properties, if present, override the OTP and EEPROM. + +Required properties: +- compatible: Should be one of "usb424,7800", "usb424,7801" or "usb424,7850". + +Optional properties: +- local-mac-address: see ethernet.txt +- mac-address: see ethernet.txt + +Optional properties of the embedded PHY: +- microchip,led-modes: a 0..4 element vector, with each element configuring + the operating mode of an LED. Omitted LEDs are turned off. Allowed values + are defined in "include/dt-bindings/net/microchip-lan78xx.h". + +Example: + +/* Based on the configuration for a Raspberry Pi 3 B+ */ +&usb { + usb1@1 { + compatible = "usb424,2514"; + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + usb1_1@1 { + compatible = "usb424,2514"; + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + ethernet: usbether@1 { + compatible = "usb424,7800"; + reg = <1>; + local-mac-address = [ 00 11 22 33 44 55 ]; + + mdio { + #address-cells = <0x1>; + #size-cells = <0x0>; + eth_phy: ethernet-phy@1 { + reg = <1>; + microchip,led-modes = < + LAN78XX_LINK_1000_ACTIVITY + LAN78XX_LINK_10_100_ACTIVITY + >; + }; + }; + }; + }; + }; +}; diff --git a/MAINTAINERS b/MAINTAINERS index 23735d9..91cb961 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14572,6 +14572,7 @@ M: Woojung Huh M: Microchip Linux Driver Support L: netdev@vger.kernel.org S: Maintained +F: Documentation/devicetree/bindings/net/microchip,lan78xx.txt F: drivers/net/usb/lan78xx.* F: include/dt-bindings/net/microchip-lan78xx.h