I have a project that can boot Linux from the QSPI but cannot access the QSPI from Linux.
I would like to update the flash as suggested in the following thread:
http://forum.trenz-electronic.de/index.php/topic,302.msg991.html#msg991 (http://forum.trenz-electronic.de/index.php/topic,302.msg991.html#msg991)
However, I see no entries in /proc/mtd, nor mtd0, mtd1, but I do see spi@e000d000 in /proc/device-tree/amba.
I am running with a TE0715-15-1C on a TE0703. Here is what I see in Linux:
root@rfcc_plnx:~# ls /proc
1 3 812 crypto kpageflags swaps
10 360 813 device-tree loadavg sys
11 374 823 devices locks sysvipc
12 375 853 diskstats meminfo thread-self
13 376 862 driver misc timer_list
14 4 887 execdomains modules timer_stats
15 473 9 fb mounts tty
16 5 asound filesystems mtd uptime
17 50 buddyinfo fs net version
19 539 bus interrupts pagetypeinfo vmallocinfo
2 570 cgroups iomem partitions vmstat
229 582 cmdline ioports scsi zoneinfo
232 595 config.gz irq self
233 6 consoles kallsyms slabinfo
235 7 cpu kmsg softirqs
267 8 cpuinfo kpagecount stat
root@rfcc_plnx:~# cat /proc/mtd
dev: size erasesize name
root@rfcc_plnx:~# ls /proc/device-tree
#address-cells amba_pl fixedregulator@0 pmu
#size-cells chosen memory
aliases compatible model
amba cpus name
root@rfcc_plnx:~# ls /proc/device-tree/amba
#address-cells name
#size-cells ocmc@f800c000
adc@f8007100 ranges
cache-controller@f8f02000 sdhci@e0100000
can@e0008000 sdhci@e0101000
can@e0009000 serial@e0000000
compatible serial@e0001000
devcfg@f8007000 slcr@f8000000
dmac@f8003000 spi@e0006000
ethernet@e000b000 spi@e0007000
ethernet@e000c000 spi@e000d000
gpio@e000a000 timer@f8001000
i2c@e0004000 timer@f8002000
i2c@e0005000 timer@f8f00200
interrupt-controller@f8f01000 timer@f8f00600
interrupt-parent usb@e0002000
memory-controller@e000e000 usb@e0003000
memory-controller@f8006000 watchdog@f8005000
I have extracted the .dts from my image.ub and one that I downloaded from Trenz te0715-test board (it's 2015.4). The QSPI sections are the same.
I am attaching the extracted device tree source "regen_tree.dts" (renamed .txt).
I can provide the .hdf file if that would help.
Here is the boot output:
U-Boot 2014.07 (Jan 23 2015 - 20:57:00)
I2C: ready
DRAM: ECC disabled 1 GiB
MMC: zynq_sdhci: 0
SF: Detected S25FL256S_64K with page size 256 Bytes, erase size 64 KiB, total 32 MiB
In: serial
Out: serial
Err: serial
Net: Gem.e000b000
Warning: failed to set MAC address
Hit any key to stop autoboot: 0
boot Petalinux from QSPI flash
SF: Detected S25FL256S_64K with page size 256 Bytes, erase size 64 KiB, total 32 MiB
SF: 11010048 bytes @ 0x520000 Read: OK
## Loading kernel from FIT Image at 01000000 ...
Using 'conf@1' configuration
Trying 'kernel@1' kernel subimage
Description: PetaLinux Kernel
Type: Kernel Image
Compression: gzip compressed
Data Start: 0x010000f0
Data Size: 9459552 Bytes = 9 MiB
Architecture: ARM
OS: Linux
Load Address: 0x00008000
Entry Point: 0x00008000
Hash algo: crc32
Hash value: d5ccd00b
Verifying Hash Integrity ... crc32+ OK
## Loading fdt from FIT Image at 01000000 ...
Using 'conf@1' configuration
Trying 'fdt@1' fdt subimage
Description: Flattened Device Tree blob
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0x01905934
Data Size: 13494 Bytes = 13.2 KiB
Architecture: ARM
Hash algo: crc32
Hash value: b6775c7b
Verifying Hash Integrity ... crc32+ OK
Booting using the fdt blob at 0x1905934
Uncompressing Kernel Image ... OK
Loading Device Tree to 07ff9000, end 07fff4b5 ... OK
Starting kernel ...
console [ttyPS0] enabled
bootconsole [earlycon0] disabled
e0001000.serial: ttyPS1 at MMIO 0xe0001000 (irq = 145, base_baud = 6249999) is a xuartps
xdevcfg f8007000.devcfg: ioremap 0xf8007000 to 8086c000
[drm] Initialized drm 1.1.0 20060810
brd: module loaded
loop: module loaded
CAN device driver interface
libphy: MACB_mii_bus: probed
mdio_bus e000b000.etherne: /amba/ethernet@e000b000/mdio has invalid PHY address
mdio_bus e000b000.etherne: scan phy mdio at address 0
mdio_bus e000b000.etherne: scan phy mdio at address 1
mdio_bus e000b000.etherne: scan phy mdio at address 2
mdio_bus e000b000.etherne: scan phy mdio at address 3
mdio_bus e000b000.etherne: scan phy mdio at address 4
mdio_bus e000b000.etherne: scan phy mdio at address 5
mdio_bus e000b000.etherne: scan phy mdio at address 6
mdio_bus e000b000.etherne: scan phy mdio at address 7
mdio_bus e000b000.etherne: scan phy mdio at address 8
mdio_bus e000b000.etherne: scan phy mdio at address 9
mdio_bus e000b000.etherne: scan phy mdio at address 10
mdio_bus e000b000.etherne: scan phy mdio at address 11
mdio_bus e000b000.etherne: scan phy mdio at address 12
mdio_bus e000b000.etherne: scan phy mdio at address 13
mdio_bus e000b000.etherne: scan phy mdio at address 14
mdio_bus e000b000.etherne: scan phy mdio at address 15
mdio_bus e000b000.etherne: scan phy mdio at address 16
mdio_bus e000b000.etherne: scan phy mdio at address 17
mdio_bus e000b000.etherne: scan phy mdio at address 18
mdio_bus e000b000.etherne: scan phy mdio at address 19
mdio_bus e000b000.etherne: scan phy mdio at address 20
mdio_bus e000b000.etherne: scan phy mdio at address 21
mdio_bus e000b000.etherne: scan phy mdio at address 22
mdio_bus e000b000.etherne: scan phy mdio at address 23
mdio_bus e000b000.etherne: scan phy mdio at address 24
mdio_bus e000b000.etherne: scan phy mdio at address 25
mdio_bus e000b000.etherne: scan phy mdio at address 26
mdio_bus e000b000.etherne: scan phy mdio at address 27
mdio_bus e000b000.etherne: scan phy mdio at address 28
mdio_bus e000b000.etherne: scan phy mdio at address 29
mdio_bus e000b000.etherne: scan phy mdio at address 30
mdio_bus e000b000.etherne: scan phy mdio at address 31
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 147 (00:0a:35:00:1e:53)
macb e000b000.ethernet eth0: attached PHY driver [Marvell 88E1510] (mii_bus:phy_addr=e000b000.etherne:00, irq=-1)
macb e000c000.ethernet (unnamed net_device) (uninitialized): invalid hw address, using random
libphy: MACB_mii_bus: probed
mdio_bus e000c000.etherne: /amba/ethernet@e000c000/mdio has invalid PHY address
mdio_bus e000c000.etherne: scan phy mdio at address 0
mdio_bus e000c000.etherne: scan phy mdio at address 1
mdio_bus e000c000.etherne: scan phy mdio at address 2
mdio_bus e000c000.etherne: scan phy mdio at address 3
mdio_bus e000c000.etherne: scan phy mdio at address 4
mdio_bus e000c000.etherne: scan phy mdio at address 5
mdio_bus e000c000.etherne: scan phy mdio at address 6
mdio_bus e000c000.etherne: scan phy mdio at address 7
mdio_bus e000c000.etherne: scan phy mdio at address 8
mdio_bus e000c000.etherne: scan phy mdio at address 9
mdio_bus e000c000.etherne: scan phy mdio at address 10
mdio_bus e000c000.etherne: scan phy mdio at address 11
mdio_bus e000c000.etherne: scan phy mdio at address 12
mdio_bus e000c000.etherne: scan phy mdio at address 13
mdio_bus e000c000.etherne: scan phy mdio at address 14
mdio_bus e000c000.etherne: scan phy mdio at address 15
mdio_bus e000c000.etherne: scan phy mdio at address 16
mdio_bus e000c000.etherne: scan phy mdio at address 17
mdio_bus e000c000.etherne: scan phy mdio at address 18
mdio_bus e000c000.etherne: scan phy mdio at address 19
mdio_bus e000c000.etherne: scan phy mdio at address 20
mdio_bus e000c000.etherne: scan phy mdio at address 21
mdio_bus e000c000.etherne: scan phy mdio at address 22
mdio_bus e000c000.etherne: scan phy mdio at address 23
mdio_bus e000c000.etherne: scan phy mdio at address 24
mdio_bus e000c000.etherne: scan phy mdio at address 25
mdio_bus e000c000.etherne: scan phy mdio at address 26
mdio_bus e000c000.etherne: scan phy mdio at address 27
mdio_bus e000c000.etherne: scan phy mdio at address 28
mdio_bus e000c000.etherne: scan phy mdio at address 29
mdio_bus e000c000.etherne: scan phy mdio at address 30
mdio_bus e000c000.etherne: scan phy mdio at address 31
macb e000c000.ethernet eth1: Cadence GEM rev 0x00020118 at 0xe000c000 irq 148 (5e:67:1e:4d:d3:d6)
macb e000c000.ethernet eth1: attached PHY driver [Generic PHY] (mii_bus:phy_addr=e000c000.etherne:00, irq=-1)
e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k
e1000e: Copyright(c) 1999 - 2014 Intel Corporation.
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
usbcore: registered new interface driver usb-storage
e0002000.usb supply vbus not found, using dummy regulator
platform ci_hdrc.0: Driver ci_hdrc requests probe deferral
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
cdns-i2c e0004000.i2c: 400 kHz mmio e0004000 irq 141
cdns-i2c e0005000.i2c: 400 kHz mmio e0005000 irq 142
zynq-edac f8006000.memory-controller: ecc not enabled
Xilinx Zynq CpuIdle Driver started
Driver 'mmcblk' needs updating - please use bus_type methods
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
sdhci-arasan e0100000.sdhci: No vmmc regulator found
sdhci-arasan e0100000.sdhci: No vqmmc regulator found
mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP: cubic registered
NET: Registered protocol family 17
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20120528 t)
can: netlink gateway (rev 20130117) max_hops=1
Registering SWP/SWPB emulation handler
platform ci_hdrc.0: Driver ci_hdrc requests probe deferral
/opt/pkg/petalinux-v2015.2.1-final/components/linux-kernel/xlnx-3.19/drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
ALSA device list:
No soundcards found.
Freeing unused kernel memory: 6092K (40639000 - 40c2c000)
INIT: version 2.88 booting
Creating /dev/flash/* device nodes
random: dd urandom read with 0 bits of entropy available
starting Busybox inet Daemon: inetd... done.
Starting uWeb server:
NET: Registered protocol family 10
update-rc.d: /etc/init.d/run-postinsts exists during rc.d purge (continuing)
Removing any system startup links for run-postinsts ...
/etc/rcS.d/S99run-postinsts
INIT: Entering runlevel: 5
Configuring network interfaces... IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
udhcpc (v1.23.1) started
Sending discover...
Sending discover...
Sending discover...
No lease, forking to background
done.
Built with PetaLinux v2015.2.1 (Yocto 1.8) rfcc_plnx /dev/ttyPS0
rfcc_plnx login:
Plese ignore the MAC address confusion above. I have seen instructions on fixing it on the Trenz Wiki, but have not yet had time to fix it.
Any help would be appreciated.
Steven
Hi Steven,
in your extracted device tree source "regen_tree.dts", you use a driver from Micron for the flash (n25q128), see:
flash@0 {
compatible = "micron,n25q128";
reg = <0x0>;
#address-cells = <0x1>;
#size-cells = <0x1>;
spi-max-frequency = <0x2faf080>;
partition@0x00000000 {
label = "boot";
reg = <0x0 0x500000>;
};
partition@0x00500000 {
label = "bootenv";
reg = <0x500000 0x20000>;
};
partition@0x00520000 {
label = "kernel";
reg = <0x520000 0xa80000>;
};
partition@0x00fa0000 {
label = "spare";
reg = <0xfa0000 0x0>;
};
};
The TE0715 has a Flash from Spansion (S25FL256SAGBHI20), try the following code (i think the driver name should be correct)
flash@0 {
compatible = "spansion,s25fl256s";
reg = <0x0>;
#address-cells = <0x1>;
#size-cells = <0x1>;
spi-max-frequency = <0x2faf080>;
partition@0x00000000 {
label = "boot";
reg = <0x0 0x500000>;
};
partition@0x00500000 {
label = "bootenv";
reg = <0x500000 0x20000>;
};
partition@0x00520000 {
label = "kernel";
reg = <0x520000 0xa80000>;
};
partition@0x00fa0000 {
label = "spare";
reg = <0xfa0000 0x0>;
};
};
br
John
John,
Thanks for the info. I just tried that code and I still can't see /dev/mtd0. However, I do get "spansion,s25fl256s" in /proc/device-tree..../compatible.
In Petalinux-config -c kernel, I did not see any driver for either the micron or spansion, only the Xilinx QSPI. Do I need to specify another driver?
Thanks,
Steven
Please only change
system-top.dts
==========
by adding:
&flash0 {
compatible = "spansion,s25fl256s1";
#size-cells = <1>;
reg = <0x0>;
spi-tx-bus-width = <1>;
spi-rx-bus-width = <4>;
spi-max-frequency = <10000000>;
};
This is only change in devicetree needed for flash to work.
m25p80 spi0.0: s25fl256s1 (32768 Kbytes)
4 ofpart partitions found on MTD device spi0.0
Creating 4 MTD partitions on "spi0.0":
0x000000000000-0x000000500000 : "boot"
0x000000500000-0x000000520000 : "bootenv"
0x000000520000-0x000000fa0000 : "kernel"
0x000000fa0000-0x000002000000 : "spare"
this is snipped from bootlog
Annti,
Thank you! That works.
Steven