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