Commit c78dfb4fd2cc8dbcd0baa3d180aeef1a06b1f062
Committed by
Simon Glass
1 parent
348b744b7c
Exists in
v2017.01-smarct4x
and in
30 other branches
x86: superio: Add keyboard controller support to smsc_lpc47m driver
Add an api to enable and configure the integrated keyboard controller on SMSC LPC47m superio chipset. It also adds several macros to help future extension. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
Showing 3 changed files with 40 additions and 5 deletions Side-by-side Diff
arch/x86/include/asm/ibmpc.h
drivers/misc/smsc_lpc47m.c
... | ... | @@ -22,13 +22,24 @@ |
22 | 22 | outb(0xaa, port); |
23 | 23 | } |
24 | 24 | |
25 | -void lpc47m_enable_serial(u16 dev, u16 iobase, u8 irq) | |
25 | +void lpc47m_enable_serial(uint dev, uint iobase, uint irq) | |
26 | 26 | { |
27 | 27 | pnp_enter_conf_state(dev); |
28 | 28 | pnp_set_logical_device(dev); |
29 | 29 | pnp_set_enable(dev, 0); |
30 | 30 | pnp_set_iobase(dev, PNP_IDX_IO0, iobase); |
31 | 31 | pnp_set_irq(dev, PNP_IDX_IRQ0, irq); |
32 | + pnp_set_enable(dev, 1); | |
33 | + pnp_exit_conf_state(dev); | |
34 | +} | |
35 | + | |
36 | +void lpc47m_enable_kbc(uint dev, uint irq0, uint irq1) | |
37 | +{ | |
38 | + pnp_enter_conf_state(dev); | |
39 | + pnp_set_logical_device(dev); | |
40 | + pnp_set_enable(dev, 0); | |
41 | + pnp_set_irq(dev, PNP_IDX_IRQ0, irq0); | |
42 | + pnp_set_irq(dev, PNP_IDX_IRQ1, irq1); | |
32 | 43 | pnp_set_enable(dev, 1); |
33 | 44 | pnp_exit_conf_state(dev); |
34 | 45 | } |
include/smsc_lpc47m.h
... | ... | @@ -7,15 +7,36 @@ |
7 | 7 | #ifndef _SMSC_LPC47M_H_ |
8 | 8 | #define _SMSC_LPC47M_H_ |
9 | 9 | |
10 | +/* I/O address of LPC47M */ | |
11 | +#define LPC47M_IO_PORT 0x2e | |
12 | + | |
13 | +/* Logical device number */ | |
14 | +#define LPC47M_FDC 0 /* Floppy */ | |
15 | +#define LPC47M_SP2 2 /* Serial Port 2 */ | |
16 | +#define LPC47M_PP 3 /* Parallel Port */ | |
17 | +#define LPC47M_SP1 4 /* Serial Port 1 */ | |
18 | +#define LPC47M_KBC 7 /* Keyboard & Mouse */ | |
19 | +#define LPC47M_PME 10 /* Power Control */ | |
20 | + | |
10 | 21 | /** |
11 | 22 | * Configure the base I/O port of the specified serial device and enable the |
12 | 23 | * serial device. |
13 | 24 | * |
14 | - * @dev: High 8 bits = Super I/O port, low 8 bits = logical device number. | |
15 | - * @iobase: Processor I/O port address to assign to this serial device. | |
16 | - * @irq: Processor IRQ number to assign to this serial device. | |
25 | + * @dev: high 8 bits = super I/O port, low 8 bits = logical device number | |
26 | + * @iobase: processor I/O port address to assign to this serial device | |
27 | + * @irq: processor IRQ number to assign to this serial device | |
17 | 28 | */ |
18 | -void lpc47m_enable_serial(u16 dev, u16 iobase, u8 irq); | |
29 | +void lpc47m_enable_serial(uint dev, uint iobase, uint irq); | |
30 | + | |
31 | +/** | |
32 | + * Configure the specified keyboard controller device and enable the keyboard | |
33 | + * controller device. | |
34 | + * | |
35 | + * @dev: high 8 bits = Super I/O port, low 8 bits = logical device number | |
36 | + * @irq0: processor IRQ number to assign to keyboard | |
37 | + * @irq1: processor IRQ number to assign to mouse | |
38 | + */ | |
39 | +void lpc47m_enable_kbc(uint dev, uint irq0, uint irq1); | |
19 | 40 | |
20 | 41 | #endif /* _SMSC_LPC47M_H_ */ |