Skip to contentSkip to conversation

ARM: da850: new drivers for better LCDC support

PATCH Applied Bartosz Golaszewski 9 participants 30 messages Oct 31, 2016 – Nov 23, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover ARM: da850: new drivers for better LCDC support

This series adds two new drivers in order to better support the LCDC rev1 present on the da850 boards.

The first patch adds a new memory driver which allows to write to the DDR2/mDDR memory controller present on the da8xx SoCs.

The second patch adds a new bus driver which allows to interact with the MSTPRI registers of the SYSCFG0 module

As is mentioned in the comments: we don't want to commit to supporting stable interfaces (DT bindings or sysfs attributes) so we hardcode the settings required by some boards (for now only da850-lcdk) with the hope that linux gets an appropriate framework for performance knobs in the future.

Potential extensions of these drivers should be straightforward in the future.

Subsequent patches add DT nodes for the new drivers: disabled nodes in da850.dtsi and enabled in da850-lcdk.dts.

The last patch adds a workaround for current lack of support for drm bridges in tilcdc.

Tested on a da850-lcdk with a display connected over VGA and two additional patches for tilcdc (sent to linux-drm): ran simple modetest for supported resolutions, used X.org and fluxbox as graphical environment, played video with mplayer.

v1 -> v2:
- used regular readl()/writel() instead of __raw_** versions
- used resource_size() instead of calculating the size by hand
- used ioremap instead of syscon in patch [2/5]
- added the DT nodes in patches [3/5]-[5/5]

Bartosz Golaszewski (5):
ARM: memory: da8xx-ddrctl: new driver
ARM: bus: da8xx-mstpri: new driver
ARM: dts: da850: add the mstpri and ddrctl nodes
ARM: dts: da850-lcdk: enable mstpri and ddrctl nodes
ARM: dts: da850-lcdk: add tilcdc panel node

 .../devicetree/bindings/bus/ti,da850-mstpri.txt    |  20 ++
 .../memory-controllers/ti-da8xx-ddrctl.txt         |  20 ++
 arch/arm/boot/dts/da850-lcdk.dts                   |  71 ++++++
 arch/arm/boot/dts/da850.dtsi                       |  11 +
 drivers/bus/Kconfig                                |   9 +
 drivers/bus/Makefile                               |   2 +
 drivers/bus/da8xx-mstpri.c                         | 269 +++++++++++++++++++++
 drivers/memory/Kconfig                             |   8 +
 drivers/memory/Makefile                            |   1 +
 drivers/memory/da8xx-ddrctl.c                      | 175 ++++++++++++++
 10 files changed, 586 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/ti,da850-mstpri.txt
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/ti-da8xx-ddrctl.txt
 create mode 100644 drivers/bus/da8xx-mstpri.c
 create mode 100644 drivers/memory/da8xx-ddrctl.c
Signature · 6 lines
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

PATCH v2 1/5 ARM: memory: da8xx-ddrctl: new driver

Create a new driver for the da8xx DDR2/mDDR controller and implement support for writing to the Peripheral Bus Burst Priority Register.

---
 .../memory-controllers/ti-da8xx-ddrctl.txt         |  20 +++
 drivers/memory/Kconfig                             |   8 +
 drivers/memory/Makefile                            |   1 +
 drivers/memory/da8xx-ddrctl.c                      | 175 +++++++++++++++++++++
 4 files changed, 204 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/ti-da8xx-ddrctl.txt
 create mode 100644 drivers/memory/da8xx-ddrctl.c
Documentation/devicetree/bindings/memory-controllers/ti-da8xx-ddrctl.txt new file +20 -0
new file mode 100644
index 0000000..ec1dd40
@@ -0,0 +1,20 @@
+* Device tree bindings for Texas Instruments da8xx DDR2/mDDR memory controller
+
+The DDR2/mDDR memory controller present on Texas Instruments da8xx SoCs features
+a set of registers which allow to tweak the controller's behavior.
+
+Documentation:
+OMAP-L138 (DA850) - http://www.ti.com/lit/ug/spruh82c/spruh82c.pdf
+
+Required properties:
+
+- compatible:		"ti,da850-ddr-controller" - for da850 SoC based boards
+- reg:			a tuple containing the base address of the memory
+			controller and the size of the memory area to map
+
+Example for da850 shown below.
+
+ddrctl {
+	compatible = "ti,da850-ddr-controller";
+	reg = <0xb0000000 0xe8>;
+};
drivers/memory/Kconfig +8 -0
index 4b4c0c3..ec80e35 100644
@@ -134,6 +134,14 @@ config MTK_SMI
 	  mainly help enable/disable iommu and control the power domain and
 	  clocks for each local arbiter.
 
+config DA8XX_DDRCTL
+	bool "Texas Instruments da8xx DDR2/mDDR driver"
+	depends on ARCH_DAVINCI_DA8XX
+	help
+	  This driver is for the DDR2/mDDR Memory Controller present on
+	  Texas Instruments da8xx SoCs. It's used to tweak various memory
+	  controller configuration options.
+
 source "drivers/memory/samsung/Kconfig"
 source "drivers/memory/tegra/Kconfig"
 
drivers/memory/Makefile +1 -0
index b20ae38..e88097fb 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_MVEBU_DEVBUS)	+= mvebu-devbus.o
 obj-$(CONFIG_TEGRA20_MC)	+= tegra20-mc.o
 obj-$(CONFIG_JZ4780_NEMC)	+= jz4780-nemc.o
 obj-$(CONFIG_MTK_SMI)		+= mtk-smi.o
