blob: af794eb5a128e845b84bd6fe996544b01feb43dd [file] [log] [blame]
Simon Glassca831f42016-01-18 20:19:17 -07001/*
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>
Simon Glassca831f42016-01-18 20:19:17 -070011
12DECLARE_GLOBAL_DATA_PTR;
13
Bin Meng3e389d82016-02-01 01:40:42 -080014int pch_get_spi_base(struct udevice *dev, ulong *sbasep)
Simon Glassca831f42016-01-18 20:19:17 -070015{
16 struct pch_ops *ops = pch_get_ops(dev);
17
18 *sbasep = 0;
Bin Meng3e389d82016-02-01 01:40:42 -080019 if (!ops->get_spi_base)
Simon Glassca831f42016-01-18 20:19:17 -070020 return -ENOSYS;
21
Bin Meng3e389d82016-02-01 01:40:42 -080022 return ops->get_spi_base(dev, sbasep);
Simon Glassca831f42016-01-18 20:19:17 -070023}
24
Simon Glassca831f42016-01-18 20:19:17 -070025int 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
Bin Meng384980c2016-02-01 01:40:43 -080035int 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
Bin Meng79d4eb62016-02-01 01:40:45 -080046int 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
Simon Glassca831f42016-01-18 20:19:17 -070057UCLASS_DRIVER(pch) = {
58 .id = UCLASS_PCH,
59 .name = "pch",
Simon Glass91195482016-07-05 17:10:10 -060060 .post_bind = dm_scan_fdt_dev,
Simon Glassca831f42016-01-18 20:19:17 -070061};