From patchwork Fri Sep 8 13:02:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 112076 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp1579157ybm; Fri, 8 Sep 2017 06:02:40 -0700 (PDT) X-Google-Smtp-Source: ADKCNb6aRShwxNGLgIqf+r6ffYn+TmgTeL3aiMjDtQ8LO1xQfG6WvaToIZg/GAK9L5wrnlsVFVAD X-Received: by 10.84.131.2 with SMTP id 2mr3371288pld.120.1504875760587; Fri, 08 Sep 2017 06:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504875760; cv=none; d=google.com; s=arc-20160816; b=0BNJNzNLokoD31uO63tJC7pA/2jdL/7UojNHer9SfYVGUQVGwTnCa/w2/AKLxIrhnR SjHImvBErtvmFTaffY2OMBnG5BX43eXLc/XcaZqBgfO4N2hfW/a2vnZB57qLxm7wuP1X 8f+DSu1E0MylyjQ19pQAfJ9L1TIPxMcNITcjMUe52CQLLIhbHT5iHnelAGCIM4W3E93w Wlwn81Fl+AbVGskPhR+JfXOeSa+h5iY1UihpvadFuEdG3YEJivzgqFIETx0UKYGn8BpO PXnqOa2nLk6wkBfeg+mLlvIMTAR7rQxjhYz35cyOkFB3hFHJjlG+s9H0XGlmz6QpPnif AMhQ== 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=ap07eNkgFki/RIulFSflAyIlWfn6tlg3paYjI4f5G7g=; b=UOZUZ1NY9KCzcec4U/kY2G2gBGoYGYOrfSNmM5woucgBad6UG3W9ZhN1DazdkXOYSN yblnZ3O0CT+GDCtqlO9mEaVQy5uKmHfSA+fy7jWnvkd5LZGdyspuuHkPv4AhsYsYC+/M ex3QPmDKSxl78KDeih81lBSnToU9Z/mb4N9exSDXN2bI6TJ43nlTiSS7Z+QE16mnxlgB VPXK3FnJXL1M8zOYvmZ7hEROsumR/2MszWoU1dG8/pKLCLhtvaiheTjEuOEO1gOK9iGt T3tqS7bBR0q4b/zpisCYqSgnPtN6vzLn2PacBooSmtrMQjj/bOgqo+nwoXXkNh2lwexD 0+og== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 t63si1557404pfg.124.2017.09.08.06.02.40; Fri, 08 Sep 2017 06:02:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932418AbdIHNCi (ORCPT + 26 others); Fri, 8 Sep 2017 09:02:38 -0400 Received: from mx.socionext.com ([202.248.49.38]:38764 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932120AbdIHNCb (ORCPT ); Fri, 8 Sep 2017 09:02:31 -0400 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 08 Sep 2017 22:02:29 +0900 Received: from mail.mfilter.local (unknown [10.213.24.61]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id 2CE44610C6; Fri, 8 Sep 2017 22:02:30 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Fri, 8 Sep 2017 22:02:30 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id 83DE41A0E11; Fri, 8 Sep 2017 22:02:29 +0900 (JST) From: Kunihiko Hayashi To: netdev@vger.kernel.org, "David S. Miller" , Andrew Lunn , Florian Fainelli Cc: Rob Herring , Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Masahiro Yamada , Masami Hiramatsu , Jassi Brar , Jongsung Kim , Kunihiko Hayashi Subject: [PATCH net-next 3/3] net: phy: realtek: add RTL8201F phy-id and functions Date: Fri, 8 Sep 2017 22:02:11 +0900 Message-Id: <1504875731-3680-4-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504875731-3680-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1504875731-3680-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- drivers/net/phy/realtek.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) -- 2.7.4 Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 9cbe645..d9974ce 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -29,10 +29,23 @@ #define RTL8211F_PAGE_SELECT 0x1f #define RTL8211F_TX_DELAY 0x100 +#define RTL8201F_ISR 0x1e +#define RTL8201F_PAGE_SELECT 0x1f +#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 +67,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, RTL8201F_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, RTL8201F_PAGE_SELECT, 0x0); + + return err; +} + static int rtl8211b_config_intr(struct phy_device *phydev) { int err; @@ -129,6 +161,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 +225,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 },