From patchwork Sun Jul 15 02:44:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Domenico Andreoli X-Patchwork-Id: 1198331 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 964D53FC4C for ; Sun, 15 Jul 2012 02:54:09 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SqEuF-0000Jr-37; Sun, 15 Jul 2012 02:49:59 +0000 Received: from mail-we0-f177.google.com ([74.125.82.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SqEqd-0008VT-2y for linux-arm-kernel@lists.infradead.org; Sun, 15 Jul 2012 02:46:27 +0000 Received: by weyr3 with SMTP id r3so3441843wey.36 for ; Sat, 14 Jul 2012 19:46:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:user-agent:date:from:to:cc:subject:references :content-disposition; bh=Xb584Kc9ri1sGEy/mbQoSzg442dp49sFF12fgUWpQ1U=; b=Xfcl0RzRAWLfoAhQvIHZL729mtbZ8jvjA/cWwq8EVzSQE6R6uAvSmWRarMqEFVUDfb gPPO4Z4jVH+/L7KY7qAID/30myKVcewUKqblf+uOCOQiiI9kd35u1lv3utrMGYPUYCoG XOTxJ7H4ImBnRQ0yyh56GMorHt1WtWzykOoAtWTtvE02dc8YF2OHrnq9EREriqjTWWj1 +iHdMfJ9znu+svMwmQvJHt+jBCYcU855CHSkPGB4oxtXgnEbZP28vjRA+bTLqZOews/X XLxKxQLvu+RZxqLoVBehbIfTK02uaJXx57SeZf2KA/qPSmExoBPYS4PsX9eJjVXNrQFJ cK8A== Received: by 10.180.92.7 with SMTP id ci7mr10106520wib.1.1342320372308; Sat, 14 Jul 2012 19:46:12 -0700 (PDT) Received: from raptus.dandreoli.com (178-85-163-250.dynamic.upc.nl. [178.85.163.250]) by mx.google.com with ESMTPS id fu3sm19284293wib.10.2012.07.14.19.46.11 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 14 Jul 2012 19:46:11 -0700 (PDT) Received: by raptus.dandreoli.com (Postfix, from userid 1000) id 7DE4637B9FE; Sun, 15 Jul 2012 04:46:11 +0200 (CEST) Message-Id: <20120715024611.173911603@gmail.com> User-Agent: quilt/0.60-1 Date: Sun, 15 Jul 2012 04:44:18 +0200 From: Domenico Andreoli To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 10/12] ARM: Decompressor support for AMBA PL011 UARTs References: <20120715024408.747946928@gmail.com> Content-Disposition: inline; filename=decomp-console-uart-amba-pl011.patch X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (cavokz[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Domenico Andreoli , Russell King - ARM Linux , Arnd Bergmann X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Domenico Andreoli Very easy implementation of the AMBA PL011 driver. Signed-off-by: Domenico Andreoli --- drivers/tty/serial/amba-pl011.c | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) Index: b/drivers/tty/serial/amba-pl011.c =================================================================== --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -2057,6 +2058,56 @@ static void __exit pl011_exit(void) arch_initcall(pl011_init); module_exit(pl011_exit); +#define pl011_decomp_base(_drv) (*(unsigned long *) (_drv)->devdata) + +static int __decomp_arch pl011_decomp_probe(struct decomp_console_drv *drv) +{ + unsigned long base = pl011_decomp_base(drv); + volatile uint32_t *cr; + + /* this driver doesn't support probing of the base address */ + if (!base) + return -EINVAL; + + cr = (volatile uint32_t *) (base + UART011_CR); + return (*cr & UART01x_CR_UARTEN) ? 0 : -1; +} + +static void __decomp_arch pl011_decomp_putc(struct decomp_console_drv *drv, int ch) +{ + unsigned long base = pl011_decomp_base(drv); + volatile uint32_t *fr, *dr; + + fr = (volatile uint32_t *) (base + UART01x_FR); + while (*fr & UART01x_FR_TXFF) + barrier(); + + dr = (volatile uint32_t *) (base + UART01x_DR); + *dr = ch; +} + +static void __decomp_arch pl011_decomp_flush(struct decomp_console_drv *drv) +{ + unsigned long base = pl011_decomp_base(drv); + volatile uint32_t *fr; + + fr = (volatile uint32_t *) (base + UART01x_FR); + while (*fr & UART01x_FR_BUSY) + barrier(); +} + +static const char pl011_dt_compat[][16] __decomp_archdata = { + "amba-pl011", + "", +}; + +DECOMP_CONSOLE_START("ttyAMA") + .probe = pl011_decomp_probe, + .putc = pl011_decomp_putc, + .flush = pl011_decomp_flush, + .dt_compat = pl011_dt_compat, +DECOMP_CONSOLE_END + MODULE_AUTHOR("ARM Ltd/Deep Blue Solutions Ltd"); MODULE_DESCRIPTION("ARM AMBA serial port driver"); MODULE_LICENSE("GPL");