linux 4.9.49: pwm led issue

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

ganesha.ld
Posts: 37
Joined: Mon Dec 19, 2011 7:01 pm

linux 4.9.49: pwm led issue

Fri Feb 09, 2018 1:45 pm

Hi,
Im using SAMA5D28 based custom board.. using linux 4.9.49

We are trying to bring up pwm led interface in linux.
Here are the definitions in the dts file:
pwm0: pwm@f802c000 {
compatible = "atmel,sama5d2-pwm";
reg = <0xf802c000 0x4000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pwm0_default>;
interrupts = <38 IRQ_TYPE_LEVEL_HIGH 7>;
clocks = <&pwm_clk>;
#pwm-cells = <3>;
status = "okay";
};

pwm0 {
pinctrl_pwm0_default: pwm0_default {
pinmux = <PIN_PB8__PWML3>;
};
};

pwmleds {
compatible = "pwm-leds";
pwmled0 {
label = "sema7:blue:front-left";
max-brightness = <255>;
pwms = <&pwm0 3 16666560 0>;
active-low;
linux,default-trigger = "default-on";
};
}; /* pwmleds */

I'm getting the following error in the linux bootup sequence:
leds_pwm pwmleds: unable to request PWM for sema7:blue:front-left: -517

Here is the full linux bootup messages log:
=> boot

NAND read: device 0 offset 0x200000, size 0x100000
1048576 bytes read: OK

