Message ID | 20230314021817.30446-1-chiawei_wang@aspeedtech.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1523064wrd; Mon, 13 Mar 2023 19:31:16 -0700 (PDT) X-Google-Smtp-Source: AK7set+TiRvEYv+6OwzvDE95ixiRqb6flbHskoLfHt7qOwYGraYaTqAt9zFJ/niLGj35gcVGFN1+ X-Received: by 2002:a05:6a20:430f:b0:d4:3031:de7e with SMTP id h15-20020a056a20430f00b000d43031de7emr5603347pzk.31.1678761075841; Mon, 13 Mar 2023 19:31:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678761075; cv=none; d=google.com; s=arc-20160816; b=mpAgNPZVhjV3ATCwf3EIPTQjjZj1tzVT9oe2XUPTTaX5tpMU91VLU20/Cq6Hcv1fib scyVgCc88zDXltII0/38XkXG5w4AiA1lLpKW4Ol5f20aaIgfUk/vorOq53g40ETP2S5y ydgc1xAMy1Bm0fHrOUL/PauUlB/52I7tsv7DDTSnSLW4UfEF8AM+/sbz2oP/PRyge02h y/9YvVaXhUX2QVs0nZsGK1m0mrsinCcG6S+G5/2xtB1kTUMXKZZewxTsOL4CzniffLEW g8GwzCixhVUD8HhMorBX4DlbL2zVc18YxuVLCybq4nimPgROIA49ZeFI2WAU0W3E575z bHiQ== 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 :message-id:date:subject:to:from; bh=QhiIQmo5mHTxFrrJyzEuGOfboDWN0tNWGo1b6a3LCVg=; b=qcVWGUz8vJgFtw3O2obJ9V2QwgtXbDtkDaoTQdOv4TCoa1OS2mc85MHpm5R1PCnxSG fgzpzmXARDKUYz8gwoulM1rJM8bk8KW1c8GIn9mmX/bqKvQsqYtdmqkAP84WUDJAmycJ SreQdE5bM5+GR7vt7iS29nOFW4QvxLFQOkn3nqlsKPRpls2vqS+krgusKaduKR+9movY tkZ/ODDWtIk1ribMROdvDxbLcJ0oVY7OQ0qNL92BukHKHmsrw0pla1FwRMhdol3L2Nlb ijioR+ocifQehirHV21Cr1ki9sXW68jgBNENkSpwlZXEzNlj3kfE6UjTwjoNo/3Oa0Ua d2ig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u22-20020a632356000000b005030e22ea14si72766pgm.136.2023.03.13.19.31.02; Mon, 13 Mar 2023 19:31:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230229AbjCNCUU (ORCPT <rfc822;realc9580@gmail.com> + 99 others); Mon, 13 Mar 2023 22:20:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230062AbjCNCUF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 13 Mar 2023 22:20:05 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C54061F5F7; Mon, 13 Mar 2023 19:20:03 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 32E249if072544; Tue, 14 Mar 2023 10:04:09 +0800 (GMT-8) (envelope-from chiawei_wang@aspeedtech.com) Received: from Chiawei-PC03.aspeed.com (192.168.2.66) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 14 Mar 2023 10:18:19 +0800 From: Chia-Wei Wang <chiawei_wang@aspeedtech.com> To: <vkoul@kernel.org>, <robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <joel@jms.id.au>, <andrew@aj.id.au>, <gregkh@linuxfoundation.org>, <jirislaby@kernel.org>, <pmenzel@molgen.mpg.de>, <ilpo.jarvinen@linux.intel.com>, <dmaengine@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-aspeed@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>, <linux-serial@vger.kernel.org>, <openbmc@lists.ozlabs.org> Subject: [PATCH v2 0/5] arm: aspeed: Add UART DMA support Date: Tue, 14 Mar 2023 10:18:12 +0800 Message-ID: <20230314021817.30446-1-chiawei_wang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.2.66] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 32E249if072544 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760308573735673239?= X-GMAIL-MSGID: =?utf-8?q?1760308573735673239?= |
Series |
arm: aspeed: Add UART DMA support
|
|
Message
ChiaWei Wang
March 14, 2023, 2:18 a.m. UTC
This patch serias adds the 8250 driver with DMA support for AST26xx UART devices v2 change: - re-write UDMA driver based on the DMAEngine framework - re-write 8250_aspeed driver with DMA support based on the 8250_dma implementation - remove virtual UART part as there is already a 8250_aspeed_vuart driver Chia-Wei Wang (5): dt-bindings: serial: 8250: Add aspeed,ast2600-uart dt-bindings: dmaengine: Add AST2600 UDMA bindings dmaengine: aspeed: Add AST2600 UART DMA driver serial: 8250: Add AST2600 UART driver ARM: dts: aspeed-g6: Add UDMA node .../bindings/dma/aspeed,ast2600-udma.yaml | 56 ++ .../devicetree/bindings/serial/8250.yaml | 1 + arch/arm/boot/dts/aspeed-g6.dtsi | 9 + drivers/dma/Kconfig | 9 + drivers/dma/Makefile | 1 + drivers/dma/ast2600-udma.c | 528 ++++++++++++++++++ drivers/tty/serial/8250/8250_aspeed.c | 224 ++++++++ drivers/tty/serial/8250/Kconfig | 8 + drivers/tty/serial/8250/Makefile | 1 + include/dt-bindings/dma/ast2600-udma.h | 40 ++ 10 files changed, 877 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/aspeed,ast2600-udma.yaml create mode 100644 drivers/dma/ast2600-udma.c create mode 100644 drivers/tty/serial/8250/8250_aspeed.c create mode 100644 include/dt-bindings/dma/ast2600-udma.h
Comments
> From: Hillf Danton <hdanton@sina.com> > Sent: Saturday, March 18, 2023 11:01 AM > > On 14 Mar 2023 10:18:15 +0800 Chia-Wei Wang > <chiawei_wang@aspeedtech.com> > > +static irqreturn_t ast2600_udma_isr(int irq, void *arg) { > > [...] > > > + /* handle RX interrupt */ > > + sts = readl(udma->regs + UDMA_RX_INT_STS); > > + for_each_set_bit(ch_bit, (unsigned long *)&sts, udma->n_ucs / 2) { > > + ch_id = (ch_bit << 1) + 1; > > + wptr = readl(udma->regs + UDMA_CH_WPTR(ch_id)); > > + > > + uc = &udma->ucs[ch_id]; > > + ud = &uc->ud; > > + tx = &ud->tx; > > + > > + uc->residue = (ud->size & ~UDMA_CH_CTRL_BUFSZ) - wptr; > > + > > + /* handle non-4B-aligned case */ > > + if (ud->addr & 0x3) { > > + p = phys_to_virt(dma_to_phys(uc->chan.device->dev, > ud->addr)); > > This does not work if the dma address has no corresponding struct page. Will add the error check for dma_to_phys to prevent further unexpected memory accesses. Thanks, Chiawei > > > + memcpy(p, uc->buf, wptr); > > + } > > + > > + ast2600_udma_terminate(&uc->chan); > > + > > + dma_cookie_complete(tx); > > + dma_descriptor_unmap(tx); > > + dmaengine_desc_get_callback_invoke(tx, NULL); > > + } > > + > > + return IRQ_HANDLED; > > +}