Re: [PATCH v5 19/29] drm/omap: dsi: move structs & defines to dsi.h

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:45PM +0200, Tomi Valkeinen wrote:
> Move structs and defines to a private dsi.h header file to make dsi.c a
> bit easier to navigate. Also move the (now) private structs and defines
> from omapdss.h to dsi.h.
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 384 +
>  drivers/gpu/drm/omapdrm/dss/dsi.h | 459 ++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  64 
>  3 files changed, 460 insertions(+), 447 deletions(-)
>  create mode 100644 drivers/gpu/drm/omapdrm/dss/dsi.h
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 0795efdd8902..da3ff9e236bd 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -45,73 +45,7 @@
>  
>  #define DSI_CATCH_MISSING_TE
>  
> -struct dsi_reg { u16 module; u16 idx; };
> -
> -#define DSI_REG(mod, idx)((const struct dsi_reg) { mod, idx })
> -
> -/* DSI Protocol Engine */
> -
> -#define DSI_PROTO0
> -#define DSI_PROTO_SZ 0x200
> -
> -#define DSI_REVISION DSI_REG(DSI_PROTO, 0x)
> -#define DSI_SYSCONFIGDSI_REG(DSI_PROTO, 0x0010)
> -#define DSI_SYSSTATUSDSI_REG(DSI_PROTO, 0x0014)
> -#define DSI_IRQSTATUSDSI_REG(DSI_PROTO, 0x0018)
> -#define DSI_IRQENABLEDSI_REG(DSI_PROTO, 0x001C)
> -#define DSI_CTRL DSI_REG(DSI_PROTO, 0x0040)
> -#define DSI_GNQ  DSI_REG(DSI_PROTO, 0x0044)
> -#define DSI_COMPLEXIO_CFG1   DSI_REG(DSI_PROTO, 0x0048)
> -#define DSI_COMPLEXIO_IRQ_STATUS DSI_REG(DSI_PROTO, 0x004C)
> -#define DSI_COMPLEXIO_IRQ_ENABLE DSI_REG(DSI_PROTO, 0x0050)
> -#define DSI_CLK_CTRL DSI_REG(DSI_PROTO, 0x0054)
> -#define DSI_TIMING1  DSI_REG(DSI_PROTO, 0x0058)
> -#define DSI_TIMING2  DSI_REG(DSI_PROTO, 0x005C)
> -#define DSI_VM_TIMING1   DSI_REG(DSI_PROTO, 0x0060)
> -#define DSI_VM_TIMING2   DSI_REG(DSI_PROTO, 0x0064)
> -#define DSI_VM_TIMING3   DSI_REG(DSI_PROTO, 0x0068)
> -#define DSI_CLK_TIMING   DSI_REG(DSI_PROTO, 0x006C)
> -#define DSI_TX_FIFO_VC_SIZE  DSI_REG(DSI_PROTO, 0x0070)
> -#define DSI_RX_FIFO_VC_SIZE  DSI_REG(DSI_PROTO, 0x0074)
> -#define DSI_COMPLEXIO_CFG2   DSI_REG(DSI_PROTO, 0x0078)
> -#define DSI_RX_FIFO_VC_FULLNESS  DSI_REG(DSI_PROTO, 0x007C)
> -#define DSI_VM_TIMING4   DSI_REG(DSI_PROTO, 0x0080)
> -#define DSI_TX_FIFO_VC_EMPTINESS DSI_REG(DSI_PROTO, 0x0084)
> -#define DSI_VM_TIMING5   DSI_REG(DSI_PROTO, 0x0088)
> -#define DSI_VM_TIMING6   DSI_REG(DSI_PROTO, 0x008C)
> -#define DSI_VM_TIMING7   DSI_REG(DSI_PROTO, 0x0090)
> -#define DSI_STOPCLK_TIMING   DSI_REG(DSI_PROTO, 0x0094)
> -#define DSI_VC_CTRL(n)   DSI_REG(DSI_PROTO, 0x0100 + (n 
> * 0x20))
> -#define DSI_VC_TE(n) DSI_REG(DSI_PROTO, 0x0104 + (n * 0x20))
> -#define DSI_VC_LONG_PACKET_HEADER(n) DSI_REG(DSI_PROTO, 0x0108 + (n * 0x20))
> -#define DSI_VC_LONG_PACKET_PAYLOAD(n)DSI_REG(DSI_PROTO, 0x010C + (n 
> * 0x20))
> -#define DSI_VC_SHORT_PACKET_HEADER(n)DSI_REG(DSI_PROTO, 0x0110 + (n 
> * 0x20))
> -#define DSI_VC_IRQSTATUS(n)  DSI_REG(DSI_PROTO, 0x0118 + (n * 0x20))
> -#define DSI_VC_IRQENABLE(n)  DSI_REG(DSI_PROTO, 0x011C + (n * 0x20))
> -
> -/* DSIPHY_SCP */
> -
> -#define DSI_PHY  1
> -#define DSI_PHY_OFFSET   0x200
> -#define DSI_PHY_SZ   0x40
> -
> -#define DSI_DSIPHY_CFG0  DSI_REG(DSI_PHY, 0x)
> -#define DSI_DSIPHY_CFG1  DSI_REG(DSI_PHY, 0x0004)
> -#define DSI_DSIPHY_CFG2  DSI_REG(DSI_PHY, 0x0008)
> -#define DSI_DSIPHY_CFG5  DSI_REG(DSI_PHY, 0x0014)
> -#define DSI_DSIPHY_CFG10 DSI_REG(DSI_PHY, 0x0028)
> -
> -/* DSI_PLL_CTRL_SCP */
> -
> -#define DSI_PLL  2
> -#define DSI_PLL_OFFSET   0x300
> -#define DSI_PLL_SZ   0x20
> -
> -#define DSI_PLL_CONTROL  DSI_REG(DSI_PLL, 0x)
> -#define DSI_PLL_STATUS   DSI_REG(DSI_PLL, 0x0004)
> -#define DSI_PLL_GO   DSI_REG(DSI_PLL, 0x0008)
> -#define DSI_PLL_CONFIGURATION1   DSI_REG(DSI_PLL, 0x000C)
> -#define DSI_PLL_CONFIGURATION2   DSI_REG(DSI_PLL, 0x0010)
> +#include "dsi.h"
>  
>  #define REG_GET(dsi, idx, start, end) \
>   FLD_GET(dsi_read_reg(dsi, idx), start, end)
> @@ -119,96 +53,6 @@ struct dsi_reg { u16 module; u16 idx; };
>  #define 

