Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2979166rwr; Sun, 7 May 2023 01:53:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5JV6dbra9LUfmDfu52tGf//QVkWgOPF06DK0ma4LmXjeQLpl+oxFiwg+wbIk68da8Dgmvn X-Received: by 2002:a17:903:1c8:b0:1a6:f5d5:b809 with SMTP id e8-20020a17090301c800b001a6f5d5b809mr9296277plh.1.1683449633245; Sun, 07 May 2023 01:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683449633; cv=none; d=google.com; s=arc-20160816; b=aP0Lf+S9p/vMjEufoTJxl7d9w8sLjFBSo3VrpGC6IDRIYjrgznJFPeEdm1rq6kjhNV Pl4d13rR4zPZ0bdIs+9JbUw8CTHabQ2CBkRK0bLSHvlBjd6y4KtosL/NVuDlv0uUUsMk opyQNnGetBdhZl54jM0Pz2k7Z7dKQEdZcrtW7K4Y5g/DczHGh2DCac9hwUnk6glE7NME NY3Rk/XQrL+eNiWVzfrRg9Gv7lpPU8KgJhYjW5h+RNgfxVwhYdZNV7JjmryKWhgSC1y2 d3pYjFgP2oj590zzNtTemsGoAlh0CIoakukCFaKz4xwYncRlxkH3uBpVVqIWImi+dgyd M4xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=dWL1wAqkfnOmQ6N+oUez5tHV7Kh/yNJKkXlK31DCBvg=; b=pklqxEuzqhivkBuKqpLo8QnLsJPVPNGnU/f1po9XR9VuAxMGU78fklBGkQ3wgIie4w pjzWwQ5K/UbX88H4Z+IUBh7t2ISLizBiweJOedZme9QDSDFEMYHkbcrL8htw6Pe9Id17 CCFAfaY+HprQ6tKJVkLh06+phdqjEHiHBxOCx+UY/etbhrEGnSMoErkkB/+uqCEh0RNB 0IhIU3hCIJyjvhZSRbL+dtNmfSpGFQa3k1Mv23E3Z6ydKNlEl6aBQ4Y3fTW9+vuYBQVy GaCjf/0soOLoviJDJydlZGb5htVafq3TNwYIU89m61x8Y3e4Gu4sysZsL9QCk3+ZuIDb rDuQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a170903018f00b001a6dfb34f8csi6070636plg.305.2023.05.07.01.53.41; Sun, 07 May 2023 01:53:53 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231290AbjEGIj0 convert rfc822-to-8bit (ORCPT + 99 others); Sun, 7 May 2023 04:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229619AbjEGIjZ (ORCPT ); Sun, 7 May 2023 04:39:25 -0400 Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44D9E55BF; Sun, 7 May 2023 01:39:24 -0700 (PDT) Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.95) with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (envelope-from ) id 1pvZvK-001MM2-9r; Sun, 07 May 2023 10:39:18 +0200 Received: from p57bd9c27.dip0.t-ipconnect.de ([87.189.156.39] helo=suse-laptop.fritz.box) by inpost2.zedat.fu-berlin.de (Exim 4.95) with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (envelope-from ) id 1pvZvK-003HIr-2d; Sun, 07 May 2023 10:39:18 +0200 Message-ID: <65f873585db0cd9f79a84eb48707413775a9ba5b.camel@physik.fu-berlin.de> Subject: Re: [PATCH 1/2] sh: dma: fix `dmaor_read_reg`/`dmaor_write_reg` macros From: John Paul Adrian Glaubitz To: Artur Rojek , Yoshinori Sato , Rich Felker Cc: Rafael Ignacio Zurita , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sun, 07 May 2023 10:39:17 +0200 In-Reply-To: <20230506141703.65605-2-contact@artur-rojek.eu> References: <20230506141703.65605-1-contact@artur-rojek.eu> <20230506141703.65605-2-contact@artur-rojek.eu> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.48.1 MIME-Version: 1.0 X-Original-Sender: glaubitz@physik.fu-berlin.de X-Originating-IP: 87.189.156.39 X-ZEDAT-Hint: PO X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 On Sat, 2023-05-06 at 16:17 +0200, Artur Rojek wrote: > 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 > --- > 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) > { I have looked through the changes and the code and I agree that there is a typo in dmaor_write_regn() that needs to be fixed and that the DMAOR offset is missing although I don't understand why that didn't break the kernel on other SuperH systems such as my SH-7785LCR evaluation board or the LANDISK board which Geert uses. What I also don't understand is the factor 6 the DMA channel number is multiplied with. When looking at the definition of dma_find_base(), it seems that every channel equal to 6 or higher will return SH_DMAC_BASE1 as DMA base address. But if we multiply the parameter with 6, this will apply to every n > 0. Is that correct? Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913