Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4491511rwd; Tue, 23 May 2023 08:22:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ63OAm2NIcmzRjXdfOVS38aOWjQTg3ECxlJ1sBEvjdBWkQlyOxTmu9wc6WgWwpJqRLu7e90 X-Received: by 2002:a17:90a:928e:b0:250:4a18:f575 with SMTP id n14-20020a17090a928e00b002504a18f575mr13540727pjo.9.1684855322510; Tue, 23 May 2023 08:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684855322; cv=none; d=google.com; s=arc-20160816; b=DjgnG9bvGdTFXK19vdG6BCfpal/xVI//W7UNsUxGxrW+ZeAMfGsUt3BlAmEWQwzMr8 cD+N6AgQCNbuT/NU3qpp4T0lnQEX66VN/3v9vZ2ri/b0SZd6h7yn+cDEItJwjQET8980 vGGfFT9nVDcLsPq54P7QWyP8zcjvxrZsdEZdBML8T1Duz6sanM6CpQr7Yzk2K3iV1gsd Na9MljCLuuIsZ36CCUjCMOJ0RbtZ3R2mnvEmjvtYQCLTanlfm/vVP6JpHQsIWjEfSzHO CE/0fvKlU4C/JPsk73Ullact07MJa0Q/b35///0HQ8mhSnpnwXtM44QmqZzuYPrgC6OI 5FVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=14Njiq0FVZkX82TLQ37zxuiOET6tE8wUYy1Gx+sJltM=; b=yzDCtz5+kq/2EECPGJC/SkjkRV6zF9kcFCsiw2zPqBEK6Zs1zKOMYQ+ub9m0oxvHRU naOrBEZBWbyYtcvwaLHDQvo8RZk40fRzhrUxKHSUzmK88qq0a2NwW3go6SsAa0zM/DSP Dok7KaY6hM74PTRnpUog4KDf3YJ3Jkv7dGXNm7rZ38IwIGH9ScbE+3qnQyFuVATqpzJQ eFyJDh1GNszGAA+1glrdYAgMmxLeR7F8pKI+RnNh+agJcQrT1RGwxbvXA7THycB5uoTt tW8702SmaQyBG18OC6TYdSOfk9p7+W2Xyxgq9bQzWZrQQV3kQaTBPN/0OaPiW9CnCipa kvFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HPXMqt+f; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oc9-20020a17090b1c0900b0024de687d6e3si4616960pjb.111.2023.05.23.08.21.49; Tue, 23 May 2023 08:22:02 -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; dkim=pass header.i=@linaro.org header.s=google header.b=HPXMqt+f; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237182AbjEWPR7 (ORCPT + 99 others); Tue, 23 May 2023 11:17:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237314AbjEWPR3 (ORCPT ); Tue, 23 May 2023 11:17:29 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FC1218F for ; Tue, 23 May 2023 08:17:23 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-30aa45f4b6cso278279f8f.3 for ; Tue, 23 May 2023 08:17:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684855041; x=1687447041; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=14Njiq0FVZkX82TLQ37zxuiOET6tE8wUYy1Gx+sJltM=; b=HPXMqt+ftQ9mTQPYy85W+IjqCj+t7mUf/vd+io+75syv/w545t9VnLbPDCUk0b189r QLAugXiFJNerH/1vra8TZHCk5C8vi3MoZ+y1IPb9GAUdZSmTaBakAwrqTZpv3LuCqvN7 B34uXE6A+FdOMla4d68WVe5Jy1qORPSa5X3iIelstf/kr734LiBt0MB+3Q+s5xOC1XiU OHxV2ZQaZxi9O6kCkq7SxdBAh/v5mmFptrsbosGhvzk91rZnQ5rLmyIrb9PEZ7z+9L1y 3d///bYnJBYDqFaidyadJ8hGIk8OfwiidXm0jZFe+s09lQ+TYBPy8CVj53BsYBt2F0et stig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684855041; x=1687447041; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=14Njiq0FVZkX82TLQ37zxuiOET6tE8wUYy1Gx+sJltM=; b=chwbESFsP44IIZ8994E9ccjjCjZ2kwCLHbtjDepcO/g4yH89uoFMyyiq+fIXLBTAhb stxMmJjKvFSmqwmYokSqY3oztd/1dtDfu98dLvYNsY5j2kDlOJrxQFEB4XwKRvP3wAl7 wQONuIci9+trK8XyaKewyd3M8Fjr+dxHsyzqHysIrgHXTVVVL7yOwQPTF68MeK5pLnNb 6qW/vXOXDE28SAfHK+pmKFhlRebo5DT1oS6FGyJYS9aYbDnI3v6ll03kUkgECI7RZRTj 80nDs+CpabrAKh5eaRrRUjPTx+10S5Wyaairvd8rhaf+LL2qOdN9JcCUmVle9hfW3jqZ Wz4A== X-Gm-Message-State: AC+VfDyuVsQ6pkTujVGxoa52O+jong1oZwfF3/KVZALEUSICilCNURzl Aort2LohjEmQFmY1LggvrhEDpQ== X-Received: by 2002:adf:db46:0:b0:2fb:87f7:3812 with SMTP id f6-20020adfdb46000000b002fb87f73812mr11298378wrj.1.1684855041363; Tue, 23 May 2023 08:17:21 -0700 (PDT) Received: from [192.168.2.107] ([79.115.63.206]) by smtp.gmail.com with ESMTPSA id w8-20020a5d4b48000000b0030771c6e443sm11442606wrs.42.2023.05.23.08.16.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 May 2023 08:17:06 -0700 (PDT) Message-ID: <4b5feef2-8d6f-20b1-9763-6e9552c4eb1c@linaro.org> Date: Tue, 23 May 2023 16:15:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 1/2] dmaengine: at_hdmac: Repair bitfield macros for peripheral ID handling Content-Language: en-US To: Peter Rosin , LKML Cc: Ludovic Desroches , Vinod Koul , Nicolas Ferre , linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org References: <68b70631-07b0-f4b2-463c-b8d3c7b9dac3@axentia.se> From: Tudor Ambarus In-Reply-To: <68b70631-07b0-f4b2-463c-b8d3c7b9dac3@axentia.se> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 5/23/23 13:42, Peter Rosin wrote: > The MSB part of the peripheral IDs need to go into the ATC_SRC_PER_MSB > and ATC_DST_PER_MSB fields. Not the LSB part. > > This fixes a severe regression for TSE-850 devices (compatible > axentia,tse850v3) where output to the audio I2S codec (the main > purpose of the device) simply do not work. > Indeed, sorry Peter. > While at it, rewrite the macros as inline functions to evade checkpatch > warnings about argument reuse. > > Fixes: d8840a7edcf0 ("dmaengine: at_hdmac: Use bitfield access macros") cc stable please > Signed-off-by: Peter Rosin > --- > drivers/dma/at_hdmac.c | 35 ++++++++++++++++++++++++++++------- > 1 file changed, 28 insertions(+), 7 deletions(-) > > diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c > index 8858470246e1..6f352160bc3b 100644 > --- a/drivers/dma/at_hdmac.c > +++ b/drivers/dma/at_hdmac.c > @@ -153,8 +153,6 @@ > #define ATC_AUTO BIT(31) /* Auto multiple buffer tx enable */ > > /* Bitfields in CFG */ > -#define ATC_PER_MSB(h) ((0x30U & (h)) >> 4) /* Extract most significant bits of a handshaking identifier */ > - > #define ATC_SRC_PER GENMASK(3, 0) /* Channel src rq associated with periph handshaking ifc h */ > #define ATC_DST_PER GENMASK(7, 4) /* Channel dst rq associated with periph handshaking ifc h */ > #define ATC_SRC_REP BIT(8) /* Source Replay Mod */ > @@ -181,10 +179,7 @@ > #define ATC_DPIP_HOLE GENMASK(15, 0) > #define ATC_DPIP_BOUNDARY GENMASK(25, 16) > > -#define ATC_SRC_PER_ID(id) (FIELD_PREP(ATC_SRC_PER_MSB, (id)) | \ > - FIELD_PREP(ATC_SRC_PER, (id))) > -#define ATC_DST_PER_ID(id) (FIELD_PREP(ATC_DST_PER_MSB, (id)) | \ > - FIELD_PREP(ATC_DST_PER, (id))) > +#define ATC_PER_MSB GENMASK(5, 4) /* Extract MSBs of a handshaking identifier */ > > > > @@ -1780,6 +1775,32 @@ static bool at_dma_filter(struct dma_chan *chan, void *slave) > } > } > > +/** > + * atc_src_per_id - prepare the source peripheral fields of the CFG > + * register for the given peripheral handshaking id. > + * > + * @per_id: the peripheral id > + */ > +static inline u32 atc_src_per_id(unsigned int per_id) > +{ > + return FIELD_PREP(ATC_SRC_PER_MSB, > + FIELD_GET(ATC_PER_MSB, per_id)) | > + FIELD_PREP(ATC_SRC_PER, per_id); > +} I still prefer a macro, would you use the following instead? +#define ATC_SRC_PER_ID(id) \ + ({ typeof(id) _id = (id); \ + FIELD_PREP(ATC_SRC_PER_MSB, FIELD_GET(ATC_PER_MSB, _id)) | \ + FIELD_PREP(ATC_SRC_PER, _id); }) Cheers, ta