Skip to contentSkip to conversation

mmc: bus: print bus speed mode of UHS-I card

PATCH Superseded Subhash Jadavani 4 participants 7 messages Mar 23, 2012 – Apr 1, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: bus: print bus speed mode of UHS-I card

When UHS-I card is detected also print the bus speed mode in which UHS-I card will be running.

---
 drivers/mmc/core/bus.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)
drivers/mmc/core/bus.c +25 -1
index 5d011a3..0517a91 100644
@@ -267,6 +267,7 @@ int mmc_add_card(struct mmc_card *card)
 {
 	int ret;
 	const char *type;
+	const char *uhs_bus_speed_mode = "";
 
 	dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card->host), card->rca);
 
@@ -296,6 +297,28 @@ int mmc_add_card(struct mmc_card *card)
 		break;
 	}
 
+	if (mmc_sd_card_uhs(card)) {
+		switch (card->sd_bus_speed) {
+		case UHS_SDR104_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR104 ";
+			break;
+		case UHS_SDR50_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR50 ";
+			break;
+		case UHS_DDR50_BUS_SPEED:
+			uhs_bus_speed_mode = "DDR50 ";
+			break;
+		case UHS_SDR25_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR25 ";
+			break;
+		case UHS_SDR12_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR12 ";
+			break;
+		default:
+			uhs_bus_speed_mode = "";
+			break;
+		}
+	}
 	if (mmc_host_is_spi(card->host)) {
 		pr_info("%s: new %s%s%s card on SPI\n",
 			mmc_hostname(card->host),
@@ -303,12 +326,13 @@ int mmc_add_card(struct mmc_card *card)
 			mmc_card_ddr_mode(card) ? "DDR " : "",
 			type);
 	} else {
-		pr_info("%s: new %s%s%s%s card at address %04x\n",
+		pr_info("%s: new %s%s%s%s%s card at address %04x\n",
 			mmc_hostname(card->host),
 			mmc_card_uhs(card) ? "ultra high speed " :
 			(mmc_card_highspeed(card) ? "high speed " : ""),
 			(mmc_card_hs200(card) ? "HS200 " : ""),
 			mmc_card_ddr_mode(card) ? "DDR " : "",
+			uhs_bus_speed_mode,
 			type, card->rca);
 	}
 
Signature · 5 lines
1.7.1.1

--
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#1 lore raw

Hi Subhash,

Quoted 2 lines · Subhash Jadavani

When UHS-I card is detected also print the bus speed mode in which UHS-I card will be running.

The patch looks correct to me, except that I' m not sure if this is needed. /sys/kernel/debug/mmc/ios also has such info.

-Aaron

Quoted 73 lines
---
 drivers/mmc/core/bus.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)
drivers/mmc/core/bus.c +25 -1
index 5d011a3..0517a91 100644
@@ -267,6 +267,7 @@ int mmc_add_card(struct mmc_card *card)
 {
 	int ret;
 	const char *type;
+	const char *uhs_bus_speed_mode = "";
 
 	dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card->host), card->rca);
 
@@ -296,6 +297,28 @@ int mmc_add_card(struct mmc_card *card)
 		break;
 	}
 
+	if (mmc_sd_card_uhs(card)) {
+		switch (card->sd_bus_speed) {
+		case UHS_SDR104_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR104 ";
+			break;
+		case UHS_SDR50_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR50 ";
+			break;
+		case UHS_DDR50_BUS_SPEED:
+			uhs_bus_speed_mode = "DDR50 ";
+			break;
+		case UHS_SDR25_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR25 ";
+			break;
+		case UHS_SDR12_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR12 ";
+			break;
+		default:
+			uhs_bus_speed_mode = "";
+			break;
+		}
+	}
 	if (mmc_host_is_spi(card->host)) {
 		pr_info("%s: new %s%s%s card on SPI\n",
 			mmc_hostname(card->host),
@@ -303,12 +326,13 @@ int mmc_add_card(struct mmc_card *card)
 			mmc_card_ddr_mode(card) ? "DDR " : "",
 			type);
 	} else {
-		pr_info("%s: new %s%s%s%s card at address %04x\n",
+		pr_info("%s: new %s%s%s%s%s card at address %04x\n",
 			mmc_hostname(card->host),
 			mmc_card_uhs(card) ? "ultra high speed " :
 			(mmc_card_highspeed(card) ? "high speed " : ""),
 			(mmc_card_hs200(card) ? "HS200 " : ""),
 			mmc_card_ddr_mode(card) ? "DDR " : "",
+			uhs_bus_speed_mode,
 			type, card->rca);
 	}
 
Signature · 9 lines
1.7.1.1

--
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 11 lines

-----Original Message-----
From: [email protected] [mailto:linux-arm-msm- [email protected]] On Behalf Of Aaron Lu
Sent: Monday, March 26, 2012 8:47 AM
To: Subhash Jadavani
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v1 1/1] mmc: bus: print bus speed mode of UHS-I card

