[U-Boot] [PATCH 1/5] 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 ---
arch/x86/include/asm/ibmpc.h | 3 +++ drivers/misc/smsc_lpc47m.c | 11 +++++++++++ include/smsc_lpc47m.h | 27 ++++++++++++++++++++++++--- 3 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/asm/ibmpc.h b/arch/x86/include/asm/ibmpc.h index 678cde4..1e9058c 100644 --- a/arch/x86/include/asm/ibmpc.h +++ b/arch/x86/include/asm/ibmpc.h @@ -24,4 +24,7 @@ #define UART0_IRQ 4 #define UART1_IRQ 3
+#define KBD_IRQ 1 +#define MSE_IRQ 12 + #endif diff --git a/drivers/misc/smsc_lpc47m.c b/drivers/misc/smsc_lpc47m.c index 1e50d5b..3f209d9 100644 --- a/drivers/misc/smsc_lpc47m.c +++ b/drivers/misc/smsc_lpc47m.c @@ -32,3 +32,14 @@ void lpc47m_enable_serial(u16 dev, u16 iobase, u8 irq) pnp_set_enable(dev, 1); pnp_exit_conf_state(dev); } + +void lpc47m_enable_kbc(u16 dev, u8 irq0, u8 irq1) +{ + pnp_enter_conf_state(dev); + pnp_set_logical_device(dev); + pnp_set_enable(dev, 0); + pnp_set_irq(dev, PNP_IDX_IRQ0, irq0); + pnp_set_irq(dev, PNP_IDX_IRQ1, irq1); + pnp_set_enable(dev, 1); + pnp_exit_conf_state(dev); +} diff --git a/include/smsc_lpc47m.h b/include/smsc_lpc47m.h index 32b069d..585a404 100644 --- a/include/smsc_lpc47m.h +++ b/include/smsc_lpc47m.h @@ -7,14 +7,35 @@ #ifndef _SMSC_LPC47M_H_ #define _SMSC_LPC47M_H_
+/* I/O address of LPC47M */ +#define LPC47M_IO_PORT 0x2e + +/* Logical device number */ +#define LPC47M_FDC 0 /* Floppy */ +#define LPC47M_SP2 2 /* Serial Port 2 */ +#define LPC47M_PP 3 /* Parallel Port */ +#define LPC47M_SP1 4 /* Serial Port 1 */ +#define LPC47M_KBC 7 /* Keyboard & Mouse */ +#define LPC47M_PME 10 /* Power Control */ + /** * Configure the base I/O port of the specified serial device and enable the * serial device. * - * @dev: High 8 bits = Super I/O port, low 8 bits = logical device number. - * @iobase: Processor I/O port address to assign to this serial device. - * @irq: Processor IRQ number to assign to this serial device. + * @dev: high 8 bits = super I/O port, low 8 bits = logical device number + * @iobase: processor I/O port address to assign to this serial device + * @irq: processor IRQ number to assign to this serial device */ void lpc47m_enable_serial(u16 dev, u16 iobase, u8 irq);
+/** + * Configure the specified keyboard controller device and enable the keyboard + * controller device. + * + * @dev: high 8 bits = Super I/O port, low 8 bits = logical device number + * @irq0: processor IRQ number to assign to keyboard + * @irq1: processor IRQ number to assign to mouse + */ +void lpc47m_enable_kbc(u16 dev, u8 irq0, u8 irq1); + #endif /* _SMSC_LPC47M_H_ */

Hi Bin,
On 17 August 2015 at 04:45, Bin Meng bmeng.cn@gmail.com wrote:
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
arch/x86/include/asm/ibmpc.h | 3 +++ drivers/misc/smsc_lpc47m.c | 11 +++++++++++ include/smsc_lpc47m.h | 27 ++++++++++++++++++++++++--- 3 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/asm/ibmpc.h b/arch/x86/include/asm/ibmpc.h index 678cde4..1e9058c 100644 --- a/arch/x86/include/asm/ibmpc.h +++ b/arch/x86/include/asm/ibmpc.h @@ -24,4 +24,7 @@ #define UART0_IRQ 4 #define UART1_IRQ 3
+#define KBD_IRQ 1 +#define MSE_IRQ 12
#endif diff --git a/drivers/misc/smsc_lpc47m.c b/drivers/misc/smsc_lpc47m.c index 1e50d5b..3f209d9 100644 --- a/drivers/misc/smsc_lpc47m.c +++ b/drivers/misc/smsc_lpc47m.c @@ -32,3 +32,14 @@ void lpc47m_enable_serial(u16 dev, u16 iobase, u8 irq) pnp_set_enable(dev, 1); pnp_exit_conf_state(dev); }
+void lpc47m_enable_kbc(u16 dev, u8 irq0, u8 irq1)
Can we make these parameters uint instead?
+{
pnp_enter_conf_state(dev);
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
pnp_set_irq(dev, PNP_IDX_IRQ0, irq0);
pnp_set_irq(dev, PNP_IDX_IRQ1, irq1);
pnp_set_enable(dev, 1);
pnp_exit_conf_state(dev);
+} diff --git a/include/smsc_lpc47m.h b/include/smsc_lpc47m.h index 32b069d..585a404 100644 --- a/include/smsc_lpc47m.h +++ b/include/smsc_lpc47m.h @@ -7,14 +7,35 @@ #ifndef _SMSC_LPC47M_H_ #define _SMSC_LPC47M_H_
+/* I/O address of LPC47M */ +#define LPC47M_IO_PORT 0x2e
+/* Logical device number */ +#define LPC47M_FDC 0 /* Floppy */ +#define LPC47M_SP2 2 /* Serial Port 2 */ +#define LPC47M_PP 3 /* Parallel Port */ +#define LPC47M_SP1 4 /* Serial Port 1 */ +#define LPC47M_KBC 7 /* Keyboard & Mouse */ +#define LPC47M_PME 10 /* Power Control */
/**
- Configure the base I/O port of the specified serial device and enable the
- serial device.
- @dev: High 8 bits = Super I/O port, low 8 bits = logical device number.
- @iobase: Processor I/O port address to assign to this serial device.
- @irq: Processor IRQ number to assign to this serial device.
- @dev: high 8 bits = super I/O port, low 8 bits = logical device number
- @iobase: processor I/O port address to assign to this serial device
*/
- @irq: processor IRQ number to assign to this serial device
void lpc47m_enable_serial(u16 dev, u16 iobase, u8 irq);
+/**
- Configure the specified keyboard controller device and enable the keyboard
- controller device.
- @dev: high 8 bits = Super I/O port, low 8 bits = logical device number
- @irq0: processor IRQ number to assign to keyboard
- @irq1: processor IRQ number to assign to mouse
- */
+void lpc47m_enable_kbc(u16 dev, u8 irq0, u8 irq1);
#endif /* _SMSC_LPC47M_H_ */
1.8.2.1
Regards, Simon

