Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp384113rdb; Thu, 30 Nov 2023 07:20:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCnByF9rXE74QkKiH8vuj6qhT4gh8GvANMWdSaFkLxvT/wUeKjKwm75BbuWhjUK1G+fDVQ X-Received: by 2002:a05:6a00:10d2:b0:6cb:4bd5:a4c5 with SMTP id d18-20020a056a0010d200b006cb4bd5a4c5mr26455848pfu.9.1701357644491; Thu, 30 Nov 2023 07:20:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701357644; cv=none; d=google.com; s=arc-20160816; b=a8+g9VSMUzEDjgXiBEjWgWmpu3npArCbVRGr3wD+kOieaGJKYbWdmYgcFjTD7yoK0F lAgCCk06LDVQbEdU5CfDMgAEPWyoufZQ+gl1tNCXrJpnkJjO0rxV2z/JHuqmTNCf/zun I8aEspNCmRNBznnOHFZ79TbFpJxdgnshZhu9fQcX2ZVi2pBCCTgl1SXfAj4voJ91cDTp 7/dn8s67KubqELiC1mwXxcDhdNeKxYwemsFt5LI1GxnV2OYNAF6quLKPHSkTdpRR4w+Y Ck5GtMIn6G0hZLqpTgl1OIh4cl2nALYZrRYD2QdqhU9HWcmlB7bjq+XVqyVoLc8tuDjf Bslw== 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=x/4VKc6j7ZPLGeNJb06p6pcCmpUDLk01xwbpFjzzvZw=; fh=Ok4klyFUkgnj0eaKwSnCsCY6uP2ODAM3LCWCs6106jQ=; b=H8vncEjEQkY36IYP1m7jSquvUyQeYqPbaQW01ZxRhyZaIUsSjByBnR6nNQVo9IDClM 2FCQcc68fvM8ZYKdmbS3XzfgzQ4LJ5ZvZKeXvPXOK3o4Jxh5HhqSEyss3uqpIqvrLPZw dMB1Ab2McQ8LXlEVBMtkFUfXj7CQ9AThYtiBQ4uc3yTVHazgo1/JRoqd7EPJ16xn1Vkj zm9LNaWrdWns8uPg4hET4cCWc1wIWvl2Oqn6jMFYnoI8o+iZcT7qUrq8VQo/ZMrKpGck CkCBPXZS8ou+ENA4DlosFTN/2fawVPs556nMGcU40PqPOwlrGbmVEYelPQqNerJucdmv CLTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=ap1qRYRr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id bw5-20020a056a00408500b006cb4f312136si1481259pfb.200.2023.11.30.07.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 07:20:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=ap1qRYRr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5789380C8400; Thu, 30 Nov 2023 07:20:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346183AbjK3PUW (ORCPT + 99 others); Thu, 30 Nov 2023 10:20:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346261AbjK3PUT (ORCPT ); Thu, 30 Nov 2023 10:20:19 -0500 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5B4810F8 for ; Thu, 30 Nov 2023 07:20:24 -0800 (PST) Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id ACC863FA53 for ; Thu, 30 Nov 2023 15:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1701357623; bh=x/4VKc6j7ZPLGeNJb06p6pcCmpUDLk01xwbpFjzzvZw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ap1qRYRraseSqCpDR3saeu4bryWspvFmdIcGYnSSvvvjGtKSq8qLb7Yx1hJElwaEm Ziv+Nu8IeQ7xU5D70a0ov8QnfUOpcv2v1nRQj5vgAPG20/YRH88VP1DlI9Iax0ziOP BAADJ5xYfxCJ+Gt90xD2K9hOc7e84I9oJDjqN8jv3rY5gKuSq6eCSucqzp+g9DBjqG cAvoLgMF1XWXSRk+PDFqHpS0Uo/YbuToTIbLkFW/0luT6TF3bG9/tE73aHXL0JD6Ad 5lGeXOBROj0XKGYfeG77c8ltJ3ZSyK9FPkGHVAoJTIHxGNfBD1zn+UHfBkptVh+thS zpujZSjzjVMGA== Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-6cddc344b98so1284089b3a.3 for ; Thu, 30 Nov 2023 07:20:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701357622; x=1701962422; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x/4VKc6j7ZPLGeNJb06p6pcCmpUDLk01xwbpFjzzvZw=; b=O1v41VkY7xIxF6RgLy66y7sWPmtjAaIBOdnDYgij1Cag5pppny606iSOZeUi0y4pit hcfFrp5DHSOQlE8lY/zJRKMv0KDCJaQWSgfJbDT+hQLGrdt+DscwaQ/R0SBJ+XJnTxsX U9F2k7zQqhZCeOtg+BjYJRsgt8087rwcZFtEzf/cb7hv4svuUMOUHmCOZjsaSUgNSfAr SbEv/J94NMrQUxfgSIM7Mp6Qsyw5QjNd2Pu5HkdTYQAyi2lKtxGDcBAIAAW4LaRSDl7q dpoqg/1L9GecXyovFab38N/Ss0NrO4jetunaRCSlC/fYrJbTQ7AguWCy0E7feakd8gzo Ti1w== X-Gm-Message-State: AOJu0Yy4kRLGFb2qxdCJtTPLbWt8X4Mefa+Aa0cnNO0RI4qv0p/33wO8 7Dy25MnvH/h4580lTXtQQ1OUe+f3HVdGoHFq0AdG+9uRqXx563lbA+0iCDCaWvDyc1GXG7zRwqA Y7ydzZ34y7rYzT2D4W3t08DlZ+gPNPA1PlZAtKKMOQg== X-Received: by 2002:a05:6a20:144b:b0:18c:548d:3d0f with SMTP id a11-20020a056a20144b00b0018c548d3d0fmr23512358pzi.5.1701357622022; Thu, 30 Nov 2023 07:20:22 -0800 (PST) X-Received: by 2002:a05:6a20:144b:b0:18c:548d:3d0f with SMTP id a11-20020a056a20144b00b0018c548d3d0fmr23512330pzi.5.1701357621745; Thu, 30 Nov 2023 07:20:21 -0800 (PST) Received: from stitch.. ([80.71.140.73]) by smtp.gmail.com with ESMTPSA id y125-20020a636483000000b005bd3d6e270dsm1356002pgb.68.2023.11.30.07.20.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 07:20:21 -0800 (PST) From: Emil Renner Berthing To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Paul Walmsley , Palmer Dabbelt , Emil Renner Berthing , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Cristian Ciocaltea , Geert Uytterhoeven Subject: [PATCH v2 5/8] riscv: dts: starfive: Add pool for coherent DMA memory on JH7100 boards Date: Thu, 30 Nov 2023 16:19:29 +0100 Message-Id: <20231130151932.729708-6-emil.renner.berthing@canonical.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231130151932.729708-1-emil.renner.berthing@canonical.com> References: <20231130151932.729708-1-emil.renner.berthing@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 30 Nov 2023 07:20:41 -0800 (PST) The StarFive JH7100 SoC has non-coherent device DMAs, but most drivers expect to be able to allocate coherent memory for DMA descriptors and such. However on the JH7100 DDR memory appears twice in the physical memory map, once cached and once uncached: 0x00_8000_0000 - 0x08_7fff_ffff : Off chip DDR memory, cached 0x10_0000_0000 - 0x17_ffff_ffff : Off chip DDR memory, uncached To use this uncached region we create a global DMA memory pool there and reserve the corresponding area in the cached region. However the uncached region is fully above the 32bit address limit, so add a dma-ranges map so the DMA address used for peripherals is still in the regular cached region below the limit. Link: https://github.com/starfive-tech/JH7100_Docs/blob/main/JH7100%20Data%20Sheet%20V01.01.04-EN%20(4-21-2021).pdf Signed-off-by: Emil Renner Berthing --- .../boot/dts/starfive/jh7100-common.dtsi | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/riscv/boot/dts/starfive/jh7100-common.dtsi b/arch/riscv/boot/dts/starfive/jh7100-common.dtsi index b93ce351a90f..3af88e6970a3 100644 --- a/arch/riscv/boot/dts/starfive/jh7100-common.dtsi +++ b/arch/riscv/boot/dts/starfive/jh7100-common.dtsi @@ -39,6 +39,30 @@ led-ack { label = "ack"; }; }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + dma-reserved@fa000000 { + reg = <0x0 0xfa000000 0x0 0x1000000>; + no-map; + }; + + linux,dma@107a000000 { + compatible = "shared-dma-pool"; + reg = <0x10 0x7a000000 0x0 0x1000000>; + no-map; + linux,dma-default; + }; + }; + + soc { + dma-ranges = <0x00 0x80000000 0x00 0x80000000 0x00 0x7a000000>, + <0x00 0xfa000000 0x10 0x7a000000 0x00 0x01000000>, + <0x00 0xfb000000 0x00 0xfb000000 0x07 0x85000000>; + }; }; &gpio { -- 2.40.1