From patchwork Fri Mar 31 10:55:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Shih X-Patchwork-Id: 13195754 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 04B42C6FD18 for ; Fri, 31 Mar 2023 10:56:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231550AbjCaK4l (ORCPT ); Fri, 31 Mar 2023 06:56:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230403AbjCaK4Z (ORCPT ); Fri, 31 Mar 2023 06:56:25 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 528BF1E730; Fri, 31 Mar 2023 03:56:10 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id o2so20872968plg.4; Fri, 31 Mar 2023 03:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680260170; 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=4CnmHFKdPQEHTvZNRYXNIZZMHyo/3bfUyI7H1X7Tf+A=; b=Me10YJcxdjrStL7uupP5YkyqYD8CoNBSTlFDEE7Xl91kSw8zfTYRgPJ8UxAbp+axGj J7W55RSOeijXPtv3rvhjMps5juGdF7jhvX4XgY+XMqQVLFaBXb7ftygmKHZw8q8KITwP T7EfUuXrMBr5Sh6Ff8ILiUsWYclFc5YIc4b9KuLLDpMMsSWhSR1V320OnQGFK1ul2A5X /5jX6+l99D+yEyI517c4mW8e7MQLBFc79v2u1VPxh6vORcIqg/wsm9K2q8kZkfudvgTV zrSYmffHG71xV++LBMOmiooro/XSQCZNKQnxxPjaphRbpeY0TacIfxbkTROXxJku0OKH Fqew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680260170; 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=4CnmHFKdPQEHTvZNRYXNIZZMHyo/3bfUyI7H1X7Tf+A=; b=AMSu637zqeEDJuKjSh+ry2c6cAT7zZBU7SsTkd7i1TiDHMKgqeD6+ymPLyj18Uahdb VZzD2pz1wCT4mttgeZhitopvEacl9hCc0Ixh8cnEIqOPy+OiAsQO2p+azgi+PwRW7irX yA5+USVxdKVOWe+vDzHpsYsRB5daXpbjeEICkHlPH9BXp+TWW/hrrWIz4IELJcFhWfAm 6CYcHOkDgDFoG+po+/XwPwyTo1XUiGluMNdSjA75cT6yanhss1x26tEFlHTEL/d5Df0A SUhXf8UeQ832w+OPHoWL823uWtlXFsg9UuMAj3xtvhh8oLMUU7+im9crdy1EdCLSmMV4 Ywtg== X-Gm-Message-State: AAQBX9dTSuWZukD8QAdX4B7OvPookqZsseq6djrZlsi4/7YVPkgjBiLV Fj8NjE5umbASVZ07aoh/sfM= X-Google-Smtp-Source: AKy350YkYmP+greOOSzzkuYAM1UY455uaSpDFdy6z3i8GnFFV287VFDa8OYeh7CUeJEz0ENDU22gZg== X-Received: by 2002:a17:903:247:b0:1a0:4859:19ea with SMTP id j7-20020a170903024700b001a0485919eamr29574732plh.39.1680260169748; Fri, 31 Mar 2023 03:56:09 -0700 (PDT) Received: from localhost.localdomain (2001-b400-e25c-983f-c7ff-3efd-77d9-6c16.emome-ip6.hinet.net. [2001:b400:e25c:983f:c7ff:3efd:77d9:6c16]) by smtp.gmail.com with ESMTPSA id f19-20020a170902e99300b0019acd3151d0sm1287665plb.114.2023.03.31.03.56.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 03:56:09 -0700 (PDT) From: Victor Shih X-Google-Original-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 V7 01/23] mmc: core: Cleanup printing of speed mode at card insertion Date: Fri, 31 Mar 2023 18:55:24 +0800 Message-Id: <20230331105546.13607-2-victor.shih@genesyslogic.com.tw> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230331105546.13607-1-victor.shih@genesyslogic.com.tw> References: <20230331105546.13607-1-victor.shih@genesyslogic.com.tw> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org 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 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);