HI,
I have written a small code in u-boot level to read the ID of the SPI Flash of 8148EVM but it is always returning FF.
Kindly help me to read the SPI Flash ID in u-boot.
here is my code.
static int uu_spi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
struct spi_slave *slave;
char *cp = 0;
uchar tmp;
int j;
int rcode = 0;
unsigned int bus;
unsigned int cs;
unsigned int mode;
int bitlen;
bus = 0;
cs = 0;
mode = 0;
dout[0] = OPCODE_RDID;
slave = spi_setup_slave(bus, cs,1000000, mode);
if (!slave) {
printf("Invalid device %d:%d\n", bus, cs);
return 1;
}
spi_claim_bus(slave);
if(spi_xfer(slave, 1*8, dout,din,
SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
printf("Error during SPI transaction\n");
rcode = 1;
}
else
{
printf("SPI Flash id = %d %d %d %d %d \n",din[0],din[1],din[2],din[3],din[4]);
}
spi_release_bus(slave);
spi_free_slave(slave);
return 0;
}
all the bytes are coming as FF.
Regards,
Vimal