{"id":817350,"url":"http://patchwork.ozlabs.org/api/patches/817350/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170922072635.32105-7-wens@csie.org/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170922072635.32105-7-wens@csie.org>","list_archive_url":null,"date":"2017-09-22T07:26:32","name":"[U-Boot,6/9] net: sun8i_emac: Support RX/TX delay chains","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"8bd3b674df3e3e2ee962729d76740d2ed005a9e4","submitter":{"id":47154,"url":"http://patchwork.ozlabs.org/api/people/47154/?format=json","name":"Chen-Yu Tsai","email":"wens@csie.org"},"delegate":{"id":17739,"url":"http://patchwork.ozlabs.org/api/users/17739/?format=json","username":"jagan","first_name":"Jagannadha Sutradharudu","last_name":"Teki","email":"jagannadh.teki@gmail.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170922072635.32105-7-wens@csie.org/mbox/","series":[{"id":4550,"url":"http://patchwork.ozlabs.org/api/series/4550/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=4550","date":"2017-09-22T07:26:29","name":"sunxi: A83T improvements","version":1,"mbox":"http://patchwork.ozlabs.org/series/4550/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/817350/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/817350/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xz4tQ3clcz9sNc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 17:31:58 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 47D5DC21E4A; Fri, 22 Sep 2017 07:28:35 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id C5B85C21F7B;\n\tFri, 22 Sep 2017 07:26:59 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 75F13C21E13; Fri, 22 Sep 2017 07:26:51 +0000 (UTC)","from wens.csie.org (mirror2.csie.ntu.edu.tw [140.112.30.76])\n\tby lists.denx.de (Postfix) with ESMTPS id E1C9AC21C26\n\tfor <u-boot@lists.denx.de>; Fri, 22 Sep 2017 07:26:46 +0000 (UTC)","by wens.csie.org (Postfix, from userid 1000)\n\tid C731260097; Fri, 22 Sep 2017 15:26:36 +0800 (CST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=none autolearn=unavailable\n\tautolearn_force=no version=3.4.0","From":"Chen-Yu Tsai <wens@csie.org>","To":"u-boot@lists.denx.de","Date":"Fri, 22 Sep 2017 15:26:32 +0800","Message-Id":"<20170922072635.32105-7-wens@csie.org>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170922072635.32105-1-wens@csie.org>","References":"<20170922072635.32105-1-wens@csie.org>","Cc":"Joe Hershberger <joe.hershberger@ni.com>, Jagan Teki <jagan@openedev.com>,\n\tMaxime Ripard <maxime.ripard@free-electrons.com>","Subject":"[U-Boot] [PATCH 6/9] net: sun8i_emac: Support RX/TX delay chains","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"The EMAC syscon has configurable RX/TX delay chains for use with RGMII\nPHYs.\n\nThis adds support for configuring them via device tree properties. The\nproperty names and format were defined in Linux's dwmac-sun8i binding\nthat was merged at one point.\n\nSigned-off-by: Chen-Yu Tsai <wens@csie.org>\n---\n drivers/net/sun8i_emac.c | 25 +++++++++++++++++++++++++\n 1 file changed, 25 insertions(+)","diff":"diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c\nindex 09bbb2cdb5ca..5fa1b4c170d7 100644\n--- a/drivers/net/sun8i_emac.c\n+++ b/drivers/net/sun8i_emac.c\n@@ -56,6 +56,10 @@\n #define H3_EPHY_SELECT\t\tBIT(15) /* 1: internal PHY, 0: external PHY */\n \n #define SC_RMII_EN\t\tBIT(13)\n+#define SC_TXDC_SHIFT\t\t10\n+#define SC_TXDC_MASK\t\tGENMASK(2, 0)\n+#define SC_RXDC_SHIFT\t\t5\n+#define SC_RXDC_MASK\t\tGENMASK(4, 0)\n #define SC_EPIT\t\t\tBIT(2) /* 1: RGMII, 0: MII */\n #define SC_ETCS_MASK\t\tGENMASK(1, 0)\n #define SC_ETCS_EXT_GMII\t0x1\n@@ -125,6 +129,8 @@ struct emac_eth_dev {\n \tu32 addr;\n \tu32 tx_slot;\n \tbool use_internal_phy;\n+\tu32 tx_delay;\n+\tu32 rx_delay;\n \n \tenum emac_variant variant;\n \tvoid *mac_reg;\n@@ -290,6 +296,12 @@ static int sun8i_emac_set_syscon(struct emac_eth_dev *priv)\n \tif (priv->variant == H3_EMAC || priv->variant == A64_EMAC)\n \t\treg &= ~SC_RMII_EN;\n \n+\t/* Configure RX/TX delay chains */\n+\treg &= ~(SC_RXDC_MASK << SC_RXDC_SHIFT);\n+\treg &= ~(SC_TXDC_MASK << SC_TXDC_SHIFT);\n+\treg |= (priv->rx_delay & SC_RXDC_MASK) << SC_RXDC_SHIFT;\n+\treg |= (priv->tx_delay & SC_TXDC_MASK) << SC_TXDC_SHIFT;\n+\n \tswitch (priv->interface) {\n \tcase PHY_INTERFACE_MODE_MII:\n \t\t/* default */\n@@ -836,6 +848,19 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)\n \t}\n #endif\n \n+\t/* Get RX/TX delays for RGMII */\n+\tpriv->rx_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),\n+\t\t\t\t\t \"allwinner,rx-delay-ps\", 0);\n+\tif (priv->rx_delay % 100 || priv->rx_delay > 3100)\n+\t\tdebug(\"%s: invalid rx delay value\\n\", __func__);\n+\tpriv->rx_delay /= 100;\n+\n+\tpriv->tx_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),\n+\t\t\t\t\t \"allwinner,tx-delay-ps\", 0);\n+\tif (priv->tx_delay % 100 || priv->tx_delay > 800)\n+\t\tdebug(\"%s: invalid tx delay value\\n\", __func__);\n+\tpriv->tx_delay /= 100;\n+\n \treturn 0;\n }\n \n","prefixes":["U-Boot","6/9"]}