How to boot from SPI?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to boot from SPI?

Jump to solution
5,863 Views
pt
Senior Contributor I

Hi

I have applied the linux kernel patch and u-boot patch for SPI.

The sf commands are enabled and sf probe detects spi flash.

I want to know the steps to boot from spi.

I am able to boot from sd card and network.

Linux : 2.6.35 kernel version

Board : MCIMX28EVK

SPI Flash :N25Q128

Regards

Parvathy

Labels (2)
Tags (3)
0 Kudos
1 Solution
3,694 Views
igorpadykov
NXP Employee
NXP Employee

Hi Parvathy

software patch for i.MX28 SPI boot has been worked out in Freescale Community.

Please refer to this link for detail:

How to enable SPI NOR boot for i.MX28 (Spansion s25fl256s)

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
13 Replies
3,695 Views
igorpadykov
NXP Employee
NXP Employee

Hi Parvathy

software patch for i.MX28 SPI boot has been worked out in Freescale Community.

Please refer to this link for detail:

How to enable SPI NOR boot for i.MX28 (Spansion s25fl256s)

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
3,694 Views
pt
Senior Contributor I

Hi

I have applied the kernel patch and uboot patch.By using mk_mx28_sd script,I have burned the image to sd card.

sf probe 2:0 detected the flash.

tftp 0x42000000

sf erase 0x100000 0x300000

sf write 0x42000000 0x100000 0x300000

sf read 0x42000000 0x100000 0x300000

I have used the above commands to write and read from spi.

/**********************************************************************************************************************************************************************************************************************/

Debug uart message log

-------------------------------------------------

U-Boot 2009.08 (Oct 07 2014 - 11:12:16)

Freescale i.MX28 family

CPU:   454 MHz

BUS:   151 MHz

EMI:   205 MHz

GPMI:   24 MHz

DRAM:  128 MB

MMC:   IMX_SSP_MMC: 0, IMX_SSP_MMC: 1

In:    serial

Out:   serial

Err:   serial

Net:   got MAC address from IIM: 00:04:9f:02:b6:94

FEC0

Hit any key to stop autoboot:  0

MX28 U-Boot > printenv

bootargs=console=ttyAM0,115200n8

bootcmd=run bootcmd_net

bootdelay=3

baudrate=115200

ipaddr=192.168.1.103

serverip=192.168.1.101

netmask=255.255.255.0

bootfile="uImage"

loadaddr=0x42000000

bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp fec_mac=${ethaddr}

bootcmd_net=run bootargs_nfs; dhcp; bootm

bootargs_mmc=setenv bootargs ${bootargs} root=/dev/mmcblk0p3 rw rootwait ip=dhcp fec_mac=${ethaddr}

bootcmd_mmc=run bootargs_mmc; mmc read 0 ${loadaddr} 100 3000; bootm

ethact=FEC0

nfsroot=/home/i.MX28/ltib/ltib/rootfs

stdin=serial

stdout=serial

stderr=serial

ver=U-Boot 2009.08 (Oct 07 2014 - 11:12:16)

Environment size: 656/130044 bytes

MX28 U-Boot > setenv serverip 192.168.2.114

MX28 U-Boot > saveenv

Saving Environment to MMC...

Writing to MMC(0)... done

MX28 U-Boot > setenv ipaddr 192.168.2.113

MX28 U-Boot > saveenv

Saving Environment to MMC...

Writing to MMC(0)... done

MX28 U-Boot > printenv

bootargs=console=ttyAM0,115200n8

bootcmd=run bootcmd_net

bootdelay=3

baudrate=115200

netmask=255.255.255.0

bootfile="uImage"

loadaddr=0x42000000

bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp fec_mac=${ethaddr}

bootcmd_net=run bootargs_nfs; dhcp; bootm

bootargs_mmc=setenv bootargs ${bootargs} root=/dev/mmcblk0p3 rw rootwait ip=dhcp fec_mac=${ethaddr}

bootcmd_mmc=run bootargs_mmc; mmc read 0 ${loadaddr} 100 3000; bootm

