1ca831f49SSimon Glass /* 2ca831f49SSimon Glass * Copyright (c) 2015 Google, Inc 3ca831f49SSimon Glass * Written by Simon Glass <sjg@chromium.org> 4ca831f49SSimon Glass * 5ca831f49SSimon Glass * SPDX-License-Identifier: GPL-2.0+ 6ca831f49SSimon Glass */ 7ca831f49SSimon Glass 8ca831f49SSimon Glass #ifndef __pch_h 9ca831f49SSimon Glass #define __pch_h 10ca831f49SSimon Glass 11ca831f49SSimon Glass enum pch_version { 12ca831f49SSimon Glass PCHV_UNKNOWN, 13ca831f49SSimon Glass PCHV_7, 14ca831f49SSimon Glass PCHV_9, 15ca831f49SSimon Glass }; 16ca831f49SSimon Glass 17*1ff4f321SSimon Glass #define PCH_RCBA 0xf0 18*1ff4f321SSimon Glass 19*1ff4f321SSimon Glass #define BIOS_CTRL_BIOSWE BIT(0) 20*1ff4f321SSimon Glass 21ca831f49SSimon Glass /* Operations for the Platform Controller Hub */ 22ca831f49SSimon Glass struct pch_ops { 23ca831f49SSimon Glass /** 24ca831f49SSimon Glass * get_sbase() - get the address of SPI base 25ca831f49SSimon Glass * 26ca831f49SSimon Glass * @dev: PCH device to check 27ca831f49SSimon Glass * @sbasep: Returns address of SPI base if available, else 0 28ca831f49SSimon Glass * @return 0 if OK, -ve on error (e.g. there is no SPI base) 29ca831f49SSimon Glass */ 30ca831f49SSimon Glass int (*get_sbase)(struct udevice *dev, ulong *sbasep); 31ca831f49SSimon Glass 32ca831f49SSimon Glass /** 33ca831f49SSimon Glass * get_version() - get the PCH version 34ca831f49SSimon Glass * 35ca831f49SSimon Glass * @return version, or -ENOSYS if unknown 36ca831f49SSimon Glass */ 37ca831f49SSimon Glass enum pch_version (*get_version)(struct udevice *dev); 38ca831f49SSimon Glass 39ca831f49SSimon Glass /** 40ca831f49SSimon Glass * set_spi_protect() - set whether SPI flash is protected or not 41ca831f49SSimon Glass * 42ca831f49SSimon Glass * @dev: PCH device to adjust 43ca831f49SSimon Glass * @protect: true to protect, false to unprotect 44ca831f49SSimon Glass * 45ca831f49SSimon Glass * @return 0 on success, -ENOSYS if not implemented 46ca831f49SSimon Glass */ 47ca831f49SSimon Glass int (*set_spi_protect)(struct udevice *dev, bool protect); 48ca831f49SSimon Glass }; 49ca831f49SSimon Glass 50ca831f49SSimon Glass #define pch_get_ops(dev) ((struct pch_ops *)(dev)->driver->ops) 51ca831f49SSimon Glass 52ca831f49SSimon Glass /** 53ca831f49SSimon Glass * pch_get_sbase() - get the address of SPI base 54ca831f49SSimon Glass * 55ca831f49SSimon Glass * @dev: PCH device to check 56ca831f49SSimon Glass * @sbasep: Returns address of SPI base if available, else 0 57ca831f49SSimon Glass * @return 0 if OK, -ve on error (e.g. there is no SPI base) 58ca831f49SSimon Glass */ 59ca831f49SSimon Glass int pch_get_sbase(struct udevice *dev, ulong *sbasep); 60ca831f49SSimon Glass 61ca831f49SSimon Glass /** 62ca831f49SSimon Glass * pch_get_version() - get the PCH version 63ca831f49SSimon Glass * 64ca831f49SSimon Glass * @return version, or -ENOSYS if unknown 65ca831f49SSimon Glass */ 66ca831f49SSimon Glass enum pch_version pch_get_version(struct udevice *dev); 67ca831f49SSimon Glass 68ca831f49SSimon Glass /** 69ca831f49SSimon Glass * set_spi_protect() - set whether SPI flash is protected or not 70ca831f49SSimon Glass * 71ca831f49SSimon Glass * @dev: PCH device to adjust 72ca831f49SSimon Glass * @protect: true to protect, false to unprotect 73ca831f49SSimon Glass * 74ca831f49SSimon Glass * @return 0 on success, -ENOSYS if not implemented 75ca831f49SSimon Glass */ 76ca831f49SSimon Glass int pch_set_spi_protect(struct udevice *dev, bool protect); 77ca831f49SSimon Glass 78ca831f49SSimon Glass #endif 79