]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
sf: probe: Handle flash size properly incase of dual parallel
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Thu, 29 Oct 2015 06:30:16 +0000 (12:00 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 29 Oct 2015 07:44:57 +0000 (08:44 +0100)
Handle flash size properly incase of dual parallel
The flash size has to be divided by 2 while checking
the flash size to enter 4byte mode and for bank
selection during init.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/mtd/spi/sf_probe.c

index bf84cebd71af88362d5bde724493fad6ca639a77..b66cc45ae9b9e0b9305924dcf92ef98d708fb234 100644 (file)
@@ -213,7 +213,7 @@ static int spi_flash_validate_params(struct spi_slave *spi, u8 *idcode,
         * and make sure the chip (> 16MiB) in default 3-byte address mode,
         * in case of warm bootup, the chip was set to 4-byte mode in kernel.
         */
-       if (flash->size > SPI_FLASH_16MB_BOUN) {
+       if ((flash->size >> flash->shift) > SPI_FLASH_16MB_BOUN) {
                if (flash->spi->bytemode == SPI_4BYTE_MODE) {
                        if (spi_flash_cmd_4B_addr_switch(flash, true,
                            idcode[0]) < 0)
@@ -367,7 +367,7 @@ static int spi_flash_validate_params(struct spi_slave *spi, u8 *idcode,
        /* Configure the BAR - discover bank cmds and read current bank */
 #ifdef CONFIG_SPI_FLASH_BAR
        u8 curr_bank = 0;
-       if (flash->size > SPI_FLASH_16MB_BOUN) {
+       if ((flash->size >> flash->shift) > SPI_FLASH_16MB_BOUN) {
                int ret;
 
                flash->bank_read_cmd = (idcode[0] == 0x01) ?