Hi Simon,
On Tue, Aug 18, 2015 at 10:00 AM, Simon Glass sjg@chromium.org wrote:
Hi Bin,
On 17 August 2015 at 04:45, Bin Meng bmeng.cn@gmail.com wrote:
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
arch/x86/include/asm/ibmpc.h | 3 +++ drivers/misc/smsc_lpc47m.c | 11 +++++++++++ include/smsc_lpc47m.h | 27 ++++++++++++++++++++++++--- 3 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/asm/ibmpc.h b/arch/x86/include/asm/ibmpc.h index 678cde4..1e9058c 100644 --- a/arch/x86/include/asm/ibmpc.h +++ b/arch/x86/include/asm/ibmpc.h @@ -24,4 +24,7 @@ #define UART0_IRQ 4 #define UART1_IRQ 3
+#define KBD_IRQ 1 +#define MSE_IRQ 12
#endif diff --git a/drivers/misc/smsc_lpc47m.c b/drivers/misc/smsc_lpc47m.c index 1e50d5b..3f209d9 100644 --- a/drivers/misc/smsc_lpc47m.c +++ b/drivers/misc/smsc_lpc47m.c @@ -32,3 +32,14 @@ void lpc47m_enable_serial(u16 dev, u16 iobase, u8 irq) pnp_set_enable(dev, 1); pnp_exit_conf_state(dev); }
+void lpc47m_enable_kbc(u16 dev, u8 irq0, u8 irq1)
Can we make these parameters uint instead?
Yes, will do in v2.
+{
pnp_enter_conf_state(dev);
pnp_set_logical_device(dev);
pnp_set_enable(dev, 0);
pnp_set_irq(dev, PNP_IDX_IRQ0, irq0);
pnp_set_irq(dev, PNP_IDX_IRQ1, irq1);
pnp_set_enable(dev, 1);
pnp_exit_conf_state(dev);
+} diff --git a/include/smsc_lpc47m.h b/include/smsc_lpc47m.h index 32b069d..585a404 100644 --- a/include/smsc_lpc47m.h +++ b/include/smsc_lpc47m.h @@ -7,14 +7,35 @@ #ifndef _SMSC_LPC47M_H_ #define _SMSC_LPC47M_H_
+/* I/O address of LPC47M */ +#define LPC47M_IO_PORT 0x2e
+/* Logical device number */ +#define LPC47M_FDC 0 /* Floppy */ +#define LPC47M_SP2 2 /* Serial Port 2 */ +#define LPC47M_PP 3 /* Parallel Port */ +#define LPC47M_SP1 4 /* Serial Port 1 */ +#define LPC47M_KBC 7 /* Keyboard & Mouse */ +#define LPC47M_PME 10 /* Power Control */
/**
- Configure the base I/O port of the specified serial device and enable the
- serial device.
- @dev: High 8 bits = Super I/O port, low 8 bits = logical device number.
- @iobase: Processor I/O port address to assign to this serial device.
- @irq: Processor IRQ number to assign to this serial device.
- @dev: high 8 bits = super I/O port, low 8 bits = logical device number
- @iobase: processor I/O port address to assign to this serial device
*/
- @irq: processor IRQ number to assign to this serial device
void lpc47m_enable_serial(u16 dev, u16 iobase, u8 irq);
+/**
- Configure the specified keyboard controller device and enable the keyboard
- controller device.
- @dev: high 8 bits = Super I/O port, low 8 bits = logical device number
- @irq0: processor IRQ number to assign to keyboard
- @irq1: processor IRQ number to assign to mouse
- */
+void lpc47m_enable_kbc(u16 dev, u8 irq0, u8 irq1);
#endif /* _SMSC_LPC47M_H_ */
Regards, Bin
participants (2)
-
Bin Meng
-
Simon Glass