• Serge Semin's avatar
    clk: Add Baikal-T1 CCU Dividers driver · 353afa3a
    Serge Semin authored
    Nearly each Baikal-T1 IP-core is supposed to have a clock source
    of particular frequency. But since there are greater than five
    IP-blocks embedded into the SoC, the CCU PLLs can't fulfill all the
    needs. Baikal-T1 CCU provides a set of fixed and configurable clock
    dividers in order to generate a necessary signal for each chip
    sub-block.
    
    This driver creates the of-based hardware clocks for each divider
    available in Baikal-T1 CCU. The same way as for PLLs we split the
    functionality up into the clocks operations (gate, ungate, set rate,
    etc) and hardware clocks declaration/registration procedures.
    
    In accordance with the CCU documentation all its dividers are distributed
    into two CCU sub-blocks: AXI-bus and system devices reference clocks.
    The former sub-block is used to supply the clocks for AXI-bus interfaces
    (AXI clock domains) and the later one provides the SoC IP-cores reference
    clocks. Each sub-block is represented by a dedicated DT node, so they
    have different compatible strings to distinguish one from another.
    
    For some reason CCU provides the dividers of different types. Some
    dividers can be gateable some can't, some are fixed while the others
    are variable, some have special divider' limitations, some've got a
    non-standard register layout and so on. In order to cover all of these
    cases the hardware clocks driver is designed with an info-descriptor
    pattern. So there are special static descriptors declared for the
    dividers of each type with additional flags describing the block
    peculiarity. These descriptors are then used to create hardware clocks
    with proper operations.
    
    Some CCU dividers provide a way to reset a domain they generate
    a clock for. So the CCU AXI-bus and CCU system devices clock
    drivers also perform the reset controller registration.
    Signed-off-by: default avatarSerge Semin <Sergey.Semin@baikalelectronics.ru>
    Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Rob Herring <robh+dt@kernel.org>
    Cc: linux-mips@vger.kernel.org
    Cc: devicetree@vger.kernel.org
    Link: https://lore.kernel.org/r/20200526222056.18072-5-Sergey.Semin@baikalelectronics.ru
    [sboyd@kernel.org: Drop return from void function, silence sparse
    warnings about initializing structs with NULL vs. integer]
    Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
    353afa3a
clk-ccu-div.c 13.1 KB