NAND read: device 0 offset 0x700000, size 0x400000
4194304 bytes read: OK
## Flattened Device Tree blob at 21000000
Booting using the fdt blob at 0x21000000
Loading Device Tree to 2fb47000, end 2fb4fbd8 ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.9.49-yocto-standard (oe-user@oe-host) (gcc version 7.2.0 (GCC) ) #1 Fri Feb 2 15:29:58 IST 2018
CPU: ARMv7 Processor [410fc051] revision 1 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt:Machine model: SemaConnect 7-series
cma: Reserved 64 MiB at 0x28000000
Memory policy: Data cache writeback
CPU: All CPU(s) started in SVC mode.
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 64960
Kernel command line: console=ttyS0,115200 mtdparts=atmel_nand:256K(bootstrap),768K(uboot),512K(env),512K(env_redundant),5M(dtb),5M(kernel),-(rootfs) root=/dev/mtdblock6 rw rootfstype=jffs2
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 184212K/262144K available (6144K kernel code, 182K rwdata, 884K rodata, 1024K init, 183K bss, 12396K reserved, 65536K cma-reserved)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xd0800000 - 0xff800000 ( 752 MB)
lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc0700000 (7136 kB)
.init : 0xc0900000 - 0xc0a00000 (1024 kB)
.data : 0xc0a00000 - 0xc0a2dab8 ( 183 kB)
.bss : 0xc0a2dab8 - 0xc0a5b978 ( 184 kB)
NR_IRQS:16 nr_irqs:16 16
L2C-310 ID prefetch enabled, offset 2 lines
L2C-310 dynamic clock gating enabled, standby mode enabled
L2C-310 cache controller enabled, 8 ways, 128 kB
L2C-310: CACHE_ID 0x410000c9, AUX_CTRL 0x36020000
clocksource: pit: mask: 0x7ffffff max_cycles: 0x7ffffff, max_idle_ns: 11513617062 ns
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836475000000ns
Console: colour dummy device 80x30
Calibrating delay loop... 329.31 BogoMIPS (lpj=1646592)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x20100000 - 0x20100058
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 2 part 30 variant 5 rev 1
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 256 (order: -1, 3072 bytes)
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor menu
AT91: Detected SoC family: sama5d2
AT91: Detected SoC: sama5d28, revision 2
clocksource: tcb_clksrc: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 184217874325 ns
at_xdmac f0010000.dma-controller: 16 channels, mapped at 0xd081a000
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
at91_i2c f8028000.i2c: using dma0chan0 (tx) and dma0chan1 (rx) for DMA transfers
at91_i2c f8028000.i2c: AT91 i2c bus driver (hw version: 0x704).
Advanced Linux Sound Architecture Driver Initialized.
clocksource: Switched to clocksource tcb_clksrc
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
workingset: timestamp_bits=14 max_order=16 bucket_order=2
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
io scheduler noop registered (default)
pinctrl-at91-pio4 fc038000.pinctrl: atmel pinctrl initialized
f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 33, base_baud = 5187500) is a ATMEL_SERIAL
f8020000.serial: ttyS0 at MMIO 0xf8020000 (irq = 34, base_baud = 5187500) is a ATMEL_SERIAL
console [ttyS0] enabled
f8024000.serial: ttyS2 at MMIO 0xf8024000 (irq = 35, base_baud = 5187500) is a ATMEL_SERIAL
fc008000.serial: ttyS3 at MMIO 0xfc008000 (irq = 38, base_baud = 5187500) is a ATMEL_SERIAL
fc00c000.serial: ttyS4 at MMIO 0xfc00c000 (irq = 39, base_baud = 5187500) is a ATMEL_SERIAL
brd: module loaded
loop: module loaded
atmel_nand_nfc c0000000.nfc: NFC is probed.
atmel_nand 80000000.nand: Using dma0chan2 for DMA transfers.
nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x38
nand: Micron MT29F8G08ABABAWP
nand: 1024 MiB, SLC, erase size: 512 KiB, page size: 4096, OOB size: 224
atmel_nand 80000000.nand: Use On Flash BBT
atmel_nand 80000000.nand: minimum ECC: 4 bits in 512 bytes
atmel_nand 80000000.nand: Initialize PMECC params, cap: 4, sector: 512
atmel_nand 80000000.nand: Using NFC Sram read and write
Bad block table found at page 262016, version 0x01
Bad block table found at page 261888, version 0x01
7 cmdlinepart partitions found on MTD device atmel_nand
Creating 7 MTD partitions on "atmel_nand":
0x000000000000-0x000000040000 : "bootstrap"
mtd: partition "bootstrap" doesn't end on an erase block -- force read-only
0x000000040000-0x000000100000 : "uboot"
mtd: partition "uboot" doesn't start on an erase block boundary -- force read-only
0x000000100000-0x000000180000 : "env"
0x000000180000-0x000000200000 : "env_redundant"
0x000000200000-0x000000700000 : "dtb"
0x000000700000-0x000000c00000 : "kernel"
0x000000c00000-0x000040000000 : "rootfs"
atmel_spi f8000000.spi: version: 0x311
atmel_spi f8000000.spi: Using dma0chan3 (tx) and dma0chan4 (rx) for DMA transfers
atmel_spi f8000000.spi: Using FIFO (16 data)
atmel_spi f8000000.spi: Atmel SPI Controller at 0xf8000000 (irq 27)
libphy: Fixed MDIO Bus: probed
libphy: MACB_mii_bus: probed
SMSC LAN8710/LAN8720 f8008000.etherne:01: attached PHY driver [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=f8008000.etherne:01, irq=-1)
macb f8008000.ethernet eth0: Cadence GEM rev 0x00020203 at 0xf8008000 irq 28 (46:fa:7e:45:0a:fb)
PPP generic driver version 2.4.2
usbcore: registered new interface driver rtl8150
usbcore: registered new interface driver r8152
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-atmel: EHCI Atmel driver
atmel-ehci 500000.ehci: EHCI Host Controller
atmel-ehci 500000.ehci: new USB bus registered, assigned bus number 1
atmel-ehci 500000.ehci: irq 19, io mem 0x00500000
atmel-ehci 500000.ehci: USB 2.0 started, EHCI 1.00
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: EHCI Host Controller
usb usb1: Manufacturer: Linux 4.9.49-yocto-standard ehci_hcd
usb usb1: SerialNumber: 500000.ehci
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-atmel: OHCI Atmel driver
at91_ohci 400000.ohci: USB Host Controller
at91_ohci 400000.ohci: new USB bus registered, assigned bus number 2
at91_ohci 400000.ohci: irq 19, io mem 0x00400000
usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: USB Host Controller
usb usb2: Manufacturer: Linux 4.9.49-yocto-standard ohci_hcd
usb usb2: SerialNumber: at91
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
usbcore: registered new interface driver cdc_acm
cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial support registered for generic
usbcore: registered new interface driver ftdi_sio
usbserial: USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver pl2303
usbserial: USB Serial support registered for pl2303
rtc rtc0: alarm rollover not handled
rtc rtc0: invalid alarm value: 1900-1-1 0:0:0
at91_rtc f80480b0.rtc: rtc core: registered f80480b0.rtc as rtc0
at91_rtc f80480b0.rtc: AT91 Real Time Clock driver.
i2c /dev entries driver
AT91: Starting after wakeup
sama5d4_wdt f8048040.watchdog: initialized (timeout = 16 sec, nowayout = 0)
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
sdhci-at91 b0000000.sdio-host: update clk mul to 39 as gck rate is 480000000 Hz
mmc0: SDHCI controller on b0000000.sdio-host [b0000000.sdio-host] using ADMA
leds_pwm pwmleds: unable to request PWM for sema7:blue:front-left: -517
atmel_aes f002c000.aes: version: 0x500
atmel_aes f002c000.aes: Atmel AES - Using dma0chan5, dma0chan6 for DMA transfers
atmel_sha f0028000.sha: version: 0x510
atmel_sha f0028000.sha: using dma0chan7 for DMA transfers
atmel_sha f0028000.sha: Atmel SHA1/SHA256/SHA224/SHA384/SHA512
atmel_tdes fc044000.tdes: version: 0x703
atmel_tdes fc044000.tdes: using dma0chan8, dma0chan9 for DMA transfers
atmel_tdes fc044000.tdes: Atmel DES/TDES
hidraw: raw HID events driver (C) Jiri Kosina
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
usb 1-2: new high-speed USB device number 2 using atmel-ehci
NET: Registered protocol family 10
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
NET: Registered protocol family 17
leds_pwm pwmleds: unable to request PWM for sema7:blue:front-left: -517
at91_rtc f80480b0.rtc: setting system clock to 2018-02-09 10:20:50 UTC (1518171650)
ALSA device list:
No soundcards found.
random: fast init done
jffs2: Empty flash at 0x0003fffc ends at 0x00040000
usb 1-2: New USB device found, idVendor=0424, idProduct=2514
usb 1-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
hub 1-2:1.0: USB hub found
hub 1-2:1.0: 4 ports detected
leds_pwm pwmleds: unable to request PWM for sema7:blue:front-left: -517
VFS: Mounted root (jffs2 filesystem) on device 31:6.
devtmpfs: mounted
Freeing unused kernel memory: 1024K
INIT: version 2.88 booting
Starting udev
udevd[128]: starting version 3.2.2
udevd[129]: starting eudev-3.2.2
INIT: Entering runlevel: 5
Configuring network interfaces... command failed: No such device (-19)
Starting system message bus: dbus.
Starting Dropbear SSH server: dropbear.
Starting domain name service: named.
starting Busybox Periodic Command Scheduler: crond... done.
crond[288]: crond (busybox 1.24.1) started, log level 8

