• Eugen Hristev's avatar
    driver: at91_slowclk: implement returning to internal RC · d9ebb82d
    Eugen Hristev authored
    We can have the following scenario:
    1) Boot the board with at91bootstrap that has CONFIG_SCLK enabled.
     It will configure the external slow oscillator.
    2) Reset board, or power down, replug.  Replace at91bootstrap with an
     at91bootstrap that has CONFIG_SCLK disabled.
     According to the at91boostrap help, this means use internal RC.
      Thus, at91boostrap will not touch this register (SLOW_CLOCK.SCKR)
    3) Result is that the external slow clock crystal is still in use.
     Not touching SCKR , combined with battery-backed configuration means
     that the old config is still in effect.
    
    This fix solves that.
    CONFIG_SCLK is now part of a choice menu: either CONFIG_SCLK=y, or
    CONFIG_SCLK_INTRC=y. When booting with CONFIG_SCLK=n, it will call the
    function to go back to internal RC. When booting with CONFIG_SCLK=y it will
    enable the external slow clock.
    If the SoC has no slow clock whatsoever, there will be none of CONFIG_SCLK
    and CONFIG_SCLK_INTRC thus no code is ca...
    d9ebb82d
main.c 3.3 KB