Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: good way to identify board type on Marvell SoC NAS boxes?



hi

At Tue, 25 Aug 2009 21:22:34 +0100,
Steve Woodford wrote:
> > GPIO configuration is different from another NAS boxes. for now, I
> > need to make new kernel config and hard-code board specific
> > configuration.
> >
> > I want to add board identify code and share kernel between NAS boxes.
> 
> If uboot pre-configures the GPIO pins on each board, why not use that 
> difference in GPIO configuration (as in, pin direction/function 
> registers) as a fingerprint to determine the board type?

thanks. sounds good.

some pins are not configured by u-boot (this is the reason that I want
to add board specific setup), some pins (LED) are changed by boot method
(from SATA or TFTP), some pins can be changed by switches.

firmware updater for LinkStation may contain new u-boot, so updating
firmware may change initial GPIO state.

I need more investigation!

----

just for fun (this is my first arm program!), I wrote simple hexadecimal
number decoder :)

        /* extract address of ramdisk image from cmdline */
0:
        mov     r4, r3
        mov     r5, #0
1:
        ldrb    r2, [r3, #0]
        add     r3, r3, #1
        cmp     r2, #120
        sub     r0, r2, #97
        sub     r1, r2, #48
        beq     0b
        cmp     r0, #5
        cmphi   r1, #9
        movhi   r0, #0
        bhi     3f
        add     r5, r5, #4
        b       1b
2:
        ldrb    r2, [r4, #0]
        sub     r5, r5, #4
        cmp     r2, #96
        sub     r1, r2, #97
        subls   r1, r2, #48
        add     r0, r0, r1, asl r5
        add     r4, r4, #1
3:
        cmp     r5, #0
        bgt     2b

        /* check magic number and save entry point as board_type */
        ldr     r1, [r0, #0]
        ldr     r2, Lmagic
        cmp     r1, r2
        ldreq   r1, [r0, #20]
        adreq   r2, board_type
        streq   r1, [r2, #0]

--
FUKAUMI Naoki


Home | Main Index | Thread Index | Old Index