OK
Starting syslogd/klogd: done
Starting NetworkManager daemon:
Poky (Yocto Project Reference Distro) 2.4 sema7 /dev/ttyS0

sema7 login: root
root@sema7:~#
Could you suggest what would have gone wrong?

Thanks,
-Ganesh
blue_z
Location: USA
Posts: 1661
Joined: Thu Apr 19, 2007 10:15 pm

Re: linux 4.9.49: pwm led issue

Sat Feb 10, 2018 1:18 am

ganesha.ld wrote:We are trying to bring up pwm led interface in linux.
Here are the definitions in the dts file:
This is unreadable; I've mentioned previously to you that you need to use code tags.
This is incomplete information.
What .dtsi files are also part of your DT?
Why are you completely defining the pwm@f802c000 node in the .dts file (i.e. are you not including sama5d2.dtsi)?
Why is the pinctrl assignment in a node named pwm0?


ganesha.ld wrote:I'm getting the following error in the linux bootup sequence:
leds_pwm pwmleds: unable to request PWM for sema7:blue:front-left: -517
An errno 517 is EPROBE_DEFER, which is not meant to be a fatal error.

The Atmel PWM driver seems to silently install itself.
Did you examine /proc/iomem to confirm that the driver claimed its address space?

Regards
ganesha.ld
Posts: 37
Joined: Mon Dec 19, 2011 7:01 pm

Re: linux 4.9.49: pwm led issue

Wed Feb 21, 2018 11:52 am

