From patchwork Fri Aug 21 14:42:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grzegorz Jaszczyk X-Patchwork-Id: 11729647 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 369D9739 for ; Fri, 21 Aug 2020 14:46:18 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0FCBA2075E for ; Fri, 21 Aug 2020 14:46:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="au+j0uh8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="O/rp+j/m" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FCBA2075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fctrqGvFzONI1OFzoj25mPgVT4B2vJyPUg66ICz9x/Y=; b=au+j0uh8dfQNaSsk/Th/Mqvled eeMViemt7UlnGU9lzRUEzfedgf92u0ACtsX5/0uLwGLkLYUUNruCL8RhoKJc8s5J3v20WF+KBDqDZ Y3caXoL5u4szFjpD0sXWVjnSgh7TORcd44ODBvynVNlLYcap0NYI8kDEzRJUqc8loUx67r2Y+/XXM 8gvgkS1xzmRUsehOboI2ZtU5OVGGIiZ/AcbF9tIWlAnrrlzsbU8dR77hWPz6d2gQXyGt1APkwhMFC LM7zyG+4Wx6QOr5/UTzaMpxxhEhBx61SuAjRbzFb33VPfb3HBbMGcfuAE0LDzZENFbApn/Ln1lg4F ZHeVV17A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k98HW-0003GF-1b; Fri, 21 Aug 2020 14:44:38 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k98HL-0003DD-Sa for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 14:44:29 +0000 Received: by mail-lj1-x244.google.com with SMTP id w25so2095168ljo.12 for ; Fri, 21 Aug 2020 07:44:27 -0700 (PDT) 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; bh=3iZtNbqc1mBJJJjWeSLbgS2Cn5Da5RL7AKHBFy+181Q=; b=O/rp+j/mkB/qPlnoIM4brPw7wKuHchbCzNlJAK9refknfOTqNp8S9SD94tcBhaAaGU bvr+qINvuhsIjJjWcYElzw5nzGWCK6eBylvqlAaH/EgtKke/80kgCrfzN/iClSfG7QW+ C8TkYjtUI7o6dO1RJl1g8cushOqXEEVsKRBaFOfFFMgTc8T+n/FYRNrWbsPGYotewsaW upa0na5T5n/UxA1j7i3XjAYfdoZeEaVLFYqQyuD9/hUIg8eYPl+FZ1EDQQWyxTpvDmkl frhhwbgUK2oRmpMhqlja8ogqUpVMP4t4gvY/Cl2cA4BI+R34usSfTZCaIbqvGkq8j+QZ YNhw== 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; bh=3iZtNbqc1mBJJJjWeSLbgS2Cn5Da5RL7AKHBFy+181Q=; b=YteCZYwtjJpqiZ8aKWwgPylHwYOg5qvrNobLhFwgQkOpAvHv98SRu1A4HtSXM21no7 nRU8vAgUDqMWLJlDXTgpcR3oWFn9B7y3+QSoY1hG1iudWWR96PTr53fva+hhlBtOfj6D CTES4l4pwWqrCu4mZnK1UFyrR8+caal2qK9o1Fm6D+FamjEDQuurihroSYHxZPMoZjym 5NKyWYwb/mzfXDdiAs7xx5SdxYNjV5pkqIwLDa+JP2oJ6IQNqAdYb7fvfyhUyhfXGasH ZOtsCYtONM89zh6R5TJmjy6pX+m2E9FTGWDqB+stEDutb3AZtfGN23yD6uWKaYSzFV0x yakQ== X-Gm-Message-State: AOAM533tg36f0pLN1wyIGDHWnt/WidOAxMJXuvS2n5LcZ26MZuniMrcp 0ndu3UWI81HGed6pw52n8JCB/A== X-Google-Smtp-Source: ABdhPJx1dh3XKL1n3kASOWvLKD/q4ylgbtRjFmMJei1J6JhlNOHQME7Fbz/tJ31RLYgisdtynECWtg== X-Received: by 2002:a2e:a586:: with SMTP id m6mr1793847ljp.458.1598021066514; Fri, 21 Aug 2020 07:44:26 -0700 (PDT) Received: from gilgamesh.semihalf.com (193-106-246-138.noc.fibertech.net.pl. [193.106.246.138]) by smtp.gmail.com with ESMTPSA id u10sm425301lfo.39.2020.08.21.07.44.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Aug 2020 07:44:26 -0700 (PDT) From: Grzegorz Jaszczyk To: ssantosh@kernel.org, s-anna@ti.com Subject: [PATCH v2 3/7] soc: ti: pruss: Add support for PRU-ICSSs on AM437x SoCs Date: Fri, 21 Aug 2020 16:42:40 +0200 Message-Id: <1598020964-29877-4-git-send-email-grzegorz.jaszczyk@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1598020964-29877-1-git-send-email-grzegorz.jaszczyk@linaro.org> References: <1598020964-29877-1-git-send-email-grzegorz.jaszczyk@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_104427_986368_EABB376F X-CRM114-Status: GOOD ( 25.85 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:244 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, grzegorz.jaszczyk@linaro.org, praneeth@ti.com, santosh.shilimkar@oracle.com, linux-kernel@vger.kernel.org, "Andrew F . Davis" , tony@atomide.com, robh+dt@kernel.org, linux-omap@vger.kernel.org, lee.jones@linaro.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Suman Anna The AM437x SoCs have two different PRU-ICSS subsystems: PRU-ICSS1 and a smaller PRU-ICSS0. Enhance the PRUSS platform driver to support both the PRU-ICSS sub-systems on these SoCs. The PRU-ICSS1 on AM437x is very similar to the PRU-ICSS on AM33xx except for few minor differences - increased Instruction RAM, increased Shared Data RAM2, and 1 less interrupt (PRUSS host interrupt 7 which is redirected to the other PRUSS) towards the MPU INTC. The PRU-ICSS0 is a cut-down version of the IP, with less DRAM per PRU, no Shared DRAM etc. It also does not have direct access to L3 bus regions, there is a single interface to L3 for both PRUSS0 and PRUSS1, and it would have to go through the PRUSS1's interface. The PRUSS_SYSCFG register is reserved on PRUSS0, so any external access requires the programming the corresponding PRUSS_SYSCFG register in PRUSS1. It does have its own dedicated I/O lines though. Note that this instance does not support any PRU Ethernet related use cases. The adaptation uses SoC-specific compatibles in the driver and uses a newly introduced pruss_match_private_data structure and the pruss_get_private_data() function to retrieve a PRUSS instance specific data using a device-name based lookup logic. The reset and the L3 external access are managed by the parent interconnect ti-sysc bus driver so that PRUSS1 and PRUSS0 can be independently supported. Signed-off-by: Suman Anna Signed-off-by: Andrew F. Davis Signed-off-by: Grzegorz Jaszczyk --- v1->v2: - No changes. --- drivers/soc/ti/Kconfig | 2 +- drivers/soc/ti/pruss.c | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig index b934bc3..40d6a22 100644 --- a/drivers/soc/ti/Kconfig +++ b/drivers/soc/ti/Kconfig @@ -103,7 +103,7 @@ config TI_K3_SOCINFO config TI_PRUSS tristate "TI PRU-ICSS Subsystem Platform drivers" - depends on SOC_AM33XX + depends on SOC_AM33XX || SOC_AM43XX select MFD_SYSCON help TI PRU-ICSS Subsystem platform specific support. diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c index c071bb2..04938ba 100644 --- a/drivers/soc/ti/pruss.c +++ b/drivers/soc/ti/pruss.c @@ -17,6 +17,14 @@ #include #include +/** + * struct pruss_private_data - PRUSS driver private data + * @has_no_sharedram: flag to indicate the absence of PRUSS Shared Data RAM + */ +struct pruss_private_data { + bool has_no_sharedram; +}; + static int pruss_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -25,8 +33,15 @@ static int pruss_probe(struct platform_device *pdev) struct pruss *pruss; struct resource res; int ret, i, index; + const struct pruss_private_data *data; const char *mem_names[PRUSS_MEM_MAX] = { "dram0", "dram1", "shrdram2" }; + data = of_device_get_match_data(&pdev->dev); + if (IS_ERR(data)) { + dev_err(dev, "missing private data\n"); + return -ENODEV; + } + ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); if (ret) { dev_err(dev, "failed to set the DMA coherent mask"); @@ -45,7 +60,14 @@ static int pruss_probe(struct platform_device *pdev) return -ENODEV; } - for (i = 0; i < ARRAY_SIZE(mem_names); i++) { + for (i = 0; i < PRUSS_MEM_MAX; i++) { + /* + * On AM437x one of two PRUSS units don't contain Shared RAM, + * skip it + */ + if (data && data->has_no_sharedram && i == PRUSS_MEM_SHRD_RAM2) + continue; + index = of_property_match_string(child, "reg-names", mem_names[i]); if (index < 0) { @@ -126,8 +148,19 @@ static int pruss_remove(struct platform_device *pdev) return 0; } +/* instance-specific driver private data */ +static const struct pruss_private_data am437x_pruss1_data = { + .has_no_sharedram = false, +}; + +static const struct pruss_private_data am437x_pruss0_data = { + .has_no_sharedram = true, +}; + static const struct of_device_id pruss_of_match[] = { { .compatible = "ti,am3356-pruss" }, + { .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, }, + { .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, }, {}, }; MODULE_DEVICE_TABLE(of, pruss_of_match);