+obj-$(CONFIG_DA8XX_DDRCTL)	+= da8xx-ddrctl.o
 
 obj-$(CONFIG_SAMSUNG_MC)	+= samsung/
 obj-$(CONFIG_TEGRA_MC)		+= tegra/
drivers/memory/da8xx-ddrctl.c new file +175 -0

175 lines not on this page · raw message

Signature · 6 lines
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by on v2 1/5
#2 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

Quoted 4 lines · Bartosz Golaszewski

Create a new driver for the da8xx DDR2/mDDR controller and implement support for writing to the Peripheral Bus Burst Priority Register.

Thanks,
Sekhar
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Acked-by on v2 1/5
#4 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

In reply to Bartosz Golaszewski
Quoted 6 lines · Bartosz Golaszewski

Create a new driver for the da8xx DDR2/mDDR controller and implement support for writing to the Peripheral Bus Burst Priority Register.

---
 .../memory-controllers/ti-da8xx-ddrctl.txt         |  20 +++
Quoted 6 lines
 drivers/memory/Kconfig                             |   8 +
 drivers/memory/Makefile                            |   1 +
 drivers/memory/da8xx-ddrctl.c                      | 175 +++++++++++++++++++++
 4 files changed, 204 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/ti-da8xx-ddrctl.txt
 create mode 100644 drivers/memory/da8xx-ddrctl.c
Applied
#5 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

Quoted 9 lines · Rob Herring
Quoted 6 lines · Bartosz Golaszewski

Create a new driver for the da8xx DDR2/mDDR controller and implement support for writing to the Peripheral Bus Burst Priority Register.

---
 .../memory-controllers/ti-da8xx-ddrctl.txt         |  20 +++

Applied to v4.10/drivers

Thanks,
Sekhar

#6 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

In reply to Bartosz Golaszewski
Quoted 9 lines · Bartosz Golaszewski
(quoted diff) +9 -0
+static int da8xx_ddrctl_probe(struct platform_device *pdev)
+{
+	const struct da8xx_ddrctl_config_knob *knob;
+	const struct da8xx_ddrctl_setting *setting;
+	struct device_node *node;
+	struct resource *res;
+	void __iomem *ddrctl;
+	struct device *dev;
+	u32 reg;

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+	dev = &pdev->dev;
+	node = dev->of_node;
+
+	setting = da8xx_ddrctl_get_board_settings();
+	if (!setting) {
+		dev_err(dev, "no settings for board '%s'\n",
+			of_flat_dt_get_machine_name());
+		return -EINVAL;
+	}

This causes a section mismatch because of_flat_dt_get_machine_name() has an __init annotation. I did not notice that before, sorry.

It can be fixed with a patch like below:

---8<---

drivers/memory/da8xx-ddrctl.c +13 -2
index a20e7bbbcbe0..9ca5aab3ac54 100644
@@ -102,6 +102,18 @@ static const struct da8xx_ddrctl_setting *da8xx_ddrctl_get_board_settings(void)
 	return NULL;
 }
 
+static const char* da8xx_ddrctl_get_machine_name(void)
+{
+	const char *str;
+	int ret;
+
+	ret = of_property_read_string(of_root, "model", &str);
+	if (ret)
+		ret = of_property_read_string(of_root, "compatible", &str);
+
+	return str;
+}
+
 static int da8xx_ddrctl_probe(struct platform_device *pdev)
 {
 	const struct da8xx_ddrctl_config_knob *knob;
@@ -118,7 +130,7 @@ static int da8xx_ddrctl_probe(struct platform_device *pdev)
 	setting = da8xx_ddrctl_get_board_settings();
 	if (!setting) {
 		dev_err(dev, "no settings for board '%s'\n",
-			of_flat_dt_get_machine_name());
+			da8xx_ddrctl_get_machine_name());
 		return -EINVAL;
 	}
---8<--- 

A similar fix is required for the other driver in this series (patch 2/5). I need some advise on whether I should introduce a common function to get the machine name post kernel boot-up (I cannot see an existing one). If yes, any advise on which file it should go into?

Thanks,
Sekhar

#7 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

2016-11-21 17:33 GMT+01:00 Sekhar Nori <[email protected]>:

Quoted 60 lines · Bartosz Golaszewski
Quoted 9 lines
(quoted diff) +9 -0
+static int da8xx_ddrctl_probe(struct platform_device *pdev)
+{
+     const struct da8xx_ddrctl_config_knob *knob;
+     const struct da8xx_ddrctl_setting *setting;
+     struct device_node *node;
+     struct resource *res;
+     void __iomem *ddrctl;
+     struct device *dev;
+     u32 reg;

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+     dev = &pdev->dev;
+     node = dev->of_node;
+
+     setting = da8xx_ddrctl_get_board_settings();
+     if (!setting) {
+             dev_err(dev, "no settings for board '%s'\n",
+                     of_flat_dt_get_machine_name());
+             return -EINVAL;
+     }

This causes a section mismatch because of_flat_dt_get_machine_name() has an __init annotation. I did not notice that before, sorry.

It can be fixed with a patch like below:

---8<---

drivers/memory/da8xx-ddrctl.c +13 -2
index a20e7bbbcbe0..9ca5aab3ac54 100644
@@ -102,6 +102,18 @@ static const struct da8xx_ddrctl_setting *da8xx_ddrctl_get_board_settings(void)
        return NULL;
 }
 
