Booting mx25 based device from SD and NOR
Roberto Nibali
rnibali at gmail.com
Thu May 31 09:12:08 EDT 2012
Hi
> +#
> > +# (C) Copyright 2007 Juergen Beisert <jbe at pengutronix.de>
>
> You should replace this with your own copyright. I think Jürgen can live
> with not having a copyright on trivial files ;)
>
Ok, will do.
> > diff --git a/arch/arm/boards/fq-sid1-mx25-noah/env/config
>
> Have you considered using one of the environment templates? You
> shouldn't duplicate them.
I haven't, I'll have look into them once I get NOR and SD card
functionality inside barebox ... for which I have exactly one day left :).
> > +# or set your networking parameters here
> > +#eth0.ipaddr=192.168.1.80
> > +#eth0.netmask=255.255.255.0
> > +#eth0.gateway=a.b.c.d
> > +eth0.serverip=192.168.1.23
> > +eth0.ethaddr=00:50:c2:8c:e6:0e
>
> *never* *ever* add MAC addresses to the default environment.
Ok. In my case, the MAC address is actually stored inside a secured at24
EEPROM buffer. Unfortunately, at24 via I2C does not seem to be available in
barebox. I reckon I have to port it from the kernel or uboot :).
> > + { .ptr_type = 4, .addr = 0xb8001004, .val = 0x0076e83a, }, /* initial
> > value for ESDCFG0 */
>
> Your mailer wraps lines.
Yeah, sorry for that, gmail is all I have at the moment, however for
serious inclusion or review of any patches, I'll definitely try to resort
to ``git send-email''
> > +#endif
> > +#ifdef CONFIG_DRIVER_VIDEO_IMX
> > + //imx25_add_fb(&noah_fb_data);
>
> Please remove dead code before posting this for inclusion
Will do, thanks.
I have included some more debugging and also workarounds for the mx25. This
is the current debug output, where it clearly indicates that for some
reason the mx25 esdhc related registers never show a transfer complete for
a multiblock write:
Board: SID1 NOAH
registered netconsole as cs1
noah_read_ccm_regs: CCM CRDR = 00000000
noah_read_ccm_regs: CCM RCSR = 01020820
noah_read_ccm_regs: Booting from WEIM: NOR
imx-esdhc at mci0: registered as mci0
imx-esdhc at imx-esdhc0: set clock: wanted: 400000 got: 377840
imx-esdhc at imx-esdhc0: pre_div: 8 div: 10
imx-esdhc at imx-esdhc0: set clock: wanted: 200000 got: 188920
imx-esdhc at imx-esdhc0: pre_div: 16 div: 10
imx-esdhc at imx-esdhc0: set clock: wanted: 200000 got: 188920
imx-esdhc at imx-esdhc0: pre_div: 16 div: 10
mci at mci0: SD Card Rev. 2.00 or later detected
mci at mci0: Put the Card in Identify Mode
mci at mci0: Card's identification data is: 1B534D30-30303030-101ABB6A-9500AB00
mci at mci0: Get/Set relative address
mci at mci0: Get card's specific data
mci at mci0: Card's specific data is: 007FFF32-5B5A83BA-F6DBDFFF-0E800000
mci at mci0: Transfer speed: 25000000
mci at mci0: Max. block length are: Write=1024, Read=1024 Bytes
mci at mci0: Capacity: 1910 MiB
mci at mci0: Limiting max. read block size down to 512
mci at mci0: Limiting max. write block size down to 512
mci at mci0: Read block length: 512, Write block length: 512
mci at mci0: Select the card, and put it into Transfer Mode
mci at mci0: Changing transfer frequency
mci at mci0: Trying to read the SCR (try 1 of 3)
esdhc_setup_data: Check if workaround ENGcm01112 is needed
on i.MX25 (0x00000008)
esdhc_setup_data: Enabling workaround for ENGcm01112 on i.MX25
esdhc_setup_data: Check if workaround ENGcm01112 is needed
on i.MX25 (0x00000008)
esdhc_setup_data: Enabling workaround for ENGcm01112 on i.MX25
esdhc_setup_data: Check if workaround ENGcm01112 is needed
on i.MX25 (0x00000040)
esdhc_setup_data: Enabling workaround for ENGcm01112 on i.MX25
mci at mci0: Prepare for bus width change
mci at mci0: Set SD bus width to 4 bit
imx-esdhc at imx-esdhc0: set clock: wanted: 200000 got: 188920
imx-esdhc at imx-esdhc0: pre_div: 16 div: 10
imx-esdhc at imx-esdhc0: set clock: wanted: 50000000 got: 33250000
imx-esdhc at imx-esdhc0: pre_div: 0 div: 1
mci at mci0: Card is up and running now, registering as a disk
mci at mci0: registered disk0
mci at mci0: mci_sd_read: Read 1 block(s), starting at 0
mci at mci0: READ: Activating single block transfer
esdhc_setup_data: Check if workaround ENGcm01112 is needed
on i.MX25 (0x00000040)
esdhc_setup_data: Enabling workaround for ENGcm01112 on i.MX25
mci at mci0: SD Card successfully added
imx25_devices_init: Adding NOR flash device
cfi_flash at cfi_flash0: cfi flash (id=01000000 vend=000002 manu=000001
devid=00007E extid=002301) at a0000000, size 64MB
imx25_devices_init: Adding initial NOR flash partitions
ehci at ehci0: USB EHCI 1.00
Malloc space: 0x83b00000 -> 0x83efffff (size 4 MB)
Stack space : 0x83af8000 -> 0x83b00000 (size 32 kB)
envfs: wrong magic on /dev/env0
no valid environment found on /dev/env0. Using default environment
running /env/bin/init...
Hit any key to stop autoboot: 4
type update_kernel nor [<imagename>] to update kernel into flash
type update_root nor [<imagename>] to update rootfs into flash
sid1-noah:/ mkdir /mnt
sid1-noah:/ mount /dev/disk0.0 fat /mnt
mci at mci0: mci_sd_read: Read 128 block(s), starting at 2048
mci at mci0: READ: Activating multiple block transfer
block_cache: blk->ops->read returned 0
sid1-noah:/ cp /mnt/conmci at mci0: mci_sd_read: Read 128 block(s), starting
at 2560
mci at mci0: READ: Activating multiple block transfer
block_cache: blk->ops->read returned 0
sole_image.jffs2 /mnt/console_image.jffs2-backup
mci at mci0: mci_sd_read: Read 128 block(s), starting at 3584
mci at mci0: READ: Activating multiple block transfer
block_cache: blk->ops->read returned 0
mci at mci0: mci_sd_read: Read 128 block(s), starting at 2304
mci at mci0: READ: Activating multiple block transfer
block_cache: blk->ops->read returned 0
mci at mci0: mci_sd_read: Read 128 block(s), starting at 53760
mci at mci0: READ: Activating multiple block transfer
block_cache: blk->ops->read returned 0
mci at mci0: mci_sd_read: Read 128 block(s), starting at 3712
mci at mci0: READ: Activating multiple block transfer
block_cache: blk->ops->read returned 0
mci at mci0: mci_sd_read: Read 128 block(s), starting at 53888
mci at mci0: READ: Activating multiple block transfer
block_cache: blk->ops->read returned 0
mci at mci0: mci_sd_read: Read 128 block(s), starting at 3840
mci at mci0: READ: Activating multiple block transfer
block_cache: blk->ops->read returned 0
mci at mci0: mci_sd_write: Write 128 block(s), starting at 2560
mci at mci0: WRITE: Activating multiple block transfer
Data Write Failed in PIO Mode.imx-esdhc at imx-esdhc0: timeout 2
esdhc_send_cmd: busy loop 1 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 2 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 3 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
imx-esdhc at imx-esdhc0: timeout 1
mci at mci0: Writing block 2560 failed with -110
mci at mci0: mci_sd_read: Read 128 block(s), starting at 54016
mci at mci0: READ: Activating multiple block transfer
esdhc_send_cmd: busy loop 1 CMD=0x01a60000 (0x00000012) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 2 CMD=0x01a60000 (0x00000012) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 3 CMD=0x01a60000 (0x00000012) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
imx-esdhc at imx-esdhc0: timeout 1
esdhc_send_cmd: busy loop 1 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 2 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 3 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
imx-esdhc at imx-esdhc0: timeout 1
mci at mci0: Reading block 54016 failed with -110
block_cache: blk->ops->read returned -110
write: I/O error
mci at mci0: mci_sd_write: Write 128 block(s), starting at 2048
mci at mci0: WRITE: Activating multiple block transfer
esdhc_send_cmd: busy loop 1 CMD=0x00100000 (0x00000019) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 2 CMD=0x00100000 (0x00000019) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 3 CMD=0x00100000 (0x00000019) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
imx-esdhc at imx-esdhc0: timeout 1
esdhc_send_cmd: busy loop 1 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 2 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 3 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
imx-esdhc at imx-esdhc0: timeout 1
mci at mci0: Writing block 2048 failed with -110
mci at mci0: mci_sd_write: Write 128 block(s), starting at 2304
mci at mci0: WRITE: Activating multiple block transfer
esdhc_send_cmd: busy loop 1 CMD=0x00120000 (0x00000019) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 2 CMD=0x00120000 (0x00000019) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 3 CMD=0x00120000 (0x00000019) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
imx-esdhc at imx-esdhc0: timeout 1
esdhc_send_cmd: busy loop 1 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 2 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 3 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
imx-esdhc at imx-esdhc0: timeout 1
mci at mci0: Writing block 2304 failed with -110
mci at mci0: mci_sd_write: Write 128 block(s), starting at 53888
mci at mci0: WRITE: Activating multiple block transfer
esdhc_send_cmd: busy loop 1 CMD=0x01a50000 (0x00000019) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 2 CMD=0x01a50000 (0x00000019) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 3 CMD=0x01a50000 (0x00000019) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
imx-esdhc at imx-esdhc0: timeout 1
esdhc_send_cmd: busy loop 1 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 2 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 3 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
imx-esdhc at imx-esdhc0: timeout 1
mci at mci0: Writing block 53888 failed with -110
mci at mci0: mci_sd_write: Write 128 block(s), starting at 53760
mci at mci0: WRITE: Activating multiple block transfer
esdhc_send_cmd: busy loop 1 CMD=0x01a40000 (0x00000019) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 2 CMD=0x01a40000 (0x00000019) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 3 CMD=0x01a40000 (0x00000019) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
imx-esdhc at imx-esdhc0: timeout 1
esdhc_send_cmd: busy loop 1 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 2 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 3 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
imx-esdhc at imx-esdhc0: timeout 1
mci at mci0: Writing block 53760 failed with -110
mci at mci0: mci_sd_read: Read 128 block(s), starting at 2560
mci at mci0: READ: Activating multiple block transfer
esdhc_send_cmd: busy loop 1 CMD=0x00140000 (0x00000012) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 2 CMD=0x00140000 (0x00000012) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 3 CMD=0x00140000 (0x00000012) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
imx-esdhc at imx-esdhc0: timeout 1
esdhc_send_cmd: busy loop 1 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 2 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
esdhc_send_cmd: busy loop 3 CMD=0x00000000 (0x0000000c) cap=0x07f30000
irqstat=0x00000000 proctl=0x00000022 prsstat=0xf7880587
xfertyp=0x0c3b0022 sysctl=0x000e0017 blkattr=0x00700200
imx-esdhc at imx-esdhc0: timeout 1
mci at mci0: Reading block 2560 failed with -110
block_cache: blk->ops->read returned -110
I'll start looking at the uboot drivers, since the kernel drivers are quite
messy with regard to the software stack a SD cmd has to travel. In any
case, you before dropping a new barebox release, you might want to
consider this cosmetic change:
diff --git a/drivers/mci/imx-esdhc.h b/drivers/mci/imx-esdhc.h
index 19fed5a..d9be69e 100644
--- a/drivers/mci/imx-esdhc.h
+++ b/drivers/mci/imx-esdhc.h
@@ -39,7 +39,6 @@
#define SYSCTL_PEREN 0x00000004
#define SYSCTL_HCKEN 0x00000002
#define SYSCTL_IPGEN 0x00000001
-#define SYSCTL_RSTA 0x01000000
#define IRQSTAT 0x0002e030
#define IRQSTAT_DMAE (0x10000000)
Best regards
Roberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/barebox/attachments/20120531/e1b24ae7/attachment-0001.html>
More information about the barebox
mailing list