RE: [PATCH v2 3/4] drm: ipk: Add extensions for DW MIPI DSI Host driver

2020-04-09 Thread Angelo Ribeiro
Hi Sam,

Thanks for your revision 

Angelo

From: Sam Ravnborg 
Date: Tue, Apr 07, 2020 at 18:51:59

> Hi Angelo.
> 
> One nit below.
> 
>   Sam
> 
> On Mon, Apr 06, 2020 at 03:24:13PM +0200, Angelo Ribeiro wrote:
> > Add Synopsys DesignWare IPK specific extensions for Synopsys DesignWare
> > MIPI DSI Host driver.
> > 
> > Cc: Maarten Lankhorst 
> > Cc: Maxime Ripard 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Gustavo Pimentel 
> > Cc: Joao Pinto 
> > Signed-off-by: Angelo Ribeiro 
> > ---
> >  drivers/gpu/drm/ipk/Kconfig   |   9 +
> >  drivers/gpu/drm/ipk/Makefile  |   2 +
> >  drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c | 556 
> > ++
> >  3 files changed, 567 insertions(+)
> >  create mode 100644 drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c
> > 
> > diff --git a/drivers/gpu/drm/ipk/Kconfig b/drivers/gpu/drm/ipk/Kconfig
> > index 1f87444..49819e5 100644
> > --- a/drivers/gpu/drm/ipk/Kconfig
> > +++ b/drivers/gpu/drm/ipk/Kconfig
> > @@ -11,3 +11,12 @@ config DRM_IPK
> >   Enable support for the Synopsys DesignWare DRM DSI.
> >   To compile this driver as a module, choose M here: the module
> >   will be called ipk-drm.
> > +
> > +config DRM_IPK_DSI
> > +   tristate "Synopsys DesignWare IPK specific extensions for MIPI DSI"
> > +   depends on DRM_IPK
> > +   select DRM_DW_MIPI_DSI
> > +   help
> > + Choose this option for Synopsys DesignWare IPK MIPI DSI support.
> > + To compile this driver as a module, choose M here: the module
> > + will be called dw-mipi-dsi-ipk.
> > diff --git a/drivers/gpu/drm/ipk/Makefile b/drivers/gpu/drm/ipk/Makefile
> > index 51d2774..c80503f 100644
> > --- a/drivers/gpu/drm/ipk/Makefile
> > +++ b/drivers/gpu/drm/ipk/Makefile
> > @@ -4,3 +4,5 @@ ipk-drm-y := \
> > dw-vpg.o
> >  
> >  obj-$(CONFIG_DRM_IPK) += ipk-drm.o
> > +
> > +obj-$(CONFIG_DRM_IPK_DSI) += dw-mipi-dsi-ipk.o
> > diff --git a/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c 
> > b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c
> > new file mode 100644
> > index 000..070eccb
> > --- /dev/null
> > +++ b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c
> > @@ -0,0 +1,556 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (c) 2019-2020 Synopsys, Inc. and/or its affiliates.
> > + * Synopsys DesignWare MIPI DSI solution driver
> > + *
> > + * Author: Angelo Ribeiro 
> > + * Author: Luis Oliveira 
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +#include 
> > +#include 
> Same rant as in previous mail about include file.
> 
> 
> Rest of the driver looked good while quickly browsing the code.
> 
>   Sam


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 3/4] drm: ipk: Add extensions for DW MIPI DSI Host driver

2020-04-07 Thread Sam Ravnborg
Hi Angelo.

One nit below.

Sam

