From patchwork Sat May 6 14:17:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Rojek X-Patchwork-Id: 13233551 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 87664C77B73 for ; Sat, 6 May 2023 14:17:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232822AbjEFORu (ORCPT ); Sat, 6 May 2023 10:17:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232778AbjEFORt (ORCPT ); Sat, 6 May 2023 10:17:49 -0400 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 020E319D47; Sat, 6 May 2023 07:17:39 -0700 (PDT) Received: (Authenticated sender: contact@artur-rojek.eu) by mail.gandi.net (Postfix) with ESMTPSA id 07AB420002; Sat, 6 May 2023 14:17:36 +0000 (UTC) From: Artur Rojek To: Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz Cc: Rafael Ignacio Zurita , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, Artur Rojek Subject: [PATCH 1/2] sh: dma: fix `dmaor_read_reg`/`dmaor_write_reg` macros Date: Sat, 6 May 2023 16:17:02 +0200 Message-Id: <20230506141703.65605-2-contact@artur-rojek.eu> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230506141703.65605-1-contact@artur-rojek.eu> References: <20230506141703.65605-1-contact@artur-rojek.eu> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Squash two bugs introduced into said macros in 7f47c7189b3e, preventing them from proper operation: 1) Add DMAOR register offset into the address of the hw reg access, 2) Correct a nasty typo in the DMAOR base calculation for `dmaor_write_reg`. Signed-off-by: Artur Rojek Reviewed-by: Geert Uytterhoeven Reviewed-by: John Paul Adrian Glaubitz --- arch/sh/drivers/dma/dma-sh.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/sh/drivers/dma/dma-sh.c b/arch/sh/drivers/dma/dma-sh.c index 96c626c2cd0a..14c18ebda400 100644 --- a/arch/sh/drivers/dma/dma-sh.c +++ b/arch/sh/drivers/dma/dma-sh.c @@ -254,8 +254,11 @@ static int sh_dmac_get_dma_residue(struct dma_channel *chan) * DMAOR bases are broken out amongst channel groups. DMAOR0 manages * channels 0 - 5, DMAOR1 6 - 11 (optional). */ -#define dmaor_read_reg(n) __raw_readw(dma_find_base((n)*6)) -#define dmaor_write_reg(n, data) __raw_writew(data, dma_find_base(n)*6) +#define dmaor_read_reg(n) __raw_readw(dma_find_base((n) * 6) + \ + DMAOR) +#define dmaor_write_reg(n, data) __raw_writew(data, \ + dma_find_base((n) * 6) + \ + DMAOR) static inline int dmaor_reset(int no) { From patchwork Sat May 6 14:17:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Rojek X-Patchwork-Id: 13233552 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 E9DA3C7EE24 for ; Sat, 6 May 2023 14:17:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232273AbjEFORu (ORCPT ); Sat, 6 May 2023 10:17:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232779AbjEFORt (ORCPT ); Sat, 6 May 2023 10:17:49 -0400 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B91A619D42; Sat, 6 May 2023 07:17:41 -0700 (PDT) Received: (Authenticated sender: contact@artur-rojek.eu) by mail.gandi.net (Postfix) with ESMTPSA id D7D8420008; Sat, 6 May 2023 14:17:38 +0000 (UTC) From: Artur Rojek To: Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz Cc: Rafael Ignacio Zurita , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, Artur Rojek Subject: [PATCH 2/2] sh: dma: Correct the number of DMA channels in SH7709 Date: Sat, 6 May 2023 16:17:03 +0200 Message-Id: <20230506141703.65605-3-contact@artur-rojek.eu> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230506141703.65605-1-contact@artur-rojek.eu> References: <20230506141703.65605-1-contact@artur-rojek.eu> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org According to the PM, the DMAC found in SH7709 features only 4 channels. Signed-off-by: Artur Rojek Reviewed-by: John Paul Adrian Glaubitz Reviewed-by: Geert Uytterhoeven --- arch/sh/drivers/dma/Kconfig | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/sh/drivers/dma/Kconfig b/arch/sh/drivers/dma/Kconfig index 7d54f284ce10..4494d09597e9 100644 --- a/arch/sh/drivers/dma/Kconfig +++ b/arch/sh/drivers/dma/Kconfig @@ -28,8 +28,9 @@ config SH_DMA_API config NR_ONCHIP_DMA_CHANNELS int depends on SH_DMA - default "4" if CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7751 || \ - CPU_SUBTYPE_SH7750S || CPU_SUBTYPE_SH7091 + default "4" if CPU_SUBTYPE_SH7709 || CPU_SUBTYPE_SH7750 || \ + CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7750S || \ + CPU_SUBTYPE_SH7091 default "8" if CPU_SUBTYPE_SH7750R || CPU_SUBTYPE_SH7751R || \ CPU_SUBTYPE_SH7760 default "12" if CPU_SUBTYPE_SH7723 || CPU_SUBTYPE_SH7780 || \ @@ -37,8 +38,9 @@ config NR_ONCHIP_DMA_CHANNELS default "6" help This allows you to specify the number of channels that the on-chip - DMAC supports. This will be 4 for SH7750/SH7751/Sh7750S/SH7091 and 8 for the - SH7750R/SH7751R/SH7760, 12 for the SH7723/SH7780/SH7785/SH7724, default is 6. + DMAC supports. This will be 4 for SH7709/SH7750/SH7751/Sh7750S/SH7091 + and 8 for the SH7750R/SH7751R/SH7760, 12 for the SH7723/SH7780/SH7785/SH7724, + default is 6. config SH_DMABRG bool "SH7760 DMABRG support"