+static const char* da8xx_ddrctl_get_machine_name(void)
+{
+       const char *str;
+       int ret;
+
+       ret = of_property_read_string(of_root, "model", &str);
+       if (ret)
+               ret = of_property_read_string(of_root, "compatible", &str);
+
+       return str;
+}
+
 static int da8xx_ddrctl_probe(struct platform_device *pdev)
 {
        const struct da8xx_ddrctl_config_knob *knob;
@@ -118,7 +130,7 @@ static int da8xx_ddrctl_probe(struct platform_device *pdev)
        setting = da8xx_ddrctl_get_board_settings();
        if (!setting) {
                dev_err(dev, "no settings for board '%s'\n",
-                       of_flat_dt_get_machine_name());
+                       da8xx_ddrctl_get_machine_name());
                return -EINVAL;
        }
---8<---
Quoted 5 lines

A similar fix is required for the other driver in this series (patch 2/5). I need some advise on whether I should introduce a common function to get the machine name post kernel boot-up (I cannot see an existing one). If yes, any advise on which file it should go into?

Hi Sekhar,

thanks for spotting that.

I think we should introduce this function right away, rather than having two static functions doing the same thing. If you don't mind, I'll try to find a good spot for it and send a follow-up series fixing the issue.

Best regards,
Bartosz Golaszewski

#8 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

Hi Bartosz, Sekhar,

Quoted 69 lines · Bartosz Golaszewski

2016-11-21 17:33 GMT+01:00 Sekhar Nori <[email protected]>:

Quoted 60 lines · Bartosz Golaszewski
Quoted 9 lines
(quoted diff) +9 -0
+static int da8xx_ddrctl_probe(struct platform_device *pdev)
+{
+     const struct da8xx_ddrctl_config_knob *knob;
+     const struct da8xx_ddrctl_setting *setting;
+     struct device_node *node;
+     struct resource *res;
+     void __iomem *ddrctl;
+     struct device *dev;
+     u32 reg;

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+     dev = &pdev->dev;
+     node = dev->of_node;
+
+     setting = da8xx_ddrctl_get_board_settings();
+     if (!setting) {
+             dev_err(dev, "no settings for board '%s'\n",
+                     of_flat_dt_get_machine_name());
+             return -EINVAL;
+     }

This causes a section mismatch because of_flat_dt_get_machine_name() has an __init annotation. I did not notice that before, sorry.

It can be fixed with a patch like below:

---8<---

drivers/memory/da8xx-ddrctl.c +13 -2
index a20e7bbbcbe0..9ca5aab3ac54 100644
@@ -102,6 +102,18 @@ static const struct da8xx_ddrctl_setting *da8xx_ddrctl_get_board_settings(void)
        return NULL;
 }
 
+static const char* da8xx_ddrctl_get_machine_name(void)
+{
+       const char *str;
+       int ret;
+
+       ret = of_property_read_string(of_root, "model", &str);
+       if (ret)
+               ret = of_property_read_string(of_root, "compatible", &str);
+
+       return str;
+}
+
 static int da8xx_ddrctl_probe(struct platform_device *pdev)
 {
        const struct da8xx_ddrctl_config_knob *knob;
@@ -118,7 +130,7 @@ static int da8xx_ddrctl_probe(struct platform_device *pdev)
        setting = da8xx_ddrctl_get_board_settings();
        if (!setting) {
                dev_err(dev, "no settings for board '%s'\n",
-                       of_flat_dt_get_machine_name());
+                       da8xx_ddrctl_get_machine_name());
                return -EINVAL;
        }
---8<---
Quoted 5 lines

A similar fix is required for the other driver in this series (patch 2/5). I need some advise on whether I should introduce a common function to get the machine name post kernel boot-up (I cannot see an existing one). If yes, any advise on which file it should go into?

Hi Sekhar,

Quoted 6 lines

thanks for spotting that.

I think we should introduce this function right away, rather than having two static functions doing the same thing. If you don't mind, I'll try to find a good spot for it and send a follow-up series fixing the issue.

As it happens, that was already proposed last week, for much the same reason:

http://www.mail-archive.com/[email protected]/msg111395.html

Robin.

Quoted 9 lines

Best regards,
Bartosz Golaszewski

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#9 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

Hi Robin,

Quoted 3 lines · Robin Murphy

Hi Bartosz, Sekhar,

On 21/11/16 16:48, Bartosz Golaszewski wrote:

[...]

Quoted 9 lines
Quoted 8 lines

Hi Sekhar,

thanks for spotting that.

I think we should introduce this function right away, rather than having two static functions doing the same thing. If you don't mind, I'll try to find a good spot for it and send a follow-up series fixing the issue.

Quoted 5 lines

As it happens, that was already proposed last week, for much the same reason:

http://www.mail-archive.com/linuxppc-dev-uLR06cmDAlY/[email protected]/msg111395.html

Thanks for pointing this out, yet another platform to move to the new API after v4.10.

Hi Shekar, Bartosz,

For v4.10, please continue with the open coding as proposed in this thread in order to avoid cross tree dependencies. I will rework on the above patch once v4.10 merge window closes to include all these occurrence and replace them.

Signature · 6 lines
Regards,
Sudeep
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#10 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

In reply to Sekhar Nori

Hi Sekhar,

(And adding Sudeep since he becomes involved in this further down thread and at that point says he will re-work this proposed work around in a manner that is incorrect in a manner that is similar to this proposed work around.)

