]>
Commit | Line | Data |
---|---|---|
452f5487 SG |
1 | /* |
2 | * Copyright (c) 2015 Google, Inc | |
3 | * Written by Simon Glass <sjg@chromium.org> | |
4 | * | |
5 | * SPDX-License-Identifier: GPL-2.0+ | |
6 | */ | |
7 | ||
8 | #include <common.h> | |
9 | #include <dm.h> | |
ca831f49 | 10 | #include <pch.h> |
452f5487 | 11 | |
8b097916 SG |
12 | DECLARE_GLOBAL_DATA_PTR; |
13 | ||
3e389d8b | 14 | int pch_get_spi_base(struct udevice *dev, ulong *sbasep) |
ca831f49 SG |
15 | { |
16 | struct pch_ops *ops = pch_get_ops(dev); | |
17 | ||
18 | *sbasep = 0; | |
3e389d8b | 19 | if (!ops->get_spi_base) |
ca831f49 SG |
20 | return -ENOSYS; |
21 | ||
3e389d8b | 22 | return ops->get_spi_base(dev, sbasep); |
ca831f49 SG |
23 | } |
24 | ||
ca831f49 SG |
25 | int pch_set_spi_protect(struct udevice *dev, bool protect) |
26 | { | |
27 | struct pch_ops *ops = pch_get_ops(dev); | |
28 | ||
29 | if (!ops->set_spi_protect) | |
30 | return -ENOSYS; | |
31 | ||
32 | return ops->set_spi_protect(dev, protect); | |
33 | } | |
34 | ||
384980c6 BM |
35 | int pch_get_gpio_base(struct udevice *dev, u32 *gbasep) |
36 | { | |
37 | struct pch_ops *ops = pch_get_ops(dev); | |
38 | ||
39 | *gbasep = 0; | |
40 | if (!ops->get_gpio_base) | |
41 | return -ENOSYS; | |
42 | ||
43 | return ops->get_gpio_base(dev, gbasep); | |
44 | } | |
45 | ||
79d4eb62 BM |
46 | int pch_get_io_base(struct udevice *dev, u32 *iobasep) |
47 | { | |
48 | struct pch_ops *ops = pch_get_ops(dev); | |
49 | ||
50 | *iobasep = 0; | |
51 | if (!ops->get_io_base) | |
52 | return -ENOSYS; | |
53 | ||
54 | return ops->get_io_base(dev, iobasep); | |
55 | } | |
56 | ||
452f5487 SG |
57 | UCLASS_DRIVER(pch) = { |
58 | .id = UCLASS_PCH, | |
59 | .name = "pch", | |
91195485 | 60 | .post_bind = dm_scan_fdt_dev, |
452f5487 | 61 | }; |