From patchwork Wed Sep 1 21:16:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 12470411 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EABB2C432BE for ; Wed, 1 Sep 2021 21:26:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BBA5660FDC for ; Wed, 1 Sep 2021 21:26:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BBA5660FDC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=timesys.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ewPK5MdIJX57ZlCSmUoXO0vjKNr40eZ2OI3tbiP87cY=; b=pYyK5v0IvoLvbe XpuukWacdo79X3fBYvGx2aVAKy65nZDx1uaOG7C7Q3Yc3Yb8UPHRL0kf7WQKuUGYYMBPGs5cOR+Rg 1IGQHJgiLYl5O9v9I2k3hcf5Z8FORb8VjFQJ8nfYHgz6D5kwe+brvCyPucQvUSLecCg6NFrpLoLme kyejl3vIqEEC91dPZAf44I31akomSRcW+T9pS3tcYi+PeDlptQpXVbG9rMVuKOzW3UDWFxInEkSXz OYKkJS8SjsDBX04aCtqqIWxDJKHeOzaSs0WO919oGITs4qNz6oN+Vq5Lk/8h36jRn7A7jP5AH4o2z CiqiTW+hxBoGLZyl3pVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLXhj-007UxQ-Jk; Wed, 01 Sep 2021 21:23:32 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLXcd-007SbZ-CK for linux-arm-kernel@lists.infradead.org; Wed, 01 Sep 2021 21:18:17 +0000 Received: by mail-ed1-x531.google.com with SMTP id g21so930780edw.4 for ; Wed, 01 Sep 2021 14:18:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=timesys-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nsj7VKNm1/45GUu+7ej+X+gh2q1WwYaSbQDEwk9lCrQ=; b=X7NoMvSyhPNax/+H6N/fuzKn9S68KQKw9FT2w9mog1ZOSsWtL1MBOIwjeGvboX6DEN zWKLMzNoK6s4Y18m0YRUAlFvib+rc1RJg4IpfcZqL9+xN6Iv4RoWuWJsRR/2folNjREL f48SeAMI3afeu6ZmR/6sXf+x7g01iiYZqJjXNKHzOvyaBDe5pS2a595auEb3P7JqmWYb 3v+tlJ9pklEMv4HloGoeoNRPeZ4lIkgkGxDGrHJXYkoXWKYcq1QYeG79Baj9kOFlr4Jt DJ4e0ABMP57KxQzTrGwx9gK3G8GsVNTe/LR9g9rkeGRBi+9G7BTsFDzoEYZSX/fdwYjH ORJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nsj7VKNm1/45GUu+7ej+X+gh2q1WwYaSbQDEwk9lCrQ=; b=dG7tPsWY44iewwRTeWLYu24HldAj68CY68nkSMjJv3tOtew/QwzC4YfALEwdhmmJWZ /iW4jYs6ka/sJeyr6tSq+E4WZGIVYKPyMMgzbZpuyJD3KdkmmpoiG8Sa8sur4Ho52H7s e3A5sJxRTEENASIlXOFdjI4mkQA8aQADv743mlFB/ea92egfQLvIIdgM16YVa2OrIKUw +JymmZ2rRFVKoOTT6k1/v4aJtM3rW+BkZasXiajpGYL7kAkTDAsBboYPEV9u2p+Zo6cf DLqFw8OuAB/qzVYvgyZguo9q6GvScxAXKtkYj0hEjjNcWkaJOQVlwZo3u8a9fn9sUExc vJbQ== X-Gm-Message-State: AOAM531KE2I2SxKxkGOZLWimVURafkfemlyqPCHz7PdmLi1XBqLV7V1v 25H2eaTMdteNkWyB6OOk+xcJQw== X-Google-Smtp-Source: ABdhPJyrNU0a5bN91zXXF+UzBB8yapuMNUdvNSLwLCCaO2tpGRw71zpDSUwVAF0L/ssLICsj+yPOGQ== X-Received: by 2002:a50:ab42:: with SMTP id t2mr1630804edc.113.1630531093249; Wed, 01 Sep 2021 14:18:13 -0700 (PDT) Received: from dfj.1.1.1.1 (host-87-5-14-18.retail.telecomitalia.it. [87.5.14.18]) by smtp.gmail.com with ESMTPSA id n13sm389406edq.91.2021.09.01.14.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Sep 2021 14:18:12 -0700 (PDT) From: Angelo Dureghello To: vinod.koul@linaro.org Cc: dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-m68k@vger.kernel.org, Angelo Dureghello Subject: [PATCH] dmaengine: fsl-edma: fix for missing dmamux module Date: Wed, 1 Sep 2021 23:16:10 +0200 Message-Id: <20210901211610.662077-1-angelo.dureghello@timesys.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210901_141815_526933_3A30AACD X-CRM114-Status: GOOD ( 13.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Fix following panic on system halt: Requesting system halt [ 10.600000] spi spi0.1: spi_device 0.1 cleanup [ 10.630000] fsl_edma_chan_mux() fsl_chan->edma->n_chans 64 dmamux_nr 0 [ 10.630000] *** ZERO DIVIDE *** FORMAT=4 [ 10.630000] Current process id is 38 [ 10.630000] BAD KERNEL TRAP: 00000000 [ 10.630000] PC: [<402f09ba>] fsl_edma_chan_mux+0x7c/0x12e ... Some architecture as mcf5441x (ColdFire) may not have a dmamux, so dmamux_nr is set to 0. This patch considers this case. Signed-off-by: Angelo Dureghello --- drivers/dma/fsl-edma-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 930ae268c497..009c75ff1320 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -638,12 +638,14 @@ EXPORT_SYMBOL_GPL(fsl_edma_alloc_chan_resources); void fsl_edma_free_chan_resources(struct dma_chan *chan) { struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan); + struct fsl_edma_engine *edma = fsl_chan->edma; unsigned long flags; LIST_HEAD(head); spin_lock_irqsave(&fsl_chan->vchan.lock, flags); fsl_edma_disable_request(fsl_chan); - fsl_edma_chan_mux(fsl_chan, 0, false); + if (edma->drvdata->dmamuxs) + fsl_edma_chan_mux(fsl_chan, 0, false); fsl_chan->edesc = NULL; vchan_get_all_descriptors(&fsl_chan->vchan, &head); fsl_edma_unprep_slave_dma(fsl_chan);