From patchwork Wed Jun 21 10:01:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Shih X-Patchwork-Id: 694840 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 3175DEB64D7 for ; Wed, 21 Jun 2023 10:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232204AbjFUKDF (ORCPT ); Wed, 21 Jun 2023 06:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232285AbjFUKCi (ORCPT ); Wed, 21 Jun 2023 06:02:38 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35DA3107; Wed, 21 Jun 2023 03:02:02 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-66654d019d4so4502371b3a.0; Wed, 21 Jun 2023 03:02:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687341721; x=1689933721; 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=CnhIJnH7RRZ7VhqQwO9JPNlZ5VNGko/ZfKRBZQDya+w=; b=aJR/fR2aFcScxiDkPUafyar6rNbk4FMXTqhY9unNDKWfw38Yg0aSCtUX9Uy0m2z0tS 4J3+XU+wiEe+wo8KhDU4a/q22IKRScXiSdjG2oDbwand6euONdJRQKFf3PyVV/prRmQv vy6VWVclyss4X4OQ2FWLulZ72D0M9wA9h7xOP8eH4CC6R0z8bEPmX49dOznOf0z6gQeX PeF7iUhgbba6HLy0u+oNLmVfci7WlWJ0wRFbmLLMxFJIcZRxf4d4ykzBxRauQK6OAxDn AJthOJI0u/3yLUUQfo6mjBQsMQ8EqMDa8GSg46et8pXsjQ2Nz8037kxwZ+OgYbVqw7wx qv4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687341721; x=1689933721; 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=CnhIJnH7RRZ7VhqQwO9JPNlZ5VNGko/ZfKRBZQDya+w=; b=MOOKWxP18iX4tFxv8hGEf9s68O8IOZ91sdAn0x1hoCypeHbCsKIEGGL3pO75SoLriA cQD/cDA62ZnUyM1BLjfhDoBcwmCV+UmULEuJWfvDVwt1tdvyzj8Pv7TqI/9GJ6npAE38 4rBhFodxAzaba93t7y5Tt6UI5ZRrJjx22npF+Dk+p3Er7/ATlwGD7t6v7iyrDIMvGEle UoAVw7VmcFzJbT0fXRtfoNoiuEhoGF68TqLiXZkqjVDy634L7FV7tzVbTB9bVwUBJPe1 fxE1r9kpwhGqqyoVs4qJHj8yTPtOjRWRfWr983Y+kFDMOx+LgQBUoQz/zjMRh4DT3TJL GCcQ== X-Gm-Message-State: AC+VfDyHA21sOgqAV8ye7n0mmsD3OLI3nlFISoCEwrPVIJJczfF3fQAk c4VZkaZ5c/7UhvQwmueDJcA1wLTEZOC/XQ== X-Google-Smtp-Source: ACHHUZ6FftxyQyB7VQmx8Q4z/H0DaZuIZKOk+o2AjqOYqiSur7051ps1leKzqcFRV1MVIfyx1smT+Q== X-Received: by 2002:a05:6a20:4284:b0:122:8096:7027 with SMTP id o4-20020a056a20428400b0012280967027mr7008583pzj.29.1687341721568; Wed, 21 Jun 2023 03:02:01 -0700 (PDT) Received: from localhost.localdomain (2001-b400-e254-4eda-2716-05ea-20f5-b048.emome-ip6.hinet.net. [2001:b400:e254:4eda:2716:5ea:20f5:b048]) by smtp.gmail.com with ESMTPSA id g2-20020aa78742000000b0064f46570bb7sm2611196pfo.167.2023.06.21.03.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 03:02:01 -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 , Victor Shih Subject: [PATCH V8 01/23] mmc: core: Cleanup printing of speed mode at card insertion Date: Wed, 21 Jun 2023 18:01:29 +0800 Message-Id: <20230621100151.6329-2-victorshihgli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230621100151.6329-1-victorshihgli@gmail.com> References: <20230621100151.6329-1-victorshihgli@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Victor Shih 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. Updates in V8: - Modify commit message. Updates in V7: - Remove unnecessary parentheses. Updates in V6: - Adjust the position of matching brackets. Signed-off-by: Ulf Hansson Signed-off-by: Victor Shih --- 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);