Hi blue_z,
sorry for my delayed reply.. I was off the work due to some health issues...
blue_z wrote: This is unreadable; I've mentioned previously to you that you need to use code tags.
This is incomplete information.
I apologise, Will add the code snippets in code blocks henceforth.
blue_z wrote:What .dtsi files are also part of your DT?
i have included sama5d2.dtsi
blue_z wrote: Why are you completely defining the pwm@f802c000 node in the .dts file (i.e. are you not including sama5d2.dtsi)?
As I have used linux 4.9.49 from yocto, it did not have pwm@f802c000 node definition in sama5d2.dtsi. So I had to define a full node in my dts file.
blue_z wrote:Why is the pinctrl assignment in a node named pwm0?
I'm not fully aware of nomenclature rules for device tree as such. Please put some light on this.
blue_z wrote: Did you examine /proc/iomem to confirm that the driver claimed its address space?
Yes, pwm driver did not claim any address apace

Code: Select all

root@sema7:~# cat /proc/iomem 
00040000-00057fff : /ahb/nand@80000000
00100000-001fffff : /ahb/nand@80000000/nfc@c0000000
00200000-0021ffff : 200000.sram
00400000-004fffff : /ahb/ohci@00400000
00500000-005fffff : /ahb/ehci@00500000
20000000-2fffffff : System RAM
  20008000-208fffff : Kernel code
  20a00000-20a5b977 : Kernel data
80000000-87ffffff : /ahb/nand@80000000
b0000000-b00002ff : /ahb/sdio-host@b0000000
c0000000-c7ffffff : /ahb/nand@80000000/nfc@c0000000
f0010000-f0010fff : /ahb/apb/dma-controller@f0010000
f0028000-f00280ff : /ahb/apb/sha@f0028000
f002c000-f002c0ff : /ahb/apb/aes@f002c000
f8000000-f80000ff : /ahb/apb/spi@f8000000
f8008000-f8008fff : /ahb/apb/ethernet@f8008000
f800c000-f800c0ff : /ahb/apb/timer@f800c000
f8010000-f80100ff : /ahb/apb/timer@f8010000
f8014000-f801406f : /ahb/nand@80000000/nfc@c0000000
f8014070-f80144ff : /ahb/nand@80000000
f8014500-f80146ff : /ahb/nand@80000000
f801c000-f801c0ff : atmel_serial
f8020000-f80200ff : atmel_serial
f8024000-f80240ff : atmel_serial
f8028000-f80280ff : /ahb/apb/i2c@f8028000
f8048010-f804801f : /ahb/apb/shdwc@f8048010
f8048040-f804804f : /ahb/apb/watchdog@f8048040
fc008000-fc0080ff : atmel_serial
fc00c000-fc00c0ff : atmel_serial
fc01c000-fc01c0ff : /ahb/apb/trng@fc01c000
fc038000-fc0385ff : /ahb/apb/pinctrl@fc038000
fc044000-fc0440ff : /ahb/apb/tdes@fc044000
root@sema7:~# 
And here is the full definition of my custom dts file. Please have a look.

Code: Select all

/dts-v1/;
#include "sama5d2.dtsi"
#include "sama5d2-pinfunc.h"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pwm/pwm.h>

