• Stuart Menefy's avatar
    tty: serial: samsung: Enable baud clock during initialisation · 5086e0a4
    Stuart Menefy authored
    The Exynos 5260, like the 5433, appears to require baud clock as
    well as pclk to be running before accessing any of the registers,
    otherwise an external abort is raised.
    
    The serial driver already enables baud clock when required, but only
    if it knows which clock is baud clock. On older SoCs baud clock may be
    selected from a number of possible clocks so to support this the driver
    only selects which clock to use for baud clock when a port is opened,
    at which point the desired baud rate is known and the best clock can be
    selected.
    
    The result is that there are a number of circumstances in which
    registers are accessed without first explicitly enabling baud clock:
     - while the driver is being initialised
     - the initial parts of opening a port for the first time
     - when resuming if the port hasn't been already opened
    
    The 5433 overcomes this currently by marking the baud clock as
    CLK_IGNORE_UNUSED, so the clock is always enabled, however
    for the 5260 I've been trying to avoid this.
    
    This change adds code to pick the first available clock to use
    as baud clock and enables it while initialising the driver.
    
    This code wouldn't be sufficient on a SoC which supports
    multiple possible baud clock sources _and_ requires the
    correct baud clock to be enabled before accessing any of the
    serial port registers (in particular the register which selects
    which clock to use as the baud clock).  As far as I know
    such hardware doesn't exist.
    Signed-off-by: default avatarStuart Menefy <stuart.menefy@mathembedded.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    5086e0a4
samsung.c 64.8 KB