source: rtems/bsps/arm/beagle/start/bspstart.c @ a4e96cf

5
Last change on this file since a4e96cf was a4e96cf, checked in by Vijay Kumar Banerjee <vijaykumar9597@…>, on 09/17/19 at 20:46:05

bsps/beagle: register i2c device at initialization

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 * Copyright (c) 2013 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/irq-generic.h>
18#include <bsp/fdt.h>
19#include <bsp/linker-symbols.h>
20#include <bsp/i2c.h>
21#include <rtems/sysinit.h>
22
23#include "bspdebug.h"
24
25void bsp_start(void)
26{
27#if IS_DM3730
28  const char* type = "dm3730-based";
29#endif
30#if IS_AM335X
31  const char* type = "am335x-based";
32#endif
33  bsp_interrupt_initialize();
34  printk("\nRTEMS Beagleboard: %s\n", type);
35  printk("        ARM Debug: 0x%08x\n", (intptr_t) bbb_arm_debug_registers());
36  rtems_cache_coherent_add_area(
37      bsp_section_nocacheheap_begin,
38      (uintptr_t) bsp_section_nocacheheap_size
39  );
40}
41
42uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells)
43{
44  return intr[0];
45}
46
47static void bbb_i2c_0_initialize(void)
48{
49  int err;
50
51  err = am335x_i2c_bus_register(BBB_I2C_0_BUS_PATH,
52                                AM335X_I2C0_BASE,
53                                I2C_BUS_CLOCK_DEFAULT,
54                                BBB_I2C0_IRQ);
55  if (err != 0) {
56    printk("rtems i2c-0: Device could not be registered (%d)", err);
57  }
58}
59
60RTEMS_SYSINIT_ITEM(
61  bbb_i2c_0_initialize,
62  RTEMS_SYSINIT_LAST,
63  RTEMS_SYSINIT_ORDER_LAST
64);
Note: See TracBrowser for help on using the repository browser.