From: Marek Vasut <marex@denx.de>
To: linux-arm-kernel@lists.infradead.org
Cc: "Marek Vasut" <marex@denx.de>,
"Dong Aisheng" <aisheng.dong@nxp.com>,
"Abel Vesa" <abel.vesa@nxp.com>,
"Shawn Guo" <shawnguo@kernel.org>,
"Guido Günther" <agx@sigxcpu.org>,
"NXP Linux Team" <linux-imx@nxp.com>,
"Fabio Estevam" <festevam@gmail.com>,
"Lucas Stach" <l.stach@pengutronix.de>
Subject: [PATCH 5/5] clk: imx: Add blk-ctl driver for i.MX8MM
Date: Sun, 4 Oct 2020 00:45:55 +0200 [thread overview]
Message-ID: <20201003224555.163780-5-marex@denx.de> (raw)
In-Reply-To: <20201003224555.163780-1-marex@denx.de>
The i.MX8MM platform also has a BLK_CTL, however it is not documented
in the documentation at all. Enable the generic blk_ctl driver so the
IP can be controlled the same way as on MX8MP, and add the clock and
reset entries for MX8MM.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Abel Vesa <abel.vesa@nxp.com>
Cc: Dong Aisheng <aisheng.dong@nxp.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Guido Günther <agx@sigxcpu.org>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: Shawn Guo <shawnguo@kernel.org>
---
drivers/clk/imx/Makefile | 2 +-
drivers/clk/imx/clk-blk-ctl-imx8mm.c | 66 ++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 1 deletion(-)
create mode 100644 drivers/clk/imx/clk-blk-ctl-imx8mm.c
diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile
index 6e70e6821727..5e7cc7ec29b6 100644
--- a/drivers/clk/imx/Makefile
+++ b/drivers/clk/imx/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_MXC_CLK_SCU) += \
clk-scu.o \
clk-lpcg-scu.o
-obj-$(CONFIG_CLK_IMX8MM) += clk-imx8mm.o
+obj-$(CONFIG_CLK_IMX8MM) += clk-imx8mm.o clk-blk-ctl.o clk-blk-ctl-imx8mm.o
obj-$(CONFIG_CLK_IMX8MN) += clk-imx8mn.o
obj-$(CONFIG_CLK_IMX8MP) += clk-imx8mp.o clk-blk-ctl.o clk-blk-ctl-imx8mp.o
obj-$(CONFIG_CLK_IMX8MQ) += clk-imx8mq.o
diff --git a/drivers/clk/imx/clk-blk-ctl-imx8mm.c b/drivers/clk/imx/clk-blk-ctl-imx8mm.c
new file mode 100644
index 000000000000..6a60747bfd07
--- /dev/null
+++ b/drivers/clk/imx/clk-blk-ctl-imx8mm.c
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Marek Vasut <marex@denx.de>
+ */
+
+#include <dt-bindings/clock/imx8mm-clock.h>
+#include <dt-bindings/reset/imx8mm-reset.h>
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+
+#include "clk.h"
+#include "clk-blk-ctl.h"
+
+#define IMX_MEDIA_BLK_CTL_SFT_RSTN 0x0
+#define IMX_MEDIA_BLK_CTL_CLK_EN 0x4
+#define IMX_MEDIA_BLK_CTL_MIPI_RST 0x8
+
+static struct imx_blk_ctl_hw imx8mm_dispmix_blk_ctl_hws[] = {
+ /* clocks */
+ IMX_BLK_CTL_CLK_GATE("lcdif_apb_clk", IMX8MM_CLK_MEDIA_BLK_CTL_LCDIF_APB, 0x4, 6, "disp_apb"),
+ IMX_BLK_CTL_CLK_GATE("lcdif_pixel_clk", IMX8MM_CLK_MEDIA_BLK_CTL_LCDIF_PIXEL, 0x4, 7, "lcdif_pixel"),
+ IMX_BLK_CTL_CLK_GATE("mipi_dsi_pclk", IMX8MM_CLK_MEDIA_BLK_CTL_MIPI_DSI_PCLK, 0x4, 8, "dsi_core"),
+ IMX_BLK_CTL_CLK_GATE("mipi_dsi_clkref", IMX8MM_CLK_MEDIA_BLK_CTL_MIPI_DSI_CLKREF, 0x4, 9, "dsi_phy_ref"),
+
+ /* resets */
+ IMX_BLK_CTL_RESET(IMX8MM_MEDIA_BLK_CTL_RESET_MIPI_DSI_I_PRESET, 0x0, 5),
+ IMX_BLK_CTL_RESET(IMX8MM_MEDIA_BLK_CTL_RESET_MIPI_M_RESET, 0x8, 17),
+};
+
+const struct imx_blk_ctl_dev_data imx8mm_dispmix_blk_ctl_dev_data __initconst = {
+ .hws = imx8mm_dispmix_blk_ctl_hws,
+ .hws_num = ARRAY_SIZE(imx8mm_dispmix_blk_ctl_hws),
+ .clocks_max = IMX8MM_CLK_MEDIA_BLK_CTL_END,
+ .resets_max = IMX8MM_MEDIA_BLK_CTL_RESET_NUM,
+ .pm_runtime_saved_regs_num = 3,
+ .pm_runtime_saved_regs = {
+ IMX_MEDIA_BLK_CTL_SFT_RSTN,
+ IMX_MEDIA_BLK_CTL_CLK_EN,
+ IMX_MEDIA_BLK_CTL_MIPI_RST,
+ },
+};
+
+static const struct of_device_id imx_blk_ctl_of_match[] = {
+ {
+ .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 = imx_blk_ctl_probe,
+ .driver = {
+ .name = "imx-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);
--
2.28.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-10-04 5:54 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-03 22:45 [PATCH 1/5] Documentation: bindings: clk: Add bindings for i.MX8MM BLK_CTL Marek Vasut
2020-10-03 22:45 ` [PATCH 2/5] dt-bindings: clock: imx8mm: Add media blk_ctl clock IDs Marek Vasut
2020-10-06 21:12 ` Rob Herring
2020-10-03 22:45 ` [PATCH 3/5] dt-bindings: reset: imx8mm: Add media blk_ctl reset IDs Marek Vasut
2020-10-06 21:12 ` Rob Herring
2020-10-03 22:45 ` [PATCH 4/5] clk: imx: Fix rewriting of hws by resets in generic blk-ctl driver Marek Vasut
2020-10-03 22:45 ` Marek Vasut [this message]
2020-10-06 21:12 ` [PATCH 1/5] Documentation: bindings: clk: Add bindings for i.MX8MM BLK_CTL Rob Herring
2020-10-07 19:52 ` Adam Ford
2020-10-07 20:01 ` Marek Vasut
2020-10-07 20:08 ` Adam Ford
2020-10-07 20:17 ` Adam Ford
2020-10-07 20:50 ` Marek Vasut
2020-11-30 11:47 ` Frieder Schrempf
2020-11-30 15:43 ` Adam Ford
2020-12-10 15:14 ` Frieder Schrempf
2020-12-16 21:24 ` Tim Harvey
2020-12-22 9:07 ` Frieder Schrempf
2021-02-04 12:46 ` Adam Ford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201003224555.163780-5-marex@denx.de \
--to=marex@denx.de \
--cc=abel.vesa@nxp.com \
--cc=agx@sigxcpu.org \
--cc=aisheng.dong@nxp.com \
--cc=festevam@gmail.com \
--cc=l.stach@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).