From patchwork Tue May 23 12:42:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 13252213 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3E285C7EE23 for ; Tue, 23 May 2023 12:43:20 +0000 (UTC) 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Subject:From:To:References :In-Reply-To:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Od8mfY/TobCNd6ba6d3HEybZherJvLdL/I30LOymzFg=; b=HbTZd3jC6azNJ2 9EBXrNsuikcW2WJFHIpQNxARhw0mCvwWLs/zj3iFLzv3vWyUNzawivlPM5KP01h8MLII78JzKumH8 coyzEmviLdmPDqlg3tUR5OJdrRGW0ZY4zTIQghF6yaExDKlx8nBRqZc3y1zBKzgiXS/VulOOWuQqA a0bQO7+vRJqV2AclluTDE4ssaazhEGlpw9xSg4XEBz2LhNXRdKxntXjm5Ixg+GB7T0XWBznDLNKXD 6xI2ev47emQpxJyOa+ql0iEyyNKsxG51X8iXOUu+6f6Fv1hJG0f44FRrRgV8EIc0nBY/QbWQ59Yn8 3Lr4+P9XrrwWut68gnlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1RLs-00AH4Z-0X; Tue, 23 May 2023 12:42:56 +0000 Received: from mail-db3eur04on0702.outbound.protection.outlook.com ([2a01:111:f400:fe0c::702] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1RLp-00AH3b-0e for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2023 12:42:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gqsa6bPwuILaZS3EATgBm2j3tmb7tvnfQieQqM5221599MMmxRTbwoLOAYBzbmfTijWQJqRE76kh1zklQz1JDappLXrItXAWMG8Pi5OHVr99L+RhH07XQFOdEo1efABn1aNrCa4GGbJ9hXxOT74+3mmuBjcPjAEulGjpZT4atPrJQvYvQyhcxTLoKO53LpgUdfbgFGvlr64xXxioesOzjjpdPgHAjk+COLPYHjb/KCv9bRl8z5MCZ74MeSR3N8ikkXpsvr7DqUN+8UjU7gIAKF9U3aieMNaO5T1ioU47uWR1h4Yb8ayQVf1L0gM3hL7pOtejxxSX/zJ6unh3rSxqEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=f6LT9hG7keXQQuPSIBJDRVMCRJh1FSVbS5i14LstFSs=; b=hNnaKubn4HuLVYC3j39okB/Xy5Q7Fa/mJVWsgRj09twXPdc7slzUhyIGzi+e0lLfDEgHAAvXosfvcxm4XnTrDx0hx5YIFC37ziM2VcEAIz1eyNM35Ml9OtO7rwIlM0Slrdi4p0RYb/EMYCkDS4ncduszPXfb37RmPMAm/+4J+B/MDWVSTkBp3iBygmFDwXH61LviVerwvNr/cLT5Via/N+E1n1Ux9LZoFZKWRsiP5JJvBVUGyansXhorIhS37hFAwQXBvc+WFSq6cADCTz7gXviWLFIQpn79zWVR6cTPeeQoU8lW9+J9vS19P+YjCBc4njQdMQFc10diMVQu/Cjaqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=axentia.se; dmarc=pass action=none header.from=axentia.se; dkim=pass header.d=axentia.se; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f6LT9hG7keXQQuPSIBJDRVMCRJh1FSVbS5i14LstFSs=; b=R3gSe8U/sQFVQlRCilu/qp7gtZ84V+caNgDZnVaECqy75/g+XphIogdqbmK4BOwhPuHNIOTZ3+HHE5gF0ovHHA/xjNF68T8sKlZNKXpNTTkt8CFqwsu+YQP1nWw+yDFqB0fIkVbBW4Bf56VH5Atd9dJqNFmxbX8N/uKXjr+596Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=axentia.se; Received: from VI1PR02MB4445.eurprd02.prod.outlook.com (2603:10a6:803:ab::28) by AM7PR02MB6145.eurprd02.prod.outlook.com (2603:10a6:20b:1a2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Tue, 23 May 2023 12:42:50 +0000 Received: from VI1PR02MB4445.eurprd02.prod.outlook.com ([fe80::b703:24c6:975a:bf84]) by VI1PR02MB4445.eurprd02.prod.outlook.com ([fe80::b703:24c6:975a:bf84%4]) with mapi id 15.20.6411.028; Tue, 23 May 2023 12:42:49 +0000 Message-ID: <68b70631-07b0-f4b2-463c-b8d3c7b9dac3@axentia.se> Date: Tue, 23 May 2023 14:42:46 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Content-Language: sv-SE In-Reply-To: References: To: LKML From: Peter Rosin Subject: [PATCH 1/2] dmaengine: at_hdmac: Repair bitfield macros for peripheral ID handling X-ClientProxiedBy: MM0P280CA0074.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:8::28) To VI1PR02MB4445.eurprd02.prod.outlook.com (2603:10a6:803:ab::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR02MB4445:EE_|AM7PR02MB6145:EE_ X-MS-Office365-Filtering-Correlation-Id: 219d047b-41b1-4e29-6f22-08db5b8b3794 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kRv+PqNN9di3IpiPrWYjcut5Od8FTJ85gsMcj/OwXREdsZ2r6Me1+WVdJRW+yg8+ut76dNVAwlxbD164t1nSnLdyTVi9AvMCU18pzXS2YxcGs298iq3L8viFeRa+C5OUOVpkvOWj7iiMz77x4waIV/DUYFMTiClv24KS5P4QGYh8SF+TnKLAVqn9PKETrzKOubAPRR0mNz4EZSnmkiwudHO1gfMmQM/I1sWvtnCRNLak22koiB0YaMJixkR7kC92nN3KhqHrPSwITJT19ztB9XDg/Ogh2AOxQMF1hv/p+c8JYHbArvkZLsiJJ88YELYtJh1wkAtJMmCTA/b29554MDnpIUkfFfEJ2nrAVBeUvjwDAc0qv8Qz380MS8BpU3/VHclVe/fOSXeduYJLAn8hobZjuxbEcQPbmgwIHqML4KDQkJEzYsPAMHn/A6VQMiZYXJfpXMQgqXVt8ASqrp5Xk5xOZnSAmjX4jSWnQqG+JpV/EopE6OWNU5PmQbGEbLkdEjHmvin3tYmpW04ItFhPai7ELMT19OfRtDL8mkg+iixB78idT9DcOTV0fQEjLMjDe3Fb3wL3LmWVDeRoyX+QDO9Bglj5XjgEEjG2UiQ3YgX/tZSopQlqH4QV8d9AoAxnrKRiSXQDCjJctL6i1pL7mg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR02MB4445.eurprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39830400003)(376002)(366004)(346002)(396003)(136003)(451199021)(54906003)(86362001)(41300700001)(6486002)(31696002)(31686004)(478600001)(316002)(4326008)(6916009)(66476007)(6666004)(66556008)(66946007)(5660300002)(8936002)(8676002)(38100700002)(6512007)(26005)(186003)(6506007)(83380400001)(2906002)(2616005)(36756003)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?RiXeHBZ823esjWWdM4gajp79Z7Ry?= =?utf-8?q?zBjsd7pbhxyPO7WrcYnK8jo7JbwTBN7uJ56skVs2dRfTCUJm/FRNLIjqdkLWJjbt9?= =?utf-8?q?kA3D5MjYHdX4ONY9hcz3snL8Rn5TgnqM/DxoYy75uUONGlsAz3jZeHzhGpbLONQae?= =?utf-8?q?APuDH9ZP6ptt7XJk/FJqde6qriZUHuAoI2ChsHcxvy03VByqsaN7aWp5mD8/sMu9+?= =?utf-8?q?SJc0B2oS/jfC/ekckqFGkznwjTvFSo5/AUEs7/HO9FcPVJHzv8R13NNhA/X6S8Pqj?= =?utf-8?q?ot5VX7roily+K5EgbqZOZaxeE37qC0DifR+v0xNQMUSIz1RbziGC73GGsDUOCDPpD?= =?utf-8?q?YpDTO57dNpAdjpgcZtKnmZXJhBJQzGhrePnr59Qc/AWpvpHGAQfiOszqeqsjDJza4?= =?utf-8?q?NNOlkw+1Bx77EFWu430w3OzX4CKf70rPSuNZTez5pPf08lE1nJm+fXm176/I1eIMJ?= =?utf-8?q?+FRW78iDRcXOxwCFb/Lhi+BSgo5vjNtJR8YsOFM5wvNpGfQEd96woj7DM8RzSCkKf?= =?utf-8?q?bKH1dintXiMFXxMhycbC0v36zhNvdEMpnfCh2qLEKGDq2f9vfHeOsE3i8kRtZOIVk?= =?utf-8?q?ddnXuIe/bepeC1UL+wja/Pn9J+6NwuJFKHzV45NLFru2osHJu/i3MTIs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f-8?q?pCJoKi4o223G?= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: 219d047b-41b1-4e29-6f22-08db5b8b3794 X-MS-Exchange-CrossTenant-AuthSource: VI1PR02MB4445.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 12:42:49.6114 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AAtyQ3bYSkHzqIdxoLH8HjD8sfjpScDfGMMYC3bkrlCZhdGkK3+5LORWLQuJ/A3f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR02MB6145 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230523_054253_242628_C1B4BDA0 X-CRM114-Status: GOOD ( 13.36 ) 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: , Cc: Tudor Ambarus , Ludovic Desroches , Vinod Koul , dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. 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") 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); +} + +/** + * atc_dst_per_id - prepare the destination peripheral fields of the CFG + * register for the given peripheral handshaking id. + * + * @per_id: the peripheral id + */ +static inline u32 atc_dst_per_id(unsigned int per_id) +{ + return FIELD_PREP(ATC_DST_PER_MSB, + FIELD_GET(ATC_PER_MSB, per_id)) | + FIELD_PREP(ATC_DST_PER, per_id); +} + static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, struct of_dma *of_dma) { @@ -1812,7 +1833,7 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, * ignored depending on DMA transfer direction. */ per_id = dma_spec->args[1] & AT91_DMA_CFG_PER_ID_MASK; - atslave->cfg |= ATC_DST_PER_ID(per_id) | ATC_SRC_PER_ID(per_id); + atslave->cfg |= atc_dst_per_id(per_id) | atc_src_per_id(per_id); /* * We have to translate the value we get from the device tree since * the half FIFO configuration value had to be 0 to keep backward