On Mon, Apr 06, 2020 at 03:24:13PM +0200, Angelo Ribeiro wrote:
> Add Synopsys DesignWare IPK specific extensions for Synopsys DesignWare
> MIPI DSI Host driver.
> 
> Cc: Maarten Lankhorst 
> Cc: Maxime Ripard 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Gustavo Pimentel 
> Cc: Joao Pinto 
> Signed-off-by: Angelo Ribeiro 
> ---
>  drivers/gpu/drm/ipk/Kconfig   |   9 +
>  drivers/gpu/drm/ipk/Makefile  |   2 +
>  drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c | 556 
> ++
>  3 files changed, 567 insertions(+)
>  create mode 100644 drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c
> 
> diff --git a/drivers/gpu/drm/ipk/Kconfig b/drivers/gpu/drm/ipk/Kconfig
> index 1f87444..49819e5 100644
> --- a/drivers/gpu/drm/ipk/Kconfig
> +++ b/drivers/gpu/drm/ipk/Kconfig
> @@ -11,3 +11,12 @@ config DRM_IPK
> Enable support for the Synopsys DesignWare DRM DSI.
> To compile this driver as a module, choose M here: the module
> will be called ipk-drm.
> +
> +config DRM_IPK_DSI
> + tristate "Synopsys DesignWare IPK specific extensions for MIPI DSI"
> + depends on DRM_IPK
> + select DRM_DW_MIPI_DSI
> + help
> +   Choose this option for Synopsys DesignWare IPK MIPI DSI support.
> +   To compile this driver as a module, choose M here: the module
> +   will be called dw-mipi-dsi-ipk.
> diff --git a/drivers/gpu/drm/ipk/Makefile b/drivers/gpu/drm/ipk/Makefile
> index 51d2774..c80503f 100644
> --- a/drivers/gpu/drm/ipk/Makefile
> +++ b/drivers/gpu/drm/ipk/Makefile
> @@ -4,3 +4,5 @@ ipk-drm-y := \
>   dw-vpg.o
>  
>  obj-$(CONFIG_DRM_IPK) += ipk-drm.o
> +
> +obj-$(CONFIG_DRM_IPK_DSI) += dw-mipi-dsi-ipk.o
> diff --git a/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c 
> b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c
> new file mode 100644
> index 000..070eccb
> --- /dev/null
> +++ b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c
> @@ -0,0 +1,556 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2019-2020 Synopsys, Inc. and/or its affiliates.
> + * Synopsys DesignWare MIPI DSI solution driver
> + *
> + * Author: Angelo Ribeiro 
> + * Author: Luis Oliveira 
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
Same rant as in previous mail about include file.


Rest of the driver looked good while quickly browsing the code.

Sam
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 3/4] drm: ipk: Add extensions for DW MIPI DSI Host driver

2020-04-07 Thread Angelo Ribeiro
Add Synopsys DesignWare IPK specific extensions for Synopsys DesignWare
MIPI DSI Host driver.

Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Gustavo Pimentel 
Cc: Joao Pinto 
Signed-off-by: Angelo Ribeiro 
---
 drivers/gpu/drm/ipk/Kconfig   |   9 +
 drivers/gpu/drm/ipk/Makefile  |   2 +
 drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c | 556 ++
 3 files changed, 567 insertions(+)
 create mode 100644 drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c

diff --git a/drivers/gpu/drm/ipk/Kconfig b/drivers/gpu/drm/ipk/Kconfig
index 1f87444..49819e5 100644
--- a/drivers/gpu/drm/ipk/Kconfig
+++ b/drivers/gpu/drm/ipk/Kconfig
@@ -11,3 +11,12 @@ config DRM_IPK
  Enable support for the Synopsys DesignWare DRM DSI.
  To compile this driver as a module, choose M here: the module
  will be called ipk-drm.
+
+config DRM_IPK_DSI
+   tristate "Synopsys DesignWare IPK specific extensions for MIPI DSI"
+   depends on DRM_IPK
+   select DRM_DW_MIPI_DSI
+   help
+ Choose this option for Synopsys DesignWare IPK MIPI DSI support.
+ To compile this driver as a module, choose M here: the module
+ will be called dw-mipi-dsi-ipk.
diff --git a/drivers/gpu/drm/ipk/Makefile b/drivers/gpu/drm/ipk/Makefile
index 51d2774..c80503f 100644
--- a/drivers/gpu/drm/ipk/Makefile
+++ b/drivers/gpu/drm/ipk/Makefile
@@ -4,3 +4,5 @@ ipk-drm-y := \
dw-vpg.o
 
 obj-$(CONFIG_DRM_IPK) += ipk-drm.o
+
+obj-$(CONFIG_DRM_IPK_DSI) += dw-mipi-dsi-ipk.o
diff --git a/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c 
b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c
new file mode 100644
index 000..070eccb
--- /dev/null
+++ b/drivers/gpu/drm/ipk/dw-mipi-dsi-ipk.c
@@ -0,0 +1,556 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019-2020 Synopsys, Inc. and/or its affiliates.
+ * Synopsys DesignWare MIPI DSI solution driver
+ *
+ * Author: Angelo Ribeiro 
+ * Author: Luis Oliveira 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define DW_DPHY_LPCLK_CTRL 0x94
+#define DW_DPHY_RSTZ   0xA0
+#define DW_DPHY_IF_CFG 0xA4
+#define DW_DPHY_ULPS_CTRL  0xA8
+#define DW_DPHY_TX_TRIGGERS0xAC
+#define DW_DPHY_STATUS 0xB0
+#define DW_DPHY_TST_CTRL0  0xB4
+#define DW_DPHY_TST_CTRL1  0xB8
+#define DW_GEN3_IF_TESTER  0x3c
+#define DW_GEN3_IF_SOC_PLL 0x48
+#define DW_GEN3_IF_SOC_PLL_EN  0x4C
+
+#define DW_12BITS_DPHY_RDY_L0  0x507
+#define DW_12BITS_DPHY_RDY_L1  0x707
+#define DW_12BITS_DPHY_RDY_L2  0x907
+#define DW_12BITS_DPHY_RDY_L3  0xB07
+
+#define DW_LANE_MIN_KBPS   8
+#define DW_LANE_MAX_KBPS   25
+#define DW_DPHY_DIV_UPPER_LIMIT8000
+#define DW_DPHY_DIV_LOWER_LIMIT2000
+#define DW_MIN_OUTPUT_FREQ 80
+#define DW_LPHS_TIM_TRANSIONS  0x40
+
+enum dw_glueiftester {
+   GLUE_LOGIC = 0x4,
+   RX_PHY = 0x2,
+   TX_PHY = 0x1,
+   RESET = 0x0,
+};
+
+struct dw_range_dphy {
+   u32 freq;
+   u8 hs_freq_range;
+   u32 osc_freq_target;
+} dw_range_gen3[] = {
+   { 80, 0x00, 0x3f }, { 90, 0x10, 0x3f }, { 100, 0x20, 0x3f },
+   { 110, 0x30, 0x39 }, { 120, 0x01, 0x39 }, { 130, 0x11, 0x39 },
+   { 140, 0x21, 0x39 }, { 150, 0x31, 0x39 }, { 160, 0x02, 0x39 },
+   { 170, 0x12, 0x2f }, { 180, 0x22, 0x2f }, { 190, 0x32, 0x2f },
+   { 205, 0x03, 0x2f }, { 220, 0x13, 0x29 }, { 235, 0x23, 0x29 },
+   { 250, 0x33, 0x29 }, { 275, 0x04, 0x29 }, { 300, 0x14, 0x29 },
+   { 325, 0x25, 0x29 }, { 350, 0x35, 0x1f }, { 400, 0x05, 0x1f },
+   { 450, 0x16, 0x19 }, { 500, 0x26, 0x19 }, { 550, 0x37, 0x19 },
+   { 600, 0x07, 0x19 }, { 650, 0x18, 0x19 }, { 700, 0x28, 0x0f },
+   { 750, 0x39, 0x0f }, { 800, 0x09, 0x0f }, { 850, 0x19, 0x0f },
+   { 900, 0x29, 0x09 }, { 950, 0x3a, 0x09 }, { 1000, 0x0a, 0x09 },
+   { 1050, 0x1a, 0x09 }, { 1100, 0x2a, 0x09 }, { 1150, 0x3b, 0x09 },
+   { 1200, 0x0b, 0x09 }, { 1250, 0x1b, 0x09 }, { 1300, 0x2b, 0x09 },
+   { 1350, 0x3c, 0x03 }, { 1400, 0x0c, 0x03 }, { 1450, 0x1c, 0x03 },
+   { 1500, 0x2c, 0x03 }, { 1550, 0x3d, 0x03 }, { 1600, 0x0d, 0x03 },
+   { 1650, 0x1d, 0x03 }, { 1700, 0x2e, 0x03 }, { 1750, 0x3e, 0x03 },
+   { 1800, 0x0e, 0x03 }, { 1850, 0x1e, 0x03 }, { 1900, 0x2f, 0x03 },
+   { 1950, 0x3f, 0x03 }, { 2000, 0x0f, 0x03 }, { 2050, 0x40, 0x03 },
+   { 2100, 0x41, 0x03 }, { 2150, 0x42, 0x03 }, { 2200, 0x43, 0x03 },
+   { 2250, 0x44, 0x03 }, {  2300, 0x45, 0x01 }, { 2350, 0x46, 0x01 },
+   { 2400, 0x47, 0x01 }, {  2450, 0x48, 0x01 }, { 2500, 0x49, 0x01 }
+};
+
+struct dw_dsi_ipk {
+   void __iomem *base;
+   void __iomem *base_phy;
+   struct clk *pllref_clk;
+   struct dw_mipi_dsi *dsi;
+   u32 lane_min_kbps;
+   u32 lane_max_kbps;
+   int range;
+   int in_div;
+   int loop_div;
+};
+
+#define dw_mipi_dsi_to_dw_dsi_ipk(target)