• Tomi Valkeinen's avatar
    drm: rcar-du: Fix setting a reserved bit in DPLLCR · 5fbc2f3b
    Tomi Valkeinen authored
    On H3 ES1.x two bits in DPLLCR are used to select the DU input dot clock
    source. These are bits 20 and 21 for DU2, and bits 22 and 23 for DU1. On
    non-ES1.x, only the higher bits are used (bits 21 and 23), and the lower
    bits are reserved and should be set to 0.
    
    The current code always sets the lower bits, even on non-ES1.x.
    
    For both DU1 and DU2, on all SoC versions, when writing zeroes to those
    bits the input clock is DCLKIN, and thus there's no difference between
    ES1.x and non-ES1.x.
    
    For DU1, writing 0b10 to the bits (or only writing the higher bit)
    results in using PLL0 as the input clock, so in this case there's also
    no difference between ES1.x and non-ES1.x.
    
    However, for DU2, writing 0b10 to the bits results in using PLL0 as the
    input clock on ES1.x, whereas on non-ES1.x it results in using PLL1. On
    ES1.x you need to write 0b11 to select PLL1.
    
    The current code always writes 0b11 to PLCS0 field to select PLL1 on all
    SoC versions, which works but causes an illegal (in the sense of not
    allowed by the documentation) write to a reserved bit field.
    
    To remove the illegal bit write on PLSC0 we need to handle the input dot
    clock selection differently for ES1.x and non-ES1.x.
    
    Add a new quirk, RCAR_DU_QUIRK_H3_ES1_PLL, for this. This way we can
    always set the bit 21 on PLSC0 when choosing the PLL as the source
    clock, and additionally set the bit 20 when on ES1.x.
    Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
    Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    5fbc2f3b
rcar_du_regs.h 15.8 KB