Article [#4943] Bfin SPORT UART driver fails to work when compiled with latest gcc, due to broken inline assembly.

[#4943] Bfin SPORT UART driver fails to work when compiled with latest gcc, due to broken inline assembly.

Submitted By: Michael Hennerich

Open Date

2009-02-25 10:58:47     Close Date

2009-02-26 10:38:56

Priority:

Medium     Assignee:

Michael Hennerich

Status:

Closed     Fixed In Release:

N/A

Found In Release:

2010R1     Release:

SVN trunk

Category:

Drivers     Board:

STAMP

Processor:

ALL     Silicon Revision:

Is this bug repeatable?:

Yes     Resolution:

Fixed

Uboot version or rev.:

    Toolchain version or rev.:

gcc4.1

App binary format:

N/A     

Summary: Bfin SPORT UART driver fails to work when compiled with latest gcc, due to broken inline assembly.

Details:

Bfin SPORT UART driver fails to work when compiled with latest gcc, due to broken inline assembly.

static 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;"

        "R3 = b#10000000001;"

        "%0 <<= 2;"

        "%0 = %0 & R2;"

        "%0 = %0 | R3;"

        : "=d"(value)

        :

        : "ASTAT", "R2", "R3"

    );

    pr_debug("%s value:%x\n", __func__, value);

    SPORT_PUT_TX(up, value);

}

tx_one_byte() assembles into this:

00000000 <_tx_one_byte>:

   0:   00 00           NOP;

   2:   10 32           P2 = R0;

   4:   22 e1 fc 03     R2 = 0x3fc (X);         /*              R2=0x3fc(1020) */

   8:   23 e1 01 04     R3 = 0x401 (X);         /*              R3=0x401(1025) */

   c:   10 4f           R0 <<= 0x2;                                             

   e:   10 54           R0 = R0 & R2;                                           

  10:   18 56           R0 = R0 | R3;                                           

  12:   52 ac           P2 = [P2 + 0x4];                                        

  14:   82 6c           P2 += 0x10;             /* ( 16) */                     

  16:   10 97           W[P2] = R0;                                             

  18:   10 00           RTS;

The second input operand (value) passed through R1 is not even used.

Instead it computes on struct sport_uart_port *up.

Inline assembly in rx_one_byte() has similar issues.

IMHO – all this assembly stuff should be converted to C.

I leave this task up to: [#3704] SPORT UART: use common infrastructure

-Michael

Follow-ups

--- Michael Hennerich                                        2009-02-26 10:38:56

Fixed on trunk.

The failing functions in 2008R1 branch are different from the ones on trunk.

So the issue doesn't exist there.

Closed.

-Michael

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

File Name     File Type     File Size     Posted By

No Files Were Found

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.