diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c index 2e68d88ad9fd19..e882d298df348f 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -282,6 +282,33 @@ unsigned long rpi_firmware_clk_get_max_rate(struct clk *clk) } EXPORT_SYMBOL_GPL(rpi_firmware_clk_get_max_rate); +unsigned long rpi_firmware_clk_get_min_rate(struct clk *clk) +{ + const struct raspberrypi_clk_data *data; + struct raspberrypi_clk *rpi; + struct clk_hw *hw; + u32 min_rate; + int ret; + + if (!clk) + return 0; + + hw = __clk_get_hw(clk); + if (!hw) + return 0; + + data = clk_hw_to_data(hw); + rpi = data->rpi; + ret = raspberrypi_clock_property(rpi->firmware, data, + RPI_FIRMWARE_GET_MIN_CLOCK_RATE, + &min_rate); + if (ret) + return 0; + + return min_rate; +} +EXPORT_SYMBOL_GPL(rpi_firmware_clk_get_min_rate); + static const struct clk_ops raspberrypi_firmware_clk_ops = { .is_prepared = raspberrypi_fw_is_prepared, .recalc_rate = raspberrypi_fw_get_rate, diff --git a/include/soc/bcm2835/raspberrypi-clocks.h b/include/soc/bcm2835/raspberrypi-clocks.h index ff0b608b51a88b..62753587796495 100644 --- a/include/soc/bcm2835/raspberrypi-clocks.h +++ b/include/soc/bcm2835/raspberrypi-clocks.h @@ -5,11 +5,17 @@ #if IS_ENABLED(CONFIG_CLK_RASPBERRYPI) unsigned long rpi_firmware_clk_get_max_rate(struct clk *clk); +unsigned long rpi_firmware_clk_get_min_rate(struct clk *clk); #else static inline unsigned long rpi_firmware_clk_get_max_rate(struct clk *clk) { return ULONG_MAX; } + +static inline unsigned long rpi_firmware_clk_get_min_rate(struct clk *clk) +{ + return 0; +} #endif #endif /* __SOC_RASPBERRY_CLOCKS_H__ */