Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Nov 2008 20:04:28 +0100
From:      Lars Engels <lme@FreeBSD.org>
To:        "M. Warner Losh" <imp@bsdimp.com>, mav@FreeBSD.org, freebsd-arm@FreeBSD.org, freebsd-current@FreeBSD.org, freebsd-mobile@FreeBSD.org
Subject:   Re: RFC: PCI SD host controller driver & mmc/mmcsd modules improvements
Message-ID:  <20081106190428.GC161@e.0x20.net>
In-Reply-To: <20081106184017.GB161@e.0x20.net>
References:  <48DEA8E7.2080503@FreeBSD.org> <20081106180556.GH8256@e.0x20.net> <4913345F.2050801@FreeBSD.org> <20081106.112338.1564836080.imp@bsdimp.com> <20081106184017.GB161@e.0x20.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--1UWUbFP1cBYEclgG
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Nov 06, 2008 at 07:40:17PM +0100, Lars Engels wrote:
> On Thu, Nov 06, 2008 at 11:23:38AM -0700, M. Warner Losh wrote:
> > In message: <4913345F.2050801@FreeBSD.org>
> >             Alexander Motin <mav@FreeBSD.org> writes:
> > : Lars Engels wrote:
> > : > On another notebook with the same card reader I get a little furthe=
r:
> > : >=20
> > : > sdhci0: <RICOH R5C822 SD> mem 0xd8002800-0xd80028ff irq 22 at devic=
e 9.2
> > : > on pci5
> > : > sdhci0: 1 slot(s) allocated
> > : > sdhci0: [ITHREAD]
> > : > mmc0: <MMC/SD bus> on sdhci0
> > : > mmc0: detached
> > : > mmc0: <MMC/SD bus> on sdhci0
> > : >=20
> > : > So the mmc device is detected everytime I insert a card and is remo=
ved
> > : > when I take the card out.
> > :=20
> > : It means that controller successfully reports card insertion. You mus=
t=20
> > : be a half way there.
> > :=20
> > : > But I do not get a new disk device...
> > :=20
> > : A bit more debugging can be produced with enabling verbose boot messa=
ges.
> > :=20
> > : > pciconf tells me pretty much the same like on the other notebook:
> > :=20
> > : Looks like it may depend or on controller version or on the way it is=
=20
> > : hardwired or somehow BIOS initialized. There are were some success=20
> > : stories reported with this controller.
> >=20
> > Add mmcsd to the kernel?  Load it as a module?
>=20
> Much better! Loading mmcsd first, then mmc and sdhci gives me the mmcsd0
> device:
> sdhci0: <RICOH R5C822 SD> mem 0xd8002800-0xd80028ff irq 22 at device 9.2
> on pci5
> sdhci0: 1 slot(s) allocated
> sdhci0: [ITHREAD]
> mmc0: <MMC/SD bus> on sdhci0
> mmcsd0: 1924MB <SD Memory Card> at mmc0 16MHz/4bit
> sdhci0-slot0: Got data interrupt 0x00000002, but there is no active
> command.
> sdhci0-slot0: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D REGISTER DUMP =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> sdhci0-slot0: Sys addr: 0x30c68000 | Version:  0x00000200
> sdhci0-slot0: Blk size: 0x00000000 | Blk cnt:  0x00000000
> sdhci0-slot0: Argument: 0x00000000 | Trn mode: 0x00000013
> sdhci0-slot0: Present:  0x01ff0000 | Host ctl: 0x00000002
> sdhci0-slot0: Power:    0x0000000f | Blk gap:  0x00000000
> sdhci0-slot0: Wake-up:  0x00000000 | Clock:    0x00000107
> sdhci0-slot0: Timeout:  0x0000000c | Int stat: 0x00000000
> sdhci0-slot0: Int enab: 0x01ff00fb | Sig enab: 0x01ff00fb
> sdhci0-slot0: AC12 err: 0x00000000 | Slot int: 0x00000000
> sdhci0-slot0: Caps:     0x01c021a1 | Max curr: 0x00000040
> sdhci0-slot0: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

[...]

> But I still cannot use it:
> lars@pts/3 # ls -l /dev/mmcsd0*
> crw-r-----  1 root  operator    0, 120 Nov  6 19:36 /dev/mmcsd0
> crw-r-----  1 root  operator    0, 121 Nov  6 19:36 /dev/mmcsd0s1
>=20
> lars@pts/3 # fdisk /dev/mmcsd0
> fdisk: could not detect sector size
>=20
>=20
> lars@pts/3 # mount -t msdosfs /dev/mmcsd0s1 /mnt
> mount_msdosfs: /dev/mmcsd0s1: : Input/output error
>=20
>=20
> What am I missing?

That seems to be the SD card I used...
Now I tried a SDHCI card and fdisk printed the partition table.
mmcsd0: 7580MB <SDHC Memory Card> at mmc0 16MHz/4bit

