• Hugo Villeneuve's avatar
    ARM: Davinci: UART: Fix bug with serial ports registration · aeb81be7
    Hugo Villeneuve authored
    This bug occurs when the davinci serial code tries to register UART(X) when
    UART(X-1) or UART(X-2) is not enabled in the structure uart_config of the board
    setup code:
    
    This works: .enabled_uarts = (1 << 0)
    This works: .enabled_uarts = (1 << 0) | (1 << 1)
    This works: .enabled_uarts = (1 << 0) | (1 << 1) | | (1 << 2)
    This fails: .enabled_uarts = (1 << 1)
    This fails: .enabled_uarts = (1 << 1) | (1 << 2)
    This fails: .enabled_uarts = (1 << 0) | (1 << 2)
    
    The bug is triggered by the fact that the 8250 serial driver stops parsing the
    serial_platform_data structure as soon as it sees a zero flags entry. Thus the
    davinci serial registration code (serial.c) must <pack> the serial_platform_data
    structure and only clear the flags entry when there is no more devices following.
    
    Tested on DM6446 and DM355 custom boards.
    Signed-off-by: default avatarHugo Villeneuve <hugo@hugovil.com>
    Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
    aeb81be7
serial.c 3.85 KB