From patchwork Thu Aug 11 19:48:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFwaGHDq2wgQXNzw6luYXQ=?= X-Patchwork-Id: 1058602 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7BJmksH003911 for ; Thu, 11 Aug 2011 19:48:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751975Ab1HKTsp (ORCPT ); Thu, 11 Aug 2011 15:48:45 -0400 Received: from roc.holo.8d.com ([64.254.227.115]:54465 "EHLO roc.holo.8d.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751168Ab1HKTsp (ORCPT ); Thu, 11 Aug 2011 15:48:45 -0400 Received: from raph.usine.8d.com ([192.168.142.55]) by roc.holo.8d.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1QrbFD-0006tf-Ug for linux-omap@vger.kernel.org; Thu, 11 Aug 2011 15:48:44 -0400 Message-ID: <4E44321B.4050009@8d.com> Date: Thu, 11 Aug 2011 15:48:43 -0400 From: =?ISO-8859-1?Q?Rapha=EBl_Ass=E9nat?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110505 Icedove/3.0.11 MIME-Version: 1.0 To: linux-omap@vger.kernel.org Subject: [RFC PATCH 1/2] omap-serial: Overriding omap-serial built in serial_in/out functions X-Enigmail-Version: 1.0.1 X-Spam-Score: -2.6 X-Spam-Level: -- X-Spam-Report: -2.6 points, 5.0 required autolearn=ham -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 11 Aug 2011 19:48:46 +0000 (UTC) This patch provides a mean to replace the default serial_in and serial_out implementations provided by omap-serial.c. Inspired from the 8250.c driver. Overridding those functions provide a very flexible way to implement special features such as GPIO connected modem lines. (By catching values written to MCR or rewriting values read from MSR on the fly). Signed-off-by: Raphaël Assénat --- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/arch/arm/plat-omap/include/plat/omap-serial.h +++ b/arch/arm/plat-omap/include/plat/omap-serial.h @@ -63,6 +63,8 @@ struct omap_uart_port_info { resource_size_t mapbase; /* resource base */ unsigned long irqflags; /* request_irq flags */ upf_t flags; /* UPF_* flags */ + unsigned int (*serial_in)(struct uart_port *, int); + void (*serial_out)(struct uart_port *, int, int); }; struct uart_omap_dma { @@ -102,6 +104,9 @@ struct uart_omap_port { unsigned char efr; int use_dma; + + unsigned int (*serial_in)(struct uart_port *, int); + void (*serial_out)(struct uart_port *, int, int); /* * Some bits in registers are cleared on a read, so they must * be saved whenever the register is read but the bits will not --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -51,14 +51,23 @@ static int serial_omap_start_rxdma(struct uart_omap_port *up); static inline unsigned int serial_in(struct uart_omap_port *up, int offset) { - offset <<= up->port.regshift; - return readw(up->port.membase + offset); + if (up->serial_in) { + return up->serial_in(&up->port, offset); + } + else { + offset <<= up->port.regshift; + return readw(up->port.membase + offset); + } } static inline void serial_out(struct uart_omap_port *up, int offset, int value) { - offset <<= up->port.regshift; - writew(value, up->port.membase + offset); + if (up->serial_out) { + up->serial_out(&up->port, offset, value); + } else { + offset <<= up->port.regshift; + writew(value, up->port.membase + offset); + } } static inline void serial_omap_clear_fifos(struct uart_omap_port *up)