LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing
@ 2018-04-23 15:31 Matthias Brugger
  2018-04-23 15:32 ` [v2 01/10] dt-bindings: mediatek: mmsys: Add support for mfd Matthias Brugger
                   ` (10 more replies)
  0 siblings, 11 replies; 14+ messages in thread
From: Matthias Brugger @ 2018-04-23 15:31 UTC (permalink / raw)
  To: ulrich.hecht+renesas, laurent.pinchart, ck.hu, p.zabel, airlied,
	robh+dt, mark.rutland, mturquette, sboyd, lee.jones
  Cc: davem, gregkh, mchehab, rdunlap, pi-cheng.chen, sean.wang,
	linux-clk, linux, matthias.bgg, dri-devel, linux-kernel,
	linux-arm-kernel, linux-mediatek, Matthias Brugger

Changes since v1:
- add binding documentation
- ddp: use regmap_update_bits
- ddp: ignore EPROBE_DEFER on clock probing
- mfd: delete mmsys_private
- add Reviewed-by and Acked-by tags

---

MMSYS in Mediatek SoCs has some registers to control clock gates (which is 
used in the clk driver) and some registers to set the routing and enable
the differnet blocks of the display subsystem.

Up to now both drivers, clock and drm are probed with the same device tree
compatible. But only the first driver get probed, which in effect breaks
graphics on mt8173 and mt2701.

This patch set introduces a new mfd device, which binds against the mmsys
compatible and takes care of probing the needed devices. It was tested on the
bananapi-r2 and the Acer R13 Chromebook.


Matthias Brugger (10):
  dt-bindings: mediatek: mmsys: Add support for mfd
  drm/mediatek: Use regmap for register access
  mfd: mtk-mmsys: Add mmsys driver
  drm/mediatek: mt2701: switch to mfd probing.
  clk: mediatek: mt2701-mm: switch to mfd device
  mfd: mtk-mmsys: Add mt8173 nodes
  drm/mediatek: Add mfd support for mt8173
  clk: mediatek: mt8173-mm: switch to mfd device
  drm: mediatek: Omit warning on probe defers
  MAINTAINERS: update Mediatek Soc entry

 .../bindings/arm/mediatek/mediatek,mmsys.txt       |  2 -
 .../bindings/display/mediatek/mediatek,disp.txt    |  2 +-
 .../devicetree/bindings/mfd/mediatek,mmsys.txt     | 27 +++++++
 MAINTAINERS                                        |  2 +
 drivers/clk/mediatek/clk-mt2701-mm.c               | 10 +--
 drivers/clk/mediatek/clk-mt8173.c                  | 17 +++-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c            |  4 +-
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c             | 41 ++++------
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h             |  4 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c             | 33 ++++----
 drivers/gpu/drm/mediatek/mtk_drm_drv.h             |  2 +-
 drivers/mfd/Kconfig                                |  9 +++
 drivers/mfd/Makefile                               |  2 +
 drivers/mfd/mtk-mmsys.c                            | 93 ++++++++++++++++++++++
 14 files changed, 189 insertions(+), 59 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/mediatek,mmsys.txt
 create mode 100644 drivers/mfd/mtk-mmsys.c