/ {

	model = "SemaConnect 7-series";
	compatible = "semaconnect,sema7", "atmel,sama5d2";

	memory {
		reg = <0x20000000 0x80000>;
	};

	clocks {
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;

		main_clock: clock@0 {
			compatible = "atmel,osc", "fixed-clock";
			clock-frequency = <12000000>;
		};
	};

	clocks {
		slow_xtal {
			clock-frequency = <32768>;
		};

		main_xtal {
			clock-frequency = <12000000>;
		};
	};

	aliases {
		serial0 = &uart1; /* DBGU */
		serial1 = &uart0; 
		serial2 = &uart2;
		serial3 = &uart3;
		serial4 = &uart4;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	ahb {    /* ahb-0 */
		nand0: nand@80000000 {
			nand-bus-width = <8>;
			nand-ecc-mode = "hw";
			atmel,has-pmecc;    /* Enable PMECC */
			atmel,pmecc-cap = <4>;
			atmel,pmecc-sector-size = <512>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_nand0_default>;
			nand-on-flash-bbt;
			status = "okay";
		};

		usb0: gadget@00300000 {
			atmel,vbus-gpio = <&pioA 31 GPIO_ACTIVE_HIGH>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_usba_vbus>;
			status = "okay";
		};

		usb1: ohci@00400000 {
			num-ports = <1>;
			status = "okay";
		};

		usb2: ehci@00500000 {
			status = "okay";
		};

		sdmmc1: sdio-host@b0000000 {
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_sdmmc1_default>;
			status = "okay";
		};

		apb {  /* apb-0 */
			spi0: spi@f8000000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_spi0_default>;
				status = "okay";

				/*m25p80@0 {
					compatible = "atmel,at25df321a";
					reg = <0>;
					spi-max-frequency = <50000000>;
				};*/
			};

			macb0: ethernet@f8008000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_macb0_default &pinctrl_macb0_phy_irq>;
				phy-mode = "rmii";
				status = "okay";
			};


			pwm0: pwm@f802c000 {
				compatible = "atmel,sama5d2-pwm";
				reg = <0xf802c000 0x4000>;
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_pwm0_default>;
				interrupts = <38 IRQ_TYPE_LEVEL_HIGH 7>;
				clocks = <&pwm_clk>;
				#pwm-cells = <3>;
				status = "okay";
			};

			watchdog@f8048040 {
				status = "okay";
			};

			rtc@f80480b0 {
				status = "okay";
			};

			uart0: serial@f801c000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_uart0_default>;
				status = "okay";
			};
			
			uart1: serial@f8020000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_uart1_default>;
				status = "okay";
			};

			uart2: serial@f8024000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_uart2_default>;
				status = "okay";
			};

			uart3: serial@fc008000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_uart3_default>;
				status = "okay";
			};

			uart4: serial@fc00c000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_uart4_default>;
				status = "okay";
			};

			i2c0: i2c@f8028000 {
				status = "okay";
			};

			/* Pinctrl definitions for Sema Gen2 Platform */
			pinctrl@fc038000 {

				pinctrl_charger_chglev: charger_chglev {
					pinmux = <PIN_PD31__GPIO>;
					bias-disable;
				};

				pinctrl_charger_irq: charger_irq {
					pinmux = <PIN_PB13__GPIO>;
					bias-disable;
				};

				pinctrl_i2c0_default: i2c0_default {
					pinmux = <PIN_PD21__TWD0>,
						 <PIN_PD22__TWCK0>;
					bias-disable;
				};

				pinctrl_i2c1_default: i2c1_default {
					pinmux = <PIN_PD4__TWD1>,
						 <PIN_PD5__TWCK1>;
					bias-disable;
				};

				pinctrl_macb0_default: macb0_default {
					pinmux = <PIN_PB14__GTXCK>,
						 <PIN_PB15__GTXEN>,
						 <PIN_PB16__GRXDV>,
						 <PIN_PB17__GRXER>,
						 <PIN_PB18__GRX0>,
						 <PIN_PB19__GRX1>,
						 <PIN_PB20__GTX0>,
						 <PIN_PB21__GTX1>,
						 <PIN_PB22__GMDC>,
						 <PIN_PB23__GMDIO>;
					bias-disable;
				};

				pinctrl_macb0_phy_irq: macb0_phy_irq {
					pinmux = <PIN_PC9__GPIO>;
					bias-disable;
				};

				pinctrl_sdmmc1_default: sdmmc1_default {
					cmd_data {
						pinmux = <PIN_PA28__SDMMC1_CMD>,
							 <PIN_PA18__SDMMC1_DAT0>,
							 <PIN_PA19__SDMMC1_DAT1>,
							 <PIN_PA20__SDMMC1_DAT2>,
							 <PIN_PA21__SDMMC1_DAT3>;
						bias-pull-up;
					};

					conf-ck_cd {
						pinmux = <PIN_PA22__SDMMC1_CK>,
							 <PIN_PA30__SDMMC1_CD>;
						bias-disable;
					};
				};

				pinctrl_spi0_default: spi0_default {
					pinmux = <PIN_PA14__SPI0_SPCK>,
						 <PIN_PA15__SPI0_MOSI>,
						 <PIN_PA16__SPI0_MISO>,
						 <PIN_PA17__SPI0_NPCS0>;
					bias-disable;
				};

				pinctrl_uart0_default: uart0_default {
					pinmux = <PIN_PB26__URXD0>,
						 <PIN_PB27__UTXD0>;
					bias-disable;
				};

				pinctrl_uart1_default: uart1_default { /* DBGU */
					pinmux = <PIN_PD2__URXD1>,
						 <PIN_PD3__UTXD1>;
					bias-disable;
				};

				pinctrl_uart2_default: uart2_default {
					pinmux = <PIN_PD23__URXD2>,
						 <PIN_PD24__UTXD2>;
					bias-disable;
				};

				pinctrl_uart3_default: uart3_default {
					pinmux = <PIN_PB11__URXD3>,
						 <PIN_PB12__UTXD3>;
					bias-disable;
				};

				pinctrl_uart4_default: uart4_default {
					pinmux = <PIN_PB3__URXD4>,
						 <PIN_PB4__UTXD4>;
					bias-disable;
				};

				pinctrl_usba_vbus: usba_vbus {
					pinmux = <PIN_PA31__GPIO>;
					bias-disable;
				};

				pinctrl_nand0_default: nand0_default {
					pinmux = <PIN_PA0__D0>,
						 <PIN_PA1__D1>,
						 <PIN_PA2__D2>,
						 <PIN_PA3__D3>,
						 <PIN_PA4__D4>,
						 <PIN_PA5__D5>,
						 <PIN_PA6__D6>,
						 <PIN_PA7__D7>,
						 <PIN_PA8__NWE_NANDWE>,
						 <PIN_PA9__NCS3>,
						 <PIN_PA10__A21_NANDALE>,
						 <PIN_PA11__A22_NANDCLE>,
						 <PIN_PA12__NRD_NANDOE>,
						 <PIN_PD8__NANDRDY>;
					bias-disable;
				};   /* pinctrl_nand0_default */

				pwm0 {
					pinctrl_pwm0_default: pwm0_default {
						pinmux = <PIN_PB8__PWML3>;
					};
				};

				pinctrl_cellular0_default: cellular0_default {
					pinmux = <PIN_PA23__GPIO>, /* C_ALARM */
						 <PIN_PA24__GPIO>, /* C_RFTXMON */
						 <PIN_PA25__GPIO>, /* C_RFTXCN */
						 <PIN_PA26__GPIO>, /* C_ON_OFF */
						 <PIN_PB29__GPIO>, /* C_PWRMON */
						 <PIN_PC21__GPIO>, /* C_RESET */
						 <PIN_PC24__GPIO>, /* C_RTS */
						 <PIN_PC25__GPIO>, /* C_CTS */
						 <PIN_PC28__GPIO>; /* C_RING */
					bias-disable;
				};

				pinctrl_glcd0_default: glcd0_default {
					pinmux = <PIN_PB31__GPIO>, /* LCD_CS1 */
						 <PIN_PC0__GPIO>,  /* LCD_DB0 */
						 <PIN_PC1__GPIO>,  /* LCD_DB1 */
						 <PIN_PC2__GPIO>,  /* LCD_DB2 */
						 <PIN_PC3__GPIO>,  /* LCD_DB3 */
						 <PIN_PC4__GPIO>,  /* LCD_DB4 */
						 <PIN_PC5__GPIO>,  /* LCD_DB5 */
						 <PIN_PC6__GPIO>,  /* LCD_DB6 */
						 <PIN_PC7__GPIO>,  /* LCD_DB7 */
						 <PIN_PC10__GPIO>, /* LCD_HTR heater */
						 <PIN_PC22__GPIO>, /* LCD_CS2 */
						 <PIN_PC23__GPIO>, /* LCD_BL */
						 <PIN_PC26__GPIO>, /* LCD_RS */
						 <PIN_PC29__GPIO>, /* LCD_RW */
						 <PIN_PC30__GPIO>, /* LCD_RES/LCD_RESET */
						 <PIN_PC31__GPIO>; /* LCD_E */
					bias-disable;
				};   /* pinctrl_glcd0_default */

				pinctrl_evseboard0_default: evseboard0_default {
					pinmux = <PIN_PB1__GPIO>,  /* PM_SCK */
						 <PIN_PC11__GPIO>, /* PM_ALERT */
						 <PIN_PC17__GPIO>, /* PM_AC_PWR_OK */
						 <PIN_PC18__GPIO>, /* PM_RESET_AVR */
						 <PIN_PD0__GPIO>,  /* PM_PDI */
						 <PIN_PD1__GPIO>;  /* PM_PDO */
					bias-disable;
				};

				pinctrl_dcdc0_pgood_default: dcdc0_pgood_default {
					pinmux = <PIN_PB28__GPIO>; /* PGOOD */
					bias-disable;	
				};

				pinctrl_dcdc0_3_8v_en_default: dcdc0_3_8v_en_default {
					pinmux = <PIN_PC27__GPIO>; /* 3.8V_EN */
					bias-disable;	
				};
			};  /* pinctrl@fc038000 */

			cellular: pinctrl@fc038000 {
				compatible = "atmel,sama5d2-pinctrl", "simple-bus";
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_cellular0_default>;
				status = "okay";
			};

			evseboard: pinctrl@fc038000 {
				compatible = "atmel,sama5d2-pinctrl", "simple-bus";
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_evseboard0_default>;
				status = "okay";
			};

			lcd: pinctrl@fc038000 {
				compatible = "atmel,sama5d2-pinctrl", "simple-bus";
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_glcd0_default>;
				status = "okay";
			};
		}; /* apb-0 */

	}; /* ahb-0 */

	pwmleds {
		compatible = "pwm-leds";
		pwmled0 {
			label = "sema7:blue:front-left";
			max-brightness = <255>;
			pwms = <&pwm0 3 16666560 0>;
			active-low;
			linux,default-trigger = "default-on";
		};
	}; /* pwmleds */


	gpioleds {
		compatible = "gpio-leds";

		gpioled0 {
			label = "sema7:red:front-right";
			gpios = <&pioA 41 GPIO_ACTIVE_LOW>;   /* PB9 */
			default-state = "on";
		};
		gpioled1 {
			label = "sema7:red:front-left";
			gpios = <&pioA 42  GPIO_ACTIVE_LOW>; /* PB10 */
			default-state = "on";
		};
	}; /* gpioleds */

};
Thanks,
blue_z
Location: USA
Posts: 1661
Joined: Thu Apr 19, 2007 10:15 pm