[PATCH v5 19/29] drm/omap: dsi: move structs & defines to dsi.h

2020-12-08 Thread Tomi Valkeinen
Move structs and defines to a private dsi.h header file to make dsi.c a
bit easier to navigate. Also move the (now) private structs and defines
from omapdss.h to dsi.h.

Signed-off-by: Tomi Valkeinen 
Reviewed-by: Laurent Pinchart 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 384 +
 drivers/gpu/drm/omapdrm/dss/dsi.h | 459 ++
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  64 
 3 files changed, 460 insertions(+), 447 deletions(-)
 create mode 100644 drivers/gpu/drm/omapdrm/dss/dsi.h

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 0795efdd8902..da3ff9e236bd 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -45,73 +45,7 @@
 
 #define DSI_CATCH_MISSING_TE
 
-struct dsi_reg { u16 module; u16 idx; };
-
-#define DSI_REG(mod, idx)  ((const struct dsi_reg) { mod, idx })
-
-/* DSI Protocol Engine */
-
-#define DSI_PROTO  0
-#define DSI_PROTO_SZ   0x200
-
-#define DSI_REVISION   DSI_REG(DSI_PROTO, 0x)
-#define DSI_SYSCONFIG  DSI_REG(DSI_PROTO, 0x0010)
-#define DSI_SYSSTATUS  DSI_REG(DSI_PROTO, 0x0014)
-#define DSI_IRQSTATUS  DSI_REG(DSI_PROTO, 0x0018)
-#define DSI_IRQENABLE  DSI_REG(DSI_PROTO, 0x001C)
-#define DSI_CTRL   DSI_REG(DSI_PROTO, 0x0040)
-#define DSI_GNQDSI_REG(DSI_PROTO, 0x0044)
-#define DSI_COMPLEXIO_CFG1 DSI_REG(DSI_PROTO, 0x0048)
-#define DSI_COMPLEXIO_IRQ_STATUS   DSI_REG(DSI_PROTO, 0x004C)
-#define DSI_COMPLEXIO_IRQ_ENABLE   DSI_REG(DSI_PROTO, 0x0050)
-#define DSI_CLK_CTRL   DSI_REG(DSI_PROTO, 0x0054)
-#define DSI_TIMING1DSI_REG(DSI_PROTO, 0x0058)
-#define DSI_TIMING2DSI_REG(DSI_PROTO, 0x005C)
-#define DSI_VM_TIMING1 DSI_REG(DSI_PROTO, 0x0060)
-#define DSI_VM_TIMING2 DSI_REG(DSI_PROTO, 0x0064)
-#define DSI_VM_TIMING3 DSI_REG(DSI_PROTO, 0x0068)
-#define DSI_CLK_TIMING DSI_REG(DSI_PROTO, 0x006C)
-#define DSI_TX_FIFO_VC_SIZEDSI_REG(DSI_PROTO, 0x0070)
-#define DSI_RX_FIFO_VC_SIZEDSI_REG(DSI_PROTO, 0x0074)
-#define DSI_COMPLEXIO_CFG2 DSI_REG(DSI_PROTO, 0x0078)
-#define DSI_RX_FIFO_VC_FULLNESSDSI_REG(DSI_PROTO, 0x007C)
-#define DSI_VM_TIMING4 DSI_REG(DSI_PROTO, 0x0080)
-#define DSI_TX_FIFO_VC_EMPTINESS   DSI_REG(DSI_PROTO, 0x0084)
-#define DSI_VM_TIMING5 DSI_REG(DSI_PROTO, 0x0088)
-#define DSI_VM_TIMING6 DSI_REG(DSI_PROTO, 0x008C)
-#define DSI_VM_TIMING7 DSI_REG(DSI_PROTO, 0x0090)
-#define DSI_STOPCLK_TIMING DSI_REG(DSI_PROTO, 0x0094)
-#define DSI_VC_CTRL(n) DSI_REG(DSI_PROTO, 0x0100 + (n * 0x20))
-#define DSI_VC_TE(n)   DSI_REG(DSI_PROTO, 0x0104 + (n * 0x20))
-#define DSI_VC_LONG_PACKET_HEADER(n)   DSI_REG(DSI_PROTO, 0x0108 + (n * 0x20))
-#define DSI_VC_LONG_PACKET_PAYLOAD(n)  DSI_REG(DSI_PROTO, 0x010C + (n * 0x20))
-#define DSI_VC_SHORT_PACKET_HEADER(n)  DSI_REG(DSI_PROTO, 0x0110 + (n * 0x20))
-#define DSI_VC_IRQSTATUS(n)DSI_REG(DSI_PROTO, 0x0118 + (n * 0x20))
-#define DSI_VC_IRQENABLE(n)DSI_REG(DSI_PROTO, 0x011C + (n * 0x20))
-
-/* DSIPHY_SCP */
-
-#define DSI_PHY1
-#define DSI_PHY_OFFSET 0x200
-#define DSI_PHY_SZ 0x40
-
-#define DSI_DSIPHY_CFG0DSI_REG(DSI_PHY, 0x)
-#define DSI_DSIPHY_CFG1DSI_REG(DSI_PHY, 0x0004)
-#define DSI_DSIPHY_CFG2DSI_REG(DSI_PHY, 0x0008)
-#define DSI_DSIPHY_CFG5DSI_REG(DSI_PHY, 0x0014)
-#define DSI_DSIPHY_CFG10   DSI_REG(DSI_PHY, 0x0028)
-
-/* DSI_PLL_CTRL_SCP */
-
-#define DSI_PLL2
-#define DSI_PLL_OFFSET 0x300
-#define DSI_PLL_SZ 0x20
-
-#define DSI_PLL_CONTROLDSI_REG(DSI_PLL, 0x)
-#define DSI_PLL_STATUS DSI_REG(DSI_PLL, 0x0004)
-#define DSI_PLL_GO DSI_REG(DSI_PLL, 0x0008)
-#define DSI_PLL_CONFIGURATION1 DSI_REG(DSI_PLL, 0x000C)
-#define DSI_PLL_CONFIGURATION2 DSI_REG(DSI_PLL, 0x0010)
+#include "dsi.h"
 
 #define REG_GET(dsi, idx, start, end) \
FLD_GET(dsi_read_reg(dsi, idx), start, end)
@@ -119,96 +53,6 @@ struct dsi_reg { u16 module; u16 idx; };
 #define REG_FLD_MOD(dsi, idx, val, start, end) \
dsi_write_reg(dsi, idx, FLD_MOD(dsi_read_reg(dsi, idx), val, start, 
end))
 
-/* Global interrupts */
-#define DSI_IRQ_VC0(1 << 0)
-#define DSI_IRQ_VC1(1 << 1)
-#define DSI_IRQ_VC2(1 << 2)
-#define DSI_IRQ_VC3(1 << 3)
-#define DSI_IRQ_WAKEUP (1 << 4)
-#define