Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp669405pxu; Fri, 11 Dec 2020 11:16:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8FNc1xs0ZVq+bb73N9xiS0K2K+bSXKAuP6OYV6t+bsbg1Gq1vCsGiS39+mmrYHng62G3U X-Received: by 2002:a17:906:2b50:: with SMTP id b16mr12000685ejg.255.1607714167402; Fri, 11 Dec 2020 11:16:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607714167; cv=none; d=google.com; s=arc-20160816; b=SoxVtuTFV2nEmDL5KGOudS250wlRb3nCoMVrtyjg/Za6VvXBXOGr9M+dm5HCrOAXr9 iHwPTVscSddixZOVJN9XlHjtyc1KXvefRN7HsXr2YYsSb0PWkRBVEYCJudXqwGuBcMrb CSG7+S+qg/L5ogPHUpXHbbsNaAGOFV4w1pV47RX1RZA8TYyk4w6HvTQZoneBQz0wEugW l9OSV+8iY332XcCM2f10SrcsLa+oJq27mgfrJAsLK20zjK7SbU+LOwhc6svYMHYfkcnn skaj4dALZmQC6+ytewaUfj88o3jP9K7BttpHjNS3qQxJTYf4GzK5tdCuERndYoIV2tkC j8ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8EDSgNyu6IgaeBQKoeFyD6qLBqoz4cEoQmcNe8L/mqU=; b=AQcXa2f69eeTxV3XgO4ssRQ8PivcrRtO0B8qXUWbmorUC5gpEYDraSA/+fJn1yfIEA K7p81BduQCwTC1qMPA8AFN2xDZmNa+D2EMprKQg/1bALDb5DL3t71da0+8Wt1Hln7GKJ TSDVX0hOhVBhpFbEbrld+5h648zFrDiOliiJuqta1mz16T8D7J1PXFCF1aBdzE2GEru8 lOSqFUPbgW5T3G+B1NQAGj+eIM8Lr5Acq2yZ5FSxg3JatOuTjQa0kngNPFVCRcNpkEm/ 31f0uRno2PMGGPRRFlR7fyeT4Tmr0Lm8a7rKKlYaXu6tiLGPQVcls7gzXZOmmKhr/ZGs 8+MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xovfjv2e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n8si5010874edy.54.2020.12.11.11.15.44; Fri, 11 Dec 2020 11:16:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xovfjv2e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437074AbgLKSu2 (ORCPT + 99 others); Fri, 11 Dec 2020 13:50:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436794AbgLKStK (ORCPT ); Fri, 11 Dec 2020 13:49:10 -0500 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2348FC0611CA for ; Fri, 11 Dec 2020 10:48:36 -0800 (PST) Received: by mail-lj1-x22f.google.com with SMTP id q8so12019129ljc.12 for ; Fri, 11 Dec 2020 10:48:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8EDSgNyu6IgaeBQKoeFyD6qLBqoz4cEoQmcNe8L/mqU=; b=Xovfjv2eUSzSO44meUSG4hzRoVIBRQkhuv4mNlvZ8xHhln76wJF5HYI9mbOIwOxX4s Svqrn2IdOqCmMHtbOhTzR1htB8j9u1CuVLMQoAL+np9GOa/0EoRBivpwhqtOCvV8t7+A 6BxTF9mIANhGnfxLJcQH5AsHMiUR7qJ6R0XnIOW1yYzsW7cuUcimT3PJ+D5aE3esLrFJ kNBkmlkBtQXOZtyw71y3ucfYEVzd0GQY0x88gYGD3aJVFdrKPSxx4xS/rQHoGEXHsa5G jbfiQgqD0QV4+8iPhmzaWcKap6MIrPhbBX4+2RE8n+YyNHjCFF59egFY2pubmQhTEAiS recw== 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=8EDSgNyu6IgaeBQKoeFyD6qLBqoz4cEoQmcNe8L/mqU=; b=tIgLax60p6aaGxxKeQuACxdQDJ+KGVN/LzmHvbs6gzYnmwfDSPvev716fYDhxL+lty a09WjdmXa2fgYClkDl2UWj/F2ftApRMjD/XCazqSHYqHosSArh3LAPty7nKPHAMc1Kxm ZAM0mvKktTwzJSqo4Z/84err3mF7kDa80PLXtZdgBw7X3T8BAjy/5vst3tM/5gWPNizR btakc+ahBQL6bkHVrM+zzA/jhs/GFUUgJFJVJiERbhE18SHQJ/H08NcuLX6MVay8aFbp eHBzHiQc5Hb4V3wbWdfd4o22YUJRQ7lxQskDTRzscWphsmZwqY5p01Z/ogTJbyBrWkpx o2Cg== X-Gm-Message-State: AOAM533C4xNpnKO3JkDsBPT0b6lU2Z7jESn7DawGjhOqPVONtjlsGZJ9 ntanU9XTF4nLAZpjUkAbmvIifg== X-Received: by 2002:a2e:86d1:: with SMTP id n17mr4291920ljj.120.1607712514591; Fri, 11 Dec 2020 10:48:34 -0800 (PST) Received: from gilgamesh.semihalf.com (193-106-246-138.noc.fibertech.net.pl. [193.106.246.138]) by smtp.gmail.com with ESMTPSA id b12sm903316lfb.139.2020.12.11.10.48.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Dec 2020 10:48:34 -0800 (PST) From: Grzegorz Jaszczyk To: ssantosh@kernel.org, s-anna@ti.com Cc: grzegorz.jaszczyk@linaro.org, santosh.shilimkar@oracle.com, lee.jones@linaro.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, praneeth@ti.com, tony@atomide.com, linux-remoteproc@vger.kernel.org, mathieu.poirier@linaro.org Subject: [PATCH 4/6] soc: ti: pruss: Add helper functions to set GPI mode, MII_RT_event and XFR Date: Fri, 11 Dec 2020 19:48:09 +0100 Message-Id: <20201211184811.6490-5-grzegorz.jaszczyk@linaro.org> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20201211184811.6490-1-grzegorz.jaszczyk@linaro.org> References: <20201211184811.6490-1-grzegorz.jaszczyk@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suman Anna The PRUSS CFG module is represented as a syscon node and is currently managed by the PRUSS platform driver. Add easy accessor functions to set GPI mode, MII_RT event enable/disable and XFR (XIN XOUT) enable/disable to enable the PRUSS Ethernet usecase. These functions reuse the generic pruss_cfg_update() API function. Signed-off-by: Suman Anna Co-developed-by: Grzegorz Jaszczyk Signed-off-by: Grzegorz Jaszczyk --- include/linux/pruss.h | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/include/linux/pruss.h b/include/linux/pruss.h index 9cef536c6cb5..c8d73cc6baa9 100644 --- a/include/linux/pruss.h +++ b/include/linux/pruss.h @@ -235,4 +235,59 @@ static inline bool is_pru_rproc(struct device *dev) return true; } +/** + * pruss_cfg_gpimode() - set the GPI mode of the PRU + * @pruss: the pruss instance handle + * @pru_id: id of the PRU core within the PRUSS + * @mode: GPI mode to set + * + * Sets the GPI mode for a given PRU by programming the + * corresponding PRUSS_CFG_GPCFGx register + * + * Return: 0 on success, or an error code otherwise + */ +static inline int pruss_cfg_gpimode(struct pruss *pruss, + enum pruss_pru_id pru_id, + enum pruss_gpi_mode mode) +{ + if (pru_id < 0 || pru_id >= PRUSS_NUM_PRUS) + return -EINVAL; + + return pruss_cfg_update(pruss, PRUSS_CFG_GPCFG(pru_id), + PRUSS_GPCFG_PRU_GPI_MODE_MASK, + mode << PRUSS_GPCFG_PRU_GPI_MODE_SHIFT); +} + +/** + * pruss_cfg_miirt_enable() - Enable/disable MII RT Events + * @pruss: the pruss instance + * @enable: enable/disable + * + * Enable/disable the MII RT Events for the PRUSS. + * + * Return: 0 on success, or an error code otherwise + */ +static inline int pruss_cfg_miirt_enable(struct pruss *pruss, bool enable) +{ + u32 set = enable ? PRUSS_MII_RT_EVENT_EN : 0; + + return pruss_cfg_update(pruss, PRUSS_CFG_MII_RT, + PRUSS_MII_RT_EVENT_EN, set); +} + +/** + * pruss_cfg_xfr_enable() - Enable/disable XIN XOUT shift functionality + * @pruss: the pruss instance + * @enable: enable/disable + * + * Return: 0 on success, or an error code otherwise + */ +static inline int pruss_cfg_xfr_enable(struct pruss *pruss, bool enable) +{ + u32 set = enable ? PRUSS_SPP_XFER_SHIFT_EN : 0; + + return pruss_cfg_update(pruss, PRUSS_CFG_SPP, + PRUSS_SPP_XFER_SHIFT_EN, set); +} + #endif /* __LINUX_PRUSS_H */ -- 2.29.0