source: rtems/c/src/lib/libbsp/arm/imx/startup/bspstart.c @ 05f9858f

5
Last change on this file since 05f9858f was 05f9858f, checked in by Sebastian Huber <sebastian.huber@…>, on 09/13/17 at 05:00:57

bsps: Generalize bsp_fdt_map_intr()

Pass all interrupt cells to bsp_fdt_map_intr() since some platforms use
an array to describe an interrupt.

Update #3090.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 * Copyright (c) 2017 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <info@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#include <bsp.h>
16#include <bsp/bootcard.h>
17#include <bsp/fatal.h>
18#include <bsp/fdt.h>
19#include <bsp/irq-generic.h>
20
21#include <libfdt.h>
22
23uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells)
24{
25  return intr[1] + 32;
26}
27
28void arm_generic_timer_get_config(
29  uint32_t *frequency,
30  uint32_t *irq
31)
32{
33  const void *fdt;
34  int node;
35  int len;
36  const uint32_t *val;
37
38  fdt = bsp_fdt_get();
39  node = fdt_path_offset(fdt, "/timer");
40
41  val = fdt_getprop(fdt, node, "clock-frequency", &len);
42  if (val != NULL && len >= 4) {
43    *frequency = fdt32_to_cpu(val[0]);
44  } else {
45    bsp_fatal(IMX_FATAL_GENERIC_TIMER_FREQUENCY);
46  }
47
48  val = fdt_getprop(fdt, node, "interrupts", &len);
49  if (val != NULL && len >= 8) {
50    /* FIXME: Figure out how Linux gets a proper IRQ number */
51    *irq = 16 + fdt32_to_cpu(val[1]);
52  } else {
53    bsp_fatal(IMX_FATAL_GENERIC_TIMER_IRQ);
54  }
55}
56
57void bsp_start(void)
58{
59  bsp_interrupt_initialize();
60}
Note: See TracBrowser for help on using the repository browser.