Skip to content

Commit

Permalink
star64: Enable serial data available interrupt
Browse files Browse the repository at this point in the history
The interrupt is enabled on init. Nothing needs to be done in the IRQ
handler as the next read will acknowledge the interrupt to the device.

Signed-off-by: Jimmy Brush <code@jimmah.com>
  • Loading branch information
canarysnort01 committed Aug 24, 2023
1 parent 5d02912 commit 523cd40
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libplatsupport/src/plat/star64/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "../../chardev.h"

#define UART_THR 0x00 /* UART Transmit Holding Register */
#define UART_IER 0x04 /* UART Interrupt Enable Register */
#define UART_IER_ERDAI BIT(0) /* Enable Received Data Available Interrupt */
#define UART_LSR 0x14 /* UART Line Status Register */
#define UART_LSR_THRE 0x20 /* Transmit Holding Register Empty */

Expand Down Expand Up @@ -38,7 +40,11 @@ int uart_putchar(ps_chardevice_t *d, int c)

static void uart_handle_irq(ps_chardevice_t *dev)
{
/* This UART driver is not interrupt driven, there is nothing to do here. */
/*
* This is currently only called when received data is available on the device.
* The interrupt will be acked to the device on the next read to the device.
* There's nothing else we need to do here.
*/
}

int uart_init(const struct dev_defn *defn,
Expand All @@ -63,6 +69,7 @@ int uart_init(const struct dev_defn *defn,
dev->flags = SERIAL_AUTO_CR;

*REG_PTR(dev->vaddr, 0x8) = 1;
*REG_PTR(dev->vaddr, UART_IER) = UART_IER_ERDAI;

return 0;
}

0 comments on commit 523cd40

Please sign in to comment.