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>
10 #include <pch.h>
11
12 DECLARE_GLOBAL_DATA_PTR;
13
pch_get_spi_base(struct udevice * dev,ulong * sbasep)14 int pch_get_spi_base(struct udevice *dev, ulong *sbasep)
15 {
16 struct pch_ops *ops = pch_get_ops(dev);
17
18 *sbasep = 0;
19 if (!ops->get_spi_base)
20 return -ENOSYS;
21
22 return ops->get_spi_base(dev, sbasep);
23 }
24
pch_set_spi_protect(struct udevice * dev,bool protect)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
pch_get_gpio_base(struct udevice * dev,u32 * gbasep)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
pch_get_io_base(struct udevice * dev,u32 * iobasep)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
57 UCLASS_DRIVER(pch) = {
58 .id = UCLASS_PCH,
59 .name = "pch",
60 .post_bind = dm_scan_fdt_dev,
61 };
62