arm: mvebu: Add SPI flash on Armada XP-GP board
Subsystems (3)
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
This patch adds an SPI master device node for Armada XP-GP board. This master node is an SPI flash controller 'n25q128a13'.
Since there is no 'partitions' node declared, one full sized partition named as the device will be created.
---
This patch depends on:
1. Gregory's patch for Armada XP GP board:
arm: mvebu: support for the new Armada XP development board(DB-MV784MP-GP)
2. My previous patch for SPI on Armada 370/XP:
arm: mvebu: Add support for SPI controller in Armada 370/XP
And don't forget to compile the SPI flash driver, CONFIG_MTD_M25P80=y
arch/arm/boot/dts/armada-xp-gp.dts | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/boot/dts/armada-xp-gp.dts +12 -0
@@ -97,5 +97,17 @@ phy = <&phy3>; phy-mode = "rgmii-id"; }; + + spi0: spi at d0010600 { + status = "okay"; + + spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "n25q128a13"; + reg = <0>; /* Chip select 0 */ + spi-max-frequency = <108000000>; + }; + }; }; };
Signature · 1 line
1.7.8.6
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
Quoted 16 lines · Ezequiel Garcia
This patch adds an SPI master device node for Armada XP-GP board. This master node is an SPI flash controller 'n25q128a13'.
Since there is no 'partitions' node declared, one full sized partition named as the device will be created.
Cc Gregory Clement <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Lior Amsalem <[email protected]>Signed-off-by Ezequiel Garcia <[email protected]>---
This patch depends on:1. Gregory's patch for Armada XP GP board:
arm: mvebu: support for the new Armada XP development board(DB-MV784MP-GP)
Quoted 7 lines
2. My previous patch for SPI on Armada 370/XP:
arm: mvebu: Add support for SPI controller in Armada 370/XPAnd don't forget to compile the SPI flash driver,
CONFIG_MTD_M25P80=yarch/arm/boot/dts/armada-xp-gp.dts | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
Very nice, thanks for listing the dependencies. That makes things a lot easier on this end.
thx,
Jason.
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
In reply to Ezequiel GarciaQuoted 1 line
And don't forget to compile the SPI flash driver,
CONFIG_MTD_M25P80=y
Hi Ezequiel
Maybe it makes sense to provide a patch to mvebu_defconfig to add CONFIG_MTD_M25P80=y ?
Andrew
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
Morning-ish Andrew,
Quoted 4 lines · Andrew Lunn
Quoted 1 line
And don't forget to compile the SPI flash driver,
CONFIG_MTD_M25P80=yMaybe it makes sense to provide a patch to
mvebu_defconfigto addCONFIG_MTD_M25P80=y?
I thought this as well, then reconsidered when he said there was nothing on it. So it's not really needed to boot. I don't have a strong opinion on it though, so =y, =m, or =n.
thx,
Jason.
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
Quoted 12 lines · Jason Cooper
Morning-ish Andrew,
Quoted 4 lines · Andrew Lunn
Quoted 1 line
And don't forget to compile the SPI flash driver,
CONFIG_MTD_M25P80=yMaybe it makes sense to provide a patch to
mvebu_defconfigto addCONFIG_MTD_M25P80=y?I thought this as well, then reconsidered when he said there was nothing on it. So it's not really needed to boot. I don't have a strong opinion on it though, so =y, =m, or =n.
Well, the SPI flash may not be empty, if that's what you meant. For instnace, my Armada XP GP board has the bootloader on that SPI, and boots from there. After booting, the SPI flash is no longer needed.
IMHO, I don't think we should include the option CONFIG_MTD_M25P80 as it is just a particular SPI master device present in a particular board.
On the other hand, I don't have a strong opinion on this. I've always wondered the *true* meaning of defconfigs, so feel free to enligthen me :)
Signature · 3 lines
Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
Quoted 9 lines · Ezequiel Garcia
Quoted 8 lines · Jason Cooper
Morning-ish Andrew,
Quoted 4 lines · Andrew Lunn
Quoted 1 line
And don't forget to compile the SPI flash driver,
CONFIG_MTD_M25P80=yMaybe it makes sense to provide a patch to
mvebu_defconfigto addCONFIG_MTD_M25P80=y?
Quoted 8 lines
Quoted 4 lines
I thought this as well, then reconsidered when he said there was nothing on it. So it's not really needed to boot. I don't have a strong opinion on it though, so =y, =m, or =n.
Well, the SPI flash may not be empty, if that's what you meant. For instnace, my Armada XP GP board has the bootloader on that SPI, and boots from there. After booting, the SPI flash is no longer needed.
Is the bootloader environment on there? Is there room for the dtb once u-boot is upgraded to support fdt?
Quoted 6 lines
IMHO, I don't think we should include the option
CONFIG_MTD_M25P80as it is just a particular SPI master device present in a particular board.On the other hand, I don't have a strong opinion on this. I've always wondered the *true* meaning of defconfigs, so feel free to enligthen me :)
Hmm, a quick look through Documentation/* didn't produce anything authoritative. There's Documentation/sh/new-machine.txt which says
"
Now all that's left to do is providing a defconfig for your new board. This way, other people who end up with this board can simply use this config for reference instead of trying to guess what settings are supposed to be used on it.
"
One thing we've been doing a lot of with mvebu is using it for build-testing. For that use case, since the bootloader is there, I'd recommend setting it. This will reduce the likelyhood of nasty build breakages futher down the line as we'll catch them before pushing to arm-soc.
thx,
Jason.
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
Dear Jason Cooper,
Quoted 5 lines · Jason Cooper
One thing we've been doing a lot of with mvebu is using it for build-testing. For that use case, since the bootloader is there, I'd recommend setting it. This will reduce the likelyhood of nasty build breakages futher down the line as we'll catch them before pushing to arm-soc.
To me, the defconfig should enable all the options needed for the drivers of on-board devices. So we should enable the driver for this SPI flash in the mvebu_defconfig.
Best regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
Quoted 10 lines · Thomas Petazzoni
Dear Jason Cooper,
Quoted 5 lines · Jason Cooper
One thing we've been doing a lot of with mvebu is using it for build-testing. For that use case, since the bootloader is there, I'd recommend setting it. This will reduce the likelyhood of nasty build breakages futher down the line as we'll catch them before pushing to arm-soc.
Quoted 4 lines
To me, the defconfig should enable all the options needed for the drivers of on-board devices. So we should enable the driver for this SPI flash in the
mvebu_defconfig.
So that means we should enable the drivers for all the devices present on all the boards?
Quoted 4 lines
Best regards,
Thomas
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
Dear Gregory CLEMENT,
Quoted 2 lines · Gregory CLEMENT
So that means we should enable the drivers for all the devices present on all the boards?
Yes. For example my mvsdio patch set enables some Wifi driver that corresponds to a particular SDIO Wifi device that is present in the Mirabox. But not on other boards.
Of course, it doesn't make sense to have drivers for pluggable devices like PCIe devices that are not soldered, USB devices and things like that. But for all the rest, I would say it should be in the defconfig.
Best regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
Quoted 3 lines · Thomas Petazzoni
Of course, it doesn't make sense to have drivers for pluggable devices like PCIe devices that are not soldered, USB devices and things like that. But for all the rest, I would say it should be in the defconfig.
hmmm, so for the new devboard we should set CONFIG_RAM=n? ;-)
thx,
Jason.
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
Quoted 9 lines
From: Jason Cooper [mailto:jason at lakedaemon.net]
Sent: Tuesday, February 05, 2013 8:09 PMQuoted 3 lines · Thomas Petazzoni
Of course, it doesn't make sense to have drivers for pluggable devices like PCIe devices that are not soldered, USB devices and things like that. But for all the rest, I would say it should be in the defconfig.
hmmm, so for the new devboard we should set
CONFIG_RAM=n? ;-)
I think something like CONFIG_RAM=m suit better :)
Quoted 4 lines
thx,
Jason.
Regards,
Lior Amsalem
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
In reply to Thomas PetazzoniQuoted 11 lines · Thomas Petazzoni
Dear Gregory CLEMENT,
Quoted 2 lines · Gregory CLEMENT
So that means we should enable the drivers for all the devices present on all the boards?
Yes. For example my mvsdio patch set enables some Wifi driver that corresponds to a particular SDIO Wifi device that is present in the Mirabox. But not on other boards.
Okey, I'll add everything needed to access and test the SPI flash, including MTD_CHAR.
Thanks,
Signature · 3 lines
Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
In reply to Thomas PetazzoniQuoted 10 lines · Thomas Petazzoni
Dear Jason Cooper,
Quoted 5 lines · Jason Cooper
One thing we've been doing a lot of with mvebu is using it for build-testing. For that use case, since the bootloader is there, I'd recommend setting it. This will reduce the likelyhood of nasty build breakages futher down the line as we'll catch them before pushing to arm-soc.
Quoted 3 lines
To me, the defconfig should enable all the options needed for the drivers of on-board devices. So we should enable the driver for this SPI flash in the
mvebu_defconfig.
I agree.
thx,
Jason.
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
In reply to Ezequiel GarciaHi Ezequiel,
Quoted 37 lines · Ezequiel Garcia
This patch adds an SPI master device node for Armada XP-GP board. This master node is an SPI flash controller 'n25q128a13'.
Since there is no 'partitions' node declared, one full sized partition named as the device will be created.
Cc Gregory Clement <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Lior Amsalem <[email protected]>Signed-off-by Ezequiel Garcia <[email protected]>---
This patch depends on:1. Gregory's patch for Armada XP GP board:
arm: mvebu: support for the new Armada XP development board(DB-MV784MP-GP)2. My previous patch for SPI on Armada 370/XP:
arm: mvebu: Add support for SPI controller in Armada 370/XPAnd don't forget to compile the SPI flash driver,
CONFIG_MTD_M25P80=yarch/arm/boot/dts/armada-xp-gp.dts | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)arch/arm/boot/dts/armada-xp-gp.dts +4
-0@@ -97,5 +97,17 @@ phy = <&phy3>; phy-mode = "rgmii-id"; }; + + spi0: spi at d0010600 { + status = "okay"; +
arch/arm/boot/dts/armada-xp-gp.dts line 113
Quoted 10 lines
arch/arm/boot/dts/armada-xp-gp.dts +8
-0+ spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "n25q128a13"; + reg = <0>; /* Chip select 0 */ + spi-max-frequency = <108000000>; + }; + }; }; };
I applied, compiled and try this patch it worked well, at least for reading, I didn't try to write on the flash where my boolader is stored. So you can add my:
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
Quoted 37 lines · Gregory CLEMENT
Hi Ezequiel,
Quoted 34 lines · Ezequiel Garcia
This patch adds an SPI master device node for Armada XP-GP board. This master node is an SPI flash controller 'n25q128a13'.
Since there is no 'partitions' node declared, one full sized partition named as the device will be created.
Cc Gregory Clement <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Lior Amsalem <[email protected]>Signed-off-by Ezequiel Garcia <[email protected]>---
This patch depends on:1. Gregory's patch for Armada XP GP board:
arm: mvebu: support for the new Armada XP development board(DB-MV784MP-GP)2. My previous patch for SPI on Armada 370/XP:
arm: mvebu: Add support for SPI controller in Armada 370/XPAnd don't forget to compile the SPI flash driver,
CONFIG_MTD_M25P80=yarch/arm/boot/dts/armada-xp-gp.dts | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)arch/arm/boot/dts/armada-xp-gp.dts +2
-0@@ -97,5 +97,17 @@ phy = <&phy3>; phy-mode = "rgmii-id"; }; + + spi0: spi at d0010600 {
Quoted 8 lines
arch/arm/boot/dts/armada-xp-gp.dts line 109
Quoted 8 lines
arch/arm/boot/dts/armada-xp-gp.dts +8
-0+ status = "okay"; + + spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "n25q128a13"; + reg = <0>; /* Chip select 0 */ + spi-max-frequency = <108000000>;
I had a remark about it, according to the datasheet, 108MHz is the maximum frequency for the all the instructions but the READ instruction. For the READ the maximum frequency is 54MHz. So I wonder if we shouldn't use 54000000 here.
Quoted 13 lines
arch/arm/boot/dts/armada-xp-gp.dts line 113
Quoted 5 lines
arch/arm/boot/dts/armada-xp-gp.dts +2
-0+ }; + }; }; };I applied, compiled and try this patch it worked well, at least for reading, I didn't try to write on the flash where my boolader is stored. So you can add my:
Tested-by Gregory Clement <[email protected]>
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
Hi Gregory,
Quoted 43 lines · Gregory CLEMENT
Quoted 42 lines · Gregory CLEMENT
Hi Ezequiel,
Quoted 39 lines · Ezequiel Garcia
This patch adds an SPI master device node for Armada XP-GP board. This master node is an SPI flash controller 'n25q128a13'.
Since there is no 'partitions' node declared, one full sized partition named as the device will be created.
Cc Gregory Clement <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Lior Amsalem <[email protected]>Signed-off-by Ezequiel Garcia <[email protected]>---
This patch depends on:1. Gregory's patch for Armada XP GP board:
arm: mvebu: support for the new Armada XP development board(DB-MV784MP-GP)2. My previous patch for SPI on Armada 370/XP:
arm: mvebu: Add support for SPI controller in Armada 370/XPAnd don't forget to compile the SPI flash driver,
CONFIG_MTD_M25P80=yarch/arm/boot/dts/armada-xp-gp.dts | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)arch/arm/boot/dts/armada-xp-gp.dts +7
-0@@ -97,5 +97,17 @@ phy = <&phy3>; phy-mode = "rgmii-id"; }; + + spi0: spi at d0010600 { + status = "okay"; + + spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>;
Quoted 9 lines
Quoted 3 lines
arch/arm/boot/dts/armada-xp-gp.dts line 109
Quoted 3 lines
arch/arm/boot/dts/armada-xp-gp.dts +3
-0+ compatible = "n25q128a13"; + reg = <0>; /* Chip select 0 */ + spi-max-frequency = <108000000>;I had a remark about it, according to the datasheet, 108MHz is the maximum frequency for the all the instructions but the READ instruction. For the READ the maximum frequency is 54MHz. So I wonder if we shouldn't use 54000000 here.
Mmm... nice catch.
The mtd driver for the spi flash (m25p80) will use FAST_READ opcode if CONFIG_M25PXX_USE_FAST_READ is selected, and this option is selected by default.
However we cannot count on this option being selected, of course.
On the other side, after some testing with spi-max-frequency = 50 MHz and also with spi-max-frequency = 108 MHz I'm seeing the flash often (not always) stalls when trying to read the full device through dd:
/ # dd if=/dev/mtd0ro of=/dev/null
This happens regardless of CONFIG_M25PXX_USE_FAST_READ, and regardless of spi-max-frequency = 50 MHz or 54 MHz or 108 MHz.
Note that setting 108 MHz is useless in our case, because there's an upper limit of 62.5 MHz set by the core clock of the SoC.
Using a read block size of 1M, the read completes OK -- always:
/ # dd if=/dev/mtd0 of=/dev/null bs=1M
16+0 records in
16+0 records out
16777216 bytes (16.0MB) copied, 27.306048 seconds, 600.0KB/s
Moreover, when the read completes, the achieved bandwidth is the same for 40, 50, 54, or 108 MHz.
If we set spi-max-frequency to 27 MHz (108 MHz / 4), it looks like the stalling disappear and the read always completes OK, at almost half the speed:
/ # dd if=/dev/mtd0ro of=/dev/null
32768+0 records in
32768+0 records out
16777216 bytes (16.0MB) copied, 49.005122 seconds, 334.3KB/s
So according to this analysis, we whould set 27 MHz as the max frequency, based on nothing but in these tests.
I'm not sure the stalling is due to the clocking or due to some driver bug (I don't like the tricks pulled by the busy loop in orion_spi_wait_till_ready() but probably this is completely unrelated).
Adding some SPI people in Cc, hoping they can shed a light on this.
What do you think?
Signature · 3 lines
Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
Quoted 56 lines · Ezequiel Garcia
Hi Gregory,
Quoted 43 lines · Gregory CLEMENT
Quoted 42 lines · Gregory CLEMENT
Hi Ezequiel,
Quoted 39 lines · Ezequiel Garcia
This patch adds an SPI master device node for Armada XP-GP board. This master node is an SPI flash controller 'n25q128a13'.
Since there is no 'partitions' node declared, one full sized partition named as the device will be created.
Cc Gregory Clement <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Lior Amsalem <[email protected]>Signed-off-by Ezequiel Garcia <[email protected]>---
This patch depends on:1. Gregory's patch for Armada XP GP board:
arm: mvebu: support for the new Armada XP development board(DB-MV784MP-GP)2. My previous patch for SPI on Armada 370/XP:
arm: mvebu: Add support for SPI controller in Armada 370/XPAnd don't forget to compile the SPI flash driver,
CONFIG_MTD_M25P80=yarch/arm/boot/dts/armada-xp-gp.dts | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)arch/arm/boot/dts/armada-xp-gp.dts +7
-0@@ -97,5 +97,17 @@ phy = <&phy3>; phy-mode = "rgmii-id"; }; + + spi0: spi at d0010600 { + status = "okay"; + + spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>;Quoted 9 lines
Quoted 3 lines
arch/arm/boot/dts/armada-xp-gp.dts line 109
Quoted 3 lines
arch/arm/boot/dts/armada-xp-gp.dts +3
-0+ compatible = "n25q128a13"; + reg = <0>; /* Chip select 0 */ + spi-max-frequency = <108000000>;I had a remark about it, according to the datasheet, 108MHz is the maximum frequency for the all the instructions but the READ instruction. For the READ the maximum frequency is 54MHz. So I wonder if we shouldn't use 54000000 here.
Quoted 5 lines
Mmm... nice catch.
The mtd driver for the spi flash (m25p80) will use
FAST_READopcode ifCONFIG_M25PXX_USE_FAST_READis selected, and this option is selected by default.
OK I didn't notice that thre wre a FAST_READ which was supported by Linux. So I think we can keep 108000000 as spi-max-frequency.
Quoted 35 lines
However we cannot count on this option being selected, of course.
On the other side, after some testing with spi-max-frequency = 50 MHz and also with spi-max-frequency = 108 MHz I'm seeing the flash often (not always) stalls when trying to read the full device through dd:
/ # dd if=/dev/mtd0ro of=/dev/null
This happens regardless of
CONFIG_M25PXX_USE_FAST_READ, and regardless of spi-max-frequency = 50 MHz or 54 MHz or 108 MHz.Note that setting 108 MHz is useless in our case, because there's an upper limit of 62.5 MHz set by the core clock of the SoC.
Using a read block size of 1M, the read completes OK -- always:
/ # dd if=/dev/mtd0 of=/dev/null bs=1M
16+0 records in
16+0 records out
16777216 bytes (16.0MB) copied, 27.306048 seconds, 600.0KB/sMoreover, when the read completes, the achieved bandwidth is the same for 40, 50, 54, or 108 MHz.
If we set spi-max-frequency to 27 MHz (108 MHz / 4), it looks like the stalling disappear and the read always completes OK, at almost half the speed:
/ # dd if=/dev/mtd0ro of=/dev/null
32768+0 records in
32768+0 records out
16777216 bytes (16.0MB) copied, 49.005122 seconds, 334.3KB/sSo according to this analysis, we whould set 27 MHz as the max frequency, based on nothing but in these tests.
Quoted 7 lines
I'm not sure the stalling is due to the clocking or due to some driver bug (I don't like the tricks pulled by the busy loop in
orion_spi_wait_till_ready()but probably this is completely unrelated).Adding some SPI people in Cc, hoping they can shed a light on this.
What do you think?
We have just seen this on IRC, so it seemed it was actually a problem in userspace not in kernel space.
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 arm: mvebu: Add SPI flash on Armada XP-GP board
In reply to Ezequiel Garcia(Adding mtd in Cc)
Quoted 63 lines · Ezequiel Garcia
Hi Gregory,
Quoted 43 lines · Gregory CLEMENT
Quoted 42 lines · Gregory CLEMENT
Hi Ezequiel,
Quoted 39 lines · Ezequiel Garcia
This patch adds an SPI master device node for Armada XP-GP board. This master node is an SPI flash controller 'n25q128a13'.
Since there is no 'partitions' node declared, one full sized partition named as the device will be created.
Cc Gregory Clement <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Lior Amsalem <[email protected]>Signed-off-by Ezequiel Garcia <[email protected]>---
This patch depends on:1. Gregory's patch for Armada XP GP board:
arm: mvebu: support for the new Armada XP development board(DB-MV784MP-GP)2. My previous patch for SPI on Armada 370/XP:
arm: mvebu: Add support for SPI controller in Armada 370/XPAnd don't forget to compile the SPI flash driver,
CONFIG_MTD_M25P80=yarch/arm/boot/dts/armada-xp-gp.dts | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)arch/arm/boot/dts/armada-xp-gp.dts +7
-0@@ -97,5 +97,17 @@ phy = <&phy3>; phy-mode = "rgmii-id"; }; + + spi0: spi at d0010600 { + status = "okay"; + + spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>;Quoted 9 lines
Quoted 3 lines
arch/arm/boot/dts/armada-xp-gp.dts line 109
Quoted 3 lines
arch/arm/boot/dts/armada-xp-gp.dts +3
-0+ compatible = "n25q128a13"; + reg = <0>; /* Chip select 0 */ + spi-max-frequency = <108000000>;I had a remark about it, according to the datasheet, 108MHz is the maximum frequency for the all the instructions but the READ instruction. For the READ the maximum frequency is 54MHz. So I wonder if we shouldn't use 54000000 here.
Mmm... nice catch.
The mtd driver for the spi flash (m25p80) will use
FAST_READopcode ifCONFIG_M25PXX_USE_FAST_READis selected, and this option is selected by default.
However we cannot count on this option being selected, of course.
Quoted 6 lines
On the other side, after some testing with spi-max-frequency = 50 MHz and also with spi-max-frequency = 108 MHz I'm seeing the flash often (not always) stalls when trying to read the full device through dd:
/ # dd if=/dev/mtd0ro of=/dev/null
FWIW, using CONFIG_DETECT_HUNG_TASK we can see the hung happens inside spi_sync(). It seems the completion handler is never called,
though I still don't understand under what circumstances that can happen.
dd D c02d79c8 0 964 961 0x00000000
[<c02d79c8>] (__schedule+0x1c8/0x504) from [<c02d61d0>] (schedule_timeout+0x158/0x200) [<c02d61d0>] (schedule_timeout+0x158/0x200) from [<c02d7504>] (wait_for_common+0xe0/0x194) [<c02d7504>] (wait_for_common+0xe0/0x194) from [<c0215b44>] (spi_sync+0x74/0x90) [<c0215b44>] (spi_sync+0x74/0x90) from [<c0214c80>] (m25p80_read+0x100/0x17c) [<c0214c80>] (m25p80_read+0x100/0x17c) from [<c020edac>] (mtd_read+0x8c/0xc0) [<c020edac>] (mtd_read+0x8c/0xc0) from [<c021404c>] (mtdchar_read+0xe0/0x224) [<c021404c>] (mtdchar_read+0xe0/0x224) from [<c00c757c>] (vfs_read+0xa4/0x148) [<c00c757c>] (vfs_read+0xa4/0x148) from [<c00c7664>] (sys_read+0x44/0x78) [<c00c7664>] (sys_read+0x44/0x78) from [<c000ede0>] (ret_fast_syscall+0x0/0x30)
Signature · 3 lines
Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com