From patchwork Wed Dec 15 00:46:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 12696136 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2E4C9C433EF for ; Wed, 15 Dec 2021 00:49:08 +0000 (UTC) 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=H/p8QEV+Yu3wbV4OWxzbBNdo46u4TlGroyyRD1i8pD0=; b=a6cpJesemwzdLO rl7oQDcuYS97WDP1HaVvriY4+jUb8XJJic8cG38VcvzHSa17pK+yxnz8v3HFwNh0Cvee/YCZGzAeB 6z+bQjnUn7WtwEeGQuWmERCfEP8ItjvTuUd/Lm5P+ZZcyL3CqIKKtihX5/zFWxlYR+WBRa6lDglt8 Rdw6bAmJKZ6i6ETeTgkRhdugq9XvYRVuj4NXsV/qkA0NDEdwYRfkprCUfzb+rjK6QiVPcpJ86HVWH BMkpTFYK+O6TwClm6Fz/vlTfgi5SI5pARyWR1D2vhl8S48lc4M/iwFcV/Jsp+lV6qc4FcTbilGkug Ws4+9bVMVex9v7oHCFKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxISI-00G9sg-PF; Wed, 15 Dec 2021 00:47:39 +0000 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxIRV-00G9g7-Jt for linux-arm-kernel@lists.infradead.org; Wed, 15 Dec 2021 00:46:51 +0000 Received: by mail-io1-xd2c.google.com with SMTP id x10so27343529ioj.9 for ; Tue, 14 Dec 2021 16:46:49 -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=jyQwYfGkQ8cnhxcnBRBIiFiQQ6uqIZv5tFNwIu243ek=; b=q3axeGrkZpJt7GmwxMn/RktTXym/WMql11C2mkwxfLGSnheGNU+0p84Sr2Sc4J5Hir 6gIQQjd8GwxUGV6RXmVwE7hLsPVLoxaf20zciJQJ6I9aOia9cwjkkIu6psK7G9NA6kOS 5/gG3NMl8smNb1ainbLUEbLoEpSy03klyqVDUnw0qajde1Nh2vf25z57U07pwnlJGIvk NK9st6NoR+EFyfwvRboKZ/LBSLmI+sAt3QjVrvVz7jV5WBcgWk28DeaVsheI1VgWdW90 EZkWWsh2PfygXa2WKTJ9TODZVI1R2jo6RZkU242qVU+KZmfgx/S/aLOguxSAYMwEJj8R 8B4A== 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=jyQwYfGkQ8cnhxcnBRBIiFiQQ6uqIZv5tFNwIu243ek=; b=c+6Q9yCVGvtwVMlbqvRrsMJr+qvxSE0t/Mof7F91Ixbwyld3z97gxcPYNwELyPZWZ2 o493ilNsaml7f8u99xdNoJX0xgk66lclNin4YEkS4T9tcmuhh/ffNyTUk0uWxbKQiKLu V90VJZLlr3yW4whxSrRYR4WMeabN9KuV0BIl+msZ9qiCdWvii1Lj3wt3PGS8CP6CljQC gMsggadfIuf+bX1HiE9D+7bMoJB+rU//V4tXfigM4WVmhhg1XfjkBXXJEZFteYzU+VV9 5TC/ShMHR4cwFyAq+DBNcELMVDq5Va6RORz5iNNl8bc5ODRbCd4GFVwyi+hM0RC+7D4V SxCA== X-Gm-Message-State: AOAM533GuVNKMns3dqV+rARe4OyC0yfDnrH0bpn3yw3Nr12da9ON98kW pxCriLJfEQYwC6TQUuibMPv4iGkLwnpKQQ== X-Google-Smtp-Source: ABdhPJznPx6aE9/mE4mECSuNgO6yzS/2SqotAFtixRDe7zxVFUQrQhDLc6JUbcloqz/SxEjwzESVLQ== X-Received: by 2002:a05:6638:11cb:: with SMTP id g11mr4624990jas.139.1639529208227; Tue, 14 Dec 2021 16:46:48 -0800 (PST) Received: from aford-IdeaCentre-A730.lan ([2601:448:8400:9e8:8256:b93c:84fb:458b]) by smtp.gmail.com with ESMTPSA id y8sm218857iox.32.2021.12.14.16.46.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 16:46:47 -0800 (PST) From: Adam Ford To: linux-arm-kernel@lists.infradead.org Cc: tharvey@gateworks.com, aford@beaconembedded.com, michael@amarulasolutions.com, jagan@amarulasolutions.com, Adam Ford , Lucas Stach , Rob Herring , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 5/9] soc: imx: imx8m-blk-ctrl: add i.MX8MN DISP blk-ctrl Date: Tue, 14 Dec 2021 18:46:22 -0600 Message-Id: <20211215004626.2241839-6-aford173@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211215004626.2241839-1-aford173@gmail.com> References: <20211215004626.2241839-1-aford173@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211214_164649_680226_308B840A X-CRM114-Status: GOOD ( 16.29 ) 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 Reviewed-by: Lucas Stach diff --git a/drivers/soc/imx/imx8m-blk-ctrl.c b/drivers/soc/imx/imx8m-blk-ctrl.c index c2f076b56e24..511e74f0db8a 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 @@ -517,6 +518,77 @@ 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), + .mipi_phy_rst_mask = BIT(17), + }, + [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), + .mipi_phy_rst_mask = BIT(16), + }, + [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 = 4, + .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", @@ -524,7 +596,10 @@ static const struct of_device_id imx8m_blk_ctrl_of_match[] = { }, { .compatible = "fsl,imx8mm-disp-blk-ctrl", .data = &imx8mm_disp_blk_ctl_dev_data - } ,{ + }, { + .compatible = "fsl,imx8mn-disp-blk-ctrl", + .data = &imx8mn_disp_blk_ctl_dev_data + }, { /* Sentinel */ } };