From patchwork Thu Jul 26 13:19:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 949647 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="Tx/8Bncq"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41bt445Twqz9ryl for ; Thu, 26 Jul 2018 23:19:47 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 7A43CC21DA1; Thu, 26 Jul 2018 13:19:40 +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=RCVD_IN_MSPIKE_H2, 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 CE8D1C21C2C; Thu, 26 Jul 2018 13:19:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2E0CFC21C2C; Thu, 26 Jul 2018 13:19:36 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by lists.denx.de (Postfix) with ESMTPS id 0DE4BC21BE5 for ; Thu, 26 Jul 2018 13:19:35 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id t13-v6so1686444wrv.12 for ; Thu, 26 Jul 2018 06:19:35 -0700 (PDT) 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; bh=liwMdt4UhaCO80LpYCE0zScnLEN4tqDTlzkSc4/VfV8=; b=Tx/8Bncq9y/2BjAF9y8IzJmYS7MctsvbU2l1q/Yzmn2py+i8JGafRieG7Iil4lkEOn GklZNlNyKTt8qId8idb1Tr82Oj2oVrOt0dR3xvwGr4ZZbIz+dcmMQhoUmuhfcccf/PQl 00DOYP50/rPklCDf7f4qbM+KRFlkVAUNzHHDPfVj1SUparFMy4sHQqE4hODQrqH7toQX Dx/WoaomH7te0vMBm+z/jT3xOh+nYoGhtPSo/nNE7q1DMHlBEtxIbKcY6lIqNhEPX/7o NrknTmD3waWA6SmyGL8mSctcys9FZ4w7/QpG1HykpZ0PJLEWmQit3UigAp2Cd67XkbH+ axWQ== 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; bh=liwMdt4UhaCO80LpYCE0zScnLEN4tqDTlzkSc4/VfV8=; b=JrWusag1mYJJUhnzMyEpPD4hifMikQcQ1cAKtGbYopvqfHTqjmHSHAoQSulMkf4UjQ 7BpyT9BSTqiraPOBUGQUzuUC5rdjlh7ca+IItCD3knko+CqHjATQP8DWeqUw5FgSUoO1 DHCtgjEy7VHcwOVGXg52sLJK6fSxCXZ5WZLlWx7Fj6fxtsCFktuIi27CRpvaLa0iljXp GERXmBLsLov6ZrYjCrrC0DptMM1TVX323w1GYGKuQt4oTzRmZJI9+T81SxP3yVv0MhqW GljsOlZ54mXyldruF8aO7DWKT/7KeXIJgvbsoFzEk9ICMKabiLDRp8p2FaerFoSnwmYy qa2g== X-Gm-Message-State: AOUpUlEY9xxUMkj628SyPe5LU2XrBcfD/2/mzehyU408yW8SeCQrojTz /V5tZ3TZuJPM4MgW4YV6W45BYQ== X-Google-Smtp-Source: AAOMgpd4Nl4MY61l3ilXhZ5c0hcQh2Qu7Hzkso/Pq3/N7mV4EyjNFFGEZ946hPp8WaaZuyjLYtvJqg== X-Received: by 2002:adf:8b01:: with SMTP id n1-v6mr1624957wra.282.1532611174605; Thu, 26 Jul 2018 06:19:34 -0700 (PDT) Received: from bender.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id s5-v6sm1970939wro.33.2018.07.26.06.19.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Jul 2018 06:19:33 -0700 (PDT) From: Neil Armstrong To: sjg@chromium.org Date: Thu, 26 Jul 2018 15:19:32 +0200 Message-Id: <1532611172-1476-1-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 2.7.4 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] clk: clk_set_default: accept no-op skip fields 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The Assigned Clock parents and rates misses the fact that a "0" entry can be passed to skip setting a parent or rate of an assigned clock as described in the Linux clock bindings at [1]. This patch simply skips the clock reparenting if the DT parsing returns -ENOENT and the clock rate setting if "0" is passed as clock rate. [1] https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/clock/clock-bindings.txt#L135 Fixes: f4fcba5c5baa "clk: implement clk_set_defaults()" Signed-off-by: Neil Armstrong Reviewed-by: Simon Glass --- drivers/clk/clk-uclass.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 419d451..2b15978 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -154,6 +154,10 @@ static int clk_set_default_parents(struct udevice *dev) for (index = 0; index < num_parents; index++) { ret = clk_get_by_indexed_prop(dev, "assigned-clock-parents", index, &parent_clk); + /* If -ENOENT, this is a no-op entry */ + if (ret == -ENOENT) + continue; + if (ret) { debug("%s: could not get parent clock %d for %s\n", __func__, index, dev_read_name(dev)); @@ -210,6 +214,10 @@ static int clk_set_default_rates(struct udevice *dev) goto fail; for (index = 0; index < num_rates; index++) { + /* If 0 is passed, this is a no-op */ + if (!rates[index]) + continue; + ret = clk_get_by_indexed_prop(dev, "assigned-clocks", index, &clk); if (ret) {