Welcome, Guest

Author Topic: Support for Olimex AM3352-SOM in beaglebone kernel  (Read 9539 times)

thom_nic

  • Newbie
  • *
  • Posts: 28
  • Karma: +1/-0
Re: Support for Olimex AM3352-SOM in beaglebone kernel
« Reply #15 on: February 02, 2017, 11:10:49 PM »
That's great, thanks!

thom_nic

  • Newbie
  • *
  • Posts: 28
  • Karma: +1/-0
Re: Support for Olimex AM3352-SOM in beaglebone kernel
« Reply #16 on: February 07, 2017, 07:27:55 PM »
I have one more question re: DTS...  I noticed with the beaglebone am335x-som DTS, LEDs on GPIO3 pins 19, 20 and 21 are used as the heartbeat.  On the Olimex SOM (and their DTS,) the green LED on the SOM is conected to gpio2 pin 18.  I know I can add that pin definition in my own DTS but what should I do to disable pins 19, 20 and 21?  I don't need 4 blinking heartbeat LEDs :D

I would prefer actually to remap gpio3 20 and 21 back to mmc0 and cpu0 trigger respectively as they were in the original Olimex EVB DTS.  Can I do that while still including the am335x-som-common.dtsi and override them?

Thanks.

vinifr

  • Sr. Member
  • ****
  • Posts: 262
  • Karma: +9/-0
Re: Support for Olimex AM3352-SOM in beaglebone kernel
« Reply #17 on: February 07, 2017, 07:43:53 PM »
Hi,

You can remove them and define in another point with different functions, no problem.

