Issue with SAMA5D2 and SDHC / UHS-I on SDMMC0

Discussion around products based on ARM Cortex-A5 core.

Moderator: nferre

belkosso
Posts: 1
Joined: Wed Mar 07, 2018 10:58 am

Issue with SAMA5D2 and SDHC / UHS-I on SDMMC0

Wed Mar 07, 2018 12:24 pm

Hello !

I'm using a custom board equipped with a RoadRunner from Acmesystems (based on a SAMA5D27 SoC) with 256 MB of RAM and 16 MB of QSPI memory. I have an issue with the SD Memory : I'm unable to use a HC / UHS-I SD memory card, where a classic SD works. There is the state of the art :

My at91bootstrap (with boot directly linux option), my kernel (v. 4.9.81) and my DTB are on the QSPI memory. The configuration is : at91bootstrap loads the kernel and the DTB in memory and launch this command line :

Code: Select all

mem=256M console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rw consoleblank=0 rootwait
I have 5 different µSD, only one works and boots correctly
  • ATP - SD 2GB
  • SanDisk industrial - SDHC UHS-I 8 GB
  • SanDisk ultra - SDHC UHS-I 8 GB
  • Swissbit - SDHC UHS-I 4 GB
  • Kingston- SDHC UHS-I 8 GB
For the others µSD, I have an error, and the kernel stuck on this

Code: Select all

Waiting for root device /dev/mmcblk0p2...
mmc0: error -110 whilst initialising SD card
So, there is two differences between the working µSD and the others :
  • They are SDHC
  • They are UHS-I
But, when I boot on the UBoot and I use the mmc info command, it prints for one µSD which won't boot (for example) :

Code: Select all

Device: sdio-host@a0000000
Manufacturer ID: 3
OEM: 5344
Name: SL08G
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 7.4 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
So finaly, I'm pretty sure the HW works together but I do something (I hope) wrong on the device tree. There is the device tree used for my custom board

Code: Select all

/*
 * acme-roadrunner.dts - Device Tree file for SAMA5D27 Roadrunner board
 *
 *  Copyright (C) 2015 Atmel,
 *                2015 Nicolas Ferre <nicolas.ferre@atmel.com>
 *                2017 Sergio Tanzilli <tanzilli@acmesystems.it>
 *
 * This file is dual-licensed: you can use it either under the terms
 * of the GPL or the X11 license, at your option. Note that this dual
 * licensing only applies to this file, and not this project as a
 * whole.
 *
 *  a) This file is free software; you can redistribute it and/or
 *     modify it under the terms of the GNU General Public License as
 *     published by the Free Software Foundation; either version 2 of the
 *     License, or (at your option) any later version.
 *
 *     This file is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 * Or, alternatively,
 *
 *  b) Permission is hereby granted, free of charge, to any person
 *     obtaining a copy of this software and associated documentation
 *     files (the "Software"), to deal in the Software without
 *     restriction, including without limitation the rights to use,
 *     copy, modify, merge, publish, distribute, sublicense, and/or
 *     sell copies of the Software, and to permit persons to whom the
 *     Software is furnished to do so, subject to the following
 *     conditions:
 *
 *     The above copyright notice and this permission notice shall be
 *     included in all copies or substantial portions of the Software.
 *
 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 *     OTHER DEALINGS IN THE SOFTWARE.
 */
/dts-v1/;
#include "sama5d2.dtsi"
#include "sama5d2-pinfunc.h"
#include <dt-bindings/mfd/atmel-flexcom.h>
#include <dt-bindings/gpio/gpio.h>

