Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3735924ybg; Sun, 20 Oct 2019 20:42:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqy05t0s+tMFgHsdIH6XYVWdtmZF210rouqqLv2hf3IR9RlvmkN9MXG+fgt9dX9xqve9krcS X-Received: by 2002:aa7:c259:: with SMTP id y25mr22403854edo.117.1571629330688; Sun, 20 Oct 2019 20:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571629330; cv=none; d=google.com; s=arc-20160816; b=0k19csSWbdQUHkZY0v+eDoUiXb4AFyTa5se+CwqY4z3vtayCjtZQLBVLy+j8I7DTqx xsTWmsOHQ4JRzLx6TZ9vFFckg6s88kXZwgQezVcKuGYP1j649xd6AdNCi3DTFHUDTsFY CPmbGAf25y/943bzLdetCLQmk1aNp6oqWEx6jnxvVNA7ZwfmUe44KfrenAvdTd3ongrG BqqzG1fnGM1dK02zk/XURnWD02lmtPNPhMV7EJpausaiWkf8l1VFVBKa9PyFqUEliNZ3 FMF35w5HzzOwhF9KaouNZscQlikYrZgAKAxeCC25q+gNoSGsZ7tmzO3lXzHCqI8QCEJw ziEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :authenticated-by; bh=KmwYOAE7Ompa9sd2Vqmf7RZPHDkdlhRr4yPKXvlkF7I=; b=akFCOObptAzbds/j65o2Renul2lWICE35ogbJsIhexqq+0n731zotV8+LvMEy9p6uR RDTDxY0sbY2syYQ0M9lwbNPcpIAA4XulJ/J955+qDcF80d3wL/uBOKnzetCvyHV2xjQp L9kpzIzIXPaDmkYvLgGg8UhDR6vt16kSem7POJaIdotBg1DGdVwhVgWwejVpMwcEZTHk raxzzA0wnqNCVGNSkqoZc2ivrnnjQG3Flp1ETpS+HknLMgwxm0utlEVbkpveY7f3iJBW n59/pRbShDPzRs5c1GXBmcz0PFlqDsguH/md1iY/bM9UmcBlWvNQV9+ShN6r98pvP+6h r/rA== 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 a16si8113099ejb.54.2019.10.20.20.41.46; Sun, 20 Oct 2019 20:42:10 -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 S1727075AbfJUDlg (ORCPT + 99 others); Sun, 20 Oct 2019 23:41:36 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:58989 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727131AbfJUDlf (ORCPT ); Sun, 20 Oct 2019 23:41:35 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x9L3fWOS014791, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTITCAS11.realtek.com.tw[172.21.6.12]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x9L3fWOS014791 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Oct 2019 11:41:32 +0800 Received: from fc30.localdomain (172.21.177.156) by RTITCAS11.realtek.com.tw (172.21.6.12) with Microsoft SMTP Server id 14.3.468.0; Mon, 21 Oct 2019 11:41:30 +0800 From: Hayes Wang To: CC: , , , , Hayes Wang Subject: [PATCH net-next 3/4] r8152: move r8153_patch_request forward Date: Mon, 21 Oct 2019 11:41:12 +0800 Message-ID: <1394712342-15778-333-Taiwan-albertk@realtek.com> X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <1394712342-15778-330-Taiwan-albertk@realtek.com> References: <1394712342-15778-330-Taiwan-albertk@realtek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [172.21.177.156] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move r8153_patch_request() forward for later patch. Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 54 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 090ddd5fb973..ab57c672c4ca 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -3397,6 +3397,33 @@ static void rtl_clear_bp(struct r8152 *tp, u16 type) ocp_write_word(tp, type, PLA_BP_BA, 0); } +static int r8153_patch_request(struct r8152 *tp, bool request) +{ + u16 data; + int i; + + data = ocp_reg_read(tp, OCP_PHY_PATCH_CMD); + if (request) + data |= PATCH_REQUEST; + else + data &= ~PATCH_REQUEST; + ocp_reg_write(tp, OCP_PHY_PATCH_CMD, data); + + for (i = 0; request && i < 5000; i++) { + usleep_range(1000, 2000); + if (ocp_reg_read(tp, OCP_PHY_PATCH_STAT) & PATCH_READY) + break; + } + + if (request && !(ocp_reg_read(tp, OCP_PHY_PATCH_STAT) & PATCH_READY)) { + netif_err(tp, drv, tp->netdev, "patch request fail\n"); + r8153_patch_request(tp, false); + return -ETIME; + } else { + return 0; + } +} + static bool rtl8152_is_fw_mac_ok(struct r8152 *tp, struct fw_mac *mac) { u16 fw_reg, bp_ba_addr, bp_en_addr, bp_start, fw_offset; @@ -4056,33 +4083,6 @@ static void r8152b_enter_oob(struct r8152 *tp) ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); } -static int r8153_patch_request(struct r8152 *tp, bool request) -{ - u16 data; - int i; - - data = ocp_reg_read(tp, OCP_PHY_PATCH_CMD); - if (request) - data |= PATCH_REQUEST; - else - data &= ~PATCH_REQUEST; - ocp_reg_write(tp, OCP_PHY_PATCH_CMD, data); - - for (i = 0; request && i < 5000; i++) { - usleep_range(1000, 2000); - if (ocp_reg_read(tp, OCP_PHY_PATCH_STAT) & PATCH_READY) - break; - } - - if (request && !(ocp_reg_read(tp, OCP_PHY_PATCH_STAT) & PATCH_READY)) { - netif_err(tp, drv, tp->netdev, "patch request fail\n"); - r8153_patch_request(tp, false); - return -ETIME; - } else { - return 0; - } -} - static int r8153_pre_firmware_1(struct r8152 *tp) { int i; -- 2.21.0