From patchwork Wed Apr 28 23:50:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Dautricourt X-Patchwork-Id: 428677 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 294D1C433ED for ; Wed, 28 Apr 2021 23:51:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 008FA6144A for ; Wed, 28 Apr 2021 23:51:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231381AbhD1Xvw (ORCPT ); Wed, 28 Apr 2021 19:51:52 -0400 Received: from mail-eopbgr90053.outbound.protection.outlook.com ([40.107.9.53]:1894 "EHLO FRA01-MR2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229794AbhD1Xvv (ORCPT ); Wed, 28 Apr 2021 19:51:51 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WXegaM5pOCGJFnedhWUmrnmALvifx1XiYBDsjTN7T1qQvL3H8YNG06QC9oYHpcosH0FdNyvS6UUHqb759Yp2ZdSuGNU51PAfeMbISS9+mtupWxpx7UfJ5fjfI2IopeclSmVGXzjlkTMkeChr10yyo03q3nIfe0PFgl71+c0oD4GH3fnOt3YkN/b0/zxsraObxgX+n7ZFdQx6h6I5pTCASLkfR4zWv///bfyogFfnBj5KusFzynVjAmFSTzYprxNxLbWnoF7S3b++dj+HVBaVhpoxfUxDrdW45uVwVj3qfMIeNyPNPRxdQKE0BzPUvtig28IpL0OJ6drjO2mQIS0B/Q== 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-SenderADCheck; bh=R0IX8xIzgAMlnkMvOHmgOQkBdPq0S/Mu39eg6JopCII=; b=CZROxxtY76+dwMGGrUi86P0zx+TPN5P1bUMeg8e0a74AmUUsdzWKPV1uEIRTYjF+nfHXCySCLVFemoLJIlPk9tdfaeiV1lrlPypIw13IpcIO675hQWvOvFQj3HsQ2lwiQMn2kDHKtwH5WO8H64T0nCyoBcvas6AXapN3OQBtQO1KuZarTLxMveM2kpw1ZE76IpdGmeBGb4RUDgdLc7S8RVdTlV7nZhg00Jrung2YuFg4osAPdlpQHgLqWGksTKzhPrGq/MS+onnK2Npogju0TgNVUS97/U2PSRoffnHi4NIyqX6tqxEWSHjcXPvo0S7ZBwowyqBpzT4kp325uflCcA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=orolia.com; dmarc=pass action=none header.from=orolia.com; dkim=pass header.d=orolia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orolia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R0IX8xIzgAMlnkMvOHmgOQkBdPq0S/Mu39eg6JopCII=; b=PnVoUh2512APHCNKYGlo/2w1HaWPQ+VmznIMK5cYUBVryRfrQwbq0BsVYpgxN4mnwSxBqVQn7YCNGZUKdmCIhyHIORCGao/V8n7X1RYafIb7148auYslxlvtrrjm/g+abDK/CtRgOqc3UcErBvUGL9nCzXxIxiHsupiG+yMxqBA= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=orolia.com; Received: from PR1PR06MB4746.eurprd06.prod.outlook.com (2603:10a6:102:11::28) by PR1PR06MB6073.eurprd06.prod.outlook.com (2603:10a6:102:2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.25; Wed, 28 Apr 2021 23:51:04 +0000 Received: from PR1PR06MB4746.eurprd06.prod.outlook.com ([fe80::246f:58b2:79d6:6aba]) by PR1PR06MB4746.eurprd06.prod.outlook.com ([fe80::246f:58b2:79d6:6aba%5]) with mapi id 15.20.4065.027; Wed, 28 Apr 2021 23:51:03 +0000 Date: Thu, 29 Apr 2021 01:50:50 +0200 From: Olivier Dautricourt To: Rob Herring , Vinod Koul , Stefan Roese Cc: Olivier Dautricourt , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] drivers: dma: altera-msgdma: add OF support Message-ID: Content-Disposition: inline X-Originating-IP: [2a01:e34:ec42:fd70:167:681b:bc47:e8b1] X-ClientProxiedBy: PR3P195CA0004.EURP195.PROD.OUTLOOK.COM (2603:10a6:102:b6::9) To PR1PR06MB4746.eurprd06.prod.outlook.com (2603:10a6:102:11::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from orolia.com (2a01:e34:ec42:fd70:167:681b:bc47:e8b1) by PR3P195CA0004.EURP195.PROD.OUTLOOK.COM (2603:10a6:102:b6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Wed, 28 Apr 2021 23:51:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 878a2165-f32f-4e36-7475-08d90aa07bc4 X-MS-TrafficTypeDiagnostic: PR1PR06MB6073: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:669; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G/GwD9Zqi9U+iut4uRetBhowjh17MDinUZkrXpBzWF+JL/AX8+qkn8VjdUWIWcynWw+IgHxofDkuDkQ1xEFzwgKnHjbluzKvvbQTBx/9Rc/VCboftwXtq4SH8oj8IbRWKCjrr5orqXE56SOziWTp5yB2K2nhKusZ8MD/Z8cWgOA3f64CXPVrh8OIdlUVcwKLQdaGH5n6OOaVBprI5wFhZPAXQMpaV0CFHU65TM3wcTS4H4t8dnKt8La3D2cz0UJG+hjqxx9JPcDxd2La4EL6YxJu1/RqCP3yOGQdAVCd0SjVIeO+ivL28WP9vCeRQtWhHZi/OWP7enasK1bYmFerXJ4CKexSkIs6HsXdX49ZomDpCkOMKPlCRrOfayewrCOFGvQaGTkaSCfFGMaLQdqqkocr85gJNHfZaTy4T9x9ltepsh/TXMftX6SEee+6iVfeAGXfFu1T+/hQVdt5Ezn0it8Kws3D1I+dfMDzKXPipaC3jMZBlmvt29GnEfybN9Q3DDLzm/O9wguQ/iyAHUvtFkuytA4C7oLqBKWcLAQY35suLkSXPrwN4dyRw1I5S9XIdpFDChmWqfycydWyMjmN179bAI+7OxVrBnF/7fBsn0o= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR1PR06MB4746.eurprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(136003)(396003)(39830400003)(376002)(55016002)(8936002)(2616005)(2906002)(83380400001)(66946007)(110136005)(8886007)(5660300002)(478600001)(36756003)(8676002)(6666004)(16526019)(186003)(316002)(38100700002)(44832011)(86362001)(66476007)(66556008)(4326008)(7696005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?SVmh7ShD3oBV90fgGLmHWCvDlio?= =?utf-8?q?zXHAQitgDMQBHM8QTqt17zTv8O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TFOZtiRJbNjbSVjDxn/fmh6MsewhaYLhzh+?= =?utf-8?q?akWAjKLboEhjYd0Up4so+TdtQPGffPqnegJSIavBv3zEie1mP/yyMEZx?= =?utf-8?q?G0YGxQGIU+L5rAjTppMppzMQG7nVfxGvcZjfyLK3yCZRem+w8Zh0Gnpx?= =?utf-8?q?oHmVKycMnpKI1VcXVa4Adb1F20pm4pF9JqE0Bo8iZQgm7+L/lHMPfbZT?= =?utf-8?q?44GuruAWYU8z1fzoYDjkOf3xxqLz8Y1CASS/zvp0VpMWVo4jZp2CR8W4?= =?utf-8?q?vvSQT92EX0lYuSnGZFVaVVSRc3SGqWNA0uLvDmAa0Ecqz2O+mQkLZ17k?= =?utf-8?q?WsqQY2SsnRGGEJCxfdIcX2RPK2nyS23ng6Fa8I3opwUiR3b2i/rYpGFE?= =?utf-8?q?+HLpDHRgO5Z86m0c1wZfJqBosPOxwgiRF8btltWQdVtq3BOiJhffDnw1?= =?utf-8?q?jxaqPrAAVv2kWqX7v3s1MLPhqCnpMZYZEUZHJ?= X-OriginatorOrg: orolia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 878a2165-f32f-4e36-7475-08d90aa07bc4 X-MS-Exchange-CrossTenant-AuthSource: PR1PR06MB4746.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2021 23:51:03.8122 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a263030c-9c1b-421f-9471-1dec0b29c664 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lObCogh8FVkHuG96k49E3oZDIVneW6eCrlli5tzfV4w0QwEodT4/Y/+RmyhdDXyLFeHBISeQ+9mmim/IWbZw9efeaGep+9HGrogU6+Ft1Q0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR1PR06MB6073 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This driver had no device tree support. - add compatible field "altr,msgdma" - define msgdma_of_xlate, with no argument - register dma controller with of_dma_controller_register Signed-off-by: Olivier Dautricourt --- drivers/dma/altera-msgdma.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) -- 2.31.0.rc2 diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c index 9a841ce5f0c5..2b062d5aa636 100644 --- a/drivers/dma/altera-msgdma.c +++ b/drivers/dma/altera-msgdma.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "dmaengine.h" @@ -784,6 +785,16 @@ static int request_and_map(struct platform_device *pdev, const char *name, return 0; } +#ifdef CONFIG_OF +static struct dma_chan *msgdma_of_xlate(struct of_phandle_args *dma_spec, + struct of_dma *ofdma) +{ + struct msgdma_device *d = ofdma->of_dma_data; + + return dma_get_any_slave_channel(&d->dmadev); +} +#endif + /** * msgdma_probe - Driver probe function * @pdev: Pointer to the platform_device structure @@ -888,6 +899,14 @@ static int msgdma_probe(struct platform_device *pdev) if (ret) goto fail; +#ifdef CONFIG_OF + ret = of_dma_controller_register(pdev->dev.of_node, msgdma_of_xlate, + mdev); + if (ret) { + dev_err(&pdev->dev, "failed to register dma controller"); + goto fail; + } +#endif dev_notice(&pdev->dev, "Altera mSGDMA driver probe success\n"); return 0; @@ -916,9 +935,19 @@ static int msgdma_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id msgdma_match[] = { + { .compatible = "altr,msgdma",}, + { } +}; + +MODULE_DEVICE_TABLE(of, msgdma_match); +#endif + static struct platform_driver msgdma_driver = { .driver = { .name = "altera-msgdma", + .of_match_table = of_match_ptr(msgdma_match), }, .probe = msgdma_probe, .remove = msgdma_remove,