From patchwork Fri Jul 21 10:13:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Shih X-Patchwork-Id: 705707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A0EEEB64DC for ; Fri, 21 Jul 2023 10:14:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230229AbjGUKOZ (ORCPT ); Fri, 21 Jul 2023 06:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229983AbjGUKOU (ORCPT ); Fri, 21 Jul 2023 06:14:20 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1CE730EF; Fri, 21 Jul 2023 03:14:13 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-66869feb7d1so1143080b3a.3; Fri, 21 Jul 2023 03:14:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689934453; x=1690539253; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o2oO47JttJauMS9op7r59Sk9d5IhHxC/WR3Byj6UFmc=; b=eQud2r05AtpMbJhkcpsn2AYVmnywid6N05q362ok/1y3zyefovRPfqWtdmdUB+tWNd Ha8lB+wvDGdk5x4pJqVSxgP9v5Zs3u0GdtfrW5d7gJAixjjbKET6iyNfPWU0vRhytYoY mN/Fp7g0iSYQ8BGkEqi/0Kx4OM8x6FBsGIHXpLW3eRlO7P4aK8ccllTD0uTkhJO8G3zO QQIc+8PxBSFNZntviKSu9y/xuLvGrepPcAfXc6rtvvo7sTH4jIM9oJpo5zsVo+zEq65I HxEe2RLRKH0X1gmplJHZW/d6JcVrP4bgJAVMzRZF+O3pKvYr27ZV2PiJ8bT0lP8OmJWV T8aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689934453; x=1690539253; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o2oO47JttJauMS9op7r59Sk9d5IhHxC/WR3Byj6UFmc=; b=PUvRPd5SfBdOqwWSwmG/UQdi5gv+Ou3m5Nkw8X0aqLzu3TIzLBDaqPDDxPTqCXMjnc pXezGB2mEpPhHsXq3/Cp2g5ilWoX03odke2gICWTtmDPJIVUc/Sfc6GXSgYl5Kp8k6H7 o6eLlrFZP4jn83ktWCIEAMDnpRjVCHDO+4tTIWsQUKUXwU0sLt/0zEqmXMKTlyD+RfZK iSfZyo0Qe+iXGmA6u+MoM2tXBw4ZWmJHFboBnTTDEmmfIyNWKVWJOXegR5VKy/zmyreu iSdoIqRjEWDTgCSZYeAosOsd9c4M8ptlNyPo6+TPKtxv/KNgBIbOxtx77MEIc3L3UALy F1Ww== X-Gm-Message-State: ABy/qLYxitnrZnqy1fSHqXVe1Q/D8DTBNoKqmUs6TIj/DS4z277wFMA3 v454f4qPjYE44vnV9M9d5uk= X-Google-Smtp-Source: APBJJlEpeASTeBmUp/5UgjZHxNQH6AwKiFy0uxxBhOXM7ps5JOgw8fgdrnA2SJUVxtjqDH1ZY6YFuA== X-Received: by 2002:a05:6a20:13c6:b0:127:72c3:fd60 with SMTP id ho6-20020a056a2013c600b0012772c3fd60mr1099642pzc.1.1689934453211; Fri, 21 Jul 2023 03:14:13 -0700 (PDT) Received: from localhost.localdomain (2001-b400-e23e-6b0d-6c46-3684-497a-06ee.emome-ip6.hinet.net. [2001:b400:e23e:6b0d:6c46:3684:497a:6ee]) by smtp.gmail.com with ESMTPSA id y1-20020a170902b48100b001b86492d724sm3050719plr.223.2023.07.21.03.14.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 03:14:12 -0700 (PDT) From: Victor Shih To: ulf.hansson@linaro.org, adrian.hunter@intel.com Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, benchuanggli@gmail.com, HL.Liu@genesyslogic.com.tw, Greg.tu@genesyslogic.com.tw, takahiro.akashi@linaro.org, dlunev@chromium.org, Victor Shih Subject: [PATCH V9 01/23] mmc: core: Cleanup printing of speed mode at card insertion Date: Fri, 21 Jul 2023 18:13:27 +0800 Message-Id: <20230721101349.12387-2-victorshihgli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721101349.12387-1-victorshihgli@gmail.com> References: <20230721101349.12387-1-victorshihgli@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Ulf Hansson 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(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 2c3074a605fc..cf32cf135781 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -299,6 +299,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 ", @@ -337,27 +338,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); - } mmc_add_card_debugfs(card); card->dev.of_node = mmc_of_find_child_device(card->host, 0);