On 2020/11/26 13:55, Sean Anderson wrote: > On 11/25/20 2:52 PM, Serge Semin wrote: [...] >>> + if (!(dws->caps & DW_SPI_CAP_DWC_SSI)) { >>> + u32 cr0; >>> + >>> + /* >>> + * Detect APB SSI CTRLR0 size by looking at the data >>> + * frame size field. >>> + */ >> >>> + dw_writel(dws, DW_SPI_CTRLR0, 0xffffffff); >> >> This isn't going to work because you need to disable the SSI controller >> first. Then please revert the change or cleanup the register and disable >> the controller back after finishing the detection. > > In U-Boot at least, ctrlr0 is written before every transfer, so there is > no need to restore it afterward. Same for enr. I don't know whether this > holds true for Linux. Same in Linux too. The base value for cr0 is prepared and saved in chip->cr0 field when the controller is scanned/reset and that saved base value is used for updating cr0 on every transfer. Serge point here was to have the DFS32 detection not result in the initial cr0 value changing, as some older versions of the DW controller may react to it. The cr0 save/restore in the detection does not matter for the K210 though. Since this is only done on scan/reset and not in the fast path, I think it is OK and definitely safer. -- Damien Le Moal Western Digital Research