Quoted 7 lines

Hi Subhash,

Quoted 2 lines · Subhash Jadavani

When UHS-I card is detected also print the bus speed mode in which UHS-I card will be running.

The patch looks correct to me, except that I' m not sure if this is

needed.

Quoted 1 line

/sys/kernel/debug/mmc/ios also has such info.

Thanks for pointing it out.
Actually we are already printing the HS200/DDR (for eMMC) bus speed mode along with card detected print. So why not bus speed mode for UHS-I cards. It really gives good impression to user what this card is capable of doing by just looking at this print.
Correct we can this information from /sys/kernel/debug/mmc/ios but this needs extra effort than just looking at the kernel logs.

Also note that mmc_ios_show() function is currently not updated to print the UHS-I bus speed modes in user readable format. We need to fix this as well probably as separate patch.

Regards,
Subhash

Quoted 76 lines

-Aaron

Quoted 66 lines
---
 drivers/mmc/core/bus.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)
drivers/mmc/core/bus.c index renamed from drivers/mmc/core/bus.c +0 -0

5d011a3..0517a91 100644

drivers/mmc/core/bus.c +25 -2
@@ -267,6 +267,7 @@ int mmc_add_card(struct mmc_card *card)  {
 	int ret;
 	const char *type;
+	const char *uhs_bus_speed_mode = "";
 
 	dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card-
 host),
 card->rca);
@@ -296,6 +297,28 @@ int mmc_add_card(struct mmc_card *card)
 		break;
 	}
 
+	if (mmc_sd_card_uhs(card)) {
+		switch (card->sd_bus_speed) {
+		case UHS_SDR104_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR104 ";
+			break;
+		case UHS_SDR50_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR50 ";
+			break;
+		case UHS_DDR50_BUS_SPEED:
+			uhs_bus_speed_mode = "DDR50 ";
+			break;
+		case UHS_SDR25_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR25 ";
+			break;
+		case UHS_SDR12_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR12 ";
+			break;
+		default:
+			uhs_bus_speed_mode = "";
+			break;
+		}
+	}
 	if (mmc_host_is_spi(card->host)) {
 		pr_info("%s: new %s%s%s card on SPI\n",
 			mmc_hostname(card->host),
@@ -303,12 +326,13 @@ int mmc_add_card(struct mmc_card *card)
 			mmc_card_ddr_mode(card) ? "DDR " : "",
 			type);
 	} else {
-		pr_info("%s: new %s%s%s%s card at address %04x\n",
+		pr_info("%s: new %s%s%s%s%s card at address %04x\n",
 			mmc_hostname(card->host),
 			mmc_card_uhs(card) ? "ultra high speed " :
 			(mmc_card_highspeed(card) ? "high speed " : ""),
 			(mmc_card_hs200(card) ? "HS200 " : ""),
 			mmc_card_ddr_mode(card) ? "DDR " : "",
+			uhs_bus_speed_mode,
 			type, card->rca);
 	}
 
--

1.7.1.1

Quoted 3 lines

--
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora

Forum.

Quoted 3 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected] More

Quoted 6 lines

majordomo

Quoted 2 lines

info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm"

in

Quoted 2 lines

the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
In reply to Subhash Jadavani
Quoted 16 lines · Subhash Jadavani
drivers/mmc/core/bus.c +12 -0
@@ -296,6 +297,28 @@ int mmc_add_card(struct mmc_card *card)
 		break;
 	}
 
+	if (mmc_sd_card_uhs(card)) {
+		switch (card->sd_bus_speed) {
+		case UHS_SDR104_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR104 ";
+			break;
+		case UHS_SDR50_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR50 ";
+			break;
+		case UHS_DDR50_BUS_SPEED:
+			uhs_bus_speed_mode = "DDR50 ";
+			break;
+		case UHS_SDR25_BUS_SPEED:

drivers/mmc/core/bus.c int mmc_add_card(struct mmc_card *card) · line 321

Quoted 10 lines
drivers/mmc/core/bus.c +9 -0
+			uhs_bus_speed_mode = "SDR25 ";
+			break;
+		case UHS_SDR12_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR12 ";
+			break;
+		default:
+			uhs_bus_speed_mode = "";
+			break;
+		}
 

This could be better code with an array:

static char *speeds[] = {
	[UHS_SDR104_BUS_SPEED] = "SDR104",
 	[UHS_SDR50_BUS_SPEED] = "SDR50",
	[UHS_SDR50_BUS_SPEED] = "DDR50",
	...
};  
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#3 lore raw
In reply to Subhash Jadavani
Quoted 1 line

Also note that mmc_ios_show() function is currently not updated to print

the

Quoted 2 lines

UHS-I bus speed modes in user readable format. We need to fix this as well probably as separate patch.

Aaron,
Sorry, I just realized that I was looking at 3.0 kernel code. In mmc-next, I can see your patch which had updated mmc_ios_show() for printing ush bus speed modes in text format. So ignore this.

Quoted 3 lines

Actually we are already printing the HS200/DDR (for eMMC) bus speed mode along with card detected print. So why not bus speed mode for UHS-I cards. It really gives good impression to user what this card is capable of doing

by

Quoted 3 lines

just looking at this print.
Correct we can this information from /sys/kernel/debug/mmc/ios but this needs extra effort than just looking at the kernel logs.

But still please check if this point makes sense?

Regards,
Subhash

Quoted 27 lines

-----Original Message-----
From: [email protected] [mailto:linux-arm-msm- [email protected]] On Behalf Of Subhash Jadavani
Sent: Monday, March 26, 2012 11:46 AM
To: 'Aaron Lu'
Cc: [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v1 1/1] mmc: bus: print bus speed mode of UHS-I card

Quoted 16 lines

-----Original Message-----
From: [email protected] [mailto:linux-arm-msm- [email protected]] On Behalf Of Aaron Lu
Sent: Monday, March 26, 2012 8:47 AM
To: Subhash Jadavani
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v1 1/1] mmc: bus: print bus speed mode of UHS-I card

Hi Subhash,

Quoted 2 lines · Subhash Jadavani

When UHS-I card is detected also print the bus speed mode in which UHS-I card will be running.

Quoted 8 lines
Quoted 1 line

The patch looks correct to me, except that I' m not sure if this is

needed.

Quoted 1 line

/sys/kernel/debug/mmc/ios also has such info.

Thanks for pointing it out.
Actually we are already printing the HS200/DDR (for eMMC) bus speed mode along with card detected print. So why not bus speed mode for UHS-I cards. It really gives good impression to user what this card is capable of doing

by

Quoted 5 lines

just looking at this print.
Correct we can this information from /sys/kernel/debug/mmc/ios but this needs extra effort than just looking at the kernel logs.

Also note that mmc_ios_show() function is currently not updated to print

the

Quoted 88 lines

UHS-I bus speed modes in user readable format. We need to fix this as well probably as separate patch.

Regards,
Subhash

Quoted 18 lines

-Aaron

Quoted 15 lines
---
 drivers/mmc/core/bus.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)
drivers/mmc/core/bus.c index renamed from drivers/mmc/core/bus.c +0 -0

5d011a3..0517a91 100644

drivers/mmc/core/bus.c +1 -0
@@ -267,6 +267,7 @@ int mmc_add_card(struct mmc_card *card)  {
 	int ret;
 	const char *type;
+	const char *uhs_bus_speed_mode = "";
 
Quoted 1 line

drivers/mmc/core/bus.c int mmc_add_card(struct mmc_card *card) { · line 271

Quoted 1 line
drivers/mmc/core/bus.c +0 -0
 	dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card-

host),

Quoted 56 lines
Quoted 49 lines
drivers/mmc/core/bus.c +24 -2
 card->rca);
 
