| 14 | #include <drivers/platform.h> |
| 15 | |
| 16 | static rt_err_t fixed_clk_ofw_init(struct rt_platform_device *pdev, struct rt_clk_fixed_rate *clk_fixed) |
| 17 | { |
| 18 | rt_err_t err = RT_EOK; |
| 19 | rt_uint32_t rate, accuracy; |
| 20 | struct rt_ofw_node *np = pdev->parent.ofw_node; |
| 21 | const char *clk_name = np->name; |
| 22 | |
| 23 | if (!rt_ofw_prop_read_u32(np, "clock-frequency", &rate)) |
| 24 | { |
| 25 | rt_ofw_prop_read_u32(np, "clock-accuracy", &accuracy); |
| 26 | rt_ofw_prop_read_string(np, "clock-output-names", &clk_name); |
| 27 | |
| 28 | clk_fixed->clk.name = clk_name; |
| 29 | clk_fixed->clk.rate = rate; |
| 30 | clk_fixed->clk.min_rate = rate; |
| 31 | clk_fixed->clk.max_rate = rate; |
| 32 | clk_fixed->fixed_rate = rate; |
| 33 | clk_fixed->fixed_accuracy = accuracy; |
| 34 | |
| 35 | rt_ofw_data(np) = &clk_fixed->clk; |
| 36 | } |
| 37 | else |
| 38 | { |
| 39 | err = -RT_EIO; |
| 40 | } |
| 41 | |
| 42 | return err; |
| 43 | } |
| 44 | |
| 45 | static rt_err_t fixed_clk_probe(struct rt_platform_device *pdev) |
| 46 | { |
no test coverage detected