From patchwork Sun Jan 8 21:56:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 40586 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1865898wrt; Sun, 8 Jan 2023 13:59:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXsrWWY6LAk6btvxdfSjm/7KYrV1T9tX+6yuvvd0rQszaXRuQgiH4lwY0nMDigX/6dwo8Vbi X-Received: by 2002:a17:906:b7ce:b0:84d:411d:64a4 with SMTP id fy14-20020a170906b7ce00b0084d411d64a4mr2495158ejb.38.1673215179041; Sun, 08 Jan 2023 13:59:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673215179; cv=none; d=google.com; s=arc-20160816; b=zgacpA4AiHxlj0Ts90nPJwGnTHIbzUkSOHYaoFHftkw8WNjOdRQibF/VwA+Oh1nnGz 0TnjDx4FVd7CCR6ZfC+ktCpUuinpByLg4Info3yDuKOWSsndX/1gbrFsinpePQ8EndSd VEyP73AcSIdQc0dZUm3FBl/A4wYcWCIoeZRHvj5OzA1DtNGE5jrF0ZUJxAzBF7e6UjL+ tS8f39T8/uav2o15nYi+VUlhzjgKJYPytuCWDeFIaiLGuSBgvXCrAHryGwvnydUCXA68 1lxintTH68bkUWkBbGWWhY+dQimOGeTj88raK2tvwp16KN4qluwTk3Bf6UsjEPDoufdB /XtA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=ALqVvJuXLwUSBoF5D6uhACAP/H9LEzc1PAajsRyeUOE=; b=TiXx54b8t3gyHHJME9O4xEwCIZThU0ANSG/MV8BYOTAE/WO/flv0xS/FiJEpR5BddY yFok4CmCynT18J8bAQgHyZmvGsae7O/PfbnrQ1/EfGontj5MuZgbTotz+gWdJ04+nzUe yilX0um/jUj0O7alXTWtahGWJy0yX6lwpA1F0JryE+pqVzbIDp6gWLfRYjCOO+SduIce Cb3Ym68K6U8qU5orOhW+BoqW6QmkEIT1w5iUeI6lDcw9hFq5Wgf4isAXOxUq+s8I2vmD hq3fbxk/bAI3NfBiWfRyI2p6blt+A7iNqQ3N1WrZyInX9SAgewC7YSjId6rVlb3F399q QKQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WcLwB0Gm; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g25-20020a170906595900b007c4f6c371b0si6016582ejr.230.2023.01.08.13.59.16; Sun, 08 Jan 2023 13:59:39 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WcLwB0Gm; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236238AbjAHV5K (ORCPT + 99 others); Sun, 8 Jan 2023 16:57:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234075AbjAHV5I (ORCPT ); Sun, 8 Jan 2023 16:57:08 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 596437662 for ; Sun, 8 Jan 2023 13:57:07 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id bg13-20020a05600c3c8d00b003d9712b29d2so7714766wmb.2 for ; Sun, 08 Jan 2023 13:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ALqVvJuXLwUSBoF5D6uhACAP/H9LEzc1PAajsRyeUOE=; b=WcLwB0Gm3jAmcGo0U6UtO4r2gXLAa6dzHouVDpKHwQyobBm11f9mT73uAWSAZ1nUNZ O570BtAiIlYTRDIwy2h4D2rOqu+HdlWkdEtiY0jtRBsujp/hV+4RyRJ2XZDScX7V31kW HXCc5sGSzHBYoES/EyUieg+3OPutRdidAguCGbwIAiKD6vmqib2mDwhFygPzbJAJZjXJ Yc7fk7w2S1egX2zQtwTvp9bGP7d8zUCApxGKdR8En3D6k/Y/OjUuywKVP3vavxQZcQO8 ahLdUKl9vgTlBtCIaERH0TFQqGxM7V1p6JwPiBKiT5+iulxBjyLdN5/ABdARjeY67SVY LyXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ALqVvJuXLwUSBoF5D6uhACAP/H9LEzc1PAajsRyeUOE=; b=KuBCsew67JIZtwMjTzwgZY6AR+sPvYylErWbtVKsHoX5yxiKsLkNlwj+zUtDAKmguJ M//arksD2T+2n6YRTfrSeJA98lSgbr+Vq1gLopMRzMI4BW/Mx6LcHooLk4S+0gCcMxB9 pcDMYY1y4qcGf7CnEjfAmTB58w+L11VBxYXtUdr1aRj5G1CoS8PpJwP32bY6FAlmho1W gH1g8qMTygBgFg13vHJZ1UtQepIwa9+DD/RGEX4CNBAep8+/6rzDrldrlkpw4aeSNNxm 8sGuDInbPS3+kVVRAK7dQAxQvH8gmviq1ziSnegukaAFQYkoDeFulSE48mR4k/IdMyra v86A== X-Gm-Message-State: AFqh2kpRTT+6/d2CTS0FR1DJVWio49zL/2RM9E+5I4vSQcQxnEcWVzgg xAoHtpJiHDqFUEigp+TUUO9RECPkJyc= X-Received: by 2002:a05:600c:a10:b0:3d2:2904:dfe9 with SMTP id z16-20020a05600c0a1000b003d22904dfe9mr49001127wmp.21.1673215025704; Sun, 08 Jan 2023 13:57:05 -0800 (PST) Received: from localhost.localdomain ([2a10:d582:3bb:0:63f8:f640:f53e:dd47]) by smtp.gmail.com with ESMTPSA id h15-20020a05600c314f00b003d99469ece1sm14654071wmo.24.2023.01.08.13.57.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 13:57:05 -0800 (PST) From: Sudip Mukherjee To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, "Maciej W. Rozycki" , Sudip Mukherjee Subject: [PATCH 1/7] parport_pc: Remove stale `parport_pc_ecp_read_block_pio' reference Date: Sun, 8 Jan 2023 21:56:50 +0000 Message-Id: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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?1754493279413273352?= X-GMAIL-MSGID: =?utf-8?q?1754493279413273352?= From: "Maciej W. Rozycki" Complement commit 991214386dee ("parport: remove unused dead code from lowlevel drivers") and remove a stale piece of commented-out code that refers to a function removed with said commit. Signed-off-by: Maciej W. Rozycki Signed-off-by: Sudip Mukherjee --- drivers/parport/parport_pc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 5784dc20fb38..de7afbea96cd 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -2119,8 +2119,6 @@ struct parport *parport_pc_probe_port(unsigned long int base, p->ops->compat_write_data = parport_pc_compat_write_block_pio; #ifdef CONFIG_PARPORT_1284 p->ops->ecp_write_data = parport_pc_ecp_write_block_pio; - /* currently broken, but working on it.. (FB) */ - /* p->ops->ecp_read_data = parport_pc_ecp_read_block_pio; */ #endif /* IEEE 1284 support */ if (p->dma != PARPORT_DMA_NONE) { pr_cont(", dma %d", p->dma); From patchwork Sun Jan 8 21:56:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 40587 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1865989wrt; Sun, 8 Jan 2023 13:59:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXt1PqEczATuHnWZ3D8h7Lcm4QVS/NQkXTEXiPkSGT0ncwjuuL1hKWmmNOKiDT4Kw3iZuQga X-Received: by 2002:a17:906:c250:b0:79e:4880:dd85 with SMTP id bl16-20020a170906c25000b0079e4880dd85mr46842999ejb.47.1673215197728; Sun, 08 Jan 2023 13:59:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673215197; cv=none; d=google.com; s=arc-20160816; b=zBtR2R1h9ijGvWriAVtxGK9xYVvqYdt50VIuhKGqb70Id2RCQcSk9lMO8vMksZ57CO 36V0nsyMxsh8CXEAq2G7gbku58oe2uQZMn2VAVa3Ss2krPb9Ytqp0pOjOReZPKXgdeWC 7olS2PEZwdfGLgfMMy1s7G7ZlmChhfco37J2Wwe3KJVVL4Jzy2uVLUexSzHOEyZIl2AA xIt/8JW/SfGSSKkApVQ3z73/xjpQKfxSG8B22BlNixRWMcbazPZaeJSdMR/AKUOYAyX5 4LTpcFk6lQaEo3ZYwS3JeuVye53Z0mvc8w2yyKzHYFXfGG/cvLxeqasZcDq6uh+BqwWo WJ1g== 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 :dkim-signature; bh=PuHjicZYsZv1YxafD0PitIxhFzu7w+N5/HlaM8PLcI4=; b=U8E5XTYTAa5CrZrEAm1GozTrNR3PtjZ81A6c9t1l+mzO2WXMyO1kmbP4VCxCY0DZ+1 QAoQT11pOwvmQ/LIiNeHc4pyOSU6FOvh8GEGvguOCKhPdsCeyp9NovEzWwGBcrlMnjbB gvEkzkaBM3ZIl1PtJFy5jOc6oXWRc6f17ZSqt9ayNT1oYA57cVG49x3RIUpIP1ko4wxM bMsG3yUdXVrd6FZ+qhAnKrsJoUcPMbI3eP775dn2HvUD1acmh3mWbCUhxCCIhvKuzMv5 pH/5+ui7ezMBYGXH3NxS0mfxBmhalj2D/rTkvO4zeRjx/6rm6tH+/T7oGCcxQDRnQ3UO 2kFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ldezYofx; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt20-20020a170907729400b00812e75e5257si7965243ejc.293.2023.01.08.13.59.34; Sun, 08 Jan 2023 13:59:57 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ldezYofx; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236260AbjAHV5N (ORCPT + 99 others); Sun, 8 Jan 2023 16:57:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236219AbjAHV5J (ORCPT ); Sun, 8 Jan 2023 16:57:09 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2285B7677 for ; Sun, 8 Jan 2023 13:57:08 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so5241699wms.2 for ; Sun, 08 Jan 2023 13:57:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PuHjicZYsZv1YxafD0PitIxhFzu7w+N5/HlaM8PLcI4=; b=ldezYofxF0jJjJeJC1RD3qkb4zEl0FmqQ0EzLX/Nkhv7NxXSNNuTeZx31gd9ZYfA9t YXnoXkg4aiNaDbUAOFjZ2a166mwOtET4tc5l0zf9nl97m3RqWI9/NqTjxyJNMWoXdiC1 G7d07sdLjN0QUk221voWKI1iZntHD7Yr1vj+jnnIvKGQPu4jBRnp0DW/uxYzMpKjlvWB pzCRMO0Zu1Ok0opQ8rJFJoVkih8W51eiuzIzpn3RFUc9297YdFG1oUh0f8AKtXi1+CrO clVWqODs4HTpr+0d+eyFk+EofoizImSSPjhwnyCZE6yWu/ge9KhR90Jd1vQwRwmGeape tKbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PuHjicZYsZv1YxafD0PitIxhFzu7w+N5/HlaM8PLcI4=; b=DZaL1Nev9UCpC1a6zfgIKI67l7ery4TOMascHT6TEKKo99B18ZveVP/K0fYFQ8S6b6 /yKj58+9slVW6hXFW6abvbOJORZuNUGi3wpBuBPkcoBdbvRkvJ7mQEsJjYytb7ug1jR4 mwQ1AAy6i3QYd11/IeKjdacEHaiyT+jdZ2xkeHzuogr30Kh2Jr7U3ZFWJ83LcImjfnpB B3F0Uod6lJUBPW6dZ72LIzOhQy3VCgX634IrzyaQwYYLuF2x99wRWRU+wjO3Qi9yDuKc rNyX3S8RT7LgoTucwhP+8QFS827QwJIxAtCFm99+6ZgauuxG1tRmDXwBxo7NCm6/GNeh cS/w== X-Gm-Message-State: AFqh2kp3HXOg1FNvboGbeq7A9YzD6FO9Zkz4KaSs3Wq9mT2ibiq560rY F9ip0+1aR5nrZuSzS5ipYXs= X-Received: by 2002:a05:600c:2247:b0:3d3:4b1a:6ff9 with SMTP id a7-20020a05600c224700b003d34b1a6ff9mr45128622wmm.26.1673215026538; Sun, 08 Jan 2023 13:57:06 -0800 (PST) Received: from localhost.localdomain ([2a10:d582:3bb:0:63f8:f640:f53e:dd47]) by smtp.gmail.com with ESMTPSA id h15-20020a05600c314f00b003d99469ece1sm14654071wmo.24.2023.01.08.13.57.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 13:57:06 -0800 (PST) From: Sudip Mukherjee To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, "Maciej W. Rozycki" , Sudip Mukherjee Subject: [PATCH 2/7] parport_pc: Let chipset drivers mask unsupported modes Date: Sun, 8 Jan 2023 21:56:51 +0000 Message-Id: <20230108215656.6433-2-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> References: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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?1754493299276059601?= X-GMAIL-MSGID: =?utf-8?q?1754493299276059601?= From: "Maciej W. Rozycki" Rename `parport_pc_probe_port' to `__parport_pc_probe_port' and add a `mode_mask' parameter so that callers can specify a mask of unsupported modes to exclude even if mode probing seems to indicate otherwise. Add a `parport_pc_probe_port' wrapper with an implicit mask of 0 for the current callers to use. No functional change at this point, but the configuration of data write handlers is now no longer intertwined with determination and reporting of available modes. Signed-off-by: Maciej W. Rozycki Signed-off-by: Sudip Mukherjee --- drivers/parport/parport_pc.c | 45 ++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index de7afbea96cd..9daaaaa305e6 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -2000,11 +2000,12 @@ static int parport_dma_probe(struct parport *p) static LIST_HEAD(ports_list); static DEFINE_SPINLOCK(ports_lock); -struct parport *parport_pc_probe_port(unsigned long int base, - unsigned long int base_hi, - int irq, int dma, - struct device *dev, - int irqflags) +static struct parport *__parport_pc_probe_port(unsigned long int base, + unsigned long int base_hi, + int irq, int dma, + struct device *dev, + int irqflags, + unsigned int mode_mask) { struct parport_pc_private *priv; struct parport_operations *ops; @@ -2116,18 +2117,28 @@ struct parport *parport_pc_probe_port(unsigned long int base, p->dma != PARPORT_DMA_NOFIFO && priv->fifo_depth > 0 && p->irq != PARPORT_IRQ_NONE) { p->modes |= PARPORT_MODE_ECP | PARPORT_MODE_COMPAT; + if (p->dma != PARPORT_DMA_NONE) + p->modes |= PARPORT_MODE_DMA; + } else + /* We can't use the DMA channel after all. */ + p->dma = PARPORT_DMA_NONE; +#endif /* Allowed to use FIFO/DMA */ + + p->modes &= ~mode_mask; + +#ifdef CONFIG_PARPORT_PC_FIFO + if ((p->modes & PARPORT_MODE_COMPAT) != 0) p->ops->compat_write_data = parport_pc_compat_write_block_pio; #ifdef CONFIG_PARPORT_1284 + if ((p->modes & PARPORT_MODE_ECP) != 0) p->ops->ecp_write_data = parport_pc_ecp_write_block_pio; -#endif /* IEEE 1284 support */ - if (p->dma != PARPORT_DMA_NONE) { +#endif + if ((p->modes & (PARPORT_MODE_ECP | PARPORT_MODE_COMPAT)) != 0) { + if ((p->modes & PARPORT_MODE_DMA) != 0) pr_cont(", dma %d", p->dma); - p->modes |= PARPORT_MODE_DMA; - } else + else pr_cont(", using FIFO"); - } else - /* We can't use the DMA channel after all. */ - p->dma = PARPORT_DMA_NONE; + } #endif /* Allowed to use FIFO/DMA */ pr_cont(" ["); @@ -2237,6 +2248,16 @@ do { \ platform_device_unregister(pdev); return NULL; } + +struct parport *parport_pc_probe_port(unsigned long int base, + unsigned long int base_hi, + int irq, int dma, + struct device *dev, + int irqflags) +{ + return __parport_pc_probe_port(base, base_hi, irq, dma, + dev, irqflags, 0); +} EXPORT_SYMBOL(parport_pc_probe_port); void parport_pc_unregister_port(struct parport *p) From patchwork Sun Jan 8 21:56:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 40590 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1866797wrt; Sun, 8 Jan 2023 14:02:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXuuUks8f1XxsJ/lYfRbSnHjAUv8etlMLYRa/AkOC7CmkGMdC+063lxidLT4ek/KdzG4LQL+ X-Received: by 2002:a17:906:99c7:b0:7b5:860d:7039 with SMTP id s7-20020a17090699c700b007b5860d7039mr54610068ejn.10.1673215325817; Sun, 08 Jan 2023 14:02:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673215325; cv=none; d=google.com; s=arc-20160816; b=Pu8fobiPSbdQFbwACq7zvKWIVkWccDXjpFJQCGI8Du/1Ls/pmu/s6UFoxgfUqG25bu 5a+1O+7fpVdIipdFIhXE4ad87O6wYc8inn67Ns/NP39vafObIeY+A90fjYp3JqGgG0Tl EiTfXNmfR2GqfWekJ/t37KpM7Ku6kDCCsor1jw+31QXABiqzeSGx1ewm5/sG4K0PUpS7 BBzhZv95NveWORAmzU+gsompMPXjbRwpkhGucPCgzeNbcLzXcZlISFw6b4xprTBcLlFU CK/ATbCzeHWgb0d1iF30bput3r+e+IP2iuWTz0JN6D5FrCsc/YslzRQ9JGF1bp6Nu5DD P5dQ== 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 :dkim-signature; bh=Pmu+ooljm/HGcSlkAl7hxuicOXpBLsPaLMjXgjubWRw=; b=LtLa8ZqKTmlPNSteejdljEexvWhPkIuumG8UVPiqX+K0hOA/QM2zJCsr1NSmuZPgpf CfbMlxPqWP3a7yRHJFGsuTtLqjIny/wzOChOhIciTL1Dz8oyyjPhI3Esf54ppXhwAbPY PHLAsIXg4v8fon0+pZepTvR46KvMA0ZOXZQ9loILpNwaXndXzi1jEZ4fLIWgLL1UaqLR Y51WFGAHmvpONmmUe+1a6HrZ0r4JGZSVJvcnuP2t/806o4wfY2Bdor5fEu7H4L1GPdTc ymniW9zTWpba06W9gTwHjNTKuZGGqHjTXwEbKQhBiS8WUA7xdgPnqex/+RWajV2UCHm6 CYOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hbFFDMrU; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb32-20020a170907162000b0083ad85fbd65si8406060ejc.347.2023.01.08.14.01.42; Sun, 08 Jan 2023 14:02:05 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hbFFDMrU; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236294AbjAHV5Q (ORCPT + 99 others); Sun, 8 Jan 2023 16:57:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236231AbjAHV5J (ORCPT ); Sun, 8 Jan 2023 16:57:09 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B02907662 for ; Sun, 8 Jan 2023 13:57:08 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id bg13-20020a05600c3c8d00b003d9712b29d2so7714786wmb.2 for ; Sun, 08 Jan 2023 13:57:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Pmu+ooljm/HGcSlkAl7hxuicOXpBLsPaLMjXgjubWRw=; b=hbFFDMrUQuk+KC+ExU005L22CrNW+1MV0BI63KaiQtchIoe3kQ/wZvXXJaUjFlFZPX rcef4uZRtvacGDNzChEkD4iX+A3uGIAB77Eh2h1d4IsaGLzL4RGbaSdstuZAbSETkDyE azzyVy6X6xfPOlTQDRRLERNlXF+5/IT1dPqYcwUKZ9WeYx+w3BuGcDaNWPx1TOgvzPle 3Q8H09oSOu6VEoQZI7Rcty/ynbAR9dSYId6530Iu4LVwDnx1pD+AdiwlaC3XgbhoTGN0 ef9PbV+xtMAoUaW3A4VsBMBwPXqi6ruV8ZFFSMm1FnhujBLCf6GjWncB7nghKev/Obwc bEXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Pmu+ooljm/HGcSlkAl7hxuicOXpBLsPaLMjXgjubWRw=; b=jETMWlFc7cIm2qjNwdtauHJHTVCgEFUURrr0hOg5N9wye4cB9YUxqz3BqxhgPyYgjD siTdylSZx0w8yyopiMne9vUQLi5cZm8qpnwhKIbISTDoOLoYgpWQ98EpR5nQncWIHdc1 QMvyPwu7qA7mTPYV0gluJ9B+rq3vWFhmTwSkTs+Vj856V+ARdFniROMT6skwrAh1WHZu atLD0+9t666t278xtWgXfeyeNOcw0lFvvxWt6IsoRdQ8tNlZbbCN2UDHg4hTFDdoUg62 4PzBvOeGy6CxjquCrxvvDwreNRZ3CTM93t8q/J6Q8p4LsYIqpwEh2piWBBCg+UOhHKOG GT0w== X-Gm-Message-State: AFqh2kpvjHUlHcAqn1sXV3vjOwRUKghQh+ePJ/oUzEzy0KDFKmHzcVor Bz6ZiWOX89nML6wU3bo3/7ShiyB9Shs= X-Received: by 2002:a05:600c:3d1b:b0:3d0:6a57:66a5 with SMTP id bh27-20020a05600c3d1b00b003d06a5766a5mr43683098wmb.0.1673215027288; Sun, 08 Jan 2023 13:57:07 -0800 (PST) Received: from localhost.localdomain ([2a10:d582:3bb:0:63f8:f640:f53e:dd47]) by smtp.gmail.com with ESMTPSA id h15-20020a05600c314f00b003d99469ece1sm14654071wmo.24.2023.01.08.13.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 13:57:06 -0800 (PST) From: Sudip Mukherjee To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, "Maciej W. Rozycki" , Sudip Mukherjee Subject: [PATCH 3/7] parport_pc: Let chipset drivers mask ECR bits on writes Date: Sun, 8 Jan 2023 21:56:52 +0000 Message-Id: <20230108215656.6433-3-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> References: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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?1754493433803026992?= X-GMAIL-MSGID: =?utf-8?q?1754493433803026992?= From: "Maciej W. Rozycki" Provide an `ecr_writable' parameter to `__parport_pc_probe_port' so that callers can specify a mask of bits to modify on ECR writes. To avoid the need for separate bit set and bit clear masks always set bit 0 whenever a non-zero mask has been set, as all the currently known cases where a mask is required, that is Oxford Semiconductor devices, do require this bit to be set. If further cases are discovered where the bit is required to be clear, we can update code accordingly, but chances are very low as the bit is supposed to be read-only[1]. Skip ECR probing, which can be problematic as the Oxford Semiconductor OX12PCI840 part has been reported to lock up on setting bit 2, whenever a non-zero mask has been requested by a port subdriver, assuming that the ECR must be there if the subdriver has requested a specific way to access it. References: [1] "Extended Capabilities Port Protocol and ISA Interface Standard", Microsoft Corporation, Revision: 1.14, July 14, 1993, Table 14 "Extended Control Register" Signed-off-by: Maciej W. Rozycki Signed-off-by: Sudip Mukherjee --- drivers/parport/parport_pc.c | 46 +++++++++++++++++++++++------------- include/linux/parport_pc.h | 3 +++ 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 9daaaaa305e6..ad49fd356c7b 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -106,15 +106,22 @@ static int pnp_registered_parport; static void frob_econtrol(struct parport *pb, unsigned char m, unsigned char v) { + const struct parport_pc_private *priv = pb->physport->private_data; + unsigned char ecr_writable = priv->ecr_writable; unsigned char ectr = 0; + unsigned char new; if (m != 0xff) ectr = inb(ECONTROL(pb)); - pr_debug("frob_econtrol(%02x,%02x): %02x -> %02x\n", - m, v, ectr, (ectr & ~m) ^ v); + new = (ectr & ~m) ^ v; + if (ecr_writable) + /* All known users of the ECR mask require bit 0 to be set. */ + new = (new & ecr_writable) | 1; - outb((ectr & ~m) ^ v, ECONTROL(pb)); + pr_debug("frob_econtrol(%02x,%02x): %02x -> %02x\n", m, v, ectr, new); + + outb(new, ECONTROL(pb)); } static inline void frob_set_mode(struct parport *p, int mode) @@ -1479,21 +1486,24 @@ static int parport_ECR_present(struct parport *pb) struct parport_pc_private *priv = pb->private_data; unsigned char r = 0xc; - outb(r, CONTROL(pb)); - if ((inb(ECONTROL(pb)) & 0x3) == (r & 0x3)) { - outb(r ^ 0x2, CONTROL(pb)); /* Toggle bit 1 */ + if (!priv->ecr_writable) { + outb(r, CONTROL(pb)); + if ((inb(ECONTROL(pb)) & 0x3) == (r & 0x3)) { + outb(r ^ 0x2, CONTROL(pb)); /* Toggle bit 1 */ - r = inb(CONTROL(pb)); - if ((inb(ECONTROL(pb)) & 0x2) == (r & 0x2)) - goto no_reg; /* Sure that no ECR register exists */ - } + r = inb(CONTROL(pb)); + if ((inb(ECONTROL(pb)) & 0x2) == (r & 0x2)) + /* Sure that no ECR register exists */ + goto no_reg; + } - if ((inb(ECONTROL(pb)) & 0x3) != 0x1) - goto no_reg; + if ((inb(ECONTROL(pb)) & 0x3) != 0x1) + goto no_reg; - ECR_WRITE(pb, 0x34); - if (inb(ECONTROL(pb)) != 0x35) - goto no_reg; + ECR_WRITE(pb, 0x34); + if (inb(ECONTROL(pb)) != 0x35) + goto no_reg; + } priv->ecr = 1; outb(0xc, CONTROL(pb)); @@ -2005,7 +2015,8 @@ static struct parport *__parport_pc_probe_port(unsigned long int base, int irq, int dma, struct device *dev, int irqflags, - unsigned int mode_mask) + unsigned int mode_mask, + unsigned char ecr_writable) { struct parport_pc_private *priv; struct parport_operations *ops; @@ -2054,6 +2065,7 @@ static struct parport *__parport_pc_probe_port(unsigned long int base, priv->ctr = 0xc; priv->ctr_writable = ~0x10; priv->ecr = 0; + priv->ecr_writable = ecr_writable; priv->fifo_depth = 0; priv->dma_buf = NULL; priv->dma_handle = 0; @@ -2256,7 +2268,7 @@ struct parport *parport_pc_probe_port(unsigned long int base, int irqflags) { return __parport_pc_probe_port(base, base_hi, irq, dma, - dev, irqflags, 0); + dev, irqflags, 0, 0); } EXPORT_SYMBOL(parport_pc_probe_port); diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h index 3d6fc576d6a1..f1ec5c10c3b3 100644 --- a/include/linux/parport_pc.h +++ b/include/linux/parport_pc.h @@ -26,6 +26,9 @@ struct parport_pc_private { /* Whether or not there's an ECR. */ int ecr; + /* Bitmask of writable ECR bits. */ + unsigned char ecr_writable; + /* Number of PWords that FIFO will hold. */ int fifo_depth; From patchwork Sun Jan 8 21:56:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 40588 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1866138wrt; Sun, 8 Jan 2023 14:00:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXv11zDw5Kvddk8fE6uFCEMFgcPGBFbxmSR2dLmwc1BxKB/ANqEDhkGzVgw35BpqULC2vAAK X-Received: by 2002:a05:6402:124a:b0:47f:b4f3:6db9 with SMTP id l10-20020a056402124a00b0047fb4f36db9mr66524928edw.13.1673215226464; Sun, 08 Jan 2023 14:00:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673215226; cv=none; d=google.com; s=arc-20160816; b=QDv4CNdhsDzSy9bFSiaHuKIIY+1gbqW+Gs1/l+yUaZ6RwMpb40pccYp64H53rTM4eG iYzd28FAu8e2YDce7mlEQY1nDEbhMwm+8Z7V5d1WBKl4IhhuTA7eh71OHmbJifzQnl4B 7hizDXKKaZVMMrrB6NPrvNrM60DFUCIOGmM+SQUycb1t+TT7bBuH+azrGskJkxSPfyJK wWxfr0MdZbrE4Xl3uqNo2he6nP7cmFhVZ0jE17948vQZVRE2AdNEGU3YXZmG898lU5K/ MjK8Kjdq5oDhkrJXhhZtWdFuOXuKkKDWyUmBNwrkEv+NBdqpL4PYmMJoB5Gns32iKLf+ YSCQ== 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 :dkim-signature; bh=HQpX0128CCnGU+qDUpUU498cMch/d898rzRC4KudPfQ=; b=wGR/sfLELsy6wRtI/jWjNcjszXElrqcvJ8cn4WTvJSAuWnIEKHJvrLLQfArM9GNtKs L1UnIYA0m0cRMR2Nsh+pfahe+KYHSQKDW5cd9hrUVeqUvzIiXypg9/FciEPZWMEgTEd3 T/DKIIKEqb2adL6P4bzcOU2qHKr+j1b8vf28qCUc7kvg9ICyra8gLeHxuHPXNtN6jy6N 8HOduzEjqjh4Xf9xWD/lY0kBo+jsljXqTO1lRbJxDjJ1HCIqKKVQis4rElJS/dpeB+ZY XD6kA7n5BnUd1rqX7OnsKJNq0s33OoJdSoCOYUGSHsjTYKYv1gU4Slt9GGPW2ON253Jw WsTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PIIvrKEL; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w22-20020aa7dcd6000000b004837719c1cfsi7097067edu.220.2023.01.08.14.00.03; Sun, 08 Jan 2023 14:00:26 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PIIvrKEL; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236320AbjAHV5T (ORCPT + 99 others); Sun, 8 Jan 2023 16:57:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236235AbjAHV5K (ORCPT ); Sun, 8 Jan 2023 16:57:10 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C8877677 for ; Sun, 8 Jan 2023 13:57:09 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id l26so4989946wme.5 for ; Sun, 08 Jan 2023 13:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HQpX0128CCnGU+qDUpUU498cMch/d898rzRC4KudPfQ=; b=PIIvrKELxWqdkL8YTQTCAmMKZlufIQIy90RYM0Fadeh7r5M5U6Vggmr9RqD2ZMSJAd daQEfhW+p8U4SxDxaAOys5lorDDbNvvDtYke1ae3fxSqj3OqLs1y/KA2hmsZ33Zo948N JzUA3GJDETwenqI4uix3TGMwo6Cmwji9TCGZunCQFGzI60+uQT5nAJ90ttL1bs8ksoxx TCXRyuuICQGl6yo1CM+psMJc7vQ8nzVjynbilBuLcZGnpIgYGIqWyrteYUypDpTSXfTL 66KpSKt170HsCPMXGKpxfxSwt3aqX2CDF4126UPW1RAPe8YNsfAES90miOlJsXi30VMm igBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HQpX0128CCnGU+qDUpUU498cMch/d898rzRC4KudPfQ=; b=xwPka45U/zr0aTxO2r/LgfYO3puP7ibc5ZFYf99dBzv1oTS8x+ydWO3tmESb94viSz NNVg9nO6U4jB8J8j8v8PQ1a27XiUbNnGEMhlN+snIXUzvYHqSprxWVXkj3pLGlWkfeb1 HTZ0bEAQ8ymBgASzytn+fsm/EyeKE31n/DQXj49tRRXdripGfc9+lkENndI/axCzWbeu NaSsW6l9kHpNVa9D1QeYDUpUM0vRjF+jZAIBCG9omKeby/TDfTf5mCbdoIPGUSvP1Wbv hwNVbgneZZLqArVgKpMhe4tt0WCzNmyVMFcE/Aq0wSWKpvU6cRlgO7HOZEl4m15nsQ7p lqXA== X-Gm-Message-State: AFqh2kq7brwA1A14xofZoGd67lDQnjDP/sABFvOLQLiD7eaSWkLXwNpn evJlmuv9fFKwzJCuD3q57qE= X-Received: by 2002:a05:600c:254:b0:3d2:2c86:d2b2 with SMTP id 20-20020a05600c025400b003d22c86d2b2mr55039647wmj.24.1673215027907; Sun, 08 Jan 2023 13:57:07 -0800 (PST) Received: from localhost.localdomain ([2a10:d582:3bb:0:63f8:f640:f53e:dd47]) by smtp.gmail.com with ESMTPSA id h15-20020a05600c314f00b003d99469ece1sm14654071wmo.24.2023.01.08.13.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 13:57:07 -0800 (PST) From: Sudip Mukherjee To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, "Maciej W. Rozycki" , Sudip Mukherjee Subject: [PATCH 4/7] parport_pc: Add a mode mask field for PCI devices Date: Sun, 8 Jan 2023 21:56:53 +0000 Message-Id: <20230108215656.6433-4-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> References: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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?1754493329234774383?= X-GMAIL-MSGID: =?utf-8?q?1754493329234774383?= From: "Maciej W. Rozycki" Add a mode mask field for PCI devices and use `__parport_pc_probe_port' in place of `parport_pc_probe_port' to apply it. Signed-off-by: Maciej W. Rozycki Signed-off-by: Sudip Mukherjee --- drivers/parport/parport_pc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index ad49fd356c7b..2928f36e05ff 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -2659,6 +2659,9 @@ static struct parport_pc_pci { /* -1 if not there, >6 for offset-method (max BAR is 6) */ } addr[4]; + /* Bit field of parport modes to exclude. */ + unsigned int mode_mask; + /* If set, this is called immediately after pci_enable_device. * If it returns non-zero, no probing will take place and the * ports will not be used. */ @@ -2862,9 +2865,10 @@ static int parport_pc_pci_probe(struct pci_dev *dev, id->vendor, id->device, io_lo, io_hi, irq); } data->ports[count] = - parport_pc_probe_port(io_lo, io_hi, irq, - PARPORT_DMA_NONE, &dev->dev, - IRQF_SHARED); + __parport_pc_probe_port(io_lo, io_hi, irq, + PARPORT_DMA_NONE, &dev->dev, + IRQF_SHARED, + cards[i].mode_mask, 0); if (data->ports[count]) count++; } From patchwork Sun Jan 8 21:56:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 40589 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1866295wrt; Sun, 8 Jan 2023 14:00:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXsZu7ZyTLdrHvYNgu1ZErcny93JoWxONKadZ29FwYOdtbUxtARghx4rb5wdzL3E2tP2q2K1 X-Received: by 2002:a17:906:2442:b0:84d:141f:6784 with SMTP id a2-20020a170906244200b0084d141f6784mr9590718ejb.29.1673215253365; Sun, 08 Jan 2023 14:00:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673215253; cv=none; d=google.com; s=arc-20160816; b=vsdbg/XDDfrd9w+m5OREWk8cmGOd+1IQweXrNOW8kglEnP9koUIF8/Nl2rYvmHXdrc oTPUmJGjBwdSjuW/Z8Aq5KOyLjtQaWeyuII4CDIRv7AyedgOuzPr1H8IEWKpSSSGtSrP fPpGhk10v5ugzpDRBaPM7UIFJxDk1aT58hWzBK3A10rBv2o2TMsvDYihBUVIOaq/8cIR BlpnH2odRbTZ1AzuPwZ4vEF04Btt5+x8ixkcL74NiIc/W3NhRYIp7ZrNZHBxtpS08Z5X e6JAMW09FAap/Zm82tfNsSKGBiaRhE+SIZ+Xzp2qp0XVyDjvcputtqFnMyplwA81NSNL 1RLw== 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 :dkim-signature; bh=KkvkO0ggi/mdrA5jtRFDVlYd+gaJ5/Kv6++Mtwxlna0=; b=Za+e6usPe0VdtNK0bU5UPdfbUxJlP92hKxPkPpbyc00wyALLkttWp/fTB0Ov+1bcpf IdS4wAGYI1Sr/y6Pv6sMhHo3QDvDdYna+L01NIV2MvFg0PgtSeSMb9lBY0gGrTMDnbE0 IRrw2zRIF4Dv/qaPn9mXxyND4BIAXuxuBTWpmWfm4zxoR/14U+av8sv7ignWfGm/uDFa LuVf50+WIqHZZxxk6Ba8X4wRB4BdnU4LEwZavhDvuBFRxMEuMuF72IwE9lJhN3imT8Af +DI8OTWvp79Jvi+b1mOatfnTjny7p6BDAsfgOcaBjSgbFI9OMEC9tPfJZZ7oAGWK69Ls HM3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="UN5P/yaV"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc3-20020a1709078a0300b0078d20d71475si8811462ejc.413.2023.01.08.14.00.30; Sun, 08 Jan 2023 14:00:53 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b="UN5P/yaV"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234698AbjAHV5W (ORCPT + 99 others); Sun, 8 Jan 2023 16:57:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236242AbjAHV5L (ORCPT ); Sun, 8 Jan 2023 16:57:11 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE04C767B for ; Sun, 8 Jan 2023 13:57:09 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id j16-20020a05600c1c1000b003d9ef8c274bso879769wms.0 for ; Sun, 08 Jan 2023 13:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KkvkO0ggi/mdrA5jtRFDVlYd+gaJ5/Kv6++Mtwxlna0=; b=UN5P/yaV2TfnhdDTe4qhIY8cgRyeNXREfjzV5AkC8g1HT8k4At0S2eySfYLFYFjbh3 3857J8xEYMC5ET5kqdryIIIEqlmrrFep2krg23yYAVL6Vb3ClGKY4TrbyzHrcavR1UQk xkcPw97WyBX2PDCfmTv0g+jlltZrqKkj/fh/r0BCfGFG6BRPQAIMBkDfJ98HSBVmTyOS DG776UbRUBIbRVpsWcYlYR0AYnD+WKxg6p7pF87Ib+A4TV1gEs49jaYeHMcM8kEMdEzs 6hVpAgmYw+37w1orj7eBLKzw10kZ+g98XiYIbDLGijbue6j+5WJy7E+B+1+IkuEqa4nz 6DYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KkvkO0ggi/mdrA5jtRFDVlYd+gaJ5/Kv6++Mtwxlna0=; b=dGhPk2ccnUQ3pD2e34B8eERGPCV1aBum6tQtWxnnUPooKvPxqyteih+/Np2M/moUF/ N52TIEyr9YGSrA8j6RVe0FEXlAdM30IXddFwlsRHMvQ0A0rNQlAG2HoTYzq+NWGNNbQT kfrnNV4WuvewvmIkIokFRTzOW4Zay53Vvyv3jPd4YTiUphgWyNSIy9Jdvsx9ollanGzs K8a5HIgEDeCddknrwIgr6Vj/b34YGwjLRt26QgmrAq9eni5Z8x/UYGE4d4yOxG8J8705 GYaDW10+VBE8lpMWxDLKeEDRkIujRqKZtXcIyll6RnGKjbzsFQ+5JbygiBMeDwvwmxCi WclQ== X-Gm-Message-State: AFqh2kpDWtpBBzWzjx1Q2NLvzWFsgLkGG/COhDVILkmANX9VZZskYPFX 7AXmfuqOnMMqHEoVHpKD5fQ= X-Received: by 2002:a05:600c:4f02:b0:3d9:f217:6f6b with SMTP id l2-20020a05600c4f0200b003d9f2176f6bmr94043wmq.33.1673215028533; Sun, 08 Jan 2023 13:57:08 -0800 (PST) Received: from localhost.localdomain ([2a10:d582:3bb:0:63f8:f640:f53e:dd47]) by smtp.gmail.com with ESMTPSA id h15-20020a05600c314f00b003d99469ece1sm14654071wmo.24.2023.01.08.13.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 13:57:08 -0800 (PST) From: Sudip Mukherjee To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, "Maciej W. Rozycki" , Sudip Mukherjee Subject: [PATCH 5/7] parport_pc: Add an ECR mask field for PCI devices Date: Sun, 8 Jan 2023 21:56:54 +0000 Message-Id: <20230108215656.6433-5-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> References: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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?1754493357585161941?= X-GMAIL-MSGID: =?utf-8?q?1754493357585161941?= From: "Maciej W. Rozycki" Add a bitmask field specifying writable ECR bits for PCI devices and apply it via `__parport_pc_probe_port'. Signed-off-by: Maciej W. Rozycki Signed-off-by: Sudip Mukherjee --- drivers/parport/parport_pc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 2928f36e05ff..d7e64f6dfe90 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -2662,6 +2662,10 @@ static struct parport_pc_pci { /* Bit field of parport modes to exclude. */ unsigned int mode_mask; + /* If non-zero, sets the bitmask of writable ECR bits. In that + * case additionally bit 0 will be forcibly set on writes. */ + unsigned char ecr_writable; + /* If set, this is called immediately after pci_enable_device. * If it returns non-zero, no probing will take place and the * ports will not be used. */ @@ -2868,7 +2872,8 @@ static int parport_pc_pci_probe(struct pci_dev *dev, __parport_pc_probe_port(io_lo, io_hi, irq, PARPORT_DMA_NONE, &dev->dev, IRQF_SHARED, - cards[i].mode_mask, 0); + cards[i].mode_mask, + cards[i].ecr_writable); if (data->ports[count]) count++; } From patchwork Sun Jan 8 21:56:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 40591 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1867117wrt; Sun, 8 Jan 2023 14:02:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXumB2eRkIwOog4oK6bPzMsIf9euWQb4dAyXS9PvJn9Y8cs18nUozMHZcSNhFzk7dClXNHZm X-Received: by 2002:a17:906:8a43:b0:84d:1f56:7415 with SMTP id gx3-20020a1709068a4300b0084d1f567415mr7645901ejc.53.1673215377345; Sun, 08 Jan 2023 14:02:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673215377; cv=none; d=google.com; s=arc-20160816; b=tA4tSGxoQnvYkrZWPpXHz0mP3yoePJmebCKkG3Omx0dAjBZkS9RF1DQ0hHvD1Hdp7h lQDjqnzXeHcQGZt8iHZgqcJT0GSeEOvjxjeZJPDuPF7cc4OCqVx+8+BRjt1l+3GrJ+sF LoJ0PoTM63XHRmnDtG/COyosMI0vyRfRxNq64MRAeo4zbwat2HUQtWA17Vp7nJRIekv/ BfCXGYKkV2HD5csB14T+BmuXiJua7BfTV23JP593aC8NiV6qcC/clnqToC2oK7Rf5251 d/qOnjlcZ1nf2bq+ms9J2flIWNlqD90MLtMqeETM8zHS7bg8Ao9M4SD83bq7gb99Ek80 2ttA== 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 :dkim-signature; bh=kEK//qA/GZwTCDOY0eW42xYLYPIkWYZxLksmuivpZXk=; b=USsIFI3U/dA9fZ3bPvO0hHSw7ZVoVkJBjkUbDkog3WhsWCSrgD4NYVffA7bbnWWkA8 +g2Pes8OhT2q+AAM/a+Rc1qsq9n+S4vCvenJVfM2ZlQhxZsy40fViIgxEvYQdx9PisXB PRbeBIVMVYbdJYaggtzcJ9VLhmKPdjQ326IoNym1R6Cg1B8sWmoSCArnF2hwJ+xSSrrp oa/3PFKkyR5atUgvHu/Bc88MGOyPVnMVseerycSSBhnBssGgCNGY24dmvbXO1IZA9iJn +YSIRTvMzx1t5ThV9T0uxp097rBO0mIka2Eeo4gc/c2Ml9mWF1PZdC4CBUW5miKI1ip7 QPsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=F1uYIMvU; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xc2-20020a170907074200b007aeec2bf18fsi7010367ejb.543.2023.01.08.14.02.32; Sun, 08 Jan 2023 14:02:57 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=F1uYIMvU; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236338AbjAHV52 (ORCPT + 99 others); Sun, 8 Jan 2023 16:57:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236042AbjAHV5M (ORCPT ); Sun, 8 Jan 2023 16:57:12 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF78AA1BC for ; Sun, 8 Jan 2023 13:57:10 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id m3so5014472wmq.0 for ; Sun, 08 Jan 2023 13:57:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kEK//qA/GZwTCDOY0eW42xYLYPIkWYZxLksmuivpZXk=; b=F1uYIMvUXqlXjYHYdlqjvSq2PKF3puT4Gs2mATnDRkGPAzqM8m0JMXxSTP00qsn6NL rokXciK+a+DVRmPrXcgRH4BWBQbejyowtonWDRIKVV+50t9cCmgrvaRheW9QQjRND7NZ IMmr3xDC3+5qR0/FPRuCUwjCF0VU12HDXlPAvyMNTiurz+p4MDisN3+xYN/laVB/TwbW QVsISgPw0EC70yaeA+N18hePfN6oL0cpB2pPC+taz/+hkyiNmAoEM8QnW+dm9qJAWAgR z38a82dzSpezFwUzebfEPd0pZKQXrxcEzGhOiU+twsEZ/zNjrNFCSJfh2E8R/swVTDjG nh7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kEK//qA/GZwTCDOY0eW42xYLYPIkWYZxLksmuivpZXk=; b=OVNFdNg771DsTZSvbMdzfa0smL9mdzAF94N1CxxN8j7KwuKKsU+zzM1B70IFEqfGU7 SZWa+ABD8SiguoYEEX5aNvNeYHFWvqrERTdlwRTxATov6t3Y4+VvPibZ26b3xyZeRtcf BbFuB9+Yb3p3peziJnhot1tf61GHo1NKOYaM4AGThm9UqOHzCDc82uis6xoLNZBCDKhd Amf2sQIswkwT5PBndFoYtAqJIUqF/8bOasi3hB4+nqkjWYlexqRgSIgvgG6ALkImYqWi ruIPLUWL5rkxqIN2DMkzbWZ8hhHceQFl6AFxK69xKM8CfnOWfxwhCL/0eTLpPhVEm7C6 tNEA== X-Gm-Message-State: AFqh2ko+L6fDUqIXoSgqNVq0+U/+swqAwgpwDWOAA3mTfaP2JgZ47u78 zjJROrZjEwUCLVEqzlS1Qg8= X-Received: by 2002:a05:600c:34d0:b0:3d6:b691:b80d with SMTP id d16-20020a05600c34d000b003d6b691b80dmr44121475wmq.21.1673215029241; Sun, 08 Jan 2023 13:57:09 -0800 (PST) Received: from localhost.localdomain ([2a10:d582:3bb:0:63f8:f640:f53e:dd47]) by smtp.gmail.com with ESMTPSA id h15-20020a05600c314f00b003d99469ece1sm14654071wmo.24.2023.01.08.13.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 13:57:08 -0800 (PST) From: Sudip Mukherjee To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, "Maciej W. Rozycki" , Sudip Mukherjee Subject: [PATCH 6/7] parport_pc: Set up mode and ECR masks for Oxford Semiconductor devices Date: Sun, 8 Jan 2023 21:56:55 +0000 Message-Id: <20230108215656.6433-6-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> References: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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?1754493487274920076?= X-GMAIL-MSGID: =?utf-8?q?1754493487274920076?= From: "Maciej W. Rozycki" No Oxford Semiconductor PCI or PCIe parallel port device supports the Parallel Port FIFO mode. All support the PS/2 Parallel Port mode and the Enhanced Parallel Port mode via the ECR register. The original 5V PCI OX16PCI954 device does not support the Extended Capabilities Port mode, the Test mode or the Configuration mode, but all the other OxSemi devices do, including in particular the 3.3V PCI OXmPCI954 device and the universal voltage PCI OXuPCI954 device. All the unsupported modes are marked reserved in the relevant datasheets. Accordingly enable the `base_hi' BAR for the 954 devices to enable PS2 and EPP mode support via the ECR register, however mask the COMPAT mode and, until we have a way to determine what chip variant it is that we poke at, also the ECP mode, and mask the COMPAT mode only for all the remaining OxSemi devices, fixing errors like: parport0: FIFO is stuck FIFO write timed out and a non-functional port when the Parallel Port FIFO mode is selected. Complementing the fix apply an ECR mask for all these devices, which are documented to only permit writing to the mode field of the ECR register with a bit pattern of 00001 required to be written to bits 4:0 on mode field writes. No nFault or service interrupts are implemented, which will therefore never have to be enabled, though bit 2 does report the FIFO threshold status to be polled for in the ECP mode where supported. We have a documented case of writing 1 to bit 2 causing a lock-up with at least one OX12PCI840 device (from old drivers/parport/ChangeLog): 2001-10-10 Tim Waugh * parport_pc.c: Support for OX12PCI840 PCI card (reported by mk@daveg.com). Lock-ups diagnosed by Ronnie Arosa (and now we just don't trust its ECR). which commit adbd321a17cc ("parport_pc: add base_hi BAR for oxsemi_840") must have broken and by applying an ECR mask here we prevent the lock-up from triggering. This could have been the reason for requiring 00001 to be written to bits 4:0 of ECR. Update the inline comment accordingly; it has come from Linux 2.4.12 back in 2001 and predates the introduction of OXmPCI954 and OXuPCI954 devices that do support ECP. References: [1] "OX16PCI954 Integrated Quad UART and PCI interface", Oxford Semiconductor Ltd., Data Sheet Revision 1.3, Feb. 1999, Chapter 9 "Bidirectional Parallel Port", pp. 53-55 [2] "OX16PCI952 Data Sheet, Integrated High Performance Dual UARTs, Parallel Port and 5.0v PCI interface", Oxford Semiconductor Ltd., DS_B008A_00, Datasheet rev 1.1, June 2001, Chapter 8 "Bi-directional Parallel Port", pp. 52-56 [3] "OXmPCI954 DATA SHEET Integrated High Performance Quad UARTs, 8-bit Local Bus/Parallel Port. 3.3v PCI/miniPCI interface.", Oxford Semiconductor Ltd., DS-0019, June 2005, Chapter 10 "Bidirectional Parallel Port", pp. 86-90 [4] "OXmPCI952 Data Sheet, Integrated High Performance Dual UARTs, 8-bit Local Bus/Parallel Port. 3.3v PCI/miniPCI interface.", Oxford Semiconductor Ltd., DS-0020, June 2005, Chapter 8 "Bidirectional Parallel Port", pp. 73-77 [5] "OX12PCI840 Integrated Parallel Port and PCI interface", Oxford Semiconductor Ltd., DS-0021, Jun 2005, Chapter 5 "Bi-directional Parallel Port", pp. 18-21 [6] "OXPCIe952 PCI Express Bridge to Dual Serial & Parallel Port", Oxford Semiconductor, Inc., DS-0046, Mar 06 08, Chapter "Parallel Port Function", pp. 59-62 [7] "OXPCIe840 PCI Express Bridge to Parallel Port", Oxford Semiconductor, Inc., DS-0049, Mar 06 08, Chapter "Parallel Port Function", pp. 15-18 [8] "OXuPCI954 Data Sheet, Integrated High Performance Quad UARTs, 8-bit Local Bus/Parallel Port, 3.3 V and 5 V (Universal Voltage) PCI Interface.", Oxford Semiconductor, Inc., DS-0058, 26 Jan 2009, Chapter 8 "Bidirectional Parallel Port", pp. 62-65 [9] "OXuPCI952 Data Sheet, Integrated High Performance Dual UARTs, 8-bit Local Bus/Parallel Port, 3.3 V and 5.0 V Universal Voltage PCI Interface.", Oxford Semiconductor, Inc., DS-0059, Sep 2007, Chapter 8 "Bidirectional Parallel Port", pp. 61-64 Signed-off-by: Maciej W. Rozycki Signed-off-by: Sudip Mukherjee --- drivers/parport/parport_pc.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index d7e64f6dfe90..9b4fe9a2b549 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -2696,12 +2696,19 @@ static struct parport_pc_pci { /* titan_010l */ { 1, { { 3, -1 }, } }, /* avlab_1p */ { 1, { { 0, 1}, } }, /* avlab_2p */ { 2, { { 0, 1}, { 2, 3 },} }, - /* The Oxford Semi cards are unusual: 954 doesn't support ECP, - * and 840 locks up if you write 1 to bit 2! */ - /* oxsemi_952 */ { 1, { { 0, 1 }, } }, - /* oxsemi_954 */ { 1, { { 0, -1 }, } }, - /* oxsemi_840 */ { 1, { { 0, 1 }, } }, - /* oxsemi_pcie_pport */ { 1, { { 0, 1 }, } }, + /* The Oxford Semi cards are unusual: older variants of 954 don't + * support ECP, and 840 locks up if you write 1 to bit 2! None + * implement nFault or service interrupts and all require 00001 + * bit pattern to be used for bits 4:0 with ECR writes. */ + /* oxsemi_952 */ { 1, { { 0, 1 }, }, + PARPORT_MODE_COMPAT, ECR_MODE_MASK }, + /* oxsemi_954 */ { 1, { { 0, 1 }, }, + PARPORT_MODE_ECP | + PARPORT_MODE_COMPAT, ECR_MODE_MASK }, + /* oxsemi_840 */ { 1, { { 0, 1 }, }, + PARPORT_MODE_COMPAT, ECR_MODE_MASK }, + /* oxsemi_pcie_pport */ { 1, { { 0, 1 }, }, + PARPORT_MODE_COMPAT, ECR_MODE_MASK }, /* aks_0100 */ { 1, { { 0, -1 }, } }, /* mobility_pp */ { 1, { { 0, 1 }, } }, /* netmos_9900 */ { 1, { { 0, -1 }, } }, From patchwork Sun Jan 8 21:56:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 40592 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1867226wrt; Sun, 8 Jan 2023 14:03:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXu/IdRNcG1rUAJio9l/4sZFJeNXGxb/LLl964378f1rbKwXysVJlyL5Hw9w6nfVWfL07kp2 X-Received: by 2002:a17:906:cec4:b0:84d:269c:760a with SMTP id si4-20020a170906cec400b0084d269c760amr7001742ejb.51.1673215396400; Sun, 08 Jan 2023 14:03:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673215396; cv=none; d=google.com; s=arc-20160816; b=kWGBIeIAtXQGZZglPiXn4H/2VjuG8YPTmIVH+JxeumLQnt/wyj24SOr2TBB9Q7WZNt JxQkU1BYlvf4EvDQlXdsMFuMGEDdrNMxUz3OTQ7Gs8aT6BpNx/giAo5JIFgkktM26aH8 pIcEVeevq6Z5tT2mVb2NaKDuXM/tAHb8lxT+Ch2rdy+aCFNtztEs5FnvPynJ8XM0dP45 3FvnNZ2VAu9NO0i0NPfwbTtFAR+lhazCrEY93pX4lnL6Af9r+3/+SwjDudruKTyo+011 h6WdXhE1V5T0Ry5+N6sSsKEJwls1CfXfT3OkDHk6vZV/5gI71xaQJTVBcnQmryMNrdyt J1Hg== 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 :dkim-signature; bh=eOkszWL1f9GVml0746jDT8yMPEtjrokgHcFXyXEm/8s=; b=oYo/+/yD8zhW1h2E3LtlgLzdQRxfxVS+haim7+X9SbVoS2+RU/xAjSIpMNYfQ+5esx Zp19xF3jxegAa3RM5Gt0KzfwIpiEsuLWglYSNaW7+FfD/zyB6HH8p02ef5QJKT2g/ivM JgQyh9rzwz2TAWn38Iexj2QfeAczWNxkTh14lyuj1KkldOWXchpl5AZlBmh26OKmWHvy 93rrHS+jEmpH0kFkk6Yps49Eb0kqUYM8ltudmiPxmamsNMKwPUhI63s7p0S9NzZcWdfq iOqBE0reAO/8sWwyujcPc/BmmxQOnkpPtmku8aZDpLXHTznPYTyw7N7r80W+1TQ075Sl spMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gHvlwGyy; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn14-20020a17090794ce00b007c11b897491si8620694ejc.833.2023.01.08.14.02.53; Sun, 08 Jan 2023 14:03:16 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gHvlwGyy; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236306AbjAHV5c (ORCPT + 99 others); Sun, 8 Jan 2023 16:57:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236244AbjAHV5M (ORCPT ); Sun, 8 Jan 2023 16:57:12 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 530C9A1BF for ; Sun, 8 Jan 2023 13:57:11 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id ja17so4992541wmb.3 for ; Sun, 08 Jan 2023 13:57:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eOkszWL1f9GVml0746jDT8yMPEtjrokgHcFXyXEm/8s=; b=gHvlwGyyqfbIoMsGj5XtztPSaWHbWKuWNYBVEPCt6YD/lvMyYgWpMagqH0fvxj4b8f DRhYN2LHpPxKxBNvTs5KFhe/pPNinrNMkwsGgM/AGr4Rb4dazkLfv9kplmGO4SSUkNwC wqKbkCwPrU0yJtEI5adnM3b9NQD45fOSqUqnXHz8OW+CAuafP2Kb/I/XLoe9Twi3RbBH 8oA8DkjMjMNGDsMfp8DwkH3NGspLV7MC2pe/dh0vDEpYFoWeJLEsf+y/8iDhu9iAl5cf n6K5ohp/2WKkUHhbWuHTjWeANMpWfHq0rYv827OMzlOT7J636eAgcPjCMUusVnn+6t29 153g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eOkszWL1f9GVml0746jDT8yMPEtjrokgHcFXyXEm/8s=; b=14F2XeViVBplE6YHdvrMGdz1CaDyXRH8ktqDexh+MWQxtHoSzSYUqg9+THZCdyO7By Np7OVG+0uhUZWk0RH+yuZzhV0l27mBLjZRcus0NdeC8QSlYIyVo1Ce/HI1cnyoOSQs0J PBvn6c7512FstbLpSXw71cfJ3lws6y8IibUjiwXrwksB66pbXsOxKgQ2AKnUZBe96Uy3 wHV871itpsAx+cd0jTqb5SFp7bJuVU3nIsrLtb3/sTFBeXmWi7AQasAhPW1D0/L6v+VI 2Thf7nDGJOckjVgvWK0zbBU5UFxJ7Uc02KtUTNdPZVNBqKuwNtyxXxv31w8Ngw96RTim 7kNg== X-Gm-Message-State: AFqh2kqI/8hSxmMmO2tvhsITtd45IFeD8mhPP4rZ8M6HVKELdN4FV8VA EkUgmb6LYvLG7oHlAwvA4NA= X-Received: by 2002:a05:600c:3ba7:b0:3d3:4dac:aa69 with SMTP id n39-20020a05600c3ba700b003d34dacaa69mr44428516wms.36.1673215029870; Sun, 08 Jan 2023 13:57:09 -0800 (PST) Received: from localhost.localdomain ([2a10:d582:3bb:0:63f8:f640:f53e:dd47]) by smtp.gmail.com with ESMTPSA id h15-20020a05600c314f00b003d99469ece1sm14654071wmo.24.2023.01.08.13.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 13:57:09 -0800 (PST) From: Sudip Mukherjee To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, "Maciej W. Rozycki" , Sudip Mukherjee Subject: [PATCH 7/7] parport_pc: Limit the number of PCI BAR pairs to 2 Date: Sun, 8 Jan 2023 21:56:56 +0000 Message-Id: <20230108215656.6433-7-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> References: <20230108215656.6433-1-sudipm.mukherjee@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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?1754493507716589652?= X-GMAIL-MSGID: =?utf-8?q?1754493507716589652?= From: "Maciej W. Rozycki" Decrease the number of PCI BAR pair slots allocated for port subdrivers from 4 to 2 as none wants more than 2 at this time, reducing the memory footprint a little. No functional change. Signed-off-by: Maciej W. Rozycki Signed-off-by: Sudip Mukherjee --- drivers/parport/parport_pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 9b4fe9a2b549..88e125e36230 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -2657,7 +2657,7 @@ static struct parport_pc_pci { int lo; int hi; /* -1 if not there, >6 for offset-method (max BAR is 6) */ - } addr[4]; + } addr[2]; /* Bit field of parport modes to exclude. */ unsigned int mode_mask;