[U-Boot] Antwort: [PATCH v2] x86: ich-spi: Convert driver to spi-mem ops

Bernhard Messerklinger bernhard.messerklinger at br-automation.com
Mon Jul 29 07:08:55 UTC 2019


Hello Bin,

> Von: "Bin Meng" <bmeng.cn at gmail.com>
> An: "Simon Glass" <sjg at chromium.org>, "Bernhard Messerklinger" 
> <bernhard.messerklinger at br-automation.com>, "Vignesh Raghavendra" 
> <vigneshr at ti.com>, "U-Boot Mailing List" <u-boot at lists.denx.de>
> Kopie: "Bernhard Messerklinger" 
<bernhard.messerklinger at br-automation.com>
> Datum: 07/28/2019 01:31 PM
> Betreff: [PATCH v2] x86: ich-spi: Convert driver to spi-mem ops
> 
> From: Bernhard Messerklinger <bernhard.messerklinger at br-automation.com>
> 
> With the introduction of the new spi-mem model operations changed
> slightly. The new spi-mem operations make things a bit easier to
> handle for ich-spi flash interface. This patch converts the ich-spi
> driver by using spi-mem operations.
> 
> Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger at br-
> automation.com>
> Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
> Tested-by: Bin Meng <bmeng.cn at gmail.com>
> [bmeng: make 2 routines static; update commit message a little bit]
> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
> 
> ---
> 
> Changes in v2:
> - make 2 routines static; update commit message a little bit
> +----------------------------------
> +   if (op->data.dir == SPI_MEM_DATA_OUT) {
> +      if (op->addr.nbytes ||
> +          (!op->addr.nbytes && op->data.nbytes == 3))
> +         trans->type = SPI_OPCODE_TYPE_WRITE_WITH_ADDRESS;
> +      else
> +         trans->type = SPI_OPCODE_TYPE_WRITE_NO_ADDRESS;
> +   } else {
> +      if (op->addr.nbytes)
> +         trans->type = SPI_OPCODE_TYPE_READ_WITH_ADDRESS;
> +      else
> +         trans->type = SPI_OPCODE_TYPE_READ_NO_ADDRESS;
> +   }
> +
>     opcode_index = spi_setup_opcode(ctlr, trans, lock);
>     if (opcode_index < 0)
>        return -EINVAL;
> -   with_address = spi_setup_offset(trans);
> -   if (with_address < 0)
> -      return -EINVAL;
> +
> +   /* Handle special case for erase where address is stored in data */
> +   if (op->addr.nbytes) {
> +      trans->offset = op->addr.val;
> +      with_address = 1;
> +   } else if (op->data.nbytes == 3 && trans->bytesout) {
> +      trans->offset = ((uint32_t)trans->out[0] << 16) |
> +            ((uint32_t)trans->out[1] << 8) |
> +            ((uint32_t)trans->out[2] << 0);
> +      with_address = 1;
> +      trans->bytesout = 0;
> +   }

this patch is a bit out of sync with the latest master spi-nor driver.
Commit f909ddb3e1770a5ef18606b46000e0d3eaf63b2e changes the erase 
behavior.
I allready fixed this so if desired I could send a v3 for review.

Regards,
Bernhard



More information about the U-Boot mailing list