{"id":816890,"url":"http://patchwork.ozlabs.org/api/patches/816890/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1506003760-34739-1-git-send-email-david.wu@rock-chips.com/","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":"<1506003760-34739-1-git-send-email-david.wu@rock-chips.com>","list_archive_url":null,"date":"2017-09-21T14:22:40","name":"[U-Boot,5/6] net: gmac_rockchip: Use the proerty of \"clock_in_out\" to set mac clock","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"5f0c8bf4b319a4632f3b752a931d519ac9c6ac3c","submitter":{"id":68083,"url":"http://patchwork.ozlabs.org/api/people/68083/?format=json","name":"David Wu","email":"david.wu@rock-chips.com"},"delegate":{"id":69486,"url":"http://patchwork.ozlabs.org/api/users/69486/?format=json","username":"ptomsich","first_name":"Philipp","last_name":"Tomsich","email":"philipp.tomsich@theobroma-systems.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1506003760-34739-1-git-send-email-david.wu@rock-chips.com/mbox/","series":[{"id":4397,"url":"http://patchwork.ozlabs.org/api/series/4397/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=4397","date":"2017-09-21T14:17:45","name":"Add gmac support for rk3399-evb and rv1108-evb","version":1,"mbox":"http://patchwork.ozlabs.org/series/4397/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816890/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816890/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 3xyf3v6hlBz9s2G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 00:23:39 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 7D959C21E76; Thu, 21 Sep 2017 14:23:27 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 65950C21E0A;\n\tThu, 21 Sep 2017 14:23:25 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid B3EBBC21E26; Thu, 21 Sep 2017 14:23:23 +0000 (UTC)","from lucky1.263xmail.com (lucky1.263xmail.com [211.157.147.133])\n\tby lists.denx.de (Postfix) with ESMTPS id 5C71EC21E0A\n\tfor <u-boot@lists.denx.de>; Thu, 21 Sep 2017 14:23:22 +0000 (UTC)","from david.wu?rock-chips.com (unknown [192.168.167.138])\n\tby lucky1.263xmail.com (Postfix) with ESMTP id 7276E8F9B6;\n\tThu, 21 Sep 2017 22:23:17 +0800 (CST)","from localhost.localdomain (localhost [127.0.0.1])\n\tby smtp.263.net (Postfix) with ESMTPA id 25E49308;\n\tThu, 21 Sep 2017 22:23:18 +0800 (CST)","from localhost.localdomain (unknown [58.22.7.114])\n\tby smtp.263.net (Postfix) whith ESMTP id 27132YATEX9;\n\tThu, 21 Sep 2017 22:23:19 +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=3.0 required=5.0 tests=RCVD_IN_MSPIKE_BL,\n\tRCVD_IN_MSPIKE_L5,RCVD_IN_SORBS_WEB autolearn=no autolearn_force=no\n\tversion=3.4.0","X-263anti-spam":"KSV:0;","X-MAIL-GRAY":"1","X-MAIL-DELIVERY":"0","X-KSVirus-check":"0","X-ABS-CHECKED":"4","X-RL-SENDER":"david.wu@rock-chips.com","X-FST-TO":"philipp.tomsich@theobroma-systems.com","X-SENDER-IP":"58.22.7.114","X-LOGIN-NAME":"david.wu@rock-chips.com","X-UNIQUE-TAG":"<a2fe0677fcfb383a0b686e2d25b66315>","X-ATTACHMENT-NUM":"0","X-SENDER":"wdc@rock-chips.com","X-DNS-TYPE":"0","From":"David Wu <david.wu@rock-chips.com>","To":"philipp.tomsich@theobroma-systems.com,\n\tsjg@chromium.org","Date":"Thu, 21 Sep 2017 22:22:40 +0800","Message-Id":"<1506003760-34739-1-git-send-email-david.wu@rock-chips.com>","X-Mailer":"git-send-email 2.7.4","In-Reply-To":"<1506003471-34551-1-git-send-email-david.wu@rock-chips.com>","References":"<1506003471-34551-1-git-send-email-david.wu@rock-chips.com>","Cc":"huangtao@rock-chips.com, u-boot@lists.denx.de,\n\tDavid Wu <david.wu@rock-chips.com>, andy.yan@rock-chips.com,\n\tchenjh@rock-chips.com","Subject":"[U-Boot] [PATCH 5/6] net: gmac_rockchip: Use the proerty of\n\t\"clock_in_out\" to set mac clock","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":"If the mac clock if from the external IO, set clock rate with 0;\nIf the mac clock if from the internal divider pll, set 50M for\nrmii mode and set 125M for rgmii.\n\nSigned-off-by: David Wu <david.wu@rock-chips.com>\n---\n\n drivers/net/gmac_rockchip.c | 23 +++++++++++++++++++----\n 1 file changed, 19 insertions(+), 4 deletions(-)","diff":"diff --git a/drivers/net/gmac_rockchip.c b/drivers/net/gmac_rockchip.c\nindex 5f8f0cd..26f7a96 100644\n--- a/drivers/net/gmac_rockchip.c\n+++ b/drivers/net/gmac_rockchip.c\n@@ -29,6 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;\n struct gmac_rockchip_platdata {\n \tstruct dw_eth_pdata dw_eth_pdata;\n \tvoid *grf;\n+\tint clk_in;\n \tint tx_delay;\n \tint rx_delay;\n };\n@@ -64,6 +65,8 @@ static int gmac_rockchip_ofdata_to_platdata(struct udevice *dev)\n {\n \tstruct gmac_rockchip_platdata *pdata = dev_get_platdata(dev);\n \n+\tpdata->clk_in = dev_read_u32_default(dev, \"clock_in_out\", 1);\n+\n \t/* Check the new naming-style first... */\n \tpdata->tx_delay = dev_read_u32_default(dev, \"tx_delay\", -ENOENT);\n \tpdata->rx_delay = dev_read_u32_default(dev, \"rx_delay\", -ENOENT);\n@@ -294,6 +297,8 @@ static int gmac_rockchip_probe(struct udevice *dev)\n \tstruct gmac_rockchip_platdata *pdata = dev_get_platdata(dev);\n \tstruct gmac_rockchip_driver_data *data =\n \t\t(struct gmac_rockchip_driver_data *)dev_get_driver_data(dev);\n+\tstruct dw_eth_pdata *dw_pdata = dev_get_platdata(dev);\n+\tstruct eth_pdata *eth_pdata = &dw_pdata->eth_pdata;\n \tconst struct rk_gmac_ops *ops = data->ops;\n \tstruct clk clk;\n \tint ret;\n@@ -302,10 +307,20 @@ static int gmac_rockchip_probe(struct udevice *dev)\n \tif (ret)\n \t\treturn ret;\n \n-\t/* Since mac_clk is fed by an external clock we can use 0 here */\n-\tret = clk_set_rate(&clk, 0);\n-\tif (ret)\n-\t\treturn ret;\n+\tif (pdata->clk_in) {\n+\t\t/*\n+\t\t * Since mac_clk is fed by an external clock\n+\t\t * we can use 0 here.\n+\t\t */\n+\t\tret = clk_set_rate(&clk, 0);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t} else {\n+\t\tif (eth_pdata->phy_interface == PHY_INTERFACE_MODE_RGMII)\n+\t\t\tclk_set_rate(&clk, 125000000);\n+\t\telse\n+\t\t\tclk_set_rate(&clk, 50000000);\n+\t}\n \n \tpdata->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF) +\n \t\t     data->grf_offset;\n","prefixes":["U-Boot","5/6"]}