Btw, if I remember well, those pin numbers in &am33xx_pinmux{ are the same in both, am3352 and beaglebone. So, we can use:
Code: [Select]
bb_spi0_pins: pinmux_bb_spi0_pins {
pinctrl-single,pins = <
0x150 0x30 /* spi0_sclk.spi0_sclk, INPUT_PULLUP | MODE0 */
0x154 0x30 /* spi0_d0.spi0_d0, INPUT_PULLUP | MODE0 */
0x158 0x10 /* spi0_d1.spi0_d1, OUTPUT_PULLUP | MODE0 */
0x15c 0x10 /* spi0_cs0.spi0_cs0, OUTPUT_PULLUP | MODE0 */
>;
};

thom_nic

  • Newbie
  • *
  • Posts: 28
  • Karma: +1/-0
Re: Support for Olimex AM3352-SOM in beaglebone kernel
« Reply #18 on: February 07, 2017, 10:57:36 PM »
Thanks.  from looking at these files:
https://www.olimex.com/Products/SOM/AM3352/AM3352-SOM/resources/AM3352_SOM_GPIOs.pdf
and https://github.com/OLIMEX/SOM/raw/master/AM3352/AM3352-SOM/AM3352-SOM_Rev_C.pdf

P3_18 is the onboard green LED,
P3_20 and P3_21 are the red and yellow LEDs on the EVB.
P0_19 (defined as led@1) is EMU2 for JTAG

So what is defined in am335x-som-common.dtsi as:

Code: [Select]
led@1 {
label = "led1:green:heartbeat";
gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
};

led@2 {
label = "led2:red:heartbeat";
gpios = <&gpio3 20 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
};

led@3 {
label = "led3:yello:heartbeat";
gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
};

I re-defined to:

Code: [Select]
led@1 {
label = "olimex-som:green:heartbeat";
gpios = <&gpio3 18 GPIO_ACTIVE_HIGH>;
};

led@2 {
label = "olimex-evb:red:led2";
gpios = <&gpio3 20 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "mmc0";
default-state = "off";
};

led@3 {
label = "olimex-evb:yellow:led3";
gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "cpu0";
default-state = "off";
};

/* later on... */

&user_leds_s0 {
pinctrl-single,pins = <
0x1a0 ( PIN_OUTPUT | MUX_MODE7 ) /* (B12) mcasp0_aclkr.gpio3[18] */
0x1a8 ( PIN_OUTPUT | MUX_MODE7 ) /* (D13) mcasp0_axr1.gpio3[20] */
0x1ac ( PIN_OUTPUT | MUX_MODE7 ) /* (A14) mcasp0_ahclkx.gpio3[21] */
>;
};

This correctly maps the green LED1 (on the SOM) to heartbeat and red EVB LED2 to disk activity but EVB LED3 (yellow) does not trigger on CPU activity.  I think that may be due to something I disabled in kernel config however since `cat /sys/devices/platform/leds/leds/olimex-evb:yellow:led3` does not list `cpu0` as an option.

vinifr

  • Sr. Member
  • ****
  • Posts: 262
  • Karma: +9/-0
Re: Support for Olimex AM3352-SOM in beaglebone kernel
« Reply #19 on: February 09, 2017, 03:23:06 AM »
Hi thom,

That is great, you should try submit these changes to bb kernel.

About leds triggers, I found useful informations here: http://www.crashcourse.ca/wiki/index.php/LEDs_on_the_BBB... Maybe you disabled CONFIG_LEDS_TRIGGER_CPU.
« Last Edit: February 09, 2017, 03:25:18 AM by vinifr »

vinifr

  • Sr. Member
  • ****
  • Posts: 262
  • Karma: +9/-0
Re: Support for Olimex AM3352-SOM in beaglebone kernel
« Reply #20 on: February 10, 2017, 01:26:18 PM »
Hi thom,

Could you pass me your config? I'll make it default configuration for AM3352-som on my repository.

thom_nic

  • Newbie
  • *
  • Posts: 28
  • Karma: +1/-0
Re: Support for Olimex AM3352-SOM in beaglebone kernel
« Reply #21 on: February 13, 2017, 04:26:01 PM »
Maybe you disabled CONFIG_LEDS_TRIGGER_CPU.

Yup, it seems CONFIG_LEDS_TRIGGER_CPU is present in omap2plus_defconfig but not in bb.org_defconfig.

Here's my dts.  I started with a copy of am335x-olimex-som.dts, then added the pin re-mappings from Olimex's EVB pins from their patch.  Also noticed &aes and &sham were not enabled so did that as well.  Note I omitted the LCD pin definitions because I don't need it for my application but a default configuration might want to keep it.

Code: [Select]
/dts-v1/;

#include "am33xx.dtsi"
#include "am335x-som-common.dtsi"

/ {
model = "Olimex AM335x SOM";
compatible = "olimex,am335x-olimex-som", "ti,am33xx";

/* Override LED defs from am335x-som-common so it's correct for Olimex SOM:
* gpio3[18] is the on-SOM green LED1
* gpio3[20] is the EVB red LED2
* gpio3[21] is the EVB yellow LED3 */
leds {
led@1 {
label = "olimex-som:green:heartbeat";
gpios = <&gpio3 18 GPIO_ACTIVE_HIGH>;
};

led@2 {
label = "olimex-evb:red:led2";
gpios = <&gpio3 20 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "mmc0";
default-state = "off";
};

led@3 {
label = "olimex-evb:yellow:led3";
gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "cpu0";
default-state = "off";
};
};
};

&ldo3_reg {
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};

&mmc1 {
vmmc-supply = <&vmmcsd_fixed>;
};

&am33xx_pinmux {
/* LCD pin definitions would go here - see am335x-olimex-som.dts */
};

/* Override pin defs in am335x-som-common.dtsi */
&user_leds_s0 {
pinctrl-single,pins = <
AM33XX_IOPAD(0x9a0, PIN_OUTPUT | MUX_MODE7 ) /* (B12) mcasp0_aclkr.gpio3[18] */
AM33XX_IOPAD(0x9a8, PIN_OUTPUT | MUX_MODE7 ) /* (D13) mcasp0_axr1.gpio3[20] */
AM33XX_IOPAD(0x9ac, PIN_OUTPUT | MUX_MODE7 ) /* (A14) mcasp0_ahclkx.gpio3[21] */
>;
};

&aes {
status = "okay";
};

&sham {
status = "okay";
}
« Last Edit: February 13, 2017, 04:37:46 PM by thom_nic »

vinifr

  • Sr. Member
  • ****
  • Posts: 262
  • Karma: +9/-0
Re: Support for Olimex AM3352-SOM in beaglebone kernel
« Reply #22 on: February 13, 2017, 05:48:34 PM »
Hi,

I meant, could you provide me your custom bb.org_defconfig? I'll make it the default defconfig for AM3352-som on my repository, since Robert Nelson does not accept a defconfig specific for a target.

thom_nic

  • Newbie
  • *
  • Posts: 28
  • Karma: +1/-0
Re: Support for Olimex AM3352-SOM in beaglebone kernel
« Reply #23 on: March 14, 2017, 04:59:40 PM »
Hey I noticed some issues in dmesg, probably related to the DTS in the bb.org kernel:

Code: [Select]
[    0.647864] cpsw 4a100000.ethernet: Using 1 as Reserved VLAN for 0 slave
[    0.647948] cpsw 4a100000.ethernet: Missing dual_emac_res_vlan in DT.
[    0.647960] cpsw 4a100000.ethernet: Using 2 as Reserved VLAN for 1 slave
...
[    0.697664] pinctrl-single 44e10800.pinmux: pin 44e109a0.0 already requested by 48060000.mmc; cannot claim for leds
[    0.697689] pinctrl-single 44e10800.pinmux: pin-104 (leds) status -22
[    0.697704] pinctrl-single 44e10800.pinmux: could not request pin 104 (44e109a0.0) from group user_leds_s0  on device pinctrl-single
[    0.697717] leds-gpio leds: Error applying setting, reverse things back
...
[    0.723512] PM: Cannot get wkup_m3_ipc handle
...
[    0.762891] tps65217 0-0024: Failed to read revision register: -121
...
[    7.703680] musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -517

The "Missing dual_emac_res_vlan in DT" is probably because Olimex' DTS defines &cpsw_emac[0,1] like so:

Code: [Select]
&cpsw_emac0 {
status = "okay";
phy_id = <&davinci_mdio>, <0>;
phy-mode = "mii";
dual_emac_res_vlan = <1>;
};

&cpsw_emac1 {
status = "okay";
phy_id = <&davinci_mdio>, <1>;
phy-mode = "mii";
dual_emac_res_vlan = <2>;
};

The issue about LED pinmux is probably because I'm trying to use gpio3[18,20,21] which are labelled LED1,2,3 on AM3352-SOM_RevC.pdf. 

In Olimex' am335x-olimex.dtsi:
Code: [Select]
mmc1_pins_default: mmc1_pins_default {
pinctrl-single,pins = <
0x100 ( PIN_INPUT | MUX_MODE0 ) /* (G17) mmc0_clk.mmc0_clk */
0x104 ( PIN_INPUT | MUX_MODE0 ) /* (G18) mmc0_cmd.mmc0_cmd */
0xfc ( PIN_INPUT | MUX_MODE0 ) /* (G16) mmc0_dat0.mmc0_dat0 */
0xf8 ( PIN_INPUT | MUX_MODE0 ) /* (G15) mmc0_dat1.mmc0_dat1 */
0xf4 ( PIN_INPUT | MUX_MODE0 ) /* (F18) mmc0_dat2.mmc0_dat2 */
0xf0 ( PIN_INPUT_PULLUP | MUX_MODE0 ) /* (F17) mmc0_dat3.mmc0_dat3 */
0x160 ( PIN_INPUT | MUX_MODE7 ) /* (C15) spi0_cs1.mmc0_sdcd */
>;
};

Versus am335x-som-common.dtsi in the beaglebone kernel sources:
Code: [Select]
mmc1_pins_default: pinmux_mmc1_pins {
pinctrl-single,pins = <
0x0F0 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat3.mmc0_dat3 */
0x0F4 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat2.mmc0_dat2 */
0x0F8 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat1.mmc0_dat1 */
0x0FC (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_dat0.mmc0_dat0 */
0x100 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_clk.mmc0_clk */
0x104 (PIN_INPUT_PULLUP | MUX_MODE0) /* mmc0_cmd.mmc0_cmd */
0x1A0 (PIN_INPUT_PULLUP | MUX_MODE7) /* mcasp0_aclkr.gpio3_18 <--- THIS ONE */
0x160 (PIN_INPUT | MUX_MODE7) /* spi0_cs1.gpio0_6 */
>;
};

The tps65217 error I'm guessing is because I'm not using that component for power management.  I will see if I can simply delete that node from my device tree.

Finally, I'm not sure what to do about the "musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -517" error - that may have to do with some extra USB drivers which should not be enabled, I am not sure.

vinifr

  • Sr. Member
  • ****
  • Posts: 262
  • Karma: +9/-0
Re: Support for Olimex AM3352-SOM in beaglebone kernel
« Reply #24 on: April 13, 2017, 01:50:09 PM »
Hi,

Sorry, I don't have investigated these problems carefully yet.

laser_dude

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Support for Olimex AM3352-SOM in beaglebone kernel
« Reply #25 on: October 21, 2017, 08:49:48 PM »
Hello. Has anyone had this working with the display? I was able to successfully get the beaglebone 4.4 kernel running, and I'm able to SSH into my Olimex board. However, there is no display (neither VGA nor LCD). Is there something I missed? Thanks.
Всичко хубаво на всички