Skip to contentSkip to conversation

drm/fsl-dcu: fix endian issue when using clk_register_divider

PATCH In review Stefan Agner 2 participants 3 messages Sep 2, 2016 – Sep 5, 2016

Subsystems (4)
lore
Share & tools
lore

Stefan Agner

author maintainer
#0 lore raw

PATCH 1/1 drm/fsl-dcu: fix endian issue when using clk_register_divider

Since using clk_register_divider to setup the pixel clock, regmap is no longer used. Regmap did take care of DCU using different endianness. Check endianness using the device-tree property "big-endian" to determine the location of DIV_RATIO.

Fixes 2d701449bce1 ("drm/fsl-dcu: use common clock framework for pixel clock divider")
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +6 -1
index 7882387..8dd042e 100644
@@ -330,6 +330,7 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
 	const char *pix_clk_in_name;
 	const struct of_device_id *id;
 	int ret;
+	u8 div_ratio_shift = 0;
 
 	fsl_dev = devm_kzalloc(dev, sizeof(*fsl_dev), GFP_KERNEL);
 	if (!fsl_dev)
@@ -382,11 +383,15 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
 		pix_clk_in = fsl_dev->clk;
 	}
 
+	if (of_property_read_bool(dev->of_node, "big-endian"))
+		div_ratio_shift = 24;
+
+
 	pix_clk_in_name = __clk_get_name(pix_clk_in);
 	snprintf(pix_clk_name, sizeof(pix_clk_name), "%s_pix", pix_clk_in_name);
 	fsl_dev->pix_clk = clk_register_divider(dev, pix_clk_name,
 			pix_clk_in_name, 0, base + DCU_DIV_RATIO,
-			0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL);
+			div_ratio_shift, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL);
 	if (IS_ERR(fsl_dev->pix_clk)) {
 		dev_err(dev, "failed to register pix clk\n");
 		ret = PTR_ERR(fsl_dev->pix_clk);
Signature · 6 lines
2.9.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Tested-by on v1 1/1
#1 lore raw
Quoted 52 lines

Subject: [PATCH] drm/fsl-dcu: fix endian issue when using clk_register_divider

Since using clk_register_divider to setup the pixel clock, regmap is no longer used. Regmap did take care of DCU using different endianness. Check endianness using the device-tree property "big-endian" to determine the location of DIV_RATIO.

Fixes 2d701449bce1 ("drm/fsl-dcu: use common clock framework for pixel

clock divider")

---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/fsl- renamed from drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -0

dcu/fsl_dcu_drm_drv.c
index 7882387..8dd042e 100644

drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +1 -0
@@ -330,6 +330,7 @@ static int fsl_dcu_drm_probe(struct platform_device
 *pdev)
 	const char *pix_clk_in_name;
 	const struct of_device_id *id;
 	int ret;
+	u8 div_ratio_shift = 0;
 
 	fsl_dev = devm_kzalloc(dev, sizeof(*fsl_dev), GFP_KERNEL);
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +5 -1
 	if (!fsl_dev)
@@ -382,11 +383,15 @@ static int fsl_dcu_drm_probe(struct platform_device
 *pdev)
 		pix_clk_in = fsl_dev->clk;
 	}
 
+	if (of_property_read_bool(dev->of_node, "big-endian"))
+		div_ratio_shift = 24;
+
+
 	pix_clk_in_name = __clk_get_name(pix_clk_in);
 	snprintf(pix_clk_name, sizeof(pix_clk_name), "%s_pix",
 pix_clk_in_name);
 	fsl_dev->pix_clk = clk_register_divider(dev, pix_clk_name,
 			pix_clk_in_name, 0, base + DCU_DIV_RATIO,
-			0, 8, CLK_DIVIDER_ROUND_CLOSEST, NULL);
+			div_ratio_shift, 8, CLK_DIVIDER_ROUND_CLOSEST,
 NULL);
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +0 -1
 	if (IS_ERR(fsl_dev->pix_clk)) {
 		dev_err(dev, "failed to register pix clk\n");
 		ret = PTR_ERR(fsl_dev->pix_clk);
--
Quoted 1 line

2.9.0

On LS1021A-TWR board.

Meng

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer Applied
#2 lore raw
Quoted 12 lines · Meng Yi
Quoted 12 lines

Subject: [PATCH] drm/fsl-dcu: fix endian issue when using clk_register_divider

Since using clk_register_divider to setup the pixel clock, regmap is no longer used. Regmap did take care of DCU using different endianness. Check endianness using the device-tree property "big-endian" to determine the location of DIV_RATIO.

Fixes 2d701449bce1 ("drm/fsl-dcu: use common clock framework for pixel

clock divider")

<snip>

Quoted 3 lines

On LS1021A-TWR board.

Thanks, applied!

--
Stefan
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel