mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 01:50:53 +00:00
The problem comes from the different assumption of interrupt mode in EC and the PCH. The PCH assumes IRQ1 is edge-triggered and triggered at a rising edge. However, the auto-IRQ functino of EC is level-triggered and uses low-active to assert an IRQ. This makes the deadlock so that the kernel never gets an interrupt until a byte is manually pulled from host. So, the solution is manually firing an IRQ_1 to host after EC puts a byte to port 0x60. Note that the auto IRQ needs to be disabled in order to avoid the interference with manual IRQ generation. This CL also moves chip specific code to lm4/lpc.c and handle some minor keyboard commands. BUG=none TEST=on hacked baord. Change-Id: Ib57f5a4d749cb019e4c3c00da110054c4f335c7b
48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
/* LPC module for Chrome EC */
|
|
|
|
#ifndef __CROS_EC_LPC_H
|
|
#define __CROS_EC_LPC_H
|
|
|
|
#include "common.h"
|
|
|
|
|
|
/* Manually generates an IRQ to host.
|
|
* Note that the irq_num == 0 would set the AH bit (Active High).
|
|
*/
|
|
void lpc_manual_irq(int irq_num);
|
|
|
|
|
|
/* Initializes the LPC module. */
|
|
int lpc_init(void);
|
|
|
|
/* Returns a pointer to the host command data buffer. This buffer
|
|
* must only be accessed between a notification to
|
|
* host_command_received() and a subsequent call to
|
|
* lpc_SendHostResponse(). <slot> is 0 for kernel-originated
|
|
* commands, 1 for usermode-originated commands. */
|
|
uint8_t *lpc_get_host_range(int slot);
|
|
|
|
/* Sends a response to a host command. The bottom 4 bits of <status>
|
|
* are sent in the status byte. <slot> is 0 for kernel-originated
|
|
* commands, 1 for usermode-originated commands. */
|
|
void lpc_send_host_response(int slot, int status);
|
|
|
|
/* Return true if the TOH is still set */
|
|
int lpc_keyboard_has_char(void);
|
|
|
|
/* Send a byte to host via port 0x60 and asserts IRQ if specified. */
|
|
void lpc_keyboard_put_char(uint8_t chr, int send_irq);
|
|
|
|
/* Returns non-zero if the COMx interface has received a character. */
|
|
int lpc_comx_has_char(void);
|
|
|
|
/* Returns the next character pending on the COMx interface. */
|
|
int lpc_comx_get_char(void);
|
|
|
|
#endif /* __CROS_EC_LPC_H */
|