From patchwork Fri Mar 4 16:15:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 12769429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3654BC433F5 for ; Fri, 4 Mar 2022 16:22:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Z4d6xRIQ4unbZxpWaZJknRcwKKVncneXiu193Ht1EOQ=; b=MtMQFGSo+eBo8z DKpbv2N1vs+iC8G3nEF/0E4H7MRpl5wpZJ0O06r9TQU3XOTnZS0ialsRgYhslgGUS8TRXsDL2tGVb 0zHzjTEp5nXs0PQ1V5nIqzg5yWx9XSGAEcNYX09K3F05zfi5FcI0gsLQlSd1Qp0H2D8y6+EzAtpgD tTkfZrZstciH0iO6vQeHYhgnq/d39HHN2Eq6o0fjqa8le60vVLrybAGkdDgCfV2fqgkHSFP7fNwxg za/Zmis1tpYy247vKkwmejMtky4j4Hp08FGQ8rxnaLtdg6rftNZaYt6FmaAkJ82xEWEGWyhpii1lX CT3v5whcfugYURdunVEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQAfL-00AzsM-K1; Fri, 04 Mar 2022 16:20:30 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQAaW-00Axln-7x for linux-arm-kernel@lists.infradead.org; Fri, 04 Mar 2022 16:15:30 +0000 Received: by mail-wr1-x430.google.com with SMTP id t11so13429201wrm.5 for ; Fri, 04 Mar 2022 08:15:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lrMkWfnep54u5iNgaB4r+dAM8d1KFFgig+FJrYuk0pk=; b=BkiMi6QmBvXGp9TotIl0ob62+e/h6JsMQPZM3+y5rzZZJCBsHJxpaaaOjoXBA8rkK2 r8r1pfp0/szpXWvqKiXjt3t4MPV1T2w82B6u6dLDyR5B+1jhu3PEJp5glLmIcCA2jtyu 9RNoMu3D73Tw1im9wuhPGSmXNf1/5ZLMI4yekxVC6TQx4VTNQEByZ2OjIAUci2P/OFxF oX1swUgh/0s8jZMoZrdxMDkRk+7UbO6M5zgK096GY+itx49fUVAoQd1byRcon7r4k3tQ bTEmZlQL5UsxpOR0KnH58n6vHHJpyzujgEnj/1Bk4yDnbs702oZVl3K6spPdUH1RJ6QI 6JuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lrMkWfnep54u5iNgaB4r+dAM8d1KFFgig+FJrYuk0pk=; b=N07Vb02Zsh5J0cUs/HT6iepXwUOEG1P5aFBCbv1sG/Se0GbXYRxIEgMEue5DPyTypn 2THmlRCo0HmpKXaASy/1Imrkef7spscKJ7jcfq1GlgMpwi2q7WLMsBi5CftD/6BxjQlL BX+bQ9DLQBaAbwx3kGhjgG3xDZRobuy2VhLyjqDTg6e5InauumQ9xUmI9Fe1p61AgD/4 v3Z6++pXob5yxWxJXtD9ESwMEukKiWbTW00C/oQUi5B1m4F/bj7h3FmIedj1QDtoAkEh T/LmSgOlC7ILcI5+uESW3Ob/QcIYu5zVilXYZHiNed4Waq8IvECtS3GmjS08xoWHGoTt cb9Q== X-Gm-Message-State: AOAM533pgT1qNpQvXpNPY5JCAKjmlstdH8O45eypIZxMVHuQ+FdW/Csc +crLHRehwTQUaZ/dbfVclxvdpw== X-Google-Smtp-Source: ABdhPJw+BrScSKY8cwPtWMHO+wpbI7pfRZr8TVd35OrIpG0qohLrXCNbxANPMJ2W58OrVGmXFPO0ig== X-Received: by 2002:adf:a34e:0:b0:1f0:1a15:c9b2 with SMTP id d14-20020adfa34e000000b001f01a15c9b2mr13213798wrb.662.1646410525632; Fri, 04 Mar 2022 08:15:25 -0800 (PST) Received: from xps-9300.baylibre (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id g6-20020a5d5406000000b001f049726044sm4937307wrv.79.2022.03.04.08.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 08:15:25 -0800 (PST) From: Alexandre Bailon To: ohad@wizery.com, bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.or Cc: matthias.bgg@gmail.com, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, stephane.leprovost@mediatek.com, khilman@baylibre.com, Alexandre Bailon Subject: [PATCH v4 0/7] Add support of mt8183 APU Date: Fri, 4 Mar 2022 17:15:07 +0100 Message-Id: <20220304161514.994128-1-abailon@baylibre.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220304_081528_379725_58AFC51D X-CRM114-Status: GOOD ( 20.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some Mediatek's SoC have an AI Processing Unit. This adds support of the one available in the mt8183 (aswell some derivative SoC). This v4 rework again the memory management. Now, vdev buffer and vring buffer are declared in device tree with a fixed physical address. Using a new property named "memory-region-da", the driver can map the vdev and vring buffers and make them available to the APU. The physical address must be fixed so the firmware can convert the physical address into APU device address. Using fixed address is not flexible but this is acceptable since the buffer addresses and size are not expected to be changed without a goog reason. Changes in v4: - Update the way to allocate and map the vdev and vring buffers - Simplfy the code - Add support of a second SoC (mt8365) - fix the dt bindings error detected by the bot - still use the threaded irq. calling rproc_vq_interrupt from irq causes a scheduling while atomic isssue Changes in v3: - Remove IOMMU hack. Instead, manage the IOMMU directly from the driver - Update the device tree bindings: only use reserved memory for virtio. All the other memory allocation will be done using DMA API. This sould simplify the memory management. - Add more comments Changes in v2: - Drop the workarounds needed to load bad firmwares - There are many name for the APU (most common one is VPU). Rename many functions and dts nodes to be more consistent. - Use the bulk clock API, and enable / disable clock at a better place - add few comments explaining how to start the APU - update the way to use pinctl for JTAG - fix some minors issues - fix device tree bindings Alexandre Bailon (5): dt bindings: remoteproc: Add bindings for the MT8183 APU dt-bindings: remoteproc: Add bindings for the MT8365 APU remoteproc: Add a remoteproc driver for the MT8183's APU remoteproc: mtk_apu: Add support of JTAG ARM64: mt8183: Add support of APU to mt8183 Julien STEPHAN (2): remoteproc: mtk_apu: Use match_data remoteproc: mtk-apu: Add support of MT8365 .../bindings/remoteproc/mtk,apu.yaml | 155 ++++ .../boot/dts/mediatek/mt8183-pumpkin.dts | 50 ++ arch/arm64/boot/dts/mediatek/mt8183.dtsi | 40 ++ drivers/remoteproc/Kconfig | 19 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/mtk_apu.c | 671 ++++++++++++++++++ 6 files changed, 936 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/mtk,apu.yaml create mode 100644 drivers/remoteproc/mtk_apu.c