From 4ff9bbaa67ff75d0425eb910bd4a8eb1b1e4aaab Mon Sep 17 00:00:00 2001 From: Roshni Shah Date: Tue, 7 Jan 2014 00:34:13 -0500 Subject: Fixed a panic seen as soon as you type a character on the terminal when EDMA is disabled in UART config. The receive interrupt was attempting to schedule a work queue only defined if EDMA is enabled. kernel BUG at kernel/workqueue.c:1037! Unable to handle kernel NULL pointer dereference at virtual address 00000000 --- drivers/tty/serial/mvf.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/tty/serial/mvf.c b/drivers/tty/serial/mvf.c index 814a7daa56f0..1b730afd4312 100644 --- a/drivers/tty/serial/mvf.c +++ b/drivers/tty/serial/mvf.c @@ -84,22 +84,22 @@ struct imx_port { unsigned int format_9bits:1; /* 9bits data format */ unsigned short trcv_delay; /* transceiver delay */ unsigned char ma_addr; /* Match address */ - struct clk *clk; + struct clk *clk; unsigned int tx_fifo_size, rx_fifo_size; /* DMA fields */ - int enable_dma; + int enable_dma; unsigned long dma_tx_ch; /* configured eDMA channel */ struct imx_dma_data dma_data; struct dma_chan *dma_chan_rx, *dma_chan_tx; struct scatterlist rx_sgl, tx_sgl; - void *rx_buf; + void *rx_buf; unsigned char *tx_buf; unsigned int rx_bytes, tx_bytes; struct work_struct tsk_rx, tsk_dma_tx; unsigned int dma_tx_nents; - bool dma_is_rxing, dma_is_txing; + bool dma_is_rxing, dma_is_txing; wait_queue_head_t dma_wait; }; @@ -226,21 +226,21 @@ static void tx_uart_dmarun(struct imx_port *sport) if (sport->dma_tx_nents == 0) return; - mcf_edma_set_tcd_params(sport->dma_tx_ch, - (u32)sg_phys(&sport->tx_sgl), - (u32)(sport->port.mapbase + MXC_UARTDR), + mcf_edma_set_tcd_params(sport->dma_tx_ch, /* channel number */ + (u32)sg_phys(&sport->tx_sgl), /* source */ + (u32)(sport->port.mapbase + MXC_UARTDR), /* dest */ MCF_EDMA_TCD_ATTR_SSIZE_8BIT | - MCF_EDMA_TCD_ATTR_DSIZE_8BIT, - 1, - 1, - 0, - sport->tx_bytes, - 0, - 0, - 0, + MCF_EDMA_TCD_ATTR_DSIZE_8BIT, /* attr */ + 1, /* soff */ + 1, /* nbytes */ + 0, /* slast */ + sport->tx_bytes, /* citer */ + 0, /* biter */ + 0, /* doff */ + 0, /* dlast_sga */ 1, /* major_int */ 1, /* disable_req */ - 0 + 0 /* enabled sg */ ); sport->dma_is_txing = 1; mcf_edma_enable_transfer(sport->dma_tx_ch); @@ -304,7 +304,7 @@ static void dma_tx_work(struct work_struct *w) { if (sport->port.state->port.tty) { - uart_write_wakeup(&sport->port); + uart_write_wakeup(&sport->port); } } @@ -359,7 +359,7 @@ static irqreturn_t imx_txint(int irq, void *dev_id) { if (sport->port.state->port.tty) { - uart_write_wakeup(&sport->port); + uart_write_wakeup(&sport->port); } } @@ -446,8 +446,10 @@ static irqreturn_t imx_rxint(int irq, void *dev_id) out: spin_unlock_irqrestore(&sport->port.lock, flags); - //TODO: Check tsk_rx, seems to be edma related. - schedule_work(&sport->tsk_rx); + if (sport->rx_bytes) { + tty_flip_buffer_push(tty); + sport->rx_bytes = 0; + } return IRQ_HANDLED; } -- cgit v1.2.3 From aed6c4fe50bfa2b5f4d30f99e984cd6bae224158 Mon Sep 17 00:00:00 2001 From: Anthony Felice Date: Thu, 27 Mar 2014 15:53:09 -0400 Subject: twr_vf600: Disabled EDMA in UART Configuration EDMA enabled in the UART configuration prevents ADC from working in MQX 4.0.2. We also disable EDMA with UART in other Vybrid variants due to an incompatibility with sysvinit. --- arch/arm/mach-mvf/board-twr-vf700.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mvf/board-twr-vf700.c b/arch/arm/mach-mvf/board-twr-vf700.c index 3c19b1c70ec9..576233588dde 100644 --- a/arch/arm/mach-mvf/board-twr-vf700.c +++ b/arch/arm/mach-mvf/board-twr-vf700.c @@ -249,13 +249,13 @@ static struct platform_device mvf_twr_audio_device = { }; static struct imxuart_platform_data mvf_uart1_pdata = { - .flags = IMXUART_FIFO | IMXUART_EDMA, + .flags = IMXUART_FIFO, .dma_req_rx = DMA_MUX03_UART1_RX, .dma_req_tx = DMA_MUX03_UART1_TX, }; static struct imxuart_platform_data mvf_uart0_pdata = { - .flags = IMXUART_FIFO | IMXUART_EDMA, + .flags = IMXUART_FIFO, .dma_req_rx = DMA_MUX03_UART0_RX, .dma_req_tx = DMA_MUX03_UART0_TX, }; -- cgit v1.2.3 From d815c9701e9c6990f4311f24b7f15c48e077dbba Mon Sep 17 00:00:00 2001 From: Anthony Felice Date: Tue, 1 Apr 2014 16:09:04 -0400 Subject: mvf: Allow DMA channel 0 to be used in imx_shutdown in the serial driver. --- drivers/tty/serial/mvf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/mvf.c b/drivers/tty/serial/mvf.c index 1b730afd4312..0ea0181cd455 100644 --- a/drivers/tty/serial/mvf.c +++ b/drivers/tty/serial/mvf.c @@ -647,10 +647,10 @@ static void imx_shutdown(struct uart_port *port) if (sport->enable_dma) { /* We have to wait for the DMA to finish. */ - if (sport->dma_tx_ch) { + if (sport->dma_tx_ch >= 0) { mcf_edma_stop_transfer(sport->dma_tx_ch); mcf_edma_free_channel(sport->dma_tx_ch, sport); - sport->dma_tx_ch = 0; + sport->dma_tx_ch = -1; } } -- cgit v1.2.3 From b2faeb5472fe71b505a103388b8a8540dbd47134 Mon Sep 17 00:00:00 2001 From: Andy Voltz Date: Thu, 6 Jun 2013 11:48:44 -0400 Subject: mvf_fec.c: Fix mac address read to match fuse layout for latest u-boot --- arch/arm/mach-mvf/mvf_fec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-mvf/mvf_fec.c b/arch/arm/mach-mvf/mvf_fec.c index d51f20519c0b..1ab339b9252e 100644 --- a/arch/arm/mach-mvf/mvf_fec.c +++ b/arch/arm/mach-mvf/mvf_fec.c @@ -35,13 +35,13 @@ static int fec_get_mac_addr(unsigned char *mac) unsigned int value; value = readl(MVF_IO_ADDRESS(MVF_FEC_BASE_ADDR) + ENET_PALR); - mac[2] = value & 0xff; - mac[3] = (value >> 8) & 0xff; - mac[4] = (value >> 16) & 0xff; - mac[5] = (value >> 24) & 0xff; + mac[3] = value & 0xff; + mac[2] = (value >> 8) & 0xff; + mac[1] = (value >> 16) & 0xff; + mac[0] = (value >> 24) & 0xff; value = readl(MVF_IO_ADDRESS(MVF_FEC_BASE_ADDR) + ENET_PAUR); - mac[0] = (value >> 16) & 0xff; - mac[1] = (value >> 24) & 0xff; + mac[5] = (value >> 16) & 0xff; + mac[4] = (value >> 24) & 0xff; return 0; } -- cgit v1.2.3