Creating a Custom device tree for your baseboard

If you have designed a custom baseboard for use with the MitySOM-335x, you will need to customize the Linux kernel (and possibly U-Boot) for your design. This customization will define the pinmux and configure the peripherals and interfaces that are specific to your design. In most cases, we suggest following our example development baseboard design as much as possible to minimize the required software changes.

Kernel 3.8 or Newer: Device Tree Update

For newer kernels, the processor and board configuration does not need to be compiled into the kernel. Instead, the hardware is described in a Device Tree file that configures the hardware interfaces and the processor pinmux. This device tree is then loaded at boot time to configure the kernel. One advantage of this approach is it allows you to reconfigure the hardware without requiring a kernel recompile in most cases.

Before you begin, please make sure you can complete a kernel compile as described in our getting started guide. This will ensure that your toolchain and environment is setup correctly before you try to customize it.

Finding the Device Trees

  • Open a terminal window
  • Navigate to the Linux Kernel git directory
    cd ~/projects/linux-mityarm-335x/
  • Navigate to the device tree directory:
    cd arch/arm/boot/dts
  • Copy the Critical Link Devkit baseboard file for use as a template.
    cp am335x-mitysom-devkit.dts am335x-mitysom-custom.dts
  • Use your favorite text editor to add a line for the new custom device tree in the Makefile in the same directory:
            am335x-moxa-uc-8100-me-t.dtb \
            am335x-nano.dtb \
            am335x-mitysom-devkit.dtb \
            am335x-mitysom-custom.dtb \
            am335x-mitysom-maker.dtb \
            am335x-mitysom-abx.dtb \
            am335x-pepper.dtb \
            am335x-phycore-rdk.dtb \

    Note that this line ends with ".dtb \" not ".dts \".

After completing these steps, your "custom" dtb will be created when you run the "make dtbs" step of the kernel build instructions. This dtb file can then be loaded at boot to configure your baseboard.

Editing your Device Tree

The kernel's device tree documentation is available in linux-mityarm-335x/Documentation/devicetree, but this can be overwhelming if you haven't used the device tree before.

For your first pass, please review the devkit device tree to see how the pinmux is defined. Then, make changes based on your board's design. Note that the pinmux registers are added to 800h to match with the pinmux registers from the TRM Table 9-10. So conf_gpmc_ad0 at 800h in the TRM will be 0x000 in the device tree.

Also, most pinmuxes have an _sleep version. This pinmux is used when the system is put into sleep mode to reduce power usage, if you don't plan to use the sleep mode these can be ignored. If your product does require a sleep mode, please contact us to help you ensure your hardware design will work in sleep mode.

If you are using the MitySOM-335x SOM in your design, Critical Link can help you update your device tree. Please feel free to post to our user forums if you have any questions.

Reference pinmux cheatsheet


Updating the kernel configuration

In addition to adding your customized device tree, you also need to ensure that any required drivers are enabled in the kernel config. This can be done manually using the "make menuconfig" command during the kernel build process. If you are using an interface or IC that is not on our development kit baseboard, you will need to make sure the correct driver is enabled in the kernel config.

If you are using the MitySOM-335x SOM in your design, please contact Critical Link if you need assistance customizing your kernel config for your specific hardware.

Using your new device tree and kernel

Once you have your compiled device tree and kernel, you can use our instructions for building a fitimage at the end of our Linux kernel guide.

You will need to use a fitImage if you want to use the same U-Boot kernel loading interface we use in our MDK. However, note that since we have changed the name of the .dtb file, you will need to update the file, <MDK path>/sources/fitImage.its, accordingly.

In fitImage.its replace

 data = /incbin/("arch/arm/boot/dts/am335x-mitysom-devkit.dtb");

data = /incbin/("arch/arm/boot/dts/am335x-mitysom-custom.dtb");

Go to top
Add picture from clipboard (Maximum size: 1 GB)