Quoted 51 lines · Sekhar Nori
Quoted 9 lines · Bartosz Golaszewski
(quoted diff) +9 -0
+static int da8xx_ddrctl_probe(struct platform_device *pdev)
+{
+	const struct da8xx_ddrctl_config_knob *knob;
+	const struct da8xx_ddrctl_setting *setting;
+	struct device_node *node;
+	struct resource *res;
+	void __iomem *ddrctl;
+	struct device *dev;
+	u32 reg;

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+	dev = &pdev->dev;
+	node = dev->of_node;
+
+	setting = da8xx_ddrctl_get_board_settings();
+	if (!setting) {
+		dev_err(dev, "no settings for board '%s'\n",
+			of_flat_dt_get_machine_name());
+		return -EINVAL;
+	}

This causes a section mismatch because of_flat_dt_get_machine_name() has an __init annotation. I did not notice that before, sorry.

It can be fixed with a patch like below:

---8<---

drivers/memory/da8xx-ddrctl.c +12 -0
index a20e7bbbcbe0..9ca5aab3ac54 100644
@@ -102,6 +102,18 @@ static const struct da8xx_ddrctl_setting *da8xx_ddrctl_get_board_settings(void)
 	return NULL;
 }
 
+static const char* da8xx_ddrctl_get_machine_name(void)
+{
+	const char *str;
+	int ret;
+
+	ret = of_property_read_string(of_root, "model", &str);
+	if (ret)
+		ret = of_property_read_string(of_root, "compatible", &str);
+
+	return str;
+}
+
 static int da8xx_ddrctl_probe(struct platform_device *pdev)
 {
 	const struct da8xx_ddrctl_config_knob *knob;

drivers/memory/da8xx-ddrctl.c static int da8xx_ddrctl_probe(struct platform_device *pdev) · line 121

Quoted 4 lines
drivers/memory/da8xx-ddrctl.c +0 -1
@@ -118,7 +130,7 @@ static int da8xx_ddrctl_probe(struct platform_device *pdev)
 	setting = da8xx_ddrctl_get_board_settings();
 	if (!setting) {
 		dev_err(dev, "no settings for board '%s'\n",
-			of_flat_dt_get_machine_name());

da8xx_ddrctl_get_board_settings() tries to match based on the "compatible" property in the root node. The "model" property in the root node has nothing to do with the failure to match. So creating and then using da8xx_ddrctl_get_machine_name() to potentially report model is not useful.

It should be sufficient to simply report that no compatible matched.

Quoted 5 lines
drivers/memory/da8xx-ddrctl.c +1 -1
+			da8xx_ddrctl_get_machine_name());
 		return -EINVAL;
 	}
---8<--- 
Quoted 9 lines

A similar fix is required for the other driver in this series (patch 2/5). I need some advise on whether I should introduce a common function to get the machine name post kernel boot-up (I cannot see an existing one). If yes, any advise on which file it should go into?

Thanks,
Sekhar

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

Hi Frank,

Quoted 62 lines · Frank Rowand
Quoted 51 lines · Sekhar Nori
Quoted 9 lines · Bartosz Golaszewski
(quoted diff) +9 -0
+static int da8xx_ddrctl_probe(struct platform_device *pdev)
+{
+	const struct da8xx_ddrctl_config_knob *knob;
+	const struct da8xx_ddrctl_setting *setting;
+	struct device_node *node;
+	struct resource *res;
+	void __iomem *ddrctl;
+	struct device *dev;
+	u32 reg;

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+	dev = &pdev->dev;
+	node = dev->of_node;
+
+	setting = da8xx_ddrctl_get_board_settings();
+	if (!setting) {
+		dev_err(dev, "no settings for board '%s'\n",
+			of_flat_dt_get_machine_name());
+		return -EINVAL;
+	}

This causes a section mismatch because of_flat_dt_get_machine_name() has an __init annotation. I did not notice that before, sorry.

It can be fixed with a patch like below:

---8<---

drivers/memory/da8xx-ddrctl.c +12 -0
index a20e7bbbcbe0..9ca5aab3ac54 100644
@@ -102,6 +102,18 @@ static const struct da8xx_ddrctl_setting *da8xx_ddrctl_get_board_settings(void)
 	return NULL;
 }
 
