Hello Bin, > Von: "Bin Meng" <[email protected]> > An: "Simon Glass" <[email protected]>, "Bernhard Messerklinger" > <[email protected]>, "Vignesh Raghavendra" > <[email protected]>, "U-Boot Mailing List" <[email protected]> > Kopie: "Bernhard Messerklinger" <[email protected]> > Datum: 07/28/2019 01:31 PM > Betreff: [PATCH v2] x86: ich-spi: Convert driver to spi-mem ops > > From: Bernhard Messerklinger <[email protected]> > > 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@br- > automation.com> > Reviewed-by: Bin Meng <[email protected]> > Tested-by: Bin Meng <[email protected]> > [bmeng: make 2 routines static; update commit message a little bit] > Signed-off-by: Bin Meng <[email protected]> > > --- > > 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 _______________________________________________ U-Boot mailing list [email protected] https://lists.denx.de/listinfo/u-boot

