From patchwork Wed Dec 4 09:28:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 847508 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44C871AC887 for ; Wed, 4 Dec 2024 09:29:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733304546; cv=none; b=rg4WY7Sr9gTNSy27K86Tu/pOvS5y0pq+IcpAa1gWH1KLqXanGxJfqw1EdxTdwXz16yQ8AnYjYckwd1MGIYDZ8zZ+Un6xEDQ1d3D3wpOhp+6bJ7uf201zwbSuZBEDit9UlebcdmCOWq22jGz9Lf8aFXFTbt/WsVuy34IJ/8hpnpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733304546; c=relaxed/simple; bh=BuT/7nos5URevs5nXU7ajsEIN7CIlXo3ltjg+xI8Y04=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=blqJGqsygpaw/ibwNOvs6kvZwu1ApSc+pI63uoRqx9u5GyD7ldO9brVDnbvrZIKS3znaRT0InGiHdIIrZkXQ8PZg3jA4SoeiVa4ESC3LjYE+HYuwEPkYblNA+AD7tSCnNLUY0Zf38wzJMag82+ndPwksuDl/hzmqz/FE/Xc0hFI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=HE0Lpkgo; arc=none smtp.client-ip=209.85.210.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HE0Lpkgo" Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-71d41932d32so2858820a34.0 for ; Wed, 04 Dec 2024 01:29:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733304544; x=1733909344; 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=a3a2o2nbwJCPSnXwOfL4XIKrCkhJXnP+2FlXfd5kTMs=; b=HE0LpkgoVheOfstNCMMGYBGbRCebMj76iPNB4UbUQfuTpqfpSpblRueQcjNleZnWW3 r4Ibbr6NyoetusNJX47Jw+MjfWMRgvorgBly0s4yRNXkIzw+B7z+5evqRlEoIxoSeTCf RIG6+m3heeDthOd1gWGcC4B78hICp80PGnn/w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733304544; x=1733909344; 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=a3a2o2nbwJCPSnXwOfL4XIKrCkhJXnP+2FlXfd5kTMs=; b=F4H3uL5yZTzbSyRFykE2Tj7/00fqUWdDlAC4nh9G1gWCqvLJa5UGCzzh1zHTT6F9Sp si5/vSNZ4ZP2XKagClPuCK7taMTog5KM2Sstq2dWZSyPuCfeB+ss9ixyXXSRcaPGgZ3U q2I3yqf/Y9yBRryGzBa/Do0qWB4FuMBwEUCamumlZNcbD6c0NG3wkY8wBdF1loJw63f5 ot48Tuh5Rs2qGW83NyQdEH0vbqd+OmWnzdFndzWP1ujyTcF0MzxrCc+q4j5cZtZHetMh UZR6s7kWwlKN09JvtwUIbSVOuE8Upp7n0TzzVe2EdFbT8AY9TQBAHVHPf7SJGF2EHztp QSgQ== X-Forwarded-Encrypted: i=1; AJvYcCVbDJSpUTTi8/Q92ZbYARcotfKJ6LYNgw2QBtEpac4yPK12sbjcp3pVRzlV7MNQvh7id0NEca4qTmY=@vger.kernel.org X-Gm-Message-State: AOJu0YxLeoJICKDs4McszIis5UMNyF+nK+CcalN3RNFBK4LxqPXQFdlX 0KwUk4ScoeeQU71+xp4Z3JGS+ACbJMQLf6FJr1Ay0dQftWr0JgSVoVDkRbtNPA== X-Gm-Gg: ASbGnct8dx4KwBP/t9ZS1gR2WHiU37rWgqXGCGzorCWxWZ8nyxg7FrXmUCooqIxkTX0 54kYbdaH56alos6KtAcdmkx97MUVR7KabD7wO0g0SkbPk2DXnDvwHy7qjWP7svvxD6PxfUVWPdC dqFJea8tcK8hNGHTTYFRBQ1HeZvXURUFss1juevsVIfohapLDMl9dPaT8zuoXUDbSRv+EtKczYC q2UpHkTiNFHd8GIiiJt/FD+L21NhKaY2Lrr+pb95NHIKaDGRDOWdnJ60UCJYAXV6Fa5 X-Google-Smtp-Source: AGHT+IG2OOr+DFMkoVU9c8r19W+ABIjfnQAct57iSGJbN6PcBsKoE81tPXls96jiKM1xKEyUQ5FchA== X-Received: by 2002:a05:6830:2045:b0:71d:5b70:41bd with SMTP id 46e09a7af769-71dad610b0bmr5596609a34.12.1733304544427; Wed, 04 Dec 2024 01:29:04 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:2eb1:a68a:2625:b944]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7fc9c2d38dbsm11049024a12.15.2024.12.04.01.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Dec 2024 01:29:04 -0800 (PST) From: Chen-Yu Tsai To: Chaotian Jing , Ulf Hansson , Matthias Brugger , AngeloGioacchino Del Regno , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Wenbin Mei Cc: Chen-Yu Tsai , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, Frank Wunderlich , Andy-ld Lu Subject: [PATCH 1/2] dt-bindings: mmc: mtk-sd: Document compatibles that need two register ranges Date: Wed, 4 Dec 2024 17:28:52 +0800 Message-ID: <20241204092855.1365638-2-wenst@chromium.org> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog In-Reply-To: <20241204092855.1365638-1-wenst@chromium.org> References: <20241204092855.1365638-1-wenst@chromium.org> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Besides the MT8183's MMC controller and all its compatible derivatives, the recently added MT7986 and MT8196 also require two register ranges. This is based on the actual device trees. Properly enforce this in the binding. Fixes: 4a8bd2b07d88 ("dt-bindings: mmc: mtk-sd: Add mt7988 SoC") Fixes: 58927c9dc4ab ("dt-bindings: mmc: mtk-sd: Add support for MT8196") Cc: Frank Wunderlich Cc: Andy-ld Lu Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno --- Documentation/devicetree/bindings/mmc/mtk-sd.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml index f86ebd81f5a5..9ea035928563 100644 --- a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml +++ b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml @@ -235,11 +235,18 @@ allOf: properties: compatible: contains: - const: mediatek,mt8183-mmc + enum: + - mediatek,mt7986-mmc + - mediatek,mt8183-mmc + - mediatek,mt8196-mmc then: properties: reg: minItems: 2 + else: + properties: + reg: + maxItems: 1 - if: properties: From patchwork Wed Dec 4 09:28:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 848590 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4ABFB1AA7A5 for ; Wed, 4 Dec 2024 09:29:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733304549; cv=none; b=QOr8Hr06B8Y/TnEPDRgM97OgkrwBU3WjsQuauvxJ/M17umi52+Ipg4CoBYqb1S9TtB9M+CFi56ZXR9PtmBA2kSSuKMF+EXPPaZWg8Ay+8kVjtwc6bBWzw0hzotct1JzknoxH2QdlgpehjGwcu7XZr5t7VyP27INm9uAFjan9jDU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733304549; c=relaxed/simple; bh=ZF846tfxXQR1bjFKcFdA9ieHcqIFK6FjHRuAwd9+d9c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WLl7LkJx7NZ2r5gdi3ki8AYz2WLlG7kHpsyWHR0G4HcTAG/++IzRUIBLsO7CKlwmzy3GZPqGBx50hV78gYY4GaLHYC2y5lpvvFc9icJ25/t7zjVFOiREwgCDmSLXQGmM7oxZYoiFi7FwimfHDl91NcVL7NA2qlZ9uU50USnnfSI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Ar8kYtfz; arc=none smtp.client-ip=209.85.215.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Ar8kYtfz" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-7fc22a88bcbso5016709a12.2 for ; Wed, 04 Dec 2024 01:29:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733304547; x=1733909347; 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=5lmhyTT2gnZ9bY0N8ST8GSpbytof12mEhpjxb7D+L9U=; b=Ar8kYtfzscK8eQvziDDm5C8HUKZVLZbINqRj/8zmMnMCiCb0QDgALrhDm2NFPRn/VG stUKrgrjnA689u3jjl7kurolByZm0cJWEdk1pn/pC+CToGLevuNfWK4DHz7bBL10WQDN U3Cg/RmBurDghyoszvT5ZGlnlIC8D4JjR7uro= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733304547; x=1733909347; 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=5lmhyTT2gnZ9bY0N8ST8GSpbytof12mEhpjxb7D+L9U=; b=CdmrdH9e+UbxopQa0DQB3v7VUs7iHSbK9fqUOhALdFv7uFPZgoIl1Nabpo7+wGFqOH L5QxE0PmJ26ZzcMVVAIzzWdE7hkZAOAQH2ThEFLvnbd81x+kOR2PKszMLN3qjhsbI3Kn nQM8sv/Hah2b/KwsFtySTOzqMIUKaFxoiGONgY+HQW7ZFjjmv7YQzppfpCGW8qMRyPsG TzQU6I0OYoSRPpJac/1YOLuG7/ZILe5zPTwC0W346NB19d5IwMJ+1qg9ojort3xCNK/U 54/8HWkazsoDcm5zVXyDHYqVLQrrz1yh4zJB1v+p78ubcnMLyBBbuNeOGgFWewvm8zXn ZSvw== X-Forwarded-Encrypted: i=1; AJvYcCWp7j5CdcjEkp5AaLB1c3n8srPOO1OKcSJSqfsMz9bjNTo11SyH7Zo/d529C5VQ8sFJFnIbBki/dY4=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1GNsiapHcFGy07mfnJE0g/LAmaH6c7pEFjzJKd3AoKxVgq52q 5CFAftRqpaegPWJLebLGPqj7Muru0JcUYprB1AHbvAsgq45Ls+GbOb5lCjLFVA== X-Gm-Gg: ASbGncs7FvJegZurGKqfR8V5XENftfqv8zwIsb48S/LFC3LweoVO6sKikFXkmOA3W7X 78pwPs65vbnEphvwaFoJ67aJlYYynqsODXd2wflGjHtImg0sv0wXA4X9vpHs4915RXjfzBZy4FP wQAZ2KFBiOwemk1iWBmayGTaFLuPKK2Zj1E/xdFS8o6hUfnwDDru895wQ1um7SKE9Kc+lLANTGf NSJjuOQCkdNlnVhYrqeBCWVfJ6eFpbmcAPsMZBoHY86poE2JI7JSDhd6R+N7ojRUO+s X-Google-Smtp-Source: AGHT+IF/J9a4qflcZHiUbg+VHivDCNAN5kL5imj4FjGYpM9OWcUYV3cXUXaClbk0sydJ7WHWfxLZ0A== X-Received: by 2002:a05:6a20:8407:b0:1db:c20f:2c4d with SMTP id adf61e73a8af0-1e1653a6515mr8672949637.2.1733304547503; Wed, 04 Dec 2024 01:29:07 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:2eb1:a68a:2625:b944]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7fc9c2d38dbsm11049024a12.15.2024.12.04.01.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Dec 2024 01:29:07 -0800 (PST) From: Chen-Yu Tsai To: Chaotian Jing , Ulf Hansson , Matthias Brugger , AngeloGioacchino Del Regno , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Wenbin Mei Cc: Chen-Yu Tsai , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, Frank Wunderlich , Andy-ld Lu Subject: [PATCH 2/2] mmc: mtk-sd: Limit getting top_base to SoCs that require it Date: Wed, 4 Dec 2024 17:28:53 +0800 Message-ID: <20241204092855.1365638-3-wenst@chromium.org> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog In-Reply-To: <20241204092855.1365638-1-wenst@chromium.org> References: <20241204092855.1365638-1-wenst@chromium.org> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently the mtk-sd driver tries to get and map the second register base, named top_base in the code, regardless of whether the SoC model actually has it or not. This produces confusing big error messages on the platforms that don't need it: mtk-msdc 11260000.mmc: error -EINVAL: invalid resource (null) Limit it to the platforms that actually require it, based on their device tree entries, and properly fail if it is missing. There is no MMC node in the MT6779 dts, so it's currently unknown if that platform needs it or not. Signed-off-by: Chen-Yu Tsai --- drivers/mmc/host/mtk-sd.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index e2c385853eef..1bb7044f4ca1 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -414,6 +414,7 @@ struct mtk_mmc_compatible { u8 clk_div_bits; bool recheck_sdio_irq; bool hs400_tune; /* only used for MT8173 */ + bool needs_top_base; u32 pad_tune_reg; bool async_fifo; bool data_tune; @@ -587,6 +588,7 @@ static const struct mtk_mmc_compatible mt7986_compat = { .clk_div_bits = 12, .recheck_sdio_irq = true, .hs400_tune = false, + .needs_top_base = true, .pad_tune_reg = MSDC_PAD_TUNE0, .async_fifo = true, .data_tune = true, @@ -627,6 +629,7 @@ static const struct mtk_mmc_compatible mt8183_compat = { .clk_div_bits = 12, .recheck_sdio_irq = false, .hs400_tune = false, + .needs_top_base = true, .pad_tune_reg = MSDC_PAD_TUNE0, .async_fifo = true, .data_tune = true, @@ -653,6 +656,7 @@ static const struct mtk_mmc_compatible mt8196_compat = { .clk_div_bits = 12, .recheck_sdio_irq = false, .hs400_tune = false, + .needs_top_base = true, .pad_tune_reg = MSDC_PAD_TUNE0, .async_fifo = true, .data_tune = true, @@ -2887,9 +2891,13 @@ static int msdc_drv_probe(struct platform_device *pdev) if (IS_ERR(host->base)) return PTR_ERR(host->base); - host->top_base = devm_platform_ioremap_resource(pdev, 1); - if (IS_ERR(host->top_base)) - host->top_base = NULL; + host->dev_comp = of_device_get_match_data(&pdev->dev); + + if (host->dev_comp->needs_top_base) { + host->top_base = devm_platform_ioremap_resource(pdev, 1); + if (IS_ERR(host->top_base)) + return PTR_ERR(host->top_base); + } ret = mmc_regulator_get_supply(mmc); if (ret) @@ -2951,7 +2959,6 @@ static int msdc_drv_probe(struct platform_device *pdev) msdc_of_property_parse(pdev, host); host->dev = &pdev->dev; - host->dev_comp = of_device_get_match_data(&pdev->dev); host->src_clk_freq = clk_get_rate(host->src_clk); /* Set host parameters to mmc */ mmc->ops = &mt_msdc_ops;