Set SDMMC1 clock rate

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

Moderator: nferre

JulienTourteau
Posts: 2
Joined: Wed Jan 08, 2020 5:36 pm

Set SDMMC1 clock rate

Fri Jun 19, 2020 3:06 pm

Hi,

I would like to understand why eMMC clock and actual clock fields differ for both my eMMCs.

Code: Select all

# cat /sys/kernel/debug/mmc0/clock 
52000000
# cat /sys/kernel/debug/mmc0/ios 
clock:          52000000 Hz
actual clock:   48000000 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      3 (8 bits)
timing spec:    1 (mmc high-speed)
signal voltage: 0 (3.30 V)
driver type:    0 (driver type B)
# cat /sys/kernel/debug/mmc1/clock 
50000000
# cat /sys/kernel/debug/mmc1/ios  
clock:          50000000 Hz
actual clock:   48000000 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      2 (4 bits)
timing spec:    1 (mmc high-speed)
signal voltage: 0 (3.30 V)
driver type:    0 (driver type B)
I'm running a Buildroot Linux 4.9.87 on a custom board based on an Atmel SAMA5D27 and both eMMCs are MTFC16GJDDQ-4M IT ones (https://4donline.ihs.com/images/VipMast ... 353EA87419).

Here are the eMMCs' device-tree blocks.

Code: Select all

sdmmc0: sdio-host@a0000000 {
	bus-width = <8>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_sdmmc0_default>;
	non-removable;
	mmc-ddr-3_3v;
	status = "okay";
};

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

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>,
				 <PIN_PA6__SDMMC0_DAT4>,
				 <PIN_PA7__SDMMC0_DAT5>,
				 <PIN_PA8__SDMMC0_DAT6>,
				 <PIN_PA9__SDMMC0_DAT7>;
		bias-disable;
	};
	ck_rstn {
		pinmux = <PIN_PA0__SDMMC0_CK>,
				 <PIN_PA10__SDMMC0_RSTN>;
		bias-disable;
	};
	cd {
		pinmux = <PIN_PA13__SDMMC0_CD>;
		bias-pull-down;
	};
};

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;
	};
	ck {
		pinmux = <PIN_PA22__SDMMC1_CK>;
		bias-disable;
	};
	rst {
		pinmux = <PIN_PA27__SDMMC1_RSTN>;
		bias-disable;
	};
	cd {
		pinmux = <PIN_PA30__SDMMC1_CD>;
		bias-pull-down;
	};
};
According to datasheet, the maximum bus clock frequency is 50MHz (0x32 into CSD.TRAN_SPEED).
However, from debugfs information, SDMMC0 is operating at 52MHz and SDMMC1 at 48MHz.
blue_z
Location: USA
Posts: 2094
Joined: Thu Apr 19, 2007 10:15 pm

Re: Set SDMMC1 clock rate

Mon Jun 22, 2020 8:37 pm

JulienTourteau wrote: I would like to understand why eMMC clock and actual clock fields differ for both my eMMCs.
Then you need to analyze what sdhci_calc_clk() in drivers/mmc/host/sdhci.c does.
That's the routine that derives the value of actual_clock given the clock argument.

JulienTourteau wrote: According to datasheet, the maximum bus clock frequency is 50MHz (0x32 into CSD.TRAN_SPEED).
Actually the Micron datasheet is contradictory regarding that specification.
On the first page under the list of features, it mentions a "52 MHz clock speed (MAX)".
This discrepancy actually shows up in your two modules: one reports 52MHz and the other reports 50MHz.
Apparently you failed to notice that your two devices may not be identical.

JulienTourteau wrote: However, from debugfs information, SDMMC0 is operating at 52MHz and SDMMC1 at 48MHz.
No, you are misreading and/or misreporting your own results.
Both modules clearly have the same actual_clock of 48MHz based on what you posted.

Regards

Return to “LINUX”

Who is online

Users browsing this forum: No registered users and 5 guests