Pin Mux Configuration in U-Boot (Naon)

From DAVE Developer's Wiki
Revision as of 10:36, 8 May 2012 by DevWikiAdmin (talk | contribs) (Texas Instruments Pin Mux Utility)

Jump to: navigation, search
Info Box
Naon am387x-dm814x.png Applies to Naon
Tux.png Applies to U-Boot

Introduction[edit | edit source]

The first thing to do when adding/modifying a peripheral is configure correctly the internal Pin Mux: in fact, nearly every peripheral function can be attached to more than one pin and nearly every pin is shared between two or more peripheral.

Texas Instruments Pin Mux Utility[edit | edit source]

Pin Mux is quite complex in Naon and, fortunately, a tool from TI can help: we suggest to download and install TI Pin Mux Utility from TI website.

Software installation and generic usage documentation is available on this TI wiki page

Pin Mux Utility also warn the user if there's a conflict in mux usage (e.g. the same pin configured for two function) and does not allow to export the source code when this kind of problems arise. Please take a look, for example, at Additional UART on Linux (Naon) article for a step-by-step guide in how to change pin mux configuration and how to fix conflicts.


An example of Pin Mux Utility with mux conflic

Pin Mux Configuration in u-boot[edit | edit source]

Due the fact the correct configuration of pin mux usually should be applied as soon as possible and that's better if pin mux is done is only one place, Dave choose to move all its initialization inside the startup code of U-Boot

Changing default pin mux configuration is just a matter of:

  1. open TI Pin Mux configuration
  2. load the Dave provided Naon default configuration
  3. change the mux as needed
  4. export the generated source code into the U-Boot source tree
  5. rebuild u-boot and update it on your Naon board

Exporting generated source file[edit | edit source]

Pix Mux Utility export function, generate two source file:

  1. mux.h: which contains only pin mux registers offset. This file does NOT change when user changes pin mux configuration. It does NOT need to be updated.
  2. pinmux.h: which contains pin mux register values for each pin. This is the file that need to be updated in U-Boot source code

To update the default pin mux configuration with your changes just overwrite the board/dave/naon/pinmux.h file inside the U-Boot source tree with the generated one.

Please also note that, inside pinmux.h, user should change:

#define MUX_EVM() \
MUX_VAL(PINCNTL1, (IEN | IPU | FCN1 )) /* SD1_CLK */\
MUX_VAL(PINCNTL2, (IEN | IPU | FCN1 )) /* SD1_CMD_MUX0 */\
MUX_VAL(PINCNTL3, (IEN | IPU | FCN1 )) /* SD1_DAT[0] */\

into

#define MUX_NAON() \
MUX_VAL(PINCNTL1, (IEN | IPU | FCN1 )) /* SD1_CLK */\
MUX_VAL(PINCNTL2, (IEN | IPU | FCN1 )) /* SD1_CMD_MUX0 */\
MUX_VAL(PINCNTL3, (IEN | IPU | FCN1 )) /* SD1_DAT[0] */\


Info-icon.png To avoid timestamp problems and broken dependency, before building U-Boot we suggest to run u-boot_clean target:
nelk@nelk-desktop:/home/shared/devel/dave/naon-DAA/sw/linux/sdk/sdk-5.03.01.15$ make u-boot_clean u-boot u-boot_install
Info-icon.png


Info-icon.png Please note that pin mux configuration is applied in both U-Boot stage (1st and 2nd). When changing pin mux configuration for your custom board, please be sure to update both binaries Info-icon.png