[U-Boot] [PATCH v5 4/5] mips: ath79: add spi driver

Thomas Chou thomas at wytron.com.tw
Wed Dec 30 05:02:03 CET 2015


Hi Marek and Wills,

On 2015年12月30日 08:51, Marek Vasut wrote:
> Just skimming through the code, it seems like bitbanging the SPI using the
> generic soft-spi driver might be easier ;-/
>

I read the data sheet and Linux driver. Now I have clearer picture of 
this device. In serial flash mode, it reads like CFI flash. But we need 
to switch to bitbanging mode to write flash. In bitbanging, we have 
shift in data as word read. Though the cs, clk and dout are gpio. And 
the soft-spi of u-boot won't fit well.

So the current ath79_spi_delay() is fine. as we don't have ndelay() in 
u-boot yet. But the set_speed() code is for serial flash mode, and does 
not apply to bitbanging mode. You should save the result of do_div(tick, 
max_hz) to priv data, because dividing can take some time. You may trim 
the count with rrw_delay like that of Linux driver for more accurate timing.

BTW, the usage of uint8_t,uint32_t and uint64_t is deprecated. Please 
change them to u8, u32 and u64. It will be helpful to run checkpatch.pl.

Thanks a lot for your work.

Best regards,
Thomas






More information about the U-Boot mailing list