From patchwork Fri May 7 10:19:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan \(OSS\)" X-Patchwork-Id: 432129 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp116449jao; Fri, 7 May 2021 02:47:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzt49pccRYOkTc3SgZg/rEjX1Kh93jKLdJ3CCSgfK+UAefU5NDKSEiKie895COqZDQnBnRY X-Received: by 2002:a17:902:da88:b029:ee:cd32:808e with SMTP id j8-20020a170902da88b02900eecd32808emr9462382plx.15.1620380848198; Fri, 07 May 2021 02:47:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1620380848; cv=pass; d=google.com; s=arc-20160816; b=ieNqiBq/GHpLypYG3+78Xlxow2/gEaHzUvVNOjq1IN6WgqBaHsvu8XazlKA9MMLNvQ 6KuEX4noYsSlamwSGCCFntbS0MG7ncdKWKjoMszwkTbZEJr5XiXT6o2f/FAp+cDB5e74 ++e/7UFw+sHY2UkrTRirjy4GJs2K0l3sNHI0goyLolXhaNlnyr4LuwitKah3VlNC7zF1 78ptRPIF9pnTmM2/I2V1LDduLbXd3UHyegl+N7zNGLjP0Psjz+usJ8K2gLbH6v8JsBu+ bYbXHK/0A1Pbef0tjBghYwrfzdO0bO3EM/bhHq+QoG/b3obTuxKCkFK1RJ5e0tmRPFAx +EuA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oxJWoeA1QBwlgP5tTvq/OWoGzQFaJUM4xbGPuxue39I=; b=uy87I7MSKImh/YS3J7DDnWAC/czLaFCtjPfzfq7pjeb4aEgdD7kKNb6D9UbOm9OCFT ozLDTfSZmHZIm2i3GfBVPvLFdbdfIDrqQxY18Ssa6IjFYjdyNxlTh1bsSGEC/1HwKTXB ZEMNZP4zSmkYr5jTK3xKgfTqK+jBnjWOTHBbQhtJS5jENevUKKi2kQh0jj5JgoZ22qJr EplmahqmiwVjCv6DQ8J0Ntv3bzLPleLjMyHUE/n3ROuIbQ7684n8OHvmFNSU/pCOUp5J ZF+YHpOyNnGCwRQUhk5MQVXTYUnbFX0G1g3jlYv7JCvoJwrKf2Xt1zG/UIQPAfeWlBuk cyqA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=WHjMGfUW; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p13si6152833pfq.327.2021.05.07.02.47.27; Fri, 07 May 2021 02:47:28 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=WHjMGfUW; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236557AbhEGJs0 (ORCPT + 7 others); Fri, 7 May 2021 05:48:26 -0400 Received: from mail-eopbgr60047.outbound.protection.outlook.com ([40.107.6.47]:28032 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236425AbhEGJsW (ORCPT ); Fri, 7 May 2021 05:48:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Panv9+GAN0aDVcQkSTFLWq28lBeoIFOAwfUaGaJES6T2OgP9lSbCXPInMBl0En1H9pHndsxpdUwEcDaOaCSLlw0xWC+mYD3nU0Xk6P9YHmgJvFViBV2IHnhQ6Dl3jFvOLy+olBuD0Eyo6JPeAofZpPPGKh9/di6y4Ett3vfGyfsJV4HAnBsgE1Xq+thmIgq0OiFyrgI9DlmKsAMT6xz2PjKCUmi5mi0+2e2mtfBkiJBLLGX6nATcMbk8CVBsuJROowGrY6bbIj1LFZYpmlzm8TIMY8R/kTR6vuuDbn9JzvrbbzEnVdCPla5d3RYLbQbBPPKrXWSyigx3XFtRxolWUg== 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=oxJWoeA1QBwlgP5tTvq/OWoGzQFaJUM4xbGPuxue39I=; b=jfAEz2vDLQTJv99zyqtdxX0xaKkldyK1u/lWF5YHQN0tyjMN/v23DodfZOz/eEcsipkXUhw7owNPm3Vr4sp1QO7Swa/a9dmcSVOl9MwUqIMzqQlZ7pP80J3ryprTLC+QfQI3k1EReQh7Wng2GCMwBwRjZV/nHovS9pQFUtphWr8NyiPOYaCENyQa+asN6kE3fPSV8dRNoWeeFlQwcUDRafCSKa3/nSDfpOpwaHx6LXL1/Ibu5DwN7moV7/S4xqgXl0DWn1D1b383u7YYgczymlZsAGqGfJdmYV2gasY/ljhCMtdDXgpGGdP7ljHAeka1vE1eJQcRHAln8A0faatAaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oxJWoeA1QBwlgP5tTvq/OWoGzQFaJUM4xbGPuxue39I=; b=WHjMGfUWDKdwLKSqoCJaoEnrLJNETCFyRSh+oSa/G9dmpt8Ugz1DH72L7THtsctPGKGHnjFAi6DzWkdUMvzfHCEDM8PkhiiGEb1K0KlIBNT1GEQBdg/YLWuxx3hx7X3KtL0mLzckJ3Z6j9OE4xMRFK7WiOa3fSmwicQ/UmzelcI= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB8PR04MB6857.eurprd04.prod.outlook.com (2603:10a6:10:114::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Fri, 7 May 2021 09:47:21 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64%8]) with mapi id 15.20.4065.039; Fri, 7 May 2021 09:47:21 +0000 From: "Peng Fan (OSS)" To: jassisinghbrar@gmail.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, o.rempel@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, aisheng.dong@nxp.com, linux-imx@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH 1/4] dt-bindings: mailbox: imx-mu: add i.MX8ULP MU support Date: Fri, 7 May 2021 18:19:23 +0800 Message-Id: <20210507101926.25631-2-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210507101926.25631-1-peng.fan@oss.nxp.com> References: <20210507101926.25631-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR02CA0085.apcprd02.prod.outlook.com (2603:1096:4:90::25) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by SG2PR02CA0085.apcprd02.prod.outlook.com (2603:1096:4:90::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 09:47:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc99f4a3-8681-439e-55a6-08d9113d1b99 X-MS-TrafficTypeDiagnostic: DB8PR04MB6857: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yTZUANbbNVKhIZtJ1jAErW3KWJzf/2J7gzP2VCIDlZ9Z5sa/MpyjWkuz1e6BC9zEx5ipEEbr7E00sxtOEtxtmn4CW2HYhhR9s907UFB6gGOl8xTlqL56TqFnzA1C/MaVkqi8bLzUxDsMt+eQqmmRdXcJn/igOkAWT8gwdwTX4dX8LOu0GKYCT/vJb3svRcmbdFES3gSGuUGSN1fMDD4qAsMdkRAz5dQTB8V+JzzaJLSMPAKMnWbmpuxduSFOkfIn3C3dAeSN3Xj9UjVIW8kC2jsDbQySam5V34OTAMRmuMk9PvhmEKLixu+uYqiholBiCtOv2jZUfSyxfACAWGj/mv/lBXYWPGsCqVNgZWx/tYCutpHh2Kzd7Wi5AkQOFG6q3mVvmqhL356VG1Sp3KVv8h06dz97CgWf5niouM8+deZ50HFUzfE9UATXZ4pMVeIATAYQuvBX38QElakY6HcGB/WbwQ4mSD9QsUUP1FECRAACYTVoz5LcJKc9aiBm35PuKijduAjhQRsvlHmL8XkFJBttZ2KZtZ/GhDLx+Tc2BI8LRpDUsv/BSZP6T0ERAfHR8lOVZijebv/nDxwfg+Lil9nsskwqp+aDY4fkELd9inIa529lTERV/JEBDawXnMhy+NnBJKFHqeDwb/qdIuzM2yNx7lRD4Hz6RmmO8ePzgEk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(396003)(376002)(346002)(366004)(39860400002)(86362001)(4326008)(478600001)(4744005)(26005)(7416002)(6486002)(83380400001)(6666004)(8936002)(316002)(38100700002)(5660300002)(66946007)(2616005)(956004)(1076003)(8676002)(2906002)(15650500001)(6512007)(16526019)(66556008)(66476007)(52116002)(6506007)(186003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: FbYNs/5ANcsdn69ImEgdJkPdoKWJSrjsJNngSKql7hwqsTGraB+apvBWZggSJNSGlOY2SQcNa7qxVlrgbh0mrU/9x3LArXyxgjyiUxhdaYWX+d/BOZmS8L3Yu90prKFtkBVn6dsjqul2ViJ+tAfHczU9Cb1NshBU/6Lbe7Pf7jJ+EjJaSLsxxYvbdUeijmfDIU5RJiw31T7TLG5dzPhnANl+rFXjn5mPtvXic00Dd/JNjo8UDuSCTZ2D5QNkOn3i891xkZk4tIg1gNY2nTLJp9JkA1E+LNxrxuhczOCSc/7YiLqSJnozYb9YpstSxxhEZDCw5vq8OZalVgt05m2pHWFfQai+DedXiAucm9KTf7IsjFfTg76f3QbxGNAX/BZYe8vU96JOz1x7FscFSfuREOgVHFT0RlRPDJqbDb5MnPQ29uMosZQIVAX4yBaBTg0F0NZqRxt/DZxmYDsI4vbLODH9KKrwbo7HrwqHgJxRzBXqIU2GOWeFdgxLva2Tw/aEY7C/RhIeQE7diWq9+uKbWfXAnk6Nn7bcItpy9FmBrUrWFkBwccQn/+r9yLO/W+DR0amwQl+RHUa2FAyXe/47PZZxAnWLNs4Z7Su8SN2lUxybQD2Jxgoqk1sHxXFT20bo3Q1XRJeAJsl3rGVW39mk0XWZZHEDoF11Qra0e2awKboPxrFMcQL4JmfB8gGAi0KrLisjBRYMw1SlGX2TW5fo310vofp0Xl2ty45OqFKgpP4c4S78c6SF4j8UcdUX+foZZIZS1w+V8wgfOQdqTAGVAaWtJhM8Y+QJrXbCzT4e/HkX/SCOltyG+buCmkQRmVrjgGiex0/RjGG23d3ed30DLs34QTQFCPJdbvvUMd2llNiGDXngJXxek0W8F6tmpgh25hBu23/xCUXmmV1pqikVIblL9GRn+kc7ZsShiEsiM7KvvLflGZOWkOWnK/4Jf7O0OA/xPYiSxxqvGyTeTx5Cv0/ayvFDRGPQeD4el4BwbRzMoehkaSbal19Zlj2syrqhQ0XsbCY/s+1BNDNBNmzE5qJOPWQB3IFVIlG9rfCeKBYH5oZbrPXLBECuu915aD1RuGrju+lMQ4LTBhycaPXv+fBwwX8+6vxo61JJEioolZMz47eSCRg0iJODH/UVHosik7xR6L1DlHFnyX9fhOmL51vWrlCdk7Zb4fQ5TKpfYmKobQP7wG+eL+uogeolkhc+I3stJoX6ApxjYpSeI5VK0jhrhEV6uoXEzcpczMVzVwAzCtISpbQ90o+RZq8Za16swKa12MyDa+X7vVlIcrH5dne3I2NX4LMOkcMwSdDzEQn8upw5RyZUJzThDxw+wR1O X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc99f4a3-8681-439e-55a6-08d9113d1b99 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2021 09:47:20.8064 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /tKZ4WLIMSqJ6jbHSawS02usrq6gr8T3ROcPDERU0WCf6Rd1I5M83VAoSotJi7o0TYYT42OmmOXW3yg1aaCkmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6857 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Peng Fan The register layout and bits definition of i.MX8ULP MU is different compared with others, let's add the compatible for the new MU. Signed-off-by: Peng Fan --- Documentation/devicetree/bindings/mailbox/fsl,mu.yaml | 1 + 1 file changed, 1 insertion(+) -- 2.30.0 Acked-by: Rob Herring diff --git a/Documentation/devicetree/bindings/mailbox/fsl,mu.yaml b/Documentation/devicetree/bindings/mailbox/fsl,mu.yaml index 1a3dff277e2b..675ad9de15bb 100644 --- a/Documentation/devicetree/bindings/mailbox/fsl,mu.yaml +++ b/Documentation/devicetree/bindings/mailbox/fsl,mu.yaml @@ -26,6 +26,7 @@ properties: oneOf: - const: fsl,imx6sx-mu - const: fsl,imx7ulp-mu + - const: fsl,imx8ulp-mu - const: fsl,imx8-mu-scu - items: - enum: From patchwork Fri May 7 10:19:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan \(OSS\)" X-Patchwork-Id: 432130 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp116540jao; Fri, 7 May 2021 02:47:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjyiGX2+1qdRAPiF6AbbIzdawEX0pVvKy1fJ8D7pqxY68uHeAHCGSU1IJFKBQgAgp44JEt X-Received: by 2002:a63:205d:: with SMTP id r29mr9160878pgm.340.1620380854687; Fri, 07 May 2021 02:47:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1620380854; cv=pass; d=google.com; s=arc-20160816; b=HoprXPNC/yWFnSd29h5pHN26bprk1yAYx6VRixjPS0yxC7pjZZUqhysCpbhXlfJ4TX z2rK0tTpRdO6MP4jlkIwJz8+HmrZuRAUTYE2dg/A7LN7ofvkW0VVxlOMqwhkHkv751Yu o3nhmQB2sZ+82yazjkZWcWzTOIak7xLEVgG6ReX9jMtpwqxKjk8uLq+osgjgz7UBqdhR 43v15w+zmn385JNxsHu3iociFRZtV0cOb2uJKfukGGkuhC5tLqwVic70kTEWEZuLhyX0 Ex2rIPNm+seFKzdtBztnm2VFT4KKbeKjNJjlcC0+1LnYvLBA42gfYTUGMCsmQR6vrzMV qB0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kthR1LaEBXeLffCxe1zpZe6u5BMGV8EDqpFYNFkbXVc=; b=rYiPSZWbIV8ahOubYVeicTmBwyw7h0Q0/5AOxUKiq7XeJvSjFYwiFfS97yFQ0ADbnf hoaqlOYfTEzCQOqfDhh8q2uJPonkJY7SSEFQOFFzh2rTfGkf8fQXXOjElLIojuL5uzAk +IA/nrMsdeas/WmUpdt7/Qu0cNNRB13kGQDZK4Wy4s2q/KbZbiTZGIfjBiayM7VyepdH /k4qVXoL/RErq8PPNDHxpGzYPZCQMWDgkG0kJnklZHLzpjbyIFhbyw+aiggqygV8yULY UrfoWYUWawZTE4824TrRp2SvEJzKGanlK7XGQ0JGk2UA7j7g1I8VgS3v7IH5nPL4etNi lhkQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=UGWAvykc; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p24si6244253pjo.68.2021.05.07.02.47.34; Fri, 07 May 2021 02:47:34 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=UGWAvykc; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234506AbhEGJs2 (ORCPT + 7 others); Fri, 7 May 2021 05:48:28 -0400 Received: from mail-db8eur05on2049.outbound.protection.outlook.com ([40.107.20.49]:6827 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236814AbhEGJs1 (ORCPT ); Fri, 7 May 2021 05:48:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k+YtRWC/Dz0K3NMb7Ad65TVdmi6w1VT0eM0Uh205acHbPKl6X06ayPOZDnLmebAPVNucsKzUPQ2cFSdSrWNaaYsgY+WGCiacCzPgCL9RDoRP/+25mc8tR0jAFHNACTNwC/G9e3yms7lXojqscVLJp0Ij6itvFqTNp8VXkjDjTox2aNdg5tV6Twl4CKtzFsd3U2mcNcvGlqp0zzxDXE9SBLGGH4sCdMbmUIm8KqwiW9bXchOgd3hVY73/jZJVHNCczz8XcUFNUSn6aHSoIvYlFACVLkhZXsd+JOJaQBX2sEZpK8ET1prO/nDx4ArYU/Yd/jutODxTxiglH0B+uvYfzg== 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=kthR1LaEBXeLffCxe1zpZe6u5BMGV8EDqpFYNFkbXVc=; b=MSHcAf7i/Xo1bdQpkF6j/vd7RpOA1ERIVQV72hitYfkhDabPo4+1lu8MEZuy/JYh7VJZgIvOoc918k7JtJMLgWgyx5w81d5/dTFavNzIrvmqp3Ap+Oq+opVlXtubiMf22NEFQtSfS6thhOzbdKH7z6vTYCDa+ugeF1OwY1n4Et7UkUTlpiEeui62ke5SCoLc2JpbuL/ZhquSWO7HyMrz8p4zqcYbogi8Fot0cqWqsUldPrnItd2l7/6MfyE6KsafQ0DBkfU9IQ9gmzANsOXSL7/TDAGq7SfIDjs0eqnENgIzVTx3TGG+jrkC1obSBx+8wuYWvMltBtrTzZrOKe4KlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kthR1LaEBXeLffCxe1zpZe6u5BMGV8EDqpFYNFkbXVc=; b=UGWAvykc/b7INNPxA4BVUh8nCpYdCqUklkb69sJf4WSLDX9N1YCJfi0/QHqV4TGx+kOIBLeLBXP3cjcZXhu+2h5FqIx3ecwqDKZ+IMFSD6q5UUUjalt+Y2XdLmNo590DNMDGTh/UO8+90GEr5HDA0JmItaswa6IShvvzlHgSEgw= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB8PR04MB6857.eurprd04.prod.outlook.com (2603:10a6:10:114::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Fri, 7 May 2021 09:47:25 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64%8]) with mapi id 15.20.4065.039; Fri, 7 May 2021 09:47:25 +0000 From: "Peng Fan (OSS)" To: jassisinghbrar@gmail.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, o.rempel@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, aisheng.dong@nxp.com, linux-imx@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH 2/4] mailbox: imx: replace the xTR/xRR array with single register Date: Fri, 7 May 2021 18:19:24 +0800 Message-Id: <20210507101926.25631-3-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210507101926.25631-1-peng.fan@oss.nxp.com> References: <20210507101926.25631-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR02CA0085.apcprd02.prod.outlook.com (2603:1096:4:90::25) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by SG2PR02CA0085.apcprd02.prod.outlook.com (2603:1096:4:90::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 09:47:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f618e615-fb67-4eae-a1dc-08d9113d1e54 X-MS-TrafficTypeDiagnostic: DB8PR04MB6857: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pzOBMziSiF0cL4CMNYm/fq/RzjovzGk1Gay1TWKgkPCjulBhg0ITxGbGLdo2wQo91eHw0oshZYoU3oGrx7ltyGPp6Tqqr7UQ3cG8t4UK5hCC/MTppAnoXWs8tsVVAmjYoeJhMxg4bU3pbcO6L7iBwySDfXm0RpuWm3IHqa8jkpo8U9DZfcNmoMyC9ZxHlCD/R1oqoJKoZJqr2IG5s+oJDBlrE2VDE29q10P6gl6HLUqPWJlV/6w1oY0yCJxtGv9bb27YHwAbw011b0RaW2592CeZtBKCnXPCI5UXf1KltRBW16D43DnDNuvrMh01KppLeCpKiTe0oVucNtzr4xkolIspFAKlyzA29bMnfOOTlUXBOtUP0W2PD4dr9wQEfQfCPpJfJnxJKCzZhjhKjS6wtkD8ejWeU4S8KYOzzu7FiX4BYVO/cihISYzMzDgVVm4yJ6yBvOyAIlcN9GYsGhLbTb+ifgLFhKzV+2UjuseLp+OEki8f8629pj1p/Z12oVxmBNe/dl+7+7ejcbnFh4O9vyr15o7uYrkpjfxapeTmVyYNQOmNPByKhLf7T7GjTD5hYhtL1sUEFA8ZKkyqGNeOIxN8qvu72srfWF9uvxHaxYEN1xa7opoioePt/xUWPkcdYvqHQUuAiU9xtY1tpV6OOA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(396003)(376002)(346002)(366004)(39860400002)(86362001)(4326008)(478600001)(26005)(7416002)(6486002)(83380400001)(8936002)(316002)(38100700002)(5660300002)(66946007)(2616005)(956004)(1076003)(8676002)(2906002)(15650500001)(6512007)(16526019)(66556008)(66476007)(52116002)(6506007)(186003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: sHHCbRqmdCc2zl90epdahTQ5ejwBprOIiRPesUvLxHlqZI9xPxEf0lV5zIrkOeUU67NYSFqBivXzlVbX1NViiTyN6p6E8BLxxC+zfd/4p26VjeatZ32b9B1nTDl2l+HAJoaq4GZ4JAYb/9KlPjS51pjncpo109vfjJ8wrHCPDBPKgFksllHYCKkfON1KQCSXU6Co67WsB53cgKMFBt69T+aV4/n4mYzFkTDcqlAVPzp4/Wi2P31opKP0HxCx9oZ9X6Nb4Pe4whPPpeirMnbGuCr08sMkuIUQ5y+GuFr0Na94C3rkoO/VdvJ0cuspRJe0r3qOgLLye4joXQUF6xgfYSbzEoY7UzpTBhBxmIgH48tFOG78dxUkJUIEWLYpef5KiSoQqloUjYNAnWuXMxW0eEDC0qRDXVzEj8a9JhCX5Yij39+JKuCg4o7sm0fIlUc4Cv7USrS/7LJZ+2Ngm8jWJOyAeRnw0tdriERGC9lu1bZxm1diXLu/dL5HubtoQC/BRTJJtioS0BJg07hwg3e1FAeconRTe8sywRXbeMhWP0v06sfETHE17QACOUEqAQ6/dHVuu+lGHdqjDZlOBo1AKyibNlyWwFfa34bO6Q0QgIKtHlTnIhutQUSWA8D36ZkRbaZSPnyyVWO8GjxM4rQ/AOPbFEgE67TGf/F3JWIKZhJ3TIXFILw8LCeMjng9w8ukTpkwPWKycV4XvSl0o3gfLkGuJgMhl47OFGPOhBSCdX8hFBtih0TA+pgMfv4ShwffpZKdFpfRkmnFlVUVeIX6IiaK9sSGCPWZbWQ8w548qTPi3cC5gD6kYgmfG+fTIVIsvie7/NG4JcWES5HRT2KYKDOcOzO+lwyrmVUfX71fwJT27rwFCoPHOvK8yS1RRtehE2k5s35P5PpF07tGLQMnfNX80CuAk0q4VswS3E+3PXTb5p66N9hSazgDQ7oBrireAVPH934dRpVoejksaYhZyQjBp0EyRj2PIdirQFndXtbbeagGx8rlVXZsaEYS6p1cpauy3CgZ5qC57JWt9pP9trN4W221YVLdxMC0zf8lIzuUYZLRcZPD9hT4rri61q+0yl6YJDZYJBi1WfpAibkhxltczGDQbawqlo33KBb+YRISF+AsuxsQ/k1BKO+g9WfkQkv3udF738DWYxegLovM1heBG7Oldz4PmV9e700pw9lnlcASpxKIAVx9D89sTVECzTpQLUvXrSnjDUmz9oV1/0zspVXcnHrzmvUdRB1bDD/oZbsE7T/IE4OGJJxZyeyYqmBzzh4pq3lxlqL8UKmGSUEiJYYDj1duBzqoF7u/OxGFwn2nHLDVuV3JgH0rVLto X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f618e615-fb67-4eae-a1dc-08d9113d1e54 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2021 09:47:25.3783 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Dialfqrzq8QbV5J7wBLJ/Rk5eFgKbrKmF9f3ymSBofl235oEcQZZRbsvoNysPNNZ3wPaEkeyUfMxJjh4EGcgLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6857 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Peng Fan The xTR/xRR registers are using 4 bytes stride and continuous. Considering we will support more TR and RR registers, use base + idx * 4 method to calculate register address, not hardcoding in driver. Signed-off-by: Peng Fan --- drivers/mailbox/imx-mailbox.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) -- 2.30.0 diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c index 2543c7b6948b..bd7758c32a80 100644 --- a/drivers/mailbox/imx-mailbox.c +++ b/drivers/mailbox/imx-mailbox.c @@ -76,8 +76,8 @@ struct imx_mu_dcfg { int (*tx)(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp, void *data); int (*rx)(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp); void (*init)(struct imx_mu_priv *priv); - u32 xTR[4]; /* Transmit Registers */ - u32 xRR[4]; /* Receive Registers */ + u32 xTR; /* Transmit Register0 */ + u32 xRR; /* Receive Register0 */ u32 xSR; /* Status Register */ u32 xCR; /* Control Register */ }; @@ -120,7 +120,7 @@ static int imx_mu_generic_tx(struct imx_mu_priv *priv, switch (cp->type) { case IMX_MU_TYPE_TX: - imx_mu_write(priv, *arg, priv->dcfg->xTR[cp->idx]); + imx_mu_write(priv, *arg, priv->dcfg->xTR + cp->idx * 4); imx_mu_xcr_rmw(priv, IMX_MU_xCR_TIEn(cp->idx), 0); break; case IMX_MU_TYPE_TXDB: @@ -140,7 +140,7 @@ static int imx_mu_generic_rx(struct imx_mu_priv *priv, { u32 dat; - dat = imx_mu_read(priv, priv->dcfg->xRR[cp->idx]); + dat = imx_mu_read(priv, priv->dcfg->xRR + (cp->idx) * 4); mbox_chan_received_data(cp->chan, (void *)&dat); return 0; @@ -172,7 +172,7 @@ static int imx_mu_scu_tx(struct imx_mu_priv *priv, } for (i = 0; i < 4 && i < msg->hdr.size; i++) - imx_mu_write(priv, *arg++, priv->dcfg->xTR[i % 4]); + imx_mu_write(priv, *arg++, priv->dcfg->xTR + (i % 4) * 4); for (; i < msg->hdr.size; i++) { ret = readl_poll_timeout(priv->base + priv->dcfg->xSR, xsr, @@ -182,7 +182,7 @@ static int imx_mu_scu_tx(struct imx_mu_priv *priv, dev_err(priv->dev, "Send data index: %d timeout\n", i); return ret; } - imx_mu_write(priv, *arg++, priv->dcfg->xTR[i % 4]); + imx_mu_write(priv, *arg++, priv->dcfg->xTR + (i % 4) * 4); } imx_mu_xcr_rmw(priv, IMX_MU_xCR_TIEn(cp->idx), 0); @@ -204,7 +204,7 @@ static int imx_mu_scu_rx(struct imx_mu_priv *priv, u32 xsr; imx_mu_xcr_rmw(priv, 0, IMX_MU_xCR_RIEn(0)); - *data++ = imx_mu_read(priv, priv->dcfg->xRR[0]); + *data++ = imx_mu_read(priv, priv->dcfg->xRR); if (msg.hdr.size > sizeof(msg) / 4) { dev_err(priv->dev, "Maximal message size (%zu bytes) exceeded on RX; got: %i bytes\n", sizeof(msg), msg.hdr.size << 2); @@ -218,7 +218,7 @@ static int imx_mu_scu_rx(struct imx_mu_priv *priv, dev_err(priv->dev, "timeout read idx %d\n", i); return ret; } - *data++ = imx_mu_read(priv, priv->dcfg->xRR[i % 4]); + *data++ = imx_mu_read(priv, priv->dcfg->xRR + (i % 4) * 4); } imx_mu_xcr_rmw(priv, IMX_MU_xCR_RIEn(0), 0); @@ -564,8 +564,8 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx6sx = { .tx = imx_mu_generic_tx, .rx = imx_mu_generic_rx, .init = imx_mu_init_generic, - .xTR = {0x0, 0x4, 0x8, 0xc}, - .xRR = {0x10, 0x14, 0x18, 0x1c}, + .xTR = 0x0, + .xRR = 0x10, .xSR = 0x20, .xCR = 0x24, }; @@ -574,8 +574,8 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx7ulp = { .tx = imx_mu_generic_tx, .rx = imx_mu_generic_rx, .init = imx_mu_init_generic, - .xTR = {0x20, 0x24, 0x28, 0x2c}, - .xRR = {0x40, 0x44, 0x48, 0x4c}, + .xTR = 0x20, + .xRR = 0x40, .xSR = 0x60, .xCR = 0x64, }; @@ -584,8 +584,8 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8_scu = { .tx = imx_mu_scu_tx, .rx = imx_mu_scu_rx, .init = imx_mu_init_scu, - .xTR = {0x0, 0x4, 0x8, 0xc}, - .xRR = {0x10, 0x14, 0x18, 0x1c}, + .xTR = 0x0 + .xRR = 0x10 .xSR = 0x20, .xCR = 0x24, }; From patchwork Fri May 7 10:19:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan \(OSS\)" X-Patchwork-Id: 432131 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp116563jao; Fri, 7 May 2021 02:47:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFaU+RJXEEKISU0GBUSNCZ4O9f58rgBpKPzij5ezuUnw4v6nVUiWJFhoFr9tH0+jQv+KpF X-Received: by 2002:aa7:985c:0:b029:28f:8ca0:f7c with SMTP id n28-20020aa7985c0000b029028f8ca00f7cmr9193193pfq.37.1620380857031; Fri, 07 May 2021 02:47:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1620380857; cv=pass; d=google.com; s=arc-20160816; b=CBxJL+cTBYMz03jrRqE3yJWtF24nduSdhqc7DF0Rplqk3//St1rbhCEMite5MA33hB WnHgEM+8NdCIZ06GHbjjJ/JcghSYBDvJCpDBJFeDPid1QmEiAiOqVGkQJSsFOXRR6gWf vPI1EGoJ8rYfKe2ndilCYCHFr2W2OlE+Ptu3Q7i6l8TWnFPXxxF6HfPT8glTGc0Das8Z LHIigAsh9P7mlthSJs0c1kombJ4z/hfTjyfknfTGoNIkfeVN1iIWN19nfCfzcDZAFkI9 m3Ldszt+3Rbwy6TB9Qj2VAE1T/NGILVg/T/HqPiB4np3tkz7wQJVQNqUI42pfYZ6aZC9 MUZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2s2IsQF9x1U+XldRTire0kFdqpmTCrVlVdeAlsaqg0M=; b=wx2K0I5qdaKKbJs/IhZ8kxhKAxTNo353nJ715RIu79XjJj+eO/6WxazfChxs7IxR/W FimhrYvpAdhdxhZSGkfMVIkl+zjKcJh+IVXVwzNnsCtY9g66mnLOwsqSgFFCm7Qs4r8y 0QthqRSJ/cLQ81hIskSpxtvbowuuO5NaDmMxzMyZ15R4MdUQ154My/1lfHq4D9P5Xd7f ATTJ6try/C6pQ97l8xxsLFnIzdWz4rDsZ6PSpLkJYxRCj31mZS38/fVlGCrANlSUt65o e+C7QQX7WpTXx+JlCboue1Nfrtsy+Tk5TGT22iskA07y0YjmNpF+YXJL9VYc2wWjIQSO xb2g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=aE13CBNm; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p24si6244253pjo.68.2021.05.07.02.47.36; Fri, 07 May 2021 02:47:37 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=aE13CBNm; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236854AbhEGJsf (ORCPT + 7 others); Fri, 7 May 2021 05:48:35 -0400 Received: from mail-db8eur05on2067.outbound.protection.outlook.com ([40.107.20.67]:2912 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236835AbhEGJsc (ORCPT ); Fri, 7 May 2021 05:48:32 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lZ+l3U/K7GZmXsMf4p6HXLICzbmDq7JDt8EXbDIG2NBBKXI5JRH/E/nzLk31vkrGgme/uh48VX8kVx7F/2L+MZ8KzLyF0W7K86y9S5pYIE8u92zDpx/JfiOnLHIJYjsn4IT3bCEeQEuas7HXXSR9kKg0cckxxT3TbcBAZLhwi8KcBH0pe8H6G6zgFhQr/1uNxnSM7OrNLkeTk8pDO3JuF0cMjxzJC3bw1xH/bjnz1rlfvBjQqx9X8XYOz2TSr1jkbr4RBSt//jrplQXLa83ZMX4SHL1EWx6EP7XRJeLPEXRNCBZOH2zOCG5BA0vbzIQGC5I6cOBtmLZcJvPRDEI1Og== 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=2s2IsQF9x1U+XldRTire0kFdqpmTCrVlVdeAlsaqg0M=; b=IbmZnd5f5lENlz5DJ9abOjwKYY8gwQl3gCsPAgQlwsfLPv1P0GpnNCOV9cpjdRk43LMQM96px5mPke0a2Xp01v9s8G5MZncRgzLv6wpAQaTOonTSwXiYlqRo2X6e/xcgzUioP/oThNtf72MNJs0ouoLw0bn3RWE/xdEEnDTOtJCXZW4Lsl1jcS87L9JA9ZZl/eI7uc1glc2ujf+BViCMTssOA6giFrfo5MWw6tE9fBk0N9kgQJ174Ux/S8vOhmDbhjUA8qrk321ma0jF7wD9Vk7wXQDALlsGmd7IMc+WE6jrWbvynVNf6xNBfThzzNn7x/qW5WclESnla2Xvvkdbrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2s2IsQF9x1U+XldRTire0kFdqpmTCrVlVdeAlsaqg0M=; b=aE13CBNmkT5r0L8OtIdFTr856JDGBgs3maQgkvp1+sE/+Rm+NI1NR2PqduQulXdgCr7/AYRJLIqeJ9QQJ4oOJCsLt+koCXZE2/2pSHnaQvvcxcWxDhnd1B0Pjus9a+jpTtAeFxax9JD1i0O3+d9dzMy0DRG1dFjLmq3VPV0APWQ= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB8PR04MB6857.eurprd04.prod.outlook.com (2603:10a6:10:114::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Fri, 7 May 2021 09:47:30 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64%8]) with mapi id 15.20.4065.039; Fri, 7 May 2021 09:47:30 +0000 From: "Peng Fan (OSS)" To: jassisinghbrar@gmail.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, o.rempel@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, aisheng.dong@nxp.com, linux-imx@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH 3/4] mailbox: imx: add xSR/xCR register array Date: Fri, 7 May 2021 18:19:25 +0800 Message-Id: <20210507101926.25631-4-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210507101926.25631-1-peng.fan@oss.nxp.com> References: <20210507101926.25631-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR02CA0085.apcprd02.prod.outlook.com (2603:1096:4:90::25) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by SG2PR02CA0085.apcprd02.prod.outlook.com (2603:1096:4:90::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 09:47:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bf221c8f-e619-4649-6af0-08d9113d2127 X-MS-TrafficTypeDiagnostic: DB8PR04MB6857: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lDjtA8SMjeQo/cKRAPQFAY5TbgfSl4b+1ZNWBv54hgnfBdUniTsd/YIwospCUnDCFmpt3QVoz5ZDD8QqxIFvz5pLO/crBwQGq3JxxaLjKaeCe90MLyPjCSJFcmMuQVwXoBljtsMzQRefOH3pL5rm0/PaobMs3ZYItY/mGrNcsDYkwrw5zYxi6v3tspognzHp8hF3FIhcndx/9wzzRzFmBtg3sIcqWXloWUZZJK5Pbg+IfMIldjqfcwdHdk5ad0qAF0GECeMSvFMfqtoEWTLYIrSfW8qsxxO3fhI/721BGwgWwOjvEs5vRk0M7OQ9ApMs71J7ARodOd7APxC0ulhgS6vTsBRS386+0WD8QawQzYuH2n/dR03GPpwADlGbkncz3pPr+vJf6LVdCgeFqK7oFZTvJ4sQXGlts4HoULTsc36x7klqRQL3cby+0Om6zue2nMpOjDQKRmCjxMchuVCmbjAJV6lF6ISUaMZwDB99Q+1q8/ELP11M82G/tc68GjfhDi6fDJMeM9r07iCuCj6SEop8YkIXGYJnOf51flbPrGwdNYFVCzPPqQ3zcvhwHm+V2qPAdi5igrW21PkLu6fza52gDdJTZzsalfJ7UbGCyC5BSof07NsZ08kCkF6rmtJIZ2uhBTOo0yxWtnNCvvJYgQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(396003)(376002)(346002)(366004)(39860400002)(86362001)(4326008)(478600001)(26005)(7416002)(6486002)(83380400001)(8936002)(316002)(38100700002)(5660300002)(66946007)(2616005)(956004)(1076003)(8676002)(2906002)(15650500001)(6512007)(16526019)(66556008)(66476007)(52116002)(6506007)(186003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: kpdBTUf8KEzZH0ud2+eqqp0GKNIZM3sNHoA4ku0yJ7QrDyU1IBmQ1TTBiNoowDrfYINeHqgkTkf7CFcQyXegQ/BMB7CZsc8mLp2atKB+ib0pPkiKSi5LFgymc7MmnhRPV4NzOhLk1K79X4nWq03N6O3xq3R/YEaYbrYCw2yAe75Awr+gCpB02lGEmnMEP/ytn78hxFUmwtKA4sjsneSlQzZpl7hzs0lqRTV0M4mxRNYtm75t9pUyeokP0rSXLnPLlkPS5EH5nMnQtZ6pePwJFD28GB7AavjXTDrFmsfWqKYscsNDsB0WAjzVZdL2ab6iEVwi7ithA58qiPTBUI0Y5um3kvVP2uK9aA7E4oJmBQKuxQVcvHUuWxfVXGrDkgkL0E7l8jCsV6TVpyIa4INYYsgWYlGEZGBnXVGeKBOJw5RjhhPFP6/kU+yOp5PHiPzSAhdNG4dxd9M2INc3zOjyafprQz2/Md6ar4PO2pm3daRVYTBGgJYRyTOerElb8d3vBwgtdC0/+30tQjWBOVwBL5nXZ2x7zF1eHsYJSGhERhJgM4eDnniIREkRlKZnfR/N1y6SHNoYyoQ32JwgsmtFLaTu3B8NDR5e8q2sl8a5aZy6m1jMvErxHTeop20xQGYpdHBI4Pd/d4xuKPrmjTuqFSXwwv3P5Tl4aGS2GV/IJOWfTaZkDsxFEKUK1XMJdT5iPaeo3j3envGrsDXPaFrEAldGIEAacw8ySSp4O2lQFJydx8eE0HPG5cjoSh9VVPgEbRfzkNM2aVLnrNadedrGfvqH+0YjmbtTuTpY5sE7ZA5kP0icDJnCNKK6vmFNqKJ/CZkNofMWNtDNmeN2KJjKU8Jrva66wXY0nEG7H2jSXpnG2jAIJRQ0Wbzs7tIJqQdOloegkJm9wYkVo1M6cbdNukLRysMqzdAVMYTJ7EOfw6vs/6PVIyz5YycHTpNLq4jZKE5DnAe3ms5+l1kL5C10ns3vHLke544pAOgv/Tbo4jFiz+5lJgBqnpxWF3wJslPAUWIq/P3Ed475JRem7nAeQ4+Neb1uai3fSgKSDlaZuZ/WjXYaLf1jYeH9XqQ8p98MjmZGAnP/JJvhWYVFkfh+YvzCZ5yh30e59Lycu2Ol57dqra6R5Qrie17LS5pffcZEEnLJUiBeW6sn2Gf0AoJ0khntZdFAHNpUB7/58DDVmWMB2ER/RdgqjEuZMfK0RO68betyBFAOyWJlrh2Fyo+6JZSvPTiaYbMEXCjOgHiho3kLp//pobrhDu7+IYK2/5tF+4gIh6KHWl1ewLi3ZBSxBOLSaa+lmyxm+U50chd/8HskiiE2AFXZaEXc6DDaRJDa X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf221c8f-e619-4649-6af0-08d9113d2127 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2021 09:47:29.9683 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fLgTX9q590fpiy61O630/G88XK6e81KSb3A41ZIFQrsbRD+3nu7vXNU7vPcVjWh5AGXpHibCtXzzLW7prLQKIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6857 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Peng Fan We are going to add a new platform which has 4 status registers(SR, TSR, RSR, GSR) and 4 control registers(CR, TCR, RCR, GCR), so extend xSR and xCR to register array and adapt code to use it. Signed-off-by: Peng Fan --- drivers/mailbox/imx-mailbox.c | 96 ++++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 35 deletions(-) -- 2.30.0 Reported-by: kernel test robot diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c index bd7758c32a80..f5dadcc827aa 100644 --- a/drivers/mailbox/imx-mailbox.c +++ b/drivers/mailbox/imx-mailbox.c @@ -41,6 +41,21 @@ enum imx_mu_chan_type { IMX_MU_TYPE_RXDB, /* Rx doorbell */ }; +enum imx_mu_xcr { + IMX_MU_CR, + IMX_MU_GCR, + IMX_MU_TCR, + IMX_MU_RCR, + IMX_MU_xCR_MAX, +}; + +enum imx_mu_xsr { + IMX_MU_SR, + IMX_MU_GSR, + IMX_MU_TSR, + IMX_MU_RSR, +}; + struct imx_sc_rpc_msg_max { struct imx_sc_rpc_msg hdr; u32 data[7]; @@ -67,7 +82,7 @@ struct imx_mu_priv { struct clk *clk; int irq; - u32 xcr; + u32 xcr[4]; bool side_b; }; @@ -78,8 +93,8 @@ struct imx_mu_dcfg { void (*init)(struct imx_mu_priv *priv); u32 xTR; /* Transmit Register0 */ u32 xRR; /* Receive Register0 */ - u32 xSR; /* Status Register */ - u32 xCR; /* Control Register */ + u32 xSR[4]; /* Status Registers */ + u32 xCR[4]; /* Control Registers */ }; static struct imx_mu_priv *to_imx_mu_priv(struct mbox_controller *mbox) @@ -97,16 +112,16 @@ static u32 imx_mu_read(struct imx_mu_priv *priv, u32 offs) return ioread32(priv->base + offs); } -static u32 imx_mu_xcr_rmw(struct imx_mu_priv *priv, u32 set, u32 clr) +static u32 imx_mu_xcr_rmw(struct imx_mu_priv *priv, enum imx_mu_xcr type, u32 set, u32 clr) { unsigned long flags; u32 val; spin_lock_irqsave(&priv->xcr_lock, flags); - val = imx_mu_read(priv, priv->dcfg->xCR); + val = imx_mu_read(priv, priv->dcfg->xCR[type]); val &= ~clr; val |= set; - imx_mu_write(priv, val, priv->dcfg->xCR); + imx_mu_write(priv, val, priv->dcfg->xCR[type]); spin_unlock_irqrestore(&priv->xcr_lock, flags); return val; @@ -121,10 +136,10 @@ static int imx_mu_generic_tx(struct imx_mu_priv *priv, switch (cp->type) { case IMX_MU_TYPE_TX: imx_mu_write(priv, *arg, priv->dcfg->xTR + cp->idx * 4); - imx_mu_xcr_rmw(priv, IMX_MU_xCR_TIEn(cp->idx), 0); + imx_mu_xcr_rmw(priv, IMX_MU_TCR, IMX_MU_xCR_TIEn(cp->idx), 0); break; case IMX_MU_TYPE_TXDB: - imx_mu_xcr_rmw(priv, IMX_MU_xCR_GIRn(cp->idx), 0); + imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIRn(cp->idx), 0); tasklet_schedule(&cp->txdb_tasklet); break; default: @@ -174,7 +189,7 @@ static int imx_mu_scu_tx(struct imx_mu_priv *priv, for (i = 0; i < 4 && i < msg->hdr.size; i++) imx_mu_write(priv, *arg++, priv->dcfg->xTR + (i % 4) * 4); for (; i < msg->hdr.size; i++) { - ret = readl_poll_timeout(priv->base + priv->dcfg->xSR, + ret = readl_poll_timeout(priv->base + priv->dcfg->xSR[IMX_MU_TSR], xsr, xsr & IMX_MU_xSR_TEn(i % 4), 0, 100); @@ -185,7 +200,7 @@ static int imx_mu_scu_tx(struct imx_mu_priv *priv, imx_mu_write(priv, *arg++, priv->dcfg->xTR + (i % 4) * 4); } - imx_mu_xcr_rmw(priv, IMX_MU_xCR_TIEn(cp->idx), 0); + imx_mu_xcr_rmw(priv, IMX_MU_TCR, IMX_MU_xCR_TIEn(cp->idx), 0); break; default: dev_warn_ratelimited(priv->dev, "Send data on wrong channel type: %d\n", cp->type); @@ -203,7 +218,7 @@ static int imx_mu_scu_rx(struct imx_mu_priv *priv, int i, ret; u32 xsr; - imx_mu_xcr_rmw(priv, 0, IMX_MU_xCR_RIEn(0)); + imx_mu_xcr_rmw(priv, IMX_MU_RCR, 0, IMX_MU_xCR_RIEn(0)); *data++ = imx_mu_read(priv, priv->dcfg->xRR); if (msg.hdr.size > sizeof(msg) / 4) { @@ -212,7 +227,7 @@ static int imx_mu_scu_rx(struct imx_mu_priv *priv, } for (i = 1; i < msg.hdr.size; i++) { - ret = readl_poll_timeout(priv->base + priv->dcfg->xSR, xsr, + ret = readl_poll_timeout(priv->base + priv->dcfg->xSR[IMX_MU_RSR], xsr, xsr & IMX_MU_xSR_RFn(i % 4), 0, 100); if (ret) { dev_err(priv->dev, "timeout read idx %d\n", i); @@ -221,7 +236,7 @@ static int imx_mu_scu_rx(struct imx_mu_priv *priv, *data++ = imx_mu_read(priv, priv->dcfg->xRR + (i % 4) * 4); } - imx_mu_xcr_rmw(priv, IMX_MU_xCR_RIEn(0), 0); + imx_mu_xcr_rmw(priv, IMX_MU_RCR, IMX_MU_xCR_RIEn(0), 0); mbox_chan_received_data(cp->chan, (void *)&msg); return 0; @@ -241,19 +256,22 @@ static irqreturn_t imx_mu_isr(int irq, void *p) struct imx_mu_con_priv *cp = chan->con_priv; u32 val, ctrl; - ctrl = imx_mu_read(priv, priv->dcfg->xCR); - val = imx_mu_read(priv, priv->dcfg->xSR); - switch (cp->type) { case IMX_MU_TYPE_TX: + ctrl = imx_mu_read(priv, priv->dcfg->xCR[IMX_MU_TCR]); + val = imx_mu_read(priv, priv->dcfg->xSR[IMX_MU_TSR]); val &= IMX_MU_xSR_TEn(cp->idx) & (ctrl & IMX_MU_xCR_TIEn(cp->idx)); break; case IMX_MU_TYPE_RX: + ctrl = imx_mu_read(priv, priv->dcfg->xCR[IMX_MU_RCR]); + val = imx_mu_read(priv, priv->dcfg->xSR[IMX_MU_RSR]); val &= IMX_MU_xSR_RFn(cp->idx) & (ctrl & IMX_MU_xCR_RIEn(cp->idx)); break; case IMX_MU_TYPE_RXDB: + ctrl = imx_mu_read(priv, priv->dcfg->xCR[IMX_MU_GCR]); + val = imx_mu_read(priv, priv->dcfg->xSR[IMX_MU_GSR]); val &= IMX_MU_xSR_GIPn(cp->idx) & (ctrl & IMX_MU_xCR_GIEn(cp->idx)); break; @@ -265,12 +283,12 @@ static irqreturn_t imx_mu_isr(int irq, void *p) return IRQ_NONE; if (val == IMX_MU_xSR_TEn(cp->idx)) { - imx_mu_xcr_rmw(priv, 0, IMX_MU_xCR_TIEn(cp->idx)); + imx_mu_xcr_rmw(priv, IMX_MU_TCR, 0, IMX_MU_xCR_TIEn(cp->idx)); mbox_chan_txdone(chan, 0); } else if (val == IMX_MU_xSR_RFn(cp->idx)) { priv->dcfg->rx(priv, cp); } else if (val == IMX_MU_xSR_GIPn(cp->idx)) { - imx_mu_write(priv, IMX_MU_xSR_GIPn(cp->idx), priv->dcfg->xSR); + imx_mu_write(priv, IMX_MU_xSR_GIPn(cp->idx), priv->dcfg->xSR[IMX_MU_GSR]); mbox_chan_received_data(chan, NULL); } else { dev_warn_ratelimited(priv->dev, "Not handled interrupt\n"); @@ -317,10 +335,10 @@ static int imx_mu_startup(struct mbox_chan *chan) switch (cp->type) { case IMX_MU_TYPE_RX: - imx_mu_xcr_rmw(priv, IMX_MU_xCR_RIEn(cp->idx), 0); + imx_mu_xcr_rmw(priv, IMX_MU_RCR, IMX_MU_xCR_RIEn(cp->idx), 0); break; case IMX_MU_TYPE_RXDB: - imx_mu_xcr_rmw(priv, IMX_MU_xCR_GIEn(cp->idx), 0); + imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIEn(cp->idx), 0); break; default: break; @@ -342,13 +360,13 @@ static void imx_mu_shutdown(struct mbox_chan *chan) switch (cp->type) { case IMX_MU_TYPE_TX: - imx_mu_xcr_rmw(priv, 0, IMX_MU_xCR_TIEn(cp->idx)); + imx_mu_xcr_rmw(priv, IMX_MU_TCR, 0, IMX_MU_xCR_TIEn(cp->idx)); break; case IMX_MU_TYPE_RX: - imx_mu_xcr_rmw(priv, 0, IMX_MU_xCR_RIEn(cp->idx)); + imx_mu_xcr_rmw(priv, IMX_MU_RCR, 0, IMX_MU_xCR_RIEn(cp->idx)); break; case IMX_MU_TYPE_RXDB: - imx_mu_xcr_rmw(priv, 0, IMX_MU_xCR_GIEn(cp->idx)); + imx_mu_xcr_rmw(priv, IMX_MU_GCR, 0, IMX_MU_xCR_GIEn(cp->idx)); break; default: break; @@ -444,7 +462,8 @@ static void imx_mu_init_generic(struct imx_mu_priv *priv) return; /* Set default MU configuration */ - imx_mu_write(priv, 0, priv->dcfg->xCR); + for (i = 0; i < IMX_MU_xCR_MAX; i++) + imx_mu_write(priv, 0, priv->dcfg->xCR[i]); } static void imx_mu_init_scu(struct imx_mu_priv *priv) @@ -466,7 +485,8 @@ static void imx_mu_init_scu(struct imx_mu_priv *priv) priv->mbox.of_xlate = imx_mu_scu_xlate; /* Set default MU configuration */ - imx_mu_write(priv, 0, priv->dcfg->xCR); + for (i = 0; i < IMX_MU_xCR_MAX; i++) + imx_mu_write(priv, 0, priv->dcfg->xCR[i]); } static int imx_mu_probe(struct platform_device *pdev) @@ -566,8 +586,8 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx6sx = { .init = imx_mu_init_generic, .xTR = 0x0, .xRR = 0x10, - .xSR = 0x20, - .xCR = 0x24, + .xSR = {0x20, 0x20, 0x20, 0x20}, + .xCR = {0x24, 0x24, 0x24, 0x24}, }; static const struct imx_mu_dcfg imx_mu_cfg_imx7ulp = { @@ -576,8 +596,8 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx7ulp = { .init = imx_mu_init_generic, .xTR = 0x20, .xRR = 0x40, - .xSR = 0x60, - .xCR = 0x64, + .xSR = {0x60, 0x60, 0x60, 0x60}, + .xCR = {0x64, 0x64, 0x64, 0x64}, }; static const struct imx_mu_dcfg imx_mu_cfg_imx8_scu = { @@ -586,8 +606,8 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8_scu = { .init = imx_mu_init_scu, .xTR = 0x0 .xRR = 0x10 - .xSR = 0x20, - .xCR = 0x24, + .xSR = {0x20, 0x20, 0x20, 0x20}, + .xCR = {0x24, 0x24, 0x24, 0x24}, }; static const struct of_device_id imx_mu_dt_ids[] = { @@ -601,9 +621,12 @@ MODULE_DEVICE_TABLE(of, imx_mu_dt_ids); static int __maybe_unused imx_mu_suspend_noirq(struct device *dev) { struct imx_mu_priv *priv = dev_get_drvdata(dev); + int i; - if (!priv->clk) - priv->xcr = imx_mu_read(priv, priv->dcfg->xCR); + if (!priv->clk) { + for (i = 0; i < IMX_MU_xCR_MAX; i++) + priv->xcr[i] = imx_mu_read(priv, priv->dcfg->xCR[i]); + } return 0; } @@ -611,6 +634,7 @@ static int __maybe_unused imx_mu_suspend_noirq(struct device *dev) static int __maybe_unused imx_mu_resume_noirq(struct device *dev) { struct imx_mu_priv *priv = dev_get_drvdata(dev); + int i; /* * ONLY restore MU when context lost, the TIE could @@ -620,8 +644,10 @@ static int __maybe_unused imx_mu_resume_noirq(struct device *dev) * send failed, may lead to system freeze. This issue * is observed by testing freeze mode suspend. */ - if (!imx_mu_read(priv, priv->dcfg->xCR) && !priv->clk) - imx_mu_write(priv, priv->xcr, priv->dcfg->xCR); + if (!imx_mu_read(priv, priv->dcfg->xCR[0]) && !priv->clk) { + for (i = 0; i < IMX_MU_xCR_MAX; i++) + imx_mu_write(priv, priv->xcr[i], priv->dcfg->xCR[i]); + } return 0; } From patchwork Fri May 7 10:19:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan \(OSS\)" X-Patchwork-Id: 432132 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp116646jao; Fri, 7 May 2021 02:47:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTM9GVay7wDluvat8aog4OnsRYZWzYdP6nFlt4Uyd0sZ0YRUceks11iQHO+jAxmZb4343+ X-Received: by 2002:a63:e63:: with SMTP id 35mr8869851pgo.27.1620380863264; Fri, 07 May 2021 02:47:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1620380863; cv=pass; d=google.com; s=arc-20160816; b=cY8tF8tRyV1DUVnVk333Uiet/qBSKWLogCRznlUR9EjkVBWHFZcxlZgbuM1QEBHfNL y5r/CwYj7vXA96p2+yUSVFw0rb0LXCM1VzREnTxh9LevjTgc7ZvPog7gQHM64Gyv0pPH yvghtnw33ejTOl4LXwy2bQ30rmfUqMcvaCN9MmQmYa4G2+vjJT1A3DTK2gbpsL8U83j0 Xl2aZhRE56Z6bvETEJrocenwwuOzeb8Jj3+ZPUrqLmMarcdilmBDQFK2dHT/+yALyVun QL8kzkpP3SiPKVAVBjGhu2TChPt+2X3MEciFSkyU7fvQuUt67HyVMwfDKa6qMpCyTcnf 2gaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kNYroyI2UN6Umsg6IIK+wfhqiMhS1hdXL7p0qTR/PHA=; b=M2wLKzN6BSF0gOr9Jg3R1dy7emB3Vmq1sbAo8UDDU1/dm4OPkewwTaMt/WSOwXHHTv IYNI2SveliAbbVXyG4+AaAEuUxgkgO1o4rWEOeIwt2rhytZ/a1+RfM0HTrmsqv7HJ827 jKslfMSJj8XpgRUy/L8PjxCzJcicq5xYRhkmvyYlAf1oFouxGWEs/d4YV6RsdWrKu9cX 259h5APaBjp0dYg244eOvJbH8GE+HDMGuDqH5YRWFGz1FZCSr8TuhZz554lEvKRRp4s1 T6gDvg6EUBjUgvtODNp6dMhlHywof9//t7M6Clfj8M2Wngtc/vPRooLNJBjaxVKrDwUY styQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=GHqohYqt; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mw15si15097250pjb.154.2021.05.07.02.47.43; Fri, 07 May 2021 02:47:43 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=GHqohYqt; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235782AbhEGJsk (ORCPT + 7 others); Fri, 7 May 2021 05:48:40 -0400 Received: from mail-db8eur05on2067.outbound.protection.outlook.com ([40.107.20.67]:2912 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236826AbhEGJsf (ORCPT ); Fri, 7 May 2021 05:48:35 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g/CR6m7fRaAYB+isUSlBuxkcfBVysZ/lyFrbItvQ+ANI37R9V5514PxwLGbZ3cD8EKScgwtluYwAXNSnLrJ8vRwJPNpW5wCKKQEZ10rBshq7as8mrtUR8m+a/zmlU/pkmVwKgQijb1vGXUVVIJPgrY5Ht0z7oCYcEyWpOOUKcoI1hUST0lXrLipe8FYxDVhLx62mO5exO78fVkB5/jxkgeg/8WqdL/w5ezz6xg29rQEQawBSy18R2Vp35V/4S87ebggHgdPEyjyRaB+Xe7WM2e8pPe4mEy/lWb4wQuRWXKcQGSjw5kkujqpSqLi4fH63l/rR61t7vb/nsGl/oshabw== 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=kNYroyI2UN6Umsg6IIK+wfhqiMhS1hdXL7p0qTR/PHA=; b=ZRITZZPCnPqHp7K/yirkguIaTmVJh4Crn23WT4hiVR302MKPjBoqiqawVT956RLQG+vSO/7EAPWjyLDS8Nd27O5pn3nBTKlAHBXhGFAk/9d6Dn/qYxIcpqXj+wiBw/LYNQzEl0mAsfTky2by/AqMME9CLjapRdBxKQ2Rb694Tvjs2KCF0LVG1AjWhgSRoi6CxeT3FZU9JyvxmPoNvDT8ppJtFtBw5BbdxxXaFH8iYhYc93Il5CajkPSsxz1OpvV069wTI4XZm0VVaRRe7Pb9LPsShfGxMiJJaMKs7miWQbEHmJTxfMLczN9XO/Ck5oJPvA8NTxB1uTfMxCdVjR/h0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kNYroyI2UN6Umsg6IIK+wfhqiMhS1hdXL7p0qTR/PHA=; b=GHqohYqtTkEJvG0aHLUFWuotAv0kyBGe1bC0VGqyrRtOJa8A/y5ylF+iPMHi+0PF2BVxnMHt45KM2SYtdZrAceSYF0FzhTJ54C98xAlbFKuALzFxw5c6USbci0dhX2hKtQ6tARxlL1SMpXLdf9Lu3gaA71wSfGLbxGgXGKbOQ2Q= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB8PR04MB6857.eurprd04.prod.outlook.com (2603:10a6:10:114::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Fri, 7 May 2021 09:47:34 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64%8]) with mapi id 15.20.4065.039; Fri, 7 May 2021 09:47:34 +0000 From: "Peng Fan (OSS)" To: jassisinghbrar@gmail.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, o.rempel@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, aisheng.dong@nxp.com, linux-imx@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH 4/4] mailbox: imx-mailbox: support i.MX8ULP MU Date: Fri, 7 May 2021 18:19:26 +0800 Message-Id: <20210507101926.25631-5-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210507101926.25631-1-peng.fan@oss.nxp.com> References: <20210507101926.25631-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR02CA0085.apcprd02.prod.outlook.com (2603:1096:4:90::25) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by SG2PR02CA0085.apcprd02.prod.outlook.com (2603:1096:4:90::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 09:47:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9cd7f834-3c0b-4739-1742-08d9113d23d2 X-MS-TrafficTypeDiagnostic: DB8PR04MB6857: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EdKfskGWUXFjwA4bhJTgrqVsvo8uYcVZ1mFUOM/IPYqxcSP3/6/E21KDJLVcSz8DMIn8UVUnJCxc/ZZ9Ssz2o0co+xO/vTfPr+ihHO4e/WmLggDdpdsOASbrga5+pRQbZ+XmsxpmE0w4gdYvXcvqwSHhZCAQTvXMwKXWp08diRDRBbhU02YRiFSY1ylQDlXmZZc7x8y+tUiV7IdVTF/c41xEjWRmPmmmCoS+c+BpX434bFyt+sDPzlplhDAr1PuZDFoK4AYEWS+dTfNAmN7ZN/e17S5kwM6T47zo5xLH0x06LS78uJJu2E7ga9PX1LYtbrjPCV5ycwKAPiE5WWD1moDaHKt894ePvxNF1qG0jn0eiMsmMW3Z4DwWluI/b3yZhzKMocFv2ILkHZGaCkIodLhl0oR2rTfd1shzJTrPzB5nR55nvDJpTvy+QCghAiBl088o6zI8QCtmmNki+cSWtKWQr2Ia30S14NezHPsMKOdfHeEK4QUNWNQ2wCL1vF2otvomT5+y5mdvQ4ZFcYAxicaal7W9bRphRSJVMUOS9ObCpD7u70s20ID9cDDBunWKI7/Tyxb3fYLV45kUIJrHUt3fa9nkEvTtwtk+hH3fQqq3y1GJZhMkW72eh2z7OV4rA6JbNVMB0I7f1v1HsaMW2w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(396003)(376002)(346002)(366004)(39860400002)(86362001)(4326008)(478600001)(26005)(7416002)(6486002)(83380400001)(6666004)(8936002)(316002)(38100700002)(5660300002)(66946007)(2616005)(956004)(1076003)(8676002)(2906002)(15650500001)(6512007)(16526019)(66556008)(66476007)(52116002)(6506007)(186003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: aPkR4I/UUNl/GQXsJtWU7pJeIrtkxBWW51EQ3yhBwwp+f5CMzXjhicCEdfIyKPMzbjhRgRuEyIlqVefMAF3kJVwILaFXNdGe5LemjLRTvekYv9XWtPt6ghYxA3VqAJEsKEpIOi1Qe0xx4hnrSe/87Wytuq2lII6hkeIgNZptRJQzZd4zwZKHq85aUOBQJxAYcy2DajCk6vVqSyAQN7wKD/wuZLO9RGoH90vjAwkM9nJoHevmT+syht1oBlG6qjOQa1vigDrDeZ+vWeupWCaq+nIECjTFZLAJpRvShjVtf2qlI/1g8gCGb8b7Rk6WavRDPZPFa7LJMB48Wt9ZbljepkbO2KRfaUqxDAwoosN5lDP/MA3er1znU68wEknGpLwTXPkAmC2D3oEmXoYEpqvzESLD4CUFvhXzHu9QdWc82gzbO+Ew9SFfhzFBR0N9D02prhTlP0lSRxiITAt+737SMFwbCGNZ4urjpkyAbhOIUG1xNiLda3lZyum0Hr9Yrfj9SBER60JaySjUnH5tKvU+mrDSZVMlgXPUBPGUOlNmZS8P7Mzz+GJjY0rXlJWUlBcBPYbmPJTkunqEUdS+oX/Kf6jr0XyqS4i96czJ/6aq4vpI4wSkoJz0q3ALSe6IJon22ePB4cPL61h8qsMbhEdxMErNtjevMCTSvNTMVKWoHRcYpSHPRJXI9EPFqGL2ruu9yksztMiRC3eocMJ99emv+OjhLDNRTawpmO0Y8x43NKjRwdpzJ9r1Md0G8FBQN26bL6aLZWVfNS2gLQezohnORMoBxMvan6dC/jCImOB7wsGsNc+gO/Gt1gHFyVEkbbRXJ2S40VIDqeL3osqbLU1n8fX11op/ycpKpfncc9h0j72e72FkWEFE/n1Ki8tTdvCttR33DmguKiPHePcp+TOjwS+86qh8iWMgcwk4+D2fNafMFkKGp2QAA221WKjufr0EXeJn9bjoiGza7tdhsWoDPMBO5Nu9ByfS0dQfThk1cXBcxGK/QBlo6fDh5ktA105+L0bpPSGsfl/vjV/2TGrpiqLwckLqkIpa1k/6A6l9pEPnZCQZZXSDvsP4Ud6yBzUY5E5d1MZQDqvQRVaJla8jRAuCiIrSkYF4y+D8nxDoMobWzANrJc1ZTO6Ip9Y1hHPZI5fHCraBF2punw3uLVzN9g65oHJ/lVCOfy5hNUsfsVVxDh50XbiG/pki+K+rTgKET3xG7DKuiYmyFCC03lPafyrO01t0LCri2AagsadQvLDWIGVIzWz/ec/OoFNm82RDVAEVm/eUkXTG999mwkd0LLkAFGw+jkwYbTJc1+0r8V2KHCOtBbDtshnfmNcSd+uW X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cd7f834-3c0b-4739-1742-08d9113d23d2 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2021 09:47:34.4802 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: F7gOAIIAebsAY/39yyx12JeoDG7hdbF/eVTNFTljOSSf4bLaIM02qxC4VMU2LCaaKG3E+4liD+YAPHhW2aN0fQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6857 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Peng Fan i.MX8ULP MU has different register layout and bit layout compared with i.MX6SX/7ULP/8. So add enum imx_mu_type to show it is IMX_MU_V2 or IMX_MU_V1. For IMX_MU_V2 mu hardware, check it when calculating bit offset to get the correct offset. Signed-off-by: Peng Fan --- drivers/mailbox/imx-mailbox.c | 100 +++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 39 deletions(-) -- 2.30.0 diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c index f5dadcc827aa..7fc5b4c2d3af 100644 --- a/drivers/mailbox/imx-mailbox.c +++ b/drivers/mailbox/imx-mailbox.c @@ -15,20 +15,6 @@ #include #include -#define IMX_MU_xSR_GIPn(x) BIT(28 + (3 - (x))) -#define IMX_MU_xSR_RFn(x) BIT(24 + (3 - (x))) -#define IMX_MU_xSR_TEn(x) BIT(20 + (3 - (x))) -#define IMX_MU_xSR_BRDIP BIT(9) - -/* General Purpose Interrupt Enable */ -#define IMX_MU_xCR_GIEn(x) BIT(28 + (3 - (x))) -/* Receive Interrupt Enable */ -#define IMX_MU_xCR_RIEn(x) BIT(24 + (3 - (x))) -/* Transmit Interrupt Enable */ -#define IMX_MU_xCR_TIEn(x) BIT(20 + (3 - (x))) -/* General Purpose Interrupt Request */ -#define IMX_MU_xCR_GIRn(x) BIT(16 + (3 - (x))) - #define IMX_MU_CHANS 16 /* TX0/RX0/RXDB[0-3] */ #define IMX_MU_SCU_CHANS 6 @@ -87,16 +73,36 @@ struct imx_mu_priv { bool side_b; }; +enum imx_mu_type { + IMX_MU_V1, + IMX_MU_V2, +}; + struct imx_mu_dcfg { int (*tx)(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp, void *data); int (*rx)(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp); void (*init)(struct imx_mu_priv *priv); + enum imx_mu_type type; u32 xTR; /* Transmit Register0 */ u32 xRR; /* Receive Register0 */ u32 xSR[4]; /* Status Registers */ u32 xCR[4]; /* Control Registers */ }; +#define IMX_MU_xSR_GIPn(type, x) (type == IMX_MU_V2 ? BIT(x) : BIT(28 + (3 - (x)))) +#define IMX_MU_xSR_RFn(type, x) (type == IMX_MU_V2 ? BIT(x) : BIT(24 + (3 - (x)))) +#define IMX_MU_xSR_TEn(type, x) (type == IMX_MU_V2 ? BIT(x) : BIT(20 + (3 - (x)))) + +/* General Purpose Interrupt Enable */ +#define IMX_MU_xCR_GIEn(type, x) (type == IMX_MU_V2 ? BIT(x) : BIT(28 + (3 - (x)))) +/* Receive Interrupt Enable */ +#define IMX_MU_xCR_RIEn(type, x) (type == IMX_MU_V2 ? BIT(x) : BIT(24 + (3 - (x)))) +/* Transmit Interrupt Enable */ +#define IMX_MU_xCR_TIEn(type, x) (type == IMX_MU_V2 ? BIT(x) : BIT(20 + (3 - (x)))) +/* General Purpose Interrupt Request */ +#define IMX_MU_xCR_GIRn(type, x) (type == IMX_MU_V2 ? BIT(x) : BIT(16 + (3 - (x)))) + + static struct imx_mu_priv *to_imx_mu_priv(struct mbox_controller *mbox) { return container_of(mbox, struct imx_mu_priv, mbox); @@ -136,10 +142,10 @@ static int imx_mu_generic_tx(struct imx_mu_priv *priv, switch (cp->type) { case IMX_MU_TYPE_TX: imx_mu_write(priv, *arg, priv->dcfg->xTR + cp->idx * 4); - imx_mu_xcr_rmw(priv, IMX_MU_TCR, IMX_MU_xCR_TIEn(cp->idx), 0); + imx_mu_xcr_rmw(priv, IMX_MU_TCR, IMX_MU_xCR_TIEn(priv->dcfg->type, cp->idx), 0); break; case IMX_MU_TYPE_TXDB: - imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIRn(cp->idx), 0); + imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIRn(priv->dcfg->type, cp->idx), 0); tasklet_schedule(&cp->txdb_tasklet); break; default: @@ -191,7 +197,7 @@ static int imx_mu_scu_tx(struct imx_mu_priv *priv, for (; i < msg->hdr.size; i++) { ret = readl_poll_timeout(priv->base + priv->dcfg->xSR[IMX_MU_TSR], xsr, - xsr & IMX_MU_xSR_TEn(i % 4), + xsr & IMX_MU_xSR_TEn(priv->dcfg->type, i % 4), 0, 100); if (ret) { dev_err(priv->dev, "Send data index: %d timeout\n", i); @@ -200,7 +206,7 @@ static int imx_mu_scu_tx(struct imx_mu_priv *priv, imx_mu_write(priv, *arg++, priv->dcfg->xTR + (i % 4) * 4); } - imx_mu_xcr_rmw(priv, IMX_MU_TCR, IMX_MU_xCR_TIEn(cp->idx), 0); + imx_mu_xcr_rmw(priv, IMX_MU_TCR, IMX_MU_xCR_TIEn(priv->dcfg->type, cp->idx), 0); break; default: dev_warn_ratelimited(priv->dev, "Send data on wrong channel type: %d\n", cp->type); @@ -218,7 +224,7 @@ static int imx_mu_scu_rx(struct imx_mu_priv *priv, int i, ret; u32 xsr; - imx_mu_xcr_rmw(priv, IMX_MU_RCR, 0, IMX_MU_xCR_RIEn(0)); + imx_mu_xcr_rmw(priv, IMX_MU_RCR, 0, IMX_MU_xCR_RIEn(priv->dcfg->type, 0)); *data++ = imx_mu_read(priv, priv->dcfg->xRR); if (msg.hdr.size > sizeof(msg) / 4) { @@ -228,7 +234,7 @@ static int imx_mu_scu_rx(struct imx_mu_priv *priv, for (i = 1; i < msg.hdr.size; i++) { ret = readl_poll_timeout(priv->base + priv->dcfg->xSR[IMX_MU_RSR], xsr, - xsr & IMX_MU_xSR_RFn(i % 4), 0, 100); + xsr & IMX_MU_xSR_RFn(priv->dcfg->type, i % 4), 0, 100); if (ret) { dev_err(priv->dev, "timeout read idx %d\n", i); return ret; @@ -236,7 +242,7 @@ static int imx_mu_scu_rx(struct imx_mu_priv *priv, *data++ = imx_mu_read(priv, priv->dcfg->xRR + (i % 4) * 4); } - imx_mu_xcr_rmw(priv, IMX_MU_RCR, IMX_MU_xCR_RIEn(0), 0); + imx_mu_xcr_rmw(priv, IMX_MU_RCR, IMX_MU_xCR_RIEn(priv->dcfg->type, 0), 0); mbox_chan_received_data(cp->chan, (void *)&msg); return 0; @@ -260,20 +266,20 @@ static irqreturn_t imx_mu_isr(int irq, void *p) case IMX_MU_TYPE_TX: ctrl = imx_mu_read(priv, priv->dcfg->xCR[IMX_MU_TCR]); val = imx_mu_read(priv, priv->dcfg->xSR[IMX_MU_TSR]); - val &= IMX_MU_xSR_TEn(cp->idx) & - (ctrl & IMX_MU_xCR_TIEn(cp->idx)); + val &= IMX_MU_xSR_TEn(priv->dcfg->type, cp->idx) & + (ctrl & IMX_MU_xCR_TIEn(priv->dcfg->type, cp->idx)); break; case IMX_MU_TYPE_RX: ctrl = imx_mu_read(priv, priv->dcfg->xCR[IMX_MU_RCR]); val = imx_mu_read(priv, priv->dcfg->xSR[IMX_MU_RSR]); - val &= IMX_MU_xSR_RFn(cp->idx) & - (ctrl & IMX_MU_xCR_RIEn(cp->idx)); + val &= IMX_MU_xSR_RFn(priv->dcfg->type, cp->idx) & + (ctrl & IMX_MU_xCR_RIEn(priv->dcfg->type, cp->idx)); break; case IMX_MU_TYPE_RXDB: ctrl = imx_mu_read(priv, priv->dcfg->xCR[IMX_MU_GCR]); val = imx_mu_read(priv, priv->dcfg->xSR[IMX_MU_GSR]); - val &= IMX_MU_xSR_GIPn(cp->idx) & - (ctrl & IMX_MU_xCR_GIEn(cp->idx)); + val &= IMX_MU_xSR_GIPn(priv->dcfg->type, cp->idx) & + (ctrl & IMX_MU_xCR_GIEn(priv->dcfg->type, cp->idx)); break; default: break; @@ -282,13 +288,17 @@ static irqreturn_t imx_mu_isr(int irq, void *p) if (!val) return IRQ_NONE; - if (val == IMX_MU_xSR_TEn(cp->idx)) { - imx_mu_xcr_rmw(priv, IMX_MU_TCR, 0, IMX_MU_xCR_TIEn(cp->idx)); + if ((val == IMX_MU_xSR_TEn(priv->dcfg->type, cp->idx)) && + (cp->type == IMX_MU_TYPE_TX)) { + imx_mu_xcr_rmw(priv, IMX_MU_TCR, 0, IMX_MU_xCR_TIEn(priv->dcfg->type, cp->idx)); mbox_chan_txdone(chan, 0); - } else if (val == IMX_MU_xSR_RFn(cp->idx)) { + } else if ((val == IMX_MU_xSR_RFn(priv->dcfg->type, cp->idx)) && + (cp->type == IMX_MU_TYPE_RX)) { priv->dcfg->rx(priv, cp); - } else if (val == IMX_MU_xSR_GIPn(cp->idx)) { - imx_mu_write(priv, IMX_MU_xSR_GIPn(cp->idx), priv->dcfg->xSR[IMX_MU_GSR]); + } else if ((val == IMX_MU_xSR_GIPn(priv->dcfg->type, cp->idx)) && + (cp->type == IMX_MU_TYPE_RXDB)) { + imx_mu_write(priv, IMX_MU_xSR_GIPn(priv->dcfg->type, cp->idx), + priv->dcfg->xSR[IMX_MU_GSR]); mbox_chan_received_data(chan, NULL); } else { dev_warn_ratelimited(priv->dev, "Not handled interrupt\n"); @@ -335,10 +345,10 @@ static int imx_mu_startup(struct mbox_chan *chan) switch (cp->type) { case IMX_MU_TYPE_RX: - imx_mu_xcr_rmw(priv, IMX_MU_RCR, IMX_MU_xCR_RIEn(cp->idx), 0); + imx_mu_xcr_rmw(priv, IMX_MU_RCR, IMX_MU_xCR_RIEn(priv->dcfg->type, cp->idx), 0); break; case IMX_MU_TYPE_RXDB: - imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIEn(cp->idx), 0); + imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIEn(priv->dcfg->type, cp->idx), 0); break; default: break; @@ -360,13 +370,13 @@ static void imx_mu_shutdown(struct mbox_chan *chan) switch (cp->type) { case IMX_MU_TYPE_TX: - imx_mu_xcr_rmw(priv, IMX_MU_TCR, 0, IMX_MU_xCR_TIEn(cp->idx)); + imx_mu_xcr_rmw(priv, IMX_MU_TCR, 0, IMX_MU_xCR_TIEn(priv->dcfg->type, cp->idx)); break; case IMX_MU_TYPE_RX: - imx_mu_xcr_rmw(priv, IMX_MU_RCR, 0, IMX_MU_xCR_RIEn(cp->idx)); + imx_mu_xcr_rmw(priv, IMX_MU_RCR, 0, IMX_MU_xCR_RIEn(priv->dcfg->type, cp->idx)); break; case IMX_MU_TYPE_RXDB: - imx_mu_xcr_rmw(priv, IMX_MU_GCR, 0, IMX_MU_xCR_GIEn(cp->idx)); + imx_mu_xcr_rmw(priv, IMX_MU_GCR, 0, IMX_MU_xCR_GIEn(priv->dcfg->type, cp->idx)); break; default: break; @@ -600,12 +610,23 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx7ulp = { .xCR = {0x64, 0x64, 0x64, 0x64}, }; +static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { + .tx = imx_mu_generic_tx, + .rx = imx_mu_generic_rx, + .init = imx_mu_init_generic, + .type = IMX_MU_V2, + .xTR = 0x200, + .xRR = 0x280, + .xSR = {0xC, 0x118, 0x124, 0x12C}, + .xCR = {0x8, 0x114, 0x120, 0x128}, +}; + static const struct imx_mu_dcfg imx_mu_cfg_imx8_scu = { .tx = imx_mu_scu_tx, .rx = imx_mu_scu_rx, .init = imx_mu_init_scu, - .xTR = 0x0 - .xRR = 0x10 + .xTR = 0x0, + .xRR = 0x10, .xSR = {0x20, 0x20, 0x20, 0x20}, .xCR = {0x24, 0x24, 0x24, 0x24}, }; @@ -613,6 +634,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8_scu = { static const struct of_device_id imx_mu_dt_ids[] = { { .compatible = "fsl,imx7ulp-mu", .data = &imx_mu_cfg_imx7ulp }, { .compatible = "fsl,imx6sx-mu", .data = &imx_mu_cfg_imx6sx }, + { .compatible = "fsl,imx8ulp-mu", .data = &imx_mu_cfg_imx8ulp }, { .compatible = "fsl,imx8-mu-scu", .data = &imx_mu_cfg_imx8_scu }, { }, };