Complete Communications Engineering

Many embedded processors have physical pins that are configurable with different functions.  These processors are designed to be useful in a wide variety of applications, so they include many more on-die modules than can be supported by the number of pins they have.  These modules can be turned on and off in software, and the pins can be connected to the modules that are enabled.  Usually each pin can only be connected to one module at a time.  The design of the circuit board that’s using the processor determines which modules should be enabled.  Connecting a pin on the processor to a pin on a peripheral device determines what function the pin on the processor should have.

For processors running Linux, the device tree can be used to set the function for each pin.  Usually Linux will have a separate device driver to control each on-die module of the CPU.  The device tree will have a node for each module which may be enabled or disabled.  Each device node can also link to a pin-multiplexing node which specifies the pin assignments required for using that module.  The following code snippet shows an example device tree with pin assignments:

#include “am33xx.dtsi”

 

&am33xx_pinmux {

    uart0_pins: pinmux_uart0_pins {

        pinctrlsingle,pins = <

            AM33XX_PADCONF(AM335X_PIN_UART0_RXD,

                           PIN_INPUT_PULLUP,

                           MUX_MODE0)

            AM33XX_PADCONF(AM335X_PIN_UART0_TXD,

                           PIN_OUTPUT_PULLDOWN,

                           MUX_MODE0)

        >;

    };

};

 

&uart0 {

    pinctrlnames = “default”;

    pinctrl0 = <&uart0_pins>;

    status = “okay”;

};

This example is taken from a system using the TI AM33xx processor.  The Linux kernel comes with a default device tree for this processor in the form of a device tree include file (am33xx.dtsi).  Any board-specific device tree can include this file and override specific nodes from the tree.  In this case, the am33xx_pinmux and uart0 nodes have been overridden to enable UART0 which is one of the on-die modules of the processor.   The module has been enabled (status=okay) and two of the processor’s pins have been configured with the required multiplexing mode to connect to the module (MUX_MODE0).