+static const char* da8xx_ddrctl_get_machine_name(void)
+{
+	const char *str;
+	int ret;
+
+	ret = of_property_read_string(of_root, "model", &str);
+	if (ret)
+		ret = of_property_read_string(of_root, "compatible", &str);
+
+	return str;
+}
+
 static int da8xx_ddrctl_probe(struct platform_device *pdev)
 {
 	const struct da8xx_ddrctl_config_knob *knob;

drivers/memory/da8xx-ddrctl.c static int da8xx_ddrctl_probe(struct platform_device *pdev) · line 121

Quoted 4 lines
drivers/memory/da8xx-ddrctl.c +0 -1
@@ -118,7 +130,7 @@ static int da8xx_ddrctl_probe(struct platform_device *pdev)
 	setting = da8xx_ddrctl_get_board_settings();
 	if (!setting) {
 		dev_err(dev, "no settings for board '%s'\n",
-			of_flat_dt_get_machine_name());

da8xx_ddrctl_get_board_settings() tries to match based on the "compatible" property in the root node. The "model" property in the root node has nothing to do with the failure to match. So creating and then using da8xx_ddrctl_get_machine_name() to potentially report model is not useful.

Quoted 1 line

It should be sufficient to simply report that no compatible matched.

I agree with you on this. Even if model name is printed, you will have to go back and check the compatible anyway. But I think it will be useful to print the compatible instead of just reporting that nothing matched.

Bartosz, if you agree too, could you send a fix patch just printing the compatible?

Thanks,
Sekhar
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#12 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

Quoted 67 lines · Sekhar Nori

Hi Frank,

Quoted 62 lines · Frank Rowand
Quoted 51 lines · Sekhar Nori
Quoted 9 lines · Bartosz Golaszewski
(quoted diff) +9 -0
+static int da8xx_ddrctl_probe(struct platform_device *pdev)
+{
+	const struct da8xx_ddrctl_config_knob *knob;
+	const struct da8xx_ddrctl_setting *setting;
+	struct device_node *node;
+	struct resource *res;
+	void __iomem *ddrctl;
+	struct device *dev;
+	u32 reg;

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+	dev = &pdev->dev;
+	node = dev->of_node;
+
+	setting = da8xx_ddrctl_get_board_settings();
+	if (!setting) {
+		dev_err(dev, "no settings for board '%s'\n",
+			of_flat_dt_get_machine_name());
+		return -EINVAL;
+	}

This causes a section mismatch because of_flat_dt_get_machine_name() has an __init annotation. I did not notice that before, sorry.

It can be fixed with a patch like below:

---8<---

drivers/memory/da8xx-ddrctl.c +12 -0
index a20e7bbbcbe0..9ca5aab3ac54 100644
@@ -102,6 +102,18 @@ static const struct da8xx_ddrctl_setting *da8xx_ddrctl_get_board_settings(void)
 	return NULL;
 }
 
+static const char* da8xx_ddrctl_get_machine_name(void)
+{
+	const char *str;
+	int ret;
+
+	ret = of_property_read_string(of_root, "model", &str);
+	if (ret)
+		ret = of_property_read_string(of_root, "compatible", &str);
+
+	return str;
+}
+
 static int da8xx_ddrctl_probe(struct platform_device *pdev)
 {
 	const struct da8xx_ddrctl_config_knob *knob;

drivers/memory/da8xx-ddrctl.c static int da8xx_ddrctl_probe(struct platform_device *pdev) · line 121

Quoted 4 lines
drivers/memory/da8xx-ddrctl.c +0 -1
@@ -118,7 +130,7 @@ static int da8xx_ddrctl_probe(struct platform_device *pdev)
 	setting = da8xx_ddrctl_get_board_settings();
 	if (!setting) {
 		dev_err(dev, "no settings for board '%s'\n",
-			of_flat_dt_get_machine_name());

da8xx_ddrctl_get_board_settings() tries to match based on the "compatible" property in the root node. The "model" property in the root node has nothing to do with the failure to match. So creating and then using da8xx_ddrctl_get_machine_name() to potentially report model is not useful.

Quoted 1 line

It should be sufficient to simply report that no compatible matched.

Quoted 7 lines

I agree with you on this. Even if model name is printed, you will have to go back and check the compatible anyway. But I think it will be useful to print the compatible instead of just reporting that nothing matched.

Bartosz, if you agree too, could you send a fix patch just printing the compatible?

Please note that the compatible property might contain several strings, not just a single string.

Quoted 4 lines

Thanks,
Sekhar

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#13 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

Quoted 2 lines · Frank Rowand

Please note that the compatible property might contain several strings, not just a single string.

So I guess the best thing to do is to use of_property_read_string_index() and print the sting at index 0.

Thanks,
Sekhar

#14 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

Quoted 9 lines · Sekhar Nori
Quoted 2 lines · Frank Rowand

Please note that the compatible property might contain several strings, not just a single string.

So I guess the best thing to do is to use of_property_read_string_index() and print the sting at index 0.

Thanks,
Sekhar

If you want to print just one compatible value, you could use that method.

To give all of the information needed to understand the problem, the error message would need to include all of the strings contained in the compatible property and all of the .board values in the da8xx_ddrctl_board_confs[] array (currently only one entry, but coded to allow additional entries in the future).

It is hard to justify an error message that complex.

I would just print an error that no match was found.

-Frank
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

Quoted 19 lines · Frank Rowand
Quoted 9 lines · Sekhar Nori
Quoted 2 lines · Frank Rowand

Please note that the compatible property might contain several strings, not just a single string.

So I guess the best thing to do is to use of_property_read_string_index() and print the sting at index 0.

Thanks,
Sekhar

If you want to print just one compatible value, you could use that method.

To give all of the information needed to understand the problem, the error message would need to include all of the strings contained in the compatible property and all of the .board values in the da8xx_ddrctl_board_confs[] array (currently only one entry, but coded to allow additional entries in the future).

Quoted 5 lines

It is hard to justify an error message that complex.

I would just print an error that no match was found.

-Frank

I just needed to read some more emails. I see this approach was taken in the "[PATCH v4 0/2] da8xx: fix section mismatch in new drivers" series.

-Frank
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw

Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver

In reply to Frank Rowand
Quoted 8 lines · Frank Rowand

Hi Sekhar,

(And adding Sudeep since he becomes involved in this further down thread and at that point says he will re-work this proposed work around in a manner that is incorrect in a manner that is similar to this proposed work around.)

On 11/21/16 08:33, Sekhar Nori wrote:

[...]

Quoted 14 lines

drivers/memory/da8xx-ddrctl.c static int da8xx_ddrctl_probe(struct platform_device *pdev) · line 121

Quoted 8 lines

static int da8xx_ddrctl_probe(struct platform_device *pdev) {

drivers/memory/da8xx-ddrctl.c +0 -1
 	const struct da8xx_ddrctl_config_knob *knob;
@@ -118,7 +130,7 @@ static int da8xx_ddrctl_probe(struct platform_device *pdev)
 	setting = da8xx_ddrctl_get_board_settings();
 	if (!setting) {
 		dev_err(dev, "no settings for board '%s'\n",
-			of_flat_dt_get_machine_name());

da8xx_ddrctl_get_board_settings() tries to match based on the "compatible" property in the root node. The "model" property in the root node has nothing to do with the failure to match. So creating and then using da8xx_ddrctl_get_machine_name() to potentially report model is not useful.

Quoted 2 lines

It should be sufficient to simply report that no compatible matched.

Agreed.

Signature · 2 lines
Regards,
Sudeep
#17 lore raw

PATCH v2 2/5 ARM: bus: da8xx-mstpri: new driver

In reply to Bartosz Golaszewski

Create the driver for the da8xx master peripheral priority configuration and implement support for writing to the three Master Priority registers on da850 SoCs.

---
 .../devicetree/bindings/bus/ti,da850-mstpri.txt    |  20 ++
 drivers/bus/Kconfig                                |   9 +
 drivers/bus/Makefile                               |   2 +
 drivers/bus/da8xx-mstpri.c                         | 269 +++++++++++++++++++++
 4 files changed, 300 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/ti,da850-mstpri.txt
 create mode 100644 drivers/bus/da8xx-mstpri.c
Documentation/devicetree/bindings/bus/ti,da850-mstpri.txt new file +20 -0
new file mode 100644
index 0000000..72daefc
@@ -0,0 +1,20 @@
+* Device tree bindings for Texas Instruments da8xx master peripheral
+  priority driver
+
+DA8XX SoCs feature a set of registers allowing to change the priority of all
+peripherals classified as masters.
+
+Documentation:
+OMAP-L138 (DA850) - http://www.ti.com/lit/ug/spruh82c/spruh82c.pdf
+
+Required properties:
+
+- compatible:		"ti,da850-mstpri" - for da850 based boards
+- reg:			offset and length of the mstpri registers
+
+Example for da850-lcdk is shown below.
+
+mstpri {
+	compatible = "ti,da850-mstpri";
+	reg = <0x14110 0x0c>;
+};
drivers/bus/Kconfig +9 -0
index 7875105..f5db3a7 100644
@@ -167,4 +167,13 @@ config VEXPRESS_CONFIG
 	help
 	  Platform configuration infrastructure for the ARM Ltd.
 	  Versatile Express.
+
+config DA8XX_MSTPRI
+	bool "TI da8xx master peripheral priority driver"
+	depends on ARCH_DAVINCI_DA8XX
+	help
+	  Driver for Texas Instruments da8xx master peripheral priority
+	  configuration. Allows to adjust the priorities of all master
+	  peripherals.
+
 endmenu
drivers/bus/Makefile +2 -0
index c6cfa6b..2adb540 100644
@@ -21,3 +21,5 @@ obj-$(CONFIG_SIMPLE_PM_BUS)	+= simple-pm-bus.o
 obj-$(CONFIG_TEGRA_ACONNECT)	+= tegra-aconnect.o
 obj-$(CONFIG_UNIPHIER_SYSTEM_BUS)	+= uniphier-system-bus.o
 obj-$(CONFIG_VEXPRESS_CONFIG)	+= vexpress-config.o
+
+obj-$(CONFIG_DA8XX_MSTPRI)	+= da8xx-mstpri.o
drivers/bus/da8xx-mstpri.c new file +269 -0

269 lines not on this page · raw message

Signature · 1 line
2.9.3
Reviewed-by on v2 2/5
#18 lore raw

Re: [PATCH v2 2/5] ARM: bus: da8xx-mstpri: new driver

Quoted 5 lines · Bartosz Golaszewski

Create the driver for the da8xx master peripheral priority configuration and implement support for writing to the three Master Priority registers on da850 SoCs.

Thanks,
Sekhar
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Acked-by on v2 2/5
#20 lore raw

Re: [PATCH v2 2/5] ARM: bus: da8xx-mstpri: new driver

In reply to Bartosz Golaszewski
Quoted 7 lines · Bartosz Golaszewski

Create the driver for the da8xx master peripheral priority configuration and implement support for writing to the three Master Priority registers on da850 SoCs.

---
 .../devicetree/bindings/bus/ti,da850-mstpri.txt    |  20 ++
Quoted 6 lines
 drivers/bus/Kconfig                                |   9 +
 drivers/bus/Makefile                               |   2 +
 drivers/bus/da8xx-mstpri.c                         | 269 +++++++++++++++++++++
 4 files changed, 300 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/ti,da850-mstpri.txt
 create mode 100644 drivers/bus/da8xx-mstpri.c
Applied
#21 lore raw

Re: [PATCH v2 2/5] ARM: bus: da8xx-mstpri: new driver

Quoted 10 lines · Rob Herring
Quoted 7 lines · Bartosz Golaszewski

Create the driver for the da8xx master peripheral priority configuration and implement support for writing to the three Master Priority registers on da850 SoCs.

---
 .../devicetree/bindings/bus/ti,da850-mstpri.txt    |  20 ++

Applied to v4.10/drivers

Thanks,
Sekhar

#22 lore raw

PATCH v2 3/5 ARM: dts: da850: add the mstpri and ddrctl nodes

In reply to Bartosz Golaszewski

Add the nodes for the MSTPRI configuration and DDR2/mDDR memory controller drivers to da850.dtsi.

---
 arch/arm/boot/dts/da850.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/da850.dtsi +11 -0
index 112c6d7..44bece3 100644
@@ -454,6 +454,12 @@
 			interrupts = <52>;
 			status = "disabled";
 		};
+
+		mstpri: mstpri at 14110 {
+			compatible = "ti,da850-mstpri";
+			reg = <0x14110 0x0c>;
+			status = "disabled";
+		};
 	};
 	aemif: aemif at 68000000 {
 		compatible = "ti,da850-aemif";
@@ -465,4 +471,9 @@
 			  1 0 0x68000000 0x00008000>;
 		status = "disabled";
 	};
+	ddrctl: ddrctl at b0000000 {
+		compatible = "ti,da850-ddr-controller";
+		reg = <0xb0000000 0xe8>;
+		status = "disabled";
+	};
 };
Signature · 1 line
2.9.3
#23 lore raw

PATCH v2 4/5 ARM: dts: da850-lcdk: enable mstpri and ddrctl nodes

In reply to Bartosz Golaszewski

Enable the MSTPRI configuration and DDR2/mDDR memory controller nodes on da850-lcdk. This is needed in order to adjust the memory throughput constraints for better tilcdc support.

---
 arch/arm/boot/dts/da850-lcdk.dts | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/da850-lcdk.dts +8 -0
index 4747629..b39796e 100644
@@ -243,3 +243,11 @@
 		};
 	};
 };
