[U-Boot] [PATCH v4 3/7] rockchip: spi: rk_spi: dynamically select an module input rate

Simon Glass sjg at chromium.org
Thu Apr 20 21:05:49 UTC 2017


On 20 April 2017 at 14:05, Philipp Tomsich
<philipp.tomsich at theobroma-systems.com> wrote:
> The original clock/bitrate selection code for the rk_spi driver was a
> bit limited, as it always selected a 99MHz input clock rate (which
> would allow for a maximum bitrate of 49.5MBit/s), but returned -EINVAL
> if a bitrate higher than 48MHz was requested.
>
> To give us better control over the bitrate (i.e. add more operating
> points, especially at "higher" bitrate---such as above 9MBit/s), we
> try to choose 4x the maximum frequency (clamped to 50MBit) from the
> DTS instead of 99MHz... for most use-cases this will yield a frequency
> of 198MHz, but is flexible to go beyond this in future configurations.
>
> This also rewrites the check to allow frequencies of up to half the
> SPI module rate as bitrates and then clamps to whatever the DTS allows
> as a maximum (board-specific) frequency and does away with the -EINVAL
> when trying to select a bitrate (for cases that exceeded the hard
> limit) and instead consistently clamps to the lower of the hard limit,
> the soft limit for the SPI bus (from the DTS) or the soft limit for
> the SPI slave device.
>
> This replaces
>   "rockchip: spi: rk_spi: select 198MHz input to the SPI module for the RK3399"
>   "rockchip: spi: rk_spi: improve clocking code for the RK3399"
> from earlier versions of this series.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich at theobroma-systems.com>
>
> ---
>
> Changes in v4:
> - rewrite to not introduce a chip-specific define, add a dynamic
>   module input rate selection and unify the bitrate handling for hard
>   and soft limits.
>   (replaces 2 earlier commits mentioned in the commit message)
>
> Changes in v3: None
> Changes in v2: None
>
>  drivers/spi/rk_spi.c | 36 +++++++++++++++++++++++++++++-------
>  drivers/spi/rk_spi.h |  9 ++++++++-
>  2 files changed, 37 insertions(+), 8 deletions(-)

Applied to u-boot-rockchip/next, thanks!


More information about the U-Boot mailing list