From patchwork Thu Oct 5 20:55:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 149025 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp561133vqb; Thu, 5 Oct 2023 13:56:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1+GiiOu5WwLq8yIHOaRvcWoDW77xtc+vtb3ENpwD5+gb8Ah31YfCDvRDWoRx6LTvEay6I X-Received: by 2002:a05:6358:419d:b0:135:4003:7857 with SMTP id w29-20020a056358419d00b0013540037857mr4418955rwc.31.1696539382898; Thu, 05 Oct 2023 13:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696539382; cv=none; d=google.com; s=arc-20160816; b=MDzBdphQhHtDP27V+WJfddecB0d74PPvTPybT9C2nbkgT2e9Qx28+/m9Avv7ZM1kfj VyhbZqTvCSip0GFkQIQs2voic+sC3qq77/l19i4NgL6MxzUWgcl38cCiYP1KB4Xnu0s+ RAytk/cbruLqM5x3WMMm5kUxHW1Ee+YhfVnEu7n0mi+W1QM/goZBxc9Ti4Mc5c8Q0iMn Y5LV0Gzfzb7ChpnB6zhAFx/LqQuzp7+BapkiCI2SMrc2HQiunuGEgZBZu51jUlwQJ6wm Pg6JcWug2adcb2XpzV5tKIsXQi95VMVaXqlOj1CCooakKwp3zsAeGCzqhv0KbG+AMbnp mNaA== 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=7P2SxlyPBbfA+FeABtKIEP+MsuGzRfiOYNXgiytXVjU=; fh=0Kn3fvtcnx6vVXAlmep6T/Q5RzgM4nGjbgzeaq8HuW4=; b=Xs6d2JmBd0piTsPoUDXs2W1DonaMSDAuxivno9Eqi9vnmn5nnA0i+MTw6gyNdaJbh6 gqDbl3milGNV2OLM5rwHP37l9Xi3NuVH1no/it3OAZa8Ld2ftMx0wl3/gTPnmRD2RteF 02PmMX/abYVM8gJufh7Enw5Lkcylmu3FfHBZQTzwd72gRF6zaxvwojHQfadQg0Ja7tXC s23Dbon9ViEa7en2zp8S1/Mz6wrAjSpgBBlmAMVrhvsjMiASfpYZ5HgcZEuz/C8K7txk SU1H2U8ADmsNxTf0uu3QdyO9k2opAEAzCqjV3CdSqOqH9zlIHsV/fl3AuQK3F2/oMdhT X/BA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id z2-20020a1709027e8200b001bb2d95f2a7si2176531pla.267.2023.10.05.13.56.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 13:56:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 220AA807792C; Thu, 5 Oct 2023 13:56:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230521AbjJEU4K (ORCPT + 18 others); Thu, 5 Oct 2023 16:56:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230029AbjJEU4J (ORCPT ); Thu, 5 Oct 2023 16:56:09 -0400 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9E18C9F; Thu, 5 Oct 2023 13:56:07 -0700 (PDT) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 95EEE7A01D5; Thu, 5 Oct 2023 22:56:06 +0200 (CEST) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Tim Waugh , linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] ata: pata_parport: fix pata_parport_devchk Date: Thu, 5 Oct 2023 22:55:56 +0200 Message-Id: <20231005205559.6504-2-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20231005205559.6504-1-linux@zary.sk> References: <20231005205559.6504-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 05 Oct 2023 13:56:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778950480060189284 X-GMAIL-MSGID: 1778950480060189284 There's a 'x' missing in 0x55 in pata_parport_devchk(), causing the detection to always fail. Fix it. Fixes: 246a1c4c6b7f ("ata: pata_parport: add driver (PARIDE replacement)") Cc: stable@vger.kernel.org Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/pata_parport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_parport/pata_parport.c index 1af64d435d3c..258d189f42e5 100644 --- a/drivers/ata/pata_parport/pata_parport.c +++ b/drivers/ata/pata_parport/pata_parport.c @@ -64,7 +64,7 @@ static bool pata_parport_devchk(struct ata_port *ap, unsigned int device) pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0xaa); pi->proto->write_regr(pi, 0, ATA_REG_LBAL, 0x55); - pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 055); + pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0x55); pi->proto->write_regr(pi, 0, ATA_REG_LBAL, 0xaa); nsect = pi->proto->read_regr(pi, 0, ATA_REG_NSECT); From patchwork Thu Oct 5 20:55:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 149026 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp561263vqb; Thu, 5 Oct 2023 13:56:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFe5xhV+tMao7xv6QbgODEyoo5bkXN5Rfx1EU8JAvkEZYf7vjJYgRVP/Hn4E6F0zWYZX9ap X-Received: by 2002:a17:902:6b04:b0:1b7:e86f:7631 with SMTP id o4-20020a1709026b0400b001b7e86f7631mr6174571plk.19.1696539405838; Thu, 05 Oct 2023 13:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696539405; cv=none; d=google.com; s=arc-20160816; b=GvoCINayrksiSM5u0h0CEeLxZqqVxdAQ84Ytp8l4h7BcSO5viyY1MlAJZ+2Lawau2s +vtSgD+qg0QmdEENjZGIyRkXxn2VeO0Wmeory76NgWy2mAtKUy4RW6KDKls9HA5Qq6bn wEv7Ki39BfQcZ41vIYQ3kXdcbD7E4633omUe2HwAXnTeRNiTxTsVWRvj2cpPdW7dt6fd 2MW0XS3WnTtzWM4XXVCcNGnVaSg34mf1M944ISjfxDDEw5yMp0FG/p+NF1c2kO1ACVUI Sr9AnKNAuT5wNtOAjTn3LR4gyX/jvtZPXqosTc1pY3W25wIt5+B7PYwf6nxwDjk9cib6 M/Aw== 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=ojMs5e5+vivdenL0B4z8IB/laNKWeerQnh4larZP0Yc=; fh=0Kn3fvtcnx6vVXAlmep6T/Q5RzgM4nGjbgzeaq8HuW4=; b=MDSF2D/OMSlzUb+bAGv/9//wtmm9L6zsqWPJyBmDZdFMqB1g7Fsq2eWgpvTj1r5KTA oXOl2UK/DVigoTXHfvM84dTsUxVcGMcwDWxEpxcF2XOQntyIqv2b4cTfeAqAjDrxO5eB 9s2/tgv2kB5rQu1rLxpo0vEEpPwPSRTohZx9JDONWfvQgIxAa818qof1gA2bqofsQqFW lKZB86a9x+zMHNw8YJc5YfPqaoMOjf57bTturgxvehPAlV1QodUSJY/CqJpT6Lv2jy84 obDzX5ypPMkfVJ20u7EObe3HZB7f9lUkYqwJESsj3IzpZo4PzYCdBFdtL5kk+KB2630B e5DQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id u8-20020a1709026e0800b001c60de17b5esi2187054plk.118.2023.10.05.13.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 13:56:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 3AB418077924; Thu, 5 Oct 2023 13:56:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231716AbjJEU4O (ORCPT + 18 others); Thu, 5 Oct 2023 16:56:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230137AbjJEU4J (ORCPT ); Thu, 5 Oct 2023 16:56:09 -0400 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CCC06A6; Thu, 5 Oct 2023 13:56:07 -0700 (PDT) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id B82437A0430; Thu, 5 Oct 2023 22:56:06 +0200 (CEST) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Tim Waugh , linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] ata: pata_parport: implement set_devctl Date: Thu, 5 Oct 2023 22:55:57 +0200 Message-Id: <20231005205559.6504-3-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20231005205559.6504-1-linux@zary.sk> References: <20231005205559.6504-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 05 Oct 2023 13:56:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778950503614658558 X-GMAIL-MSGID: 1778950503614658558 Add missing ops->sff_set_devctl implementation. Fixes: 246a1c4c6b7f ("ata: pata_parport: add driver (PARIDE replacement)") Cc: stable@vger.kernel.org Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/pata_parport.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_parport/pata_parport.c index 258d189f42e5..cf87bbb52f1f 100644 --- a/drivers/ata/pata_parport/pata_parport.c +++ b/drivers/ata/pata_parport/pata_parport.c @@ -51,6 +51,13 @@ static void pata_parport_dev_select(struct ata_port *ap, unsigned int device) ata_sff_pause(ap); } +static void pata_parport_set_devctl(struct ata_port *ap, u8 ctl) +{ + struct pi_adapter *pi = ap->host->private_data; + + pi->proto->write_regr(pi, 1, 6, ctl); +} + static bool pata_parport_devchk(struct ata_port *ap, unsigned int device) { struct pi_adapter *pi = ap->host->private_data; @@ -252,6 +259,7 @@ static struct ata_port_operations pata_parport_port_ops = { .hardreset = NULL, .sff_dev_select = pata_parport_dev_select, + .sff_set_devctl = pata_parport_set_devctl, .sff_check_status = pata_parport_check_status, .sff_check_altstatus = pata_parport_check_altstatus, .sff_tf_load = pata_parport_tf_load, From patchwork Thu Oct 5 20:55:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 149028 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp561752vqb; Thu, 5 Oct 2023 13:58:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHrpOtI48Gp6/ofVKcdLFUMZ+uDEis6DC5/ajclmNdYEDBqtxOLJOUPLq4lKfdvHTOpYb2q X-Received: by 2002:a05:6a20:938a:b0:15d:d73e:e398 with SMTP id x10-20020a056a20938a00b0015dd73ee398mr7584546pzh.16.1696539480888; Thu, 05 Oct 2023 13:58:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696539480; cv=none; d=google.com; s=arc-20160816; b=bRV4E3M4fiXLgQSDzRqVjhWWtUcF9jtvBCXX7yYkiLL8mWTAtAJK5kGsaPyvlN/2iH KB4CyKm4Gp78YSmIqqq03vhhBOOsrGBStK0g0stQbnEt4ferlEU2l4IIKFUR0sK0Y5qS 7P6qnTSNx4PlrtIg6m0Pc/lVcGp+j9I8JMXVvjGkfGlgWtX7aowV+TBdHu4npvTny8PK 1ng/W/VE621NPZic8ZRQuCv5Exrlon3eFtlp7f0u4DrQh9e+zmCzqTF5Ikeyxl4S6i4F oIQP5xKs68mAG5Cv9uDp7WO8ZekxdibTLtNHTeKIlQYxqVlaO2DnCs7+D4I0j1pNHrcN NQZw== 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=sqL3OwVvdpmSIOEHs2mQwzoUjW82238re+qlHC3sH00=; fh=0Kn3fvtcnx6vVXAlmep6T/Q5RzgM4nGjbgzeaq8HuW4=; b=KJTebjb5Twzr1p2TyHwP4m0hNMtCUW3cqODe/HvaYLwrREuNa8uyRuYeWbHU+e6WZ1 hh2/nXA7sLkBQBWYPW50GJvqCnmGB8XvRsdK7YVHn2G6IYYMeFC4isCCQh+UvfcB4AXx JPCc7qzLRDeykNlVlynhx7HilYAulvFTOYIg5F7MvJce0wLt4quI13V3IIKRGZcFHVJH e4wEaMXlfpTb7pQN9NPPbyHCq5GPnP3zjwiV9dzy+5SY5ziEzbunivZNRA8HFGEXTEBG fg/uE++/p2azhGrAtoBPr42cHQgHh6af//2NuxYaN5s04VQEzUdHEKB3QG8qRXUW1ne/ ys7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id u11-20020a6540cb000000b0056532a14f54si1680626pgp.900.2023.10.05.13.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 13:58:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C802D8083B00; Thu, 5 Oct 2023 13:56:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231795AbjJEU4S (ORCPT + 18 others); Thu, 5 Oct 2023 16:56:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230480AbjJEU4K (ORCPT ); Thu, 5 Oct 2023 16:56:10 -0400 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ED619B6; Thu, 5 Oct 2023 13:56:07 -0700 (PDT) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id DE9977A062F; Thu, 5 Oct 2023 22:56:06 +0200 (CEST) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Tim Waugh , linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] ata: pata_parport: add custom version of wait_after_reset Date: Thu, 5 Oct 2023 22:55:58 +0200 Message-Id: <20231005205559.6504-4-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20231005205559.6504-1-linux@zary.sk> References: <20231005205559.6504-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 05 Oct 2023 13:56:40 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778950582633216316 X-GMAIL-MSGID: 1778950582633216316 Some parallel adapters (e.g. EXP Computer MC-1285B EPP Cable) return bogus values when there's no master device present. This can cause reset to fail, preventing the lone slave device (such as EXP Computer CD-865) from working. Add custom version of wait_after_reset that ignores master failure when a slave device is present. The custom version is also needed because the generic ata_sff_wait_after_reset uses direct port I/O for slave device detection. Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/pata_parport.c | 68 ++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_parport/pata_parport.c index cf87bbb52f1f..a7adfdcb5e27 100644 --- a/drivers/ata/pata_parport/pata_parport.c +++ b/drivers/ata/pata_parport/pata_parport.c @@ -80,6 +80,72 @@ static bool pata_parport_devchk(struct ata_port *ap, unsigned int device) return (nsect == 0x55) && (lbal == 0xaa); } +static int pata_parport_wait_after_reset(struct ata_link *link, + unsigned int devmask, + unsigned long deadline) +{ + struct ata_port *ap = link->ap; + struct pi_adapter *pi = ap->host->private_data; + unsigned int dev0 = devmask & (1 << 0); + unsigned int dev1 = devmask & (1 << 1); + int rc, ret = 0; + + ata_msleep(ap, ATA_WAIT_AFTER_RESET); + + /* always check readiness of the master device */ + rc = ata_sff_wait_ready(link, deadline); + if (rc) { + /* + * some adapters return bogus values if master device is not + * present, so don't abort now if a slave device is present + */ + if (!dev1) + return rc; + ret = -ENODEV; + } + + /* + * if device 1 was found in ata_devchk, wait for register + * access briefly, then wait for BSY to clear. + */ + if (dev1) { + int i; + + pata_parport_dev_select(ap, 1); + + /* + * Wait for register access. Some ATAPI devices fail + * to set nsect/lbal after reset, so don't waste too + * much time on it. We're gonna wait for !BSY anyway. + */ + for (i = 0; i < 2; i++) { + u8 nsect, lbal; + + nsect = pi->proto->read_regr(pi, 0, ATA_REG_NSECT); + lbal = pi->proto->read_regr(pi, 0, ATA_REG_LBAL); + if (nsect == 1 && lbal == 1) + break; + /* give drive a breather */ + ata_msleep(ap, 50); + } + + rc = ata_sff_wait_ready(link, deadline); + if (rc) { + if (rc != -ENODEV) + return rc; + ret = rc; + } + } + + pata_parport_dev_select(ap, 0); + if (dev1) + pata_parport_dev_select(ap, 1); + if (dev0) + pata_parport_dev_select(ap, 0); + + return ret; +} + static int pata_parport_bus_softreset(struct ata_port *ap, unsigned int devmask, unsigned long deadline) { @@ -94,7 +160,7 @@ static int pata_parport_bus_softreset(struct ata_port *ap, unsigned int devmask, ap->last_ctl = ap->ctl; /* wait the port to become ready */ - return ata_sff_wait_after_reset(&ap->link, devmask, deadline); + return pata_parport_wait_after_reset(&ap->link, devmask, deadline); } static int pata_parport_softreset(struct ata_link *link, unsigned int *classes, From patchwork Thu Oct 5 20:55:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 149027 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp561279vqb; Thu, 5 Oct 2023 13:56:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGT1GtdmqMtH4ICCwvFZpsJ9LQcKA8Fc4bLR7O2r+J+4i9WUA5FPnCyncCdVhOq16/FvPXD X-Received: by 2002:a17:90a:f3c4:b0:277:4057:b752 with SMTP id ha4-20020a17090af3c400b002774057b752mr6414101pjb.46.1696539408153; Thu, 05 Oct 2023 13:56:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696539408; cv=none; d=google.com; s=arc-20160816; b=EPqFmhykl07nBFUAwsEoZ1Iqsda3BjLk5Vwa/n/wpB8V1qUAj54CpuZxIFdiq4xRxB ZeCd9Et9ek8dQK9CouTufic99IR//Oq08LV/QmwYEdOyppjvreKbgKyuMpLKeqzFZ08k PhwUtiGPA5/6pYJ2HHRiplgZFJxGK7oAhSIUBuqu6B6QB3NxcnKu0fplNFU8/uZQWF12 EjZE/lHSe9nGEJwrgFlyKYfSqsSfeYlB5gFUC64EEBcxnKKLN5eUU8avnDWnOL/O93KP KsQGu7s1YYgUMBFL9KwwVtho+301a0zwWIvpYkbI3LYaQnbjfE9cZrkpgLxpdm1RdCdc SfAw== 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=WQbOuHv6/l2ZBqTYd39NQw0Z5le5u0pmuKxIapJPGEE=; fh=0Kn3fvtcnx6vVXAlmep6T/Q5RzgM4nGjbgzeaq8HuW4=; b=zgrH9qoRj/cABQ5JmPK9uQgexIGar0/LgYvOYST2ohtlJnpt6/KpOleJf063DrDR4z ogqNmE6e2MIDrfTHBBLmkLnkHaVOFrNx728fVMYgOIUPPO0hPmvoYQDUaNFiLKqQEbQ7 ntb9yKEF5T3iS10wFy5wc7sR5gTT5fO2vm6ns6ayrNxL846ZNKg+mfHVXOclg8E1jht7 8J01weoJa0XkDEs6xdb535TwfU2VNr1Aas+BxmNZaALk+P3tn1gm8JLRXfO00vYsjcFY 5l7dvJVgQ71bbCYyGl0Qq6khawqqHuLeMeeHzyxZUVsAr0FxAdbs5PaxffwjyN5tjSEQ UM2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id l5-20020a170903120500b001bdca6456c3si2438278plh.46.2023.10.05.13.56.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 13:56:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B9E05802FA3D; Thu, 5 Oct 2023 13:56:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231810AbjJEU4U (ORCPT + 18 others); Thu, 5 Oct 2023 16:56:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231124AbjJEU4K (ORCPT ); Thu, 5 Oct 2023 16:56:10 -0400 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6230FC0; Thu, 5 Oct 2023 13:56:08 -0700 (PDT) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 175AE7A072E; Thu, 5 Oct 2023 22:56:07 +0200 (CEST) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Tim Waugh , linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] ata: pata_parport: fit3: implement IDE command set registers Date: Thu, 5 Oct 2023 22:55:59 +0200 Message-Id: <20231005205559.6504-5-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20231005205559.6504-1-linux@zary.sk> References: <20231005205559.6504-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 05 Oct 2023 13:56:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778950506156182554 X-GMAIL-MSGID: 1778950506156182554 fit3 protocol driver does not support accessing IDE control registers (device control/altstatus). The DOS driver does not use these registers either (as observed from DOSEMU trace). But the HW seems to be capable of accessing these registers - I simply tried bit 3 and it works! The control register is required to properly reset ATAPI devices or they will be detected only once (after a power cycle). Tested with EXP Computer CD-865 with MC-1285B EPP cable and TransDisk 3000. Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/fit3.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/ata/pata_parport/fit3.c b/drivers/ata/pata_parport/fit3.c index bad7aa920cdc..d2b81cf2e16d 100644 --- a/drivers/ata/pata_parport/fit3.c +++ b/drivers/ata/pata_parport/fit3.c @@ -9,11 +9,6 @@ * * The TD-2000 and certain older devices use a different protocol. * Try the fit2 protocol module with them. - * - * NB: The FIT adapters do not appear to support the control - * registers. So, we map ALT_STATUS to STATUS and NO-OP writes - * to the device control register - this means that IDE reset - * will not work on these devices. */ #include @@ -37,8 +32,7 @@ static void fit3_write_regr(struct pi_adapter *pi, int cont, int regr, int val) { - if (cont == 1) - return; + regr += cont << 3; switch (pi->mode) { case 0: @@ -59,11 +53,7 @@ static int fit3_read_regr(struct pi_adapter *pi, int cont, int regr) { int a, b; - if (cont) { - if (regr != 6) - return 0xff; - regr = 7; - } + regr += cont << 3; switch (pi->mode) { case 0: