Received: by 10.213.65.68 with SMTP id h4csp2116750imn; Sun, 8 Apr 2018 20:07:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx480WzwMU6y4uEmIoAcRu2OMNGubJt1UrY0f4WeUYDVJ+LymVlOlN8Mold2HgKCZr6E6gUH0 X-Received: by 10.99.122.8 with SMTP id v8mr334067pgc.401.1523243262528; Sun, 08 Apr 2018 20:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243262; cv=none; d=google.com; s=arc-20160816; b=WXWcOVOhhYZ4k0biy43MiDaFY2goCCnNUuntzo4HK27rkB7YrULU9gdERfkih2tFds yP+sYkLfNu5FrV2io+qV/1EDUSf9tLdoSRlM+tAue+ULUk8GJKZel6f69ivpYymhkZG4 /eKFMDQljsRCTNSmpywO5/yfuaqEZjg22TA1CerKqESKuoIF/nj8Y0bK2nwR1oKww2Yi F+w9A05eg2blU4asVhlF3RtgIbJps/cXnXRecl8fF+sJxBzBy0vnCZk4a1j1rd2Lsh/9 tu7o1nYTlaZc5TJteu8VwAZnVyQ+hx5TT7aQEYqIIUBLgWhXn4lyMwuGlF3pk6C+BJbP MvNw== 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=g11R5ZqZfY4tY/L6f8CFRTA4SO1gBK09sRYYLVGe2Es=; b=UW27UP0RPPd7xBT2+nnJANcLdXTX59md5mtB8zR4w8LuvtLW+2Ti8/vAOtZk1ZZooI bWih+N6wQK6vI3d3p5ai83qHwxqgPMXbx6kfqcGdv7qmasHbCJ4iTcSoVW2iLXvB7SkV ty3qQCCUquUoouuYqFXIrl7M6e00EHOmQ5KuyquYRTTNCZgfm5L8XKc5CLYi+W9XBLcR npV3jY340W+pw7buEF2sFGapb/GqkCk+ZyuTMA4Ag1Qt88EBPg6b7PX9C+DLdtifsV9d kYZB/UBzUxAbeqeAAL5W0Mpgis+5MJ2uX7/uJ4w3Pgr2Qmm2ijtUY99tu3ucir7w0Wfd gUmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=iZjCI8cq; 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 f2si4614135pgn.320.2018.04.08.20.07.05; Sun, 08 Apr 2018 20:07:42 -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=iZjCI8cq; 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 S932644AbeDIBa6 (ORCPT + 99 others); Sun, 8 Apr 2018 21:30:58 -0400 Received: from mail-sn1nam02on0133.outbound.protection.outlook.com ([104.47.36.133]:9440 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756171AbeDIAf4 (ORCPT ); Sun, 8 Apr 2018 20:35:56 -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=g11R5ZqZfY4tY/L6f8CFRTA4SO1gBK09sRYYLVGe2Es=; b=iZjCI8cq50QlWHBb2z67KZSxipuc2wnk3TmO8JIrkqyu+eG3jm+249a9cG2u2SWmCe9a77o9aXR58ASJA6PCaGnGz/fPwkVzJRQ0XcJvJxkgVh/N80POkWAgDvx89J4Zz2AJMh5Wnr+EX96J605X3lEe46/GgsIxZZQtuHmQV98= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0725.namprd21.prod.outlook.com (10.167.107.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:35:54 +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:35:54 +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.4 043/162] r8152: add byte_enable for ocp_read_word function Thread-Topic: [PATCH AUTOSEL for 4.4 043/162] r8152: add byte_enable for ocp_read_word function Thread-Index: AQHTz5mlei8E0JuYQ0CYmWIVJjNYxw== Date: Mon, 9 Apr 2018 00:28:13 +0000 Message-ID: <20180409002738.163941-43-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-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;DM5PR2101MB0725;7:2dHL3N7V6Iku+gpheVNhdYQ/N0Hb16IuCBcD5zJwbpu3MrEDZznsNmobIx5gquB47fRIfbuilN6ngnrbmHltvz6THTGyoh1MM+oCZxoI0DjGeE8bcJ8LURWRT7BMwd7Kz2SQKRUNRs4c9JelpJKygHnKmC3RQrZ7m7dK6WZg6X/82/dIqFPesSFqYoQwArkflkBE1Oj0JcBX0FbpJvv/d1CGKDaHCimZK33cWGyuKendLTtxDnf4UpfiJD2knWen;20:1aPQ+4iGkmfYyi9RtxJv0dt0zxXtRFzmXLW6PQVvmDQb62URGUKbHwn/TS8aioBq2Mh8nqQPH2wuYKqqSziQ03Yg5bC9vRjkWjUsn2Kj+i6LXyaaYdBTAVvn2JUotkNn7yUE0+KI/RfqUxoyhslJYGhcnCFOGFfkxIiDDaMV5DU= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: cc06bcd0-87be-45a8-1381-08d59db1dad2 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0725; x-ms-traffictypediagnostic: DM5PR2101MB0725: 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)(10201501046)(3231221)(944501327)(52105095)(93006095)(93001095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0725;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0725; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(396003)(376002)(39380400002)(346002)(366004)(189003)(199004)(86612001)(102836004)(5660300001)(14454004)(476003)(68736007)(11346002)(66066001)(446003)(99286004)(76176011)(486006)(10090500001)(3660700001)(110136005)(305945005)(106356001)(316002)(105586002)(3280700002)(59450400001)(3846002)(10290500003)(6116002)(22452003)(6506007)(2616005)(1076002)(7736002)(54906003)(478600001)(2900100001)(2501003)(5250100002)(8936002)(25786009)(81156014)(8676002)(6666003)(6436002)(4326008)(26005)(6512007)(6486002)(81166006)(107886003)(53936002)(2906002)(86362001)(186003)(97736004)(36756003)(72206003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0725;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: fHD6pLcoA3haoqu8/j0RikLl13FW+/RR7o5O+UswJ5GFdrP1HfcigAfDixSUPJq0e37ZfZgg1gypcs8kcTVd3bjaXzUfZ8ZhRfLZcU4szIonN18DkvfKqL6jf/wkYFEZxuPXLCEUrwMtvRCrZVJLgOzAw09ZyKTdpScEUp3UEDPA/pxHQRUI4s3OyRY4t1EbGXtZPTii5ol3+DQwLxsrgHjgsOSVSkUherS6IOZ4PUPcKDACGTl0kAMr0Y5ZMOtDExi7FWBZ2Ue5cW6VhTM6/yOuPjH/ZtRTEcq9P0Kkyt0t5mJ+TsP2G/GvVa7yIc+XuZdMkCVWe3V8lj9rVD+e+Ecw17r9Dge+zuPfLZ+Dmz0rns8cJCopvjiZpllN1Jzs1qKyV9X5VWm/Z4B5tfhqrB6SOZrVrqqTQDrlApv4UPI= 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: cc06bcd0-87be-45a8-1381-08d59db1dad2 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:28:13.9424 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0725 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 89950f5cea71..d91d094c11d1 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -853,11 +853,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