From: Mike Frysinger <vapier@gentoo.org>
To: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: uclinux-dist-devel@blackfin.uclinux.org, Bryan Wu <cooloney@kernel.org>
Subject: [PATCH 03/11] Blackfin SPORT UART: rewrite inline assembly
Date: Tue, 2 Jun 2009 03:11:32 -0400 [thread overview]
Message-ID: <1243926700-30485-3-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1243926700-30485-1-git-send-email-vapier@gentoo.org>
Hopefuly the new version is easier to read, but in the process it declares
proper clobber lists and better constraints so that GCC can do a better
job at allocating free registers.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/serial/bfin_sport_uart.c | 54 ++++++++++++++++++++-----------------
1 files changed, 29 insertions(+), 25 deletions(-)
diff --git a/drivers/serial/bfin_sport_uart.c b/drivers/serial/bfin_sport_uart.c
index 6687ccd..34b4ae0 100644
--- a/drivers/serial/bfin_sport_uart.c
+++ b/drivers/serial/bfin_sport_uart.c
@@ -101,15 +101,16 @@ static inline void tx_one_byte(struct sport_uart_port *up, unsigned int value)
{
pr_debug("%s value:%x\n", __func__, value);
/* Place a Start and Stop bit */
- __asm__ volatile (
- "R2 = b#01111111100;\n\t"
- "R3 = b#10000000001;\n\t"
- "%0 <<= 2;\n\t"
- "%0 = %0 & R2;\n\t"
- "%0 = %0 | R3;\n\t"
- :"=r"(value)
- :"0"(value)
- :"R2", "R3");
+ __asm__ __volatile__ (
+ "R2 = b#01111111100;"
+ "R3 = b#10000000001;"
+ "%0 <<= 2;"
+ "%0 = %0 & R2;"
+ "%0 = %0 | R3;"
+ : "=d"(value)
+ : "d"(value)
+ : "ASTAT", "R2", "R3"
+ );
pr_debug("%s value:%x\n", __func__, value);
SPORT_PUT_TX(up, value);
@@ -118,27 +119,30 @@ static inline void tx_one_byte(struct sport_uart_port *up, unsigned int value)
static inline unsigned int rx_one_byte(struct sport_uart_port *up)
{
unsigned int value, extract;
+ u32 tmp_mask1, tmp_mask2, tmp_shift, tmp;
value = SPORT_GET_RX32(up);
pr_debug("%s value:%x\n", __func__, value);
/* Extract 8 bits data */
- __asm__ volatile (
- "R5 = 0;\n\t"
- "P0 = 8;\n\t"
- "R1 = 0x1801(Z);\n\t"
- "R3 = 0x0300(Z);\n\t"
- "R4 = 0;\n\t"
- "LSETUP(loop_s, loop_e) LC0 = P0;\nloop_s:\t"
- "R2 = extract(%1, R1.L)(Z);\n\t"
- "R2 <<= R4;\n\t"
- "R5 = R5 | R2;\n\t"
- "R1 = R1 - R3;\nloop_e:\t"
- "R4 += 1;\n\t"
- "%0 = R5;\n\t"
- :"=r"(extract)
- :"r"(value)
- :"P0", "R1", "R2","R3","R4", "R5");
+ __asm__ __volatile__ (
+ "%[extr] = 0;"
+ "%[mask1] = 0x1801(Z);"
+ "%[mask2] = 0x0300(Z);"
+ "%[shift] = 0;"
+ "LSETUP(.Lloop_s, .Lloop_e) LC0 = %[lc];"
+ ".Lloop_s:"
+ "%[tmp] = extract(%[val], %[mask1].L)(Z);"
+ "%[tmp] <<= %[shift];"
+ "%[extr] = %[extr] | %[tmp];"
+ "%[mask1] = %[mask1] - %[mask2];"
+ ".Lloop_e:"
+ "%[shift] += 1;"
+ : [val]"=d"(value), [extr]"=d"(extract), [shift]"=d"(tmp_shift), [tmp]"=d"(tmp),
+ [mask1]"=d"(tmp_mask1), [mask2]"=d"(tmp_mask2)
+ : "d"(value), [lc]"a"(8)
+ : "ASTAT", "LB0", "LC0", "LT0"
+ );
pr_debug(" extract:%x\n", extract);
return extract;
--
1.6.3.1
next prev parent reply other threads:[~2009-06-02 7:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-02 7:11 [PATCH 01/11] Blackfin SPORT UART: fix typo in sport_set_termios prototype Mike Frysinger
2009-06-02 7:11 ` [PATCH 02/11] Blackfin SPORT UART: fix data misses while using transmit frame sync Mike Frysinger
2009-06-02 7:11 ` Mike Frysinger [this message]
2009-06-02 7:11 ` [PATCH 04/11] Blackfin SPORT UART: fix overrun errors Mike Frysinger
2009-06-02 9:00 ` Alan Cox
2009-06-03 8:03 ` Mike Frysinger
2009-06-03 8:49 ` Cai, Cliff
2009-06-03 8:53 ` Alan Cox
2009-06-03 9:47 ` Mike Frysinger
2009-06-03 9:57 ` Alan Cox
2009-06-03 10:15 ` Mike Frysinger
2009-06-02 7:11 ` [PATCH 05/11] Blackfin Serial Driver: fix error while transferring large files Mike Frysinger
2009-06-02 7:11 ` [PATCH 06/11] Blackfin Serial Driver: fix baudrate for early_printk Mike Frysinger
2009-06-02 7:11 ` [PATCH 07/11] Blackfin Serial Driver: fix missing new lines when under load Mike Frysinger
2009-06-02 7:11 ` [PATCH 08/11] Blackfin Serial Driver: handle irregular DMA register status in auto start mode Mike Frysinger
2009-06-02 7:11 ` [PATCH 09/11] Blackfin Serial Driver: annotate anomalies 05000215 and 05000099 Mike Frysinger
2009-06-02 7:11 ` [PATCH 10/11] Blackfin Serial Driver: handle anomaly 05000231 Mike Frysinger
2009-06-02 7:11 ` [PATCH 11/11] Blackfin Serial Driver: disable dma rx interrupt only rather than all irqs Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1243926700-30485-3-git-send-email-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=cooloney@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®