Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * Driver for Realtek PCI-Express card reader
0004  *
0005  * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
0006  *
0007  * Author:
0008  *   Wei WANG (wei_wang@realsil.com.cn)
0009  *   Micky Ching (micky_ching@realsil.com.cn)
0010  */
0011 
0012 #ifndef __REALTEK_RTSX_SPI_H
0013 #define __REALTEK_RTSX_SPI_H
0014 
0015 /* SPI operation error */
0016 #define SPI_NO_ERR      0x00
0017 #define SPI_HW_ERR      0x01
0018 #define SPI_INVALID_COMMAND 0x02
0019 #define SPI_READ_ERR        0x03
0020 #define SPI_WRITE_ERR       0x04
0021 #define SPI_ERASE_ERR       0x05
0022 #define SPI_BUSY_ERR        0x06
0023 
0024 /* Serial flash instruction */
0025 #define SPI_READ        0x03
0026 #define SPI_FAST_READ       0x0B
0027 #define SPI_WREN        0x06
0028 #define SPI_WRDI        0x04
0029 #define SPI_RDSR        0x05
0030 
0031 #define SF_PAGE_LEN     256
0032 
0033 #define BYTE_PROGRAM        0
0034 #define AAI_PROGRAM     1
0035 #define PAGE_PROGRAM        2
0036 
0037 #define PAGE_ERASE      0
0038 #define CHIP_ERASE      1
0039 
0040 int spi_erase_eeprom_chip(struct rtsx_chip *chip);
0041 int spi_erase_eeprom_byte(struct rtsx_chip *chip, u16 addr);
0042 int spi_read_eeprom(struct rtsx_chip *chip, u16 addr, u8 *val);
0043 int spi_write_eeprom(struct rtsx_chip *chip, u16 addr, u8 val);
0044 int spi_get_status(struct scsi_cmnd *srb, struct rtsx_chip *chip);
0045 int spi_set_parameter(struct scsi_cmnd *srb, struct rtsx_chip *chip);
0046 int spi_read_flash_id(struct scsi_cmnd *srb, struct rtsx_chip *chip);
0047 int spi_read_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip);
0048 int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip);
0049 int spi_erase_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip);
0050 int spi_write_flash_status(struct scsi_cmnd *srb, struct rtsx_chip *chip);
0051 
0052 #endif  /* __REALTEK_RTSX_SPI_H */