blob: 73994b8343f72547fb8f555b503f0cdb6f8fe418 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glassca831f42016-01-18 20:19:17 -07002/*
3 * Copyright (c) 2015 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
Simon Glassca831f42016-01-18 20:19:17 -07005 */
6
7#ifndef __pch_h
8#define __pch_h
9
Simon Glass1ff4f322016-01-18 20:19:18 -070010#define PCH_RCBA 0xf0
11
12#define BIOS_CTRL_BIOSWE BIT(0)
13
Simon Glassca831f42016-01-18 20:19:17 -070014/* Operations for the Platform Controller Hub */
15struct pch_ops {
16 /**
Bin Meng3e389d82016-02-01 01:40:42 -080017 * get_spi_base() - get the address of SPI base
Simon Glassca831f42016-01-18 20:19:17 -070018 *
19 * @dev: PCH device to check
20 * @sbasep: Returns address of SPI base if available, else 0
21 * @return 0 if OK, -ve on error (e.g. there is no SPI base)
22 */
Bin Meng3e389d82016-02-01 01:40:42 -080023 int (*get_spi_base)(struct udevice *dev, ulong *sbasep);
Simon Glassca831f42016-01-18 20:19:17 -070024
25 /**
Simon Glassca831f42016-01-18 20:19:17 -070026 * set_spi_protect() - set whether SPI flash is protected or not
27 *
28 * @dev: PCH device to adjust
29 * @protect: true to protect, false to unprotect
30 *
31 * @return 0 on success, -ENOSYS if not implemented
32 */
33 int (*set_spi_protect)(struct udevice *dev, bool protect);
Bin Meng384980c2016-02-01 01:40:43 -080034
35 /**
36 * get_gpio_base() - get the address of GPIO base
37 *
38 * @dev: PCH device to check
39 * @gbasep: Returns address of GPIO base if available, else 0
40 * @return 0 if OK, -ve on error (e.g. there is no GPIO base)
41 */
42 int (*get_gpio_base)(struct udevice *dev, u32 *gbasep);
Bin Meng79d4eb62016-02-01 01:40:45 -080043
44 /**
45 * get_io_base() - get the address of IO base
46 *
47 * @dev: PCH device to check
48 * @iobasep: Returns address of IO base if available, else 0
49 * @return 0 if OK, -ve on error (e.g. there is no IO base)
50 */
51 int (*get_io_base)(struct udevice *dev, u32 *iobasep);
Simon Glassca831f42016-01-18 20:19:17 -070052};
53
54#define pch_get_ops(dev) ((struct pch_ops *)(dev)->driver->ops)
55
56/**
Bin Meng3e389d82016-02-01 01:40:42 -080057 * pch_get_spi_base() - get the address of SPI base
Simon Glassca831f42016-01-18 20:19:17 -070058 *
59 * @dev: PCH device to check
60 * @sbasep: Returns address of SPI base if available, else 0
61 * @return 0 if OK, -ve on error (e.g. there is no SPI base)
62 */
Bin Meng3e389d82016-02-01 01:40:42 -080063int pch_get_spi_base(struct udevice *dev, ulong *sbasep);
Simon Glassca831f42016-01-18 20:19:17 -070064
65/**
Simon Glassca831f42016-01-18 20:19:17 -070066 * set_spi_protect() - set whether SPI flash is protected or not
67 *
68 * @dev: PCH device to adjust
69 * @protect: true to protect, false to unprotect
70 *
71 * @return 0 on success, -ENOSYS if not implemented
72 */
73int pch_set_spi_protect(struct udevice *dev, bool protect);
74
Bin Meng384980c2016-02-01 01:40:43 -080075/**
76 * pch_get_gpio_base() - get the address of GPIO base
77 *
78 * @dev: PCH device to check
79 * @gbasep: Returns address of GPIO base if available, else 0
80 * @return 0 if OK, -ve on error (e.g. there is no GPIO base)
81 */
82int pch_get_gpio_base(struct udevice *dev, u32 *gbasep);
83
Bin Meng79d4eb62016-02-01 01:40:45 -080084/**
85 * pch_get_io_base() - get the address of IO base
86 *
87 * @dev: PCH device to check
88 * @iobasep: Returns address of IO base if available, else 0
89 * @return 0 if OK, -ve on error (e.g. there is no IO base)
90 */
91int pch_get_io_base(struct udevice *dev, u32 *iobasep);
92
Simon Glassca831f42016-01-18 20:19:17 -070093#endif