From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Mavrodiev Date: Wed, 7 Feb 2018 11:24:19 +0200 Subject: [U-Boot] [PATCH v4 2/2] Enable test case with A20-OLinuXino-Lime2 In-Reply-To: References: <1517922874-5815-1-git-send-email-stefan@olimex.com> <1517922874-5815-2-git-send-email-stefan@olimex.com> <70ef7ae8-5167-9f63-52a9-7ed080b8b1b5@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 02/07/2018 09:25 AM, Jagan Teki wrote: > On Wed, Feb 7, 2018 at 12:35 PM, Stefan Mavrodiev > wrote: >> On 02/07/2018 08:39 AM, Jagan Teki wrote: >>> On Wed, Feb 7, 2018 at 12:00 PM, Stefan Mavrodiev >>> wrote: >>>> On 02/06/2018 06:48 PM, Jagan Teki wrote: >>>>> On Tue, Feb 6, 2018 at 6:44 PM, Stefan Mavrodiev >>>>> 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 >>>>>> - Add flash sub-node of spi >>>>>> - Enable spi flash related options in the defconfig file >>>>>> >>>>>> The testing log is: >>>>>> >>>>>> U-Boot SPL 2018.03-rc1-00075-g35a689a-dirty (Feb 06 2018 - 14:40:07 >>>>>> +0200) >>>>>> DRAM: 1024 MiB >>>>>> CPU: 912000000Hz, AXI/AHB/APB: 3/2/2 >>>>>> Trying to boot from FEL >>>>> Why FEL? can't it boot from SPI-FLASH? >>>> Because I previously erased the flash during testing. Here is same, >>>> booting >>>> from SPI: >>>> >>>> U-Boot SPL 2018.03-rc1-00075-g61ce225 (Feb 07 2018 - 08:21:07 +0200) >>>> DRAM: 1024 MiB >>>> CPU: 912000000Hz, AXI/AHB/APB: 3/2/2 >>>> Trying to boot from sunxi SPI >>>> >>>> >>>> U-Boot 2018.03-rc1-00075-g61ce225 (Feb 07 2018 - 08:21:07 +0200) >>>> Allwinner >>>> Technology >>>> >>>> >>>> CPU: Allwinner A20 (SUN7I) >>>> Model: Olimex A20-OLinuXino-LIME2 >>>> I2C: ready >>>> DRAM: 1 GiB >>>> MMC: SUNXI SD/MMC: 0 >>>> Loading Environment from SPI Flash... SF: Detected w25q128bv with page >>>> size 256 Bytes, erase size 4 KiB, total 16 MiB >>>> OK >>>> 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: >>>>> >>>>>> U-Boot 2018.03-rc1-00075-g35a689a-dirty (Feb 06 2018 - 14:40:07 >>>>>> +0200) >>>>>> Allwinner Technology >>>>>> >>>>>> CPU: Allwinner A20 (SUN7I) >>>>>> Model: Olimex A20-OLinuXino-LIME2 >>>>>> I2C: ready >>>>>> DRAM: 1 GiB >>>>>> MMC: SUNXI SD/MMC: 0 >>>>>> Loading Environment from SPI Flash... SF: Detected w25q128bv with >>>>>> page >>>>>> size 256 Bytes, erase size 4 KiB, total 16 MiB >>>>>> OK >>>>>> 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 >>>>>> >>>>>> # Probe device >>>>>> => sf probe >>>>>> SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, >>>>>> total 16 MiB >>>>> How did this resolved w/o sspi? >>>> I enabled both CONFIG_SPI_FLASH and CONFIG_DM_SPI_FLASH. The driver-model >>>> search for >>>> "spi-flash" compatible string, probe it and bind it to the spi driver. >>>>> >>>>>> # Erase >>>>>> => sf erase 0x1000 0x100 >>>>>> SF: 256 bytes @ 0x1000 Erased: ERROR >>>>>> => sf erase 0x1000 0x1000 >>>>>> SF: 4096 bytes @ 0x1000 Erased: OK >>>>>> >>>>>> # Test >>>>>> => sf test 0 100000 >>>>>> SPI flash test: >>>>>> 0 erase: 12104 ticks, 84 KiB/s 0.672 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: 12104 ticks, 84 KiB/s 0.672 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 >>>>>> >>>>>> # Try write/read >>>>>> => sf erase 0x1000 0x1000 >>>>>> SF: 4096 bytes @ 0x1000 Erased: OK >>>>>> >>>>>> => md.b 0x50000000 0x100 >>>>>> 50000000: a9 4d b7 68 d2 48 69 c3 09 78 fa d3 33 66 e9 53 >>>>>> .M.h.Hi..x..3f.S >>>>>> 50000010: b0 53 af 79 ad 33 79 b1 f1 e3 1d 09 2e ba dd dc >>>>>> .S.y.3y......... >>>>>> 50000020: 8c eb eb 53 f4 ef 66 89 b5 e9 f6 fb af 73 7f cb >>>>>> ...S..f......s.. >>>>>> 50000030: b6 4b bf de c3 fd de bb 9a 53 ad 7d ef 38 6f bf >>>>>> .K.......S.}.8o. >>>>>> 50000040: fd fb e7 5e e9 db fc 0c fc f7 be 76 ad b9 fd eb >>>>>> ...^.......v.... >>>>>> 50000050: f3 ed 5f b5 bb bd ba 8f ff df 1f bf f3 ff fb d7 >>>>>> .._............. >>>>>> 50000060: b7 6e 9e 5f af 7a 62 ed 7f 66 1b 6d fd fb 47 f7 >>>>>> .n._.zb..f.m..G. >>>>>> 50000070: b7 fa f4 db d5 b6 d5 ff 81 e6 f5 d9 8f ef ff db >>>>>> ................ >>>>>> 50000080: b7 dd bd fb f3 1d 9d 2f f6 db c8 7f fb cf b9 f3 >>>>>> ......./........ >>>>>> 50000090: 3c ee da 2f b7 5e 6f bc f1 2f 2b cf 3f f2 fb ee >>>>>> <../.^o../+.?... >>>>>> 500000a0: 6f 5e 99 c3 3b 51 bd d4 be 40 4e db ab ed f9 77 >>>>>> o^..;Q... at N....w >>>>>> 500000b0: 9f f6 7d ed 54 4a 68 f8 7d ee 53 9b ff ae ef e4 >>>>>> ..}.TJh.}.S..... >>>>>> 500000c0: 73 ff 3c c7 f7 df f6 be bf 0f 97 96 3d 9b 9e 9f >>>>>> s.<.........=... >>>>>> 500000d0: e4 49 ca ff be fa ff df f7 7a cf ab 7f 7a 7b cf >>>>>> .I.......z...z{. >>>>>> 500000e0: bb c7 9f 3f c1 99 f2 f2 bf ee cf fb d5 b9 e2 e8 >>>>>> ...?............ >>>>>> 500000f0: ec e8 b2 bd 21 1f 5a ef 7a 7d 9d ad 31 89 3f 6f >>>>>> ....!.Z.z}..1.?o >>>>>> >>>>>> => sf write 0x50000000 0x1000 0x100 >>>>>> device 0 offset 0x1000, size 0x100 >>>>>> SF: 256 bytes @ 0x1000 Written: OK >>>>>> => sf read 0x51000000 0x1000 0x100 >>>>>> device 0 offset 0x1000, size 0x100 >>>>>> SF: 256 bytes @ 0x1000 Read: OK >>>>>> >>>>>> => cmp.b 0x50000000 0x51000000 0x100 >>>>>> Total of 256 byte(s) were the same >>>>>> >>>>>> Signed-off-by: Stefan Mavrodiev >>>>>> --- >>>>>> arch/arm/dts/sun7i-a20-olinuxino-lime2.dts | 30 >>>>>> ++++++++++++++++++++++++++++++ >>>>>> configs/A20-OLinuXino-Lime2_defconfig | 11 +++++++++++ >>>>>> drivers/mtd/spi/Makefile | 4 +++- >>>>>> include/configs/sunxi-common.h | 2 ++ >>>>>> 4 files changed, 46 insertions(+), 1 deletion(-) >>>>>> >>>>>> diff --git a/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts >>>>>> b/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts >>>>>> index d5c796c..a6ee87c 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 = ; >>>>>> }; >>>>>> >>>>>> + spi0_pins_b: spi0 at 1 { >>>>>> + allwinner,pins = "PC0", "PC1", "PC2"; >>>>>> + allwinner,function = "spi0"; >>>>>> + allwinner,drive = ; >>>>>> + allwinner,pull = ; >>>>>> + }; >>>>>> + >>>>>> + spi0_cs0_pins_b: spi0_cs0 at 1 { >>>>>> + allwinner,pins = "PC23"; >>>>>> + allwinner,function = "spi0"; >>>>>> + allwinner,drive = ; >>>>>> + allw inner,pull = ; >>>>>> + }; >>>>>> + >>>>>> usb0_id_detect_pin: usb0_id_detect_pin at 0 { >>>>>> allwinner,pins = "PH4"; >>>>>> allwinner,function = "gpio_in"; >>>>>> @@ -257,6 +272,21 @@ >>>>>> status = "okay"; >>>>>> }; >>>>>> >>>>>> +&spi0 { >>>>>> + pinctrl-names = "default"; >>>>>> + pinctrl-0 = <&spi0_pins_b>, <&spi0_cs0_pins_b>; >>>>>> + status = "okay"; >>>>>> + >>>>>> + flash: w25q128 at 0 { >>>>> Was it sync from Linux? >>>> No, this isn't in the linux dts. >>> But we have to, please send it to Linux first. >> We've already commented this issue. In the v2 [1], I've explained that this >> won't go mainline, since it's optional feature. Rather it will be managed >> with overlays. > Thought this was already in ML, and ready to merge. So this never go > to Linux tree since it's optional? then add u-boot.dtsi for this > atleast since we always sync dts from Linux. OK, I'll do this. In the next revision, how to implement your patch [1]? As part of the series or mentioned somehow? [1]https://patchwork.ozlabs.org/patch/869946/