From patchwork Wed Oct 6 00:05:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 12538237 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1D73C433EF for ; Wed, 6 Oct 2021 00:07:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 69C1261175 for ; Wed, 6 Oct 2021 00:07:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 69C1261175 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IiIzcrts7UWdMW0iVDMa9OGjN8wtIIkkGrdHXy8lk98=; b=vHSybkjCRJH7KE zac8V50IZr0s3wUY/wENZlV4BQgjjfcu/28gl9gUwOf88u376JPYxKrHIWhfh8IKhshd8IiB8sszz 1+UcBa1UUsVNue5j23khNvNzqTrv9FGIJXMdpxX8mPvvbzh88dcIpdDXG46+NUN8wGKbAb6Lz7gGT peteeZnlIpLOJQcB1pwoUTqCTHHXOGULV3qQMxyWfpzBV9KXoCUgla/ktABxYLZM07HaPc717zqSZ yEYooa0qMMFgim3Fg4kwq0SoR1yTsBwX/s6ZvHhc9PquC4pOhgP50nAN3foHz7FJDQ8N9tkTvpBHQ koJeEE87ARukVehtuhug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXuRR-00CLL0-By; Wed, 06 Oct 2021 00:05:49 +0000 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXuR2-00CLD4-4K for linux-arm-kernel@lists.infradead.org; Wed, 06 Oct 2021 00:05:25 +0000 Received: by mail-il1-x12c.google.com with SMTP id l13so1100921ilo.3 for ; Tue, 05 Oct 2021 17:05:23 -0700 (PDT) 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=akNDEe+kJOl28ay+y5Gnkbqr2EBbo/gtcDP1PA6ZmAo=; b=dezX+RhlSeS7JzthKehV0pZYqy9zHkI0EbuQRQbHoOKuQ3+JYiPWJVntXtZ1K0ESPT FOQMOKPk3aryIvRUHhKQFd2PElQhdmj5rcCRsr23N3NP99+66NIFI0qPbF+cXBhaecwS 5omRvtmqraYsbGBEo2hGf/ASjHhJ8Xoa1C2SLZSiJhITTSBeUNgjlqdzS4v6jtsWV3dg tzLj41VMY1P+Qz8e8einbXLixHG5GjhPfUYFk+pnoy1YGrQq9dL+S7aQUKj5RI01KJgq RJG6hKuGLafxjYLSgj6SURNNm4cCu66yb6uGcOaRadjnx0XjmQ0373pcDisQeAVQ/ZKL kF6g== 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=akNDEe+kJOl28ay+y5Gnkbqr2EBbo/gtcDP1PA6ZmAo=; b=vu43mz1cecakIY/qhnvLsZDxdl8a4gtk295QHNkw5TiYJ5YsZfnTreDeyk6nttSmKs CdpZdNQ2/hVP2KPNZ3ISR5b3NltHFsw9IAIAdDtzSh64N4rYjIHzkAgnj1GgpQ1Q4h5u Q8WKbTDzZhA5KaXeLdolXop8fqvcoloTafYeDjbwVklGGgZ+Xp9EcKOvGudEubLPvcKt T7+pAP84nR+IzHzP9rUFRUpFvWKulHVG/F/1mf4b6C9WlmhdMX9ZSQf0dkaF5qmRYioa 4c9xbtkiLhRxrE+T7LyENkG296L4ltd1J6qAK5KimmJoTjwgyhwW9FGrZsfs5RgRTdGt 859w== X-Gm-Message-State: AOAM532AgGejgdMqcsU3lbb3zLAjkpeZcZSnHas8d/0jMRhnk9QA27tl 8PUGtq6epqCdZrrPNM2TRBWXyvLpRv0= X-Google-Smtp-Source: ABdhPJz9NzE0MxRp7tokSSNfE0HMMX9kyD6FZUznh+ikcZtyTem0x8X1s+RfK19RaVablqOiHuW2zw== X-Received: by 2002:a05:6e02:893:: with SMTP id z19mr5013863ils.224.1633478722865; Tue, 05 Oct 2021 17:05:22 -0700 (PDT) Received: from aford-IdeaCentre-A730.lan ([2601:448:8400:9e8:94fc:9a4b:2e18:e915]) by smtp.gmail.com with ESMTPSA id y2sm11338646ioj.12.2021.10.05.17.05.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 17:05:22 -0700 (PDT) From: Adam Ford To: linux-arm-kernel@lists.infradead.org Cc: aford@beaconembedded.com, Adam Ford , Rob Herring , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Lucas Stach , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] soc: imx: imx8m-blk-ctrl: add i.MX8MN DISP blk-ctrl Date: Tue, 5 Oct 2021 19:05:00 -0500 Message-Id: <20211006000505.627334-3-aford173@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211006000505.627334-1-aford173@gmail.com> References: <20211006000505.627334-1-aford173@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211005_170524_198039_B18E8D10 X-CRM114-Status: GOOD ( 17.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This adds the description for the i.MX8MN disp blk-ctrl. Signed-off-by: Adam Ford --- drivers/soc/imx/imx8m-blk-ctrl.c | 70 ++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/drivers/soc/imx/imx8m-blk-ctrl.c b/drivers/soc/imx/imx8m-blk-ctrl.c index e172d295c441..8fcd5ed62f50 100644 --- a/drivers/soc/imx/imx8m-blk-ctrl.c +++ b/drivers/soc/imx/imx8m-blk-ctrl.c @@ -14,6 +14,7 @@ #include #include +#include #define BLK_SFT_RSTN 0x0 #define BLK_CLK_EN 0x4 @@ -498,6 +499,75 @@ static const struct imx8m_blk_ctrl_data imx8mm_disp_blk_ctl_dev_data = { .num_domains = ARRAY_SIZE(imx8mm_disp_blk_ctl_domain_data), }; + +static int imx8mn_disp_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; + + /* Enable bus clock and deassert bus reset */ + regmap_set_bits(bc->regmap, BLK_CLK_EN, BIT(8)); + regmap_set_bits(bc->regmap, BLK_SFT_RSTN, BIT(8)); + + /* + * 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. + */ + if (action == GENPD_NOTIFY_ON) + udelay(5); + + + return NOTIFY_OK; +} + +static const struct imx8m_blk_ctrl_domain_data imx8mn_disp_blk_ctl_domain_data[] = { + [IMX8MN_DISPBLK_PD_MIPI_DSI] = { + .name = "dispblk-mipi-dsi", + .clk_names = (const char *[]){ "dsi-pclk", "dsi-ref", }, + .num_clks = 2, + .gpc_name = "mipi-dsi", + .rst_mask = BIT(0) | BIT(1), + .clk_mask = BIT(0) | BIT(1), + }, + [IMX8MN_DISPBLK_PD_MIPI_CSI] = { + .name = "dispblk-mipi-csi", + .clk_names = (const char *[]){ "csi-aclk", "csi-pclk" }, + .num_clks = 2, + .gpc_name = "mipi-csi", + .rst_mask = BIT(2) | BIT(3), + .clk_mask = BIT(2) | BIT(3), + }, + [IMX8MN_DISPBLK_PD_LCDIF] = { + .name = "dispblk-lcdif", + .clk_names = (const char *[]){ "lcdif-axi", "lcdif-apb", "lcdif-pix", }, + .num_clks = 3, + .gpc_name = "lcdif", + .rst_mask = BIT(4) | BIT(5), + .clk_mask = BIT(4) | BIT(5), + }, + [IMX8MN_DISPBLK_PD_ISI] = { + .name = "dispblk-isi", + .clk_names = (const char *[]){ "disp_axi", "disp_apb", "disp_axi_root", + "disp_apb_root"}, + .num_clks = 2, + .gpc_name = "isi", + .rst_mask = BIT(6) | BIT(7), + .clk_mask = BIT(6) | BIT(7), + }, +}; + +static const struct imx8m_blk_ctrl_data imx8mn_disp_blk_ctl_dev_data = { + .max_reg = 0x84, + .power_notifier_fn = imx8mn_disp_power_notifier, + .domains = imx8mn_disp_blk_ctl_domain_data, + .num_domains = ARRAY_SIZE(imx8mn_disp_blk_ctl_domain_data), +}; + static const struct of_device_id imx8m_blk_ctrl_of_match[] = { { .compatible = "fsl,imx8mm-vpu-blk-ctrl",