Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2799157pxk; Sun, 20 Sep 2020 18:18:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRYcBHF3QvENgOH96Vwc91hiS+y4V/vgwTch44GGc9lcH9t1tZWWsbrjdlQDf1vaPxNAMb X-Received: by 2002:a17:906:7d5:: with SMTP id m21mr29950625ejc.538.1600651101430; Sun, 20 Sep 2020 18:18:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600651101; cv=pass; d=google.com; s=arc-20160816; b=00VPTej52ikdEOF3zI3NGA3L5G74C/KK1XO/gBMgDMNhwSPRSgrbk4FGEvxHgVhREF kBle+QsZGNR0/HwSUqAf1Ezivb4EUM6rIz8FG4h4VUX/vmxcLHkBTS3IoDFmLFkM3XBa +CS3KXdGLghpG8cGaMO1EwOss2EC9y6wg21BUllnWBNkBbmm34EdTkgo/T2I6Nb3zp0N G1dmFf1oQIZy0f53SA5SAlMzSMEhcG6EXDxwuErnIGtVoVxFqKHLeDwGWmVvUzowbGqQ Ana/coeJTlrFJfiN5+mZBL+5YdbQyi0nAgUFapUhwyFHvAfC9gcYidTb6qrG01LzFPfp eZAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:subject:cc:to:from:date:dkim-signature; bh=WAKEvVNFerSkMGAQazu+pc9uib62Mx1apPzjuqDdTPg=; b=qSXlwbzJomHNaLhzhGcoLrV4u9+2uMbz8zyVhbfFu5Mmw73NZFbTKu6+qJr5YtqP2T 2jkLnuXMh5dy8NiijUWqnvItzOg3bxSXb78Ir3vA7DwYDnYlhR/t2C344l5jxCJaYw9B z1cPASL7WITS3wq5AjcZqVNZ+d3R9ME+OM/iBo9RlVzqHOAtrMEsAVB2V0J6TefMgnAq 4hx6ILPHlOgKaYtojmMjRGigwvVHcqr2ioXBzB8UO1wIPe0K2Y6h8n6lIMtkegS4MrAy VsOha0HUFWjte1KGMPRlEVIAs5a3k9ow8Ltj4fCUWMTNJ5K9kAcdR8n2LBiISlJORihi 1PDg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b=L528jfM1; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synaptics.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a3si6623851ejt.659.2020.09.20.18.17.57; Sun, 20 Sep 2020 18:18:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b=L528jfM1; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synaptics.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726253AbgIUBO4 (ORCPT + 99 others); Sun, 20 Sep 2020 21:14:56 -0400 Received: from mail-bn7nam10on2070.outbound.protection.outlook.com ([40.107.92.70]:23676 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726126AbgIUBO4 (ORCPT ); Sun, 20 Sep 2020 21:14:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gO1ohXaxMUhQx17sh5RqiHzGgxclNTct6jPWu+BR6Wp1HKdaknq+O1rJq12yOUOuWeullPwxMeoP9SdhVhvHMtrlshec5nBO80r9IaltQVvAVgedepc69rsNLiH8Q+vfT6Hlo2Kks2SEw5BqfIbCCNAtlG4G9PjERd73OtqYBU9UXELhXpM1JxhVNzo0DLK5vzkhNhs91QoyViMTEHVPEdKQcmlOrLVtDTRlEwlibMxBQqRrBuItoJ51Ykk0IlnJiMT2tO4qwdgtmjhrFaxEmzw94dHUWIG9ivlCFqWBZ/TrqsqKKFdICpGlpfEjYqzZDJClN1pvw00dr2zDpnEi7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WAKEvVNFerSkMGAQazu+pc9uib62Mx1apPzjuqDdTPg=; b=UMzKQ4TQe9eaGONkcxZRPGMNZhAhsjZm6gMmjqQeVJ4cKvhozwqu9WIvA2yoq30PjMQXbjvjhYaJ5HEbLNNehb5Va3TTUGWrVc+nIvWx9fc40yMCzOqqJufp3rNtxnHsLQURvptmo443G3HCggHb6PIE1AEDrDEBTQH8XxyeWh8gJMmCHO4ase/wPQlt6vG7X3CMVCkahQWwAb1BPmOEo+rV6vPDlhW+OB0CB33AA0sZtCiYsjFs7CmZeCUXx+6oNtYlt+TXrMEusAPY3BI7G3uzCP2eXYnDN14DOdd1a2O/iRlPm4ZxAWeYi+OcQpgAb7Oc/jQ/KwNgrXH1lTI6/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WAKEvVNFerSkMGAQazu+pc9uib62Mx1apPzjuqDdTPg=; b=L528jfM11MtUJ0lMVwSaY7/Yr7CTa7Ew+0AG0vn3IZ3O0WVg5wwyPpmN9o52U9g1dcG8LbHYMo+o0k4wE0OsfWhPz9WuoMUY0t2SHXk3t4Afvy60Se/F9q75lSG15ZZJX8+2oy98gnGMsdVZvwbxUZj2t/aQqs94i34hf/3Iu9Y= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=synaptics.com; Received: from DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) by DM6PR03MB3802.namprd03.prod.outlook.com (2603:10b6:5:50::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.19; Mon, 21 Sep 2020 01:14:53 +0000 Received: from DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38]) by DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38%7]) with mapi id 15.20.3391.019; Mon, 21 Sep 2020 01:14:52 +0000 Date: Mon, 21 Sep 2020 09:13:54 +0800 From: Jisheng Zhang To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next] net: phy: realtek: enable ALDPS to save power for RTL8211F Message-ID: <20200921091354.2bf0a039@xhacker.debian> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-ClientProxiedBy: TY1PR01CA0155.jpnprd01.prod.outlook.com (2603:1096:402:1::31) To DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xhacker.debian (124.74.246.114) by TY1PR01CA0155.jpnprd01.prod.outlook.com (2603:1096:402:1::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.11 via Frontend Transport; Mon, 21 Sep 2020 01:14:50 +0000 X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Originating-IP: [124.74.246.114] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 98081720-114a-41d8-40a3-08d85dcbbe33 X-MS-TrafficTypeDiagnostic: DM6PR03MB3802: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:153; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UBn1YSW0+5I/bhceJXG6g3VokaY+lLRiyP/ZHDyb4tqZcjGfaBfNaMQ7GSX842kjXzlsPJZFEPKs6VzqtE5d5O+7BWgp1giI/vwrCvXKouNFB9Qy+Y3FqRWaqg7/yh7AorU8WzMd3rjWJXjdn2SNWwhRAy4ODz41th0eZeti/4DAL0dmfrD5bpvIndm7qEVmdd+tuKXs6qqUCutKtN8dd6cIhWt0y40Hpuca8RkyLm+TqtzYcTimgukHrACfBJbVeOeS0LsJPwr9Se9pHIFoZyYeq68YXSPG1Sa+JEkYzXs0xa84V1PI5wFS5iNz12UU51V4KtoljL4cXhW2cTfkTg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR03MB4555.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(136003)(376002)(396003)(39850400004)(366004)(26005)(8936002)(110136005)(4326008)(956004)(478600001)(8676002)(7696005)(186003)(16526019)(52116002)(9686003)(66556008)(86362001)(2906002)(55016002)(66946007)(1076003)(6506007)(66476007)(316002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: wIZ9x8Eao3plOi2Moz4/Xj/XIM/qoS97GjMCy/8pnRE7eQKVhSuO0sdjR1iSE+vZHvKesG+rRlwyEl9jxeeC0s0P8gVlShfi1R9wrdoXnzYmE6Qy3VV1y5dQzvFTgnp/w0wp7+skxuvp5of8gH2D7zpJ7x6mpo8k0wnTVRqwY+5scMu9AvYnxNCzAMJbdloZnYLbIN0JtrdISKwpvxT/WUCAl2FTRWQ+JFTKh8MAwoS/KmVydg5E7lCtzR2rzM3fBNHB/QvU/tVlxz8cpmXdJ//ETBCxKlNRv56BcfCEtuXRCy/jwx26tkjDo9RnBZ+vf5dBOewB7Ui23Xbu9jwr++VzePVZlXwwQWaMc2qOtq8NfHrtiNQQgfaBX0stz+a/8GRctViuiCCDkl+JX6HOWsHZydqoXhlSg1sO62oE8eeo0T4QOeukpKZU+rGwTEGDylaUoVCWFKSLucP8uA1LraMa3yonmmQjPOLYY/REWSFGlWqbiuXCsEsDeFVu3xOf9G23GGUv8ONIcxDseKJHTXw6/vEFOvWxGCF0fMMR83AyliXEAjBq4iT+37w57djYbAEQ/8hOQjMrLfPKgDWMjB0o40VNuLwnW9yTtK8hBdNJm78UqC/8pz89PB3xsXV36wRs+7xMT26esLcBEGO1Tg== X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98081720-114a-41d8-40a3-08d85dcbbe33 X-MS-Exchange-CrossTenant-AuthSource: DM6PR03MB4555.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2020 01:14:52.6937 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kU+3HucTwjUq00iVWjm26lSz59foh4yg2fk01hQYxL/8E+SzBxNsfC2WgNNDyQMdlFomXbym0SeJUQ1Ius/hnA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB3802 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Enable ALDPS(Advanced Link Down Power Saving) to save power when link down. Signed-off-by: Jisheng Zhang --- Since v1: - add what does ALDPS mean. - replace magic number 0x18 with RTL8211F_PHYCR1 macro. drivers/net/phy/realtek.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 95dbe5e8e1d8..4bf54cded48a 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -27,11 +27,16 @@ #define RTL821x_EXT_PAGE_SELECT 0x1e #define RTL821x_PAGE_SELECT 0x1f +#define RTL8211F_PHYCR1 0x18 #define RTL8211F_INSR 0x1d #define RTL8211F_TX_DELAY BIT(8) #define RTL8211F_RX_DELAY BIT(3) +#define RTL8211F_ALDPS_PLL_OFF BIT(1) +#define RTL8211F_ALDPS_ENABLE BIT(2) +#define RTL8211F_ALDPS_XTAL_OFF BIT(12) + #define RTL8211E_TX_DELAY BIT(1) #define RTL8211E_RX_DELAY BIT(2) #define RTL8211E_MODE_MII_GMII BIT(3) @@ -178,8 +183,12 @@ static int rtl8211f_config_init(struct phy_device *phydev) { struct device *dev = &phydev->mdio.dev; u16 val_txdly, val_rxdly; + u16 val; int ret; + val = RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_XTAL_OFF; + phy_modify_paged_changed(phydev, 0xa43, RTL8211F_PHYCR1, val, val); + switch (phydev->interface) { case PHY_INTERFACE_MODE_RGMII: val_txdly = 0; -- 2.28.0