source: rtems/bsps/powerpc/mpc55xxevb/i2c/i2c_init.c @ 762fa62

5
Last change on this file since 762fa62 was a2dad96, checked in by Sebastian Huber <sebastian.huber@…>, on 04/23/18 at 07:45:28

bsps: Move I2C drivers to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*===============================================================*\
2| Project: RTEMS support for GWLCFM                               |
3+-----------------------------------------------------------------+
4|                    Copyright (c) 2010                           |
5|                    Embedded Brains GmbH                         |
6|                    Obere Lagerstr. 30                           |
7|                    D-82178 Puchheim                             |
8|                    Germany                                      |
9|                    rtems@embedded-brains.de                     |
10+-----------------------------------------------------------------+
11| The license and distribution terms for this file may be         |
12| found in the file LICENSE in this distribution or at            |
13|                                                                 |
14| http://www.rtems.org/license/LICENSE.                           |
15|                                                                 |
16+-----------------------------------------------------------------+
17| this file contains the low level MPC5516 I2C driver parameters  |
18\*===============================================================*/
19
20#include <libchip/i2c-2b-eeprom.h>
21
22#include <bsp.h>
23#include <bsp/irq.h>
24#include <mpc83xx/mpc83xx_i2cdrv.h>
25
26#if MPC55XX_CHIP_FAMILY == 551
27  static void i2c_probe(mpc83xx_i2c_softc_t *self)
28  {
29    self->base_frq = bsp_clock_speed;
30  }
31
32  static mpc83xx_i2c_desc_t mpc55xx_i2c_bus = {
33    .bus_desc = {
34      .ops = &mpc83xx_i2c_ops,
35      .size = sizeof(mpc55xx_i2c_bus),
36    },
37    .softc = {
38      .reg_ptr = (m83xxI2CRegisters_t *) 0xfff88000,
39      .initialized = FALSE,
40      .irq_number = MPC55XX_IRQ_I2C(0),
41      .base_frq = 0,
42      .probe = i2c_probe
43    }
44  };
45
46  rtems_status_code bsp_register_i2c(void)
47  {
48    int rv = 0;
49    int busno = 0;
50
51    rtems_libi2c_initialize ();
52
53    busno = rtems_libi2c_register_bus(
54      "/dev/i2c1",
55      &mpc55xx_i2c_bus.bus_desc
56    );
57    if (busno < 0) {
58      return RTEMS_IO_ERROR;
59    }
60
61    #ifdef RTEMS_BSP_I2C_EEPROM_DEVICE_NAME
62      rv = rtems_libi2c_register_drv(
63        RTEMS_BSP_I2C_EEPROM_DEVICE_NAME,
64        i2c_2b_eeprom_driver_descriptor,
65        busno,
66        0x51
67      );
68      if (rv < 0) {
69        return RTEMS_IO_ERROR;
70      }
71    #endif
72
73    return RTEMS_SUCCESSFUL;
74  }
75#endif
Note: See TracBrowser for help on using the repository browser.