forked from Imagelibrary/rtems
@@ -71,18 +71,10 @@ static void imx_uart_init_context(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
int node;
|
int node;
|
||||||
int len;
|
|
||||||
const uint32_t *val;
|
|
||||||
|
|
||||||
rtems_termios_device_context_initialize(&ctx->base, "UART");
|
rtems_termios_device_context_initialize(&ctx->base, "UART");
|
||||||
|
|
||||||
node = fdt_path_offset(fdt, serial);
|
node = fdt_path_offset(fdt, serial);
|
||||||
|
ctx->regs = imx_get_reg_of_node(fdt, node);
|
||||||
val = fdt_getprop(fdt, node, "reg", &len);
|
|
||||||
if (val != NULL && len >= 4) {
|
|
||||||
ctx->regs = (imx_uart *) fdt32_to_cpu(val[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONSOLE_USE_INTERRUPTS
|
#ifdef CONSOLE_USE_INTERRUPTS
|
||||||
ctx->irq = imx_get_irq_of_node(fdt, node, 0);
|
ctx->irq = imx_get_irq_of_node(fdt, node, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ 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);
|
||||||
|
|
||||||
|
void *imx_get_reg_of_node(const void *fdt, int node);
|
||||||
|
|
||||||
rtems_vector_number imx_get_irq_of_node(
|
rtems_vector_number imx_get_irq_of_node(
|
||||||
const void *fdt,
|
const void *fdt,
|
||||||
int node,
|
int node,
|
||||||
|
|||||||
@@ -23,6 +23,19 @@
|
|||||||
|
|
||||||
#define MAGIC_IRQ_OFFSET 32
|
#define MAGIC_IRQ_OFFSET 32
|
||||||
|
|
||||||
|
void *imx_get_reg_of_node(const void *fdt, int node)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
const uint32_t *val;
|
||||||
|
|
||||||
|
val = fdt_getprop(fdt, node, "reg", &len);
|
||||||
|
if (val == NULL || len < 4) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (void *) fdt32_to_cpu(val[0]);
|
||||||
|
}
|
||||||
|
|
||||||
rtems_vector_number imx_get_irq_of_node(
|
rtems_vector_number imx_get_irq_of_node(
|
||||||
const void *fdt,
|
const void *fdt,
|
||||||
int node,
|
int node,
|
||||||
|
|||||||
Reference in New Issue
Block a user