Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#3784 assigned project

Beagle BSP: Add a flattened device tree based initialization

Reported by: Christian Mauderer Owned by: Christian Mauderer
Priority: normal Milestone: Indefinite
Component: bsps Version:
Severity: normal Keywords: SoC, BSP, medium, retired
Cc: Blocked By: #3782
Blocking:

Description (last modified by Christian Mauderer)

Introduction

RTEMS currently has multiple BSPs for various Beagle Boards:

  • beagleboardorig ./bsps/arm/beagle
  • beagleboardxm ./bsps/arm/beagle
  • beagleboneblack ./bsps/arm/beagle
  • beaglebonewhite ./bsps/arm/beagle

There are a lot of hard coded values in the drivers like the used pins or the register addresses. Applications have to initialize the drivers by calling special functions like bbb_register_i2c_1(...).

Other operating systems like Linux or FreeBSD use a flattened device tree (FDT) for this kind of stuff. Due to the FDT they are able to support all the board variants with only a single BSP.

Target of this project would be to create a FDT based initialization for the Beagle BSPs. Depending on the result it might can be possible to eliminate some of the BSPs mentioned above.

Work Overview

RTEMS already supports FDT for other BSPs. So there is no need to add a complete FDT library. The library is also already included in Beagle for use together with libbsd.

Roughly the following steps would be necessary:

  • Parse the pinmux settings from FDT and create a two part driver for a 'pinctrl-single' compatible FDT entry. One part should be generic so that it can be used for other BSPs too and one part will have to be device specific (similar to FreeBSD or Linux). This would solve #3782.
  • Remove pinmux initialization from all drivers.
  • Initialize drivers based on the FDT (instead of functions like bbb_register_i2c_1(...)). This means that a lot of headers with hardcoded register addresses will have to be changed.
  • Taking a more detailed look at the FDT what else could be initialized from it. Candidates are clocks, RAM size, ...
  • Update the documentation to show the changes.
  • Make sure there is a reasonable error message if no or an invalid FDT is provided.

Requirements

  • Minimal requirement for that project is one Beagle variant (e.g. BBB). I would suggest more if possible. There also should be a Beagleboard XM simulator that can be used as a second variant.
  • Some possibility to debug the application. In this case it should be possible to use the simulator for this. But plan enough time to set it up. An alternative is a hardware debugger like a J-Link (EDU), some OpenOCD based solution like Flyswatter or another debugger solution.
  • Good ability to read C code. This project will need a lot of it to adapt the drivers.
  • Basic knowledge about how to use U-Boot. You'll need it for testing different FDTs.

Update 2020

Also there is still quite a bit left (Updating drivers, improving error messages, ...), a lot of work has been done on this project during GSoC 2020. Not everything has been merged yet because of other structural changes that have to take place first. If you are interested in working on that project, you have to be aware of the work from 2020:

https://gs-niteesh.github.io/finalreport/

Any new work should be based on that.

Change History (7)

comment:1 Changed on 12/27/20 at 09:08:53 by G S Niteesh Babu <niteesh.gs@…>

In [changeset:"9d2ed41fcb1dc635ce7d689c60cdf374f2394dbd/rtems" 9d2ed41/rtems]:

bsps/shared/ofw: Implement RTEMS OFW interface

RTEMS OFW is a FDT only implementation of the OpenFirmWare?
interface. This API is created to be compatible with FreeBSD
OpenFirmWare? interface. The main intention is to make
porting of FreeBSD drivers to RTEMS easier.

Most functions implemented have an direct one-one mapping
with the original OFW API and some extra auxiliary functions
were implemented to make working with device trees easier in
RTEMS.

Update #3784

comment:2 Changed on 01/07/21 at 13:19:48 by Christian Mauderer

Description: modified (diff)

comment:3 Changed on 03/21/21 at 11:37:39 by G S Niteesh Babu <niteesh.gs@…>

In [changeset:"5c656ead880067c6b09119efb91fce577e3c438f/rtems" 5c656ead/rtems]:

bsp/beagle: Import Beagle pinmux from FreeBSD

This patch imports the beagle pinmux driver from FreeBSD into
RTEMS. Previously this driver was placed in RTEMS-libBSD but
this caused double initialization of few pins once during RTEMS
initialization and second time during libBSD initialization.
The following patches port the driver from FreeBSD to RTEMS and
will remove the driver from RTEMS-libBSD.

RTEMS Ticket Update: #3784

FreeBSD head: ca12b7e9534b10af022fed60c043984dbaf4003d

The following files have been imported from FreeBSD:
1) freebsd/sys/arm/ti/am335x/am335x_scm_padconf.h
2) freebsd/sys/arm/ti/am335x/am335x_scm_padconf.c
3) freebsd/sys/arm/ti/ti_pinmux.h
4) freebsd/sys/arm/ti/ti_pinmux.c

comment:4 Changed on 03/21/21 at 11:37:45 by G S Niteesh Babu <niteesh.gs@…>

In [changeset:"56074644a733ecc984722da2a1b61736275270c0/rtems" 5607464/rtems]:

bsp/beagle: Ported Beagle pinmux driver to RTEMS

The following files have been ported
1) ti_pinmux.c
2) ti_pinmux.h
3) am335x_scm_padconf.c
4) am335x_scm_padconf.h

Update #3784

comment:5 Changed on 02/03/22 at 19:30:15 by Gedare Bloom

Keywords: small added

comment:6 Changed on 02/16/24 at 00:06:19 by Gedare Bloom

Keywords: medium added; small removed

comment:7 Changed on 02/16/24 at 14:14:25 by Christian Mauderer

Keywords: retired added
Note: See TracTickets for help on using tickets.