Simon Glass | 6eb4e3c | 2020-02-06 09:54:53 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright 2019 Google LLC |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
| 5 | */ |
| 6 | |
Simon Glass | 6eb4e3c | 2020-02-06 09:54:53 -0700 | [diff] [blame] | 7 | #include <dm.h> |
| 8 | #include <clk-uclass.h> |
| 9 | #include <dt-bindings/clock/intel-clock.h> |
| 10 | |
| 11 | static ulong intel_clk_get_rate(struct clk *clk) |
| 12 | { |
Simon Glass | 6eb4e3c | 2020-02-06 09:54:53 -0700 | [diff] [blame] | 13 | switch (clk->id) { |
| 14 | case CLK_I2C: |
| 15 | /* Hard-coded to 133MHz on current platforms */ |
| 16 | return 133333333; |
| 17 | default: |
| 18 | return -ENODEV; |
| 19 | } |
Simon Glass | 6eb4e3c | 2020-02-06 09:54:53 -0700 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | static struct clk_ops intel_clk_ops = { |
| 23 | .get_rate = intel_clk_get_rate, |
| 24 | }; |
| 25 | |
| 26 | static const struct udevice_id intel_clk_ids[] = { |
| 27 | { .compatible = "intel,apl-clk" }, |
| 28 | { } |
| 29 | }; |
| 30 | |
Simon Glass | 6646c57 | 2021-01-21 13:57:12 -0700 | [diff] [blame] | 31 | U_BOOT_DRIVER(intel_apl_clk) = { |
| 32 | .name = "intel_apl_clk", |
Simon Glass | 6eb4e3c | 2020-02-06 09:54:53 -0700 | [diff] [blame] | 33 | .id = UCLASS_CLK, |
| 34 | .of_match = intel_clk_ids, |
| 35 | .ops = &intel_clk_ops, |
| 36 | }; |