From patchwork Tue Jul 12 07:58:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Schmitz X-Patchwork-Id: 590759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCB87C433EF for ; Tue, 12 Jul 2022 07:58:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232373AbiGLH6o (ORCPT ); Tue, 12 Jul 2022 03:58:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232036AbiGLH6l (ORCPT ); Tue, 12 Jul 2022 03:58:41 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9B16EB9; Tue, 12 Jul 2022 00:58:38 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id q5so6579207plr.11; Tue, 12 Jul 2022 00:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QSLBth1UAZoBdoCqm60VueY2vh2tMmMd00GyQMuP4pM=; b=Yznmx/2cyIJ/Dfw0nJxPxpwzvjm2dFOpdWuosIre5BJq7zyV18WJ7eTiAoXPpfh+ja TM8FKijtqVvM8P2uvJoD6pk4qM4/dbuoP/VFsyu7b5Deq27O5+UoLGajCVfQ/nTXiuw+ 5UTX5hcpLxIsgDAuTsWsY78tqqOzAmXitTxaS1nOiU/CldhvWzxQIV+Pj9uv5ZQ7G2Un /+WuCHPyqog1+fPPfOSE4HmdhHvE83+LfY5E6hXm4yZtEtBEeI5J5x5UQS6g0zzysXAB 1VWTYT6HKCeAVs00Bkyk35MXpBUktP4GkhfNNy8qCnCA1eCuFjzZiMlor8DBkBsc1XX7 ck0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QSLBth1UAZoBdoCqm60VueY2vh2tMmMd00GyQMuP4pM=; b=2+sqGhwFNVOReCOACy826ySi3KtoiTFRx4Tj2NecV3qjYFqWVRfklPD4LQbjbyZra9 o1/pFe5BChtwf9HqRAMV7TTz5uofLvQsvDqspnnhnSH0KUUEK3jvzGQRUFCNlK88QCoh On9zo0WHVQnR7B8YtKhDtLjG5n7s8iH9CbgeQY/kZwZvapcMs/M6Lvy4vIKnyg1PqN+X NKyDaQd2dgCkYPmtWPaVbc88LE+g3d/wlTesghXbXNqSiLTu6IMAcPlqsnEYi7BR9CW2 Qy9aXiigVfIZFYKMspQMk+iv2CfbPDTx18E24UQB8PQ9BGtLHe02lgQOYRHQjCpuutkh 4d6Q== X-Gm-Message-State: AJIora9RWdj2uZG+Tv08+ou/jbwkXPbmVB3NKDVVvq5Sq+UeJLycBo8m QaT//Ch2OBTKHhyNudHpzVc= X-Google-Smtp-Source: AGRyM1uDLquXzZxi7+k2QUZW+uwAslmddxmq4Xnuo07sGlLb12xPdp8PlRAGKBENSwkRdDpNTZHF8g== X-Received: by 2002:a17:902:c947:b0:16c:1c97:16ec with SMTP id i7-20020a170902c94700b0016c1c9716ecmr22049349pla.7.1657612718266; Tue, 12 Jul 2022 00:58:38 -0700 (PDT) Received: from xplor.waratah.dyndns.org (222-155-0-244-adsl.sparkbb.co.nz. [222.155.0.244]) by smtp.gmail.com with ESMTPSA id g6-20020a655806000000b0040c74f0cdb5sm5451995pgr.6.2022.07.12.00.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 00:58:37 -0700 (PDT) Received: by xplor.waratah.dyndns.org (Postfix, from userid 1000) id 198C7360331; Tue, 12 Jul 2022 19:58:35 +1200 (NZST) From: Michael Schmitz To: linux-m68k@vger.kernel.org, arnd@kernel.org Cc: linux-scsi@vger.kernel.org, geert@linux-m68k.org, Michael Schmitz Subject: [PATCH v2 1/5] m68k - add MVME147 SCSI base address to mvme147hw.h Date: Tue, 12 Jul 2022 19:58:28 +1200 Message-Id: <20220712075832.23793-2-schmitzmic@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220712075832.23793-1-schmitzmic@gmail.com> References: <20220712075832.23793-1-schmitzmic@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The base address for the WD33C93 SCSI host adapter on mvme147 boards is missing from mvme147hw.h. This information will be needed for platform device conversion of the mvme147_scsi driver, so add it here. CC: linux-scsi@vger.kernel.org Link: https://lore.kernel.org/r/6d1d88ee-1cf6-c735-1e6d-bafd2096e322@gmail.com Signed-off-by: Michael Schmitz --- arch/m68k/include/asm/mvme147hw.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/m68k/include/asm/mvme147hw.h b/arch/m68k/include/asm/mvme147hw.h index e28eb1c0e0bf..fd8c1e4fc7be 100644 --- a/arch/m68k/include/asm/mvme147hw.h +++ b/arch/m68k/include/asm/mvme147hw.h @@ -93,6 +93,7 @@ struct pcc_regs { #define M147_SCC_B_ADDR 0xfffe3000 #define M147_SCC_PCLK 5000000 +#define MVME147_SCSI_BASE 0xfffe4000 #define MVME147_IRQ_SCSI_PORT (IRQ_USER+0x45) #define MVME147_IRQ_SCSI_DMA (IRQ_USER+0x46) From patchwork Tue Jul 12 07:58:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Schmitz X-Patchwork-Id: 590758 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC76CCCA485 for ; Tue, 12 Jul 2022 07:58:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232323AbiGLH6u (ORCPT ); Tue, 12 Jul 2022 03:58:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231896AbiGLH6n (ORCPT ); Tue, 12 Jul 2022 03:58:43 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4E1BF08; Tue, 12 Jul 2022 00:58:39 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id 23so6876409pgc.8; Tue, 12 Jul 2022 00:58:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=llxMpF9nJlCaL45HHzQOxFiHqiNr+0CVyGM12/RbJls=; b=AN/H6CFNSjoacRTIRRQQM+uydc/ayghIqGV8Ud+eMpbzEVavCk7xKrvKv+ofUocuNS FjLkrP8NCeH9diD46prKSnBnwHH7uOTxW+lV/kgIbEl0H6V8glN4KuMWJ+iA0P8JQ/vw Eo+zm12zj6+Fb3rF9UquVmAFOAl6P21jcEf5ful5QcMrSb3Kixp6WKwy+xO6T0rmfMMR CHZZBSBOK1VWdy8PHWrI+Hf5YF/jp5PQjoShU/SNazaxCCrbdJAIpmlN+LxZyUpiHeMd 5P0dlXaPrAR9QV99feJFxFOi2LU76zeo0HdaMhjACN4bcxrTsQWr4ezKvM0ZPgRF+ZPq w/5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=llxMpF9nJlCaL45HHzQOxFiHqiNr+0CVyGM12/RbJls=; b=2+49VHHduwCd6sMgCsnyMh2+1Mc+hMzWbRhKpIwsicw47u6Gj4gDPryYA6qlxRedNK +swD+XAIb+NbyV7dbUbBbjfmfYEW1zoor5M50XTKANnka2PTT8lrwMmKDfFqKWk8oRBO iLilGKrvFkV5nPdLLVXArOZ7o6zHM/qmjZnsbufpNfm9ek5O71KD95ETUzpkc6xJraDL Y/sk87bzyOUGgH9rleOO5lNucdU0toee3FiR1k6keWx5B1h+Qce8CKA9M6H755/YsoOx Wmyyj6ol+7Lx7V4KLJFudM/k3ERFJ0LYYbRN+jpC4VgY1acjq4l9RSbdXEqSNr2vFFn8 +UoA== X-Gm-Message-State: AJIora/Oy171OUujeDpI1GXA3Bf12PsIqS9G/gQXGANYf7CcEPWXXsE6 fRRTzDU8er2IUN8bHJxarAN+/Asw4Mg= X-Google-Smtp-Source: AGRyM1vgHY4Wc1JH22i97c3EV21O/3M2QUZu+htOIwtkKMqIQPkK9rjX5x1DUH+HhZ1jw0Ht0nXJRQ== X-Received: by 2002:a05:6a00:1da9:b0:52a:c339:c520 with SMTP id z41-20020a056a001da900b0052ac339c520mr13318010pfw.70.1657612719146; Tue, 12 Jul 2022 00:58:39 -0700 (PDT) Received: from xplor.waratah.dyndns.org (222-155-0-244-adsl.sparkbb.co.nz. [222.155.0.244]) by smtp.gmail.com with ESMTPSA id z6-20020a170903018600b0016be5f24aaesm6189097plg.163.2022.07.12.00.58.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 00:58:38 -0700 (PDT) Received: by xplor.waratah.dyndns.org (Postfix, from userid 1000) id B6348360333; Tue, 12 Jul 2022 19:58:35 +1200 (NZST) From: Michael Schmitz To: linux-m68k@vger.kernel.org, arnd@kernel.org Cc: linux-scsi@vger.kernel.org, geert@linux-m68k.org, Michael Schmitz Subject: [PATCH v2 2/5] m68k - set up platform device for mvme147_scsi Date: Tue, 12 Jul 2022 19:58:29 +1200 Message-Id: <20220712075832.23793-3-schmitzmic@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220712075832.23793-1-schmitzmic@gmail.com> References: <20220712075832.23793-1-schmitzmic@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Set up a platform device for the mvme147_scsi driver. The platform device is required for conversion of the driver to the DMA API. CC: linux-scsi@vger.kernel.org Link: https://lore.kernel.org/r/6d1d88ee-1cf6-c735-1e6d-bafd2096e322@gmail.com Signed-off-by: Michael Schmitz --- arch/m68k/mvme147/config.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c index 4e6218115f43..c6e7dfe3eb54 100644 --- a/arch/m68k/mvme147/config.c +++ b/arch/m68k/mvme147/config.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -188,3 +189,23 @@ int mvme147_hwclk(int op, struct rtc_time *t) } return 0; } + +static const struct resource mvme147_scsi_rsrc[] __initconst = { + DEFINE_RES_MEM(MVME147_SCSI_BASE, 0xff), + DEFINE_RES_IRQ(MVME147_IRQ_SCSI_PORT), +}; + +int __init mvme147_platform_init(void) +{ + struct platform_device *pdev; + int rv = 0; + + pdev = platform_device_register_simple("mvme147-scsi", -1, + mvme147_scsi_rsrc, ARRAY_SIZE(mvme147_scsi_rsrc)); + if (IS_ERR(pdev)) + rv = PTR_ERR(pdev); + + return rv; +} + +arch_initcall(mvme147_platform_init); From patchwork Tue Jul 12 07:58:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Schmitz X-Patchwork-Id: 589997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F449CCA47C for ; Tue, 12 Jul 2022 07:58:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230352AbiGLH6u (ORCPT ); Tue, 12 Jul 2022 03:58:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231911AbiGLH6n (ORCPT ); Tue, 12 Jul 2022 03:58:43 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4EBCF0C; Tue, 12 Jul 2022 00:58:40 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id 70so6849897pfx.1; Tue, 12 Jul 2022 00:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nUNEBFmN+RgdAIiWgIKnwVs66l6z7a1wHw6JjJ0sTrw=; b=NdAnuBKMcCP/6Qj0SW3VSIKLhmcqyk1xk0J/2KqY0wXWyn3RxvQWuIIRB+Cf/el2BS HAoLCr1Z8UMSXopIx7pb9M4yXMyHCc5KkPxFv27gspEXIRp/3d44+YzUZAQOz4OQWHuZ 1Qu1BX1Cda5hdeeNTG91kjGppGytT7leXD2izUi4+lItMWJhir6bLEkmtI+UE8qScQlu wbVVpFRW5XGSscDBFPm/RmH/iy1SNnuET5kTZZWhNdpPtogrT25hnTrHlJcQ29AiiMXZ Mj8zy2vMWc73lfEoEfXPiMz1A8iI0VB9OwFyUT8cvGqcCD4o16gmf5iYSUNS7LYYmiDm 1zxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nUNEBFmN+RgdAIiWgIKnwVs66l6z7a1wHw6JjJ0sTrw=; b=Qla94Ud3aVY0ruU6Anm5SKUjK2td6dI3w1rNejG8qxq0RQ8MU99Y7rK56b6BUMc903 7/Il8JLHaihrmopnQWKxKj5Cufgkk12eXTk7rJ/5gNeVHcwsseJMHGuLnhKB6NR5CQ3Z fyZh2aCDILwgVXiUi1AETIvIweNewsIOvXe+ofCOzk5JPF1D2V5oGLXWcfC7TF52RFw0 WLbR72PHZSRO1e/noqORvmCW9QR1/eAWF+6r7YL1vFgAB0/pBWX6T/2EHkaRXC0Z3rPX ADWxFR8/nunoSfIuh2VkEuGlHCAcUeZgyfXBSXb9H0xPPOx9usriKMuMupp6/ShKDb+J 2z9A== X-Gm-Message-State: AJIora/HctWa8K1hha/BNU9Nj7WxFwpPHXo9JVIGyTaneRG6OYusY8Ec n9uMWwV2I/FuZr+A5Kd5Au2XvYUzm+M= X-Google-Smtp-Source: AGRyM1urbb6QGwKxZg+ehk1jUBx2U6Lpw1ioZt575GZvIp+Txac0Q9pJcnZ20fj08YeYaBJ/BEoWSg== X-Received: by 2002:a63:6703:0:b0:413:1f40:6cb5 with SMTP id b3-20020a636703000000b004131f406cb5mr19709822pgc.614.1657612719700; Tue, 12 Jul 2022 00:58:39 -0700 (PDT) Received: from xplor.waratah.dyndns.org (222-155-0-244-adsl.sparkbb.co.nz. [222.155.0.244]) by smtp.gmail.com with ESMTPSA id mv16-20020a17090b199000b001f021cdd73dsm5055429pjb.10.2022.07.12.00.58.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 00:58:39 -0700 (PDT) Received: by xplor.waratah.dyndns.org (Postfix, from userid 1000) id 5ECF23603F6; Tue, 12 Jul 2022 19:58:36 +1200 (NZST) From: Michael Schmitz To: linux-m68k@vger.kernel.org, arnd@kernel.org Cc: linux-scsi@vger.kernel.org, geert@linux-m68k.org, Michael Schmitz Subject: [PATCH v2 3/5] m68k - add MMIO ioremap support for mvme147 Date: Tue, 12 Jul 2022 19:58:30 +1200 Message-Id: <20220712075832.23793-4-schmitzmic@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220712075832.23793-1-schmitzmic@gmail.com> References: <20220712075832.23793-1-schmitzmic@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Converting the mvme147 SCSI driver to the DMA API requires use of ioremap() in order to get the kernel virtual address of the WD chip registers. Add support for transparent mapping of the mvme147 MMIO region to arch/m68k/mm/kmap.c to enable use of ioremap() in that driver. Link: https://lore.kernel.org/r/6d1d88ee-1cf6-c735-1e6d-bafd2096e322@gmail.com Signed-off-by: Michael Schmitz --- arch/m68k/mm/kmap.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c index 7594a945732b..2bcede2af902 100644 --- a/arch/m68k/mm/kmap.c +++ b/arch/m68k/mm/kmap.c @@ -185,6 +185,13 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cachefla return (void __iomem *)physaddr; } #endif +#ifdef CONFIG_MVME147 + if (MACH_IS_MVME147) { + if (physaddr >= 0xe0000000 && cacheflag == IOMAP_NOCACHE_SER) + return (void __iomem *)physaddr; + } +#endif + #ifdef CONFIG_COLDFIRE if (__cf_internalio(physaddr)) return (void __iomem *) physaddr; @@ -308,6 +315,10 @@ void iounmap(void __iomem *addr) if (MACH_IS_VIRT && (unsigned long)addr >= 0xff000000) return; #endif +#ifdef CONFIG_MVME147 + if (MACH_IS_MVME147 && (unsigned long)addr >= 0xe000000) + return; +#endif #ifdef CONFIG_COLDFIRE if (cf_internalio(addr)) return; From patchwork Tue Jul 12 07:58:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Schmitz X-Patchwork-Id: 589998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 430CACCA483 for ; Tue, 12 Jul 2022 07:58:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232308AbiGLH6s (ORCPT ); Tue, 12 Jul 2022 03:58:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232299AbiGLH6n (ORCPT ); Tue, 12 Jul 2022 03:58:43 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45624391; Tue, 12 Jul 2022 00:58:40 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id x18-20020a17090a8a9200b001ef83b332f5so10641494pjn.0; Tue, 12 Jul 2022 00:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QcZZ4ub4WwN95qjSoiSBbijtRxPDIIjCgWyTOxMJML4=; b=I97z6+j9/lUoZj5t0yWMuu9L5dGZG5KKpXOUfRndDCKSTSHaapwNcJkldvJXe+x9LB buOCRJgQI/Zugkaz44TMZ2/iYrnurG+BP9S8S1f4fHIpe4/rCk7B8YGsiE6EvlJ1fOka 5BJAKyPLXfpjGI0xSnYmh0rVBdr1m3cmSl9w37OkY5pzwpKUPp8RlOtk+lxAPSsZqnA6 1JzfXkqFg0MUaPN6HM833p3F2pFXVaTQR7NCLrTuGW5yFOjfZ7nRnauLYGdVN2oF9mvo bkWR4GXNU+TNjy/UV5tCuxul/xycvaBZQPCEx+WFn/Onc5zgfNeVVxElnvjKIfENYqbJ DBMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QcZZ4ub4WwN95qjSoiSBbijtRxPDIIjCgWyTOxMJML4=; b=ElUaTm38WhAwWhbXeUBQjLN5Et76QCHqUqIDLaGXvz5TjPEozHqlBfnSGaodDnDCKi s+K1nbbo7gClLSE9hjfryy+qMT0NBHUjFjXZc169gnGRWWLDXb+vhvCZ5pHfHpHAmQnV oWA64lOsk1bMRuTWjxC1RBu1nZuRWtc3GX4xh3ipWQQQMsYoIAFFqbAHvhgcidky9Ilz oYgQz1W7Rdnvn9fDcNKFbvOLOPw/SVokf0V0cAZrBu7atGevcaButZIVG+iJBHa/YHug 9IaQyXwOFReXEemCeHBC4aQKsqwq2UJ5eQGT6jttpoSp31KQspq2pGyWXPKK1vnQ4way 1f7Q== X-Gm-Message-State: AJIora92GTfvzFu1zeEFfKRMZzUzTGotTo8DW5rjgJa5KH1LJxcABHfS vlPg0AiWsuSCp4//Hs6Ycy4= X-Google-Smtp-Source: AGRyM1ukLMtz9Ne++6ILvS2RzmFS6FcCOxWAIFQ/RR0OfmbJZvsfoLQNDcynP1mevFcf3jBLTnZJ5A== X-Received: by 2002:a17:90a:f3c8:b0:1ef:7976:a6d8 with SMTP id ha8-20020a17090af3c800b001ef7976a6d8mr2857087pjb.198.1657612720326; Tue, 12 Jul 2022 00:58:40 -0700 (PDT) Received: from xplor.waratah.dyndns.org (222-155-0-244-adsl.sparkbb.co.nz. [222.155.0.244]) by smtp.gmail.com with ESMTPSA id jj9-20020a170903048900b0016be4d78792sm6076738plb.257.2022.07.12.00.58.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 00:58:40 -0700 (PDT) Received: by xplor.waratah.dyndns.org (Postfix, from userid 1000) id E73243603FB; Tue, 12 Jul 2022 19:58:36 +1200 (NZST) From: Michael Schmitz To: linux-m68k@vger.kernel.org, arnd@kernel.org Cc: linux-scsi@vger.kernel.org, geert@linux-m68k.org, Michael Schmitz Subject: [PATCH v2 4/5] scsi - convert mvme147.c driver to platform device Date: Tue, 12 Jul 2022 19:58:31 +1200 Message-Id: <20220712075832.23793-5-schmitzmic@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220712075832.23793-1-schmitzmic@gmail.com> References: <20220712075832.23793-1-schmitzmic@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Convert the mvme147.c driver to a platform device driver. This is required for conversion of the driver to the DMA API. CC: linux-scsi@vger.kernel.org Link: https://lore.kernel.org/r/6d1d88ee-1cf6-c735-1e6d-bafd2096e322@gmail.com Signed-off-by: Michael Schmitz --- Changes from v1: - change patch index from 3 to 3 (due to insertion of m68k kmap patch) Arnd Bergmann: - use devm_platform_ioremap_resource() for wd33c93 base address --- drivers/scsi/mvme147.c | 89 +++++++++++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c index 472fa043094f..ea8afeec8e56 100644 --- a/drivers/scsi/mvme147.c +++ b/drivers/scsi/mvme147.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -85,40 +86,52 @@ static struct scsi_host_template mvme147_host_template = { .cmd_size = sizeof(struct scsi_pointer), }; -static struct Scsi_Host *mvme147_shost; - -static int __init mvme147_init(void) +static int __init mvme147_scsi_probe(struct platform_device *pdev) { + struct resource *mres, *ires; + struct Scsi_Host *mvme147_inst; wd33c93_regs regs; struct WD33C93_hostdata *hdata; + void __iomem *base; int error = -ENOMEM; - if (!MACH_IS_MVME147) - return 0; + mres = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!mres) + return -ENODEV; + + ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!ires) + return -ENODEV; + + if (!request_mem_region(mres->start, resource_size(mres), "wd33c93")) + return -EBUSY; - mvme147_shost = scsi_host_alloc(&mvme147_host_template, + mvme147_inst = scsi_host_alloc(&mvme147_host_template, sizeof(struct WD33C93_hostdata)); - if (!mvme147_shost) + if (!mvme147_inst) goto err_out; - mvme147_shost->base = 0xfffe4000; - mvme147_shost->irq = MVME147_IRQ_SCSI_PORT; - regs.SASR = (volatile unsigned char *)0xfffe4000; - regs.SCMD = (volatile unsigned char *)0xfffe4001; + base = devm_platform_ioremap_resource(pdev, 0); - hdata = shost_priv(mvme147_shost); + mvme147_inst->base = (unsigned int) base; + mvme147_inst->irq = ires->start; + + regs.SASR = (volatile unsigned char *)base; + regs.SCMD = (volatile unsigned char *)(base+1); + + hdata = shost_priv(mvme147_inst); hdata->no_sync = 0xff; hdata->fast = 0; hdata->dma_mode = CTRL_DMA; - wd33c93_init(mvme147_shost, regs, dma_setup, dma_stop, WD33C93_FS_8_10); + wd33c93_init(mvme147_inst, regs, dma_setup, dma_stop, WD33C93_FS_8_10); - error = request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0, - "MVME147 SCSI PORT", mvme147_shost); + error = request_irq(ires->start, mvme147_intr, 0, + "MVME147 SCSI PORT", mvme147_inst); if (error) goto err_unregister; - error = request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0, - "MVME147 SCSI DMA", mvme147_shost); + error = request_irq(ires->start+1, mvme147_intr, 0, + "MVME147 SCSI DMA", mvme147_inst); if (error) goto err_free_irq; #if 0 /* Disabled; causes problems booting */ @@ -133,30 +146,50 @@ static int __init mvme147_init(void) m147_pcc->dma_cntrl = 0x00; /* ensure DMA is stopped */ m147_pcc->dma_intr = 0x89; /* Ack and enable ints */ - error = scsi_add_host(mvme147_shost, NULL); + error = scsi_add_host(mvme147_inst, &pdev->dev); if (error) goto err_free_irq; - scsi_scan_host(mvme147_shost); + + platform_set_drvdata(pdev, mvme147_inst); + + scsi_scan_host(mvme147_inst); return 0; err_free_irq: - free_irq(MVME147_IRQ_SCSI_PORT, mvme147_shost); + free_irq(ires->start, mvme147_inst); err_unregister: - scsi_host_put(mvme147_shost); + scsi_host_put(mvme147_inst); err_out: return error; } -static void __exit mvme147_exit(void) +static int __exit mvme147_scsi_remove(struct platform_device *pdev) { - scsi_remove_host(mvme147_shost); + struct Scsi_Host *mvme147_inst = platform_get_drvdata(pdev); + struct resource *mres = platform_get_resource(pdev, IORESOURCE_MEM, 0); + struct resource *ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + + scsi_remove_host(mvme147_inst); /* XXX Make sure DMA is stopped! */ - free_irq(MVME147_IRQ_SCSI_PORT, mvme147_shost); - free_irq(MVME147_IRQ_SCSI_DMA, mvme147_shost); + free_irq(ires->start, mvme147_inst); + free_irq(ires->start+1, mvme147_inst); - scsi_host_put(mvme147_shost); + iounmap((void __iomem *)mvme147_inst->base); + scsi_host_put(mvme147_inst); + release_mem_region(mres->start, resource_size(mres)); + return 0; } -module_init(mvme147_init); -module_exit(mvme147_exit); +static struct platform_driver mvme147_scsi_driver = { + .remove = __exit_p(mvme147_scsi_remove), + .driver = { + .name = "mvme147-scsi", + }, +}; + +module_platform_driver_probe(mvme147_scsi_driver, mvme147_scsi_probe); + +MODULE_DESCRIPTION("MVME147 built-in SCSI"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:mvme147-scsi"); From patchwork Tue Jul 12 07:58:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Schmitz X-Patchwork-Id: 590757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35D27C433EF for ; Tue, 12 Jul 2022 07:58:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232507AbiGLH6x (ORCPT ); Tue, 12 Jul 2022 03:58:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232428AbiGLH6r (ORCPT ); Tue, 12 Jul 2022 03:58:47 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D204A3B3; Tue, 12 Jul 2022 00:58:41 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id 73so6860828pgb.10; Tue, 12 Jul 2022 00:58:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KsiErWWdRW3Hk14U/AhfcSq+a/LkvR4Yk5HQLw394/o=; b=REiuhOYm/SL8aaddOgNyKke7UBpYUUtnidsbOGMBPgt5XveGcY7yWkYSzsdRsoIB4y 2CPhpzt1B69iTcQVKvjO/U0jLDagvfpEd6VQu+peve0F1GzbrdJN7CnKqzWlfm9fTnIx MwXAnWDdwNmgaQ2hNwGZrJKKJLHvWwNyMp12FkvX6u3TWAvuaMBmqQhKqcAFB0REcUDD r8cN9eXCX07kSKKc/xpozgd7REFU2az3qPIxvJ6va5w0+Fuekc7XaNdQJl79DS3WgbII CiAo/kMyXjHxB/mB4lbBLBbbl90n27lGMP6EIFy4DHoWa4f3/bmuw84lkY90+p3FOi3U LF9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KsiErWWdRW3Hk14U/AhfcSq+a/LkvR4Yk5HQLw394/o=; b=SgA+E4ArBBuxP4I3TSlE+9H6RmQUlP+oKXdNCHERgOF7b/8fVg6TIt/i5XMLOSndWH sy8n6Epr1HaOnLUioTswn7j05w5GJ9ZhgL4W6F0+AkfE/6HQLN9JAJAEo7M44FrYrY5O lG8HtVJDwzarzqkuRYP8ogvcMXIQCbWc0Iqf92hQEhfWFcsAjmHISlOPWEfGPJ0jAsE5 /9+f703D842GPC2oeczF7sXZ0YPCsiWYDdky4Jr3Fc4um+22ssU31klYxJ91ITLLisLq rAoFtnSKTKUtYFZC7CRPszGti6fwHGrsU0eujUqF6JIjAYKiDwif/nkIhHyyy5jJz7TT 7QSg== X-Gm-Message-State: AJIora/rrqhx/Zqq9/DjljT5WRB29Du90Ix17cmCKzjH/gLxGYSdFl4U +nUjkbLSRNTKoXqb6ba7Yro= X-Google-Smtp-Source: AGRyM1u571TcaLXfgri+YldABCVGiVF3l6orO7eVRXRGPuiSjJpsKtFhdT+M7faB5YdgP7k53kQSVg== X-Received: by 2002:a05:6a00:b54:b0:52a:d3d1:f63f with SMTP id p20-20020a056a000b5400b0052ad3d1f63fmr8211527pfo.26.1657612721294; Tue, 12 Jul 2022 00:58:41 -0700 (PDT) Received: from xplor.waratah.dyndns.org (222-155-0-244-adsl.sparkbb.co.nz. [222.155.0.244]) by smtp.gmail.com with ESMTPSA id n6-20020a622706000000b00528c22fbb45sm6236203pfn.141.2022.07.12.00.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 00:58:41 -0700 (PDT) Received: by xplor.waratah.dyndns.org (Postfix, from userid 1000) id 859A8360403; Tue, 12 Jul 2022 19:58:37 +1200 (NZST) From: Michael Schmitz To: linux-m68k@vger.kernel.org, arnd@kernel.org Cc: linux-scsi@vger.kernel.org, geert@linux-m68k.org, Michael Schmitz Subject: [PATCH v2 5/5] scsi - convert mvme147.c driver to DMA API Date: Tue, 12 Jul 2022 19:58:32 +1200 Message-Id: <20220712075832.23793-6-schmitzmic@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220712075832.23793-1-schmitzmic@gmail.com> References: <20220712075832.23793-1-schmitzmic@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Convert mvme147.c to DMA API to eliminate one of the last usages of virt_to_bus(). CC: linux-scsi@vger.kernel.org Link: https://lore.kernel.org/r/6d1d88ee-1cf6-c735-1e6d-bafd2096e322@gmail.com Signed-off-by: Michael Schmitz --- Changes from v1: - change patch index from 3 to 4 (due to insertion of m68k kmap patch) --- drivers/scsi/mvme147.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c index ea8afeec8e56..166248bef6cf 100644 --- a/drivers/scsi/mvme147.c +++ b/drivers/scsi/mvme147.c @@ -21,6 +21,8 @@ #include "wd33c93.h" #include "mvme147.h" +#define DMA_DIR(d) ((d == DATA_OUT_DIR) ? DMA_TO_DEVICE : DMA_FROM_DEVICE) + static irqreturn_t mvme147_intr(int irq, void *data) { struct Scsi_Host *instance = data; @@ -35,10 +37,20 @@ static irqreturn_t mvme147_intr(int irq, void *data) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { struct scsi_pointer *scsi_pointer = WD33C93_scsi_pointer(cmd); + unsigned long len = scsi_pointer->this_residual; struct Scsi_Host *instance = cmd->device->host; struct WD33C93_hostdata *hdata = shost_priv(instance); unsigned char flags = 0x01; - unsigned long addr = virt_to_bus(scsi_pointer->ptr); + dma_addr_t addr; + + addr = dma_map_single(instance->dma_dev, scsi_pointer->ptr, + len, DMA_DIR(dir_in)); + if (dma_mapping_error(instance->dma_dev, addr)) { + dev_warn(instance->dma_dev, "cannot map SCSI data block %p\n", + scsi_pointer->ptr); + return 1; + } + scsi_pointer->dma_handle = addr; /* setup dma direction */ if (!dir_in) @@ -47,14 +59,6 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) /* remember direction */ hdata->dma_dir = dir_in; - if (dir_in) { - /* invalidate any cache */ - cache_clear(addr, scsi_pointer->this_residual); - } else { - /* push any dirty cache */ - cache_push(addr, scsi_pointer->this_residual); - } - /* start DMA */ m147_pcc->dma_bcr = scsi_pointer->this_residual | (1 << 24); m147_pcc->dma_dadr = addr; @@ -67,7 +71,13 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { + struct scsi_pointer *scsi_pointer = WD33C93_scsi_pointer(SCpnt); + struct WD33C93_hostdata *hdata = shost_priv(instance); + m147_pcc->dma_cntrl = 0; + dma_unmap_single(instance->dma_dev, scsi_pointer->dma_handle, + scsi_pointer->this_residual, + DMA_DIR(hdata->dma_dir)); } static struct scsi_host_template mvme147_host_template = { @@ -95,6 +105,11 @@ static int __init mvme147_scsi_probe(struct platform_device *pdev) void __iomem *base; int error = -ENOMEM; + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { + dev_warn(&pdev->dev, "cannot use 32 bit DMA\n"); + return -ENODEV; + } + mres = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mres) return -ENODEV;