Board bring-up part 3: Other peripherals

Posted by Marcus Folkesson on Friday, August 16, 2024

Board bring-up part 3: Other peripherals

I'm currently working with a board bring up for a custom hardware based on a OMAPL138 from Texas Instruments. It is fun to work with "real" bring-ups. Most of my customers use System On Modules (SoM:s) these days. You get a lot for free with those modules but a lot of the fun is stripped away.

This post is not intended to be guide, it is more of a follow-me-through-my-work-post divided into three parts.

The first step is to get a bootloader to startup properly - which is also as far as I will take it in this series.

We are going to use U-boot [1] as bootloader for this project and I will use the TMDSLCDK138 [2] implementation as a reference during my bring-up, which is a evaluation kit for the OMAP-L138 CPU.

I will also be sharing lots of code snippets and it may not be obvious where they belong. In part4, I will summary all the changes I made.

About this part

In this part I will add support for the rest of the peripherals I need. The board has a lot of external IC:s that the final product shall support, but after looking into it, very few of those needs to be supported by the bootloader. Hence the only peripherals I will setup is the EMAC to add an ethernet interface and the serial port.

EMAC

I Added CONFIG_DRIVER_TI_EMAC=y to the configuration file, MUX the pins and setup the module to use MII mode:

 1static const struct pinmux_config emac_pins[] = {
 2	{ pinmux(2), 8, 1 },
 3	{ pinmux(2), 8, 2 },
 4	{ pinmux(2), 8, 3 },
 5	{ pinmux(2), 8, 4 },
 6	{ pinmux(2), 8, 5 },
 7	{ pinmux(2), 8, 6 },
 8	{ pinmux(2), 8, 7 },
 9	{ pinmux(3), 8, 0 },
10	{ pinmux(3), 8, 1 },
11	{ pinmux(3), 8, 2 },
12	{ pinmux(3), 8, 3 },
13	{ pinmux(3), 8, 4 },
14	{ pinmux(3), 8, 5 },
15	{ pinmux(3), 8, 6 },
16	{ pinmux(3), 8, 7 },
17	{ pinmux(4), 8, 0 },
18	{ pinmux(4), 8, 1 }
19};
20
21int board_init(void)
22{
23	...
24	if (davinci_configure_pin_mux(emac_pins, ARRAY_SIZE(emac_pins)) != 0)
25		return 1;
26	davinci_emac_mii_mode_sel(HAS_RMII);
27
28	...
29}

A little bit redundant as we setup the pinctrl node in the devicetree as well.

Devicetree

Enable the mdio and eth0 nodes in the device tree.

&mdio {
	pinctrl-names = "default";
	pinctrl-0 = <&mdio_pins>;
	bus_freq = <2200000>;
	status = "okay";
};

&eth0 {
	pinctrl-names = "default";
	pinctrl-0 = <&mii_pins>;
	status = "okay";
};

Serial port

Make sure CONFIG_SERIAL=y and CONFIG_DM_SERIAL=y in the configuration.

Devicetree

Enable the serial1 node in the device tree.

&serial1 {
	pinctrl-names = "default";
	pinctrl-0 = <&serial1_rxtx_pins>;
	status = "okay";
};

Summary

This was a short post, but we're getting close to the end now!

Continue to Part4 of this series.