However, when I tried to mount it, I get this error:
g_vfs_done():mmcsd0s1[WRITE(offset=3D2254848, length=3D4096)]error =3D 5
g_vfs_done():mmcsd0s1[WRITE(offset=3D2254848, length=3D4096)]error =3D 5
g_vfs_done():mmcsd0s1[WRITE(offset=3D2254848, length=3D4096)]error =3D 5
fsync: giving up on dirty
0xc5452d9c: tag devfs, type VCHR
    usecount 1, writecount 0, refcount 240 mountedhere 0xc474f700
    flags ()
    v_object 0xc48368b8 ref 0 pages 240
     lock type devfs: UNLOCKED

        dev mmcsd0s1


And a (reproducable) kernel panic shortly after that:


Fatal trap 12: page fault while in kernel mode
cpuid =3D 0; apic id =3D 00
fault virtual address   =3D 0x0
fault code              =3D supervisor read, page not present
instruction pointer     =3D 0x20:0xc057e6a9
stack pointer           =3D 0x28:0xc3fd5b84
frame pointer           =3D 0x28:0xc3fd5bb0
code segment            =3D base 0x0, limit 0xfffff, type 0x1b
                        =3D DPL 0, pres 1, def32 1, gran 1
processor eflags        =3D interrupt enabled, resume, IOPL =3D 0
current process         =3D 19 (syncer)
Physical memory: 1002 MB
Dumping 163 MB: 148 132 116 100 84 68 52 36 20 4

Reading symbols from /boot/kernel/linux.ko...Reading symbols from /boot/ker=
nel/linux.ko.symbols...done.
[...]
Loaded symbols for /boot/kernel/mmcsd.ko
Reading symbols from /boot/kernel/mmc.ko...done.
Loaded symbols for /boot/kernel/mmc.ko
Reading symbols from /boot/kernel/sdhci.ko...done.
Loaded symbols for /boot/kernel/sdhci.ko
#0  doadump () at pcpu.h:246
246     pcpu.h: No such file or directory.
        in pcpu.h
(kgdb) bt
#0  doadump () at pcpu.h:246
#1  0xc0477b99 in db_fncall (dummy1=3D-1006806728, dummy2=3D0, dummy3=3D-10=
63504288, dummy4=3D0xc3fd5918 "k=CAN=C0") at /usr/src/sys/ddb/db_command.c:=
548
#2  0xc0477f91 in db_command (last_cmdp=3D0xc097143c, cmd_table=3D0x0, dopa=
ger=3D1) at /usr/src/sys/ddb/db_command.c:445
#3  0xc04780ea in db_command_loop () at /usr/src/sys/ddb/db_command.c:498
#4  0xc0479f2d in db_trap (type=3D12, code=3D0) at /usr/src/sys/ddb/db_main=
=2Ec:229
#5  0xc0602076 in kdb_trap (type=3D12, code=3D0, tf=3D0xc3fd5b44) at /usr/s=
rc/sys/kern/subr_kdb.c:534
#6  0xc0880f6f in trap_fatal (frame=3D0xc3fd5b44, eva=3D0) at /usr/src/sys/=
i386/i386/trap.c:920
#7  0xc0881210 in trap_pfault (frame=3D0xc3fd5b44, usermode=3D0, eva=3D0) a=
t /usr/src/sys/i386/i386/trap.c:842
#8  0xc0881bf2 in trap (frame=3D0xc3fd5b44) at /usr/src/sys/i386/i386/trap.=
c:522
#9  0xc0866cfb in calltrap () at /usr/src/sys/i386/i386/exception.s:165
#10 0xc057e6a9 in g_io_request (bp=3D0xc56c58c4, cp=3D0xc5562100) at /usr/s=
rc/sys/geom/geom_io.c:364
#11 0xc0583a06 in g_vfs_strategy (bo=3D0xc57dc0a8, bp=3D0xd82b9bc0) at /usr=
/src/sys/geom/geom_vfs.c:107
#12 0xc06456e1 in bufwrite (bp=3D0xd82b9bc0) at buf.h:397
#13 0xc063ea48 in bawrite (bp=3D0xd82b9bc0) at buf.h:385
#14 0xc064a23c in vop_stdfsync (ap=3D0xc3fd5c74) at /usr/src/sys/kern/vfs_d=
efault.c:482
#15 0xc056221e in devfs_fsync (ap=3D0xc3fd5c74) at /usr/src/sys/fs/devfs/de=
vfs_vnops.c:485
#16 0xc088e312 in VOP_FSYNC_APV (vop=3D0xc0931520, a=3D0xc3fd5c74) at vnode=
_if.c:1007
#17 0xc065ccce in sync_vnode (slp=3DVariable "slp" is not available.
) at vnode_if.h:529
#18 0xc065d0c2 in sched_sync () at /usr/src/sys/kern/vfs_subr.c:1761
#19 0xc05b3b83 in fork_exit (callout=3D0xc065ce00 <sched_sync>, arg=3D0x0, =
frame=3D0xc3fd5d38) at /usr/src/sys/kern/kern_fork.c:815
#20 0xc0866d70 in fork_trampoline () at /usr/src/sys/i386/i386/exception.s:=
270


--1UWUbFP1cBYEclgG
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEARECAAYFAkkTP7wACgkQKc512sD3afgZjgCffXwX0dy1bzts3kL2oxgRyW8g
thUAoKefg0xcjWidALpJkV0fcKhh/IW2
=hs5+
-----END PGP SIGNATURE-----

--1UWUbFP1cBYEclgG--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081106190428.GC161>