From patchwork Fri Jan 22 02:43:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 571437 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 05D7114017E for ; Fri, 22 Jan 2016 13:54:23 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=NfT2kWc8; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 34D1C4BC84; Fri, 22 Jan 2016 03:54:18 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id m_lYLq2_42fq; Fri, 22 Jan 2016 03:54:18 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B7CC24BEE5; Fri, 22 Jan 2016 03:51:05 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 43CF94BA81 for ; Fri, 22 Jan 2016 03:45:05 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id slJ5pnBZzteF for ; Fri, 22 Jan 2016 03:45:05 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ob0-f181.google.com (mail-ob0-f181.google.com [209.85.214.181]) by theia.denx.de (Postfix) with ESMTPS id 029044BB0D for ; Fri, 22 Jan 2016 03:44:23 +0100 (CET) Received: by mail-ob0-f181.google.com with SMTP id yo10so26966703obb.2 for ; Thu, 21 Jan 2016 18:44:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=5TpKZT7ZImIj/YSlEby/5j1143jE7z/Pf/ymEl7afc8=; b=NfT2kWc8XyCsEvXW2iHOHAab0mPCdZzIJogK6blwE3hJlcpMRD6uiDMugjWQVuSD6C T9mUXIYUGZo/Aq7STFf0tukmGyrAD/hNUhdPvGVigFqcPdOoNx3A+g8kc5PREfrLcG6U ptCMUDE9IVqNnXqwy/cz96/1fW33LijG9LpnSmrin/WFs6eyffcw6+fqyOJAzuV4Cr+7 G/iefdRCoMISsoxJnWqqKjK4Jvg+fFY7CT8YN+hP7cGVwDPUAOrkJTwv1sbKNu/8SS5U eI/dqD0umeBlQmstqOzPvhaYKyxOQ7nOhAwtwt7ZLFiqRJk54OMcrItFixbMTe/8EsZR 8IOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=5TpKZT7ZImIj/YSlEby/5j1143jE7z/Pf/ymEl7afc8=; b=aU+hclSioBnW739yo4+at2jl4URvqWMzS6jiPv/SLna1hvNMdQFRSIgJcNmRLdRmRc b4ku9fsxFnDXIBuojGDkjiYjRI4eWdoEVqiiGf837wDIjdsUdpaYfii7yDFZTfVXiKWp S7nvrcyShqytB/GhvaK3leLopi6IOYRLweHgbfzwmTTGW6C5RPrJYLWER8MFmvtRLNrT VLVgp2htjIAsELrPk969oF293gTItewnXOjrD4fnHgbMBkPKjgMP0FBHkiz6t5Il6X+i Y3CdYCScvdaHRyLX0nr9ZlYqMs2U9kST1QUIdY5yy9Lwx+jrUUg20DxG9jv0z5h2jDTh vUYg== X-Gm-Message-State: AG10YOTA4Cnpx/46Wo0HYF5IFrVUyJnZbSJ7w42VdlRY/SpxisfzbV0l3uePLpoHvg3N54c0 X-Received: by 10.182.106.13 with SMTP id gq13mr513876obb.38.1453430662502; Thu, 21 Jan 2016 18:44:22 -0800 (PST) Received: from kaki.bld.corp.google.com ([2620:0:1005:1100:c535:4833:2893:55c2]) by smtp.gmail.com with ESMTPSA id f9sm2095706obw.13.2016.01.21.18.44.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2016 18:44:21 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id D01C52216D8; Thu, 21 Jan 2016 19:44:18 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Thu, 21 Jan 2016 19:43:31 -0700 Message-Id: <1453430653-3280-8-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1453430653-3280-1-git-send-email-sjg@chromium.org> References: <1453430653-3280-1-git-send-email-sjg@chromium.org> Cc: Jeffy Chen Subject: [U-Boot] [PATCH v9 07/49] dm: Add a power sequencing uclass X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 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" Some devices need special sequences to be used when starting up. Add a uclass for this. Drivers can be added to provide specific features as needed. Signed-off-by: Simon Glass --- Changes in v9: None Changes in v2: None drivers/misc/Kconfig | 18 ++++++++++++++++++ drivers/misc/Makefile | 1 + drivers/misc/pwrseq-uclass.c | 24 ++++++++++++++++++++++++ include/dm/uclass-id.h | 1 + include/pwrseq.h | 18 ++++++++++++++++++ 5 files changed, 62 insertions(+) create mode 100644 drivers/misc/pwrseq-uclass.c create mode 100644 include/pwrseq.h diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index b92da4e..cba2363 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -90,6 +90,24 @@ config MXC_OCOTP Programmable memory pages that are stored on the some Freescale i.MX processors. +config PWRSEQ + bool "Enable power-sequencing drivers" + depends on DM + help + Power-sequencing drivers provide support for controlling power for + devices. They are typically referenced by a phandle from another + device. When the device is started up, its power sequence can be + initiated. + +config SPL_PWRSEQ + bool "Enable power-sequencing drivers for SPL" + depends on PWRSEQ + help + Power-sequencing drivers provide support for controlling power for + devices. They are typically referenced by a phandle from another + device. When the device is started up, its power sequence can be + initiated. + config PCA9551_LED bool "Enable PCA9551 LED driver" help diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index aa137f5..fc8eb6f 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -24,6 +24,7 @@ obj-$(CONFIG_MXC_OCOTP) += mxc_ocotp.o obj-$(CONFIG_MXS_OCOTP) += mxs_ocotp.o obj-$(CONFIG_NS87308) += ns87308.o obj-$(CONFIG_PDSP188x) += pdsp188x.o +obj-$(CONFIG_$(SPL_)PWRSEQ) += pwrseq-uclass.o obj-$(CONFIG_SANDBOX) += reset_sandbox.o ifdef CONFIG_DM_I2C obj-$(CONFIG_SANDBOX) += i2c_eeprom_emul.o diff --git a/drivers/misc/pwrseq-uclass.c b/drivers/misc/pwrseq-uclass.c new file mode 100644 index 0000000..8ed2ad4 --- /dev/null +++ b/drivers/misc/pwrseq-uclass.c @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2015 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include + +int pwrseq_set_power(struct udevice *dev, bool enable) +{ + struct pwrseq_ops *ops = pwrseq_get_ops(dev); + + if (!ops->set_power) + return -ENOSYS; + + return ops->set_power(dev, enable); +} + +UCLASS_DRIVER(pwrseq) = { + .id = UCLASS_PWRSEQ, + .name = "pwrseq", +}; diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index a0a3a79..b5f43ae 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -51,6 +51,7 @@ enum uclass_id { UCLASS_PINCTRL, /* Pinctrl (pin muxing/configuration) device */ UCLASS_PINCONFIG, /* Pin configuration node device */ UCLASS_PMIC, /* PMIC I/O device */ + UCLASS_PWRSEQ, /* Power sequence device */ UCLASS_REGULATOR, /* Regulator device */ UCLASS_RESET, /* Reset device */ UCLASS_REMOTEPROC, /* Remote Processor device */ diff --git a/include/pwrseq.h b/include/pwrseq.h new file mode 100644 index 0000000..b934f29 --- /dev/null +++ b/include/pwrseq.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2013 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __pwrseq_h +#define __pwrseq_h + +struct pwrseq_ops { + int (*set_power)(struct udevice *dev, bool enable); +}; + +#define pwrseq_get_ops(dev) ((struct pwrseq_ops *)(dev)->driver->ops) + +int pwrseq_set_power(struct udevice *dev, bool enable); + +#endif