From patchwork Tue Dec 13 09:00:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Shih X-Patchwork-Id: 32694 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:8188:b0:89:790f:f786 with SMTP id m8csp3856905dye; Tue, 13 Dec 2022 01:02:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Igm0zDnerz8y2+C/Yiy/DEzJBmPaKGfmFaOZisE+PO1qkjpVnxGrVSgEYq8Ftuoxls/2o X-Received: by 2002:a17:90a:f3c2:b0:219:38b7:4809 with SMTP id ha2-20020a17090af3c200b0021938b74809mr20303509pjb.39.1670922165926; Tue, 13 Dec 2022 01:02:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670922165; cv=none; d=google.com; s=arc-20160816; b=EZAjr9l4ul0QPU1fXIZPrrYEkZzMXLSBscWnEXc6bh22vvTSaNjngMtG8+cF8lp78I GNbjdYGktT8goQDxdBv6+i9dRm2qRgFF2DiHK5IxouW0xkY3XuxQ3crv6I+OGHtD1234 6VG29f4gYdwllcxRezV65tBNq5BbGqThz7YDA7LYTsCBIL6BIFG2S/ujEL//D9sOMOYg rptRLTbZao1ri30jly1VgHBUHp9WtN/0HA+Qzq9wYGzvncPmyBWlgcnTFg+q/H4U4+mU DDcyCTeE+a1RSvmliMJMACzzCNPJn8Rt+glct699ersxI7xQvQxmRcK132ENoHUHrHhv 0rLg== 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=OnZ14x+Cd+TEg+zucSh/Nr19nBP6U3yPYDLuptGj0yU=; b=V99gDfWt0czLJRfShuL16pZmh9NZm90X32ZjFrG8R8LmVjgLUtRzcVECPwLkugq4ds ju92TuVvNrLFxO9FgCcOyBZ0yAY5RI4YGh0UfeW2hH6U1JL+3BMe9O+O1LtuoWeDGFU6 zcAbD3sBDPt4koQ8FN009dR+OZwX1yZS3b2RS7AuNHhnA7JtdHBJQAN0Kfheny3Oqpof w28NAf0m80d834qutaAmo6GM3+eIVL+IvA3DPnbN5vd0jlEgekZYWYbg4/bYSyP7SYu/ gnBwGbMsFS3tBv4niJDeOz6j4cyDmWQqZ34giCrPGmW8RoTENI1qpvtUEgYus86Zjtd4 wiUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qUTiEHNy; 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 131-20020a630589000000b00478a09699f8si12273140pgf.126.2022.12.13.01.02.33; Tue, 13 Dec 2022 01:02:45 -0800 (PST) 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=20210112 header.b=qUTiEHNy; 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 S234748AbiLMJBM (ORCPT + 99 others); Tue, 13 Dec 2022 04:01:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234733AbiLMJBI (ORCPT ); Tue, 13 Dec 2022 04:01:08 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFF3562E1; Tue, 13 Dec 2022 01:01:07 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id 62so9966439pgb.13; Tue, 13 Dec 2022 01:01:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=OnZ14x+Cd+TEg+zucSh/Nr19nBP6U3yPYDLuptGj0yU=; b=qUTiEHNy4ETosFcpfvdfkl5YygjNK3pfz1KiVstmSGIsMF4rqVrBI60aPcZZqzkAPZ To8u7kWzviFjCrW1xbuoJG0FJjowUeDiVmzXW/5o5D1Zd5WJhZY3UbIsBr4rIWK++Rqf LjfQCn94uIEufBDNz+M6QH+aPXDO6nlxbWQzorcB6DaPSXZO4vaO50JTCHo+gozNSMWF JbnRQmDZcW8q0sr6YMiz3uVH96XQ9CU6Qng4xPM+hENqg9sY9UuqDRVgOske8Fzt5qsv 847sAcQuNlDIuCUnWJMtQ4XbdSjIUH/gcGJJmqtFodZr9athZC9ZfmR6WDbYnsXx1Z6+ Lguw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=OnZ14x+Cd+TEg+zucSh/Nr19nBP6U3yPYDLuptGj0yU=; b=FbO5CrArAeTHbf+KXG81fVRcHKxxsn/smSaP/VhA5mqkQmI235zq4fl9rpu74nkEcQ f7xqWN9eQCBv8Pg86AOvBq+5cMhuuL7hJkXL4kp6RigxSS6j0KLBGkMJgeVHN/ropled ZFNOn4ibQx8hxuyGDRr638I1+/TonBymK13CGYrhfr5cDefgCf4eA4B91UQdN162QGfJ EmyXGVju1znfd8uVrqtXt4GePvDQK4DFGfKEIvQy0FX7oQju/ZAoLcs4sfpnrjzbj+fT jruhlHkkD/UNPOeToMJidaxN8BfgHN8iCUnmgrnOuJ8ZNaPUlNpbC6dIzI0LezoZNOKs uYKQ== X-Gm-Message-State: ANoB5plt7wWqBNssT0x8ygYWub6lWCjO949ilqZv4/MZIa/rS2SOVdt0 dSVDxn4+hmYqxve8D5du06o= X-Received: by 2002:a05:6a00:26c5:b0:576:fb7c:7aa3 with SMTP id p5-20020a056a0026c500b00576fb7c7aa3mr18291570pfw.14.1670922067266; Tue, 13 Dec 2022 01:01:07 -0800 (PST) Received: from localhost.localdomain (2001-b400-e2dc-5c03-264b-f684-a8c9-21ae.emome-ip6.hinet.net. [2001:b400:e2dc:5c03:264b:f684:a8c9:21ae]) by smtp.gmail.com with ESMTPSA id 81-20020a621954000000b0056b9ec7e2desm7141682pfz.125.2022.12.13.01.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Dec 2022 01:01:06 -0800 (PST) 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 V6 01/24] mmc: core: Cleanup printing of speed mode at card insertion Date: Tue, 13 Dec 2022 17:00:24 +0800 Message-Id: <20221213090047.3805-2-victor.shih@genesyslogic.com.tw> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221213090047.3805-1-victor.shih@genesyslogic.com.tw> References: <20221213090047.3805-1-victor.shih@genesyslogic.com.tw> 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 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?1752088881183086465?= X-GMAIL-MSGID: =?utf-8?q?1752088881183086465?= 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 | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 36679f4e9acc..bbbbdbca5366 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,25 +338,29 @@ 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); }