Skip to content

Commit c2671a2

Browse files
Yannick FertrePatrice Chotard
authored andcommitted
video: stm32: ltdc: Set configuration register masks to 12 bits
The display configuration registers vary between LTDC IP versions. The registers controlling height settings are 11 or 12-bit based. Therefore, the masks must be updated depending on the LTDC IP version. Change-Id: Idcffa08941ff681917273e28a5937e5c71765745 Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com> Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/444327 ACI: CITOOLS <MDG-smet-aci-reviews@list.st.com> ACI: CIBUILD <MDG-smet-aci-builds@list.st.com> Reviewed-by: Patrice CHOTARD <patrice.chotard@foss.st.com>
1 parent 8368138 commit c2671a2

1 file changed

Lines changed: 38 additions & 11 deletions

File tree

drivers/video/stm32/stm32_ltdc.c

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct stm32_ltdc_priv {
4444
u32 bg_col_argb;
4545
const u32 *layer_regs;
4646
const u32 *pix_fmt_hw;
47+
const u32 *conf_regs;
4748
u32 crop_x, crop_y, crop_w, crop_h;
4849
u32 alpha;
4950
u32 hw_version;
@@ -154,6 +155,28 @@ static const u32 layer_regs_a2[] = {
154155
0x178 /* L1 Flexible Pixel Format 1 */
155156
};
156157

158+
static const u32 ltdc_conf_regs_a0[] = {
159+
GENMASK(10, 0), /* Vertical Synchronization Height */
160+
GENMASK(27, 16), /* Horizontal Synchronization Width */
161+
GENMASK(10, 0), /* Accumulated Vertical Back Porch */
162+
GENMASK(27, 16), /* Accumulated Horizontal Back Porch */
163+
GENMASK(10, 0), /* Accumulated Active Height */
164+
GENMASK(27, 16), /* Accumulated Active Width */
165+
GENMASK(10, 0), /* TOTAL Height */
166+
GENMASK(27, 16) /* TOTAL Width */
167+
};
168+
169+
static const u32 ltdc_conf_regs_a1[] = {
170+
GENMASK(11, 0), /* Vertical Synchronization Height */
171+
GENMASK(27, 16), /* Horizontal Synchronization Width */
172+
GENMASK(11, 0), /* Accumulated Vertical Back Porch */
173+
GENMASK(27, 16), /* Accumulated Horizontal Back Porch */
174+
GENMASK(11, 0), /* Accumulated Active Height */
175+
GENMASK(27, 16), /* Accumulated Active Width */
176+
GENMASK(11, 0), /* TOTAL Height */
177+
GENMASK(27, 16) /* TOTAL Width */
178+
};
179+
157180
/* LTDC main registers */
158181
#define LTDC_IDR 0x00 /* IDentification */
159182
#define LTDC_LCR 0x04 /* Layer Count */
@@ -211,17 +234,14 @@ static const u32 layer_regs_a2[] = {
211234
#define LTDC_L1FPF1R (priv->layer_regs[30]) /* L1 Flexible Pixel Format 1 */
212235

213236
/* Bit definitions */
214-
#define SSCR_VSH GENMASK(10, 0) /* Vertical Synchronization Height */
215-
#define SSCR_HSW GENMASK(27, 16) /* Horizontal Synchronization Width */
216-
217-
#define BPCR_AVBP GENMASK(10, 0) /* Accumulated Vertical Back Porch */
218-
#define BPCR_AHBP GENMASK(27, 16) /* Accumulated Horizontal Back Porch */
219-
220-
#define AWCR_AAH GENMASK(10, 0) /* Accumulated Active Height */
221-
#define AWCR_AAW GENMASK(27, 16) /* Accumulated Active Width */
222-
223-
#define TWCR_TOTALH GENMASK(10, 0) /* TOTAL Height */
224-
#define TWCR_TOTALW GENMASK(27, 16) /* TOTAL Width */
237+
#define SSCR_VSH (priv->conf_regs[0]) /* Vertical Synchronization Height */
238+
#define SSCR_HSW (priv->conf_regs[1]) /* Horizontal Synchronization Width */
239+
#define BPCR_AVBP (priv->conf_regs[2]) /* Accumulated Vertical Back Porch */
240+
#define BPCR_AHBP (priv->conf_regs[3]) /* Accumulated Horizontal Back Porch */
241+
#define AWCR_AAH (priv->conf_regs[4]) /* Accumulated Active Height */
242+
#define AWCR_AAW (priv->conf_regs[5]) /* Accumulated Active Width */
243+
#define TWCR_TOTALH (priv->conf_regs[6]) /* TOTAL Height */
244+
#define TWCR_TOTALW (priv->conf_regs[7]) /* TOTAL Width */
225245

226246
#define GCR_LTDCEN BIT(0) /* LTDC ENable */
227247
#define GCR_ROTEN BIT(2) /* ROTation ENable */
@@ -903,18 +923,25 @@ static int stm32_ltdc_probe(struct udevice *dev)
903923

904924
switch (priv->hw_version) {
905925
case HWVER_10200:
926+
priv->layer_regs = layer_regs_a0;
927+
priv->pix_fmt_hw = pix_fmt_a0;
928+
priv->conf_regs = ltdc_conf_regs_a0;
929+
break;
906930
case HWVER_10300:
907931
priv->layer_regs = layer_regs_a0;
908932
priv->pix_fmt_hw = pix_fmt_a0;
933+
priv->conf_regs = ltdc_conf_regs_a1;
909934
break;
910935
case HWVER_20101:
911936
priv->layer_regs = layer_regs_a1;
912937
priv->pix_fmt_hw = pix_fmt_a1;
938+
priv->conf_regs = ltdc_conf_regs_a1;
913939
break;
914940
case HWVER_40100:
915941
case HWVER_40101:
916942
priv->layer_regs = layer_regs_a2;
917943
priv->pix_fmt_hw = pix_fmt_a2;
944+
priv->conf_regs = ltdc_conf_regs_a1;
918945
break;
919946
default:
920947
return -ENODEV;

0 commit comments

Comments
 (0)