@@ -296,6 +297,28 @@ int mmc_add_card(struct mmc_card *card)
 		break;
 	}
 
+	if (mmc_sd_card_uhs(card)) {
+		switch (card->sd_bus_speed) {
+		case UHS_SDR104_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR104 ";
+			break;
+		case UHS_SDR50_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR50 ";
+			break;
+		case UHS_DDR50_BUS_SPEED:
+			uhs_bus_speed_mode = "DDR50 ";
+			break;
+		case UHS_SDR25_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR25 ";
+			break;
+		case UHS_SDR12_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR12 ";
+			break;
+		default:
+			uhs_bus_speed_mode = "";
+			break;
+		}
+	}
 	if (mmc_host_is_spi(card->host)) {
 		pr_info("%s: new %s%s%s card on SPI\n",
 			mmc_hostname(card->host),
@@ -303,12 +326,13 @@ int mmc_add_card(struct mmc_card *card)
 			mmc_card_ddr_mode(card) ? "DDR " : "",
 			type);
 	} else {
-		pr_info("%s: new %s%s%s%s card at address %04x\n",
+		pr_info("%s: new %s%s%s%s%s card at address %04x\n",
 			mmc_hostname(card->host),
 			mmc_card_uhs(card) ? "ultra high speed " :
 			(mmc_card_highspeed(card) ? "high speed " : ""),
 			(mmc_card_hs200(card) ? "HS200 " : ""),
 			mmc_card_ddr_mode(card) ? "DDR " : "",
+			uhs_bus_speed_mode,
 			type, card->rca);
 	}
 
--

1.7.1.1

Quoted 3 lines

--
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora

Forum.

Quoted 3 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected] More

Quoted 6 lines

majordomo

Quoted 2 lines

info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm"

Quoted 7 lines

in

Quoted 1 line

the body of a message to [email protected] More majordomo

info

Quoted 1 line

at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm"

in

Quoted 2 lines

the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Hi,

Quoted 10 lines · Subhash Jadavani
Quoted 3 lines

Actually we are already printing the HS200/DDR (for eMMC) bus speed mode along with card detected print. So why not bus speed mode for UHS-I cards. It really gives good impression to user what this card is capable of doing

by

Quoted 3 lines

just looking at this print.
Correct we can this information from /sys/kernel/debug/mmc/ios but this needs extra effort than just looking at the kernel logs.

But still please check if this point makes sense?

Yes, I think this makes sense.

-Aaron

#6 lore raw
In reply to Stephen Boyd

Hi Subhash,

Quoted 30 lines · Stephen Boyd
Quoted 16 lines · Subhash Jadavani
drivers/mmc/core/bus.c +12 -0
@@ -296,6 +297,28 @@ int mmc_add_card(struct mmc_card *card)
 		break;
 	}
 
+	if (mmc_sd_card_uhs(card)) {
+		switch (card->sd_bus_speed) {
+		case UHS_SDR104_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR104 ";
+			break;
+		case UHS_SDR50_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR50 ";
+			break;
+		case UHS_DDR50_BUS_SPEED:
+			uhs_bus_speed_mode = "DDR50 ";
+			break;
+		case UHS_SDR25_BUS_SPEED:

drivers/mmc/core/bus.c int mmc_add_card(struct mmc_card *card) · line 321

Quoted 10 lines
drivers/mmc/core/bus.c +9 -0
+			uhs_bus_speed_mode = "SDR25 ";
+			break;
+		case UHS_SDR12_BUS_SPEED:
+			uhs_bus_speed_mode = "SDR12 ";
+			break;
+		default:
+			uhs_bus_speed_mode = "";
+			break;
+		}
 

This could be better code with an array:

Quoted 6 lines
static char *speeds[] = {
	[UHS_SDR104_BUS_SPEED] = "SDR104",
 	[UHS_SDR50_BUS_SPEED] = "SDR50",
	[UHS_SDR50_BUS_SPEED] = "DDR50",
	...
};  

I'm happy to take the patch in general (I agree that having bus speed in dmesg is very useful for analyzing bug reports), but let's use Stephen's suggestion above. Please resend.

Thanks!

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child