]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - include/pch.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2015 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
12 #define BIOS_CTRL_BIOSWE BIT(0)
14 /* All the supported PCH ioctls */
16 PCH_REQ_TEST1
, /* Test requests for sandbox driver */
20 PCH_REQ_COUNT
, /* Number of ioctrls supported */
24 * struct pch_ops - Operations for the Platform Controller Hub
26 * Consider using ioctl() to add rarely used or driver-specific operations.
30 * get_spi_base() - get the address of SPI base
32 * @dev: PCH device to check
33 * @sbasep: Returns address of SPI base if available, else 0
34 * @return 0 if OK, -ve on error (e.g. there is no SPI base)
36 int (*get_spi_base
)(struct udevice
*dev
, ulong
*sbasep
);
39 * set_spi_protect() - set whether SPI flash is protected or not
41 * @dev: PCH device to adjust
42 * @protect: true to protect, false to unprotect
44 * @return 0 on success, -ENOSYS if not implemented
46 int (*set_spi_protect
)(struct udevice
*dev
, bool protect
);
49 * get_gpio_base() - get the address of GPIO base
51 * @dev: PCH device to check
52 * @gbasep: Returns address of GPIO base if available, else 0
53 * @return 0 if OK, -ve on error (e.g. there is no GPIO base)
55 int (*get_gpio_base
)(struct udevice
*dev
, u32
*gbasep
);
58 * get_io_base() - get the address of IO base
60 * @dev: PCH device to check
61 * @iobasep: Returns address of IO base if available, else 0
62 * @return 0 if OK, -ve on error (e.g. there is no IO base)
64 int (*get_io_base
)(struct udevice
*dev
, u32
*iobasep
);
67 * ioctl() - perform misc read/write operations
69 * This is a catch-all operation intended to avoid adding lots of
70 * methods to this uclass, of which few are commonly used. Uncommon
71 * operations that pertain only to a few devices in this uclass should
72 * use this method instead of adding new methods.
74 * @dev: PCH device to check
75 * @req: PCH request ID
76 * @data: Input/output data
77 * @size: Size of input data (and maximum size of output data)
78 * @return size of output data on sucesss, -ve on error
80 int (*ioctl
)(struct udevice
*dev
, enum pch_req_t req
, void *data
,
84 #define pch_get_ops(dev) ((struct pch_ops *)(dev)->driver->ops)
87 * pch_get_spi_base() - get the address of SPI base
89 * @dev: PCH device to check
90 * @sbasep: Returns address of SPI base if available, else 0
91 * @return 0 if OK, -ve on error (e.g. there is no SPI base)
93 int pch_get_spi_base(struct udevice
*dev
, ulong
*sbasep
);
96 * set_spi_protect() - set whether SPI flash is protected or not
98 * @dev: PCH device to adjust
99 * @protect: true to protect, false to unprotect
101 * @return 0 on success, -ENOSYS if not implemented
103 int pch_set_spi_protect(struct udevice
*dev
, bool protect
);
106 * pch_get_gpio_base() - get the address of GPIO base
108 * @dev: PCH device to check
109 * @gbasep: Returns address of GPIO base if available, else 0
110 * @return 0 if OK, -ve on error (e.g. there is no GPIO base)
112 int pch_get_gpio_base(struct udevice
*dev
, u32
*gbasep
);
115 * pch_get_io_base() - get the address of IO base
117 * @dev: PCH device to check
118 * @iobasep: Returns address of IO base if available, else 0
119 * @return 0 if OK, -ve on error (e.g. there is no IO base)
121 int pch_get_io_base(struct udevice
*dev
, u32
*iobasep
);
124 * pch_ioctl() - perform misc read/write operations
126 * This is a catch-all operation intended to avoid adding lots of
127 * methods to this uclass, of which few are commonly used. Uncommon
128 * operations that pertain only to a few devices in this uclass should
129 * use this method instead of adding new methods.
131 * @dev: PCH device to check
132 * @req: PCH request ID
133 * @data: Input/output data
134 * @size: Size of input data (and maximum size of output data)
135 * @return size of output data on sucesss, -ve on error
137 int pch_ioctl(struct udevice
*dev
, ulong req
, void *data
, int size
);