Received: by 10.213.65.68 with SMTP id h4csp2113688imn; Sun, 8 Apr 2018 20:03:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+fm001nmKUOs1/PJRW4USwuAuWTcqbIefIrA2agbu5GnweRoGrMBfE4teRBS7h3lNTFdMx X-Received: by 10.98.69.142 with SMTP id n14mr27567797pfi.42.1523243024495; Sun, 08 Apr 2018 20:03:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243024; cv=none; d=google.com; s=arc-20160816; b=et5G7jXcitYkJcdjIqh77iNXbomYmgZ7wHuA88s42iVr/bRJQWo9RA8X3RV0qHHy86 AQEEtLd0LPqRK3KRUaAKN5nTjPcVkoRL5yvzzl1Piy57bVeM16V1AiWaYl5rLbe6E9qb Ql85G2h8FvnSi202yub1Xry1n1Dtghsp7ljq30IBfBYcV/8WupHmumr8dcYl3MD3Cq1F IZEqGP7MbXtM2OYVbow9NtE6S7FYqQNLYHIIKez6UWH1npBLXCNC2TwQ6U8uAQ3GeL8l L5haXTZIEOnkT90ZSUL09I1lTRo5ahFAYVlimp9lgHGSoxydokhIJKJ2BNfrSPkG6OKn AbMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=wFJJa9S4HV8FpdjGRpjjBih+Ok0MNIYMISEMDg2QFxc=; b=D64uf57sNj98g1t1THaZZWWT66DbjAWlrouPsjxylYVAoNjrpGYSMz4yE0iZ0+SSNS LvGeiQmAORvHjdXms0JzoH5T6QxCY6kjIqENMhi6GVMtMiJ5wc+c0oAxLol+rDEnJ6i5 2PUEGUsYVEn+6T8lLmbuG9zHXM+qITjmSSYHDOiR5vaDkBz5rxjyMO6po0SF52XOzFGc HDy/KHYqlO/J3gyjRj6eEREvik66fl4vIS4DxVbkQquYJFUH5CnLiUt/s2nDC44B10mC Ur0B0SrtBqzvaaYKMXIlvc1h+uKVynyQSrcAdntCTVazfBfT5kYPQ6/eOR2KwispKCV2 PFdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=LRYjoFUb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o69si11928713pfi.157.2018.04.08.20.03.07; Sun, 08 Apr 2018 20:03:44 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=LRYjoFUb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755929AbeDIA2t (ORCPT + 99 others); Sun, 8 Apr 2018 20:28:49 -0400 Received: from mail-dm3nam03on0110.outbound.protection.outlook.com ([104.47.41.110]:12595 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754315AbeDIA2k (ORCPT ); Sun, 8 Apr 2018 20:28:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wFJJa9S4HV8FpdjGRpjjBih+Ok0MNIYMISEMDg2QFxc=; b=LRYjoFUbR4utErQoKw0EXCTopcwlYbyPCCug7BDQUFJFVWEs6Xlcs6XnGWHpPUI++5Ut4AyNbeOuJgdNfmZryWqNJiGWpPROwQvTGSm0MI/6+5Y8UnOc4NOfJ2JHkvauMLHoN9casZdDgHg0DyESHNhpDH3iSvjZdOSJOcpuaxo= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0807.namprd21.prod.outlook.com (10.167.110.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.3; Mon, 9 Apr 2018 00:28:33 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:28:33 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: hayeswang , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 084/293] r8152: add byte_enable for ocp_read_word function Thread-Topic: [PATCH AUTOSEL for 4.9 084/293] r8152: add byte_enable for ocp_read_word function Thread-Index: AQHTz5kNg3u+/qH3L0Kl9y1muvllvA== Date: Mon, 9 Apr 2018 00:23:59 +0000 Message-ID: <20180409002239.163177-84-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0807;7:HeMdG8A1nHlJtTy/OF4FXiXEN2RsbrRKmhBmE+KacGgtIa6O8vIYH29o1LuZsOu8IKcBLXuJ2BWbXKFxh6hlDrocIrxCk2SoE460SGzO0ACYqjd/uXHqNFCwdb9S3C6BV7fOGQlc2TtPi//dOwG2Ck7ZGo0s3wlp0Yq6zWRVE1hIPMdYCpESBWgSTvhRGPF1hQuSB5qu4qMlEr4ALD8qIJbydBGpimUYjNz3eLovhCgfYcelcSh9nFCJwappTJ5w;20:cGNCNC145x6Jug89EH6Ny4ysQBdz7gl7UlzNwamz0ybvNXXbJDfq6sIC0SwpXBqsuYotpnp2MD21X8E0O0FNP4mQKeNRrkYO/v3u741+P+9+D6OfxiaXHRRliaPmk1HKNSQ8AnLyXOeekAsBJLOsjDpLNZhclku/OAXMzlSuHgo= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: d1b4e08f-6b8d-4d8e-204e-08d59db0d3fc x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0807; x-ms-traffictypediagnostic: DM5PR2101MB0807: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(788757137089); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231221)(944501327)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB0807;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0807; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(39860400002)(396003)(366004)(376002)(346002)(199004)(189003)(14454004)(4326008)(54906003)(25786009)(53936002)(2900100001)(1076002)(3280700002)(6486002)(186003)(2616005)(68736007)(110136005)(11346002)(10090500001)(6116002)(107886003)(3846002)(36756003)(8676002)(72206003)(22452003)(66066001)(26005)(6512007)(478600001)(3660700001)(81156014)(86362001)(81166006)(86612001)(7736002)(305945005)(8936002)(10290500003)(6436002)(105586002)(6666003)(316002)(59450400001)(76176011)(5660300001)(476003)(106356001)(2906002)(6506007)(446003)(2501003)(99286004)(5250100002)(486006)(102836004)(97736004)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0807;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: SzTEPm14Rc128cTgoL4/xsJfyVoiCw7+XFOzWFW7sxre37GoAR7SVunqZCyW0MiKQIIQovvQ4ZJkp1eknWOYOlyCKBIWCKmmS4XD+FwIbZAskrQx9VureYSEyj3Rh3bfHWemUN62Qn82/iY4o0CSgnKI7oPfXI+F6M9alZQAN48us4JPGP7pfQba9YLXW60j+Nm1HRNKk5l/iDz4Z5n20qGdtETnlQ341IjqzOH0qTlOTglJCGYyjQuQzL+WMNghksR0giTtBQeskcUQqn1My5NXGEwILpKQBfRY6HaWrCNgwtXlolT0t1+ni+vHb4CYlDWsuq+1JYVMuiL4AveXfrMuJ8mmLp3iocTrohcfG4/09EKgq+zyyx2LwCS/1BgLDF35t5omy+k5SbrWPoAlEH1YREaYLg5FnzeSr66yX3A= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1b4e08f-6b8d-4d8e-204e-08d59db0d3fc X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:23:59.5187 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0807 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: hayeswang [ Upstream commit d8fbd27469fc02049c674de296a3263bef089131 ] Add byte_enable for ocp_read_word() to replace reading 4 bytes data with reading the desired 2 bytes data. This is used to avoid the issue which is described in commit b4d99def0938 ("r8152: remove sram_read"). The original method always reads 4 bytes data, and it may have problem when reading the PHY registers. The new method is supported since RTL8153B, but it doesn't influence the previous chips. The bits of the byte_enable for the previous chips are the reserved bits, and the hw would ignore them. Signed-off-by: Hayes Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/usb/r8152.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index b2d7c7e32250..29b7eb9085ab 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -871,11 +871,13 @@ static u16 ocp_read_word(struct r8152 *tp, u16 type, = u16 index) { u32 data; __le32 tmp; + u16 byen =3D BYTE_EN_WORD; u8 shift =3D index & 2; =20 index &=3D ~3; + byen <<=3D shift; =20 - generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); + generic_ocp_read(tp, index, sizeof(tmp), &tmp, type | byen); =20 data =3D __le32_to_cpu(tmp); data >>=3D (shift * 8); --=20 2.15.1