-- 
2.16.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [v2 01/10] dt-bindings: mediatek: mmsys: Add support for mfd
  2018-04-23 15:31 [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Matthias Brugger
@ 2018-04-23 15:32 ` Matthias Brugger
  2018-04-23 15:32 ` [v2 02/10] drm/mediatek: Use regmap for register access Matthias Brugger
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Matthias Brugger @ 2018-04-23 15:32 UTC (permalink / raw)
  To: ulrich.hecht+renesas, laurent.pinchart, ck.hu, p.zabel, airlied,
	robh+dt, mark.rutland, mturquette, sboyd, lee.jones
  Cc: davem, gregkh, mchehab, rdunlap, pi-cheng.chen, sean.wang,
	linux-clk, linux, matthias.bgg, dri-devel, linux-kernel,
	linux-arm-kernel, linux-mediatek, Matthias Brugger

Add binding description for the mmsys mfd for some Mediatek
devices. mmsys has some registers to control clock gates (which is
used in the clk driver) and some registers to set the routing and enable
the differnet blocks of the display subsystem.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
---
 .../bindings/arm/mediatek/mediatek,mmsys.txt       |  2 --
 .../bindings/display/mediatek/mediatek,disp.txt    |  2 +-
 .../devicetree/bindings/mfd/mediatek,mmsys.txt     | 27 ++++++++++++++++++++++
 3 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/mediatek,mmsys.txt

diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
index 4eb8bbe15c01..4468345f8b1a 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
@@ -6,10 +6,8 @@ The Mediatek mmsys controller provides various clocks to the system.
 Required Properties:
 
 - compatible: Should be one of:
-	- "mediatek,mt2701-mmsys", "syscon"
 	- "mediatek,mt2712-mmsys", "syscon"
 	- "mediatek,mt6797-mmsys", "syscon"
-	- "mediatek,mt8173-mmsys", "syscon"
 - #clock-cells: Must be 1
 
 The mmsys controller uses the common clk binding from
diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
index 383183a89164..85a3b4ec06cd 100644
--- a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
+++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
@@ -9,7 +9,7 @@ function block.
 
 All DISP device tree nodes must be siblings to the central MMSYS_CONFIG node.
 For a description of the MMSYS_CONFIG binding, see
-Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt.
+Documentation/devicetree/bindings/mfd/mediatek,mmsys.txt
 
 DISP function blocks
 ====================
diff --git a/Documentation/devicetree/bindings/mfd/mediatek,mmsys.txt b/Documentation/devicetree/bindings/mfd/mediatek,mmsys.txt
new file mode 100644
index 000000000000..2331ae16917e
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/mediatek,mmsys.txt
@@ -0,0 +1,27 @@
+MediaTek MMSYS Multifunction Device Driver
+
+MMSYS is a multifunction device with the following sub modules:
+- clocks for the multi-media subsystem
+- central node for the DRM subsystem.
+
+This document describes the binding for MFD device. The MFD takes care to initailize
+the clock driver and the DRM driver. More info see
+Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
+
+Required properties:
+- compatible: Should be one of:
+	- "mediatek,mt2701-mmsys", "syscon"
+	- "mediatek,mt8173-mmsys", "syscon"
+- #clock-cells: Must be 1
+
+Optional properties:
+- power-domains: list of powerdomains needed for the subsystem to work
+
+Example:
+
+mmsys: clock-controller@14000000 {
+	compatible = "mediatek,mt8173-mmsys", "syscon";
+	reg = <0 0x14000000 0 0x1000>;
+	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
+	#clock-cells = <1>;
+};
-- 
2.16.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [v2 02/10] drm/mediatek: Use regmap for register access
  2018-04-23 15:31 [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Matthias Brugger
  2018-04-23 15:32 ` [v2 01/10] dt-bindings: mediatek: mmsys: Add support for mfd Matthias Brugger
@ 2018-04-23 15:32 ` Matthias Brugger
  2018-04-23 15:32 ` [v2 03/10] mfd: mtk-mmsys: Add mmsys driver Matthias Brugger
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Matthias Brugger @ 2018-04-23 15:32 UTC (permalink / raw)
  To: ulrich.hecht+renesas, laurent.pinchart, ck.hu, p.zabel, airlied,
	robh+dt, mark.rutland, mturquette, sboyd, lee.jones
  Cc: davem, gregkh, mchehab, rdunlap, pi-cheng.chen, sean.wang,
	linux-clk, linux, matthias.bgg, dri-devel, linux-kernel,
	linux-arm-kernel, linux-mediatek, Matthias Brugger

The mmsys memory space is shared between the drm and the
clk driver. Use regmap to access it.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  4 ++--
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 38 +++++++++++++--------------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |  4 ++--
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 13 ++++-------
 drivers/gpu/drm/mediatek/mtk_drm_drv.h  |  2 +-
 5 files changed, 24 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 658b8dd45b83..4c65873b4867 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -33,7 +33,7 @@
  * @enabled: records whether crtc_enable succeeded
  * @planes: array of 4 drm_plane structures, one for each overlay plane
  * @pending_planes: whether any plane has pending changes to be applied
- * @config_regs: memory mapped mmsys configuration register space
+ * @config_regs: regmap mapped mmsys configuration register space
  * @mutex: handle to one of the ten disp_mutex streams
  * @ddp_comp_nr: number of components in ddp_comp
  * @ddp_comp: array of pointers the mtk_ddp_comp structures used by this crtc
@@ -48,7 +48,7 @@ struct mtk_drm_crtc {
 	struct drm_plane		planes[OVL_LAYER_NR];
 	bool				pending_planes;
 
-	void __iomem			*config_regs;
+	struct regmap			*config_regs;
 	struct mtk_disp_mutex		*mutex;
 	unsigned int			ddp_comp_nr;
 	struct mtk_ddp_comp		**ddp_comp;
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 8130f3dab661..bafc5c77c4fb 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -185,53 +185,45 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur,
 	return value;
 }
 
-static void mtk_ddp_sout_sel(void __iomem *config_regs,
+static void mtk_ddp_sout_sel(struct regmap *config_regs,
 			     enum mtk_ddp_comp_id cur,
 			     enum mtk_ddp_comp_id next)
 {
 	if (cur == DDP_COMPONENT_BLS && next == DDP_COMPONENT_DSI0)
-		writel_relaxed(BLS_TO_DSI_RDMA1_TO_DPI1,
-			       config_regs + DISP_REG_CONFIG_OUT_SEL);
+		regmap_write(config_regs, DISP_REG_CONFIG_OUT_SEL,
+				BLS_TO_DSI_RDMA1_TO_DPI1);
 }
 
-void mtk_ddp_add_comp_to_path(void __iomem *config_regs,
+void mtk_ddp_add_comp_to_path(struct regmap *config_regs,
 			      enum mtk_ddp_comp_id cur,
 			      enum mtk_ddp_comp_id next)
 {
-	unsigned int addr, value, reg;
+	unsigned int addr, value;
 
 	value = mtk_ddp_mout_en(cur, next, &addr);
-	if (value) {
-		reg = readl_relaxed(config_regs + addr) | value;
-		writel_relaxed(reg, config_regs + addr);
-	}
+	if (value)
+		regmap_update_bits(config_regs, addr, value, value);
 
 	mtk_ddp_sout_sel(config_regs, cur, next);
 
 	value = mtk_ddp_sel_in(cur, next, &addr);
-	if (value) {
-		reg = readl_relaxed(config_regs + addr) | value;
-		writel_relaxed(reg, config_regs + addr);
-	}
+	if (value)
+		regmap_update_bits(config_regs, addr, value, value);
 }
 
-void mtk_ddp_remove_comp_from_path(void __iomem *config_regs,
+void mtk_ddp_remove_comp_from_path(struct regmap *config_regs,
 				   enum mtk_ddp_comp_id cur,
 				   enum mtk_ddp_comp_id next)
 {
-	unsigned int addr, value, reg;
+	unsigned int addr, value;
 
 	value = mtk_ddp_mout_en(cur, next, &addr);
-	if (value) {
-		reg = readl_relaxed(config_regs + addr) & ~value;
-		writel_relaxed(reg, config_regs + addr);
-	}
+	if (value)
+		regmap_update_bits(config_regs, addr, value, 0);
 
 	value = mtk_ddp_sel_in(cur, next, &addr);
-	if (value) {
-		reg = readl_relaxed(config_regs + addr) & ~value;
-		writel_relaxed(reg, config_regs + addr);
-	}
+	if (value)
+		regmap_update_bits(config_regs, addr, value, 0);
 }
 
 struct mtk_disp_mutex *mtk_disp_mutex_get(struct device *dev, unsigned int id)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp.h
index f9a799168077..32e12f33b76a 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.h
@@ -20,10 +20,10 @@ struct regmap;
 struct device;
 struct mtk_disp_mutex;
 
-void mtk_ddp_add_comp_to_path(void __iomem *config_regs,
+void mtk_ddp_add_comp_to_path(struct regmap *config_regs,
 			      enum mtk_ddp_comp_id cur,
 			      enum mtk_ddp_comp_id next);
-void mtk_ddp_remove_comp_from_path(void __iomem *config_regs,
+void mtk_ddp_remove_comp_from_path(struct regmap *config_regs,
 				   enum mtk_ddp_comp_id cur,
 				   enum mtk_ddp_comp_id next);
 
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index a2ca90fc403c..a48e28adad09 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -21,6 +21,7 @@
 #include <drm/drm_of.h>
 #include <linux/component.h>
 #include <linux/iommu.h>
+#include <linux/mfd/syscon.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
@@ -385,7 +386,6 @@ static int mtk_drm_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct mtk_drm_private *private;
-	struct resource *mem;
 	struct device_node *node;
 	struct component_match *match = NULL;
 	int ret;
@@ -399,14 +399,9 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	INIT_WORK(&private->commit.work, mtk_atomic_work);
 	private->data = of_device_get_match_data(dev);
 
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	private->config_regs = devm_ioremap_resource(dev, mem);
-	if (IS_ERR(private->config_regs)) {
-		ret = PTR_ERR(private->config_regs);
-		dev_err(dev, "Failed to ioremap mmsys-config resource: %d\n",
-			ret);
-		return ret;
-	}
+	private->config_regs = syscon_node_to_regmap(dev->of_node);
+	if (IS_ERR(private->config_regs))
+		return PTR_ERR(private->config_regs);
 
 	/* Iterate over sibling DISP function blocks */
 	for_each_child_of_node(dev->of_node->parent, node) {
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
index c3378c452c0a..c6fa0ad458e8 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
@@ -44,7 +44,7 @@ struct mtk_drm_private {
 
 	struct device_node *mutex_node;
 	struct device *mutex_dev;
-	void __iomem *config_regs;
+	struct regmap *config_regs;
 	struct device_node *comp_node[DDP_COMPONENT_ID_MAX];
 	struct mtk_ddp_comp *ddp_comp[DDP_COMPONENT_ID_MAX];
 	const struct mtk_mmsys_driver_data *data;
-- 
2.16.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [v2 03/10] mfd: mtk-mmsys: Add mmsys driver
  2018-04-23 15:31 [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Matthias Brugger
  2018-04-23 15:32 ` [v2 01/10] dt-bindings: mediatek: mmsys: Add support for mfd Matthias Brugger
  2018-04-23 15:32 ` [v2 02/10] drm/mediatek: Use regmap for register access Matthias Brugger
@ 2018-04-23 15:32 ` Matthias Brugger
  2018-04-23 15:32 ` [v2 05/10] clk: mediatek: mt2701-mm: switch to mfd device Matthias Brugger
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Matthias Brugger @ 2018-04-23 15:32 UTC (permalink / raw)
  To: ulrich.hecht+renesas, laurent.pinchart, ck.hu, p.zabel, airlied,
	robh+dt, mark.rutland, mturquette, sboyd, lee.jones
  Cc: davem, gregkh, mchehab, rdunlap, pi-cheng.chen, sean.wang,
	linux-clk, linux, matthias.bgg, dri-devel, linux-kernel,
	linux-arm-kernel, linux-mediatek, Matthias Brugger

The MMSYS subsystem includes clocks and drm components.
This patch adds a MFD device to probe both drivers from the same
device tree compatible.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
---
 drivers/mfd/Kconfig     |  9 ++++++
 drivers/mfd/Makefile    |  2 ++
 drivers/mfd/mtk-mmsys.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 90 insertions(+)
 create mode 100644 drivers/mfd/mtk-mmsys.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b860eb5aa194..a2c928e26026 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -378,6 +378,15 @@ config MFD_MC13XXX_I2C
 	help
 	  Select this if your MC13xxx is connected via an I2C bus.
 
+config MFD_MEDIATEK_MMSYS
+	tristate "Mediatek MMSYS interface"
+	select MDF_CORE
+	select REGMAP_MMIO
+	help
+	  Select this if you have a MMSYS subsystem in your SoC. The
+	  MMSYS subsystem has at least a clock driver part and some
+	  DRM components.
+
 config MFD_MXS_LRADC
 	tristate "Freescale i.MX23/i.MX28 LRADC"
 	depends on ARCH_MXS || COMPILE_TEST
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index d9d2cf0d32ef..b96118bd68d9 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -98,6 +98,8 @@ obj-$(CONFIG_MFD_MC13XXX)	+= mc13xxx-core.o
 obj-$(CONFIG_MFD_MC13XXX_SPI)	+= mc13xxx-spi.o
 obj-$(CONFIG_MFD_MC13XXX_I2C)	+= mc13xxx-i2c.o
 
+obj-$(CONFIG_MFD_MEDIATEK_MMSYS) += mtk-mmsys.o
+
 obj-$(CONFIG_MFD_CORE)		+= mfd-core.o
 
 obj-$(CONFIG_EZX_PCAP)		+= ezx-pcap.o
diff --git a/drivers/mfd/mtk-mmsys.c b/drivers/mfd/mtk-mmsys.c
new file mode 100644
index 000000000000..c802343fb1c6
--- /dev/null
+++ b/drivers/mfd/mtk-mmsys.c
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/*
+ * mtk-mmsys.c -- Mediatek MMSYS multi-function driver
+ *
+ * Copyright (c) 2018 Matthias Brugger <matthias.bgg@gmail.com>
+ *
+ * Author: Matthias Brugger <matthias.bgg@gmail.com>
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/mfd/core.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+enum {
+	MMSYS_MT2701 = 1,
+};
+
+static const struct mfd_cell mmsys_mt2701_devs[] = {
+	{ .name = "clk-mt2701-mm", },
+	{ .name = "drm-mt2701-mm", },
+};
+
+static int mmsys_probe(struct platform_device *pdev)
+{
+	const struct mfd_cell *mmsys_cells;
+	int nr_cells;
+	long id;
+	int ret;
+
+	id = (long) of_device_get_match_data(&pdev->dev);
+	if (!id) {
+		dev_err(&pdev->dev, "of_device_get match_data() failed\n");
+		return -EINVAL;
+	}
+
+	switch (id) {
+	case MMSYS_MT2701:
+		mmsys_cells = mmsys_mt2701_devs;
+		nr_cells = ARRAY_SIZE(mmsys_mt2701_devs);
+		break;
+	default:
+		return -ENODEV;
+	}
+
+	ret = devm_mfd_add_devices(&pdev->dev, 0, mmsys_cells, nr_cells,
+					NULL, 0, NULL);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to add MFD devices %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+};
+
+static const struct of_device_id of_match_mmsys[] = {
+	{ .compatible = "mediatek,mt2701-mmsys",
+	  .data = (void *) MMSYS_MT2701,
+	},
+	{ /* sentinel */ },
+};
+
+static struct platform_driver mmsys_drv = {
+	.probe = mmsys_probe,
+	.driver = {
+		.name = "mediatek-mmysys",
+		.of_match_table = of_match_ptr(of_match_mmsys),
+	},
+};
+
+builtin_platform_driver(mmsys_drv);
+
+MODULE_DESCRIPTION("Mediatek MMSYS multi-function driver");
+MODULE_LICENSE("GPL");
-- 
2.16.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [v2 05/10] clk: mediatek: mt2701-mm: switch to mfd device
  2018-04-23 15:31 [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Matthias Brugger
                   ` (2 preceding siblings ...)
  2018-04-23 15:32 ` [v2 03/10] mfd: mtk-mmsys: Add mmsys driver Matthias Brugger
@ 2018-04-23 15:32 ` Matthias Brugger
  2018-04-23 15:32 ` [v2 06/10] mfd: mtk-mmsys: Add mt8173 nodes Matthias Brugger
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Matthias Brugger @ 2018-04-23 15:32 UTC (permalink / raw)
  To: ulrich.hecht+renesas, laurent.pinchart, ck.hu, p.zabel, airlied,
	robh+dt, mark.rutland, mturquette, sboyd, lee.jones
  Cc: davem, gregkh, mchehab, rdunlap, pi-cheng.chen, sean.wang,
	linux-clk, linux, matthias.bgg, dri-devel, linux-kernel,
	linux-arm-kernel, linux-mediatek, Matthias Brugger

As the new mfd device is in place, switch probing
for the MMSYS to support invocation from the mfd device.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/clk/mediatek/clk-mt2701-mm.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/mediatek/clk-mt2701-mm.c b/drivers/clk/mediatek/clk-mt2701-mm.c
index fe1f85072fc5..4517525887dd 100644
--- a/drivers/clk/mediatek/clk-mt2701-mm.c
+++ b/drivers/clk/mediatek/clk-mt2701-mm.c
@@ -87,16 +87,13 @@ static const struct mtk_gate mm_clks[] = {
 	GATE_DISP1(CLK_MM_TVE_FMM, "mm_tve_fmm", "mm_sel", 14),
 };
 
-static const struct of_device_id of_match_clk_mt2701_mm[] = {
-	{ .compatible = "mediatek,mt2701-mmsys", },
-	{}
-};
-
 static int clk_mt2701_mm_probe(struct platform_device *pdev)
 {
 	struct clk_onecell_data *clk_data;
 	int r;
-	struct device_node *node = pdev->dev.of_node;
+	struct device_node *node;
+
+	node = pdev->dev.parent->of_node;
 
 	clk_data = mtk_alloc_clk_data(CLK_MM_NR);
 
@@ -116,7 +113,6 @@ static struct platform_driver clk_mt2701_mm_drv = {
 	.probe = clk_mt2701_mm_probe,
 	.driver = {
 		.name = "clk-mt2701-mm",
-		.of_match_table = of_match_clk_mt2701_mm,
 	},
 };
 
-- 
2.16.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [v2 06/10] mfd: mtk-mmsys: Add mt8173 nodes
  2018-04-23 15:31 [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Matthias Brugger
                   ` (3 preceding siblings ...)
  2018-04-23 15:32 ` [v2 05/10] clk: mediatek: mt2701-mm: switch to mfd device Matthias Brugger
@ 2018-04-23 15:32 ` Matthias Brugger
  2018-04-23 15:32 ` [v2 07/10] drm/mediatek: Add mfd support for mt8173 Matthias Brugger
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Matthias Brugger @ 2018-04-23 15:32 UTC (permalink / raw)
  To: ulrich.hecht+renesas, laurent.pinchart, ck.hu, p.zabel, airlied,
	robh+dt, mark.rutland, mturquette, sboyd, lee.jones
  Cc: davem, gregkh, mchehab, rdunlap, pi-cheng.chen, sean.wang,
	linux-clk, linux, matthias.bgg, dri-devel, linux-kernel,
	linux-arm-kernel, linux-mediatek, Matthias Brugger

Add devices for the mt8173 SoC.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/mfd/mtk-mmsys.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/mfd/mtk-mmsys.c b/drivers/mfd/mtk-mmsys.c
index c802343fb1c6..5585a561a02f 100644
--- a/drivers/mfd/mtk-mmsys.c
+++ b/drivers/mfd/mtk-mmsys.c
@@ -19,6 +19,7 @@
 
 enum {
 	MMSYS_MT2701 = 1,
+	MMSYS_MT8173,
 };
 
 static const struct mfd_cell mmsys_mt2701_devs[] = {
@@ -26,6 +27,12 @@ static const struct mfd_cell mmsys_mt2701_devs[] = {
 	{ .name = "drm-mt2701-mm", },
 };
 
+static const struct mfd_cell mmsys_mt8173_devs[] = {
+	{ .name = "clk-mt8173-mm", },
+	{ .name = "drm-mt8173-mm", },
+};
+
+
 static int mmsys_probe(struct platform_device *pdev)
 {
 	const struct mfd_cell *mmsys_cells;
@@ -44,6 +51,10 @@ static int mmsys_probe(struct platform_device *pdev)
 		mmsys_cells = mmsys_mt2701_devs;
 		nr_cells = ARRAY_SIZE(mmsys_mt2701_devs);
 		break;
+	case MMSYS_MT8173:
+		mmsys_cells = mmsys_mt8173_devs;
+		nr_cells = ARRAY_SIZE(mmsys_mt8173_devs);
+		break;
 	default:
 		return -ENODEV;
 	}
@@ -62,6 +73,9 @@ static const struct of_device_id of_match_mmsys[] = {
 	{ .compatible = "mediatek,mt2701-mmsys",
 	  .data = (void *) MMSYS_MT2701,
 	},
+	{ .compatible = "mediatek,mt8173-mmsys",
+	  .data = (void *) MMSYS_MT8173,
+	},
 	{ /* sentinel */ },
 };
 
-- 
2.16.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [v2 07/10] drm/mediatek: Add mfd support for mt8173
  2018-04-23 15:31 [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Matthias Brugger
                   ` (4 preceding siblings ...)
  2018-04-23 15:32 ` [v2 06/10] mfd: mtk-mmsys: Add mt8173 nodes Matthias Brugger
@ 2018-04-23 15:32 ` Matthias Brugger
  2018-04-23 15:32 ` [v2 08/10] clk: mediatek: mt8173-mm: switch to mfd device Matthias Brugger
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Matthias Brugger @ 2018-04-23 15:32 UTC (permalink / raw)
  To: ulrich.hecht+renesas, laurent.pinchart, ck.hu, p.zabel, airlied,
	robh+dt, mark.rutland, mturquette, sboyd, lee.jones
  Cc: davem, gregkh, mchehab, rdunlap, pi-cheng.chen, sean.wang,
	linux-clk, linux, matthias.bgg, dri-devel, linux-kernel,
	linux-arm-kernel, linux-mediatek, Matthias Brugger

Use the MFD device for SoC mt8173. Probing via devicetree
is no longer needed for any SoC, so delete it.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 88ee35907744..3cc433ebfa8f 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -399,20 +399,12 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	INIT_WORK(&private->commit.work, mtk_atomic_work);
 	private->data = of_device_get_match_data(dev);
 
-	/* Check if called from mfd */
-	if (!dev->of_node) {
-		mmsys_node = pdev->dev.parent->of_node;
-		private->data = (struct mtk_mmsys_driver_data *)
-				platform_get_device_id(pdev)->driver_data;
-		private->config_regs =
-			syscon_node_to_regmap(mmsys_node);
-		parent_node = mmsys_node->parent;
-	} else {
-		private->config_regs = syscon_node_to_regmap(dev->of_node);
-		if (IS_ERR(private->config_regs))
-			return PTR_ERR(private->config_regs);
-		parent_node = dev->of_node->parent;
-	}
+	mmsys_node = pdev->dev.parent->of_node;
+	private->data = (struct mtk_mmsys_driver_data *)
+			platform_get_device_id(pdev)->driver_data;
+	private->config_regs =
+		syscon_node_to_regmap(mmsys_node);
+	parent_node = mmsys_node->parent;
 
 	/* Iterate over sibling DISP function blocks */
 	for_each_child_of_node(parent_node, node) {
@@ -555,14 +547,9 @@ static int mtk_drm_sys_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
 			 mtk_drm_sys_resume);
 
-static const struct of_device_id mtk_drm_of_ids[] = {
-	{ .compatible = "mediatek,mt8173-mmsys",
-	  .data = &mt8173_mmsys_driver_data},
-	{ }
-};
-
 static const struct platform_device_id mtk_drm_ids[] = {
 	{ "drm-mt2701-mm", (kernel_ulong_t)&mt2701_mmsys_driver_data },
+	{ "drm-mt8173-mm", (kernel_ulong_t)&mt8173_mmsys_driver_data },
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(platform, mtk_drm_ids);
@@ -572,7 +559,6 @@ static struct platform_driver mtk_drm_platform_driver = {
 	.remove	= mtk_drm_remove,
 	.driver	= {
 		.name	= "mediatek-drm",
-		.of_match_table = mtk_drm_of_ids,
 		.pm     = &mtk_drm_pm_ops,
 	},
 	.id_table = mtk_drm_ids,
-- 
2.16.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [v2 08/10] clk: mediatek: mt8173-mm: switch to mfd device
  2018-04-23 15:31 [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Matthias Brugger
                   ` (5 preceding siblings ...)
  2018-04-23 15:32 ` [v2 07/10] drm/mediatek: Add mfd support for mt8173 Matthias Brugger
@ 2018-04-23 15:32 ` Matthias Brugger
  2018-04-24 10:05   ` kbuild test robot
  2018-04-23 15:32 ` [v2 09/10] drm: mediatek: Omit warning on probe defers Matthias Brugger
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 14+ messages in thread
From: Matthias Brugger @ 2018-04-23 15:32 UTC (permalink / raw)
  To: ulrich.hecht+renesas, laurent.pinchart, ck.hu, p.zabel, airlied,
	robh+dt, mark.rutland, mturquette, sboyd, lee.jones
  Cc: davem, gregkh, mchehab, rdunlap, pi-cheng.chen, sean.wang,
	linux-clk, linux, matthias.bgg, dri-devel, linux-kernel,
	linux-arm-kernel, linux-mediatek, Matthias Brugger

As the new mfd device is in place, switch probing
for the MMSYS to support invocation from the mfd device.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/clk/mediatek/clk-mt8173.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/mediatek/clk-mt8173.c b/drivers/clk/mediatek/clk-mt8173.c
index 96c292c3e440..abd2592078d4 100644
--- a/drivers/clk/mediatek/clk-mt8173.c
+++ b/drivers/clk/mediatek/clk-mt8173.c
@@ -15,6 +15,7 @@
 #include <linux/clk.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/platform_device.h>
 
 #include "clk-mtk.h"
 #include "clk-gate.h"
@@ -1152,10 +1153,13 @@ static void __init mtk_imgsys_init(struct device_node *node)
 }
 CLK_OF_DECLARE(mtk_imgsys, "mediatek,mt8173-imgsys", mtk_imgsys_init);
 
-static void __init mtk_mmsys_init(struct device_node *node)
+static int mtk_mmsys_probe(struct platform_device *pdev)
 {
 	struct clk_onecell_data *clk_data;
 	int r;
+	struct device_node *node;
+
+	node = pdev->dev.parent->of_node;
 
 	clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
 
@@ -1166,8 +1170,17 @@ static void __init mtk_mmsys_init(struct device_node *node)
 	if (r)
 		pr_err("%s(): could not register clock provider: %d\n",
 			__func__, r);
+
+	return r;
 }
-CLK_OF_DECLARE(mtk_mmsys, "mediatek,mt8173-mmsys", mtk_mmsys_init);
+
+static struct platform_driver clk_mt8173_mm_drv = {
+	.probe = mtk_mmsys_probe,
+	.driver = {
+		.name = "clk-mt8173-mm",
+	},
+};
+builtin_platform_driver(clk_mt8173_mm_drv);
 
 static void __init mtk_vdecsys_init(struct device_node *node)
 {
-- 
2.16.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [v2 09/10] drm: mediatek: Omit warning on probe defers
  2018-04-23 15:31 [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Matthias Brugger
                   ` (6 preceding siblings ...)
  2018-04-23 15:32 ` [v2 08/10] clk: mediatek: mt8173-mm: switch to mfd device Matthias Brugger
@ 2018-04-23 15:32 ` Matthias Brugger
  2018-04-23 15:32 ` [v2 10/10] MAINTAINERS: update Mediatek Soc entry Matthias Brugger
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Matthias Brugger @ 2018-04-23 15:32 UTC (permalink / raw)
  To: ulrich.hecht+renesas, laurent.pinchart, ck.hu, p.zabel, airlied,
	robh+dt, mark.rutland, mturquette, sboyd, lee.jones
  Cc: davem, gregkh, mchehab, rdunlap, pi-cheng.chen, sean.wang,
	linux-clk, linux, matthias.bgg, dri-devel, linux-kernel,
	linux-arm-kernel, linux-mediatek, Matthias Brugger

When probe through the MFD, it can happen that the
clock drivers wasn't probed before the ddp driver gets
invoked. The driver used to omit a warning that the driver
failed to get the clocks. Omit this error on the defered probe path.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index bafc5c77c4fb..6b399348a2dc 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -374,7 +374,8 @@ static int mtk_ddp_probe(struct platform_device *pdev)
 
 	ddp->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(ddp->clk)) {
-		dev_err(dev, "Failed to get clock\n");
+		if (PTR_ERR(ddp->clk) != -EPROBE_DEFER)
+			dev_err(dev, "Failed to get clock\n");
 		return PTR_ERR(ddp->clk);
 	}
 
-- 
2.16.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [v2 10/10] MAINTAINERS: update Mediatek Soc entry
  2018-04-23 15:31 [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Matthias Brugger
                   ` (7 preceding siblings ...)
  2018-04-23 15:32 ` [v2 09/10] drm: mediatek: Omit warning on probe defers Matthias Brugger
@ 2018-04-23 15:32 ` Matthias Brugger
  2018-04-23 16:13 ` [v2 04/10] drm/mediatek: mt2701: switch to mfd probing matthias.bgg
  2018-04-24  5:48 ` [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Lee Jones
  10 siblings, 0 replies; 14+ messages in thread
From: Matthias Brugger @ 2018-04-23 15:32 UTC (permalink / raw)
  To: ulrich.hecht+renesas, laurent.pinchart, ck.hu, p.zabel, airlied,
	robh+dt, mark.rutland, mturquette, sboyd, lee.jones
  Cc: davem, gregkh, mchehab, rdunlap, pi-cheng.chen, sean.wang,
	linux-clk, linux, matthias.bgg, dri-devel, linux-kernel,
	linux-arm-kernel, linux-mediatek, Matthias Brugger

Mediatek SoCs include several soc specific drivers as well
as a mfd device. Add these to the maintainers file.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 0a1410d5a621..74f7ea345096 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1621,6 +1621,8 @@ F:	arch/arm/boot/dts/mt7*
 F:	arch/arm/boot/dts/mt8*
 F:	arch/arm/mach-mediatek/
 F:	arch/arm64/boot/dts/mediatek/
+F:	drivers/soc/mediatek/
+F:	drivers/mfd/mtk-mmsys.c
 N:	mtk
 K:	mediatek
 
-- 
2.16.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [v2 04/10] drm/mediatek: mt2701: switch to mfd probing.
  2018-04-23 15:31 [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Matthias Brugger
                   ` (8 preceding siblings ...)
  2018-04-23 15:32 ` [v2 10/10] MAINTAINERS: update Mediatek Soc entry Matthias Brugger
@ 2018-04-23 16:13 ` matthias.bgg
  2018-04-24  5:48 ` [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Lee Jones
  10 siblings, 0 replies; 14+ messages in thread
From: matthias.bgg @ 2018-04-23 16:13 UTC (permalink / raw)
  To: ulrich.hecht+renesas, laurent.pinchart, ck.hu, p.zabel, airlied,
	robh+dt, mark.rutland, mturquette, sboyd, lee.jones
  Cc: davem, gregkh, mchehab, rdunlap, pi-cheng.chen, sean.wang,
	linux-clk, linux, matthias.bgg, dri-devel, linux-kernel,
	linux-arm-kernel, linux-mediatek, Matthias Brugger

From: Matthias Brugger <mbrugger@suse.com>

With the mtk-mmsys MFD device in place, we switch the probing for
mt2701 from device-tree to mfd.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index a48e28adad09..88ee35907744 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -386,7 +386,7 @@ static int mtk_drm_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct mtk_drm_private *private;
-	struct device_node *node;
+	struct device_node *node, *parent_node, *mmsys_node;
 	struct component_match *match = NULL;
 	int ret;
 	int i;
@@ -399,12 +399,23 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	INIT_WORK(&private->commit.work, mtk_atomic_work);
 	private->data = of_device_get_match_data(dev);
 
-	private->config_regs = syscon_node_to_regmap(dev->of_node);
-	if (IS_ERR(private->config_regs))
-		return PTR_ERR(private->config_regs);
+	/* Check if called from mfd */
+	if (!dev->of_node) {
+		mmsys_node = pdev->dev.parent->of_node;
+		private->data = (struct mtk_mmsys_driver_data *)
+				platform_get_device_id(pdev)->driver_data;
+		private->config_regs =
+			syscon_node_to_regmap(mmsys_node);
+		parent_node = mmsys_node->parent;
+	} else {
+		private->config_regs = syscon_node_to_regmap(dev->of_node);
+		if (IS_ERR(private->config_regs))
+			return PTR_ERR(private->config_regs);
+		parent_node = dev->of_node->parent;
+	}
 
 	/* Iterate over sibling DISP function blocks */
-	for_each_child_of_node(dev->of_node->parent, node) {
+	for_each_child_of_node(parent_node, node) {
 		const struct of_device_id *of_id;
 		enum mtk_ddp_comp_type comp_type;
 		int comp_id;
@@ -545,13 +556,17 @@ static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
 			 mtk_drm_sys_resume);
 
 static const struct of_device_id mtk_drm_of_ids[] = {
-	{ .compatible = "mediatek,mt2701-mmsys",
-	  .data = &mt2701_mmsys_driver_data},
 	{ .compatible = "mediatek,mt8173-mmsys",
 	  .data = &mt8173_mmsys_driver_data},
 	{ }
 };
 
+static const struct platform_device_id mtk_drm_ids[] = {
+	{ "drm-mt2701-mm", (kernel_ulong_t)&mt2701_mmsys_driver_data },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(platform, mtk_drm_ids);
+
 static struct platform_driver mtk_drm_platform_driver = {
 	.probe	= mtk_drm_probe,
 	.remove	= mtk_drm_remove,
@@ -560,6 +575,7 @@ static struct platform_driver mtk_drm_platform_driver = {
 		.of_match_table = mtk_drm_of_ids,
 		.pm     = &mtk_drm_pm_ops,
 	},
+	.id_table = mtk_drm_ids,
 };
 
 static struct platform_driver * const mtk_drm_drivers[] = {
-- 
2.16.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing
  2018-04-23 15:31 [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Matthias Brugger
                   ` (9 preceding siblings ...)
  2018-04-23 16:13 ` [v2 04/10] drm/mediatek: mt2701: switch to mfd probing matthias.bgg
@ 2018-04-24  5:48 ` Lee Jones
  2018-04-24  9:46   ` Matthias Brugger
  10 siblings, 1 reply; 14+ messages in thread
From: Lee Jones @ 2018-04-24  5:48 UTC (permalink / raw)
  To: matthias.bgg
  Cc: ulrich.hecht+renesas, laurent.pinchart, ck.hu, p.zabel, airlied,
	robh+dt, mark.rutland, mturquette, sboyd, davem, gregkh, mchehab,
	rdunlap, pi-cheng.chen, sean.wang, linux-clk, linux,
	matthias.bgg, dri-devel, linux-kernel, linux-arm-kernel,
	linux-mediatek, Matthias Brugger

On Mon, 23 Apr 2018, matthias.bgg@kernel.org wrote:

> From: Matthias Brugger <mbrugger@suse.com>
> 
> Changes since v1:
> - add binding documentation
> - ddp: use regmap_update_bits
> - ddp: ignore EPROBE_DEFER on clock probing
> - mfd: delete mmsys_private
> - add Reviewed-by and Acked-by tags

I'm confused by the double submission.

Please can you send it again completely detached from the first and
the second submissions please?

> ---
> 
> MMSYS in Mediatek SoCs has some registers to control clock gates (which is 
> used in the clk driver) and some registers to set the routing and enable
> the differnet blocks of the display subsystem.
> 
> Up to now both drivers, clock and drm are probed with the same device tree
> compatible. But only the first driver get probed, which in effect breaks
> graphics on mt8173 and mt2701.
> 
> This patch set introduces a new mfd device, which binds against the mmsys
> compatible and takes care of probing the needed devices. It was tested on the
> bananapi-r2 and the Acer R13 Chromebook.
> 
> 
> Matthias Brugger (10):
>   dt-bindings: mediatek: mmsys: Add support for mfd
>   drm/mediatek: Use regmap for register access
>   mfd: mtk-mmsys: Add mmsys driver
>   drm/mediatek: mt2701: switch to mfd probing.
>   clk: mediatek: mt2701-mm: switch to mfd device
>   mfd: mtk-mmsys: Add mt8173 nodes
>   drm/mediatek: Add mfd support for mt8173
>   clk: mediatek: mt8173-mm: switch to mfd device
>   drm: mediatek: Omit warning on probe defers
>   MAINTAINERS: update Mediatek Soc entry
> 
>  .../bindings/arm/mediatek/mediatek,mmsys.txt       |  2 -
>  .../bindings/display/mediatek/mediatek,disp.txt    |  2 +-
>  .../devicetree/bindings/mfd/mediatek,mmsys.txt     | 27 +++++++
>  MAINTAINERS                                        |  2 +
>  drivers/clk/mediatek/clk-mt2701-mm.c               | 10 +--
>  drivers/clk/mediatek/clk-mt8173.c                  | 17 +++-
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c            |  4 +-
>  drivers/gpu/drm/mediatek/mtk_drm_ddp.c             | 41 ++++------
>  drivers/gpu/drm/mediatek/mtk_drm_ddp.h             |  4 +-
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c             | 33 ++++----
>  drivers/gpu/drm/mediatek/mtk_drm_drv.h             |  2 +-
>  drivers/mfd/Kconfig                                |  9 +++
>  drivers/mfd/Makefile                               |  2 +
>  drivers/mfd/mtk-mmsys.c                            | 93 ++++++++++++++++++++++
>  14 files changed, 189 insertions(+), 59 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mfd/mediatek,mmsys.txt
>  create mode 100644 drivers/mfd/mtk-mmsys.c
> 

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing
  2018-04-24  5:48 ` [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Lee Jones
@ 2018-04-24  9:46   ` Matthias Brugger
  0 siblings, 0 replies; 14+ messages in thread
From: Matthias Brugger @ 2018-04-24  9:46 UTC (permalink / raw)
  To: Lee Jones, matthias.bgg
  Cc: ulrich.hecht+renesas, laurent.pinchart, ck.hu, p.zabel, airlied,
	robh+dt, mark.rutland, mturquette, sboyd, davem, gregkh, mchehab,
	rdunlap, pi-cheng.chen, sean.wang, linux-clk, linux, dri-devel,
	linux-kernel, linux-arm-kernel, linux-mediatek, Matthias Brugger

Hi Lee,

On 04/24/2018 07:48 AM, Lee Jones wrote:
> On Mon, 23 Apr 2018, matthias.bgg@kernel.org wrote:
> 
>> From: Matthias Brugger <mbrugger@suse.com>
>>
>> Changes since v1:
>> - add binding documentation
>> - ddp: use regmap_update_bits
>> - ddp: ignore EPROBE_DEFER on clock probing
>> - mfd: delete mmsys_private
>> - add Reviewed-by and Acked-by tags
> 
> I'm confused by the double submission.
> 
> Please can you send it again completely detached from the first and
> the second submissions please?
> 

I had some problems with my mailclient. I'll resend as 'v2 resend'.

Sorry for that.
Matthias

>> ---
>>
>> MMSYS in Mediatek SoCs has some registers to control clock gates (which is 
>> used in the clk driver) and some registers to set the routing and enable
>> the differnet blocks of the display subsystem.
>>
>> Up to now both drivers, clock and drm are probed with the same device tree
>> compatible. But only the first driver get probed, which in effect breaks
>> graphics on mt8173 and mt2701.
>>
>> This patch set introduces a new mfd device, which binds against the mmsys
>> compatible and takes care of probing the needed devices. It was tested on the
>> bananapi-r2 and the Acer R13 Chromebook.
>>
>>
>> Matthias Brugger (10):
>>   dt-bindings: mediatek: mmsys: Add support for mfd
>>   drm/mediatek: Use regmap for register access
>>   mfd: mtk-mmsys: Add mmsys driver
>>   drm/mediatek: mt2701: switch to mfd probing.
>>   clk: mediatek: mt2701-mm: switch to mfd device
>>   mfd: mtk-mmsys: Add mt8173 nodes
>>   drm/mediatek: Add mfd support for mt8173
>>   clk: mediatek: mt8173-mm: switch to mfd device
>>   drm: mediatek: Omit warning on probe defers
>>   MAINTAINERS: update Mediatek Soc entry
>>
>>  .../bindings/arm/mediatek/mediatek,mmsys.txt       |  2 -
>>  .../bindings/display/mediatek/mediatek,disp.txt    |  2 +-
>>  .../devicetree/bindings/mfd/mediatek,mmsys.txt     | 27 +++++++
>>  MAINTAINERS                                        |  2 +
>>  drivers/clk/mediatek/clk-mt2701-mm.c               | 10 +--
>>  drivers/clk/mediatek/clk-mt8173.c                  | 17 +++-
>>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c            |  4 +-
>>  drivers/gpu/drm/mediatek/mtk_drm_ddp.c             | 41 ++++------
>>  drivers/gpu/drm/mediatek/mtk_drm_ddp.h             |  4 +-
>>  drivers/gpu/drm/mediatek/mtk_drm_drv.c             | 33 ++++----
>>  drivers/gpu/drm/mediatek/mtk_drm_drv.h             |  2 +-
>>  drivers/mfd/Kconfig                                |  9 +++
>>  drivers/mfd/Makefile                               |  2 +
>>  drivers/mfd/mtk-mmsys.c                            | 93 ++++++++++++++++++++++
>>  14 files changed, 189 insertions(+), 59 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/mfd/mediatek,mmsys.txt
>>  create mode 100644 drivers/mfd/mtk-mmsys.c
>>
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [v2 08/10] clk: mediatek: mt8173-mm: switch to mfd device
  2018-04-23 15:32 ` [v2 08/10] clk: mediatek: mt8173-mm: switch to mfd device Matthias Brugger
@ 2018-04-24 10:05   ` kbuild test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kbuild test robot @ 2018-04-24 10:05 UTC (permalink / raw)
  To: matthias.bgg
  Cc: kbuild-all, ulrich.hecht+renesas, laurent.pinchart, ck.hu,
	p.zabel, airlied, robh+dt, mark.rutland, mturquette, sboyd,
	lee.jones, sean.wang, gregkh, rdunlap, linux, dri-devel,
	linux-clk, Matthias Brugger, linux-mediatek, linux-arm-kernel,
	matthias.bgg, mchehab, pi-cheng.chen, davem, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

Hi Matthias,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.17-rc2 next-20180424]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/matthias-bgg-kernel-org/arm-arm64-mediatek-Fix-mmsys-device-probing/20180424-013521
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

>> WARNING: vmlinux.o(.text+0x501416): Section mismatch in reference from the function mtk_mmsys_probe() to the variable .init.rodata:mm_clks
   The function mtk_mmsys_probe() references
   the variable __initconst mm_clks.
   This is often because mtk_mmsys_probe lacks a __initconst
   annotation or the annotation of mm_clks is wrong.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 62881 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-04-24 10:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23 15:31 [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Matthias Brugger
2018-04-23 15:32 ` [v2 01/10] dt-bindings: mediatek: mmsys: Add support for mfd Matthias Brugger
2018-04-23 15:32 ` [v2 02/10] drm/mediatek: Use regmap for register access Matthias Brugger
2018-04-23 15:32 ` [v2 03/10] mfd: mtk-mmsys: Add mmsys driver Matthias Brugger
2018-04-23 15:32 ` [v2 05/10] clk: mediatek: mt2701-mm: switch to mfd device Matthias Brugger
2018-04-23 15:32 ` [v2 06/10] mfd: mtk-mmsys: Add mt8173 nodes Matthias Brugger
2018-04-23 15:32 ` [v2 07/10] drm/mediatek: Add mfd support for mt8173 Matthias Brugger
2018-04-23 15:32 ` [v2 08/10] clk: mediatek: mt8173-mm: switch to mfd device Matthias Brugger
2018-04-24 10:05   ` kbuild test robot
2018-04-23 15:32 ` [v2 09/10] drm: mediatek: Omit warning on probe defers Matthias Brugger
2018-04-23 15:32 ` [v2 10/10] MAINTAINERS: update Mediatek Soc entry Matthias Brugger
2018-04-23 16:13 ` [v2 04/10] drm/mediatek: mt2701: switch to mfd probing matthias.bgg
2018-04-24  5:48 ` [v2 00/10] arm/arm64: mediatek: Fix mmsys device probing Lee Jones
2018-04-24  9:46   ` Matthias Brugger

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).