2017-12-06 11:54:36

by Neil Armstrong

[permalink] [raw]
Subject: [RESEND PATCH 0/4] drm/meson: power domain init related fixes

On the Amlogic Gx SoCs (GXBB, GXL & GXM), the VPU power domain is initialized
by the vendor U-Boot code, but running mainline U-boot has been possible
on these SoCs. But lacking such init made the system lock at kernel boot.

A PM Power Domain driver has been pushed at [1] to solve the main issue.
The following patches :
- updates the DT bindings accordingly
- adds support for missing regulators and registers init

Neil Armstrong (4):
dt-bindings: display: amlogic,meson-vpu: Add optional power domain
property
dt-bindings: display: amlogic,meson-dw-hdmi: Add optional HDMI 5V
regulator
drm/meson: dw_hdmi: Add support for an optional external 5V regulator
drm/meson: Add missing VPU init

.../devicetree/bindings/display/amlogic,meson-dw-hdmi.txt | 4 ++++
.../devicetree/bindings/display/amlogic,meson-vpu.txt | 4 ++++
drivers/gpu/drm/meson/meson_drv.c | 9 +++++++++
drivers/gpu/drm/meson/meson_dw_hdmi.c | 13 +++++++++++++
drivers/gpu/drm/meson/meson_registers.h | 4 ++++
5 files changed, 34 insertions(+)

--
2.7.4


2017-12-06 11:54:46

by Neil Armstrong

[permalink] [raw]
Subject: [RESEND PATCH 3/4] drm/meson: dw_hdmi: Add support for an optional external 5V regulator

On reference boards and derivatives, the HDMI Logic is powered by an external
5V regulator.
This regulator was set by the Vendor U-Boot, add optional support for it.

Signed-off-by: Neil Armstrong <[email protected]>
---
drivers/gpu/drm/meson/meson_dw_hdmi.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index cef4144..17de3af 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -23,6 +23,7 @@
#include <linux/of_graph.h>
#include <linux/reset.h>
#include <linux/clk.h>
+#include <linux/regulator/consumer.h>

#include <drm/drmP.h>
#include <drm/drm_edid.h>
@@ -137,6 +138,7 @@ struct meson_dw_hdmi {
struct reset_control *hdmitx_phy;
struct clk *hdmi_pclk;
struct clk *venci_clk;
+ struct regulator *hdmi_supply;
u32 irq_stat;
};
#define encoder_to_meson_dw_hdmi(x) \
@@ -751,6 +753,17 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
dw_plat_data = &meson_dw_hdmi->dw_plat_data;
encoder = &meson_dw_hdmi->encoder;

+ meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi");
+ if (IS_ERR(meson_dw_hdmi->hdmi_supply)) {
+ if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ meson_dw_hdmi->hdmi_supply = NULL;
+ } else {
+ ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
+ if (ret)
+ return ret;
+ }
+
meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
"hdmitx_apb");
if (IS_ERR(meson_dw_hdmi->hdmitx_apb)) {
--
2.7.4

2017-12-06 11:54:51

by Neil Armstrong

[permalink] [raw]
Subject: [RESEND PATCH 2/4] dt-bindings: display: amlogic,meson-dw-hdmi: Add optional HDMI 5V regulator

On reference boards and derivatives, the HDMI Logic is powered by an external
5V regulator.
This regulator was set by the Vendor U-Boot, add optional support for it.

Acked-by: Rob Herring <[email protected]>
Signed-off-by: Neil Armstrong <[email protected]>
---
Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.txt | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.txt b/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.txt
index 7f040ed..bf4a180 100644
--- a/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.txt
+++ b/Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.txt
@@ -48,6 +48,10 @@ Required properties:
Documentation/devicetree/bindings/reset/reset.txt,
the reset-names should be "hdmitx_apb", "hdmitx", "hdmitx_phy"

+Optional properties:
+- hdmi-supply: Optional phandle to an external 5V regulator to power the HDMI
+ logic, as described in the file ../regulator/regulator.txt
+
Required nodes:

The connections to the HDMI ports are modeled using the OF graph
--
2.7.4

2017-12-06 11:54:44

by Neil Armstrong

[permalink] [raw]
Subject: [RESEND PATCH 1/4] dt-bindings: display: amlogic,meson-vpu: Add optional power domain property

The Video Processing Unit power domain was setup by the Vendor U-Boot,
add support for an optional Power Domain phandle to setup it from the kernel.

Acked-by: Rob Herring <[email protected]>
Signed-off-by: Neil Armstrong <[email protected]>
---
Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt
index 00f74ba..057b813 100644
--- a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt
+++ b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt
@@ -64,6 +64,10 @@ Required properties:
- reg-names: should contain the names of the previous memory regions
- interrupts: should contain the VENC Vsync interrupt number

+Optional properties:
+- power-domains: Optional phandle to associated power domain as described in
+ the file ../power/power_domain.txt
+
Required nodes:

The connections to the VPU output video ports are modeled using the OF graph
--
2.7.4

2017-12-06 11:55:27

by Neil Armstrong

[permalink] [raw]
Subject: [RESEND PATCH 4/4] drm/meson: Add missing VPU init

The VPU init misses these configurations values.

Signed-off-by: Neil Armstrong <[email protected]>
---
drivers/gpu/drm/meson/meson_drv.c | 9 +++++++++
drivers/gpu/drm/meson/meson_registers.h | 4 ++++
2 files changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 3b804fd..f9ad0e9 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -151,6 +151,14 @@ static struct regmap_config meson_regmap_config = {
.max_register = 0x1000,
};

+static void meson_vpu_init(struct meson_drm *priv)
+{
+ writel_relaxed(0x210000, priv->io_base + _REG(VPU_RDARB_MODE_L1C1));
+ writel_relaxed(0x10000, priv->io_base + _REG(VPU_RDARB_MODE_L1C2));
+ writel_relaxed(0x900000, priv->io_base + _REG(VPU_RDARB_MODE_L2C1));
+ writel_relaxed(0x20000, priv->io_base + _REG(VPU_WRARB_MODE_L2C1));
+}
+
static int meson_drv_bind_master(struct device *dev, bool has_components)
{
struct platform_device *pdev = to_platform_device(dev);
@@ -222,6 +230,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)

/* Hardware Initialization */

+ meson_vpu_init(priv);
meson_venc_init(priv);
meson_vpp_init(priv);
meson_viu_init(priv);
diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h
index 2847381..bca8714 100644
--- a/drivers/gpu/drm/meson/meson_registers.h
+++ b/drivers/gpu/drm/meson/meson_registers.h
@@ -1363,6 +1363,10 @@
#define VPU_PROT3_STAT_1 0x277a
#define VPU_PROT3_STAT_2 0x277b
#define VPU_PROT3_REQ_ONOFF 0x277c
+#define VPU_RDARB_MODE_L1C1 0x2790
+#define VPU_RDARB_MODE_L1C2 0x2799
+#define VPU_RDARB_MODE_L2C1 0x279d
+#define VPU_WRARB_MODE_L2C1 0x27a2

/* osd super scale */
#define OSDSR_HV_SIZEIN 0x3130
--
2.7.4

2017-12-06 12:04:04

by Neil Armstrong

[permalink] [raw]
Subject: Re: [RESEND PATCH 4/4] drm/meson: Add missing VPU init

On 06/12/2017 13:02, Chris Wilson wrote:
> Quoting Neil Armstrong (2017-12-06 11:54:28)
>> The VPU init misses these configurations values.
>>
>> Signed-off-by: Neil Armstrong <[email protected]>
>> ---
>> drivers/gpu/drm/meson/meson_drv.c | 9 +++++++++
>> drivers/gpu/drm/meson/meson_registers.h | 4 ++++
>> 2 files changed, 13 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
>> index 3b804fd..f9ad0e9 100644
>> --- a/drivers/gpu/drm/meson/meson_drv.c
>> +++ b/drivers/gpu/drm/meson/meson_drv.c
>> @@ -151,6 +151,14 @@ static struct regmap_config meson_regmap_config = {
>> .max_register = 0x1000,
>> };
>>
>> +static void meson_vpu_init(struct meson_drm *priv)
>> +{
>> + writel_relaxed(0x210000, priv->io_base + _REG(VPU_RDARB_MODE_L1C1));
>> + writel_relaxed(0x10000, priv->io_base + _REG(VPU_RDARB_MODE_L1C2));
>> + writel_relaxed(0x900000, priv->io_base + _REG(VPU_RDARB_MODE_L2C1));
>> + writel_relaxed(0x20000, priv->io_base + _REG(VPU_WRARB_MODE_L2C1));
>> +}
>
>> diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h
>> index 2847381..bca8714 100644
>> --- a/drivers/gpu/drm/meson/meson_registers.h
>> +++ b/drivers/gpu/drm/meson/meson_registers.h
>> @@ -1363,6 +1363,10 @@
>> #define VPU_PROT3_STAT_1 0x277a
>> #define VPU_PROT3_STAT_2 0x277b
>> #define VPU_PROT3_REQ_ONOFF 0x277c
>> +#define VPU_RDARB_MODE_L1C1 0x2790
>> +#define VPU_RDARB_MODE_L1C2 0x2799
>
> Hmm, not naturally aligned for writel. Is the register width correct,
> address correct, or this really is an unaligned iowrite?

The registers are aligned with the documentation, then are used with the _REG() macro
to align them with the bus (on top of the file).

Neil

>
>> +#define VPU_RDARB_MODE_L2C1 0x279d
>> +#define VPU_WRARB_MODE_L2C1 0x27a2
>
> Similarly,
> -Chris
>

2017-12-08 09:04:26

by Jerome Brunet

[permalink] [raw]
Subject: Re: [RESEND PATCH 0/4] drm/meson: power domain init related fixes

On Wed, 2017-12-06 at 12:54 +0100, Neil Armstrong wrote:
> On the Amlogic Gx SoCs (GXBB, GXL & GXM), the VPU power domain is initialized
> by the vendor U-Boot code, but running mainline U-boot has been possible
> on these SoCs. But lacking such init made the system lock at kernel boot.
>
> A PM Power Domain driver has been pushed at [1] to solve the main issue.
> The following patches :
> - updates the DT bindings accordingly
> - adds support for missing regulators and registers init
>
> Neil Armstrong (4):
> dt-bindings: display: amlogic,meson-vpu: Add optional power domain
> property
> dt-bindings: display: amlogic,meson-dw-hdmi: Add optional HDMI 5V
> regulator
> drm/meson: dw_hdmi: Add support for an optional external 5V regulator
> drm/meson: Add missing VPU init
>
> .../devicetree/bindings/display/amlogic,meson-dw-hdmi.txt | 4 ++++
> .../devicetree/bindings/display/amlogic,meson-vpu.txt | 4 ++++
> drivers/gpu/drm/meson/meson_drv.c | 9 +++++++++
> drivers/gpu/drm/meson/meson_dw_hdmi.c | 13
> +++++++++++++
> drivers/gpu/drm/meson/meson_registers.h | 4 ++++
> 5 files changed, 34 insertions(+)
>

No dependencies on the bootloader anymore, this is great ! Thanks
Series tested on libretech-cc s905x

Tested-by: Jerome Brunet <[email protected]>
Reviewed-by: Jerome Brunet <[email protected]>

2017-12-08 09:47:27

by Neil Armstrong

[permalink] [raw]
Subject: Re: [RESEND PATCH 0/4] drm/meson: power domain init related fixes

On 08/12/2017 10:04, Jerome Brunet wrote:
> On Wed, 2017-12-06 at 12:54 +0100, Neil Armstrong wrote:
>> On the Amlogic Gx SoCs (GXBB, GXL & GXM), the VPU power domain is initialized
>> by the vendor U-Boot code, but running mainline U-boot has been possible
>> on these SoCs. But lacking such init made the system lock at kernel boot.
>>
>> A PM Power Domain driver has been pushed at [1] to solve the main issue.
>> The following patches :
>> - updates the DT bindings accordingly
>> - adds support for missing regulators and registers init
>>
>> Neil Armstrong (4):
>> dt-bindings: display: amlogic,meson-vpu: Add optional power domain
>> property
>> dt-bindings: display: amlogic,meson-dw-hdmi: Add optional HDMI 5V
>> regulator
>> drm/meson: dw_hdmi: Add support for an optional external 5V regulator
>> drm/meson: Add missing VPU init
>>
>> .../devicetree/bindings/display/amlogic,meson-dw-hdmi.txt | 4 ++++
>> .../devicetree/bindings/display/amlogic,meson-vpu.txt | 4 ++++
>> drivers/gpu/drm/meson/meson_drv.c | 9 +++++++++
>> drivers/gpu/drm/meson/meson_dw_hdmi.c | 13
>> +++++++++++++
>> drivers/gpu/drm/meson/meson_registers.h | 4 ++++
>> 5 files changed, 34 insertions(+)
>>
>
> No dependencies on the bootloader anymore, this is great ! Thanks
> Series tested on libretech-cc s905x
>
> Tested-by: Jerome Brunet <[email protected]>
> Reviewed-by: Jerome Brunet <[email protected]>
>

Applied to drm-misc-next