mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-30 02:20:48 +00:00
Add a function that allows reading of the status register from the SPI chip. This can be used to determine whether write protection is enabled on the chip. BUG=chrome-os-partner:35209 BRANCH=haswell TEST=build and boot on peppy Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/240702 Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit c58f17689162b291a7cdb57649a237de21b73545) Change-Id: Ib7fead2cc4ea4339ece322dd18403362c9c79c7d Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 9fbdf0d72892eef4a742a418a347ecf650c01ea5 Original-Change-Id: I2541b22c51e43f7b7542ee0f48618cf411976a98 Original-Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/241128 Original-Reviewed-by: Shawn N <shawnn@chromium.org> Reviewed-on: http://review.coreboot.org/9730 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
59 lines
1.5 KiB
C
59 lines
1.5 KiB
C
/*
|
|
* Interface to SPI flash
|
|
*
|
|
* Copyright (C) 2008 Atmel Corporation
|
|
*
|
|
* See file CREDITS for list of people who contributed to this
|
|
* project.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* version 2 as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
* MA 02111-1307 USA
|
|
*/
|
|
#ifndef _SPI_FLASH_H_
|
|
#define _SPI_FLASH_H_
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <console/console.h>
|
|
#include <spi-generic.h>
|
|
#include <boot/coreboot_tables.h>
|
|
|
|
struct spi_flash {
|
|
struct spi_slave *spi;
|
|
|
|
const char *name;
|
|
|
|
u32 size;
|
|
|
|
u32 sector_size;
|
|
|
|
u8 erase_cmd;
|
|
|
|
u8 status_cmd;
|
|
|
|
int (*read)(struct spi_flash *flash, u32 offset,
|
|
size_t len, void *buf);
|
|
int (*write)(struct spi_flash *flash, u32 offset,
|
|
size_t len, const void *buf);
|
|
int (*erase)(struct spi_flash *flash, u32 offset,
|
|
size_t len);
|
|
int (*status)(struct spi_flash *flash, u8 *reg);
|
|
};
|
|
|
|
struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs);
|
|
|
|
void lb_spi_flash(struct lb_header *header);
|
|
|
|
#endif /* _SPI_FLASH_H_ */
|