summaryrefslogtreecommitdiff
path: root/chip/mec1322/lpc.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2019-03-11 15:57:52 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-03-26 04:42:55 -0700
commitbb266fc26fc05d4ab22de6ad7bce5b477c9f9140 (patch)
treef6ada087f62246c3a9547e649ac8846b0ed6d5ab /chip/mec1322/lpc.c
parent0bfc511527cf2aebfa163c63a1d028419ca0b0c3 (diff)
downloadchrome-ec-bb266fc26fc05d4ab22de6ad7bce5b477c9f9140.tar.gz
common: replace 1 << digits, with BIT(digits)
Requested for linux integration, use BIT instead of 1 << First step replace bit operation with operand containing only digits. Fix an error in motion_lid try to set bit 31 of a signed integer. BUG=None BRANCH=None TEST=compile Change-Id: Ie843611f2f68e241f0f40d4067f7ade726951d29 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'chip/mec1322/lpc.c')
-rw-r--r--chip/mec1322/lpc.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/chip/mec1322/lpc.c b/chip/mec1322/lpc.c
index 5d2d57f834..829f91a85c 100644
--- a/chip/mec1322/lpc.c
+++ b/chip/mec1322/lpc.c
@@ -190,23 +190,23 @@ static void setup_lpc(void)
gpio_config_module(MODULE_LPC, 1);
/* Set up interrupt on LRESET# deassert */
- MEC1322_INT_SOURCE(19) = 1 << 1;
- MEC1322_INT_ENABLE(19) |= 1 << 1;
- MEC1322_INT_BLK_EN |= 1 << 19;
+ MEC1322_INT_SOURCE(19) = BIT(1);
+ MEC1322_INT_ENABLE(19) |= BIT(1);
+ MEC1322_INT_BLK_EN |= BIT(19);
task_enable_irq(MEC1322_IRQ_GIRQ19);
/* Set up ACPI0 for 0x62/0x66 */
MEC1322_LPC_ACPI_EC0_BAR = 0x00628304;
- MEC1322_INT_ENABLE(15) |= 1 << 6;
- MEC1322_INT_BLK_EN |= 1 << 15;
+ MEC1322_INT_ENABLE(15) |= BIT(6);
+ MEC1322_INT_BLK_EN |= BIT(15);
/* Clear STATUS_PROCESSING bit in case it was set during sysjump */
MEC1322_ACPI_EC_STATUS(0) &= ~EC_LPC_STATUS_PROCESSING;
task_enable_irq(MEC1322_IRQ_ACPIEC0_IBF);
/* Set up ACPI1 for 0x200/0x204 */
MEC1322_LPC_ACPI_EC1_BAR = 0x02008407;
- MEC1322_INT_ENABLE(15) |= 1 << 8;
- MEC1322_INT_BLK_EN |= 1 << 15;
+ MEC1322_INT_ENABLE(15) |= BIT(8);
+ MEC1322_INT_BLK_EN |= BIT(15);
MEC1322_ACPI_EC_STATUS(1) &= ~EC_LPC_STATUS_PROCESSING;
task_enable_irq(MEC1322_IRQ_ACPIEC1_IBF);
@@ -214,24 +214,24 @@ static void setup_lpc(void)
MEC1322_LPC_8042_BAR = 0x00608104;
/* Set up indication of Auxiliary sts */
- MEC1322_8042_KB_CTRL |= 1 << 7;
+ MEC1322_8042_KB_CTRL |= BIT(7);
MEC1322_8042_ACT |= 1;
- MEC1322_INT_ENABLE(15) |= ((1 << 13) | (1 << 14));
- MEC1322_INT_BLK_EN |= 1 << 15;
+ MEC1322_INT_ENABLE(15) |= (BIT(13) | BIT(14));
+ MEC1322_INT_BLK_EN |= BIT(15);
task_enable_irq(MEC1322_IRQ_8042EM_IBF);
task_enable_irq(MEC1322_IRQ_8042EM_OBF);
#ifndef CONFIG_KEYBOARD_IRQ_GPIO
/* Set up SERIRQ for keyboard */
- MEC1322_8042_KB_CTRL |= (1 << 5);
+ MEC1322_8042_KB_CTRL |= BIT(5);
MEC1322_LPC_SIRQ(1) = 0x01;
#endif
/* Set up EMI module for memory mapped region, base address 0x800 */
MEC1322_LPC_EMI_BAR = 0x0800800f;
- MEC1322_INT_ENABLE(15) |= 1 << 2;
- MEC1322_INT_BLK_EN |= 1 << 15;
+ MEC1322_INT_ENABLE(15) |= BIT(2);
+ MEC1322_INT_BLK_EN |= BIT(15);
task_enable_irq(MEC1322_IRQ_EMI);
/* Access data RAM through alias address */
@@ -295,7 +295,7 @@ DECLARE_DEFERRED(lpc_chipset_reset);
void girq19_interrupt(void)
{
/* Check interrupt result for LRESET# trigger */
- if (MEC1322_INT_RESULT(19) & (1 << 1)) {
+ if (MEC1322_INT_RESULT(19) & BIT(1)) {
/* Initialize LPC module when LRESET# is deasserted */
if (!lpc_get_pltrst_asserted()) {
setup_lpc();
@@ -313,7 +313,7 @@ void girq19_interrupt(void)
lpc_get_pltrst_asserted() ? "" : "de");
/* Clear interrupt source */
- MEC1322_INT_SOURCE(19) = 1 << 1;
+ MEC1322_INT_SOURCE(19) = BIT(1);
}
}
DECLARE_IRQ(MEC1322_IRQ_GIRQ19, girq19_interrupt, 1);
@@ -423,7 +423,7 @@ void kb_ibf_interrupt(void)
{
if (lpc_keyboard_input_pending())
keyboard_host_write(MEC1322_8042_H2E,
- MEC1322_8042_STS & (1 << 3));
+ MEC1322_8042_STS & BIT(3));
task_wake(TASK_ID_KEYPROTO);
}
DECLARE_IRQ(MEC1322_IRQ_8042EM_IBF, kb_ibf_interrupt, 1);
@@ -437,12 +437,12 @@ DECLARE_IRQ(MEC1322_IRQ_8042EM_OBF, kb_obf_interrupt, 1);
int lpc_keyboard_has_char(void)
{
- return (MEC1322_8042_STS & (1 << 0)) ? 1 : 0;
+ return (MEC1322_8042_STS & BIT(0)) ? 1 : 0;
}
int lpc_keyboard_input_pending(void)
{
- return (MEC1322_8042_STS & (1 << 1)) ? 1 : 0;
+ return (MEC1322_8042_STS & BIT(1)) ? 1 : 0;
}
void lpc_keyboard_put_char(uint8_t chr, int send_irq)
@@ -506,7 +506,7 @@ static int lpc_get_protocol_info(struct host_cmd_handler_args *args)
struct ec_response_get_protocol_info *r = args->response;
memset(r, 0, sizeof(*r));
- r->protocol_versions = (1 << 3);
+ r->protocol_versions = BIT(3);
r->max_request_packet_size = EC_LPC_HOST_PACKET_SIZE;
r->max_response_packet_size = EC_LPC_HOST_PACKET_SIZE;
r->flags = 0;