[U-Boot] [ v2 06/10] video: add MIPI DSI host controller bridge

Simon Glass sjg at chromium.org
Mon Jul 16 05:20:51 UTC 2018


Hi Yannick,

On 13 July 2018 at 06:11, Yannick Fertré <yannick.fertre at st.com> wrote:
> Add a Synopsys Designware MIPI DSI host bridge driver, based on the
> Rockchip version from rockchip/dw-mipi-dsi.c with phy & bridge APIs.
>
> Signed-off-by: Yannick Fertré <yannick.fertre at st.com>
> ---
>  drivers/video/Kconfig       |   9 +
>  drivers/video/Makefile      |   1 +
>  drivers/video/dw_mipi_dsi.c | 826 ++++++++++++++++++++++++++++++++++++++++++++
>  include/dw_mipi_dsi.h       |  32 ++
>  4 files changed, 868 insertions(+)
>  create mode 100644 drivers/video/dw_mipi_dsi.c
>  create mode 100644 include/dw_mipi_dsi.h
>
> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> index e1029e5..3ccc8df 100644
> --- a/drivers/video/Kconfig
> +++ b/drivers/video/Kconfig
> @@ -674,6 +674,15 @@ config VIDEO_DW_HDMI
>           rather requires a SoC-specific glue driver to call it), it
>           can not be enabled from the configuration menu.
>
> +config VIDEO_DW_MIPI_DSI
> +       bool
> +       help
> +         Enables the common driver code for the Synopsis Designware
> +         MIPI DSI block found in SoCs from various vendors.
> +         As this does not provide any functionality by itself (but
> +         rather requires a SoC-specific glue driver to call it), it
> +         can not be enabled from the configuration menu.
> +
>  config VIDEO_SIMPLE
>         bool "Simple display driver for preconfigured display"
>         help
> diff --git a/drivers/video/Makefile b/drivers/video/Makefile
> index 018343f..bb2fd3c 100644
> --- a/drivers/video/Makefile
> +++ b/drivers/video/Makefile
> @@ -52,6 +52,7 @@ obj-$(CONFIG_FORMIKE) += formike.o
>  obj-$(CONFIG_LG4573) += lg4573.o
>  obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
>  obj-$(CONFIG_VIDEO_DW_HDMI) += dw_hdmi.o
> +obj-$(CONFIG_VIDEO_DW_MIPI_DSI) += dw_mipi_dsi.o
>  obj-${CONFIG_VIDEO_MIPI_DSI} += mipi_display.o
>  obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o
>  obj-${CONFIG_VIDEO_TEGRA124} += tegra124/
> diff --git a/drivers/video/dw_mipi_dsi.c b/drivers/video/dw_mipi_dsi.c
> new file mode 100644
> index 0000000..db278c5
> --- /dev/null
> +++ b/drivers/video/dw_mipi_dsi.c
> @@ -0,0 +1,826 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2016, Fuzhou Rockchip Electronics Co., Ltd
> + * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
> + * Author(s): Philippe Cornu <philippe.cornu at st.com> for STMicroelectronics.
> + *            Yannick Fertre <yannick.fertre at st.com> for STMicroelectronics.
> + *
> + * This generic Synopsys DesignWare MIPI DSI host driver is inspired from
> + * the Linux Kernel driver drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c.
> + */
> +
> +#include <common.h>
> +#include <clk.h>
> +#include <dm.h>
> +#include <errno.h>
> +#include <mipi_display.h>
> +#include <panel.h>
> +#include <video.h>
> +#include <asm/io.h>
> +#include <asm/arch/gpio.h>
> +#include <dm/device-internal.h>
> +#include <dw_mipi_dsi.h>
> +#include <linux/iopoll.h>
> +#include <video_bridge.h>

Please check the ordering here.

> +
> +#define HWVER_131                      0x31333100      /* IP version 1.31 */
> +
> +#define DSI_VERSION                    0x00
> +#define VERSION                                GENMASK(31, 8)
> +
> +#define DSI_PWR_UP                     0x04
> +#define RESET                          0
> +#define POWERUP                                BIT(0)
> +
> +#define DSI_CLKMGR_CFG                 0x08
> +#define TO_CLK_DIVISION(div)           (((div) & 0xff) << 8)
> +#define TX_ESC_CLK_DIVISION(div)       ((div) & 0xff)

Instead of this can you use something like:

#define TO_CLK_DIVISION_SHIFT  8
#define TO_CLK_DIVISION_MASK (0xff << TO_CLK_DIVISION_SHIFT)

then do the shift in the code which need it below.

xxx << TO_CLK_DIVISION_SHIFT


> diff --git a/include/dw_mipi_dsi.h b/include/dw_mipi_dsi.h
> new file mode 100644
> index 0000000..f8482f7
> --- /dev/null
> +++ b/include/dw_mipi_dsi.h
> @@ -0,0 +1,32 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Copyright (C) 2017-2018, STMicroelectronics - All Rights Reserved
> + *
> + * Authors: Yannick Fertre <yannick.fertre at st.com>
> + *          Philippe Cornu <philippe.cornu at st.com>
> + *
> + * This generic Synopsys DesignWare MIPI DSI host include is inspired from
> + * the Linux Kernel include file include/drm/bridge/dw_mipi_dsi.h.
> + */
> +
> +#ifndef __DW_MIPI_DSI__
> +#define __DW_MIPI_DSI__
> +
> +#include <mipi_display.h>
> +
> +struct dw_mipi_dsi_phy_ops {
> +       int (*init)(void *priv_data);
> +       int (*get_lane_mbps)(void *priv_data, struct display_timing *timings,
> +                            u32 lanes, u32 format, unsigned int *lane_mbps);
> +};
> +
> +struct dw_mipi_dsi_plat_data {
> +       unsigned int max_data_lanes;
> +       const struct dw_mipi_dsi_phy_ops *phy_ops;
> +       struct udevice *panel;
> +};
> +
> +int dw_mipi_dsi_init_bridge(struct mipi_dsi_device *device);
> +void dw_mipi_dsi_bridge_enable(struct mipi_dsi_device *device);

This should be in a uclass I think.

Regards
Simon


More information about the U-Boot mailing list