From patchwork Wed Jul 13 02:55:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Schmitz X-Patchwork-Id: 12915920 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 2CD0DCCA47F for ; Wed, 13 Jul 2022 02:56:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231294AbiGMC4J (ORCPT ); Tue, 12 Jul 2022 22:56:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbiGMC4I (ORCPT ); Tue, 12 Jul 2022 22:56:08 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95EBDB1C1; Tue, 12 Jul 2022 19:56:07 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id t5-20020a17090a6a0500b001ef965b262eso1357267pjj.5; Tue, 12 Jul 2022 19:56:07 -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=IRRFCg80RU+w9f0X+XxlSoVhJ7/4eI+x/vtRy3PQEkVAIVMJVO3ATeZ13hF5sn0QSw Vb1snU6QN6YM8qhmlOImscDFIXBeVivmMgiIeACm0ZUGz5GOp9tzs05rPFdP4T3FuKmj zi1avPiztEuzdMFaJ6Wdlvl0juVyfQ4jRG0RKZE21ZacnYduPYs7dnHqEe+MYmGztDmA ZfA1k3BMVEkTKsNM2VRCCw6jdkEZHpOyFFJUhGof4rSo2Tta4K8eS15mAayMQrIbb2zp ct/hFJQqmitvYQxm5q1oxfjKl1WxikB4kAA4p7eflePuntTIRE3/KLlDhictIPAMBBuK E2/A== 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=mpXmFq8mvdiH2iOnzR9S2BQ5olTIrCio/wgL32cbQB+4y9o24dDjOOOD41LwUS4j0D S8fQP4w/MsAHVEtx09fwlcIqhdP6k0NJ9YROTMH1QogtOZ2qPC3aHCiMBxhfQo/w0tbw 4BS9YdZRsFk+B5AF//urfN0fuxjjYnOnYOI5c0Gga9vS0LIqhMU0Jz/aKij1CtP9FB/6 xi4Ovg1fYqysCCCqgvTUXby0ViquDqAHJicjPM+bRDdOOOE4bnoXlJbUIRM0pF/813Uz ogFAHH82CbmQk/C+3L9wsHv3GjMe8d5LaiFS33DGNP1Bz12lJx3HdZnY+ha0+5c1CdXh 6LuQ== X-Gm-Message-State: AJIora/kOlfMRxj1Vc2+fS+qQJSs5D4p4m9RdLto3hM2D+ynTWqWYlMC qzYkEnCkN3tVwncD3KljZgI= X-Google-Smtp-Source: AGRyM1uSq/a6KNVSKlDEhqx0DplbDaKewcz0F9SFJOneDFPX3m2A/kifPbBWiPyvCwVsMZVEriUDfQ== X-Received: by 2002:a17:902:db04:b0:16c:5568:d73e with SMTP id m4-20020a170902db0400b0016c5568d73emr1093083plx.46.1657680967016; Tue, 12 Jul 2022 19:56:07 -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 w81-20020a627b54000000b0050dc7628178sm7492070pfc.82.2022.07.12.19.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 19:56:06 -0700 (PDT) Received: by xplor.waratah.dyndns.org (Postfix, from userid 1000) id 7C0F1360331; Wed, 13 Jul 2022 14:56:03 +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 v3 1/5] m68k - add MVME147 SCSI base address to mvme147hw.h Date: Wed, 13 Jul 2022 14:55:57 +1200 Message-Id: <20220713025601.22584-2-schmitzmic@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220713025601.22584-1-schmitzmic@gmail.com> References: <20220713025601.22584-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 Wed Jul 13 02:55:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Schmitz X-Patchwork-Id: 12915921 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 9BD84CCA482 for ; Wed, 13 Jul 2022 02:56:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232094AbiGMC4K (ORCPT ); Tue, 12 Jul 2022 22:56:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231322AbiGMC4I (ORCPT ); Tue, 12 Jul 2022 22:56:08 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E832765E8; Tue, 12 Jul 2022 19:56:07 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id a15so10147008pjs.0; Tue, 12 Jul 2022 19:56:07 -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=75FoxV++GMxu2VY3OA67v9tSA2fW6OiCjpFilQU8+z0=; b=mBraN3CtR2uv4o4h0uKSDjkreswPojLXzTsdDanjn7ax7w3YQ26lXfzrIf6uv+s5il BEQzoCcUIFfuAHEXhPItechiWn6OxD6YtzVdML/E1tuvV1OYLfemgUOllYrl4FtALIOH bvv07TcukGRm2ycfpfq1fuwd4iv9jgmU/8u9k2sOogV5GvHeSditB1I4h7bf/LmdDl1o bufURjAFrIrQeqJswIzKCweaCkQj0w7SH8GS6wKt4GmkBOlgx0V6oiUWUryLeh4gQW2U JbxT/FbWPzvxIwRia/nIXWkLVool573Rw28zFM7sQUzP6xs8+U9YUfCCnswq0+RPXFTG 5aPg== 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=75FoxV++GMxu2VY3OA67v9tSA2fW6OiCjpFilQU8+z0=; b=54zy1LMqyYeHywBsg8SFsiiwz9nGtcm/ouQmTS83eMNz5wUcsgV1pZdGNuWJaNVrYH bCkara5NwL7x7hOlGfX5r5JVMTbuEv3WkJLGReUULZ1SNDbl1HzUVncHqYIt7cXvvBPQ J3nvBCdWrYkvLdLdO4E/9dT6gnls5dmuPiW5LJ6RnJPpZjGW6ZAxw8kxxHBq1tRYLr7T xiyo0KIy4SQcFGr72Ww4VFL9Jt7Thbg2ssu8Xm+hjSoMVV0wRPjOCOoaS95q7z9GStlf 0LFMXJXJdQ6ljcIiQk3jXUovCmKUJ/L+jW+OIgqVnt9pztdG3+xXQI5SvjJ+SToS8ULK G5qg== X-Gm-Message-State: AJIora/41Y+97gejooNRhgQ6Fo9IQFc3W/pxofEL7ozDTolqs/3rbOU/ M5WasegZiUdzBZlT+hWYJAE= X-Google-Smtp-Source: AGRyM1tS0VkYMLVNXv0Jm9vuBvlmKnaCNNuWmv3fLvF2vUSvKW8kH8V4Yw7KrfMXJwJWw6Wv9A7AIQ== X-Received: by 2002:a17:90b:3e8a:b0:1f0:6e06:92e7 with SMTP id rj10-20020a17090b3e8a00b001f06e0692e7mr4927111pjb.155.1657680967560; Tue, 12 Jul 2022 19:56:07 -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 z18-20020aa79592000000b0052abfc4b4a4sm6897113pfj.12.2022.07.12.19.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 19:56:07 -0700 (PDT) Received: by xplor.waratah.dyndns.org (Postfix, from userid 1000) id 055A0360333; Wed, 13 Jul 2022 14:56:03 +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 v3 2/5] m68k - set up platform device for mvme147_scsi Date: Wed, 13 Jul 2022 14:55:58 +1200 Message-Id: <20220713025601.22584-3-schmitzmic@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220713025601.22584-1-schmitzmic@gmail.com> References: <20220713025601.22584-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 --- Changes from v2: Arnd Bergmann: - correct resource size --- 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..7e3d4dc139c7 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, 0x100), + 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 Wed Jul 13 02:55:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Schmitz X-Patchwork-Id: 12915922 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 E3AD5C43334 for ; Wed, 13 Jul 2022 02:56:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233192AbiGMC4Q (ORCPT ); Tue, 12 Jul 2022 22:56:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231599AbiGMC4J (ORCPT ); Tue, 12 Jul 2022 22:56:09 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB49E65E8; Tue, 12 Jul 2022 19:56:08 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id o31-20020a17090a0a2200b001ef7bd037bbso1436865pjo.0; Tue, 12 Jul 2022 19:56:08 -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=BsxmFzifF9BIo8cMy5rhxaqn6OqhSSsd4NQ9sDFAqTy3iTNaE/i2bfH+YsvGniBI55 afq2RHyn5VmuLVdhJ+ALiovOdN4P33NCFsqtbpf3nsAZ+A6YvaYUjgVvSnVurZYZxrHo u460pEmwGOZH5o6mB3xwWbveIXKu9H7qTZk1lPvOsN/lznwCtxK3YzdvZcDBZ86GPgZE mnDUIVvd3ID8LuDezzxamHcP8/6BUcF0f6JJ/jff0GfGbjOq2x5DbuySKCY6CVoHnUGD fgZRK9lWLGmmu70z4EKXCecY39Y8novon4CzOXFTIHKmeBniqptE/48YP5kGEe3Lg38p WqKA== 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=oipODcYDBlJWgDfAC1Z1k6m+eiSjfKEAjHYPVMLrjy2/sL9Qp9t9+Z1k/7igVePWoy gsiOToCoy/36CHoiEhY2AMwy0ge1vdbdr0P8i92Izjrvy0LBPUJLolT63bWl2EwugGjZ y03Z9T/8xlbb2LniL84JOZv1L3gu0znTx3LYWCVZeVhGR9YSOr5UmDJnvrwLd9Srj6By LJiRqtRwJxBgbIpOVifdaM/L4BUK22inV5dnl/WTU/2r6DPB6QyS1HOXEKT0zLvsmUip TDocXy/n6jndG8sPVPrtaLt76BbInDASp2zLgJuWMl5dDk+7N2qgzVHAdNXt2XD2vts9 tH1Q== X-Gm-Message-State: AJIora9WWhN5JDk/F26MrqiuKX2ckHI+Vhzgtg8wPa+Hlyv/5YPcoxJf nJz7GMaW92RvKhEYmIZBEJM= X-Google-Smtp-Source: AGRyM1tR+rED7WQH5LviMXHraoT4TCdfyxa+gvs8nVKFLp7VbFyuuNuaBdF+0W9Dm6U8UFSxkJdxFA== X-Received: by 2002:a17:90b:3b8a:b0:1ef:b87d:309d with SMTP id pc10-20020a17090b3b8a00b001efb87d309dmr1376493pjb.176.1657680968253; Tue, 12 Jul 2022 19:56:08 -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 jd9-20020a170903260900b0016a109c7606sm7492487plb.259.2022.07.12.19.56.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 19:56:07 -0700 (PDT) Received: by xplor.waratah.dyndns.org (Postfix, from userid 1000) id 87A333603F6; Wed, 13 Jul 2022 14:56:04 +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 v3 3/5] m68k - add MMIO ioremap support for mvme147 Date: Wed, 13 Jul 2022 14:55:59 +1200 Message-Id: <20220713025601.22584-4-schmitzmic@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220713025601.22584-1-schmitzmic@gmail.com> References: <20220713025601.22584-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 Wed Jul 13 02:56:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Schmitz X-Patchwork-Id: 12915923 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 9AD99C43334 for ; Wed, 13 Jul 2022 02:56:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233360AbiGMC4R (ORCPT ); Tue, 12 Jul 2022 22:56:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232158AbiGMC4K (ORCPT ); Tue, 12 Jul 2022 22:56:10 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 085CFB1C1; Tue, 12 Jul 2022 19:56:09 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id v7so7025962pfb.0; Tue, 12 Jul 2022 19:56:09 -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=8kSolpFpfll2jRagRjitUaLZvrjSNiOy/OAh9cabmLo=; b=PBvqEbSNQmE/cQ+HqYKJX35P5gIKbXyXKjovZLeJ8W43luZ0TwvcrzLR9J0/lPumGu 30sc5/KcF9IwFNGrpXpDFAM/JtgCN4XgV8cxtvhFPhgC5LMKfkJ2XvTgqhjzIZtzoGRM FU6vLRHwqGpnm+AUsCgz9431MrzyAgsBnEp+yTzJywGnJ7+/Utv9Z/LFba5xPy/uB+bo Ahq+djXwMWhIGA3j1kxAJZP6nzIZfojeYgTzKHA34oAnfhEFVLYIZ7AWwBbBkVoaxfbr uWnOlKVpfG6HjcQVd+NqrcwyHaerrFyXrew9BMVe/VH6Unoy6xE4JRhT5964vzyJXUUD tugQ== 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=8kSolpFpfll2jRagRjitUaLZvrjSNiOy/OAh9cabmLo=; b=fA+1B7PtJffRaadfTnEcKgUz73GF1QUVFhwNXAsVTdz+9EMshDAFiR8jt5tnvavLV2 NN+fOv9gpJWbxNEyC0RhWBzuCjR/H0AElweLMkA8IPqdf5/NI+H0GlKxcK1JKeMM8KLb NXBsQ/T25+0v5tsw/pT4gSOc7xT+C4wvcPGzEOYKXQ38XQJ50Ko38Ddpk/o1+M6HjCOk 0IggzQ1xKyWsHd1CXJcq243D6PI35rGSMnDqGRD2Wi/etFccEL3G457u2lOiyTQRUk4n 6KytFSXPOMwTYiqn0/AAfZCfL4YGCMKuGh46SGqWAkLqyVO4fsb9ityZYChI7hcN2FMU Vc9Q== X-Gm-Message-State: AJIora+DyHuExS84mFLobkw/43S++NVTc+iGt1fqujSy/Bz2EGnfxYMg 6Nj1huIRoOgLeGlElqQX/IYNgjZUXjc= X-Google-Smtp-Source: AGRyM1vG9sPsFZDL9gXPOpK97+LxIIpjDxOBSqncO+NKnPzJyPaaX5AKitxbpwPtgH+rB7XD9srwEQ== X-Received: by 2002:a63:82c6:0:b0:416:1717:4add with SMTP id w189-20020a6382c6000000b0041617174addmr1167648pgd.472.1657680968545; Tue, 12 Jul 2022 19:56:08 -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 h29-20020aa79f5d000000b005289521b656sm7837407pfr.92.2022.07.12.19.56.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 19:56:08 -0700 (PDT) Received: by xplor.waratah.dyndns.org (Postfix, from userid 1000) id 0782F3603FB; Wed, 13 Jul 2022 14:56:04 +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 v3 4/5] scsi - convert mvme147.c driver to platform device Date: Wed, 13 Jul 2022 14:56:00 +1200 Message-Id: <20220713025601.22584-5-schmitzmic@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220713025601.22584-1-schmitzmic@gmail.com> References: <20220713025601.22584-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 4 (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 Wed Jul 13 02:56:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Schmitz X-Patchwork-Id: 12915924 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 3D500CCA47F for ; Wed, 13 Jul 2022 02:56:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230368AbiGMC4S (ORCPT ); Tue, 12 Jul 2022 22:56:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232206AbiGMC4L (ORCPT ); Tue, 12 Jul 2022 22:56:11 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 539C54D161; Tue, 12 Jul 2022 19:56:10 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id a15so10147110pjs.0; Tue, 12 Jul 2022 19:56:10 -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=+Zpq1dA4b/bWeDb/wHl+mZq9dvDvGdVdXynjpr6pFIQ=; b=mJSvvHc39MHXNzcKhSK8Tj0WjoObwFgFhapHI2zHtc3reyJQRvYhKD4SRI3Me2koTa 6KBQoYG0PnXMtNmxZJWINC0OSkwSiUxCTGIax/6mGHO+BeRCIvA8uhFrMqjdSL7caBLd njvu9s6slLKiubbxUFF+h7ESZ6ZkjkCtKllh3+D+vdgzDuMzdMp3hAo5MU0uDoiGgJvZ zT4V7jy/OSavTd0r1SHQnQ+Hsta0BtjorE1M8oUu2WrfpUJV/XbhbSwXcyKu3PP4tmp5 dRdNM8HHq7dQxAwzDpl+TDsashfXSz7m4YleKUjzYJ3oK8kX1subZ8iHq7FUdxdI/NTo xDNg== 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=+Zpq1dA4b/bWeDb/wHl+mZq9dvDvGdVdXynjpr6pFIQ=; b=medJcToGnXSVsCLXBPXwisy8wZDWRwCCfRXaz8dyeEA/iQdVDxVB2U/aPL3cUnx4G2 SWFVBOQ6qAytg11M4nrg3Zcjm55T8Es2BkYdpeBcOiqiSVkiO83Izl6/HANqeedjg2S8 EhdQ7vTgVtD61K4wt9a0Pvn5Q5/Ix0vutgMoCoITgrifoi2rom/2Ah5Llm2qe+Af+BCL O18kiSjrEI8uKqHVe/S7dbxjqPxjTEypr/vEsp+tWM3q/tnB8uCnERe7FBgMlcPcPNnP 7dBXD4AazrdES1yFtHAfpOJMit16wD/uk/nz2tPIvs0Y6DtGDYezpNHabG7pb8H8bEMj jhww== X-Gm-Message-State: AJIora+nvcBwCWZXyBE7X8PoeQpNcyUhsddm8z9gnkoEt8LuoreTeulA qA/6bbxZS5Z7CdjPDBq4Fa8= X-Google-Smtp-Source: AGRyM1uUGTq2NGSF5y4IZb/Y7ILIj1aqH0dn+3bOoyF7pOOKtieQCQnflnRoWKdjDgAlA55ql2emlQ== X-Received: by 2002:a17:902:d591:b0:16b:a170:8586 with SMTP id k17-20020a170902d59100b0016ba1708586mr1037093plh.91.1657680970071; Tue, 12 Jul 2022 19:56:10 -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 h131-20020a628389000000b00527bb6fff6csm7513375pfe.119.2022.07.12.19.56.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 19:56:09 -0700 (PDT) Received: by xplor.waratah.dyndns.org (Postfix, from userid 1000) id 799DC360403; Wed, 13 Jul 2022 14:56:05 +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 v3 5/5] scsi - convert mvme147.c driver to DMA API Date: Wed, 13 Jul 2022 14:56:01 +1200 Message-Id: <20220713025601.22584-6-schmitzmic@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220713025601.22584-1-schmitzmic@gmail.com> References: <20220713025601.22584-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 4 to 5 (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;