clk-factors.h 886 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef __MACH_SUNXI_CLK_FACTORS_H
  2. #define __MACH_SUNXI_CLK_FACTORS_H
  3. #include <linux/clk-provider.h>
  4. #include <linux/clkdev.h>
  5. #include <linux/spinlock.h>
  6. #define SUNXI_FACTORS_NOT_APPLICABLE (0)
  7. struct clk_factors_config {
  8. u8 nshift;
  9. u8 nwidth;
  10. u8 kshift;
  11. u8 kwidth;
  12. u8 mshift;
  13. u8 mwidth;
  14. u8 pshift;
  15. u8 pwidth;
  16. u8 n_start;
  17. };
  18. struct factors_data {
  19. int enable;
  20. int mux;
  21. int muxmask;
  22. struct clk_factors_config *table;
  23. void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p);
  24. const char *name;
  25. };
  26. struct clk_factors {
  27. struct clk_hw hw;
  28. void __iomem *reg;
  29. struct clk_factors_config *config;
  30. void (*get_factors) (u32 *rate, u32 parent, u8 *n, u8 *k, u8 *m, u8 *p);
  31. spinlock_t *lock;
  32. };
  33. struct clk *sunxi_factors_register(struct device_node *node,
  34. const struct factors_data *data,
  35. spinlock_t *lock,
  36. void __iomem *reg);
  37. #endif