Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f9c60f2 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Florian Tobias Schandinat
Browse files

fbdev: sh_mipi_dsi: add extra phyctrl for sh_mipi_dsi_info



sh_mipi uses some clocks, but the method of setup depends on CPU.

Current SuperH (like sh73a0) can control all of these clocks
by CPG (Clock Pulse Generator).
It means we can control it by clock framework only.
But on sh7372, it needs CPG settings AND sh_mipi PHYCTRL::PLLDS,
and only sh7372 has PHYCTRL::PLLDS.

But on current sh_mipi driver, PHYCTRL::PLLDS of sh7372 was
overwrote since the callback timing of clock setting was changed
by c2658b70
(fbdev: sh_mipi_dsi: fixup setup timing of sh_mipi_setup()).
To solve this issue, this patch adds extra .phyctrl.

This patch adds detail explanation for unclear mipi settings
and fixup wrong PHYCTRL::PLLDS value for ap4evb (0xb -> 0x6).

Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
parent f363afc1
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -486,20 +486,25 @@ static struct platform_device keysc_device = {
};
};


/* MIPI-DSI */
/* MIPI-DSI */
#define PHYCTRL		0x0070
static int sh_mipi_set_dot_clock(struct platform_device *pdev,
static int sh_mipi_set_dot_clock(struct platform_device *pdev,
				 void __iomem *base,
				 void __iomem *base,
				 int enable)
				 int enable)
{
{
	struct clk *pck = clk_get(&pdev->dev, "dsip_clk");
	struct clk *pck = clk_get(&pdev->dev, "dsip_clk");
	void __iomem *phy =  base + PHYCTRL;


	if (IS_ERR(pck))
	if (IS_ERR(pck))
		return PTR_ERR(pck);
		return PTR_ERR(pck);


	if (enable) {
	if (enable) {
		/*
		 * DSIPCLK	= 24MHz
		 * D-PHY	= DSIPCLK * ((0x6*2)+1) = 312MHz (see .phyctrl)
		 * HsByteCLK	= D-PHY/8 = 39MHz
		 *
		 *  X * Y * FPS =
		 * (544+72+600+16) * (961+8+8+2) * 30 = 36.1MHz
		 */
		clk_set_rate(pck, clk_round_rate(pck, 24000000));
		clk_set_rate(pck, clk_round_rate(pck, 24000000));
		iowrite32(ioread32(phy) | (0xb << 8), phy);
		clk_enable(pck);
		clk_enable(pck);
	} else {
	} else {
		clk_disable(pck);
		clk_disable(pck);
@@ -530,6 +535,7 @@ static struct sh_mipi_dsi_info mipidsi0_info = {
	.lcd_chan	= &lcdc_info.ch[0],
	.lcd_chan	= &lcdc_info.ch[0],
	.lane		= 2,
	.lane		= 2,
	.vsynw_offset	= 17,
	.vsynw_offset	= 17,
	.phyctrl	= 0x6 << 8,
	.flags		= SH_MIPI_DSI_SYNC_PULSES_MODE |
	.flags		= SH_MIPI_DSI_SYNC_PULSES_MODE |
			  SH_MIPI_DSI_HSbyteCLK,
			  SH_MIPI_DSI_HSbyteCLK,
	.set_dot_clock	= sh_mipi_set_dot_clock,
	.set_dot_clock	= sh_mipi_set_dot_clock,
+1 −1
Original line number Original line Diff line number Diff line
@@ -273,7 +273,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
	iowrite32(0x00000001, base + PHYCTRL);
	iowrite32(0x00000001, base + PHYCTRL);
	udelay(200);
	udelay(200);
	/* Deassert resets, power on */
	/* Deassert resets, power on */
	iowrite32(0x03070001, base + PHYCTRL);
	iowrite32(0x03070001 | pdata->phyctrl, base + PHYCTRL);


	/*
	/*
	 * Default = ULPS enable |
	 * Default = ULPS enable |
+1 −0
Original line number Original line Diff line number Diff line
@@ -51,6 +51,7 @@ struct sh_mipi_dsi_info {
	int				lane;
	int				lane;
	unsigned long			flags;
	unsigned long			flags;
	u32				clksrc;
	u32				clksrc;
	u32				phyctrl; /* for extra setting */
	unsigned int			vsynw_offset;
	unsigned int			vsynw_offset;
	int	(*set_dot_clock)(struct platform_device *pdev,
	int	(*set_dot_clock)(struct platform_device *pdev,
				 void __iomem *base,
				 void __iomem *base,