2 * Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
3 * Copyright (c) 2015 Google, Inc
4 * Copyright 2014 Rockchip Inc.
6 * SPDX-License-Identifier: GPL-2.0+
15 #include <asm/hardware.h>
17 #include <asm/arch/clock.h>
18 #include <asm/arch/grf_rk3288.h>
21 DECLARE_GLOBAL_DATA_PTR;
23 static void rk3288_set_pin_polarity(struct udevice *dev,
24 enum vop_modes mode, u32 polarity)
26 struct rk_vop_priv *priv = dev_get_priv(dev);
27 struct rk3288_vop *regs = priv->regs;
29 /* The RK3328 VOP (v3.1) has its polarity configuration in ctrl0 */
30 clrsetbits_le32(®s->dsp_ctrl0,
31 M_DSP_DCLK_POL | M_DSP_DEN_POL |
32 M_DSP_VSYNC_POL | M_DSP_HSYNC_POL,
33 V_DSP_PIN_POL(polarity));
36 static void rk3288_set_io_vsel(struct udevice *dev)
38 struct rk3288_grf *grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
40 /* lcdc(vop) iodomain select 1.8V */
41 rk_setreg(&grf->io_vsel, 1 << 0);
45 * Try some common regulators. We should really get these from the
46 * device tree somehow.
48 static const char * const rk3288_regulator_names[] = {
57 static int rk3288_vop_probe(struct udevice *dev)
59 /* Before relocation we don't need to do anything */
60 if (!(gd->flags & GD_FLG_RELOC))
63 /* Set the LCDC(vop) iodomain to 1.8V */
64 rk3288_set_io_vsel(dev);
66 /* Probe regulators required for the RK3288 VOP */
67 rk_vop_probe_regulators(dev, rk3288_regulator_names,
68 ARRAY_SIZE(rk3288_regulator_names));
70 return rk_vop_probe(dev);
73 struct rkvop_driverdata rk3288_driverdata = {
74 .features = VOP_FEATURE_OUTPUT_10BIT,
75 .set_pin_polarity = rk3288_set_pin_polarity,
78 static const struct udevice_id rk3288_vop_ids[] = {
79 { .compatible = "rockchip,rk3288-vop",
80 .data = (ulong)&rk3288_driverdata },
84 static const struct video_ops rk3288_vop_ops = {
87 U_BOOT_DRIVER(rk_vop) = {
90 .of_match = rk3288_vop_ids,
91 .ops = &rk3288_vop_ops,
93 .probe = rk3288_vop_probe,
94 .priv_auto_alloc_size = sizeof(struct rk_vop_priv),