/* Read the specified number of 32-bit words from the serial flash. If @byte_oriented is set the read data is stored as a byte array (i.e., big-endian), otherwise as 32-bit words in the platform's natural endianess.  */
int t3_read_flash(struct adapter *adapter, unsigned int addr, unsigned int nwords, u32 *data, int byte_oriented)
/* Read the specified number of 32-bit words from the serial flash. If @byte_oriented is set the read data is stored as a byte array (i.e., big-endian), otherwise as 32-bit words in the platform's natural endianess.  */
int t3_read_flash(struct adapter *adapter, unsigned int addr, unsigned int nwords, u32 *data, int byte_oriented)
{
	int ret;
	if (addr + nwords * sizeof(u32) > SF_SIZE || (addr & 3))
		return -EINVAL;
	addr = swab32(addr) | SF_RD_DATA_FAST;
	if ((ret = sf1_write(adapter, 4, 1, addr)) != 0 ||
	    (ret = sf1_read(adapter, 1, 1, data)) != 0)
		return ret;
	for (; nwords; nwords--, data++) {
		ret = sf1_read(adapter, 4, nwords > 1, data);
		if (ret)
			return ret;
		if (byte_oriented)
			*data = htonl(*data);
	}
	return 0;
}