From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Chou Date: Wed, 30 Dec 2015 12:02:03 +0800 Subject: [U-Boot] [PATCH v5 4/5] mips: ath79: add spi driver In-Reply-To: <201512300151.47999.marex@denx.de> References: <1451387833-932-1-git-send-email-wills.wang@live.com> <201512291425.27888.marex@denx.de> <56831B4F.1030200@wytron.com.tw> <201512300151.47999.marex@denx.de> Message-ID: <5683573B.9040700@wytron.com.tw> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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