Skip to content
Permalink
Browse files

drivers/plic: Remove DTS fixups for RISC-V PLIC

Change the DT macros used by the RISC-V PLIC driver so that fixups
are no longer required.

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
  • Loading branch information...
nategraff-sifive authored and nashif committed Mar 20, 2019
1 parent 3093f5c commit 627e27a25fdc6ac242c7284c37f425b81d7eb63a
Showing with 10 additions and 26 deletions.
  1. +10 −10 drivers/interrupt_controller/plic.c
  2. +0 −16 soc/riscv32/riscv-privilege/sifive-freedom/dts_fixup.h
@@ -42,7 +42,7 @@ void riscv_plic_irq_enable(u32_t irq)
u32_t key;
u32_t plic_irq = irq - RISCV_MAX_GENERIC_IRQ;
volatile u32_t *en =
(volatile u32_t *)DT_PLIC_IRQ_EN_BASE_ADDR;
(volatile u32_t *)DT_RISCV_PLIC0_0_IRQ_EN_BASE_ADDRESS;

key = irq_lock();
en += (plic_irq >> 5);
@@ -68,7 +68,7 @@ void riscv_plic_irq_disable(u32_t irq)
u32_t key;
u32_t plic_irq = irq - RISCV_MAX_GENERIC_IRQ;
volatile u32_t *en =
(volatile u32_t *)DT_PLIC_IRQ_EN_BASE_ADDR;
(volatile u32_t *)DT_RISCV_PLIC0_0_IRQ_EN_BASE_ADDRESS;

key = irq_lock();
en += (plic_irq >> 5);
@@ -88,7 +88,7 @@ void riscv_plic_irq_disable(u32_t irq)
int riscv_plic_irq_is_enabled(u32_t irq)
{
volatile u32_t *en =
(volatile u32_t *)DT_PLIC_IRQ_EN_BASE_ADDR;
(volatile u32_t *)DT_RISCV_PLIC0_0_IRQ_EN_BASE_ADDRESS;
u32_t plic_irq = irq - RISCV_MAX_GENERIC_IRQ;

en += (plic_irq >> 5);
@@ -109,14 +109,14 @@ int riscv_plic_irq_is_enabled(u32_t irq)
void riscv_plic_set_priority(u32_t irq, u32_t priority)
{
volatile u32_t *prio =
(volatile u32_t *)DT_PLIC_PRIO_BASE_ADDR;
(volatile u32_t *)DT_RISCV_PLIC0_0_PRIO_BASE_ADDRESS;

/* Can set priority only for PLIC-specific interrupt line */
if (irq <= RISCV_MAX_GENERIC_IRQ)
return;

if (priority > DT_PLIC_MAX_PRIORITY)
priority = DT_PLIC_MAX_PRIORITY;
if (priority > DT_RISCV_PLIC0_0_RISCV_MAX_PRIORITY)
priority = DT_RISCV_PLIC0_0_RISCV_MAX_PRIORITY;

prio += (irq - RISCV_MAX_GENERIC_IRQ);
*prio = priority;
@@ -140,7 +140,7 @@ int riscv_plic_get_irq(void)
static void plic_irq_handler(void *arg)
{
volatile struct plic_regs_t *regs =
(volatile struct plic_regs_t *)DT_PLIC_REG_BASE_ADDR;
(volatile struct plic_regs_t *) DT_RISCV_PLIC0_0_REG_BASE_ADDRESS;

u32_t irq;
struct _isr_table_entry *ite;
@@ -186,11 +186,11 @@ static int plic_init(struct device *dev)
ARG_UNUSED(dev);

volatile u32_t *en =
(volatile u32_t *)DT_PLIC_IRQ_EN_BASE_ADDR;
(volatile u32_t *)DT_RISCV_PLIC0_0_IRQ_EN_BASE_ADDRESS;
volatile u32_t *prio =
(volatile u32_t *)DT_PLIC_PRIO_BASE_ADDR;
(volatile u32_t *)DT_RISCV_PLIC0_0_PRIO_BASE_ADDRESS;
volatile struct plic_regs_t *regs =
(volatile struct plic_regs_t *)DT_PLIC_REG_BASE_ADDR;
(volatile struct plic_regs_t *)DT_RISCV_PLIC0_0_REG_BASE_ADDRESS;
int i;

/* Ensure that all interrupts are disabled initially */

This file was deleted.

0 comments on commit 627e27a

Please sign in to comment.
You can’t perform that action at this time.