public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] Troubles on my custom keyboard driver in u-boot
       [not found] <E1BB3de-00025R-RJ@sc8-sf-list1.sourceforge.net>
@ 2004-04-07 11:21 ` Sam Song
  2004-04-07 13:24   ` Wolfgang Denk
  2004-04-11  0:44   ` Udi Finkelstein
  0 siblings, 2 replies; 5+ messages in thread
From: Sam Song @ 2004-04-07 11:21 UTC (permalink / raw)
  To: u-boot

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?
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.
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;
}

5. Additionly,is it necessary for me to make it in
u-boot and then port it to LINUX? A mess in my mind?!

Any input are warmly welcome!!!

Sam


_________________________________________________________
Do You Yahoo!? 
??TT????????????
http://cn.rd.yahoo.com/mail_cn/tag/*http://hp.allyes.com/laserjet/gamestory/index.html?jumpid=ex_hphqapcn_MongooseLJ1010/201073CN407016/Yahoo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Troubles on my custom keyboard driver in u-boot
  2004-04-07 11:21 ` [U-Boot-Users] Troubles on my custom keyboard driver in u-boot Sam Song
@ 2004-04-07 13:24   ` Wolfgang Denk
  2004-04-07 15:54     ` Sam Song
  2004-04-11  0:44   ` Udi Finkelstein
  1 sibling, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2004-04-07 13:24 UTC (permalink / raw)
  To: u-boot

In message <20040407112143.80715.qmail@web15201.mail.bjs.yahoo.com> you wrote:
> 
> 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

This is wrong.

Many systems have a custom keyboard of one kind or another.  See  for
example  LWMON  and  R360  and  TRAB,  which  allow to bind arbitrary
command sequences to arbitrary key combinations.

Or see HMI-10 which uses  a  custom  PS/2  multiplexor  to  attach  a
standard PC keuyboard as input device.

> 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?

What are you going to use the "keyboard" for? To  detect  single  key
presses and to switch functions in U-Boot, like truning on/off of log
,messages, booting a different image and the like? Or as input device
for interactive use?

> 1. RBC823 use DPRAM as keyboard buffer and get
...
> 2. How come RBC823 uses lcd_disable function and a
> special U-BUS arbitration priority? I did the same on
...
> 3. Also,when I registered my custom board as RBC823
> did.I found the I/O address of keyboard and LCD had

It makes little sense  to  use  a  configuration  for  one  board  on
completely  different  hardware. You need a detailed understanding of
that hardware, and of your own, and in nearly all cases you will have
to adapt the code. Simpy copying a configuration  is  a  pretty  good
guarantee to run you into problems.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Mandrell: "You know what I think?"
Doctor:   "Ah, ah that's a catch question. With a brain your size you
          don't think, right?"
                - Dr. Who

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Troubles on my custom keyboard driver in u-boot
  2004-04-07 13:24   ` Wolfgang Denk
@ 2004-04-07 15:54     ` Sam Song
  2004-04-07 16:30       ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Sam Song @ 2004-04-07 15:54 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote: 
> > According to README,only RBC823 does have a custom
> > keyboard so far.I looked up

> This is wrong.
> 
> Many systems have a custom keyboard of one kind or
> another.  See  for example  LWMON  and  R360  and  
> TRAB,  which  allow to bind arbitrary
> command sequences to arbitrary key combinations.
> 
> Or see HMI-10 which uses  a  custom  PS/2 
> multiplexor  to  attach a standard PC keuyboard as 
> input device.

Thanks for your detailed points.I knew LWMON with a
i2c keyboard driver from your post.BTW,which file is
this LWMON keyboard driver in ELDK3.0 kernel code?As
for others,I would like to have a look at them.

> What are you going to use the "keyboard" for? To 
> detect  single  key presses and to switch functions
> in U-Boot, like truning on/off of log,messages, 
> booting a different image and the like? Or as input
> device for interactive use?

For interactive use.We have a special keyboard with 80
keys or so.We plan to code the driver in LINUX.But if
implentmented in u-boot as well,it would be perfect.

> It makes little sense  to  use  a  configuration 
> for  one  board  on completely  different  hardware.
> You need a detailed understanding of that hardware, 
 
I have no RBC823 hardware scheme but wanted to do like
that to test some possibilities.I really cannot
understand RBC823 init process of its keyboard.

> and of your own, and in nearly all cases you will 
> have to adapt the code. Simpy copying a 
> connfiguration  is a  pretty  good guarantee to run
> you into problems.

I know my hardware more than the driver I am
programming.Coding a custom driver is a big challenge
to me.Anyway,I just editted some drivers before.I hope
to find a good example to follow.

Thanks for your kind help!

Sam

_________________________________________________________
Do You Yahoo!? 
??TT????????????
http://cn.rd.yahoo.com/mail_cn/tag/*http://hp.allyes.com/laserjet/gamestory/index.html?jumpid=ex_hphqapcn_MongooseLJ1010/201073CN407016/Yahoo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Troubles on my custom keyboard driver in u-boot
  2004-04-07 15:54     ` Sam Song
@ 2004-04-07 16:30       ` Wolfgang Denk
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2004-04-07 16:30 UTC (permalink / raw)
  To: u-boot

In message <20040407155430.31430.qmail@web15214.mail.bjs.yahoo.com> you wrote:
>
> Thanks for your detailed points.I knew LWMON with a
> i2c keyboard driver from your post.BTW,which file is
> this LWMON keyboard driver in ELDK3.0 kernel code?As
> for others,I would like to have a look at them.

The LWMON project uses a frozen version of the Linux kernel code,  so
we  didn't  port  their  board  to  a more recent kernel version yet.
Please see arch/ppc/8xx_io/lwmon_kbd.c in the (old ) linux-2.4 kernel
tree.

> For interactive use.We have a special keyboard with 80
> keys or so.We plan to code the driver in LINUX.But if
> implentmented in u-boot as well,it would be perfect.

Then you will probably use  something  similar  to  the  standard  PC
keyboard  code;  feel  free to peek into drivers/ps2*.c in the U-Boot
sources.

> that to test some possibilities.I really cannot
> understand RBC823 init process of its keyboard.

I don't know this hardware either.

> Thanks for your kind help!

You are welcome.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
"The question of whether a computer can think is no more  interesting
than the question of whether a submarine can swim"
                                                - Edsgar W.  Dijkstra

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Troubles on my custom keyboard driver in u-boot
  2004-04-07 11:21 ` [U-Boot-Users] Troubles on my custom keyboard driver in u-boot Sam Song
  2004-04-07 13:24   ` Wolfgang Denk
@ 2004-04-11  0:44   ` Udi Finkelstein
  1 sibling, 0 replies; 5+ messages in thread
From: Udi Finkelstein @ 2004-04-11  0:44 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-04-11  0:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1BB3de-00025R-RJ@sc8-sf-list1.sourceforge.net>
2004-04-07 11:21 ` [U-Boot-Users] Troubles on my custom keyboard driver in u-boot Sam Song
2004-04-07 13:24   ` Wolfgang Denk
2004-04-07 15:54     ` Sam Song
2004-04-07 16:30       ` Wolfgang Denk
2004-04-11  0:44   ` Udi Finkelstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox