diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2008-09-01 07:47:16 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-03 09:53:45 -0400 |
commit | 4a5b504d0c582db80813b70359b616ea30e91743 (patch) | |
tree | c3b10e411914a42c21d2a525e26eb440e37c6651 /drivers/net/sfc/spi.h | |
parent | 4d566063a799231b99d9a21128634ea78b89ab72 (diff) |
sfc: Export boot configuration in EEPROM through ethtool
Extend the SPI device setup code to support this.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/sfc/spi.h')
-rw-r--r-- | drivers/net/sfc/spi.h | 89 |
1 files changed, 42 insertions, 47 deletions
diff --git a/drivers/net/sfc/spi.h b/drivers/net/sfc/spi.h index 34412f3d41c9..feef61942377 100644 --- a/drivers/net/sfc/spi.h +++ b/drivers/net/sfc/spi.h | |||
@@ -19,53 +19,48 @@ | |||
19 | * | 19 | * |
20 | *************************************************************************/ | 20 | *************************************************************************/ |
21 | 21 | ||
22 | /* | 22 | #define SPI_WRSR 0x01 /* Write status register */ |
23 | * Commands common to all known devices. | 23 | #define SPI_WRITE 0x02 /* Write data to memory array */ |
24 | * | 24 | #define SPI_READ 0x03 /* Read data from memory array */ |
25 | #define SPI_WRDI 0x04 /* Reset write enable latch */ | ||
26 | #define SPI_RDSR 0x05 /* Read status register */ | ||
27 | #define SPI_WREN 0x06 /* Set write enable latch */ | ||
28 | |||
29 | #define SPI_STATUS_WPEN 0x80 /* Write-protect pin enabled */ | ||
30 | #define SPI_STATUS_BP2 0x10 /* Block protection bit 2 */ | ||
31 | #define SPI_STATUS_BP1 0x08 /* Block protection bit 1 */ | ||
32 | #define SPI_STATUS_BP0 0x04 /* Block protection bit 0 */ | ||
33 | #define SPI_STATUS_WEN 0x02 /* State of the write enable latch */ | ||
34 | #define SPI_STATUS_NRDY 0x01 /* Device busy flag */ | ||
35 | |||
36 | /** | ||
37 | * struct efx_spi_device - an Efx SPI (Serial Peripheral Interface) device | ||
38 | * @efx: The Efx controller that owns this device | ||
39 | * @device_id: Controller's id for the device | ||
40 | * @size: Size (in bytes) | ||
41 | * @addr_len: Number of address bytes in read/write commands | ||
42 | * @munge_address: Flag whether addresses should be munged. | ||
43 | * Some devices with 9-bit addresses (e.g. AT25040A EEPROM) | ||
44 | * use bit 3 of the command byte as address bit A8, rather | ||
45 | * than having a two-byte address. If this flag is set, then | ||
46 | * commands should be munged in this way. | ||
47 | * @block_size: Write block size (in bytes). | ||
48 | * Write commands are limited to blocks with this size and alignment. | ||
49 | * @read: Read function for the device | ||
50 | * @write: Write function for the device | ||
25 | */ | 51 | */ |
26 | 52 | struct efx_spi_device { | |
27 | /* Write status register */ | 53 | struct efx_nic *efx; |
28 | #define SPI_WRSR 0x01 | 54 | int device_id; |
29 | 55 | unsigned int size; | |
30 | /* Write data to memory array */ | 56 | unsigned int addr_len; |
31 | #define SPI_WRITE 0x02 | 57 | unsigned int munge_address:1; |
32 | 58 | unsigned int block_size; | |
33 | /* Read data from memory array */ | 59 | }; |
34 | #define SPI_READ 0x03 | 60 | |
35 | 61 | int falcon_spi_read(const struct efx_spi_device *spi, loff_t start, | |
36 | /* Reset write enable latch */ | 62 | size_t len, size_t *retlen, u8 *buffer); |
37 | #define SPI_WRDI 0x04 | 63 | int falcon_spi_write(const struct efx_spi_device *spi, loff_t start, |
38 | 64 | size_t len, size_t *retlen, const u8 *buffer); | |
39 | /* Read status register */ | ||
40 | #define SPI_RDSR 0x05 | ||
41 | |||
42 | /* Set write enable latch */ | ||
43 | #define SPI_WREN 0x06 | ||
44 | |||
45 | /* SST: Enable write to status register */ | ||
46 | #define SPI_SST_EWSR 0x50 | ||
47 | |||
48 | /* | ||
49 | * Status register bits. Not all bits are supported on all devices. | ||
50 | * | ||
51 | */ | ||
52 | |||
53 | /* Write-protect pin enabled */ | ||
54 | #define SPI_STATUS_WPEN 0x80 | ||
55 | |||
56 | /* Block protection bit 2 */ | ||
57 | #define SPI_STATUS_BP2 0x10 | ||
58 | |||
59 | /* Block protection bit 1 */ | ||
60 | #define SPI_STATUS_BP1 0x08 | ||
61 | |||
62 | /* Block protection bit 0 */ | ||
63 | #define SPI_STATUS_BP0 0x04 | ||
64 | |||
65 | /* State of the write enable latch */ | ||
66 | #define SPI_STATUS_WEN 0x02 | ||
67 | |||
68 | /* Device busy flag */ | ||
69 | #define SPI_STATUS_NRDY 0x01 | ||
70 | 65 | ||
71 | #endif /* EFX_SPI_H */ | 66 | #endif /* EFX_SPI_H */ |