ethact=FEC0

nfsroot=/home/i.MX28/ltib/ltib/rootfs

stdin=serial

stdout=serial

stderr=serial

ver=U-Boot 2009.08 (Oct 07 2014 - 11:12:16)

serverip=192.168.2.114

ipaddr=192.168.2.113

Environment size: 656/130044 bytes

MX28 U-Boot > setenv bootargs_spi 'setenv bootargs ${bootargs} root=/dev/mtdblock2 rootfstype=jffs2 rootwait rw ip=none'

MX28 U-Boot > saveenv

Saving Environment to MMC...

Writing to MMC(0)... done

MX28 U-Boot > setenv bootcmd_spi 'run bootargs_spi;sf probe 2:0; sf read ${loadaddr} 0x100000 0x300000;bootm'             

MX28 U-Boot > saveenv

Saving Environment to MMC...

Writing to MMC(0)... done

MX28 U-Boot > run

  bootargs bootcmd bootdelay baudrate netmask bootfile loadaddr bootargs_nfs

  bootcmd_net bootargs_mmc bootcmd_mmc ethact nfsroot stdin stdout stderr ver

  serverip ...

MX28 U-Boot > tftp 0x42000000

Using FEC0 device

TFTP from server 192.168.2.114; our IP address is 192.168.2.113

Filename 'uImage'.

Load address: 0x42000000

Loading: FEC: Link is down 7809

T #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         #

done

Bytes transferred = 2998040 (2dbf18 hex)

MX28 U-Boot > sf write      

