linux/drivers/staging/rts5208/spi.h

/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * Driver for Realtek PCI-Express card reader
 *
 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
 *
 * Author:
 *   Wei WANG ([email protected])
 *   Micky Ching ([email protected])
 */

#ifndef __REALTEK_RTSX_SPI_H
#define __REALTEK_RTSX_SPI_H

/* SPI operation error */
#define SPI_NO_ERR
#define SPI_HW_ERR
#define SPI_INVALID_COMMAND
#define SPI_READ_ERR
#define SPI_WRITE_ERR
#define SPI_ERASE_ERR
#define SPI_BUSY_ERR

/* Serial flash instruction */
#define SPI_READ
#define SPI_FAST_READ
#define SPI_WREN
#define SPI_WRDI
#define SPI_RDSR

#define SF_PAGE_LEN

#define BYTE_PROGRAM
#define AAI_PROGRAM
#define PAGE_PROGRAM

#define PAGE_ERASE
#define CHIP_ERASE

int spi_erase_eeprom_chip(struct rtsx_chip *chip);
int spi_erase_eeprom_byte(struct rtsx_chip *chip, u16 addr);
int spi_read_eeprom(struct rtsx_chip *chip, u16 addr, u8 *val);
int spi_write_eeprom(struct rtsx_chip *chip, u16 addr, u8 val);
int spi_get_status(struct scsi_cmnd *srb, struct rtsx_chip *chip);
int spi_set_parameter(struct scsi_cmnd *srb, struct rtsx_chip *chip);
int spi_read_flash_id(struct scsi_cmnd *srb, struct rtsx_chip *chip);
int spi_read_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip);
int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip);
int spi_erase_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip);
int spi_write_flash_status(struct scsi_cmnd *srb, struct rtsx_chip *chip);

#endif  /* __REALTEK_RTSX_SPI_H */