From nobody Wed Feb 5 14:56:47 2025 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 7BB7B22B8D1 for ; Tue, 10 Dec 2024 07:32:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733815943; cv=none; b=gRkirZW1ZSwvQUOUhXtp8NypWmXcVfwyUWGCIEYN/kBVmZLCYJKzh2A/rmtXUbBclI0KY8giIWucTomF29IO5BRrSUvfGeTmhzD5oWwgVay2hMeucWOV9rkziKQXcYeSqqVRQoJd6cuHrqGE4A3AGEHJcLyT29yE57odqMIJFxI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733815943; c=relaxed/simple; bh=hsirGFiU8BzwJ9k9bRXj/aFU0gO5K783nFnr1XHXDe4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X47Xl5nUVzSik8dFwKoapJf8DzfUxqDuGK+KSXfE4xTQusPvE5uhHN5zygqyVZxV83so117dffQ5pJt/cjiR4/hP+D5vixTc91LfNdIU/W0x8px1+iicJbI/ejxSR97erPWnHwBKZqwH+8qTpfGBtVeMolnK8+UN0BP99ztQgGs= 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=lppgcg9E; arc=none smtp.client-ip=209.85.214.173 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="lppgcg9E" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2161eb94cceso23072655ad.2 for ; Mon, 09 Dec 2024 23:32:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733815941; x=1734420741; 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=fU9h1qciZfo1eCFrj9RBOWdEPoZjJk9V1VI96TtLyqU=; b=lppgcg9E3wpJVG8vWlDCF3+oOe0ZFP9+e2+dkAGLqdwpnRp/a9Czf7o6P4VqnTQpqM wNcox/86N2wR+8S9IdkuDWepzl6qXBG0BkpOmEAC5SLbX+ahxGTHdgyYSB7rwKWgdyMc E0kwS23XrCdplorg3eDJ1mFoGBaZ0ttr7vDSA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733815941; x=1734420741; 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=fU9h1qciZfo1eCFrj9RBOWdEPoZjJk9V1VI96TtLyqU=; b=RVGfF4PEN+Wlebn4obouVA84RsDzWUx2jtPnaO2p8VYGJBL/8QZydlz/CvuIqX7OGI 32WPjevmjKkwSydFfFnx111IGSNHsRa3BhibVIWs0sYFcwPUlACASQnmlIZh/KNQDpvt rXeXEWQMwYFbw43bgPoBByPlXw5fZCNmMV20d9DLgZvMAuAOCXT+t8NZVIgnqM5eiXZw vo9i6YDqQuUXqWQSi1IU3wrI+nfuWFwwlRmuj79m4JNydgf4JWMp0llr3TBH1tjCZJnt DmTGdS1/4+YZux7EHsT+/27U+d/36oC9yorn0PiWMz2wYL8PPD9HeKrhS4GdVbIqtIvW 6yfA== X-Forwarded-Encrypted: i=1; AJvYcCWsYm8z+RDrm6ZucO0X1Ws7TnW16ITaa73e9WPMRnXzsOq6Pyv+9Yz/rsuKlmGmr78Z0cztFKK9abNY+pk=@vger.kernel.org X-Gm-Message-State: AOJu0YycSiW+7qfOjQs1/HWSmppfyCwm33THDdpM7+MwQgBMSxRqYfkS ebaqL+V4Kntu1HmOLtI4/gL59zwLzVf4d5Bj5l+STart+NiCbU0T1biL6QASNA== X-Gm-Gg: ASbGncvkjx2zxJ94iSUBhhfctQVppiKD7uaXK72RUVSk67MsmhuaZHrF9WpuVUcGV6O EUsSuIxyDI20fgE9d/ei9/fnReNQCctkkoyVkxYDXmCVpK1nOL8H0PkFgz7k4hyRoqlmFrVA6W+ 9r+2d7/tj2VEAB9eBbVafVn7mo9KjVsbIqsUPmAHUQZi7x1a4vErEx7oJbXwhqgGARdsDyvpRWT Xi0whDZSWFXKXZPvmM4zY77V3ymaiN9n1LGX2pGW5bOgQxGQL+QcMQ4GdEboB7krZXiyy3m X-Google-Smtp-Source: AGHT+IHPmON+PwbNAPPZYDE53KwGnbvTApGQhaNGbUZe2uB605PBpV+ZcftSN2qQ7es0oLZxPl5QBA== X-Received: by 2002:a17:902:ecc1:b0:216:3876:2cff with SMTP id d9443c01a7336-21638762fcamr152395915ad.54.1733815940983; Mon, 09 Dec 2024 23:32:20 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:89ce:2db9:f7d5:156d]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-215f8f09146sm83693295ad.199.2024.12.09.23.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 23:32:20 -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 v2 1/2] dt-bindings: mmc: mtk-sd: Document compatibles that need two register ranges Date: Tue, 10 Dec 2024 15:32:10 +0800 Message-ID: <20241210073212.3917912-2-wenst@chromium.org> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog In-Reply-To: <20241210073212.3917912-1-wenst@chromium.org> References: <20241210073212.3917912-1-wenst@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/mmc/mtk-sd.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml b/Documentat= ion/devicetree/bindings/mmc/mtk-sd.yaml index f86ebd81f5a5..0debccbd6519 100644 --- a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml +++ b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml @@ -235,11 +235,19 @@ allOf: properties: compatible: contains: - const: mediatek,mt8183-mmc + enum: + - mediatek,mt7986-mmc + - mediatek,mt7988-mmc + - mediatek,mt8183-mmc + - mediatek,mt8196-mmc then: properties: reg: minItems: 2 + else: + properties: + reg: + maxItems: 1 =20 - if: properties: --=20 2.47.0.338.g60cca15819-goog From nobody Wed Feb 5 14:56:47 2025 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 B417722E407 for ; Tue, 10 Dec 2024 07:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733815946; cv=none; b=ESD1tyfC5mkZyq+K6Qdv33JeFPgBC2DjJW/BhYVqiKOI0fTpYZljBYZEfFA6wOzI6B7KnfFH5PxdlPBjiWwa6CdrVAyv//S/uei99hNb0MNwDj4m0JlnoOt11QCdAPT94NDxOODxUaErbg17ztoqPkCc1znBk505vG1gl7hZGjg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733815946; c=relaxed/simple; bh=NOfDh6XWMXA3bQDZgyXinaVUDZBBis7f4DQlXXXEj18=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sPybOntjzjZ7UnmQzjfPp7EOw028vjM4Yr5gCynLHjyOcAt939jKzZt/cNs51bu6IxQcAAMB9yWq7d3f747qRFiF+C+rDO0jqk5BGoF0zZpDmrbnsk7oKV/jrn3Pypcz2EcAUJ7ihJ2tAUgIDvf7KXYsmpsQ7kPNelrLnDQcWz8= 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=nNRq3IaS; arc=none smtp.client-ip=209.85.214.170 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="nNRq3IaS" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-21644aca3a0so21283325ad.3 for ; Mon, 09 Dec 2024 23:32:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733815944; x=1734420744; 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=oIYaaljMW1uOvyE52JKpg1mRNjsi/3D4cn4UsNQnmlk=; b=nNRq3IaSCDLph7zpnboRZ1+zFRDvhhk7V0FKhrFDr39iKyHno9vLzL+r4PWE15tXP5 IS+2L49n+YGoPTZVK8axS49mFkGdK4HKUHbn5e0/Kv6RRj3DtKUH2L1Aq6Svrn8djXkf D4W7pHiLAxgjJMivWGHR9LiwWR5ZrgazL7Ar4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733815944; x=1734420744; 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=oIYaaljMW1uOvyE52JKpg1mRNjsi/3D4cn4UsNQnmlk=; b=wxkbpMEhR9D5uCqBoHSispCHu0VtuEhkWAG2Pr+OSyv7dQyU6rJJAdvWh8ylY18seR nJzhCZpU87VXr2AlmoywN1SpsqNxlgMs5sxO0k2g+bqejMRSyQ/EDZeWmNYH2DVTWR3p uqwh7j+uSn7heg0uo3PpnC57oz2Czq7Ngeg9+6llMLlXFvLizwPN0MfF5FQFqV+tXn66 FmR7R9JDsFOKeGUGOeRJoi7tWwr1yCvI4lfiVrODVGAtZgvegOD+sUaYr9Y3yF6VVtDb Yl5j9fSMgNztbBDXJdvO/KuSgb6XU0RwHY/4FLh+kHF7I+BlPc/nOeyKn7uBX6EfXtOh NIwA== X-Forwarded-Encrypted: i=1; AJvYcCU72MfgFmlbNDbXhFvZ3v2Y8wX9eK4A0kKou6TcjtmBPICfMNZgmnYeNvfEYseHUo5Vr9gcf/8bDo9TS+4=@vger.kernel.org X-Gm-Message-State: AOJu0Yyf6ppHUeBYLWZhkVxPPKFn9pMSfRS975NvE80BsoVy5zssXKHv gszjHwk9r4DWiMLa+ulamiKDMTB8yuhtjC6t15f+AJmwMwq7g3wE4xFHyKU8Kg== X-Gm-Gg: ASbGncvPkB7VScI0lxBwqvDP/vbZLX8EuEg0h1j2h5hxbaif/Vyx87/AGt0dMJKiQzH w8n+tg8y1CBwP493qDWi2AeAEcjxr6mkICt0OIDcCvB4hfyhgt5G1YXFk82MQIGhmTv2CelGnNm XL0b9cLFA5XZS+5MGnU8w/0Jn/n5jAX8o/xqliQZl9HgkpZ80wOM7fkyw5N7p7kq+hBLH99hdId U8YQyGsoE3Ch57RKe1K0zB2h6UhfA33Ziis4Hn+Nhu0Dd6QU9FcWNls0Dlo9kqq9Sgwx7lh X-Google-Smtp-Source: AGHT+IEljjpPjIkRAq9lZ+wjZ9Q+4usk5mFRZZW08ysh+jkDMPJ/btZlL9SUPYyzmbG9svkENmEq7A== X-Received: by 2002:a17:902:ce88:b0:216:55a1:35a with SMTP id d9443c01a7336-2166a0097c0mr55964065ad.30.1733815943958; Mon, 09 Dec 2024 23:32:23 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:89ce:2db9:f7d5:156d]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-215f8f09146sm83693295ad.199.2024.12.09.23.32.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 23:32:23 -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 v2 2/2] mmc: mtk-sd: Limit getting top_base to SoCs that require it Date: Tue, 10 Dec 2024 15:32:11 +0800 Message-ID: <20241210073212.3917912-3-wenst@chromium.org> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog In-Reply-To: <20241210073212.3917912-1-wenst@chromium.org> References: <20241210073212.3917912-1-wenst@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno --- 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 = =3D { .clk_div_bits =3D 12, .recheck_sdio_irq =3D true, .hs400_tune =3D false, + .needs_top_base =3D true, .pad_tune_reg =3D MSDC_PAD_TUNE0, .async_fifo =3D true, .data_tune =3D true, @@ -627,6 +629,7 @@ static const struct mtk_mmc_compatible mt8183_compat = =3D { .clk_div_bits =3D 12, .recheck_sdio_irq =3D false, .hs400_tune =3D false, + .needs_top_base =3D true, .pad_tune_reg =3D MSDC_PAD_TUNE0, .async_fifo =3D true, .data_tune =3D true, @@ -653,6 +656,7 @@ static const struct mtk_mmc_compatible mt8196_compat = =3D { .clk_div_bits =3D 12, .recheck_sdio_irq =3D false, .hs400_tune =3D false, + .needs_top_base =3D true, .pad_tune_reg =3D MSDC_PAD_TUNE0, .async_fifo =3D true, .data_tune =3D true, @@ -2887,9 +2891,13 @@ static int msdc_drv_probe(struct platform_device *pd= ev) if (IS_ERR(host->base)) return PTR_ERR(host->base); =20 - host->top_base =3D devm_platform_ioremap_resource(pdev, 1); - if (IS_ERR(host->top_base)) - host->top_base =3D NULL; + host->dev_comp =3D of_device_get_match_data(&pdev->dev); + + if (host->dev_comp->needs_top_base) { + host->top_base =3D devm_platform_ioremap_resource(pdev, 1); + if (IS_ERR(host->top_base)) + return PTR_ERR(host->top_base); + } =20 ret =3D mmc_regulator_get_supply(mmc); if (ret) @@ -2951,7 +2959,6 @@ static int msdc_drv_probe(struct platform_device *pde= v) msdc_of_property_parse(pdev, host); =20 host->dev =3D &pdev->dev; - host->dev_comp =3D of_device_get_match_data(&pdev->dev); host->src_clk_freq =3D clk_get_rate(host->src_clk); /* Set host parameters to mmc */ mmc->ops =3D &mt_msdc_ops; --=20 2.47.0.338.g60cca15819-goog