SAMA5D27 FLEXCOM USART initialization problem

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

Moderator: nferre

gselabs
Posts: 17
Joined: Sun Feb 17, 2019 7:04 pm

SAMA5D27 FLEXCOM USART initialization problem

Wed Jul 10, 2019 7:39 pm

I use custom board based on SAMA5D27C-D1G. Now I am creating Device Tree. I faced with problem with initialization of a USART under FLEXCOM. My dts file contains the following:

Code: Select all

			flx0: flexcom@f8034000 {
				atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
				status = "okay";

				uart0f: serial@200 {
				    compatible = "atmel,at91sam9260-usart";
				    reg = <0x200 0x200>;
					interrupts = <19 IRQ_TYPE_LEVEL_HIGH 7>;
					clocks = <&flx0_clk>;
					clock-names = "usart";
					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_iso7816_disable &pinctrl_iso7816_default &pinctrl_iso7816_sam_slct &pinctrl_iso7816_sam1_nrst &pinctrl_iso7816_scr_sam2_nrst>;
					atmel,fifo-size = <32>;
					status = "okay";
				};
			};
			
			flx3: flexcom@fc014000 {
				atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
				status = "okay";

				uart3f: serial@200 {
					compatible = "atmel,at91sam9260-usart";
					reg = <0x200 0x200>;
					interrupts = <22 IRQ_TYPE_LEVEL_HIGH 7>;
					clocks = <&flx3_clk>;
					clock-names = "usart";
					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_flx3_default>;
					atmel,fifo-size = <32>;
					status = "okay";
				};
			};
Under the pin controller node I have the following fragment:

Code: Select all

	
				pinctrl_flx3_default: flx3_default {
					pinmux = <PIN_PB22__FLEXCOM3_IO1>,
						 <PIN_PB23__FLEXCOM3_IO0>,
						 <PIN_PB24__FLEXCOM3_IO3>,
						 <PIN_PB25__FLEXCOM3_IO4>;
					bias-disable;
				};
				
uart0f initialized without any problems, but I can't get uart3f initialized. I got the following error:

Code: Select all

[    0.650000] pinctrl-at91-pio4 fc038000.pinctrl: pin PB22 already requested by fc014200.serial; cannot claim for atmel_usart_serial.2.auto                                        
[    0.660000] pinctrl-at91-pio4 fc038000.pinctrl: pin-54 (atmel_usart_serial.2.auto) status -22                                                                                    
[    0.670000] at91_usart_mode atmel_usart_serial.2.auto: Error applying setting, reverse things back                                                                               
[    0.680000] at91_usart_mode: probe of atmel_usart_serial.2.auto failed with error -22
When I checking pinmux-pins pins, I get the following:

Code: Select all

pin 54 (PB22): fc014200.serial (GPIO UNCLAIMED) function E group PB22                                                                                                               
pin 55 (PB23): fc014200.serial (GPIO UNCLAIMED) function E group PB23                                                                                                               
pin 56 (PB24): fc014200.serial (GPIO UNCLAIMED) function E group PB24                                                                                                               
pin 57 (PB25): fc014200.serial (GPIO UNCLAIMED) function E group PB25
So, I am confused where the problem is?
gselabs
Posts: 17
Joined: Sun Feb 17, 2019 7:04 pm

Re: SAMA5D27 FLEXCOM USART initialization problem

Thu Jul 11, 2019 12:54 pm

When I move

Code: Select all

					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_flx3_default>;
under

Code: Select all

			flx3: flexcom@fc014000 {
				atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_flx3_default>;
				status = "okay";

				uart3f: serial@200 {
					compatible = "atmel,at91sam9260-usart";
					reg = <0x200 0x200>;
					interrupts = <22 IRQ_TYPE_LEVEL_HIGH 7>;
					clocks = <&flx3_clk>;
					clock-names = "usart";
					atmel,fifo-size = <32>;
					status = "okay";
				};
			};
I get kernel oops on boot.
gselabs
Posts: 17
Joined: Sun Feb 17, 2019 7:04 pm

Re: SAMA5D27 FLEXCOM USART initialization problem

Thu Jul 11, 2019 2:17 pm

It's pretty strange, but the problem was solved by commenting the alias out:

Code: Select all

	aliases {
		serial0 = &uart2;	/* MCU UART - DBG UART*/
		serial6 = &uart0f;  /* smart card */
		// serial9 = &uart3f;  /* Modem */
	};
I wonder why this is relevant?
blue_z
Location: USA
Posts: 1927
Joined: Thu Apr 19, 2007 10:15 pm

Re: SAMA5D27 FLEXCOM USART initialization problem

Fri Jul 12, 2019 2:18 am

gselabs wrote: Now I am creating Device Tree. I faced with problem with initialization of a USART under FLEXCOM. My dts file contains the following: ...
You neglect to mention a kernel version.
There's no context for these excerpts.

gselabs wrote: I got the following error: ...
You choose to provide only tidbits of information to solve your problem.
Looks like there's more than one device driver trying to claim these pins.

gselabs wrote: When I checking pinmux-pins pins, I get the following: ...
This does not seem indicate anything unusual.
Those pins have been multiplexed to the E function as you require.
The "GPIO UNCLAIMED" is not a problem.

Regards
gselabs
Posts: 17
Joined: Sun Feb 17, 2019 7:04 pm

Re: SAMA5D27 FLEXCOM USART initialization problem

Fri Jul 12, 2019 12:11 pm

I use linux-4.19-at91.
I know that it seems that somthing trying to use this pins, but there is nothing. Actually, if you check the following output:

Code: Select all

[    0.650000] pinctrl-at91-pio4 fc038000.pinctrl: pin PB22 already requested by fc014200.serial; cannot claim for atmel_usart_serial.2.auto 
you can find that the fc014200.serial is the flx0: flexcom@f8034000. So how can it be? I am confused. I solve the problem by commenting only one string:

Code: Select all

// serial9 = &uart3f;
Why is this works?

Return to “LINUX”

Who is online

Users browsing this forum: No registered users and 2 guests