+
+&mstpri {
+	status = "okay";
+};
+
+&ddrctl {
+	status = "okay";
+};
Signature · 1 line
2.9.3
#24 lore raw

Re: [PATCH v2 4/5] ARM: dts: da850-lcdk: enable mstpri and ddrctl nodes

Hi Bartosz,

Thank you for the patch.

Quoted 3 lines · On Monday 31 Oct 2016 15:45:37 Bartosz Golaszewski wrote:

Enable the MSTPRI configuration and DDR2/mDDR memory controller nodes on da850-lcdk. This is needed in order to adjust the memory throughput constraints for better tilcdc support.

Is there a reason not to enable these unconditionally in da850.dtsi (or rather not disabling them) instead of handling it per board ?

Quoted 21 lines
---
 arch/arm/boot/dts/da850-lcdk.dts | 8 ++++++++
 1 file changed, 8 insertions(+)
(quoted diff) +0 -0

b/arch/arm/boot/dts/da850-lcdk.dts index 4747629..b39796e 100644

arch/arm/boot/dts/da850-lcdk.dts +8 -0
@@ -243,3 +243,11 @@
 		};
 	};
 };
+
+&mstpri {
+	status = "okay";
+};
+
+&ddrctl {
+	status = "okay";
+};
Signature · 3 lines
Regards,