No SPI flash selected. Please run `sf probe'

MX28 U-Boot > sf probe 2:0  

SF: Detected N25Q128 with page size 256, total 16777216 bytes

16384 KiB N25Q128 at 2:0 is now current device

MX28 U-Boot > sf probe 2:0

SF: Detected N25Q128 with page size 256, total 16777216 bytes

16384 KiB N25Q128 at 2:0 is now current device

MX28 U-Boot > sf erase 0x100000 0x300000

SF: STMicro: Successfully erased 3145728 bytes @ 0x100000

MX28 U-Boot > sf write 0x42000000 0x100000 0x300000

SF: STMicro: Successfully programmed 3145728 bytes @ 0x100000

MX28 U-Boot > sf read 0x42000000 0x100000 0x300000

MX28 U-Boot > run bootcmd_spi

SF: Detected N25Q128 with page size 256, total 16777216 bytes

16384 KiB N25Q128 at 2:0 is now current device

## Booting kernel from Legacy Image at 42000000 ...

   Image Name:   Linux-2.6.35.3-g779560d-dirty

   Image Type:   ARM Linux Kernel Image (uncompressed)

   Data Size:    2997976 Bytes =  2.9 MB

   Load Address: 40008000

   Entry Point:  40008000

   Verifying Checksum ... OK

   Loading Kernel Image ... OK

OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

Linux version 2.6.35.3-g779560d-dirty (dtsuser@dtsmachine) (gcc version 4.4.4 (4.4.4_09.06.2010) ) #19 PREEMPT Wed Oct 1 16:18:52 IST 2014

CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177

CPU: VIVT data cache, VIVT instruction cache

Machine: Freescale MX28EVK board

Memory policy: ECC disabled, Data cache writeback

Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512

Kernel command line: console=ttyAM0,115200n8 root=/dev/mtdblock2 rootfstype=jffs2 rootwait rw ip=none

PID hash table entries: 512 (order: -1, 2048 bytes)

Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)

Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)

Memory: 128MB = 128MB total

Memory: 123432k/123432k available, 7640k reserved, 0K highmem

Virtual kernel memory layout:

    vector  : 0xffff0000 - 0xffff1000   (   4 kB)

    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

    DMA     : 0xfde00000 - 0xffe00000   (  32 MB)

    vmalloc : 0xc8800000 - 0xf0000000   ( 632 MB)

    lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)

    modules : 0xbf000000 - 0xc0000000   (  16 MB)

      .init : 0xc0008000 - 0xc0034000   ( 176 kB)

      .text : 0xc0034000 - 0xc05ce000   (5736 kB)

      .data : 0xc05ce000 - 0xc06113a0   ( 269 kB)

SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1

Hierarchical RCU implementation.

        RCU-based detection of stalled CPUs is disabled.

        Verbose stalled-CPUs detection is disabled.

NR_IRQS:288

Console: colour dummy device 80x30

console [ttyAM0] enabled

Calibrating delay loop... 226.09 BogoMIPS (lpj=1130496)

pid_max: default: 32768 minimum: 301

Security Framework initialized

SELinux:  Initializing.

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

regulator: core version 0.5

NET: Registered protocol family 16

regulator: vddd: 800 <--> 1575 mV at 1500 mV fast normal

regulator: vdddbo: 800 <--> 1575 mV fast normal

regulator: vdda: 1500 <--> 2275 mV at 1800 mV fast normal

vddio = 3380000, val=10

regulator: vddio: 2880 <--> 3680 mV at 3380 mV fast normal

regulator: overall_current: fast normal

regulator: vbus5v:

regulator: mxs-duart-1: fast normal

regulator: mxs-bl-1: fast normal

regulator: mxs-i2c-1: fast normal

regulator: mmc_ssp-1: fast normal

regulator: mmc_ssp-2: fast normal

regulator: charger-1: fast normal

regulator: power-test-1: fast normal

regulator: cpufreq-1: fast normal

i.MX IRAM pool: 124 KB@0xc8820000

usb DR wakeup device is registered

IMX usb wakeup probe

audit: cannot initialize inotify handle

bio: create slab <bio-0> at 0

SCSI subsystem initialized

Freescale USB OTG Driver loaded, $Revision: 1.55 $

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

Advanced Linux Sound Architecture Driver Version 1.0.23.

Bluetooth: Core ver 2.15

NET: Registered protocol family 31

Bluetooth: HCI device and connection manager initialized

Bluetooth: HCI socket layer initialized

cfg80211: Calling CRDA to update world regulatory domain

NetLabel: Initializing

NetLabel:  domain hash size = 128

NetLabel:  protocols = UNLABELED CIPSOv4

NetLabel:  unlabeled traffic allowed by default

Switching to clocksource mxs clock source

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 4096 (order: 3, 32768 bytes)

TCP bind hash table entries: 4096 (order: 2, 16384 bytes)

TCP: Hash tables configured (established 4096 bind 4096)

TCP reno registered

UDP hash table entries: 256 (order: 0, 4096 bytes)

UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)

NET: Registered protocol family 1

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

RPC: Registered tcp NFSv4.1 backchannel transport module.

Bus freq driver module loaded

IMX usb wakeup probe

usb h1 wakeup device is registered

mxs_cpu_init: cpufreq init finished

audit: initializing netlink socket (disabled)

type=2000 audit(0.660:1): initialized

VFS: Disk quotas dquot_6.5.2

Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)

JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.

msgmni has been set to 241

alg: No test for stdrng (krng)

cryptodev: driver loaded.

Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)

io scheduler noop registered

io scheduler deadline registered

io scheduler cfq registered (default)

Console: switching to colour frame buffer device 100x30

mxs-duart.0: ttyAM0 at MMIO 0x80074000 (irq = 47) is a DebugUART

mxs-auart.0: ttySP0 at MMIO 0x8006a000 (irq = 112) is a mxs-auart.0

Found APPUART 3.1.0

mxs-auart.1: ttySP1 at MMIO 0x8006c000 (irq = 113) is a mxs-auart.1

Found APPUART 3.1.0

mxs-auart.2: ttySP2 at MMIO 0x8006e000 (irq = 114) is a mxs-auart.2

Found APPUART 3.1.0

mxs-auart.3: ttySP3 at MMIO 0x80070000 (irq = 115) is a mxs-auart.3

Found APPUART 3.1.0

mxs-auart.4: ttySP4 at MMIO 0x80072000 (irq = 116) is a mxs-auart.4

Found APPUART 3.1.0

brd: module loaded

loop: module loaded

i.MX GPMI NFC

NFC: Version 1, 8-chip GPMI and BCH

gpmi-nfc: probe of gpmi-nfc.0 failed with error 1

mxs-spi mxs-spi.0: Max possible speed 120000 = 120000000/2 kHz

mxs-spi mxs-spi.0: at 0x80014000 mapped to 0xF0014000, irq=84, bus 1, DMA ver_major 4

FEC Ethernet Driver

fec_enet_mii_bus: probed

ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver

fsl-ehci fsl-ehci: Freescale On-Chip EHCI Host Controller

fsl-ehci fsl-ehci: new USB bus registered, assigned bus number 1

fsl-ehci fsl-ehci: irq 93, io base 0x80080000

fsl-ehci fsl-ehci: USB 2.0 started, EHCI 1.00

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 1 port detected

fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller

fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 2

fsl-ehci fsl-ehci.0: irq 92, io base 0x80090000

fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00

hub 2-0:1.0: USB hub found

hub 2-0:1.0: 1 port detected

Initializing USB Mass Storage driver...

usbcore: registered new interface driver usb-storage

USB Mass Storage support registered.

ARC USBOTG Device Controller driver (1 August 2005)

mice: PS/2 mouse device common for all mice

input: mxs-kbd as /devices/platform/mxs-kbd.0/input/input0

input: MXS touchscreen as /devices/virtual/input/input1

MXS RTC driver v1.0 hardware v2.3.0

mxs-rtc mxs-rtc.0: rtc core: registered mxs-rtc as rtc0

IR NEC protocol handler initialized

IR RC5(x) protocol handler initialized

IR RC6 protocol handler initialized

IR JVC protocol handler initialized

IR Sony protocol handler initialized

Linux video capture interface: v2.00

mxs-pxp mxs-pxp.0: initialized

mxs watchdog: initialized, heartbeat 19 sec

Bluetooth: HCI UART driver ver 2.2

Bluetooth: HCI H4 protocol initialized

Bluetooth: HCI BCSP protocol initialized

Bluetooth: Generic Bluetooth SDIO driver ver 0.1

mxs-mmc: MXS SSP Controller MMC Interface driver

mxs-mmc mxs-mmc.0: mmc0: MXS SSP MMC DMAIRQ 82 ERRIRQ 96

__mxs_reset_block(f0012000): timeout when resetting

mxs-mmc mxs-mmc.1: mmc1: MXS SSP MMC DMAIRQ 83 ERRIRQ 97

dcp dcp.0: DCP crypto enabled.!

usbcore: registered new interface driver hiddev

usbcore: registered new interface driver usbhid

usbhid: USB HID core driver

sgtl5000-i2c 0-000a: SGTL5000 revision 17

mmc0: new high speed SDHC card at address e624

mmcblk0: mmc0:e624 SU04G 3.69 GiB

mmcblk0: p1 p2 p3

mxs-spdif mxs-spdif.0: MXS SPDIF Audio Transmitter

No device for codec mxs spdif

No device for DAI mxs spdif

No device for DAI mxs-saif

No device for DAI mxs-spdif

asoc: SGTL5000 <-> mxs-saif mapping ok

Failed to add route LINE_OUT->Ext Spk

asoc: mxs spdif <-> mxs-spdif mapping ok

ALSA device list:

  #0: mxs-evk (SGTL5000)

  #1: mxs-evk (mxs spdif)

Netfilter messages via NETLINK v0.30.

nf_conntrack version 0.5.0 (1928 buckets, 7712 max)

CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Please use

nf_conntrack.acct=1 kernel parameter, acct=1 nf_conntrack module option or

sysctl net.netfilter.nf_conntrack_acct=1 to enable it.

ctnetlink v0.93: registering with nfnetlink.

xt_time: kernel timezone is -0000

ip_tables: (C) 2000-2006 Netfilter Core Team

ipt_CLUSTERIP: ClusterIP Version 0.8 loaded successfully

arp_tables: (C) 2002 David S. Miller

TCP cubic registered

NET: Registered protocol family 17

Bridge firewalling registered

Ebtables v2.0 registered

can: controller area network core (rev 20090105 abi 8)

NET: Registered protocol family 29

can: raw protocol (rev 20090105)

Bluetooth: L2CAP ver 2.14

Bluetooth: L2CAP socket layer initialized

Bluetooth: SCO (Voice Link) ver 0.6

Bluetooth: SCO socket layer initialized

Bluetooth: RFCOMM TTY layer initialized

Bluetooth: RFCOMM socket layer initialized

Bluetooth: RFCOMM ver 1.11

Bluetooth: BNEP (Ethernet Emulation) ver 1.3

Bluetooth: HIDP (Human Interface Emulation) ver 1.2

802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>

All bugs added by David S. Miller <davem@redhat.com>

lib80211: common routines for IEEE802.11 drivers

mxs-rtc mxs-rtc.0: setting system clock to 1970-01-01 01:19:55 UTC (4795)

Waiting for root device /dev/mtdblock2...

-------------------------------------------------------------------------------------------------------------------------

Not going beyond this.Its waiting for mtdblock2.How to solve this issue?

Regards

Pt

0 Kudos
3,694 Views
igorpadykov
NXP Employee
NXP Employee

From log:

"Kernel command line: console=ttyAM0,115200n8 root=/dev/mtdblock2 rootfstype=jffs2"


where is located your rootfs system , what device ?


~igor

0 Kudos
3,694 Views
pt
Senior Contributor I

Hi

I need to store rootfs system to spi flash.

I am able to store it sd card and successfully booted up from mmc.

I am using tftp to copy the file in the case of spi.

How to copy rootfs system to mtdblock2 to boot from spi?

Regards

Pt

0 Kudos
3,694 Views
igorpadykov
NXP Employee
NXP Employee

Hi Parvathy

I think you can boot from sd and check

if spi-nor mtdblock2 is accessible. Then you can

just copy rootfs from sd to spi-nor.

Usually rootfs is big size, do you have sufficient spi-nor

capacity to hold it ?

~igor

0 Kudos
3,694 Views
pt
Senior Contributor I

Hi igorpadykov

I am using N25Q128 spi flash.

SF: Detected N25Q128 with page size 256, total 16777216 bytes

16384 KiB N25Q128 at 2:0 is now current device

16MB. I think rootfs size is big.so spi boot is not possible,right?

Regards

Pt

0 Kudos
3,694 Views
igorpadykov
NXP Employee
NXP Employee

yes I think 16MB is not sufficient for roofs.

You can boot from spi but have rootfs on other device,

for example sd.

~igor

3,694 Views
pt
Senior Contributor I

Hi

How to reduce the size of rootfs?

Regards

Pt

0 Kudos
3,694 Views
igorpadykov
NXP Employee
NXP Employee

remove unused programs

~igor

3,694 Views
pt
Senior Contributor I

Hi

How to optimize the size at compiler level? CFLAGS of complier to reduce size.

0 Kudos
3,694 Views
igorpadykov
NXP Employee
NXP Employee
0 Kudos
3,694 Views
pt
Senior Contributor I

Hi

I have used mfgtools to program spi. But I am getting the following error.

Log:

Panel A Start <CMD/> type="push" body="mknod class/mtd,mtd0,/dev/mtd0" file="" timeout="10" onError="" text="".

1 - Panel A Finished <CMD/> type="push" body="mknod class/mtd,mtd0,/dev/mtd0" file="" timeout="10" onError="" text="" FAIL code=0xffffffea.

Panel A: Command is not supported by device.,failed to run command: type="push" body="mknod class/mtd,mtd0,/dev/mtd0" file="" timeout="10" onError="" text="" 

2 - Panel A Finished processing SPI-NOR (uboot.sb) <LIST/> : FAIL code=-22.

Regards

Pt

0 Kudos
3,694 Views
pt
Senior Contributor I

Hi

Thank you.I will try to do that.

Regards

Pt

0 Kudos