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: 12230249 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=ham 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 17AB5C433B4 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 E554461006 for ; Wed, 28 Apr 2021 23:51:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230131AbhD1Xvw (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?SVmh7ShD3oBV90fgGLmHWCvDliozXH?= =?utf-8?q?AQitgDMQBHM8QTqt17zTv8Oz89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YLhzh+akWAjKLboEhjYd0Up4so+TdtQP?= =?utf-8?q?GffPqnegJSIavBv3zEie1mP/yyMEZxG0YGxQGIU+L5rAjTppMppzMQG7nVfxGvcZj?= =?utf-8?q?fyLK3yCZRem+w8Zh0GnpxoHmVKycMnpKI1VcXVa4Adb1F20pm4pF9JqE0Bo8iZQgm?= =?utf-8?q?7+L/lHMPfbZT44GuruAWYU8z1fzoYDjkOf3xxqLz8Y1CASS/zvp0VpMWVo4jZp2CR?= =?utf-8?q?8W4vvSQT92EX0lYuSnGZFVaVVSRc3SGqWNA0uLvDmAa0Ecqz2O+mQkLZ17kWsqQY2?= =?utf-8?q?SsnRGGEJCxfdIcX2RPK2nyS23ng6Fa8I3opwUiR3b2i/rYpGFE+HLpDHRgO5Z86m0?= =?utf-8?q?c1wZfJqBosPOxwgiRF8btltWQdVtq3BOiJhffDnw1jxaqPrAAVv2kWqX7v3s1MLPh?= =?utf-8?q?qCnpMZYZEUZHJ?= 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: dmaengine@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,