summaryrefslogtreecommitdiff
path: root/chip/mec1322/port80.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /chip/mec1322/port80.c
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-14695.85.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'chip/mec1322/port80.c')
-rw-r--r--chip/mec1322/port80.c104
1 files changed, 0 insertions, 104 deletions
diff --git a/chip/mec1322/port80.c b/chip/mec1322/port80.c
deleted file mode 100644
index df4583ed8b..0000000000
--- a/chip/mec1322/port80.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Copyright 2015 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.
- */
-
-/* Port 80 Timer Interrupt for MEC1322 */
-
-#include "common.h"
-#include "console.h"
-#include "hooks.h"
-#include "lpc.h"
-#include "port80.h"
-#include "registers.h"
-#include "task.h"
-
-/* Fire timer interrupt every 1000 usec to check for port80 data. */
-#define POLL_PERIOD_USEC 1000
-/* After 30 seconds of no port 80 data, disable the timer interrupt. */
-#define INTERRUPT_DISABLE_TIMEOUT_SEC 30
-#define INTERRUPT_DISABLE_IDLE_COUNT (INTERRUPT_DISABLE_TIMEOUT_SEC \
- * 1000000 \
- / POLL_PERIOD_USEC)
-
-/* Count the number of consecutive interrupts with no port 80 data. */
-static int idle_count;
-
-static void port_80_interrupt_enable(void)
-{
- idle_count = 0;
-
- /* Enable the interrupt. */
- task_enable_irq(MEC1322_IRQ_TIMER16_1);
- /* Enable and start the timer. */
- MEC1322_TMR16_CTL(1) |= 1 | BIT(5);
-}
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, port_80_interrupt_enable, HOOK_PRIO_DEFAULT);
-DECLARE_HOOK(HOOK_CHIPSET_RESET, port_80_interrupt_enable, HOOK_PRIO_DEFAULT);
-
-static void port_80_interrupt_disable(void)
-{
- /* Disable the timer block. */
- MEC1322_TMR16_CTL(1) &= ~1;
- /* Disable the interrupt. */
- task_disable_irq(MEC1322_IRQ_TIMER16_1);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, port_80_interrupt_disable,
- HOOK_PRIO_DEFAULT);
-
-/*
- * The port 80 interrupt will use TIMER16 instance 1 for a 1ms countdown
- * timer. This timer is on GIRQ23, bit 1.
- */
-static void port_80_interrupt_init(void)
-{
- uint32_t val = 0;
-
- /*
- * The timers are driven by a 48MHz oscillator. Prescale down to
- * 1MHz. 48MHz/48 -> 1MHz
- */
- val = MEC1322_TMR16_CTL(1);
- val = (val & 0xFFFF) | (47 << 16);
- /* Automatically restart the timer. */
- val |= BIT(3);
- /* The counter should decrement. */
- val &= ~BIT(2);
- MEC1322_TMR16_CTL(1) = val;
-
- /* Set the reload value(us). */
- MEC1322_TMR16_PRE(1) = POLL_PERIOD_USEC;
-
- /* Clear the status if any. */
- MEC1322_TMR16_STS(1) |= 1;
-
- /* Clear any pending interrupt. */
- MEC1322_INT_SOURCE(23) = BIT(1);
- /* Enable IRQ vector 23. */
- MEC1322_INT_BLK_EN |= BIT(23);
- /* Enable the interrupt. */
- MEC1322_TMR16_IEN(1) |= 1;
- MEC1322_INT_ENABLE(23) = BIT(1);
-
- port_80_interrupt_enable();
-}
-DECLARE_HOOK(HOOK_INIT, port_80_interrupt_init, HOOK_PRIO_DEFAULT);
-
-void port_80_interrupt(void)
-{
- int data;
-
- MEC1322_TMR16_STS(1) = 1; /* Ack the interrupt */
- if (BIT(1) & MEC1322_INT_RESULT(23)) {
- data = port_80_read();
-
- if (data != PORT_80_IGNORE) {
- idle_count = 0;
- port_80_write(data);
- }
- }
-
- if (++idle_count >= INTERRUPT_DISABLE_IDLE_COUNT)
- port_80_interrupt_disable();
-}
-DECLARE_IRQ(MEC1322_IRQ_TIMER16_1, port_80_interrupt, 2);