Laurent Pinchart
#25 lore raw

Re: [PATCH v2 4/5] ARM: dts: da850-lcdk: enable mstpri and ddrctl nodes

Quoted 11 lines · Laurent Pinchart

Hi Bartosz,

Thank you for the patch.

Quoted 3 lines · On Monday 31 Oct 2016 15:45:37 Bartosz Golaszewski wrote:

Enable the MSTPRI configuration and DDR2/mDDR memory controller nodes on da850-lcdk. This is needed in order to adjust the memory throughput constraints for better tilcdc support.

Is there a reason not to enable these unconditionally in da850.dtsi (or rather not disabling them) instead of handling it per board ?

Right. They should be enabled by default in DT. The drivers already have board-specific compatible checks.

Kevin

#26 lore raw

PATCH v2 5/5 ARM: dts: da850-lcdk: add tilcdc panel node

In reply to Bartosz Golaszewski

The tilcdc driver is not yet ready for working together with the dumb-vga-dac drm bridge. While the work on enabling drm_bridge support in tilcdc continues, enable the VGA connector on da850-lcdk with the following workaround: use the tilcdc-panel driver with a set of common (and tested) resolutions.

Once the drm bridge support is complete, we'll remove the node added by this patch and use the correct solution. This change will be transparent for the user.

---
 arch/arm/boot/dts/da850-lcdk.dts | 63 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
arch/arm/boot/dts/da850-lcdk.dts +63 -0
index b39796e..df582c6 100644
@@ -62,6 +62,65 @@
 		regulator-max-microvolt = <5000000>;
 	};
 
