Skip to content

Commit eedd603

Browse files
committed
drm/pl111: Support variants with broken clock divider
The early Integrator CLCD synthesized in the Integrator CP and IM-PD1 FPGAs are broken: their clock dividers do not work properly. Support disabling the clock divider and drive the clock directly from the parent under these circumstances. Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 6470b7d commit eedd603

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

drivers/gpu/drm/pl111/pl111_display.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe,
138138
tim2 = readl(priv->regs + CLCD_TIM2);
139139
tim2 &= (TIM2_BCD | TIM2_PCD_LO_MASK | TIM2_PCD_HI_MASK);
140140

141+
if (priv->variant->broken_clockdivider)
142+
tim2 |= TIM2_BCD;
143+
141144
if (mode->flags & DRM_MODE_FLAG_NHSYNC)
142145
tim2 |= TIM2_IHS;
143146

@@ -455,6 +458,11 @@ pl111_init_clock_divider(struct drm_device *drm)
455458
dev_err(drm->dev, "CLCD: unable to get clcdclk.\n");
456459
return PTR_ERR(parent);
457460
}
461+
/* If the clock divider is broken, use the parent directly */
462+
if (priv->variant->broken_clockdivider) {
463+
priv->clk = parent;
464+
return 0;
465+
}
458466
parent_name = __clk_get_name(parent);
459467

460468
spin_lock_init(&priv->tim2_lock);

drivers/gpu/drm/pl111/pl111_drm.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,16 @@ struct drm_minor;
3838
* @is_pl110: this is the early PL110 variant
3939
* @external_bgr: this is the Versatile Pl110 variant with external
4040
* BGR/RGB routing
41+
* @broken_clockdivider: the clock divider is broken and we need to
42+
* use the supplied clock directly
4143
* @formats: array of supported pixel formats on this variant
4244
* @nformats: the length of the array of supported pixel formats
4345
*/
4446
struct pl111_variant_data {
4547
const char *name;
4648
bool is_pl110;
4749
bool external_bgr;
50+
bool broken_clockdivider;
4851
const u32 *formats;
4952
unsigned int nformats;
5053
};

drivers/gpu/drm/pl111/pl111_versatile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ static const u32 pl110_versatile_pixel_formats[] = {
237237
static const struct pl111_variant_data pl110_integrator = {
238238
.name = "PL110 Integrator",
239239
.is_pl110 = true,
240+
.broken_clockdivider = true,
240241
.formats = pl110_integrator_pixel_formats,
241242
.nformats = ARRAY_SIZE(pl110_integrator_pixel_formats),
242243
};

0 commit comments

Comments
 (0)