From patchwork Thu Nov 22 21:12:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Richard_R=C3=B6jfors?= X-Patchwork-Id: 1002025 X-Patchwork-Delegate: van.freenix@gmail.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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lz0ewvvd"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 431By718dJz9s1c for ; Fri, 23 Nov 2018 08:13:50 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id AD480C222C0; Thu, 22 Nov 2018 21:13:43 +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=FREEMAIL_FROM, 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 0775CC22214; Thu, 22 Nov 2018 21:13:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 37334C22259; Thu, 22 Nov 2018 21:12:28 +0000 (UTC) Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by lists.denx.de (Postfix) with ESMTPS id E2D98C221F8 for ; Thu, 22 Nov 2018 21:12:27 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id x85-v6so9020238ljb.2 for ; Thu, 22 Nov 2018 13:12:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=33sDC6QStJ4PsvwQ2IvAHz14rALoGDT2lJhsiUjUcQ0=; b=lz0ewvvdFt28YD8zf1FmzlkrBo44rzI3d32goQwfyLcH79EtsEstJPdp8b2FhlkV36 MQiDgSTgxfeiZH69ZTgC5BgV+WC/X9abVhuOkGuBtYfzZA3sV6iPN23nTxmOkfcoccRF NXS+L6jvB3T8d881d5W7q2zAbSeOzSyw3w+GZfv4Ovg1oXQowG1PCzrPBf41YVEwP+Mw 5pe5GavRcZjfDG1czy3jaqBXzb3+ImocCFRvz5dgd+G+rPMOu1M2AyTgZjjHNqKzR7yN cwZbAAdUHsrAfZSWxc//hbfuETxyVWwme2HLli9GgCQl6L7d0u21d1s3OdHLUDa0LjrF 9q7Q== 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:mime-version :content-transfer-encoding; bh=33sDC6QStJ4PsvwQ2IvAHz14rALoGDT2lJhsiUjUcQ0=; b=F3NfM2jLdQLhxinJO7KCr0myi8ciYjuWbWvpo4RHpsDp1m5de3ugXGirPDo36lvNMy EBiyN+Zme72fx3mt/CLTYe9ZA2wxhpsClDyvtM9pApKM7WYi6HbmjL5t056US6eodulx +JKG0GuQvvkSUPrplXXg1kpj63JOvMt/aS84diQP1UroXS39QOGe178Oy7TsiaJUhYuk zEtTjS8rThpNz+j0MFpO/iCdlXeCYWke1zG5qbIoi3RdwBcQNMPoo4FSw4xv9lH9KWEE yT/rwBmhkxsHvXiPRYKcJKP84R7tU21Xnu7ELqc9G8I47UhaJkc7VKRgl7zvLLHN5OKP 5Blw== X-Gm-Message-State: AA+aEWaTSsgcUe99+QWOf+O1gLSHULpqZg7YisWXRJTI/F+pUcn8Yk7f YfzFrZoCFNOLZf2VJsRYnqT+PBae X-Google-Smtp-Source: AFSGD/VldQ7SUfKlepXtN+LrGtOg4thNWg5NhqnH4e94qYeGyRIji53VmloVUFv1HsSKoCMJcq7PoA== X-Received: by 2002:a2e:917:: with SMTP id 23-v6mr7599977ljj.1.1542921146904; Thu, 22 Nov 2018 13:12:26 -0800 (PST) Received: from xellan.lan (82-209-144-86.cust.bredband2.com. [82.209.144.86]) by smtp.gmail.com with ESMTPSA id r29-v6sm6922038ljd.44.2018.11.22.13.12.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 13:12:26 -0800 (PST) From: "=?UTF-8?q?Richard=20R=C3=B6jfors?=" X-Google-Original-From: =?utf-8?q?Richard_R=C3=B6jfors?= To: u-boot@lists.denx.de Date: Thu, 22 Nov 2018 22:12:05 +0100 Message-Id: <20181122211205.14200-1-richard@puffinpack.se> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Cc: =?utf-8?q?Richard_R=C3=B6jfors?= Subject: [U-Boot] [PATCH] drivers: regulator: regulator-uclass: disallow disable of always-on 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" It does not make sense to allow disable of a regulator that is defined always on. I found this because the new mmc code that tests if the mmc power can be switched off. That results in the rk3288 firefly board to die since the regulator, which is always-on, is shared with more than just mmc. Signed-off-by: Richard Röjfors Reviewed-by: Philipp Tomsich --- drivers/power/regulator/regulator-uclass.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c index 4da8e43259..d5be6ef424 100644 --- a/drivers/power/regulator/regulator-uclass.c +++ b/drivers/power/regulator/regulator-uclass.c @@ -106,10 +106,15 @@ int regulator_get_enable(struct udevice *dev) int regulator_set_enable(struct udevice *dev, bool enable) { const struct dm_regulator_ops *ops = dev_get_driver_ops(dev); + struct dm_regulator_uclass_platdata *uc_pdata; if (!ops || !ops->set_enable) return -ENOSYS; + uc_pdata = dev_get_uclass_platdata(dev); + if (uc_pdata->always_on && !enable) + return -EINVAL; + return ops->set_enable(dev, enable); }