[U-Boot-Users] Troubles on my custom keyboard driver in u-boot
Udi Finkelstein
u-boot-users at udif.com
Sun Apr 11 02:44:06 CEST 2004
Hi,
I am the owner of the RBC23 platform, and I'll try to answer some of your
questions.
Sorry for not answering before (a trip abroad and a new child dosn't leave
much free time for hobbies). I also just installed a new Athlon 64 3000
machine (my previous hardware wasn't stable and tended to core dump during gcc
compiles). I intend to install ELDK 3.0 and resume work on this code in a few
weeks.
On Wed, 7 Apr 2004 19:21:43 +0800 (CST), you wrote:
>Hi,
>
>I had a trouble on coding a custom keyboard driver on
>my custom 8xx board in u-boot.According to README,only
>RBC823 does have a custom keyboard so far.I looked up
>kbd.c of this board but still some puzzles.In kbd.c,
>RBC823 use SMC1 as serial port to get the input,while
>I mean to implement the input by PCMCIA pins as GPIO.I
>could make a Level 0 interrupt by PCMCIA status change
>to create a character.But how about next step?
>
>1. RBC823 use DPRAM as keyboard buffer and get
>character "automatically" from SMC1. But could I leave
>a RAM zone for keyboard buffer to keep keycode and
>later convert these keycodes to characters and put
>them into LCD console buffer?
I really don't know.
>2. How come RBC823 uses lcd_disable function and a
>special U-BUS arbitration priority? I did the same on
>my custom board but LCD turned off when booting or
>worked with a half screen in a twinkling way.
What do you mean by U-BUS?
It's been quite a while since I touched this code (I compiled it last time
around U-boot 0.4.0), but as far as I remember the problem was that the LCD
initialization was done too early. The information on which I decided if I
wanted a keyboard/LCD or not was only available later.
>3. Also,when I registered my custom board as RBC823
>did.I found the I/O address of keyboard and LCD had
>the same address.Normal or not?
>
>===================================================
>
>&lcddev is 0x3eecef0
>
>device_register is : 0x0
>
>The value of device_register (&kbd_dev) is : 0x0
>
>kbd_dev.getc is : 0x3fa25c0
>
>&kbd_dev is : 0x3eecef0
>
>The value of device_register (&kbd_dev) is : 0x0
>
>==================================================
>
>4. In following drv_keyboard_init of kbd.c[RBC823], if
>"if (0)" is right,how could keyboard finish
>registering?
>
>int drv_keyboard_init(void)
>{
> int error = 0;
> device_t kbd_dev;
>
> if (0) {
> /* register the keyboard */
> memset (&kbd_dev, 0,
>sizeof(device_t));
> strcpy(kbd_dev.name, "kbd");
> kbd_dev.flags = DEV_FLAGS_INPUT |
>DEV_FLAGS_SYSTEM;
> kbd_dev.putc = NULL;
> kbd_dev.puts = NULL;
> kbd_dev.getc = smc1_getc;
> kbd_dev.tstc = smc1_tstc;
> error = device_register (&kbd_dev);
> } else {
> lcd_is_enabled = 0;
> lcd_disable();
> }
> return error;
>}
Here is the big catch:
RBC823 is a proprietary platform previously made by my employer but got
canned. I'm the only one using the board (its actually a smart telephone with
a keyboard and LCD) now. I literally saved 5-10 prototypes from being thrown
into the garbage.
Since some of the documentation required for a full port is proprietary,
including the communication protocol of the keyboard over SMC1, the public
port contains only stuff that can be learned by simple probing of the board
(Flash, DRAM, ethernet, LCD configuration). for al lthe stuff that requires
proprietary docs, I've placed stubs. In practice, this only amounts to kbd.c
This does not violate the GPL, since I've never released the full version to
anyone but myself.
In the real kbd.c, the code above would have been
if (kbhit())
and not
if(0)
the idea is to fallback to serial console if no keyboard is connected. if you
want keyboard you must turn on the board with a certain key pressed.
>
>5. Additionly,is it necessary for me to make it in
>u-boot and then port it to LINUX? A mess in my mind?!
Yes. Unless you think you can settle for a serial console in U-boot. I did the
keyboard driver as an excersize to see if I can get the keyboard HW to work as
I expect it to.
>
>Any input are warmly welcome!!!
>
>Sam
You can direct RBC823 question directly to me.
Udi
More information about the U-Boot
mailing list