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 #ifndef __pch_h 9 #define __pch_h 10 11 #define PCH_RCBA 0xf0 12 13 #define BIOS_CTRL_BIOSWE BIT(0) 14 15 /* Operations for the Platform Controller Hub */ 16 struct pch_ops { 17 /** 18 * get_sbase() - get the address of SPI base 19 * 20 * @dev: PCH device to check 21 * @sbasep: Returns address of SPI base if available, else 0 22 * @return 0 if OK, -ve on error (e.g. there is no SPI base) 23 */ 24 int (*get_sbase)(struct udevice *dev, ulong *sbasep); 25 26 /** 27 * set_spi_protect() - set whether SPI flash is protected or not 28 * 29 * @dev: PCH device to adjust 30 * @protect: true to protect, false to unprotect 31 * 32 * @return 0 on success, -ENOSYS if not implemented 33 */ 34 int (*set_spi_protect)(struct udevice *dev, bool protect); 35 }; 36 37 #define pch_get_ops(dev) ((struct pch_ops *)(dev)->driver->ops) 38 39 /** 40 * pch_get_sbase() - get the address of SPI base 41 * 42 * @dev: PCH device to check 43 * @sbasep: Returns address of SPI base if available, else 0 44 * @return 0 if OK, -ve on error (e.g. there is no SPI base) 45 */ 46 int pch_get_sbase(struct udevice *dev, ulong *sbasep); 47 48 /** 49 * set_spi_protect() - set whether SPI flash is protected or not 50 * 51 * @dev: PCH device to adjust 52 * @protect: true to protect, false to unprotect 53 * 54 * @return 0 on success, -ENOSYS if not implemented 55 */ 56 int pch_set_spi_protect(struct udevice *dev, bool protect); 57 58 #endif 59