Received: by 10.223.176.5 with SMTP id f5csp1711207wra; Wed, 31 Jan 2018 10:20:56 -0800 (PST) X-Google-Smtp-Source: AH8x227msedPcQ2E5tlsShjXxHcvO50Mak3nSQzz85p1IXIma2/xaC6SKlrwhuRG4H9R4Z+sFFEL X-Received: by 10.99.124.94 with SMTP id l30mr26578980pgn.108.1517422856585; Wed, 31 Jan 2018 10:20:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517422856; cv=none; d=google.com; s=arc-20160816; b=vCagPtR3qgRkMN/0kcymBm54Tn2J1V8ayiSN69ag+CcdLAL9TBdiT/vcOBeV9C9cqe fRvfdG2jo//Vyl/vghIOTYX6UTwV0h/hb0hURWqk40xj89wCMogdN6ZIalAoKwPTVbux wFyonk71ljqwAA8gVbY7j3FP0+MuNPLAbKEEBbm+W78WwaA/nYcTqyNFdgWwBcZViwyr gw9l0GwrM18h1ltLrioRaBrEAhL9mGH8negHDVpUsA4Z62B3geWtNolL32bOqgeOzemC H8H6RcX3YElQdociYRjiMjZoQAvwaz6WyghWVNipR6zLMexwP2UzPQIbQ2bET5giBV1g x52g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=N8HtXJFZME7LEjsKkVcDMftgbQcVjUqLfq5PNSd1pMw=; b=0RqgXe7xBDaAFni0i3EqjCwVuMI1Jey/1mBA62WXkTsMC+XUbCjEoIIJPDP8mU963W h27KCTNTolRsfXyWM5J5bFaOo3bT3HjYTsg3DC6c4dZ0MmfP/IWP1snUFZXxiqZTwO2r Mx9Onayh6tkK1m1KIm8VirPvI1xtRzNbxWT7hCxTQrLatWmE76drCU4KCbtpbjEdMr0e dD73A7MrS3CpR/LYpNDrDFwEsmn18cMWrjgqrheSeuxitXN7aZXQTlvd1muH5zQrlzCE +LdfbtqKifx5/Mq42LzBLz74lsh6T0ICWBo3y6Ur2IbMbeMt/ADIzcj4pgqejF09hySy HL9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b34-v6si2061047plc.54.2018.01.31.10.20.41; Wed, 31 Jan 2018 10:20:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753039AbeAaSUT (ORCPT + 99 others); Wed, 31 Jan 2018 13:20:19 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:41158 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751700AbeAaSUS (ORCPT ); Wed, 31 Jan 2018 13:20:18 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EDE2F1529; Wed, 31 Jan 2018 10:20:17 -0800 (PST) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4C0D03F487; Wed, 31 Jan 2018 10:20:15 -0800 (PST) Date: Wed, 31 Jan 2018 18:20:12 +0000 From: Mark Rutland To: Jolly Shah Cc: ard.biesheuvel@linaro.org, mingo@kernel.org, gregkh@linuxfoundation.org, matt@codeblueprint.co.uk, sudeep.holla@arm.com, hkallweit1@gmail.com, keescook@chromium.org, dmitry.torokhov@gmail.com, michal.simek@xilinx.com, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Jolly Shah , Rajan Vaja Subject: Re: [PATCH v3 2/4] drivers: firmware: xilinx: Add ZynqMP firmware driver Message-ID: <20180131182012.oshjmvahetaizlbu@lakrids.cambridge.arm.com> References: <1516836074-4149-1-git-send-email-jollys@xilinx.com> <1516836074-4149-3-git-send-email-jollys@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1516836074-4149-3-git-send-email-jollys@xilinx.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 24, 2018 at 03:21:12PM -0800, Jolly Shah wrote: > This patch is adding communication layer with firmware. > Firmware driver provides an interface to firmware APIs. > Interface APIs can be used by any driver to communicate to > PMUFW(Platform Management Unit). All requests go through ATF. > +/** > + * zynqmp_pm_set_wakeup_source - PM call to specify the wakeup source > + * while suspended > + * @target: Node ID of the targeted PU or subsystem > + * @wakeup_node:Node ID of the wakeup peripheral > + * @enable: Enable or disable the specified peripheral as wake source > + * > + * Return: Returns status, either success or error+reason > + */ > +static int zynqmp_pm_set_wakeup_source(const u32 target, > + const u32 wakeup_node, > + const u32 enable) > +{ > + return invoke_pm_fn(PM_SET_WAKEUP_SOURCE, target, > + wakeup_node, enable, 0, NULL); > +} I see many functions take a "Node ID" parameter, but these don't appear to be in any DT binding, and drivers (other than the debugfs driver) aren't using them. What's the plan for making use of these? Where are the node IDs going to come from in practice? > +/** > + * zynqmp_pm_system_shutdown - PM call to request a system shutdown or restart > + * @type: Shutdown or restart? 0 for shutdown, 1 for restart > + * @subtype: Specifies which system should be restarted or shut down > + * > + * Return: Returns status, either success or error+reason > + */ > +static int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype) > +{ > + return invoke_pm_fn(PM_SYSTEM_SHUTDOWN, type, subtype, 0, 0, NULL); > +} PSCI already has this functionality, so I'm a little confused by the duplication. [...] > +/** > + * zynqmp_pm_get_node_status - PM call to request a node's current power state > + * @node: ID of the component or sub-system in question > + * @status: Current operating state of the requested node > + * @requirements: Current requirements asserted on the node, > + * used for slave nodes only. > + * @usage: Usage information, used for slave nodes only: > + * 0 - No master is currently using the node > + * 1 - Only requesting master is currently using the node > + * 2 - Only other masters are currently using the node > + * 3 - Both the current and at least one other master > + * is currently using the node These should probably have corresponding macros or enum values. [...] > +/** > + * zynqmp_pm_sha_hash - Access the SHA engine to calculate the hash > + * @address: Address of the data/ Address of output buffer where > + * hash should be stored. > + * @size: Size of the data. > + * @flags: > + * BIT(0) - Sha3 init (Here address and size inputs can be NULL) > + * BIT(1) - Sha3 update (address should holds the ) Missing "data", I guess? > + * BIT(2) - Sha3 final (address should hold the address of > + * buffer to store hash) Is the SHA engine coherent? Or is cache maintenance necessary? [...] > +/** > + * zynqmp_pm_pinctrl_request - Request Pin from firmware > + * @pin: Pin number to request > + * No DT binding for the pinctrl bits? [...] > +/** > + * zynqmp_pm_clock_enable - Enable the clock for given id > + * @clock_id: ID of the clock to be enabled > + * Likewise for the clocks? > +/** > + * get_eemi_ops - Get eemi ops functions > + * > + * Return: - pointer of eemi_ops structure > + */ > +const struct zynqmp_eemi_ops *get_eemi_ops(void) > +{ > + return &eemi_ops; > +} > +EXPORT_SYMBOL_GPL(get_eemi_ops); > + > +static int __init zynqmp_plat_init(void) > +{ > + struct device_node *np; > + int ret = 0; > + > + np = of_find_compatible_node(NULL, NULL, "xlnx,zynqmp"); > + if (!np) > + return 0; > + of_node_put(np); > + > + /* We're running on a ZynqMP machine, the PM node is mandatory. */ > + np = of_find_compatible_node(NULL, NULL, "xlnx,zynqmp-firmware"); > + if (!np) { > + pr_warn("%s: pm node not found\n", __func__); > + return -ENXIO; > + } > + > + ret = get_set_conduit_method(np); > + if (ret) { > + of_node_put(np); > + return ret; > + } > + > + /* Check PM API version number */ > + zynqmp_pm_get_api_version(&pm_api_version); > + if (pm_api_version != ZYNQMP_PM_VERSION) { > + panic("%s power management API version error. Expected: v%d.%d - Found: v%d.%d\n", > + __func__, > + ZYNQMP_PM_VERSION_MAJOR, ZYNQMP_PM_VERSION_MINOR, > + pm_api_version >> 16, pm_api_version & 0xffff); > + } > + > + pr_info("%s Power management API v%d.%d\n", __func__, > + ZYNQMP_PM_VERSION_MAJOR, ZYNQMP_PM_VERSION_MINOR); > + > + of_node_put(np); > + > + return ret; > +} > + > +early_initcall(zynqmp_plat_init); Why does this need to be an early initcall? Can't we probe this as a platform device? Thanks, Mark.