From patchwork Mon Feb 4 10:58:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Parent X-Patchwork-Id: 1035826 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="B2CQJOrW"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43tPq15QbXz9s3x for ; Mon, 4 Feb 2019 21:59:25 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 6D702C21F8F; Mon, 4 Feb 2019 10:59:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 87112C21F3A; Mon, 4 Feb 2019 10:58:54 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id ECEA5C21F02; Mon, 4 Feb 2019 10:58:52 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by lists.denx.de (Postfix) with ESMTPS id 85675C21E29 for ; Mon, 4 Feb 2019 10:58:52 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id y139so12576749wmc.5 for ; Mon, 04 Feb 2019 02:58:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8N4D8Ccifzn5JijIG2mLDNwENqW080AxsN1rgNM1+kY=; b=B2CQJOrWKKQ7woYY/3OjxUBfj9OkD0ZXeI+l2sDBIM6adZGiufNlqKZVX+zPn47dhm gS+wFOLP51cSDR+5mW0u/uw9+vWAqCjRZx74uQJ/rUEDtr9UO7R0ZeUatoIDNNbNtBcF kfafKFYuhGZ8EUE+w6XeqLhDfXTZlCpi4FJMC+08JOVvciergXznL+BnyyLxvmUEj8Ql 9rH7+VVX6ktOyxo+jteu7yQo60ncw0YwQebR0SuHAHU6/kaVTZ6dQzsSGoEIA//JlhdL bHEZ6Rz/NPyy5Z1VPhG5RKskPhlnl3pE4VnI7r3L6yiiKf+9JJnrPPh3zR62RWqKgtDY iBVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8N4D8Ccifzn5JijIG2mLDNwENqW080AxsN1rgNM1+kY=; b=NxGgEXvf5S2gYL9YWC9ZZTwiY3n9OUG7YtnpZRsM9Nl2Ndr3Dbbl9O0tGlaDSkHkoD Vknm8UA1FyFP6nHOraLz3xXmLsDdMW6TeZSUyEw8YDRAwpaiPGHuBzEhmMlwnhAXWr9e Iw23W5zqu6ERW17B1diid7L5wbqsFvEsjz7iYrTSa13KXCSMWoakoj8glrtwa7SFfddQ w+ccwvfZkBN1Fr8v0Olp+28RGUacUT+XeIgIyvyWkmGbc0CUjtGELYOGUOTf19Cw86Iu xNWm0lc31MKq3R9ocVmgeDEizpwF8Jrz48rFO7FR1w0WKMDtkE0ifHCWHnkYmzK3ExW+ x/mw== X-Gm-Message-State: AHQUAubaqBEy34scAnYcIryOO6UVd2yEMR+Noj2WUsxE/cMpcdKzZIRr lyn5smxWYjoMF4JN6cjyFI1Ry1XqAmk= X-Google-Smtp-Source: AHgI3IbMnWEA9RcIfcX1UT50EcoMrfflX+13Iu+8ZUv5f+6Brlw2/zc7Fc5tfq76sYJoZIA1qcHebw== X-Received: by 2002:a7b:c399:: with SMTP id s25mr13312628wmj.90.1549277931780; Mon, 04 Feb 2019 02:58:51 -0800 (PST) Received: from localhost.localdomain (aputeaux-684-1-8-223.w90-86.abo.wanadoo.fr. [90.86.125.223]) by smtp.gmail.com with ESMTPSA id e9sm16193217wro.16.2019.02.04.02.58.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Feb 2019 02:58:51 -0800 (PST) From: Fabien Parent To: u-boot@lists.denx.de Date: Mon, 4 Feb 2019 11:58:41 +0100 Message-Id: <20190204105846.26889-2-fparent@baylibre.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190204105846.26889-1-fparent@baylibre.com> References: <20190204105846.26889-1-fparent@baylibre.com> MIME-Version: 1.0 Cc: trini@konsulko.com, ryder.lee@mediatek.com, stephane.leprovost@mediatek.com, ccaione@baylibre.com, GSS_MTK_Uboot_upstream@mediatek.com Subject: [U-Boot] [PATCH 1/6] mmc: mtk-sd: add source_cg clock support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Some MediaTek SoC need an additional clock "source_cg". Enable this new clock. We reuse the same clock name as in the kernel. Signed-off-by: Fabien Parent Acked-by: Ryder Lee --- drivers/mmc/mtk-sd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c index d3f0778368..8573ea7430 100644 --- a/drivers/mmc/mtk-sd.c +++ b/drivers/mmc/mtk-sd.c @@ -247,7 +247,9 @@ struct msdc_host { struct msdc_compatible *dev_comp; struct clk src_clk; /* for SD/MMC bus clock */ + struct clk src_clk_cg; /* optional, MSDC source clock control gate */ struct clk h_clk; /* MSDC core clock */ + bool has_src_clk_cg; u32 src_clk_freq; /* source clock */ u32 mclk; /* mmc framework required bus clock */ @@ -1269,6 +1271,8 @@ static void msdc_ungate_clock(struct msdc_host *host) { clk_enable(&host->src_clk); clk_enable(&host->h_clk); + if (host->has_src_clk_cg) + clk_enable(&host->src_clk_cg); } static int msdc_drv_probe(struct udevice *dev) @@ -1332,6 +1336,10 @@ static int msdc_ofdata_to_platdata(struct udevice *dev) if (ret < 0) return ret; + ret = clk_get_by_name(dev, "source_cg", &host->src_clk_cg); /* optional */ + if (!ret) + host->has_src_clk_cg = true; + #if IS_ENABLED(DM_GPIO) gpio_request_by_name(dev, "wp-gpios", 0, &host->gpio_wp, GPIOD_IS_IN); gpio_request_by_name(dev, "cd-gpios", 0, &host->gpio_cd, GPIOD_IS_IN);