Hi Grazvydas, You are right. mmc_io_rw_direct() implementation doesn't check R/W flag and returns data if "out" != NULL. So if SDIO spec "demands" WRITE flag and wl1251 ignores it anyway, then we should use WRITE. You function name is slightly confusing I would say, but I am fine with the patch. Thanks, Dmitry On Sat, May 15, 2010 at 5:16 AM, Grazvydas Ignotas <notasas@xxxxxxxxx> wrote: > On Sat, May 15, 2010 at 3:02 AM, Dmitry Shmidt <dimitrysh@xxxxxxxxxx> wrote: >> Hi Andrew, >> >> wl1251 has some HW problem for ELP register that demands to do >> something like "write during read" in order >> not to loose bits from this register during simple read. >> Fortunately it was enough just to add low 8 bits previous register >> value to the cmd.args during read operation >> and SD Controller will behave as needed. And it was tested on real >> wl1251 device that is used in G1 and MyTouch. >> >> However, patch author for some reason is using WRITE operation instead of READ. >>>>> ret = mmc_io_rw_direct(func->card, 1, func->num, addr, b, &val); >>>>> 1 means WRITE >> >> Maybe in case of wl1251 HW it is not important - to write during read, >> or to read during write, but the problem in wl1251 was during ELP >> register READ operation, so I do not understand why author used WRITE >> flag. > > Well like you said, 'wl1251 [...] demands to do something like "write > during read"', and SDIO spec provides exactly this functionality with > the RAW flag (quoting SDIO spec): > > "If this bit [RAW] is set to 1 and the R/W flag is set to 1, then the > command shall read the value of the register after the write. This is > useful to allow writing to a control register and reading the status > at the same address." > > If you pass WRITE flag and a pointer for read value to > mmc_io_rw_direct(), it sets the R/W and RAW bits in the CMD52 request. > According to my tests wl1251 actually ignores both R/W and RAW flags, > but by the looks of it it is expecting the RAW request. With my patch > we can add a function that both conforms the SDIO spec and suits > wl1251 hardware. > > Does that make sense to you? > -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html