On Mon, 3 Dec 2018 10:08:14 +0100 Boris Brezillon <boris.brezillon@xxxxxxxxxxx> wrote: > On Mon, 3 Dec 2018 08:37:17 +0000 > "Sverdlin, Alexander (Nokia - DE/Ulm)" <alexander.sverdlin@xxxxxxxxx> > wrote: > > > Hi! > > > > On 03/12/2018 09:23, Boris Brezillon wrote: > > >> This is the same instruction 65h which is used to read regs and which > > >> appears in SMPT headers, it is a chicken-egg problem. > > > Oh, right, I remember now. Not a smart decision from Spansion :-/. > > > > > >> Therefore, I don't know if it's possible to provide smarter heuristics > > >> here. > > > Maybe: > > > > > > ref_cr1 = read_CR1_using_RDCR() > > > > > > for_each_possible_dummy_and_addr_width > > > cr1 = read_CR1_using_RDAR() > > > if (cr1 == ref_cr1) > > > break; > > > > This will not work, as default value for CR1(N)V is 0 and that is the value > > one gets with incorrect addr_width as well. > > > > How about: > > // set the WE bit in SR1 so that SR1 is not 0 > write_enable() > > ref_sr1 = read_SR1_using_RDSR1() > for_each_possible_dummy_and_addr_width > sr1 = read_SR1_using_RDAR() > if (sr1 == ref_sr1) > break; Oh, and you should read CR2 to make sure AL and RL fields match the selected addr/dummy values. > > write_disable() ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/