Edward O'Callaghan (eocallaghan@alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7615
-gerrit
commit 2134f5912e96f592f22e997627da8fb45757986a Author: Edward O'Callaghan eocallaghan@alterapraxis.com Date: Sun Nov 30 16:24:11 2014 +1100
ec/compal/ene932: Fix TODO by sharing kbc func's with kbc driver
Change-Id: I711d697f3d254d0f447eb3d46bc0f36e16332688 Signed-off-by: Edward O'Callaghan eocallaghan@alterapraxis.com --- src/drivers/pc80/keyboard.c | 6 +++--- src/ec/compal/ene932/ec.c | 49 --------------------------------------------- src/include/pc80/keyboard.h | 5 +++++ 3 files changed, 8 insertions(+), 52 deletions(-)
diff --git a/src/drivers/pc80/keyboard.c b/src/drivers/pc80/keyboard.c index 06eae46..d1cbd10 100644 --- a/src/drivers/pc80/keyboard.c +++ b/src/drivers/pc80/keyboard.c @@ -65,7 +65,7 @@ /* Wait 400ms for keyboard controller answers */ #define KBC_TIMEOUT_IN_MS 400
-static int kbc_input_buffer_empty(void) +int kbc_input_buffer_empty(void) { u32 timeout; for (timeout = KBC_TIMEOUT_IN_MS; @@ -78,7 +78,7 @@ static int kbc_input_buffer_empty(void) return !!timeout; }
-static int kbc_output_buffer_full(void) +int kbc_output_buffer_full(void) { u32 timeout; for (timeout = KBC_TIMEOUT_IN_MS; @@ -91,7 +91,7 @@ static int kbc_output_buffer_full(void) return !!timeout; }
-static int kbc_cleanup_buffers(void) +int kbc_cleanup_buffers(void) { u32 timeout; for (timeout = KBC_TIMEOUT_IN_MS; diff --git a/src/ec/compal/ene932/ec.c b/src/ec/compal/ene932/ec.c index 91c979e..f68da81 100644 --- a/src/ec/compal/ene932/ec.c +++ b/src/ec/compal/ene932/ec.c @@ -31,55 +31,6 @@ #include "ec.h" #include "chip.h"
-/* kbc helper functions from drivers/pc80/keyboard.c. TODO: share functions. */ -static int kbc_input_buffer_empty(void) -{ - u32 timeout; - for(timeout = KBC_TIMEOUT_IN_MS; timeout && (inb(KBD_STATUS) & KBD_IBF); - timeout--) { - mdelay(1); - } - - if (!timeout) { - printk(BIOS_WARNING, - "Unexpected Keyboard controller input buffer full\n"); - } - return !!timeout; -} - - -static int kbc_output_buffer_full(void) -{ - u32 timeout; - for(timeout = KBC_TIMEOUT_IN_MS; timeout && ((inb(KBD_STATUS) - & KBD_OBF) == 0); timeout--) { - mdelay(1); - } - - if (!timeout) { - printk(BIOS_INFO, "Keyboard controller output buffer result timeout\n"); - } - return !!timeout; -} - -int kbc_cleanup_buffers(void) -{ - u32 timeout; - for(timeout = KBC_TIMEOUT_IN_MS; timeout && (inb(KBD_STATUS) - & (KBD_OBF | KBD_IBF)); timeout--) { - mdelay(1); - inb(KBD_DATA); - } - - if (!timeout) { - printk(BIOS_ERR, "Couldn't cleanup the keyboard controller buffers\n"); - printk(BIOS_ERR, "Status (0x%x): 0x%x, Buffer (0x%x): 0x%x\n", - KBD_STATUS, inb(KBD_STATUS), KBD_DATA, inb(KBD_DATA)); - } - - return !!timeout; -} -
/* The ENE 60/64 EC registers are the same command/status IB/OB KBC pair. * Check status from 64 port before each command. diff --git a/src/include/pc80/keyboard.h b/src/include/pc80/keyboard.h index 16cb959..8ec69e8 100644 --- a/src/include/pc80/keyboard.h +++ b/src/include/pc80/keyboard.h @@ -4,4 +4,9 @@ void pc_keyboard_init(void); void set_kbc_ps2_mode(void);
+/* Use in some Embedded Controller drivers */ +int kbc_input_buffer_empty(void); +int kbc_output_buffer_full(void); +int kbc_cleanup_buffers(void); + #endif /* PC80_KEYBOARD_H */