[OpenWrt-Devel] [PATCH] ramips: Increase GB-PC2 SPI speed to 50MHz

Rosen Penev rosenp at gmail.com
Sun Feb 10 18:49:31 EST 2019


On Sun, Feb 10, 2019 at 9:23 AM Christian Lamparter <chunkeey at gmail.com> wrote:
>
> On Friday, February 1, 2019 8:36:13 AM CET Rosen Penev wrote:
> > The flash chip on the board (Spansion S25FL256SAIF00) is rated to support
> > at least 50MHz according to the datasheet.
> >
> > From testing this, that seems correct.
> >
> > time dd if=/dev/mtdblock3 of=/dev/null bs=64k from
> >
> > 41.78s to 16.61s
> >
> > Signed-off-by: Rosen Penev <rosenp at gmail.com>
>
> Hm, this is fine. There's just a small caveat. The mt7621-spi [0]
> can do at most (SYS_CLOCK) / 2 which works out as 50 MHz / 2 = 25 MHz
> and this is supported by your results as well:
>
> Because 41.78s / 16.61s = 2.51. If the spi-transfers were operating
> at 50 Mhz, dd would have taken just around 8-9 seconds.
After applying the upstream spi driver (
https://github.com/openwrt/openwrt/pull/1578 ), time goes down to
9.54s on the PC1. It's a little lower on the PC2 (no idea why).

On the PC1, I can go even higher with the SPI frequency to get better
performance. However, the later versions of the PC1 switched flash
chips to Spansion to avoid a restart bug. Those are documented as
accepting 50MHz for read requests.

>
> The reason why the dts patch this is still fine is because the
> spi-max-frequency's value is supposed to be taken from the slave
> device (S25FL256SAIF00 datasheet). So maybe, you could just mention in the
> commit message that speed it sadly capped at 25 Mhz.
>
> (Maybe you could also test, if you get better read performance
> by adding the "m25p,fast-read;" property [1] to the device's dts)
>
> Regards,
> Christian
>
> [0] <https://github.com/torvalds/linux/blob/master/drivers/staging/mt7621-spi/spi-mt7621.c#L304>
> [1] <https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/jedec%2Cspi-nor.txt>
> > ---
> >  target/linux/ramips/dts/GB-PC2.dts | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/target/linux/ramips/dts/GB-PC2.dts b/target/linux/ramips/dts/GB-PC2.dts
> > index 788d4e6c08..f951083b8f 100644
> > --- a/target/linux/ramips/dts/GB-PC2.dts
> > +++ b/target/linux/ramips/dts/GB-PC2.dts
> > @@ -81,7 +81,7 @@
> >       m25p80 at 0 {
> >               compatible = "jedec,spi-nor";
> >               reg = <0>;
> > -             spi-max-frequency = <10000000>;
> > +             spi-max-frequency = <50000000>;
> >
> >               partitions {
> >                       compatible = "fixed-partitions";
> >
>
>
>
>

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list