forked from Imagelibrary/rtems
@@ -84,12 +84,7 @@ static void imx_uart_init_context(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONSOLE_USE_INTERRUPTS
|
#ifdef CONSOLE_USE_INTERRUPTS
|
||||||
val = fdt_getprop(fdt, node, "interrupts", &len);
|
ctx->irq = imx_get_irq_of_node(fdt, node, 0);
|
||||||
if (val != NULL && len >= 8) {
|
|
||||||
uint32_t cpu_val[2];
|
|
||||||
cpu_val[1] = fdt32_to_cpu(val[1]);
|
|
||||||
ctx->irq = bsp_fdt_map_intr(cpu_val, 2);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,12 @@ extern "C" {
|
|||||||
|
|
||||||
void arm_generic_timer_get_config(uint32_t *frequency, uint32_t *irq);
|
void arm_generic_timer_get_config(uint32_t *frequency, uint32_t *irq);
|
||||||
|
|
||||||
|
rtems_vector_number imx_get_irq_of_node(
|
||||||
|
const void *fdt,
|
||||||
|
int node,
|
||||||
|
size_t index
|
||||||
|
);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@@ -21,9 +21,28 @@
|
|||||||
|
|
||||||
#include <libfdt.h>
|
#include <libfdt.h>
|
||||||
|
|
||||||
|
#define MAGIC_IRQ_OFFSET 32
|
||||||
|
|
||||||
|
rtems_vector_number imx_get_irq_of_node(
|
||||||
|
const void *fdt,
|
||||||
|
int node,
|
||||||
|
size_t index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
const uint32_t *val;
|
||||||
|
|
||||||
|
val = fdt_getprop(fdt, node, "interrupts", &len);
|
||||||
|
if (val == NULL || len < (int) ((index + 1) * 12)) {
|
||||||
|
return UINT32_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fdt32_to_cpu(val[index * 3 + 1]) + MAGIC_IRQ_OFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells)
|
uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells)
|
||||||
{
|
{
|
||||||
return intr[1] + 32;
|
return intr[1] + MAGIC_IRQ_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
void arm_generic_timer_get_config(
|
void arm_generic_timer_get_config(
|
||||||
@@ -46,13 +65,8 @@ void arm_generic_timer_get_config(
|
|||||||
bsp_fatal(IMX_FATAL_GENERIC_TIMER_FREQUENCY);
|
bsp_fatal(IMX_FATAL_GENERIC_TIMER_FREQUENCY);
|
||||||
}
|
}
|
||||||
|
|
||||||
val = fdt_getprop(fdt, node, "interrupts", &len);
|
/* FIXME: Figure out how Linux gets a proper IRQ number */
|
||||||
if (val != NULL && len >= 8) {
|
*irq = imx_get_irq_of_node(fdt, node, 0) - 16;
|
||||||
/* FIXME: Figure out how Linux gets a proper IRQ number */
|
|
||||||
*irq = 16 + fdt32_to_cpu(val[1]);
|
|
||||||
} else {
|
|
||||||
bsp_fatal(IMX_FATAL_GENERIC_TIMER_IRQ);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bsp_start(void)
|
void bsp_start(void)
|
||||||
|
|||||||
@@ -137,8 +137,7 @@ typedef enum {
|
|||||||
ATSAM_FATAL_PIO_CONFIGURE_IT,
|
ATSAM_FATAL_PIO_CONFIGURE_IT,
|
||||||
|
|
||||||
/* i.MX fatal codes */
|
/* i.MX fatal codes */
|
||||||
IMX_FATAL_GENERIC_TIMER_FREQUENCY = BSP_FATAL_CODE_BLOCK(12),
|
IMX_FATAL_GENERIC_TIMER_FREQUENCY = BSP_FATAL_CODE_BLOCK(12)
|
||||||
IMX_FATAL_GENERIC_TIMER_IRQ
|
|
||||||
} bsp_fatal_code;
|
} bsp_fatal_code;
|
||||||
|
|
||||||
RTEMS_NO_RETURN static inline void
|
RTEMS_NO_RETURN static inline void
|
||||||
|
|||||||
Reference in New Issue
Block a user