]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
452f5487 SG |
2 | /* |
3 | * Copyright (c) 2015 Google, Inc | |
4 | * Written by Simon Glass <[email protected]> | |
452f5487 SG |
5 | */ |
6 | ||
b953ec2b PD |
7 | #define LOG_CATEGORY UCLASS_PCH |
8 | ||
452f5487 | 9 | #include <dm.h> |
ca831f49 | 10 | #include <pch.h> |
452f5487 | 11 | |
3e389d8b | 12 | int pch_get_spi_base(struct udevice *dev, ulong *sbasep) |
ca831f49 SG |
13 | { |
14 | struct pch_ops *ops = pch_get_ops(dev); | |
15 | ||
16 | *sbasep = 0; | |
3e389d8b | 17 | if (!ops->get_spi_base) |
ca831f49 SG |
18 | return -ENOSYS; |
19 | ||
3e389d8b | 20 | return ops->get_spi_base(dev, sbasep); |
ca831f49 SG |
21 | } |
22 | ||
ca831f49 SG |
23 | int pch_set_spi_protect(struct udevice *dev, bool protect) |
24 | { | |
25 | struct pch_ops *ops = pch_get_ops(dev); | |
26 | ||
27 | if (!ops->set_spi_protect) | |
28 | return -ENOSYS; | |
29 | ||
30 | return ops->set_spi_protect(dev, protect); | |
31 | } | |
32 | ||
384980c6 BM |
33 | int pch_get_gpio_base(struct udevice *dev, u32 *gbasep) |
34 | { | |
35 | struct pch_ops *ops = pch_get_ops(dev); | |
36 | ||
37 | *gbasep = 0; | |
38 | if (!ops->get_gpio_base) | |
39 | return -ENOSYS; | |
40 | ||
41 | return ops->get_gpio_base(dev, gbasep); | |
42 | } | |
43 | ||
79d4eb62 BM |
44 | int pch_get_io_base(struct udevice *dev, u32 *iobasep) |
45 | { | |
46 | struct pch_ops *ops = pch_get_ops(dev); | |
47 | ||
48 | *iobasep = 0; | |
49 | if (!ops->get_io_base) | |
50 | return -ENOSYS; | |
51 | ||
52 | return ops->get_io_base(dev, iobasep); | |
53 | } | |
54 | ||
1260f8c0 SG |
55 | int pch_ioctl(struct udevice *dev, ulong req, void *data, int size) |
56 | { | |
57 | struct pch_ops *ops = pch_get_ops(dev); | |
58 | ||
59 | if (!ops->ioctl) | |
60 | return -ENOSYS; | |
61 | ||
62 | return ops->ioctl(dev, req, data, size); | |
63 | } | |
64 | ||
452f5487 SG |
65 | UCLASS_DRIVER(pch) = { |
66 | .id = UCLASS_PCH, | |
67 | .name = "pch", | |
414cc151 | 68 | #if CONFIG_IS_ENABLED(OF_REAL) |
91195485 | 69 | .post_bind = dm_scan_fdt_dev, |
12e927b0 | 70 | #endif |
452f5487 | 71 | }; |