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

5
Last change on this file since 5616983 was 5616983, checked in by Sebastian Huber <sebastian.huber@…>, on 09/26/17 at 05:10:40

bsp/imx: Add nocache section

Update #3090.

  • Property mode set to 100644
File size: 1.4 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#include <bsp/linker-symbols.h>
21
22#include <libfdt.h>
23
24uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells)
25{
26  return intr[1] + 32;
27}
28
29void arm_generic_timer_get_config(
30  uint32_t *frequency,
31  uint32_t *irq
32)
33{
34  const void *fdt;
35  int node;
36  int len;
37  const uint32_t *val;
38
39  fdt = bsp_fdt_get();
40  node = fdt_path_offset(fdt, "/timer");
41
42  val = fdt_getprop(fdt, node, "clock-frequency", &len);
43  if (val != NULL && len >= 4) {
44    *frequency = fdt32_to_cpu(val[0]);
45  } else {
46    bsp_fatal(IMX_FATAL_GENERIC_TIMER_FREQUENCY);
47  }
48
49  val = fdt_getprop(fdt, node, "interrupts", &len);
50  if (val != NULL && len >= 8) {
51    /* FIXME: Figure out how Linux gets a proper IRQ number */
52    *irq = 16 + fdt32_to_cpu(val[1]);
53  } else {
54    bsp_fatal(IMX_FATAL_GENERIC_TIMER_IRQ);
55  }
56}
57
58void bsp_start(void)
59{
60  bsp_interrupt_initialize();
61  rtems_cache_coherent_add_area(
62    bsp_section_nocacheheap_begin,
63    (uintptr_t) bsp_section_nocacheheap_size
64  );
65}
Note: See TracBrowser for help on using the repository browser.