From patchwork Tue Mar 7 22:46:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65946 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp10542wrd; Tue, 7 Mar 2023 15:03:55 -0800 (PST) X-Google-Smtp-Source: AK7set9YFXJemthPXBJ1Qs3PVkZ6E9Acras/2JjeM+XUgn2/6/lunmDP5fs4H4vaKqsadCGRSVlG X-Received: by 2002:a17:906:b095:b0:7ad:aed7:a5da with SMTP id x21-20020a170906b09500b007adaed7a5damr18793022ejy.28.1678230235202; Tue, 07 Mar 2023 15:03:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678230235; cv=none; d=google.com; s=arc-20160816; b=iy2KLrQuG+R2+gHRfIGBtWj6cQJu9G84h7scQYm/iLhF8tjNI1fKII5y8yZDYq6cCv vCLu/K5/mgl0t6ayxof1hxgC9pUvgQ+uY/lmf/67A/LKdgi7pPPbYmR0VWsCo6DhykhD FoABAS3dgqhxtzyEm9myrvRFdTo7Ggl/u+jfnsp+J0YMdnzP5M0Vx5cm8L0TL0BUclSb s3Aa6Em6DFx+45xuC636AKCOmDr20AlJXB9CkUykVjAoZXhV0L7GjQsh08sd8dEQ7pTS wSr6u6iS8Rf7GFuG90JTWHD3m8UtmC9F6yb+x1qIdhDccrlerRLZIBe885nDkVtNm0CD M9ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ahr73mNyTI5/RzwYeZNwyIGh9p6MliZLbPFza9HEq7s=; b=p9MhstLoIFrLs8kAUy2RxwcxCAEubqbGM1EAgm6IoqjOAfduYEaPgiLvpdzYNUu9rA JC+YNjTx/i8l52AvwR2ECjayuIJ7qDe5xqxviHse3dQEewVAPmAbT8/wFPYUE1bgon3F vTiyNXLfl0XxYMXnhMKQnT8N3WobgBiDHPiLAc79KbdzHX464MGCXBuXKpb1Md1YjzL/ iEU3Knvex2+3gsf+yeEXUX9MXj5u9peaYc/O756RU+b5HVpWGJPT/1nnC8owj2Ykacjr +PLsLDMO2piXxWVtyVeA45E5srR0h+USdXbgG4sgTJxxSYM7nSFJcsa/clrOu33alp0c JFwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a17090617d100b008c35e1f30fcsi10666029eje.404.2023.03.07.15.03.23; Tue, 07 Mar 2023 15:03:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231927AbjCGWtf (ORCPT + 99 others); Tue, 7 Mar 2023 17:49:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231776AbjCGWrp (ORCPT ); Tue, 7 Mar 2023 17:47:45 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4C0F957D0C; Tue, 7 Mar 2023 14:47:08 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id B21D77A0771; Tue, 7 Mar 2023 23:46:50 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 28/32] pata_parport-bpck6: move ppc6_rd_data_byte to bpck6.c and rename Date: Tue, 7 Mar 2023 23:46:23 +0100 Message-Id: <20230307224627.28011-29-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751947177210318?= X-GMAIL-MSGID: =?utf-8?q?1759751947177210318?= Move ppc6_rd_data_byte to bpck6.c and rename it to bpck6_rd_data_byte Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 38 ++++++++++++++++++- drivers/ata/pata_parport/ppc6lnx.c | 61 ------------------------------ 2 files changed, 36 insertions(+), 63 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 32dc9e61e80c..064696b6d68f 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -37,12 +37,46 @@ static void bpck6_send_cmd(struct pi_adapter *pi, u8 cmd) } } +static u8 bpck6_rd_data_byte(struct pi_adapter *pi) +{ + u8 data = 0; + + switch (mode_map[pi->mode]) { + case PPCMODE_UNI_SW: + case PPCMODE_UNI_FW: + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, + PARPORT_CONTROL_INIT); + data = parport_read_status(pi->pardev->port); + data = ((data & 0x80) >> 1) | ((data & 0x38) >> 3); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, + PARPORT_CONTROL_STROBE); + data |= parport_read_status(pi->pardev->port) & 0xB8; + break; + case PPCMODE_BI_SW: + case PPCMODE_BI_FW: + parport_data_reverse(pi->pardev->port); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, + PARPORT_CONTROL_STROBE | PARPORT_CONTROL_INIT); + data = parport_read_data(pi->pardev->port); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, 0); + parport_data_forward(pi->pardev->port); + break; + case PPCMODE_EPP_BYTE: + case PPCMODE_EPP_WORD: + case PPCMODE_EPP_DWORD: + pi->pardev->port->ops->epp_read_data(pi->pardev->port, &data, 1, 0); + break; + } + + return data; +} + static int bpck6_read_regr(struct pi_adapter *pi, int cont, int reg) { u8 port = cont ? reg | 8 : reg; bpck6_send_cmd(pi, port | ACCESS_PORT | ACCESS_READ); - return ppc6_rd_data_byte(pi); + return bpck6_rd_data_byte(pi); } static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val) @@ -240,7 +274,7 @@ static int bpck6_open(struct pi_adapter *pi) ppc6_wr_data_byte(pi, RAMSIZE_128K); bpck6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); - if ((ppc6_rd_data_byte(pi) & 0x3F) == 0x0C) + if ((bpck6_rd_data_byte(pi) & 0x3F) == 0x0C) pi->private |= fifo_wait; return 1; diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index d3c3968fbfc8..838af60a0d4d 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -68,7 +68,6 @@ //*************************************************************************** static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); -static u8 ppc6_rd_data_byte(struct pi_adapter *pi); //*************************************************************************** @@ -102,63 +101,3 @@ static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) } } } - -//*************************************************************************** - -static u8 ppc6_rd_data_byte(struct pi_adapter *pi) -{ - u8 data = 0; - - switch (mode_map[pi->mode]) - { - case PPCMODE_UNI_SW : - case PPCMODE_UNI_FW : - { - parport_frob_control(pi->pardev->port, - PARPORT_CONTROL_STROBE, PARPORT_CONTROL_INIT); - - // DELAY - - data = parport_read_status(pi->pardev->port); - - data = ((data & 0x80) >> 1) | ((data & 0x38) >> 3); - - parport_frob_control(pi->pardev->port, - PARPORT_CONTROL_STROBE, PARPORT_CONTROL_STROBE); - - // DELAY - - data |= parport_read_status(pi->pardev->port) & 0xB8; - - break; - } - - case PPCMODE_BI_SW : - case PPCMODE_BI_FW : - { - parport_data_reverse(pi->pardev->port); - - parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, - PARPORT_CONTROL_STROBE | PARPORT_CONTROL_INIT); - - data = parport_read_data(pi->pardev->port); - - parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, 0); - - parport_data_forward(pi->pardev->port); - - break; - } - - case PPCMODE_EPP_BYTE : - case PPCMODE_EPP_WORD : - case PPCMODE_EPP_DWORD : - { - pi->pardev->port->ops->epp_read_data(pi->pardev->port, &data, 1, 0); - - break; - } - } - - return(data); -}