+	/*
+	 * Remove this node once the tilcdc driver gets support for
+	 * drm bridge modules.
+	 */
+	panel {
+		compatible = "ti,tilcdc,panel";
+		pinctrl-names = "default";
+		pinctrl-0 = <&lcd_pins>;
+		status = "okay";
+
+		panel-info {
+			ac-bias = <0>;
+			ac-bias-intrpt = <0>;
+			dma-burst-sz = <16>;
+			bpp = <16>;
+			fdd = <255>;
+			sync-edge = <0>;
+			sync-ctrl = <0>;
+			raster-order = <0>;
+			fifo-th = <5>;
+		};
+
+		display-timings {
+			native-mode = <&svga_timings>;
+			vga_timings: 640x480 at 60 {
+				clock-frequency = <27500000>;
+				hactive = <640>;
+				hback-porch = <90>;
+				hfront-porch = <40>;
+				hsync-len = <128>;
+				vactive = <480>;
+				vback-porch = <23>;
+				vfront-porch = <1>;
+				vsync-len = <4>;
+			};
+			vga_timings_hf: 640x480 at 75 {
+				clock-frequency = <34000000>;
+				hactive = <640>;
+				hback-porch = <90>;
+				hfront-porch = <40>;
+				hsync-len = <128>;
+				vactive = <480>;
+				vback-porch = <23>;
+				vfront-porch = <1>;
+				vsync-len = <4>;
+			};
+			svga_timings: 800x600 at 56 {
+				clock-frequency = <37500000>;
+				hactive = <800>;
+				hback-porch = <140>;
+				hfront-porch = <40>;
+				hsync-len = <128>;
+				vactive = <600>;
+				vback-porch = <23>;
+				vfront-porch = <1>;
+				vsync-len = <4>;
+			};
+		};
+	};
 };
 
 &pmx_core {
@@ -251,3 +310,7 @@
 &ddrctl {
 	status = "okay";
 };
+
+&display {
+	status = "okay";
+};
Signature · 1 line
2.9.3
#27 lore raw

Re: [PATCH v2 5/5] ARM: dts: da850-lcdk: add tilcdc panel node

Quoted 11 lines · Bartosz Golaszewski

The tilcdc driver is not yet ready for working together with the dumb-vga-dac drm bridge. While the work on enabling drm_bridge support in tilcdc continues, enable the VGA connector on da850-lcdk with the following workaround: use the tilcdc-panel driver with a set of common (and tested) resolutions.

Once the drm bridge support is complete, we'll remove the node added by this patch and use the correct solution. This change will be transparent for the user.

I dont think this can be applied. If this goes in v4.10, then the DT blob becomes an ABI and driver will have to support tilcdc-panel driver for DA850 forever.

Its probably better to wait for the proper driver support to arrive.

Thanks,
Sekhar
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#28 lore raw

Re: [PATCH v2 5/5] ARM: dts: da850-lcdk: add tilcdc panel node

Quoted 11 lines · Sekhar Nori
Quoted 10 lines · Bartosz Golaszewski

The tilcdc driver is not yet ready for working together with the dumb-vga-dac drm bridge. While the work on enabling drm_bridge support in tilcdc continues, enable the VGA connector on da850-lcdk with the following workaround: use the tilcdc-panel driver with a set of common (and tested) resolutions.

Once the drm bridge support is complete, we'll remove the node added by this patch and use the correct solution. This change will be transparent for the user.

Quoted 7 lines
Quoted 1 line

I dont think this can be applied. If this goes in v4.10, then the DT blob becomes an ABI and driver will have to support tilcdc-panel driver for DA850 forever.

Its probably better to wait for the proper driver support to arrive.

Agreed, NAK for this.

Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161101/c00353af/attachment.sig>

#29 lore raw
In reply to Bartosz Golaszewski

+ Arnd, Olof

Quoted 8 lines · Bartosz Golaszewski

This series adds two new drivers in order to better support the LCDC rev1 present on the da850 boards.

The first patch adds a new memory driver which allows to write to the DDR2/mDDR memory controller present on the da8xx SoCs.

The second patch adds a new bus driver which allows to interact with the MSTPRI registers of the SYSCFG0 module

I think patches 1/5 and 2/5 are ready to be merged. If there are no objections I would like to send a pull request for them to be merged through ARM-SoC tree for v4.10 kernel.

Thanks,
Sekhar

Quoted 50 lines

As is mentioned in the comments: we don't want to commit to supporting stable interfaces (DT bindings or sysfs attributes) so we hardcode the settings required by some boards (for now only da850-lcdk) with the hope that linux gets an appropriate framework for performance knobs in the future.

Potential extensions of these drivers should be straightforward in the future.

Subsequent patches add DT nodes for the new drivers: disabled nodes in da850.dtsi and enabled in da850-lcdk.dts.

The last patch adds a workaround for current lack of support for drm bridges in tilcdc.

Tested on a da850-lcdk with a display connected over VGA and two additional patches for tilcdc (sent to linux-drm): ran simple modetest for supported resolutions, used X.org and fluxbox as graphical environment, played video with mplayer.

v1 -> v2:
- used regular readl()/writel() instead of __raw_** versions
- used resource_size() instead of calculating the size by hand
- used ioremap instead of syscon in patch [2/5]
- added the DT nodes in patches [3/5]-[5/5]

Bartosz Golaszewski (5):
ARM: memory: da8xx-ddrctl: new driver
ARM: bus: da8xx-mstpri: new driver
ARM: dts: da850: add the mstpri and ddrctl nodes
ARM: dts: da850-lcdk: enable mstpri and ddrctl nodes
ARM: dts: da850-lcdk: add tilcdc panel node

 .../devicetree/bindings/bus/ti,da850-mstpri.txt    |  20 ++
 .../memory-controllers/ti-da8xx-ddrctl.txt         |  20 ++
 arch/arm/boot/dts/da850-lcdk.dts                   |  71 ++++++
 arch/arm/boot/dts/da850.dtsi                       |  11 +
 drivers/bus/Kconfig                                |   9 +
 drivers/bus/Makefile                               |   2 +
 drivers/bus/da8xx-mstpri.c                         | 269 +++++++++++++++++++++
 drivers/memory/Kconfig                             |   8 +
 drivers/memory/Makefile                            |   1 +
 drivers/memory/da8xx-ddrctl.c                      | 175 ++++++++++++++
 10 files changed, 586 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/ti,da850-mstpri.txt
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/ti-da8xx-ddrctl.txt
 create mode 100644 drivers/bus/da8xx-mstpri.c
 create mode 100644 drivers/memory/da8xx-ddrctl.c