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

Rosen Penev rosenp at gmail.com
Sun Feb 10 19:05:06 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:
Forgot to mention. since hackpascal's rework of the CPU clock
handling, SPI clock is not tied to sysclock anymore. sysclock is set
to either 50MHz or 125MHz depending on the board. See:
https://github.com/openwrt/openwrt/pull/1578#issuecomment-443676217

Also forgot to mention, those results are with the driver in OpenWrt.
They're better with the upstream one.
>
> 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.
>
> 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.
Should I? There are other mt7621 with dts files that exceed this figure.
>
> (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