On 01/02/2018 01:01 PM, Stefan Mavrodiev wrote:
On 12/26/2017 11:47 AM, Jagan Teki wrote:
On Fri, Dec 22, 2017 at 3:30 PM, Stefan Mavrodiev <ste...@olimex.com> wrote:
Driver testing is done with A20-OLinuXino-Lime2. Testing
requirements are:
   - Exposing spi0 alternative pins in the dts file
   - Add alias node, enabling driver probing
   - Enable spi flash related options in the defconfig file

The testing log is:
   U-Boot SPL 2018.01-rc2-00023-gfa13cb3-dirty (Dec 22 2017 - 11:39:48)
   DRAM: 1024 MiB
   CPU: 912000000Hz, AXI/AHB/APB: 3/2/2
   Trying to boot from sunxi SPI


   U-Boot 2018.01-rc2-00023-gfa13cb3-dirty (Dec 22 2017 - 11:39:48 +0200) Allwinner Technology

   CPU:   Allwinner A20 (SUN7I)
   Model: Olimex A20-OLinuXino-LIME2
Lime2 doen't have in-built spi-nor is it?
We have some prototypes with this option.

   I2C:   ready
   DRAM:  1 GiB
   MMC:   SUNXI SD/MMC: 0
   MMC: no card present
   mmc_init: -123, time 1
   *** Warning - MMC init failed, using default environment
you lost the env? since it's spi-nor better to use flash env.
What's the point since this is only test case?

   In:    serial
   Out:   serial
   Err:   serial
   Allwinner mUSB OTG (Peripheral)
   SCSI:  SATA link 0 timeout.
   AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
   flags: ncq stag pm led clo only pmp pio slum part ccc apst
   Net:   No ethernet found.
   starting USB...
   USB0:   USB EHCI 1.00
   USB1:   USB OHCI 1.0
   USB2:   USB EHCI 1.00
   USB3:   USB OHCI 1.0
   scanning bus 0 for devices... 1 USB Device(s) found
   scanning bus 2 for devices... 1 USB Device(s) found
          scanning usb for storage devices... 0 Storage Device(s) found
   Hit any key to stop autoboot:  0
   => sspi

   => sf probe
   SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
try to use erase/write and read commands to verify
# Erase one sector
=> sf erase 0x1000 0x100
SF: 256 bytes @ 0x1000 Erased: ERROR
=> sf erase 0x1000 0x1000
SF: 4096 bytes @ 0x1000 Erased: OK

