Simon Glass | 68a2423 | 2016-01-18 20:19:17 -0700 | [diff] [blame] | 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> |
Simon Glass | 68a2423 | 2016-01-18 20:19:17 -0700 | [diff] [blame] | 11 | |
Bin Meng | 06d66af | 2016-02-01 01:40:42 -0800 | [diff] [blame] | 12 | int pch_get_spi_base(struct udevice *dev, ulong *sbasep) |
Simon Glass | 68a2423 | 2016-01-18 20:19:17 -0700 | [diff] [blame] | 13 | { |
| 14 | struct pch_ops *ops = pch_get_ops(dev); |
| 15 | |
| 16 | *sbasep = 0; |
Bin Meng | 06d66af | 2016-02-01 01:40:42 -0800 | [diff] [blame] | 17 | if (!ops->get_spi_base) |
Simon Glass | 68a2423 | 2016-01-18 20:19:17 -0700 | [diff] [blame] | 18 | return -ENOSYS; |
| 19 | |
Bin Meng | 06d66af | 2016-02-01 01:40:42 -0800 | [diff] [blame] | 20 | return ops->get_spi_base(dev, sbasep); |
Simon Glass | 68a2423 | 2016-01-18 20:19:17 -0700 | [diff] [blame] | 21 | } |
| 22 | |
Simon Glass | 68a2423 | 2016-01-18 20:19:17 -0700 | [diff] [blame] | 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 | |
Bin Meng | 8fec3e1 | 2016-02-01 01:40:43 -0800 | [diff] [blame] | 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 | |
Bin Meng | b9c951d | 2016-02-01 01:40:45 -0800 | [diff] [blame] | 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 | |
Simon Glass | 68a2423 | 2016-01-18 20:19:17 -0700 | [diff] [blame] | 55 | UCLASS_DRIVER(pch) = { |
| 56 | .id = UCLASS_PCH, |
| 57 | .name = "pch", |
Simon Glass | 1823034 | 2016-07-05 17:10:10 -0600 | [diff] [blame] | 58 | .post_bind = dm_scan_fdt_dev, |
Simon Glass | 68a2423 | 2016-01-18 20:19:17 -0700 | [diff] [blame] | 59 | }; |