Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2421837imj; Mon, 18 Feb 2019 05:49:43 -0800 (PST) X-Google-Smtp-Source: AHgI3IaTl6MECPdkH/1yFJoB6pLWGc+Z9SlAbBM6dFkUZAHkuGpNTnDcUKA5Rgtz32AUXJmqodHG X-Received: by 2002:a17:902:2f:: with SMTP id 44mr17026374pla.44.1550497783497; Mon, 18 Feb 2019 05:49:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550497783; cv=none; d=google.com; s=arc-20160816; b=OeQ1jw4j/+NRwlAXOc56/sPOuya6fjkQy1aktzZyUXvMrM2uFQU2VciBgvmRQSkPWg WIgWFxR4z9B4h2DXOZrYopSdVr2lWo1aeb6jqPmZKtJL5ozejaa72Q716X7ddgTbcRxE mcxgyyN3pNPrCMfv/JOdAIfnhuST1GY/ueu3gndtKVfuYbvYuGBr9PoYSQkNlP3Gbmeu Wp82lK8YvfY2mIfAuJ892QklMV68h+3LCHSv2Hki++JXWxaeiebOylZ7jg3a2iAgaCoq HBG6YMlwiAh61l2Mrpha9vZK5/o/woUklFTjTvyKob6pX1LxgiGSrG4oFk4LlKZQiON/ IQ5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8m4O8CuuCCnKOwFfeBbPJOvDeqpey7rCq8aKF8MlCSs=; b=sTHxZdnUK5PCjj2AyVWoVW8V6GZSWrrOLhcrchC6NiwX+0HajecZepY3WXEj7hJ9zT w5NeL9ldVpn9EQKB06qYn1o5/yRirxrsSuhObWCWW4HthbxR/MaWLuNg20DpqGX3qWjz pQKoVGqkD6NsLlDkDEvSVmFFvMMmIJf4Xynqb7OwWieqG0EukxP0ZBlhlB7w7oZk14j+ 104lwB0atFEBlnLZj17jkqflZctZevL8rBkl2TWu7klY00obiFnj4hiZQ2qp2LC+JMpL fMEJGC60ntVeP7O6zNOkkq4KqNQIwVziZ85ggCGM803HSFSQI3d72Tlix9UXf6EFvj3U jBdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uFwktvsl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6si12423468pgs.211.2019.02.18.05.49.27; Mon, 18 Feb 2019 05:49:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uFwktvsl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731834AbfBRNry (ORCPT + 99 others); Mon, 18 Feb 2019 08:47:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:54552 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730139AbfBRNrv (ORCPT ); Mon, 18 Feb 2019 08:47:51 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 25D1F2190B; Mon, 18 Feb 2019 13:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550497670; bh=8uy7t/uNv2QrsmXMTl00U4uWKl+Op/d/BxfgH/yAz8Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uFwktvslNPtUwZ7MNdyMDbjqU85O0QY9EtEHYWTRRjzG1xTU8Dt/7MCNK2ZcPqCUi LDuMKwlcoIaIU2Jr4ftVuo3FPXFkGkjZF5BjeF7wZNAE5tfc3dxpPh+t7z/F8ULM1B kep5L7RGMt1bXxQKvif7ZABawxP47AZNrEp3XlZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Maxime Ripard , Ulf Hansson Subject: [PATCH 4.20 65/92] mmc: sunxi: Filter out unsupported modes declared in the device tree Date: Mon, 18 Feb 2019 14:43:08 +0100 Message-Id: <20190218133500.979167685@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133454.668268457@linuxfoundation.org> References: <20190218133454.668268457@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chen-Yu Tsai commit d6f11e7d91f2ac85f66194fe3ef8789b49901d64 upstream. The MMC device tree bindings include properties used to signal various signalling speed modes. Until now the sunxi driver was accepting them without any further filtering, while the sunxi device trees were not actually using them. Since some of the H5 boards can not run at higher speed modes stably, we are resorting to declaring the higher speed modes per-board. Regardless, having boards declare modes and blindly following them, even without proper support in the driver, is generally a bad thing. Filter out all unsupported modes from the capabilities mask after the device tree properties have been parsed. Cc: Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sunxi-mmc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- a/drivers/mmc/host/sunxi-mmc.c +++ b/drivers/mmc/host/sunxi-mmc.c @@ -1415,6 +1415,21 @@ static int sunxi_mmc_probe(struct platfo if (ret) goto error_free_dma; + /* + * If we don't support delay chains in the SoC, we can't use any + * of the higher speed modes. Mask them out in case the device + * tree specifies the properties for them, which gets added to + * the caps by mmc_of_parse() above. + */ + if (!(host->cfg->clk_delays || host->use_new_timings)) { + mmc->caps &= ~(MMC_CAP_3_3V_DDR | MMC_CAP_1_8V_DDR | + MMC_CAP_1_2V_DDR | MMC_CAP_UHS); + mmc->caps2 &= ~MMC_CAP2_HS200; + } + + /* TODO: This driver doesn't support HS400 mode yet */ + mmc->caps2 &= ~MMC_CAP2_HS400; + ret = sunxi_mmc_init_host(host); if (ret) goto error_free_dma;