From patchwork Fri Jul 10 15:50:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1326952 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=YH+/OWFe; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B3Hbp4Qmvz9sRN for ; Sat, 11 Jul 2020 01:52:06 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0D15782281; Fri, 10 Jul 2020 17:51:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="YH+/OWFe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4A45F82280; Fri, 10 Jul 2020 17:51:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1767982284 for ; Fri, 10 Jul 2020 17:51:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jagan@amarulasolutions.com Received: by mail-pg1-x542.google.com with SMTP id g67so2697715pgc.8 for ; Fri, 10 Jul 2020 08:51:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=omCpbeqcJPh1o1xXQNItUN/WxYdikkBt0s5WkGVn3zA=; b=YH+/OWFei9o2nGWHjMUyUXsWpn7/6c2xj57+lUhWv9of3Lb5cCbwng1K7QSpeTaFQT fCjPLHYiGUsq7bbPEz+booiNX3oWvGMuahV/waxHLbNi9ZQLYTxnXc6YPPMpEwRi056d oykXKehTDpKBO2l5SVHLD5JCLPkiykqO24bp4= 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=omCpbeqcJPh1o1xXQNItUN/WxYdikkBt0s5WkGVn3zA=; b=TosVSRrFxuLQKZqxb/KdkbA/EDuXNz7ipO4P7c8aRxU9vVNQ7XgGBt2a7ruFyBhwKz WYpU7Sje+vjSt9Naj5zqnFvFmAyOoFs1hUVwtqH01LEIfLmA0vxDOfR5Z39ZXSdm6U65 c5FCnHqG4dDsP5NIy2SkST1VnuWL7J2eDx0Ac8If0IEX0TZ1lP/te4S77DugYwmvdsCd 2mgvbyuFhOQhWd+Uqu3Y1wl+WaZIrpedXm9dEGNqKN4fuIukzNPzsc2qSqATQOwtdb/X HYQSTCwRKCUbIcPdQdFwjzlJbfpoC1VTloaKx3VMIlnNkMamlMxK3putZ+Ihd6pERwUX RjJw== X-Gm-Message-State: AOAM5306ltU/p71+ZIh7SFZBgU74nZgfuWc/Wpi4vpaCJ6BkCu5P9BST bC8nke457KUdkkT7xA2K4fDD8vf88fs= X-Google-Smtp-Source: ABdhPJyal76azwT55234MPOdNuDzkPe8SUnjem3+J682WfrOcQE0Xpc/0IDlcYVbI07Tf/A45oGh9A== X-Received: by 2002:aa7:9909:: with SMTP id z9mr57248971pff.139.1594396301649; Fri, 10 Jul 2020 08:51:41 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:a1d6:54e3:577a:ace0]) by smtp.gmail.com with ESMTPSA id lx2sm6398917pjb.16.2020.07.10.08.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 08:51:40 -0700 (PDT) From: Jagan Teki To: Kever Yang , Philipp Tomsich , Simon Glass Cc: Suniel Mahesh , U-Boot-Denx , linux-rockchip@lists.infradead.org, linux-amarula Subject: [PATCH v4 2/4] power: pmic: rk8xx: bind rk808 RTC Date: Fri, 10 Jul 2020 21:20:55 +0530 Message-Id: <20200710155057.310168-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710155057.310168-1-jagan@amarulasolutions.com> References: <20200710155057.310168-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean From: Suniel Mahesh RK808 PMIC is a multi functional device with an RTC. In order to access RTC, bind to its parent device i.e. RK808 PMIC. Signed-off-by: Suniel Mahesh Reviewed-by: Kever Yang --- Change for v4: - none drivers/power/pmic/rk8xx.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c index 195884bde9..aea9272f8a 100644 --- a/drivers/power/pmic/rk8xx.c +++ b/drivers/power/pmic/rk8xx.c @@ -25,6 +25,11 @@ static const struct pmic_child_info pmic_children_info[] = { { }, }; +static const struct pmic_child_info rtc_info[] = { + { .prefix = "rk808-rtc", .driver = "rk808_rtc"}, + { }, +}; + static int rk8xx_reg_count(struct udevice *dev) { return RK808_NUM_OF_REGS; @@ -60,7 +65,7 @@ static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len) #if CONFIG_IS_ENABLED(PMIC_CHILDREN) static int rk8xx_bind(struct udevice *dev) { - ofnode regulators_node; + ofnode regulators_node, rtc_node; int children; regulators_node = dev_read_subnode(dev, "regulators"); @@ -76,6 +81,18 @@ static int rk8xx_bind(struct udevice *dev) if (!children) debug("%s: %s - no child found\n", __func__, dev->name); + rtc_node = dev_read_subnode(dev, "rtc"); + if (!ofnode_valid(rtc_node)) { + debug("%s: %s rtc subnode not found!\n", __func__, dev->name); + return -ENXIO; + } + + debug("%s: '%s' - found rtc subnode\n", __func__, dev->name); + + children = pmic_bind_children(dev, rtc_node, rtc_info); + if (!children) + debug("%s: %s - no child found\n", __func__, dev->name); + /* Always return success for this device */ return 0; }