* Govindraj <govindraj.ti@xxxxxxxxx> [100210 06:36]: > Tony, > > > > >> +static void serial_omap_start_tx(struct uart_port *port) > >> +{ > >> + struct uart_omap_port *up = (struct uart_omap_port *)port; > >> + > >> + if (up->use_dma && !(up->port.x_char)) { > >> + > >> + struct circ_buf *xmit = &up->port.state->xmit; > >> + unsigned int start = up->uart_dma.tx_buf_dma_phys + > >> + (xmit->tail & (UART_XMIT_SIZE - 1)); > >> + if (uart_circ_empty(xmit) || up->uart_dma.tx_dma_state) > >> + return; > >> + spin_lock(&(up->uart_dma.tx_lock)); > >> + up->uart_dma.tx_dma_state = 1; > >> + spin_unlock(&(up->uart_dma.tx_lock)); > >> + > >> + up->uart_dma.tx_buf_size = uart_circ_chars_pending(xmit); > >> + /* > >> + * It is a circular buffer. See if the buffer has wounded back. > >> + * If yes it will have to be transferred in two separate dma > >> + * transfers > >> + */ > >> + if (start + up->uart_dma.tx_buf_size >= > >> + up->uart_dma.tx_buf_dma_phys + UART_XMIT_SIZE) > >> + up->uart_dma.tx_buf_size = > >> + (up->uart_dma.tx_buf_dma_phys + > >> + UART_XMIT_SIZE) - start; > >> + > >> + if (up->uart_dma.tx_dma_channel == 0xFF) > >> + omap_request_dma(up->uart_dma.uart_dma_tx, > >> + "UART Tx DMA", > >> + (void *)uart_tx_dma_callback, up, > >> + &(up->uart_dma.tx_dma_channel)); > > > > You need to check the result from omap_request_dma. On a busy system > > it's quite possible that all DMA channels are taken and you need to > > dynamically fall back to PIO transfer instead. > > > > Looks like this function is easy to fix for that. Maybe you also > > need to reprogram something in the UART for switching between DMA > > and PIO? > > I explored the possibility of falling back to to Interrupt mode when we get an > -EBUSY signal from request dma. > > It is quite complex, as we set DMA mode in FCR [Fifo control register] > and FCR can be configured only when "the baud clock is not running > (DLL_REG and DLH_REG set to 0)." > > So we need to reconfigure complete register set since setting DLL and > DLH to zero means > we need to reconfigure for baudrate again this would affect the mcr > configuration and other > flow control configuration which is set. Thus increasing the > complexity of switching > to interrupt mode. Sure, that's what I figured too.. How about make the reconfigure function non __init for that? Sounds like it will also be needed if we want to power off the uart for off-idle too. This is quite a critical driver to get right, it's the only debug console we have in most cases. Regards, Tony -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html