diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 96386ffc8483..216d62968957 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -271,6 +271,10 @@ static int _next_div(const struct clk_div_table *table, int div, return __roundup_pow_of_two(div); if (table) return _round_up_table(table, div); +#ifdef CONFIG_AMLOGIC_MODIFY + if ((flags & CLK_DIVIDER_PROHIBIT_ZERO) && (div == 1)) + div++; +#endif return div; } diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index a428aec36ace..9116cb293c7d 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -385,6 +385,8 @@ struct clk_div_table { * CLK_DIVIDER_MAX_AT_ZERO - For dividers which are like CLK_DIVIDER_ONE_BASED * except when the value read from the register is zero, the divisor is * 2^width of the field. + * CLK_DIVIDER_PROHIBIT_ZERO - Prohibit value 0 of register(no bypass, enable by + * CONFIG_AMLOGIC_MODIFY). */ struct clk_divider { struct clk_hw hw; @@ -405,6 +407,9 @@ struct clk_divider { #define CLK_DIVIDER_ROUND_CLOSEST BIT(4) #define CLK_DIVIDER_READ_ONLY BIT(5) #define CLK_DIVIDER_MAX_AT_ZERO BIT(6) +#ifdef CONFIG_AMLOGIC_MODIFY +#define CLK_DIVIDER_PROHIBIT_ZERO BIT(7) +#endif extern const struct clk_ops clk_divider_ops; extern const struct clk_ops clk_divider_ro_ops;