]>
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 SG |
9 | #include <common.h> |
10 | #include <dm.h> | |
ca831f49 | 11 | #include <pch.h> |
452f5487 | 12 | |
3e389d8b | 13 | int pch_get_spi_base(struct udevice *dev, ulong *sbasep) |
ca831f49 SG |
14 | { |
15 | struct pch_ops *ops = pch_get_ops(dev); | |
16 | ||
17 | *sbasep = 0; | |
3e389d8b | 18 | if (!ops->get_spi_base) |
ca831f49 SG |
19 | return -ENOSYS; |
20 | ||
3e389d8b | 21 | return ops->get_spi_base(dev, sbasep); |
ca831f49 SG |
22 | } |
23 | ||
ca831f49 SG |
24 | int pch_set_spi_protect(struct udevice *dev, bool protect) |
25 | { | |
26 | struct pch_ops *ops = pch_get_ops(dev); | |
27 | ||
28 | if (!ops->set_spi_protect) | |
29 | return -ENOSYS; | |
30 | ||
31 | return ops->set_spi_protect(dev, protect); | |
32 | } | |
33 | ||
384980c6 BM |
34 | int pch_get_gpio_base(struct udevice *dev, u32 *gbasep) |
35 | { | |
36 | struct pch_ops *ops = pch_get_ops(dev); | |
37 | ||
38 | *gbasep = 0; | |
39 | if (!ops->get_gpio_base) | |
40 | return -ENOSYS; | |
41 | ||
42 | return ops->get_gpio_base(dev, gbasep); | |
43 | } | |
44 | ||
79d4eb62 BM |
45 | int pch_get_io_base(struct udevice *dev, u32 *iobasep) |
46 | { | |
47 | struct pch_ops *ops = pch_get_ops(dev); | |
48 | ||
49 | *iobasep = 0; | |
50 | if (!ops->get_io_base) | |
51 | return -ENOSYS; | |
52 | ||
53 | return ops->get_io_base(dev, iobasep); | |
54 | } | |
55 | ||
1260f8c0 SG |
56 | int pch_ioctl(struct udevice *dev, ulong req, void *data, int size) |
57 | { | |
58 | struct pch_ops *ops = pch_get_ops(dev); | |
59 | ||
60 | if (!ops->ioctl) | |
61 | return -ENOSYS; | |
62 | ||
63 | return ops->ioctl(dev, req, data, size); | |
64 | } | |
65 | ||
452f5487 SG |
66 | UCLASS_DRIVER(pch) = { |
67 | .id = UCLASS_PCH, | |
68 | .name = "pch", | |
12e927b0 | 69 | #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) |
91195485 | 70 | .post_bind = dm_scan_fdt_dev, |
12e927b0 | 71 | #endif |
452f5487 | 72 | }; |