source: rtems-docs/user/bsps/arm/beagle.rst @ 6185f6e

5
Last change on this file since 6185f6e was 6185f6e, checked in by Vijay Kumar Banerjee <vijaykumar9597@…>, on 09/24/19 at 18:44:32

bsps/beagle: update i2c section

  • Property mode set to 100644
File size: 2.8 KB
Line 
1.. SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. Copyright (C) 2019 Vijay Kumar Banerjee
4
5beagle
6======
7
8This BSP supports four variants, `beagleboardorig`, `beagleboardxm`,
9`beaglebonewhite` and `beagleboneblack`. The basic hardware initialization is
10not performed by the BSP.  A boot loader with device tree support must be used
11to start the BSP, e.g., U-Boot.
12
13TODO(These drivers are present but not documented yet):
14
15 *  Clock driver.
16 *  Network Interface Driver.
17 *  SDcard driver.
18 *  GPIO Driver.
19 *  Console driver.
20 *  PWM Driver.
21 *  RTC driver.
22
23Boot via U-Boot
24---------------
25To boot via uboot, the ELF must be converted to a U-Boot image like below:
26
27.. code-block:: none
28
29    arm-rtems5-objcopy hello.exe -O binary app.bin
30    gzip -9 app.bin
31    mkimage -A arm -O linux -T kernel -a 0x80000000 -e 0x80000000 -n RTEMS -d app.bin.gz rtems-app.img
32
33Getting the Device Tree Blob
34----------------------------
35
36The Device Tree Blob (DTB) is needed to load the device tree while starting up
37the kernel. We build the dtb from the FreeBSD source matching the commit hash
38from the libbsd HEAD of freebsd-org. For example if the HEAD is at
39"19a6ceb89dbacf74697d493e48c388767126d418"
40Then the right Device Tree Source (DTS) file is:
41https://github.com/freebsd/freebsd/blob/19a6ceb89dbacf74697d493e48c388767126d418/sys/gnu/dts/arm/am335x-boneblack.dts
42
43Please refer to the :ref:`DeviceTree` to know more about building and applying
44the Device Trees.
45
46Writing the uEnv.txt file
47-------------------------
48
49The uEnv.txt file is needed to set any environment variable before the kernel is
50loaded. Each line is a u-boot command that the uboot will execute during start
51up.
52
53Add the following to a file named uEnv.txt:
54
55.. code-block:: none
56
57     setenv bootdelay 5
58     uenvcmd=run boot
59     boot=fatload mmc 0 0x80800000 rtems-app.img ; fatload mmc 0 0x88000000 am335x-boneblack.dtb ; bootm 0x80800000 - 0x88000000
60
61I2C Driver
62----------
63
64The Beagle has the `i2c-0` device registered at initialization. For registering
65`i2c-1` and `i2c-2` ``bbb_register_i2c_1()`` and
66``bbb_register_i2c_2()`` wrapper functions are respectively used.
67
68For registering an I2C device with a custom path (say `/dev/i2c-3`) the
69function ``am335x_i2c_bus_register()`` has to be used.
70
71The function prototype is given below:
72
73.. code-block:: C
74
75   int am335x_i2c_bus_register(
76   const char         *bus_path,
77   uintptr_t           register_base,
78   uint32_t            input_clock,
79   rtems_vector_number irq
80   );
81
82SPI Driver
83----------
84
85The SPI device `/dev/spi-0` can be registered with ``bbb_register_spi_0()``
86
87For registering with a custom path, the ``bsp_register_spi()`` can be used.
88
89The function prototype is given below:
90
91.. code-block:: C
92
93    rtems_status_code bsp_register_spi(
94       const char         *bus_path,
95       uintptr_t           register_base,
96       rtems_vector_number irq
97    );
Note: See TracBrowser for help on using the repository browser.