From patchwork Sat Jun 12 13:31:34 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: 459159 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp1795187jae; Sat, 12 Jun 2021 05:59:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvlWFXbXPERjOCFlCxGLeuviwAK3KTh9UXu+ytAt1GvQg1uk9SK++i0qIHuAD5bs+hRWvq X-Received: by 2002:a17:906:7fc5:: with SMTP id r5mr8005291ejs.474.1623502771021; Sat, 12 Jun 2021 05:59:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1623502771; cv=pass; d=google.com; s=arc-20160816; b=hAT9ntxlUUapI5RLIgFz/ZK1APDOOnjYL5kSL9ASPuq1PnuvUg+9Gw3FOWCaI4rbCK QTgREwiJ7kOdYIL5RYtGXazEtd/JWDlsTCnE9ZcDu7EGjtpolCxh7vXlgs53tKvyZYG5 m07UdbBOvoamaoe/PN+V1OhbWJ2e7BjQhADDRbPhTPs3ExMiReRhJgBoq+ZGncJ0z3gK iLp/JhY3Rz0GQII5kEM//WAvxdbu6RcGaqmmrFkO5Fmlz7uYulBftjBARjWkDrVubEdG 7eCoFeb8ovapYQh5T0qOvZvJuMBhpRGxqYWnPCSoEcZ4kTTIk8xnOjKNHyj04yvYrj7F De5A== 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=Gm8D7o9Zkhoyic+N9lE/S6Kr9IT/0CYNpO5BdIwHQps=; b=wRJJpVqv8fyyaeDJ1e4GTVxTfDtM0OLWeY8lbI6xGg4X5sImiPklawgnhx3ul0NWlc t+oRqGxkigJQaeONK3/LYN5mq6sjIPsgNIqbSUQAQV/cxLsq8lgtMBVupI0ML/XhtMsv pVB7Adj6zhDc5nn6Q3kMR6QpUuYxPnyF2WMiff2gnw594f3inGY3bNIF8AcFoeSa65tS 2xk/l3mz2vY9cL5M6jxG+TN/mEk1htLfGyVasJeVJtAbmmzok0+eCo2o2GUBOsPdXf61 NNkFTrt2CQ5mAuw7O7JfQS2JUnh1SqgVk10hCWdoXMoarw15PQLzlQeHypOfmqZTUwOI Y/NA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b="E5/hwdo1"; 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 b11si7565559ejl.253.2021.06.12.05.59.30; Sat, 12 Jun 2021 05:59:31 -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="E5/hwdo1"; 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 S231403AbhFLNBB (ORCPT + 7 others); Sat, 12 Jun 2021 09:01:01 -0400 Received: from mail-eopbgr70077.outbound.protection.outlook.com ([40.107.7.77]:61414 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231393AbhFLNBA (ORCPT ); Sat, 12 Jun 2021 09:01:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VoJY2PghjBIkZeM3/NoSqveFeB7Qb5gy95V8nZaMyx35cLqoiJlyATeFor7OOoRl4NPsENQ2Kcinqh7eRckTpqpLzRQZLmVVfiWnMGJkY2OGYfq0G2bhmkMZApg2HSvOlruTUEHx66kF9UIUq8NAjVUcVQF7Wu5+YFrgOGKbm6G7m8Xm6dhZ7KSh70pUCj4o9sYxjhbLpOrGckC4auXVHHmj3soLgd/3lCFBjxvTsQqdev1MQw1Gonac5IqgGtpzG15Y4P+eokmkkht0WwlIQvvw5U1rE/tqMiXBTB0J5DX3i4XSy0Fs/U0XzMdSuFF/vfj3BgTkL8W0w9fpTvmxiw== 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=Gm8D7o9Zkhoyic+N9lE/S6Kr9IT/0CYNpO5BdIwHQps=; b=QBm0W+qfm457LgdzppMjNBZTUT35IYULghsrfm1puau9zentV0RDmWpZWJA9EFMxXROxdMNeTNqhlfbwf/qqrseF/jc86ECWdw4AxigwRFhIUf4u5sQZZQOKx6Gp8raHNixk13CTTsro7CNPjgiWImfobiFYxFKAzUw4bL4GWZMB4hLFHcPqxhTSBdGKbDsdIrG4VNQi54jOm3QUnixpKEVhsaporg2eW07sTXcHB015bpjY4soG9xbfj8ATg+9xPGqNybcx7nJLyEFV1fJvv6Uf9qEY6/h+VTE9yBpbhlnduMBUMGqVqWvUkW3pE9qggPbTwDNVzZsoGsKcfCvOcg== 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=Gm8D7o9Zkhoyic+N9lE/S6Kr9IT/0CYNpO5BdIwHQps=; b=E5/hwdo1rBXO6HFzR7+jydCRPlOKzUV7yN29K8cCy0KHn6aRSgBgrJbrmoNO7o2cQuVYiDA8ZTP1IrQUETPRknMIj2tJTVrEsJUdf68/SFZkNaSAg6dumg1+SUKABiv+56yNTRPtJlYB3t+xT7FeRAFezO+pMmNHevuN9QVRlbo= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DBAPR04MB7285.eurprd04.prod.outlook.com (2603:10a6:10:1ac::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.24; Sat, 12 Jun 2021 12:58:56 +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.4219.022; Sat, 12 Jun 2021 12:58:56 +0000 From: "Peng Fan (OSS)" To: robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, p.zabel@pengutronix.de, l.stach@pengutronix.de, krzk@kernel.org, agx@sigxcpu.org, marex@denx.de, andrew.smirnov@gmail.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, ping.bai@nxp.com, frieder.schrempf@kontron.de, aford173@gmail.com, abel.vesa@nxp.com, Peng Fan Subject: [PATCH V7 4/4] soc: imx: Add blk-ctl driver for i.MX8MM Date: Sat, 12 Jun 2021 21:31:34 +0800 Message-Id: <20210612133134.2738-5-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210612133134.2738-1-peng.fan@oss.nxp.com> References: <20210612133134.2738-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR06CA0174.apcprd06.prod.outlook.com (2603:1096:1:1e::28) 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 SG2PR06CA0174.apcprd06.prod.outlook.com (2603:1096:1:1e::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Sat, 12 Jun 2021 12:58:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 52fc616a-854c-44f9-27d1-08d92da1d6a3 X-MS-TrafficTypeDiagnostic: DBAPR04MB7285: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:366; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iCQxD5JmIc44DkBH39uiCcJT0PFtucPE2GQWv7EFP5Z6Rmmii0XEhdg1WWR8Aj1rBbzWRemP4qseFUNZga8/+AeRNH51GGJztuErqdIuxHrurmrNwcJkwzi1A3dI0DyvGIqIAfizwdd8sXjbWMtVpfGT80OJQXt1YRwPMHLprVr/FQ3rBLbDR+G6+GOBJtZICF7JxJMt1QVNCP3IV6ixR147Bet2H3QeHAfdjCEdqWOASSiuwuPPDDtwQvMmSE7EGkwyzCi+eH2Ev74eJJoPXG6QnBJ98XnX4Bk1dPlFt//R7MrZvHPl8Nqa05FpdqI+cKqpDvDIRNP4+pT+8V4o5E0i+jwWIfBcJ8MNdChHlhEvSkQLWvgT4eEozLN635oHaz9xefbLLhSOBa3vxPVXLBoEiiUwvCU1If4x1B/GgMZYsKDxRARTA3NTdlRQSMV7fqcEauF1smUPs4Ik8X1v5PTxnxoquk1ifT7PHTsLjpgsQPIwNavbHks/P7FR9RJv/sBnT8dK+gmFB3Pf0dL7RPXKYiFYVtkE+1Le4orlQG0dAxH9kpEx7UQ9UsDEAjl7h7aqjRBXfoQAe4HT/COfPHGc4AtRJFj/RQWj05/3qdWk3tUdl1oabDQupb0sdyU4ns7VIWn7kAfjRfAKstOPBA== 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)(376002)(346002)(136003)(366004)(396003)(39840400004)(6486002)(6666004)(8676002)(52116002)(2906002)(186003)(1076003)(16526019)(8936002)(26005)(4326008)(6506007)(66556008)(66476007)(66946007)(6512007)(316002)(38350700002)(38100700002)(478600001)(2616005)(956004)(83380400001)(7416002)(5660300002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SW4CZi1kJKknUuJSTHNi5GGG1F6JZMMFjrhs3SlIk5CNOowsx+NxGUUzLmi0LrlAAb3rAZd683cRqHWYecCYRZgIANoUY9YuXLuhU78WPR+I83U8z5rZ0N4WwWRBWXTgn28ITRHIoRsJ7Utl1/mTM4tTSk5k8SKdt7t/BwwSctiSwk7RDZStdlIqSMCzq2yiWDrpQs7zc2aR3sswqfwYRZTaxwnKP/0wRd5f5pkPWXPfdV5KEVncVolXbxw4XcKcSyGc+/AYLFYekCyia0SNVxML0qo9d/6I45NKChsuuKgrPf2/v9Jmeyby8ErBYz38hxfv0cxmEiGUDJmTqjr7EjVTUNJaNFqDp2KajZANbFVU/9zD86tCa8J/Fhp1qOTD//upu3DRgs8PD7Q3p04oSvF6k3yf2Qx6DrFS0IILEPiM2j3aI/QNrccOF/9xmHjViLrZG4sLuam38ZB9iiCA3WwNAxrJOrVesnxSvoqxxeSNk6K+CFS1XMCnFZA6AqBKeKZC50n3xYPbeBKvXIl5RLNaHMuzt481aI97Jq+9sZQyxPVtBHPHaOA6IALNZpTz7LhS/Kt4/cztrThqP3HwcxJi0tCTx5sd+lyLOy6NbT3xSrPw1l1Xr3ky0i5tk3hnviAkP9GrzruUiQ1UR0iHLjF3hVYvO+NBEQizQ6FmKJprnyuWzFpSQfF2XjLxykJrTI03LEW44TYha7xixQG39PvHI12NQNrwiCfrG8B6fGd2tVkw++G/uTUPovabrGVuJf0SaeQEvN9RQKg+Py7wkeDkFJoFn53eWsE0emXBN/3HkGN+K+Ja+QdVANi7qvrwD5bgpGXFXwcG7tlD5mpOF8Opmf4BILT4SSixFW2dtR9ahzqyhG5Hs9d2hotCW79dy/vTqBkxqlrQqozvu+whmoZNOm5oEXWblltIRfVUmQk3DzQ5zUVFQ8hLaTFPy9Qz+AxCB9hm9Y3cT4sDwkFgxznw4b+xmYm/QVRGlsMJME7bOz53EEgtkXGR7uvsGOCIEx4OXAnurWgs+wcuTMjXmVdShedrN3E46Aj728IwV8YQzqLEjDtFeAhb+U7iFlsHKsR69UOwOZVksndOsd174KqVFhcHMh5qYBG5BmojW/Osd0fGQgbp9V1HaCgHjhEECsNogVay1FW4sgP0jCozfp/jvpUIOpWv7B3TorQTt1oJnsILU1osdpdlP2n7YLzvTba9nQsSGMHoLIyQvdKnnZtVSRYkMDkU+cPItMOdlUA0b5zVO86fkPGgzbM6N/pM3PBBqommYKySGCmw/1z0BzcoPANR0ZhVPqJiCGes+pycaAEqN0PXRTQhvpRlr0FJ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52fc616a-854c-44f9-27d1-08d92da1d6a3 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2021 12:58:56.5946 (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: 3bBYXcqbzytoPTnUOvBKWHTxHNiSWsY398TwvXA/4THF7bVZmqnFmLp906EkksKpTQnEsOwOKP/DHcVOgbKaCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7285 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Peng Fan The i.MX8MM SoC has dispmix BLK-CTL and vpumix BLK-CTL, so we add that support in this driver. Reviewed-by: Abel Vesa Signed-off-by: Peng Fan --- drivers/soc/imx/Makefile | 2 +- drivers/soc/imx/blk-ctl-imx8mm.c | 139 +++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 drivers/soc/imx/blk-ctl-imx8mm.c -- 2.30.0 diff --git a/drivers/soc/imx/Makefile b/drivers/soc/imx/Makefile index d3d2b49a386c..c260b962f495 100644 --- a/drivers/soc/imx/Makefile +++ b/drivers/soc/imx/Makefile @@ -4,4 +4,4 @@ obj-$(CONFIG_ARCH_MXC) += soc-imx.o endif obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o -obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o blk-ctl.o +obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o blk-ctl.o blk-ctl-imx8mm.o diff --git a/drivers/soc/imx/blk-ctl-imx8mm.c b/drivers/soc/imx/blk-ctl-imx8mm.c new file mode 100644 index 000000000000..59443588f892 --- /dev/null +++ b/drivers/soc/imx/blk-ctl-imx8mm.c @@ -0,0 +1,139 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2021 NXP + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "blk-ctl.h" + +#define MEDIA_BLK_BUS_RSTN_BLK_SYNC_SFT_EN BIT(6) +#define MEDIA_BLK_MIPI_DSI_I_PRESETN_SFT_EN BIT(5) +#define MEDIA_BLK_MIPI_CSI_I_PRESETN_SFT_EN BIT(4) +#define MEDIA_BLK_CAMERA_PIXEL_RESET_N_SFT_EN BIT(3) +#define MEDIA_BLK_CSI_BRIDGE_SFT_EN GENMASK(2, 0) + +#define MEDIA_BLK_BUS_PD_MASK BIT(12) +#define MEDIA_BLK_MIPI_CSI_PD_MASK GENMASK(11, 10) +#define MEDIA_BLK_MIPI_DSI_PD_MASK GENMASK(9, 8) +#define MEDIA_BLK_LCDIF_PD_MASK GENMASK(7, 6) +#define MEDIA_BLK_CSI_BRIDGE_PD_MASK GENMASK(5, 0) + +static struct imx_blk_ctl_hw imx8mm_dispmix_blk_ctl_pds[] = { + IMX_BLK_CTL_PD("CSI_BRIDGE", NULL, IMX8MM_BLK_CTL_PD_DISPMIX_CSI_BRIDGE, 0x4, + MEDIA_BLK_CSI_BRIDGE_PD_MASK, 0, MEDIA_BLK_CSI_BRIDGE_SFT_EN, + IMX_BLK_CTL_PD_RESET), + IMX_BLK_CTL_PD("LCDIF", NULL, IMX8MM_BLK_CTL_PD_DISPMIX_LCDIF, 0x4, + MEDIA_BLK_LCDIF_PD_MASK, -1, -1, 0), + IMX_BLK_CTL_PD("MIPI_DSI", "mipi", IMX8MM_BLK_CTL_PD_DISPMIX_MIPI_DSI, 0x4, + MEDIA_BLK_MIPI_DSI_PD_MASK, 0, MEDIA_BLK_MIPI_DSI_I_PRESETN_SFT_EN, + IMX_BLK_CTL_PD_RESET), + IMX_BLK_CTL_PD("MIPI_CSI", "mipi", IMX8MM_BLK_CTL_PD_DISPMIX_MIPI_CSI, 0x4, + MEDIA_BLK_MIPI_CSI_PD_MASK, 0, + MEDIA_BLK_MIPI_CSI_I_PRESETN_SFT_EN | MEDIA_BLK_CAMERA_PIXEL_RESET_N_SFT_EN, + IMX_BLK_CTL_PD_RESET), + IMX_BLK_CTL_PD("DISPMIX_BUS", "dispmix", IMX8MM_BLK_CTL_PD_DISPMIX_BUS, 0x4, + MEDIA_BLK_BUS_PD_MASK, 0, MEDIA_BLK_BUS_RSTN_BLK_SYNC_SFT_EN, + IMX_BLK_CTL_PD_HANDSHAKE | IMX_BLK_CTL_PD_RESET) +}; + +static struct imx_blk_ctl_hw imx8mm_vpumix_blk_ctl_pds[] = { + IMX_BLK_CTL_PD("VPU_BLK_CTL_G2", "vpu-g2", IMX8MM_BLK_CTL_PD_VPU_G2, 0x4, + BIT(0), 0, BIT(0), IMX_BLK_CTL_PD_RESET), + IMX_BLK_CTL_PD("VPU_BLK_CTL_G1", "vpu-g1", IMX8MM_BLK_CTL_PD_VPU_G1, 0x4, + BIT(1), 0, BIT(1), IMX_BLK_CTL_PD_RESET), + IMX_BLK_CTL_PD("VPU_BLK_CTL_H1", "vpu-h1", IMX8MM_BLK_CTL_PD_VPU_H1, 0x4, + BIT(2), 0, BIT(2), IMX_BLK_CTL_PD_RESET), + IMX_BLK_CTL_PD("VPU_BLK_CTL_BUS", "vpumix", IMX8MM_BLK_CTL_PD_VPU_BUS, 0x4, + BIT(2), 0, BIT(2), IMX_BLK_CTL_PD_HANDSHAKE | IMX_BLK_CTL_PD_RESET) +}; + +static const struct regmap_config imx8mm_blk_ctl_regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .max_register = 0x30, + .fast_io = true, +}; + +static const struct imx_blk_ctl_dev_data imx8mm_vpumix_blk_ctl_dev_data = { + .pds = imx8mm_vpumix_blk_ctl_pds, + .pds_num = ARRAY_SIZE(imx8mm_vpumix_blk_ctl_pds), + .max_num = IMX8MM_BLK_CTL_PD_VPU_MAX, + .hw_hsk = &imx8mm_vpumix_blk_ctl_pds[3], + .config = imx8mm_blk_ctl_regmap_config, + .name = "imx-vpumix-blk-ctl", +}; + +static const struct imx_blk_ctl_dev_data imx8mm_dispmix_blk_ctl_dev_data = { + .pds = imx8mm_dispmix_blk_ctl_pds, + .pds_num = ARRAY_SIZE(imx8mm_dispmix_blk_ctl_pds), + .max_num = IMX8MM_BLK_CTL_PD_DISPMIX_MAX, + .hw_hsk = &imx8mm_dispmix_blk_ctl_pds[4], + .config = imx8mm_blk_ctl_regmap_config, + .name = "imx-dispmix-blk-ctl", +}; + +static int imx8mm_blk_ctl_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + const struct imx_blk_ctl_dev_data *dev_data = of_device_get_match_data(dev); + struct regmap *regmap; + struct imx_blk_ctl *ctl; + void __iomem *base; + + ctl = devm_kzalloc(dev, sizeof(*ctl), GFP_KERNEL); + if (!ctl) + return -ENOMEM; + + base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); + + regmap = devm_regmap_init_mmio(dev, base, &dev_data->config); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + ctl->regmap = regmap; + ctl->dev = dev; + mutex_init(&ctl->lock); + + ctl->num_clks = devm_clk_bulk_get_all(dev, &ctl->clks); + if (ctl->num_clks < 0) + return ctl->num_clks; + + dev_set_drvdata(dev, ctl); + ctl->dev_data = dev_data; + + return imx_blk_ctl_register(dev); +} + +static const struct of_device_id imx_blk_ctl_of_match[] = { + { .compatible = "fsl,imx8mm-vpumix-blk-ctl", .data = &imx8mm_vpumix_blk_ctl_dev_data }, + { .compatible = "fsl,imx8mm-dispmix-blk-ctl", .data = &imx8mm_dispmix_blk_ctl_dev_data }, + { /* Sentinel */ } +}; +MODULE_DEVICE_TABLE(of, imx_blk_ctl_of_match); + +static struct platform_driver imx_blk_ctl_driver = { + .probe = imx8mm_blk_ctl_probe, + .driver = { + .name = "imx8mm-blk-ctl", + .of_match_table = of_match_ptr(imx_blk_ctl_of_match), + .pm = &imx_blk_ctl_pm_ops, + }, +}; +module_platform_driver(imx_blk_ctl_driver);