From patchwork Tue Sep 12 09:54:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 112259 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5665283edi; Tue, 12 Sep 2017 02:54:52 -0700 (PDT) X-Google-Smtp-Source: ADKCNb6VPq2TIxhcsPes42rB71mxdlNFY8iAOiJpe0hkpi+9XZzH3NAvEH0SDTejnQ25OK/QQ3eK X-Received: by 10.84.254.4 with SMTP id b4mr15948455plm.285.1505210092114; Tue, 12 Sep 2017 02:54:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210092; cv=none; d=google.com; s=arc-20160816; b=QK9iDDHJtbSGcpkLqFhYUnDNt/jV4joyVW1vWdedfmeaNWUHe+7ETfr3vj9733jbJF 1HGeI+8qImN+57lk4YREroDMijNPsEFYpvKwLlQuorpuCIO7zGLVP5y2IXSFCODAWRg9 0HWFShNSCbPoJaa42s4gZjfF3cb5mlCkmUtqbBhRAykBF3g63OPWaZQ6t+4hMMLboBrS x/nYygtTzpVLxbSRYcalwZDeRpulvqgQvLqnCPgWO4QvedtyPzkJC8oYz6eM6qB1s2b4 23e/RAwiHYPldnurvnMC1rYGtZbFYRjq7D1yEWg2QybbFys4GrzMKKphoi/ovJvIO9Tw 2bPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GBzbf4qWk6GgBAawo1kjW+d3w0rgOWwlNl7YWTJLR10=; b=S7xiMySUXck4ukz5GWhAQm7o6BqM6QwN4sgjB+y4E3zEt8puVfHba6d5uj/jck42R/ KpAikSdno3Zox380LAp4LcUfO2NGkMKJTwZvigyMovsdGFE0UXHuYcz8usC6SMLBAVAz JIK5Gu4ljAYFtWcrNVGPQUT2qtQ3sQFO5nPYDfxfcK8GcD15RZ0xOhN5j2Oo3+K7IrLH iFIiRV56CeSNYqwSND8yngeonSgYiCIWixmB+j8IRTEW4PT9N5QQA93GLAOQpa0qxgmU VC2UPnhomTg1RlFf5yv2u9LY01kfCbEEYdWLeu/W6bEFU6x9axFTmBi2EDkJKR3uNx4r Layg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e29si7711094pfl.586.2017.09.12.02.54.51; Tue, 12 Sep 2017 02:54:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751381AbdILJyr (ORCPT + 7 others); Tue, 12 Sep 2017 05:54:47 -0400 Received: from mx.socionext.com ([202.248.49.38]:35968 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751286AbdILJyq (ORCPT ); Tue, 12 Sep 2017 05:54:46 -0400 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 12 Sep 2017 18:54:45 +0900 Received: from mail.mfilter.local (unknown [10.213.24.62]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id DDE83610C6; Tue, 12 Sep 2017 18:54:45 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Tue, 12 Sep 2017 18:54:45 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id A1CBB1A0E11; Tue, 12 Sep 2017 18:54:45 +0900 (JST) From: Kunihiko Hayashi To: Andrew Lunn , Florian Fainelli , netdev@vger.kernel.org Cc: Jassi Brar , Kunihiko Hayashi Subject: [PATCH net-next v2 1/2] net: phy: realtek: rename RTL8211F_PAGE_SELECT to RTL821x_PAGE_SELECT Date: Tue, 12 Sep 2017 18:54:35 +0900 Message-Id: <1505210076-32311-1-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This renames the definition of page select register from RTL8211F_PAGE_SELECT to RTL821x_PAGE_SELECT to use it across models. Signed-off-by: Kunihiko Hayashi --- Changes since v1: - new patch in this series --- drivers/net/phy/realtek.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.7.4 Reviewed-by: Andrew Lunn diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 9cbe645..99c3297 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -22,11 +22,11 @@ #define RTL821x_INER 0x12 #define RTL821x_INER_INIT 0x6400 #define RTL821x_INSR 0x13 +#define RTL821x_PAGE_SELECT 0x1f #define RTL8211E_INER_LINK_STATUS 0x400 #define RTL8211F_INER_LINK_STATUS 0x0010 #define RTL8211F_INSR 0x1d -#define RTL8211F_PAGE_SELECT 0x1f #define RTL8211F_TX_DELAY 0x100 MODULE_DESCRIPTION("Realtek PHY driver"); @@ -46,10 +46,10 @@ static int rtl8211f_ack_interrupt(struct phy_device *phydev) { int err; - phy_write(phydev, RTL8211F_PAGE_SELECT, 0xa43); + phy_write(phydev, RTL821x_PAGE_SELECT, 0xa43); err = phy_read(phydev, RTL8211F_INSR); /* restore to default page 0 */ - phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0); + phy_write(phydev, RTL821x_PAGE_SELECT, 0x0); return (err < 0) ? err : 0; } @@ -102,7 +102,7 @@ static int rtl8211f_config_init(struct phy_device *phydev) if (ret < 0) return ret; - phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd08); + phy_write(phydev, RTL821x_PAGE_SELECT, 0xd08); reg = phy_read(phydev, 0x11); /* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */ @@ -114,7 +114,7 @@ static int rtl8211f_config_init(struct phy_device *phydev) phy_write(phydev, 0x11, reg); /* restore to default page 0 */ - phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0); + phy_write(phydev, RTL821x_PAGE_SELECT, 0x0); return 0; } From patchwork Tue Sep 12 09:54:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 112260 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5665329edi; Tue, 12 Sep 2017 02:54:56 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5fIOWEK1b2D0aB7NhCWlI3iYBpW1sInHciG2pDuoJ/0HU0yoRKFdvNN2db493NxP410YO6 X-Received: by 10.84.131.2 with SMTP id 2mr16232978pld.120.1505210096447; Tue, 12 Sep 2017 02:54:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210096; cv=none; d=google.com; s=arc-20160816; b=Q7rrQvygMHvn9f5ZhkcNIQAwpAzA28nsEepq8jInbo56r/4YsOngIIfKvKjMMh8+E1 f8nQT4X/IlfAsbs3OGdv4yeThegWe75uaPIpfv8/0PkoVV4+hHduehIduVi43kw3OAPG z6MYesfiT5KIWox2LRYkLKzOyreTw02nSz+KP4+YKytyWE4BNqHbmmLCMsus9gSr5P1B YLDJig4oFR2phizoDZhZ4bhplZb9r0GWJNhb6Kn8Pm6c7SsrjUZfDg449O5CNMPV97sX OkyI0FbW1h9PT2UFbXrKZdbvX4GLyisxhD2DV0UOEYFB4BpoFkJemK9ZklxnF50ITR2i HiLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=kUDYoCxi12GsEQTFFkCbUwJ0FnBaJyqYbP5WKnAZIbs=; b=mMx7C03H23S1wgWEZbBJeluN3DxPxzZTR/R9QsqZ40qd+BEIFR3COSVsFyHUrrHuBn sv7KgMrnJYX33qCygIR2iJT7h9H5ptA4dOaMGFrwoe4NQasU8USFc0bS469hPHgfvNKk gilxmVaTKVkwq1rl93YVo8lfhY3PdUiHQMlpXelA+xGqfsALfT2PvKL5ImyZZuGEqtaj Nm76gSg+YHFnSYADwDQlV4nKMnFGdj76B+r0wl2UxHa5j38E3DzUND35q25iyx2PqXdN yoCkDXtNiaWVPSvPAr6qfj6wdWmkt7R+vkEyMq3TYwsljScMZWuh49SUVVSI/HEq1E4g +zzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1si831941plb.289.2017.09.12.02.54.56; Tue, 12 Sep 2017 02:54:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751400AbdILJyv (ORCPT + 7 others); Tue, 12 Sep 2017 05:54:51 -0400 Received: from mx.socionext.com ([202.248.49.38]:35968 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751286AbdILJyu (ORCPT ); Tue, 12 Sep 2017 05:54:50 -0400 Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 12 Sep 2017 18:54:49 +0900 Received: from mail.mfilter.local (unknown [10.213.24.61]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id 8EB24180B90; Tue, 12 Sep 2017 18:54:49 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Tue, 12 Sep 2017 18:54:49 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id EDCA61A0E11; Tue, 12 Sep 2017 18:54:48 +0900 (JST) From: Kunihiko Hayashi To: Andrew Lunn , Florian Fainelli , netdev@vger.kernel.org Cc: Jassi Brar , Jongsung Kim , Kunihiko Hayashi Subject: [PATCH net-next v2 2/2] net: phy: realtek: add RTL8201F phy-id and functions Date: Tue, 12 Sep 2017 18:54:36 +0900 Message-Id: <1505210076-32311-2-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505210076-32311-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1505210076-32311-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jassi Brar Add RTL8201F phy-id and the related functions to the driver. The original patch is as follows: https://patchwork.kernel.org/patch/2538341/ Signed-off-by: Jongsung Kim Signed-off-by: Jassi Brar Signed-off-by: Kunihiko Hayashi Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli --- Changes since v1: - use RTL821x_PAGE_SELECT instead of defining RTL8201F_PAGE_SELECT --- drivers/net/phy/realtek.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) -- 2.7.4 diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 99c3297..d4670ec 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -29,10 +29,22 @@ #define RTL8211F_INSR 0x1d #define RTL8211F_TX_DELAY 0x100 +#define RTL8201F_ISR 0x1e +#define RTL8201F_IER 0x13 + MODULE_DESCRIPTION("Realtek PHY driver"); MODULE_AUTHOR("Johnson Leung"); MODULE_LICENSE("GPL"); +static int rtl8201_ack_interrupt(struct phy_device *phydev) +{ + int err; + + err = phy_read(phydev, RTL8201F_ISR); + + return (err < 0) ? err : 0; +} + static int rtl821x_ack_interrupt(struct phy_device *phydev) { int err; @@ -54,6 +66,25 @@ static int rtl8211f_ack_interrupt(struct phy_device *phydev) return (err < 0) ? err : 0; } +static int rtl8201_config_intr(struct phy_device *phydev) +{ + int err; + + /* switch to page 7 */ + phy_write(phydev, RTL821x_PAGE_SELECT, 0x7); + + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) + err = phy_write(phydev, RTL8201F_IER, + BIT(13) | BIT(12) | BIT(11)); + else + err = phy_write(phydev, RTL8201F_IER, 0); + + /* restore to default page 0 */ + phy_write(phydev, RTL821x_PAGE_SELECT, 0x0); + + return err; +} + static int rtl8211b_config_intr(struct phy_device *phydev) { int err; @@ -129,6 +160,18 @@ static struct phy_driver realtek_drvs[] = { .config_aneg = &genphy_config_aneg, .read_status = &genphy_read_status, }, { + .phy_id = 0x001cc816, + .name = "RTL8201F 10/100Mbps Ethernet", + .phy_id_mask = 0x001fffff, + .features = PHY_BASIC_FEATURES, + .flags = PHY_HAS_INTERRUPT, + .config_aneg = &genphy_config_aneg, + .read_status = &genphy_read_status, + .ack_interrupt = &rtl8201_ack_interrupt, + .config_intr = &rtl8201_config_intr, + .suspend = genphy_suspend, + .resume = genphy_resume, + }, { .phy_id = 0x001cc912, .name = "RTL8211B Gigabit Ethernet", .phy_id_mask = 0x001fffff, @@ -181,6 +224,7 @@ static struct phy_driver realtek_drvs[] = { module_phy_driver(realtek_drvs); static struct mdio_device_id __maybe_unused realtek_tbl[] = { + { 0x001cc816, 0x001fffff }, { 0x001cc912, 0x001fffff }, { 0x001cc914, 0x001fffff }, { 0x001cc915, 0x001fffff },