From patchwork Mon Feb 4 15:53:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 157436 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4070556jaa; Mon, 4 Feb 2019 07:57:06 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibdv/H9e1CSrK5+fIJfDhRpgQrsn3YWjLvigaYEbFzrbG/JGcxm40M6Vv84h3LwmxEJIeU2 X-Received: by 2002:aa7:81d0:: with SMTP id c16mr25929pfn.153.1549295826183; Mon, 04 Feb 2019 07:57:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549295826; cv=none; d=google.com; s=arc-20160816; b=G5ycavKJXY+kZv3fYTc4GZRWXA6EIhCW2FAl9YTTxg2cdv6UACgu6mmYGhq0QEV2XK DSijmwIDhzUOC+z0g/vdn6Y9ufTZtsVayH+ZVLHyI88k6nVAA8zSmvjbJdn4kdeAjWnl cWgT9CjHiLuN7v7dQTgrXIWi6gkwZvfev8wdOZyzVLvIGH34Kp97l+yaT3e44z3tMUK1 3vJzpZTUxJXQQg3F/+ynj9qlwSZGd56RphbGaA2Kb8tpy06Qq5j/q8wQqkYz8nlF5uZW /2lMa66RfLYkY0CXtSY85BFgkewgJgnqV46C9VcDGrGUhXFMFIfj8MllnWWUqzm3xzal lSdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=sRfewLSOCmw7X5qCkG4/3mIaDUuGix6nNN9Q8VQTNZM=; b=sWloutOoP1/R5zdwXwOObJRWafmwIFsbfQvwShSdx1hTUVvUmo/gwm7+UCeTOG4GIb bxvswO4xdFW9exHq2VzUHJvwJ0CGf2cR5XNGiAqg+8oKP4VpKn1HL0ml/UszTGhHxPQD mk5oANKvinFU7N8NG+qoJXRZyiZC6FfITvf2higQsJAtFEQdDLMuWMaepPQLUsQV8Jeh Wyoqp9C66yZy6ufy+9wmnRxL36tjOJtwlA0/+0uuyIyPlGafCYU9YAjtfgK+CS+nbDwF Wlz9oWQQwdBttWUhNRRyb6W8M+5IJtiwcGpYxPQKHPyTKr8bkkweD6gDs9oWIP5egJol SQKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ikogvVIe; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x74si372395pfe.23.2019.02.04.07.57.05; Mon, 04 Feb 2019 07:57:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ikogvVIe; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731569AbfBDP5F (ORCPT + 5 others); Mon, 4 Feb 2019 10:57:05 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:58004 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731564AbfBDP5F (ORCPT ); Mon, 4 Feb 2019 10:57:05 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x14FsClj058478; Mon, 4 Feb 2019 09:54:12 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1549295652; bh=sRfewLSOCmw7X5qCkG4/3mIaDUuGix6nNN9Q8VQTNZM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ikogvVIeA3JC9x0NIyrI7heL35FKKtW68Wzv7wehJbObbgbFK5Wur8uLWZ5L6xGNx apelH7Ln4bZerE3iwWsfdzThxtipE1iGqj8gwZaKzqLcNU0q/RsZOe0irXWyQi6PZF k8hIRZFyc9iMNqg6Sxvw5k9pw/WnhbE/hm8bPuWg= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x14FsBJt087388 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 4 Feb 2019 09:54:12 -0600 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Mon, 4 Feb 2019 09:54:11 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Mon, 4 Feb 2019 09:54:11 -0600 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x14Fs1mN012077; Mon, 4 Feb 2019 09:54:08 -0600 From: Roger Quadros To: CC: , , , , , , , , , , , Roger Quadros Subject: [PATCH 2/4] bus: ti-sysc: Add support for PRUSS SYSC type Date: Mon, 4 Feb 2019 17:53:55 +0200 Message-ID: <1549295637-24890-3-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549295637-24890-1-git-send-email-rogerq@ti.com> References: <1549295637-24890-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org The PRUSS module has a SYSCFG which is unique. Add support for it. Signed-off-by: Roger Quadros --- drivers/bus/ti-sysc.c | 77 +++++++++++++++++++++++++++++++++++ include/dt-bindings/bus/ti-sysc.h | 11 ----- include/linux/platform_data/ti-sysc.h | 1 + 3 files changed, 78 insertions(+), 11 deletions(-) -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c index f94d335..5b9c81a 100644 --- a/drivers/bus/ti-sysc.c +++ b/drivers/bus/ti-sysc.c @@ -622,6 +622,50 @@ static void sysc_show_registers(struct sysc *ddata) buf); } +static int sysc_enable_pruss(struct sysc *sysc) +{ + int i; + u32 reg; + bool ready; + + /* configure for Smart Idle & Smart Standby */ + reg = sysc_read(sysc, sysc->offsets[SYSC_SYSCONFIG]); + reg &= ~(SYSC_PRUSS_STANDBY_MASK | SYSC_PRUSS_IDLE_MASK); + reg |= SYSC_PRUSS_STANDBY_SMART | SYSC_IDLE_SMART; + sysc_write(sysc, sysc->offsets[SYSC_SYSCONFIG], reg); + + /* bring out of Standby */ + reg = sysc_read(sysc, sysc->offsets[SYSC_SYSCONFIG]); + reg &= ~SYSC_PRUSS_STANDBY_INIT; + sysc_write(sysc, sysc->offsets[SYSC_SYSCONFIG], reg); + + /* wait till we are ready for transactions - delay is arbitrary */ + for (i = 0; i < 10; i++) { + reg = sysc_read(sysc, sysc->offsets[SYSC_SYSCONFIG]); + ready = !(reg & SYSC_PRUSS_SUB_MWAIT); + if (ready) + break; + udelay(5); + } + + if (!ready) { + dev_err(sysc->dev, "not ready for transaction\n"); + return -ETIMEDOUT; + } + + return 0; +} + +static void sysc_disable_pruss(struct sysc *sysc) +{ + u32 reg; + + /* initiate Standby */ + reg = sysc_read(sysc, sysc->offsets[SYSC_SYSCONFIG]); + reg |= SYSC_PRUSS_STANDBY_INIT; + sysc_write(sysc, sysc->offsets[SYSC_SYSCONFIG], reg); +} + static int __maybe_unused sysc_runtime_suspend(struct device *dev) { struct ti_sysc_platform_data *pdata; @@ -649,6 +693,9 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev) goto idled; } + if (ddata->cap->type == TI_SYSC_PRUSS) + sysc_disable_pruss(ddata); + for (i = 0; i < ddata->nr_clocks; i++) { if (IS_ERR_OR_NULL(ddata->clocks[i])) continue; @@ -704,6 +751,9 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev) return error; } + if (ddata->cap->type == TI_SYSC_PRUSS) + sysc_enable_pruss(ddata); + awake: ddata->enabled = true; @@ -1573,6 +1623,26 @@ static const struct sysc_capabilities sysc_dra7_mcan = { .regbits = &sysc_regbits_dra7_mcan, }; +/* + * PRUSS on AM33x and later + */ +static const struct sysc_regbits sysc_regbits_pruss = { + .midle_shift = -ENODEV, + .clkact_shift = -ENODEV, + .sidle_shift = -ENODEV, + .enwkup_shift = -ENODEV, + .srst_shift = -ENODEV, + .autoidle_shift = -ENODEV, + .dmadisable_shift = -ENODEV, + .emufree_shift = -ENODEV, +}; + +static const struct sysc_capabilities sysc_pruss = { + .type = TI_SYSC_PRUSS, + .sysc_mask = SYSC_PRUSS_STANDBY_INIT | SYSC_PRUSS_SUB_MWAIT, + .regbits = &sysc_regbits_pruss, +}; + static int sysc_init_pdata(struct sysc *ddata) { struct ti_sysc_platform_data *pdata = dev_get_platdata(ddata->dev); @@ -1702,6 +1772,10 @@ static int sysc_probe(struct platform_device *pdev) INIT_DELAYED_WORK(&ddata->idle_work, ti_sysc_idle); + /* FIXME: how to ensure PRUSS stays enabled? */ + if (ddata->cap->type == TI_SYSC_PRUSS) + goto skip_pm_put; + /* At least earlycon won't survive without deferred idle */ if (ddata->cfg.quirks & (SYSC_QUIRK_NO_IDLE_ON_INIT | SYSC_QUIRK_NO_RESET_ON_INIT)) { @@ -1710,6 +1784,8 @@ static int sysc_probe(struct platform_device *pdev) pm_runtime_put(&pdev->dev); } +skip_pm_put: + if (!of_get_available_child_count(ddata->dev->of_node)) reset_control_assert(ddata->rsts); @@ -1766,6 +1842,7 @@ static const struct of_device_id sysc_match[] = { { .compatible = "ti,sysc-usb-host-fs", .data = &sysc_omap4_usb_host_fs, }, { .compatible = "ti,sysc-dra7-mcan", .data = &sysc_dra7_mcan, }, + { .compatible = "ti,sysc-pruss", .data = &sysc_pruss, }, { }, }; MODULE_DEVICE_TABLE(of, sysc_match); diff --git a/include/dt-bindings/bus/ti-sysc.h b/include/dt-bindings/bus/ti-sysc.h index 8ec78e8..7138384 100644 --- a/include/dt-bindings/bus/ti-sysc.h +++ b/include/dt-bindings/bus/ti-sysc.h @@ -17,17 +17,6 @@ #define SYSC_DRA7_MCAN_ENAWAKEUP (1 << 4) -/* SYSCONFIG specific to PRUSS */ -#define SYSC_PRUSS_SUB_MWAIT (1 << 5) -#define SYSC_PRUSS_STANDBY_INIT (1 << 4) - -#define SYSC_PRUSS_STANDBY_FORCE (0 << 2) -#define SYSC_PRUSS_STANDBY_NO (1 << 2) -#define SYSC_PRUSS_STANDBY_SMART (2 << 2) -#define SYSC_PRUSS_STANDBY_MASK (3 << 2) - -#define SYSC_PRUSS_IDLE_MASK 3 - /* SYSCONFIG STANDBYMODE/MIDLEMODE/SIDLEMODE supported by hardware */ #define SYSC_IDLE_FORCE 0 #define SYSC_IDLE_NO 1 diff --git a/include/linux/platform_data/ti-sysc.h b/include/linux/platform_data/ti-sysc.h index 1ea3aab..56098e7 100644 --- a/include/linux/platform_data/ti-sysc.h +++ b/include/linux/platform_data/ti-sysc.h @@ -15,6 +15,7 @@ enum ti_sysc_module_type { TI_SYSC_OMAP4_MCASP, TI_SYSC_OMAP4_USB_HOST_FS, TI_SYSC_DRA7_MCAN, + TI_SYSC_PRUSS, }; struct ti_sysc_cookie { From patchwork Mon Feb 4 15:53:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 157434 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4068724jaa; Mon, 4 Feb 2019 07:55:16 -0800 (PST) X-Google-Smtp-Source: AHgI3IbMVJA+DMPT+8fl/khcLeB3WpXg210ZuDSl7H23+elLDdGsyBD9sMdieDnXfebbvHlpd37c X-Received: by 2002:a63:bd1a:: with SMTP id a26mr23761pgf.121.1549295716255; Mon, 04 Feb 2019 07:55:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549295716; cv=none; d=google.com; s=arc-20160816; b=MHUDyD0Xj4OhXmZY80HvDricqNPCUaBv0R7loXf+oqSGu13sAu4HRd/ltyncjcY+vo DgKIG4ZxpWyrmkr9pMFy+l60TMO9fmCg9tSh7tqx9g0xQ5GlaBGTNzkVhLjOuA1cQ80t 984HesrWxe4zUI8tkDbFma9w8j6pxxaP+DJklgsQDUOIvREL0GpNkjHPrwCIWE3RUQil pwYApsqaaVfZAEIAetb1OGRvS8Ffz0Fj7uYUneXZTEDX43f2LEWsMA3/6y0Fnn9Br/DG KovaD2gW5QfoHsWvQbLNziIsqZj0K+iNLG1ZeJjsOqMAIAVhXIoD2AasrhH/p+pO8B/B u8+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=BiXMQuMZ9eiNysfRIHNum8sRRwJ1Hp4E3fwt8m4C9Ww=; b=OelZb3LD6S8pNmuNIcIDxhw2t3sILtYEzVRBmsqgxqlwtiRruUXhOXJ4S7Wyjxhf5J OcXi9sMxX26QgjU2VtuNyrkIzWTZt4A4hgT7ZJsfUdwSAEguMb4F/lCrpPyLG42EDpVI B05g7ClcR2TyK0sxDNzwB89ES33oDTFIoesO2mdipAHFgUwthypdYSxxc3MoneI7y+zE A54kGvFkEZA079J8+rPwzf6OixWwRoif7ClNTxTV3zqopQdwt/QlzuscY2WWIUXutSTv FIa+BXbBt1sd2UW8euKJwkWPR0d5ZZJAZiIWdW1pyNElGT9PauvS32MOeeXWf1wH7nJq wQPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=NVAj96Su; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j63si324333pgc.109.2019.02.04.07.55.16; Mon, 04 Feb 2019 07:55:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=NVAj96Su; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728252AbfBDPzP (ORCPT + 5 others); Mon, 4 Feb 2019 10:55:15 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:46378 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728760AbfBDPzO (ORCPT ); Mon, 4 Feb 2019 10:55:14 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x14FsMGq119417; Mon, 4 Feb 2019 09:54:22 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1549295662; bh=BiXMQuMZ9eiNysfRIHNum8sRRwJ1Hp4E3fwt8m4C9Ww=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=NVAj96SuPPmLr+hnpwmLPHpqX9vHHSuFc7tkFW6m4JY53WK2RiuZJ2uc1RP4GlZUZ OTPWPz3dLUaaSQ5T0nN18HMNZEw/kXhxa5JeJpoMvOPUQ7YKUxs/6CYvo5+by93e2m oxpG9Nen5tgiBlXkC4A+7SyZgOeFTydt5oBIqPhE= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x14FsM8W112040 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 4 Feb 2019 09:54:22 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Mon, 4 Feb 2019 09:54:17 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Mon, 4 Feb 2019 09:54:17 -0600 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x14Fs1mP012077; Mon, 4 Feb 2019 09:54:14 -0600 From: Roger Quadros To: CC: , , , , , , , , , , , Roger Quadros Subject: [PATCH 4/4] ARM: dts: am57xx-idk-common: Enable PRU-ICSS nodes Date: Mon, 4 Feb 2019 17:53:57 +0200 Message-ID: <1549295637-24890-5-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549295637-24890-1-git-send-email-rogerq@ti.com> References: <1549295637-24890-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Suman Anna The two PRU-ICSS processor subsystem bus nodes and their corresponding subsystem nodes were left in disabled state in the base dra7.dts file. The PRU-ICSSs are supported on only the AM57xx SoCs, so enable these nodes (both PRU-ICSS1 and PRU-ICSS2 instances) to support them on all the AM571x, AM572x and AM574x IDK boards. The PRU nodes are already enabled in the base dts file, and so become effective automatically with the enabling of these PRU-ICSS nodes. The corresponding PRU nodes can be disabled later on if there are no use-cases defined to use a particular PRU core or the whole PRU-ICSS subsystem itself if both its PRU cores are unused. Signed-off-by: Suman Anna Signed-off-by: Roger Quadros --- arch/arm/boot/dts/am57xx-idk-common.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/arch/arm/boot/dts/am57xx-idk-common.dtsi b/arch/arm/boot/dts/am57xx-idk-common.dtsi index f7bd264..6991412 100644 --- a/arch/arm/boot/dts/am57xx-idk-common.dtsi +++ b/arch/arm/boot/dts/am57xx-idk-common.dtsi @@ -492,3 +492,11 @@ &cpu0 { vdd-supply = <&smps12_reg>; }; + +&pruss1 { + status = "okay"; +}; + +&pruss2 { + status = "okay"; +};