/ {
	model = "Atmel SAMA5D2 Xplained";
	compatible = "atmel,sama5d2-xplained", "atmel,sama5d2", "atmel,sama5";

	chosen {
		stdout-path = "serial0:115200n8";
		bootargs = "mem=256M console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait consoleblank=0";
	};

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

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

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

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

		usb1: ohci@00400000 {
			num-ports = <3>;
			atmel,vbus-gpio = <0 //&pioA 41 GPIO_ACTIVE_HIGH
					   &pioA 42 GPIO_ACTIVE_HIGH
					   0
					  >;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_usb_default>;
			status = "disabled";
		};

		usb2: ehci@00500000 {
			status = "disabled";
		};
		*/

		sdmmc0: sdio-host@a0000000 {
			compatible = "atmel,sama5d2-sdhci";
			bus-width = <4>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_sdmmc0_default>;
			//non-removable;
			//mmc-ddr-3_3v;
			
			
			max-frequency = <208000000>;
			//disable-wp;
			cap-sd-highspeed;
			sd-uhs-sdr12;
			sd-uhs-sdr25;
			sd-uhs-sdr50;
			sd-uhs-sdr104;
			sd-uhs-ddr50;
			
			status = "okay";
		};
		

		apb {
			/*				
			spi0: spi@f8000000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_spi0_default>;
				status = "disabled";
			};
			*/
			
			macb0: ethernet@f8008000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_macb0_default &pinctrl_macb0_phy_irq>;
				phy-mode = "rmii";
				status = "okay";

				ethernet-phy@1 {
					reg = <0x1>;
					interrupt-parent = <&pioA>;
					interrupts = <73 IRQ_TYPE_LEVEL_LOW>;
				};
			};

			/*
			pdmic@f8018000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_pdmic_default>;
				atmel,model = "PDMIC @ sama5d2_xplained";
				atmel,mic-min-freq = <1000000>;
				atmel,mic-max-freq = <3246000>;
				atmel,mic-offset = <0x0>;
				status = "disabled";
			};
			*/

			/* Debug port */

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

			//
			// I2C utilisé pour les LEDs
			//	GPIO Extender
			//
			
			i2c1: i2c@fc028000 {
				dmas = <0>, <0>;
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_i2c1_default>;
				status = "okay";

				/*at24@54 {
					compatible = "atmel,24c02";
					reg = <0x54>;
					pagesize = <16>;
				};*/

				lp5562@30 {
					compatible = "ti,lp5562";
					reg = <0x30>;
					clock-mode = /bits/ 8 <2>;

					chan0 {
						chan-name = "R";
						led-cur = /bits/ 8 <0x20>;
						max-cur = /bits/ 8 <0x60>;
					};
			
					chan1 {
						chan-name = "G";
						led-cur = /bits/ 8 <0x20>;
						max-cur = /bits/ 8 <0x60>;
					};

					chan2 {
						chan-name = "B";
						led-cur = /bits/ 8 <0x20>;
						max-cur = /bits/ 8 <0x60>;
					};

					chan3 {
						chan-name = "W";
						led-cur = /bits/ 8 <0x20>;
						max-cur = /bits/ 8 <0x60>;
					};
				};
			};

			/*
			flx0: flexcom@f8034000 {
				atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
				status = "disabled"; // conflict with ISC_D2 & ISC_D3 data pins

				uart5: 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_flx0_default>;
					atmel,fifo-size = <32>;
					status = "disabled";
				};
			};
			*/

			
			shdwc@f8048010 {
				atmel,shdwc-debouncer = <976>;

				input@0 {
					reg = <0>;
					atmel,wakeup-type = "low";
				};
			};

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

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

			/*
			flx4: flexcom@fc018000 {
				atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
				status = "disabled";

				i2c2: i2c@600 {
					compatible = "atmel,sama5d2-i2c";
					reg = <0x600 0x200>;
					interrupts = <23 IRQ_TYPE_LEVEL_HIGH 7>;
					dmas = <0>, <0>;
					dma-names = "tx", "rx";
					#address-cells = <1>;
					#size-cells = <0>;
					clocks = <&flx4_clk>;
					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_flx4_default>;
					atmel,fifo-size = <16>;
					status = "disabled";
				};
			};
			*/

			
			adc: adc@fc030000 {
				//vddana-supply = <&vdd_3v3_lp_reg>;
				//vref-supply = <&vdd_3v3_lp_reg>;
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_adc_default>;
				status = "okay";
			};
			

			pinctrl@fc038000 {
			
				/* Touch screen controller interript line */
				
				pinctrl_ft_irq: ft_irq {
					pinmux = <PIN_PB7__GPIO>;
					bias-pull-up;
					input-debounce = <1>;
				};

				/*
				 * There is no real pinmux for ADC, if the pin
				 * is not requested by another peripheral then
				 * the muxing is done when channel is enabled.
				 * Requesting pins for ADC is GPIO is
				 * encouraged to prevent conflicts and to
				 * disable bias in order to be in the same
				 * state when the pin is not muxed to the adc.
				 */
				pinctrl_adc_default: adc_default {
					pinmux = <PIN_PD24__GPIO>,
							<PIN_PD25__GPIO>,
							<PIN_PD26__GPIO>,
							<PIN_PD27__GPIO>;
					bias-disable;
				};

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

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

				/*
				pinctrl_charger_lbo: charger_lbo {
					pinmux = <PIN_PC8__GPIO>;
					bias-pull-up;
				};
				*/

				/*
				pinctrl_flx0_default: flx0_default {
					pinmux = <PIN_PB28__FLEXCOM0_IO0>,
						 <PIN_PB29__FLEXCOM0_IO1>;
					bias-disable;
				};
				*/

				/*
				pinctrl_flx4_default: flx4_default {
					pinmux = <PIN_PD12__FLEXCOM4_IO0>,
						 <PIN_PD13__FLEXCOM4_IO1>;
					bias-disable;
				};
				*/
			
				pinctrl_i2c1_default: i2c1_default {
					pinmux = <PIN_PD4__TWD1>,
						 <PIN_PD5__TWCK1>;
					bias-pull-up;
				};

				pinctrl_key_gpio_default: key_gpio_default {
					pinmux = <PIN_PB9__GPIO>;
					bias-pull-up;
				};

				pinctrl_led_gpio_default: led_gpio_default {
					pinmux = <PIN_PB0__GPIO>,
						 <PIN_PB5__GPIO>,
						 <PIN_PB6__GPIO>;
					bias-pull-up;
				};

				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_pdmic_default: pdmic_default {
					pinmux = <PIN_PB26__PDMIC_DAT>,
						<PIN_PB27__PDMIC_CLK>;
					bias-disable;
				};
				*/

				pinctrl_sdmmc0_default: sdmmc0_default {
					cmd_data {
						pinmux = <PIN_PA1__SDMMC0_CMD>,
							 <PIN_PA2__SDMMC0_DAT0>,
							 <PIN_PA3__SDMMC0_DAT1>,
							 <PIN_PA4__SDMMC0_DAT2>,
							 <PIN_PA5__SDMMC0_DAT3>;
						bias-pull-up;
					};

					conf-ck {
						pinmux = <PIN_PA0__SDMMC0_CK>;
						bias-disable;
					};
					
					conf-cd {
						pinmux =<PIN_PA13__SDMMC0_CD>;
						bias-pull-up;
					};
				};

				/*
				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_uart1_default: uart1_default {
					pinmux = <PIN_PD2__URXD1>,
						 <PIN_PD3__UTXD1>;
					bias-disable;
				};

				pinctrl_uart3_default: uart3_default {
					pinmux = <PIN_PB11__URXD3>,
						 <PIN_PB12__UTXD3>;
					bias-disable;
				};
				
				/*
				pinctrl_usb_default: usb_default {
					pinmux = <PIN_PB10__GPIO>;
					bias-disable;
				};
		
				
				pinctrl_usba_vbus: usba_vbus {
					pinmux = <PIN_PA31__GPIO>;
					bias-disable;
				};
				*/				
			};
		};
	};
};
Do you have any idea why the SDHC / UHS-I SD Cards won't work with my board ? Do I miss something one device tree ? I've been working on this for at least a week without any significant result. Any help would be much appreciated.
blue_z
Location: USA
Posts: 1690
Joined: Thu Apr 19, 2007 10:15 pm

