• Linus Walleij's avatar
    clk: ux500: Implement the missing CLKOUT clocks · 639d5661
    Linus Walleij authored
    This implements the two missing CLKOUT clocks for the ux500
    (well really U8500/DB8500) SoC.
    
    The clocks are initialized using a specific parent and
    divider and these are specified in the device tree, see
    the separate binding patch.
    
    The implementation is a bit different in that it will only
    create the clock in the clock framework if a user appears
    in the device tree, rather than it being registered upfront
    like most of the other clocks. This is because the clock
    needs parameters for source and divider from the consumer
    phandle for the clock to be set up properly when the clock
    is registered.
    
    There could be more than one user of a CLKOUT clock, but
    we have not seen this in practice. If this happens the
    framework prints and info and returns the previously
    registered clock.
    
    Using the clocks requires also muxing the CLKOUT1 or
    CLKOUT2 to the appropriate pad. In practice this is
    achived in a pinctrl handle in the DTS node for the device
    using the CLKOUT clock, so this muxing is done separately
    from the clock itself. Example:
    
      haptic@49 {
        compatible = "immersion,isa1200";
        reg = <0x49>;
        (...)
        /* clkout1 from ACLK divided by 8 */
        clocks = <&clkout_clk DB8500_CLKOUT_1 DB8500_CLKOUT_SRC_ACLK 8>;
        pinctrl-names = "default";
        pinctrl-0 = <&isa1200_janice_default>;
      };
    
      isa1200_janice_default: isa1200_janice {
        /* Bring out clkout1 on pin GPIO227 pin AH7 */
        janice_mux {
          function = "clkout";
          groups = "clkout1_a_1";
        };
        janice_cfg1 {
          pins = "GPIO227_AH7";
          ste,config = <&out_lo>;
        };
      (...)
    
    This was tested successfully with the Immersion ISA1200
    haptic feedback unit on the Samsung Galaxy S Advance GT-I9070
    (Janice) mobile phone.
    
    As the CLKOUT clocks need some undefined fixed rate parent
    clocks that are currently missing from the PRCMU clock
    implementation, the three simplest are added in this patch:
    clk38m_to_clkgen, aclk and sysclk. The only parent not yet
    available in the implementation is clk009, which is a kind
    of special muxed and divided clock which isn't even
    implemented in the vendor clock driver.
    Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Link: https://lore.kernel.org/r/20220414221751.323525-6-linus.walleij@linaro.orgSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
    639d5661
clk.h 2.48 KB