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: 110944 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4252960vqr; Wed, 21 Jun 2023 03:14:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7mf83vXIJhihDuTU1L1nT9AZ7BeANLF+GeWHZF22JW7LF95/ewWv0s/tfEDDjCUM+I5xwc X-Received: by 2002:a05:6a20:734a:b0:122:cb18:2e8c with SMTP id v10-20020a056a20734a00b00122cb182e8cmr5109932pzc.6.1687342485880; Wed, 21 Jun 2023 03:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687342485; cv=none; d=google.com; s=arc-20160816; b=0OSoy8tG5IlzllImQf8fxAkU5XfC0wEuLlXwe+NckdlY3Phvs0Ox17XG551jNT908F GnhmC+cb4m7BIJY1Imf+hCmzJ4ZMC8CudGSJO34OO16u3MPGwszrtuNLiNqpSs4A3tVs cJN+r3TLlpK9oD/AW3nqtBtZ+0XUPop5kYImtryDjaW60p895lWB7drSgADwgHyeELdu dfVtcN7F28TFiWfU2TZ2WwvLy3Z1j8IlWChcSdVgdvtNSQagbKEEfsgi8c2PseK8+gvv Y0XCrFOMf60krQX0S+IJWmRcZd4iVDVRA9fxmxxq+bLIR9OrTWHW+0ORWDkIih4v1etT 4Uww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CnhIJnH7RRZ7VhqQwO9JPNlZ5VNGko/ZfKRBZQDya+w=; b=kIhl4attBClrtEuyxmuuxeonMCREom8ZGJNyhtYEZlbuJYhDihX4DJ219OB8cIjhDa xXZoS7ZqkJ3Ax+Jw+pmxnk7LVc79hSyg+v/7bVZ6pCqB2kfPyIZqUCY6AJ0EGfgidZUv 7HZGVjgamLVJpzunDjOF7nH3AKQZiazbeF3wOQgh9qX9EsTlvJngTSEOtw8HJqv9ujJ1 qbtRw9ZlXL57YdzZekGeXJyoFf/qSnZ/BJkJQMUSYlvtYdPE/tB2JfuQigZqoiO76/NK DXPGhQOCI/U9qhi/gn4pz9/G8FNLoQjUKv1+3hw4N2VX7fNNWqyBV87IT4V4ecWtnYxe TEjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="aJR/fR2a"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i69-20020a638748000000b0050fa9bc63cbsi3610295pge.432.2023.06.21.03.14.32; Wed, 21 Jun 2023 03:14:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="aJR/fR2a"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232301AbjFUKDL (ORCPT + 99 others); Wed, 21 Jun 2023 06:03:11 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769306834199936045?= X-GMAIL-MSGID: =?utf-8?q?1769306834199936045?= 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);