Re: Issue with SAMA5D2 and SDHC / UHS-I on SDMMC0

Thu Mar 08, 2018 2:07 am

belkosso wrote:I have an issue with the SD Memory ...
That's an ambiguous statement.
The proper name is "SD memory card" or "SD card".
The SD Card Association (aka SD Association) never refers to its devices as "SD memory", and neither should you.

belkosso wrote:There is the state of the art :
You're misusing this phrase, so your attempt at cute writing seems lame.

belkosso wrote:But, when I boot on the UBoot and I use the mmc info command, it prints for one µSD which won't boot (for example) : ...
From what device are you booting U-Boot?
belkosso wrote:So finaly, I'm pretty sure the HW works together but I do something (I hope) wrong on the device tree.
You have presented no evidence that your HW is 100% functional.
That U-Boot output does not validate the HW, because that SDcard response is received over the CMD line rather than the data lines, and only uses SD Mode clock frequency.
So your trivial "test" does not require any UHS operational modes involving the parallel data lines.
The proper test that you should do is actually try reading files from the SDcards using U-Boot (assuming that U-Boot is configured/built with ext4 commands, i.e. CONFIG_CMD_EXT4).

belkosso wrote:There is the device tree used for my custom board ...
You fail to mention a salient detail that, unlike any published board design, your board has the uSDcard slot on the first SDMMC.
You also fail to provide any description of the QSPI chip.
Without a board schematic the accuracy of your DT is unknown.


Regards

Return to “SAMA5D Cortex-A5 MPU”

Who is online

Users browsing this forum: No registered users and 2 guests