From patchwork Thu Feb 25 17:03:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 387226 Delivered-To: patches@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp476950jap; Thu, 25 Feb 2021 09:04:06 -0800 (PST) X-Received: by 2002:a05:6512:108e:: with SMTP id j14mr2246683lfg.364.1614272646563; Thu, 25 Feb 2021 09:04:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614272646; cv=none; d=google.com; s=arc-20160816; b=lQ04DfH+k65dI19orA+BNWiiUAhSxcq/UbORdmdeZIUSStnfQAQ8jJPgHhnWV4nJ9C gYO+pBomRWgM44CbiU1vMAvRsJ87EFniCRh5pnxJM549M18WlJcfJgat5GoE/s1WTgeM 5a2Ekb6aDycxg9LVSkY3842JOoAbYrTUVAfoFqr3JEoffI4y1eLafO4B8WR3Qfanm3nl A7jBtAoSt7Ay5DjMFdyS1oI9PS0rAW+NZpBPr/kAkWx0kvIdC3bswP2cLwIT/eZYpxeJ 0shOmvg2kFIu/auM642slxGxsB9sLHVZh+MXnQhKzYXMwe1ycrlXkHV5HmpRPGLHUE+H 6+Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=vj9rdIaC2NXd2ktY/guBoYHKwtZ19VGh75jY1riwXmk=; b=GolywWmgUtHUQW5NHyQxFJQaIQPPgY829gzz89m6XMl3o/dZYAVKRnxWBFFyRRQoYJ +hlokOb6/8lBaL5lDLYI9hgfXdTRIvhDprh1e5x7si8+dDBUGH9O9KJDgBb2OJnBA2b/ XBfqWZ2H/446wa4Q7IamUXY1OUvW3ozW8n5Y+zMS0hzkAse2XaQu8DG4CiUvS+Aupn5m gY0SfZCCi86agRbX6zWnDZLJfvRzrPrTEcrLzuVKkqjVC/lS7UWm8odQm3Bne0LTV3XC Ma6WZYt0RoeVZ0O1I88uA6/ZiB16vu3a7sp/RDyMOJ1FNSB0gddL8wF4d4HJMqd0OFmw B1cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=guHDoLEE; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id c13sor1445695lft.135.2021.02.25.09.04.06 for (Google Transport Security); Thu, 25 Feb 2021 09:04:06 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=guHDoLEE; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vj9rdIaC2NXd2ktY/guBoYHKwtZ19VGh75jY1riwXmk=; b=guHDoLEECvKjKyHltm0WRI213M65b10M0InJ3+CiKpohgzE/LmWJCZVMa3/9hcSsy1 7M95nwTk9s8UQEoTlg0+nasyj8VFxZ1YUj5JF/3viFIglVKrNUXkZVv5Swxk++ow7Qsw 3s7SfeSAzTds/HRMJPji2dHIPyM6ovWZSygdXeqCUOeS4gARnLP5nV+hbe8KUrAVx6VB KuWkQ6xAdaejLoXqPO3nVd6n9t9SAwbzvXWNLSYhfis5cYrhJMMf5ovGpjYi/JDD5it9 xPi92RBccdKq1vHi2CX9I6aTZiKj9XT585/lwOp1FtJ4UMhOrEr8Q+uORU+qyoAQU5qE xcng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vj9rdIaC2NXd2ktY/guBoYHKwtZ19VGh75jY1riwXmk=; b=VKbEo2rZwP61SlVseQ34MW7B9LTJn17GTKRvmeC2Yzv0ycv2mnV7iRkPSmguRHg9pU Cf2XrmPmouZSFnME9c/rPYKTsTRe/SNy8KZZqwx+51VFmlyrjugfZ0ZMKPrX7dQARltA CCryq2dApn3pa7/Ui9x5DSrcfJBXTOHPaRacIIkSERLZHlfXhNX516at9UI5XJ90PUCJ BuJELgxIS+fH0ZSbz90RGD+m6TAMR9C6z840o/ZPlBTnJgd/mqgLHwAq6YqzLw1GCcka JfBJ9Y8UqWbXHoo2Jy0doGzmCs1NCsC+/Y2VaNJlNvskshgz8W0jr2eSgrseY1li3Ofv 6gcw== X-Gm-Message-State: AOAM531ZwXiBrrc8T4D7nqJYJ4yuUAxEgewCPqbOanYPc8oZD7GTzxi5 91yLm/QlxZ8fexhH3hEyFQMpxxZx X-Google-Smtp-Source: ABdhPJwRC+KhmoMpNcZAsBwMSKrl2NeOaJRIlJkg1RF7mJ9XoLIydrpQAmVR0qTjIyxwhXBYYWonoQ== X-Received: by 2002:a05:6512:5d7:: with SMTP id o23mr2454322lfo.254.1614272646204; Thu, 25 Feb 2021 09:04:06 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-155-4-129-234.NA.cust.bahnhof.se. [155.4.129.234]) by smtp.gmail.com with ESMTPSA id b39sm1103749ljf.68.2021.02.25.09.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Feb 2021 09:04:05 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter Cc: AKASHI Takahiro , Ben Chuang , greg.tu@genesyslogic.com.tw, Renius Chen , Masami Hiramatsu , Takao Orito , linux-kernel@vger.kernel.org Subject: [PATCH 1/4] mmc: core: Cleanup printing of speed mode at card insertion Date: Thu, 25 Feb 2021 18:03:49 +0100 Message-Id: <20210225170352.76872-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210225170352.76872-1-ulf.hansson@linaro.org> References: <20210225170352.76872-1-ulf.hansson@linaro.org> MIME-Version: 1.0 The current print of the bus speed mode in mmc_add_card() has grown over the years and is now difficult to parse. Let's clean up the code and also take the opportunity to properly announce "DDR" for eMMCs as "high speed DDR", which is according to the eMMC spec. Signed-off-by: Ulf Hansson --- drivers/mmc/core/bus.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) -- 2.25.1 diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index c2e70b757dd1..f4851ec8290c 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -311,6 +311,7 @@ int mmc_add_card(struct mmc_card *card) { int ret; const char *type; + const char *speed_mode = ""; const char *uhs_bus_speed_mode = ""; static const char *const uhs_speeds[] = { [UHS_SDR12_BUS_SPEED] = "SDR12 ", @@ -349,27 +350,30 @@ int mmc_add_card(struct mmc_card *card) break; } + if (mmc_card_hs(card)) + speed_mode = "high speed "; + else if (mmc_card_uhs(card)) + speed_mode = "ultra high speed "; + else if (mmc_card_ddr52(card)) + speed_mode = "high speed DDR "; + else if (mmc_card_hs200(card)) + speed_mode = "HS200 "; + else if (mmc_card_hs400es(card)) + speed_mode = "HS400 Enhanced strobe "; + else if (mmc_card_hs400(card)) + speed_mode = "HS400 "; + if (mmc_card_uhs(card) && (card->sd_bus_speed < ARRAY_SIZE(uhs_speeds))) uhs_bus_speed_mode = uhs_speeds[card->sd_bus_speed]; - if (mmc_host_is_spi(card->host)) { - pr_info("%s: new %s%s%s card on SPI\n", - mmc_hostname(card->host), - mmc_card_hs(card) ? "high speed " : "", - mmc_card_ddr52(card) ? "DDR " : "", - type); - } else { - pr_info("%s: new %s%s%s%s%s%s card at address %04x\n", - mmc_hostname(card->host), - mmc_card_uhs(card) ? "ultra high speed " : - (mmc_card_hs(card) ? "high speed " : ""), - mmc_card_hs400(card) ? "HS400 " : - (mmc_card_hs200(card) ? "HS200 " : ""), - mmc_card_hs400es(card) ? "Enhanced strobe " : "", - mmc_card_ddr52(card) ? "DDR " : "", + if (mmc_host_is_spi(card->host)) + pr_info("%s: new %s%s card on SPI\n", + mmc_hostname(card->host), speed_mode, type); + else + pr_info("%s: new %s%s%s card at address %04x\n", + mmc_hostname(card->host), speed_mode, uhs_bus_speed_mode, type, card->rca); - } #ifdef CONFIG_DEBUG_FS mmc_add_card_debugfs(card);