Re: linux 4.9.49: pwm led issue

Thu Feb 22, 2018 12:32 am

ganesha.ld wrote:As I have used linux 4.9.49 from yocto, it did not have pwm@f802c000 node definition in sama5d2.dtsi. So I had to define a full node in my dts file.
That doesn't make sense.
Yocto is just a build script/program. It doesn't have its own version of Linux kernel source.
Inspect your project, and determine where you're getting the kernel source.

ganesha.ld wrote:
blue_z wrote:Why is the pinctrl assignment in a node named pwm0?
I'm not fully aware of nomenclature rules for device tree as such. Please put some light on this.
You can download a pdf of the specification from www.devicetree.org

Now that you've posted the actual (and readable) DT source, this node looks even more suspicious.

Code: Select all

			pinctrl@fc038000 {
				...
				pwm0 {
					...
				};
I suggest you delete this encapsulation, and promote the inner node (which then resembles other pinctrl nodes):

Code: Select all

			pinctrl@fc038000 {
				...
				pinctrl_pwm0_default: pwm0_default {
						pinmux = <PIN_PB8__PWML3>;
				};


ganesha.ld wrote:Yes, pwm driver did not claim any address apace
That's an indication that the pwm-atmel driver failed to install.
You can confirm that by booting with a kernel command line (e.g. the bootargs environment variable in U-Boot) augmented with "initcall_debug" and "ignore_loglevel" parameters. This should indicate whether the init (and probe) of the pwm-atmel driver was executed or not, and reveal any return code.
If you can't make any sense of the error code returned by the pwm-atmel driver, then you will have to hack the driver and make every return from atmel_pwm_probe() verbose with a dev_err() output.

Regards
ganesha.ld
Posts: 37
Joined: Mon Dec 19, 2011 7:01 pm

Re: linux 4.9.49: pwm led issue

Tue Mar 20, 2018 11:37 am

Hi blue_z,

I finally was able to get the pwm issue solved and "pwmled" driver up.
The issue was the compatibility string for pwm driver. For kernel 4.9.49 only "compatible = "atmel,sama5d3-pwm"; was allowed.
"sama5d2-pwm" compatibility was added in later versions of 4.9.
blue_z wrote: Now that you've posted the actual (and readable) DT source, this node looks even more suspicious.

Code: Select all

pinctrl@fc038000 {
...
pwm0 {
...
};

I suggest you delete this encapsulation, and promote the inner node (which then resembles other pinctrl nodes):

Code: Select all

pinctrl@fc038000 {
...
pinctrl_pwm0_default: pwm0_default {
pinmux = <PIN_PB8__PWML3>;
};
I also deleted the inner encapsulation. made it logically structured.

Thanks!!

Return to “LINUX”

Who is online

Users browsing this forum: Google [Bot] and 1 guest