clk: scmi: Fix min and max rate when registering clocks with discrete rates
authorSudeep Holla <sudeep.holla@arm.com>
Thu, 9 Jul 2020 08:17:05 +0000 (09:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:23:28 +0000 (08:23 +0200)
commitecf0cf1147c1b916de1b876259a6fdf72dbc5ea0
treec9dfc7b9317a410698669a3427595d681b7599ad
parente966e1c761887ca928f44d3ff73df802f98338ad
clk: scmi: Fix min and max rate when registering clocks with discrete rates

[ Upstream commit fcd2e0deae50bce48450f14c8fc5611b08d7438c ]

Currently we are not initializing the scmi clock with discrete rates
correctly. We fetch the min_rate and max_rate value only for clocks with
ranges and ignore the ones with discrete rates. This will lead to wrong
initialization of rate range when clock supports discrete rate.

Fix this by using the first and the last rate in the sorted list of the
discrete clock rates while registering the clock.

Link: https://lore.kernel.org/r/20200709081705.46084-2-sudeep.holla@arm.com
Fixes: 6d6a1d82eaef7 ("clk: add support for clocks provided by SCMI")
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Reported-and-tested-by: Dien Pham <dien.pham.ry@renesas.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/clk-scmi.c