Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4761506pxb; Tue, 25 Jan 2022 18:50:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMwYosAodBBAurtSVzBbYicLtAJfDaGqpi+/ovJmpD5JzSDxT1aaaVlr7+7oboL0EwPXyT X-Received: by 2002:a63:85c1:: with SMTP id u184mr17014736pgd.434.1643165454921; Tue, 25 Jan 2022 18:50:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643165454; cv=none; d=google.com; s=arc-20160816; b=tvA2MtJLrU50hxS6gvOfdvjerjFJR3QL30DQKOADa/oZo46EC3UdYVdCRGwMgYlnpS BWi3NYAYWUYKKfL6TIc4BRjSr6XhkvKRiYTlzW+s098VhChlCnHGtubGd9JRHl1+iXOi ht3u8FWIsbAqHQVG1mB9h97MtBH2V5iOT7ZRxMoN9hgwe6g+wixX3rnRf4ynhyvum+a1 nWfr/4yom1JafXEYEOd0f8uE3BrljFWDs/eJ386sGdJo9rOPf2Q/OMcl2lmh8U494DZV l9fBNa2kM6C3hCly/JCCiTa2ND57822EZsH3Cq2GSW3hhDDJEDfyZw5SC2w+U1NT40oU PI8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iSXId6wFOcwUDpkasr+brcXkI4I0RStdwVThOM4wpW8=; b=x7g1NpIy1hls7YHiuMHLm+bYdDnQxvrH6UFBB6hOpM7/7QlwYJ1ZIu4105FwmCdM++ EXEZv9//zjeFmUeeDIww+CQffMEvOAziaGnCvbmOq6/TKXd5pG+N/FMy0YM5CjIyaoC2 PH2w5PN4DDkdkicX7/w8EQXurQMUkzDGxd5C47LL4MzM9STeT80A9zbCpk5Ks88KItVE dG0UhcQ8rxb2GoeH1lR5cLBu3r7tHhYXREc+2FdpMpZTRqsllLKQeMNrsjQsyUzXMAwv U1t2fYcR2oeT1NzAdyJGWUXZTd2fkUtg77NHwyHKi6dPN4cUG2pSCj5kQx+ba/NFPX9N kERQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jvq2weiH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qe11si1924972pjb.63.2022.01.25.18.50.33; Tue, 25 Jan 2022 18:50:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@gmail.com header.s=20210112 header.b=jvq2weiH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380682AbiAYRQx (ORCPT + 99 others); Tue, 25 Jan 2022 12:16:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239868AbiAYRNl (ORCPT ); Tue, 25 Jan 2022 12:13:41 -0500 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 078DBC061762; Tue, 25 Jan 2022 09:12:33 -0800 (PST) Received: by mail-io1-xd2a.google.com with SMTP id q204so9923724iod.8; Tue, 25 Jan 2022 09:12:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iSXId6wFOcwUDpkasr+brcXkI4I0RStdwVThOM4wpW8=; b=jvq2weiHDbFCUevkgkPdczmPL6fzlcvMzmh2jrJxpO/Sdv/oZE+g/WRBe1lnOJocOm tQLZPZixBcvXD0jCsCWL6biJJCwl6CvZXd+2LDUGL86ovKzrInyjzFQxNf3cMz2OA+hD lsHkJcwXC1i17yZbqBNNJ6sjklScgpwu3sxwUeGKmRFoWknqgzm8n3jYwqBxSyqTQ5dd q471L0yA+NFzaNE7ZxvzPD4CAosyYbL2jrmUoXCRgRuGcPFM1VV28ALhZGro+uXHI6H8 4+S3FaiPs3k7fMEp90QkIDWfVQlGI/mdOjFotVKJtOE1sfww9rhpTmh9vlrXjy38Vsp4 u/kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iSXId6wFOcwUDpkasr+brcXkI4I0RStdwVThOM4wpW8=; b=HX09jPySTeTTvT1r/pjfPWYChs95o2/W+LfGXs0ulbzYZWl+Xr7FeQd50nPRmUlkZO 8+doHMBcF5cbM2ay4D2cnBjb8DILPiqqcKe5fywadlfGaG0iiFBgB5VmQj8wkYUW+BhW +sxX0fTZ2tpD1Ntuhmqf36Yu/v04x+Dy9R2pCiIleIVjevkRAPwnRZKPVwN1hidBmfLZ G3j+EJeJEgdcXKVDeezsJM0SEpO4/xLbEhQsmLtnox8Ul4FNj5Q2R/CJ7CpA7xqYwaqL 9G2U4fsLFrGxz+5aAkQV85bx+42CduMfFSIpRXHlwCnfypOGSsXLL8tCMOch/YnEbWXM +6/A== X-Gm-Message-State: AOAM5317QN9FR2Fgqr5B8p+C+QrUMVE5G5ore2UcN1rK2DPrkD0rU22D AVO2QcLjOnM1/FczTp3ztwO5gIwm9q0= X-Received: by 2002:a05:6638:761:: with SMTP id y1mr10429953jad.240.1643130751936; Tue, 25 Jan 2022 09:12:31 -0800 (PST) Received: from aford-IdeaCentre-A730.lan ([2601:448:8400:9e8:6592:b6fe:71b1:9f4c]) by smtp.gmail.com with ESMTPSA id m14sm8090291iov.0.2022.01.25.09.12.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jan 2022 09:12:31 -0800 (PST) From: Adam Ford To: linux-media@vger.kernel.org Cc: aford@beaconembedded.com, cphealy@gmail.com, Lucas Stach , Adam Ford , Ezequiel Garcia , Philipp Zabel , Mauro Carvalho Chehab , Rob Herring , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Greg Kroah-Hartman , linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH V4 04/11] soc: imx: imx8m-blk-ctrl: add i.MX8MQ VPU blk-ctrl Date: Tue, 25 Jan 2022 11:11:21 -0600 Message-Id: <20220125171129.472775-5-aford173@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220125171129.472775-1-aford173@gmail.com> References: <20220125171129.472775-1-aford173@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lucas Stach This adds the necessary bits to drive the VPU blk-ctrl on the i.MX8MQ, to avoid putting more of this functionality into the decoder driver. Signed-off-by: Lucas Stach Signed-off-by: Adam Ford diff --git a/drivers/soc/imx/imx8m-blk-ctrl.c b/drivers/soc/imx/imx8m-blk-ctrl.c index 511e74f0db8a..122f9c884b38 100644 --- a/drivers/soc/imx/imx8m-blk-ctrl.c +++ b/drivers/soc/imx/imx8m-blk-ctrl.c @@ -15,6 +15,7 @@ #include #include +#include #define BLK_SFT_RSTN 0x0 #define BLK_CLK_EN 0x4 @@ -589,6 +590,68 @@ static const struct imx8m_blk_ctrl_data imx8mn_disp_blk_ctl_dev_data = { .num_domains = ARRAY_SIZE(imx8mn_disp_blk_ctl_domain_data), }; +static int imx8mq_vpu_power_notifier(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct imx8m_blk_ctrl *bc = container_of(nb, struct imx8m_blk_ctrl, + power_nb); + + if (action != GENPD_NOTIFY_ON && action != GENPD_NOTIFY_PRE_OFF) + return NOTIFY_OK; + + /* + * The ADB in the VPUMIX domain has no separate reset and clock + * enable bits, but is ungated and reset together with the VPUs. The + * reset and clock enable inputs to the ADB is a logical OR of the + * VPU bits. In order to set the G2 fuse bits, the G2 clock must + * also be enabled. + */ + regmap_set_bits(bc->regmap, BLK_SFT_RSTN, BIT(0) | BIT(1)); + regmap_set_bits(bc->regmap, BLK_CLK_EN, BIT(0) | BIT(1)); + + if (action == GENPD_NOTIFY_ON) { + /* + * On power up we have no software backchannel to the GPC to + * wait for the ADB handshake to happen, so we just delay for a + * bit. On power down the GPC driver waits for the handshake. + */ + udelay(5); + + /* set "fuse" bits to enable the VPUs */ + regmap_set_bits(bc->regmap, 0x8, 0xffffffff); + regmap_set_bits(bc->regmap, 0xc, 0xffffffff); + regmap_set_bits(bc->regmap, 0x10, 0xffffffff); + } + + return NOTIFY_OK; +} + +static const struct imx8m_blk_ctrl_domain_data imx8mq_vpu_blk_ctl_domain_data[] = { + [IMX8MQ_VPUBLK_PD_G1] = { + .name = "vpublk-g1", + .clk_names = (const char *[]){ "g1", }, + .num_clks = 1, + .gpc_name = "g1", + .rst_mask = BIT(1), + .clk_mask = BIT(1), + }, + [IMX8MQ_VPUBLK_PD_G2] = { + .name = "vpublk-g2", + .clk_names = (const char *[]){ "g2", }, + .num_clks = 1, + .gpc_name = "g2", + .rst_mask = BIT(0), + .clk_mask = BIT(0), + }, +}; + +static const struct imx8m_blk_ctrl_data imx8mq_vpu_blk_ctl_dev_data = { + .max_reg = 0x14, + .power_notifier_fn = imx8mq_vpu_power_notifier, + .domains = imx8mq_vpu_blk_ctl_domain_data, + .num_domains = ARRAY_SIZE(imx8mq_vpu_blk_ctl_domain_data), +}; + static const struct of_device_id imx8m_blk_ctrl_of_match[] = { { .compatible = "fsl,imx8mm-vpu-blk-ctrl", @@ -599,6 +662,9 @@ static const struct of_device_id imx8m_blk_ctrl_of_match[] = { }, { .compatible = "fsl,imx8mn-disp-blk-ctrl", .data = &imx8mn_disp_blk_ctl_dev_data + }, { + .compatible = "fsl,imx8mq-vpu-blk-ctrl", + .data = &imx8mq_vpu_blk_ctl_dev_data }, { /* Sentinel */ } -- 2.32.0