# Get some random data
=> md.b 0x50000000 0x100
50000000: d6 4d d0 7e 93 d8 0f 48 1b ef 7f 7e be 4e a8 5d .M.~...H...~.N.] 50000010: fd 9f e5 7f 2f 7b 5b 19 ed de d8 58 99 7a 24 da ..../{[....X.z$. 50000020: ef dd 9c 45 d7 97 ab 4f e7 fb ee 61 bc de 6a 1a ...E...O...a..j. 50000030: 9a 9f f4 3a be 4b 2f f3 ce 77 87 7e 07 23 af ff ...:.K/..w.~.#.. 50000040: e5 e5 c0 fa 65 e2 78 9b 16 38 42 52 e5 6c 52 0d ....e.x..8BR.lR. 50000050: f5 ff da 94 7f 98 96 d7 f0 9d 66 ae 9b b9 a2 cd ..........f..... 50000060: 0b dd f1 c9 1d 3b fe 5b cf ef d6 ce 8b c5 fd 56 .....;.[.......V 50000070: e2 52 eb 78 d4 f1 bf 57 56 6a 57 58 52 f1 0e 9d .R.x...WVjWXR... 50000080: df be f8 19 bf cf d7 ac 4b 3e 86 21 3f c3 fe 3e ........K>.!?..> 50000090: ea 27 52 ca 1f 79 bd 7b ef bf 96 c9 9d f6 81 d3 .'R..y.{........ 500000a0: cc 2e 8b c8 34 7f c5 2f 29 19 a8 dc 54 7a 07 1d ....4../)...Tz.. 500000b0: f4 e6 db ed 38 03 59 bb 31 ee b3 dd 5c e6 be 58 ....8.Y.1...\..X 500000c0: a6 7c 87 61 84 47 e0 b1 a1 fc 6e d3 d5 93 bf 8a .|.a.G....n..... 500000d0: 5d a3 be 4b cf 07 1d 92 ff 36 f9 46 fb 5a cb 8f ]..K.....6.F.Z.. 500000e0: f9 27 7a b8 7b 07 2e 22 a1 ee 56 bc a7 de 57 6a .'z.{.."..V...Wj
500000f0: da d4 7d 7f ee db 7a e2 bc 5c 44 64 b7 fc ea 3e ..}...z..\Dd...

# Write one page to spi-nor
=> sf write 0x50000000 0x1000 0x100
device 0 offset 0x1000, size 0x100
SF: 256 bytes @ 0x1000 Written: OK

# Readback data
=> sf read 0x51000000 0x1000 0x100
device 0 offset 0x1000, size 0x100
SF: 256 bytes @ 0x1000 Read: OK

# Compare data
=> cmp.b 0x50000000 0x51000000 0x100
Total of 256 byte(s) were the same

   => sf test 0 100000
   SPI flash test:
   0 erase: 11407 ticks, 89 KiB/s 0.712 Mbps
   1 check: 8881 ticks, 115 KiB/s 0.920 Mbps
   2 write: 10824 ticks, 94 KiB/s 0.752 Mbps
   3 read: 8872 ticks, 115 KiB/s 0.920 Mbps
   Test passed
   0 erase: 11407 ticks, 89 KiB/s 0.712 Mbps
   1 check: 8881 ticks, 115 KiB/s 0.920 Mbps
   2 write: 10824 ticks, 94 KiB/s 0.752 Mbps
   3 read: 8872 ticks, 115 KiB/s 0.920 Mbps
   =>

Signed-off-by: Stefan Mavrodiev <ste...@olimex.com>
---
  arch/arm/dts/sun7i-a20-olinuxino-lime2.dts | 21 +++++++++++++++++++++
  configs/A20-OLinuXino-Lime2_defconfig      |  8 ++++++++
  2 files changed, 29 insertions(+)

diff --git a/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts b/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts
index d5c796c..3c708da 100644
--- a/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts
+++ b/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts
@@ -54,6 +54,7 @@

         aliases {
                 serial0 = &uart0;
+               spi0 = &spi0;
         };

         chosen {
@@ -215,6 +216,20 @@
                 allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
         };

+       spi0_pins_b: spi0@1 {
+               allwinner,pins = "PC0", "PC1", "PC2";
+               allwinner,function = "spi0";
+               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+       };
+
+       spi0_cs0_pins_b: spi0_cs0@1 {
+               allwinner,pins = "PC23";
+               allwinner,function = "spi0";
+               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+       };
+
         usb0_id_detect_pin: usb0_id_detect_pin@0 {
                 allwinner,pins = "PH4";
                 allwinner,function = "gpio_in";
@@ -257,6 +272,12 @@
         status = "okay";
  };

+&spi0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&spi0_pins_b>, <&spi0_cs0_pins_b>;
+       status = "okay";
+};
+
  &uart0 {
         pinctrl-names = "default";
         pinctrl-0 = <&uart0_pins_a>;
diff --git a/configs/A20-OLinuXino-Lime2_defconfig b/configs/A20-OLinuXino-Lime2_defconfig
index 1edc844..c499e3d 100644
--- a/configs/A20-OLinuXino-Lime2_defconfig
+++ b/configs/A20-OLinuXino-Lime2_defconfig
@@ -30,3 +30,11 @@ CONFIG_SCSI=y
  CONFIG_USB_EHCI_HCD=y
  CONFIG_USB_MUSB_GADGET=y
  CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_SF_TEST=y
Ok, but not useful to include in config's

+CONFIG_CMD_SPI=y
this command is not needed, since the current usage on your board as
spi-nor flash

Regards,
Stefan Mavrodiev

Hello,

What's the current status of the driver? Do I have to make more changes, etc ?

Regards,
Stefan Mavrodiev

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to