From patchwork Fri Sep 8 09:53:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Shih X-Patchwork-Id: 721037 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 0C3BBEE57EC for ; Fri, 8 Sep 2023 09:53:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238614AbjIHJxq (ORCPT ); Fri, 8 Sep 2023 05:53:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230475AbjIHJxp (ORCPT ); Fri, 8 Sep 2023 05:53:45 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 248171BD3; Fri, 8 Sep 2023 02:53:41 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-573d52030fbso1387183a12.0; Fri, 08 Sep 2023 02:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694166820; x=1694771620; darn=vger.kernel.org; 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=qUyhKz0IZnGv/kDPhh0zvtC7NPuBSxGKLGuzvFl9j+w=; b=YaSWqxNhK2FEU7nErELA6h8mRu+WQrNa7ogsIdaoKb7FQI4mCzYRATkT5hDgYnhBZX SXCSadvmyex2KFjhLNOyh67YrTVgVxNN4e1K3Q7ps+dTGscvg53N8tH6K4953v8UKhPv FZSORH5k8q9vxSdIB4gXjZ5WXyi1rPW0RqjHwaWCUbNhHpc8DXH+sNF96PV6qaDQqEPM LiqK5Gsi+o2i4hrUvIvaClsKOy97Opc2oOtoJpQ+jwS87ZjtjyPiSnktwSjYvh0gJeAC ulZBYD50VrbvL6PioyXA6IFFvO/8Yc2skjMVb1h29Gu01YasbgsuqRA8Sj80Ri79C8vt yDzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694166820; x=1694771620; 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=qUyhKz0IZnGv/kDPhh0zvtC7NPuBSxGKLGuzvFl9j+w=; b=U5fUM9+h2z+Lw/GCL7UHM5IsU8O+3K0DM2DgALtHsAFZMaQ1Xr86Fk3rxYRk8naBD5 sNa/7gKTTfj+OnXcsyI0WZD1NqZcwP4d31jqTyN8tXgQaMk1CR/wHGMexxidlXqpmiTD scFS/D+S9zBIwcynQm9hL5JzEg2RroMmudF7zD39Oi5sMcTrTDPFFMo9Zln8SWyv3Dbs MmBhgVRnAMcgA+6AcJaxizWTma0xLvM9/e+EsFTc5iWzIDPIqy32rHekZVNzNOe875Vx lJAkeRixyGvsMt8EdREgYNhl5xgkLiq+Lw/YcPHmWM4ANrR1zMUqb37xd0bI0oWY31LA 4DxA== X-Gm-Message-State: AOJu0Yx0lvUwbhwmG0mKlYxvTEoyK+9Z5hjg82Vb8p5FwhMgiQ2jcsWO sf5Qqvu4MiXqnHcXqOX5LB0= X-Google-Smtp-Source: AGHT+IFKwp2MtaQyqprNbgxb33hojVJsHkCXZPF8d/OrgMwYIqXhWvd68rx7PIJRUw0kvXRq5Bkj7A== X-Received: by 2002:a05:6a20:7490:b0:13b:a2c9:922e with SMTP id p16-20020a056a20749000b0013ba2c9922emr2164193pzd.27.1694166820500; Fri, 08 Sep 2023 02:53:40 -0700 (PDT) Received: from localhost.localdomain (2001-b400-e3a1-00a4-a20b-46bc-ccec-3e79.emome-ip6.hinet.net. [2001:b400:e3a1:a4:a20b:46bc:ccec:3e79]) by smtp.gmail.com with ESMTPSA id c9-20020a170902d48900b001b892aac5c9sm1172178plg.298.2023.09.08.02.53.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Sep 2023 02:53:40 -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 V11 01/23] mmc: core: Cleanup printing of speed mode at card insertion Date: Fri, 8 Sep 2023 17:53:08 +0800 Message-Id: <20230908095330.12075-2-victorshihgli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230908095330.12075-1-victorshihgli@gmail.com> References: <20230908095330.12075-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 0af96548e7da..bd761e2858f1 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 ", @@ -340,27 +341,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);