No subject
Sun Aug 18 03:03:50 CEST 2013
-----------------------------------------------------------------------------
/* Look for the fastest read cmd */
cmd = fls(params->rd_cmd & flash->spi->rd_cmd);
if (cmd) {
cmd = spi_read_cmds_array[cmd - 1];
flash->read_cmd = cmd;
} else {
/* Go for controller supported command */
flash->read_cmd = CMD_READ_ARRAY_FAST;
}
/* Look for the fastest write cmd */
cmd = fls(params->wr_cmd & flash->spi->wr_cmd);
if (cmd) {
cmd = spi_write_cmds_array[cmd - 1];
flash->write_cmd = cmd;
} else {
/* Go for controller supported command */
flash->write_cmd = CMD_PAGE_PROGRAM;
}
include/spi_flash.h:
---------------------------
/* Supported write cmds enum list */
enum spi_write_cmds {
PAGE_PROGRAM = 1 << 0,
QUAD_PAGE_PROGRAM = 1 << 1,
};
#define WR_CMD_FULL PAGE_PROGRAM | QUAD_PAGE_PROGRAM
/* Supported read cmds enum list */
enum spi_read_cmds {
ARRAY_SLOW = 1 << 0,
ARRAY_FAST = 1 << 1,
DUAL_OUTPUT_FAST = 1 << 2,
DUAL_IO_FAST = 1 << 3,
QUAD_OUTPUT_FAST = 1 << 4,
};
#define RD_CMD_FULL ARRAY_SLOW | ARRAY_FAST | DUAL_OUTPUT_FAST | \
DUAL_IO_FAST | QUAD_OUTPUT_FAST
If the controller is not filling slave.rd_cmd and slave.wr_cmd if it's
not supporting even if connected flash
supports, fill the read/write commands to default ones.
Controller is a master to decide which command is to use, and flash is
slave to transfer the discovered command
through spi_xfer(), so the controller will take care of the command processing.
This is well detailed explanation, I hope you understand.
>
> Maybe your specific controller behaves in another way, but this is not the standard
> and you should not force this into the interface.
>
> And another doubt: The might be different commands for dual/quad read/write,
> depending on the flash manufacturer. With your solution, the controller drivers
> would need these details in advance! Or at least need to be updated on each new
> command, which needs to be supported.
>
>> --
>> Thanks,
>> Jagan.
>
> Best Regards,
> Thomas
>
>
--
Thanks,
Jagan.
--------
Jagannadha Sutradharudu Teki,
E: jagannadh.teki at gmail.com, P: +91-9676773388
Engineer - System Software Hacker
U-boot - SPI Custodian and Zynq APSOC
Ln: http://www.linkedin.com/in/jaganteki
More information about the U-Boot
mailing list