Kumar, Pantelis,
This patch makes non-console UART work on both 8xx and 82xx. Various
issues are resolved:
- removed unnecessary STOP_TX commands in shutdown - no need to
completely stop CPM TX and reinit BDs each time the port is closing;
- when mem_addr has been allocated via dma_coherent_alloc, virt_to_bus
on it will not tell the truth in most cases
- SCC UART needs to wait several character times even after all the BDs
have READY bit cleared
- adds needed board-specific bits for 86xADS
Tested on 8272ADS, 885ADS and 866ADS development boards.
---------------------------------
Signed-off-by: Vitaly Bordug <redacted>
--
Sincerely,
Vitaly
From: Kumar Gala <hidden> Date: 2005-08-02 18:36:12
I want to test this out on the 8560 ADS to see if works there as well
before pushing upstream.
- kumar
On Aug 2, 2005, at 10:24 AM, Vitaly Bordug wrote:
Kumar, Pantelis,
This patch makes non-console UART work on both 8xx and 82xx. Various
issues are resolved:
- removed unnecessary STOP_TX commands in shutdown - no need to
completely stop CPM TX and reinit BDs each time the port is closing;
- when mem_addr has been allocated via dma_coherent_alloc, virt_to_bus
on it will not tell the truth in most cases
- SCC UART needs to wait several character times even after all the
BDs
have READY bit cleared
- adds needed board-specific bits for 86xADS
Tested on 8272ADS, 885ADS and 866ADS development boards.
---------------------------------
Signed-off-by: Vitaly Bordug <redacted>
--
Sincerely,
Vitaly
<cpm_uart_fixes.patch>
On Tuesday 02 August 2005 18:24, Vitaly Bordug wrote:
Kumar, Pantelis,
This patch makes non-console UART work on both 8xx and 82xx. Various
issues are resolved:
- removed unnecessary STOP_TX commands in shutdown - no need to
completely stop CPM TX and reinit BDs each time the port is closing;
- when mem_addr has been allocated via dma_coherent_alloc, virt_to_bus
on it will not tell the truth in most cases
- SCC UART needs to wait several character times even after all the BDs
have READY bit cleared
- adds needed board-specific bits for 86xADS
Tested on 8272ADS, 885ADS and 866ADS development boards.
---------------------------------
Signed-off-by: Vitaly Bordug <redacted>
Vitaly, this patch is clearly in conflict with mine.
Mind taking a look at my patch and include the changes I've made?
You'll only have to change the cpm2cpu & cpu2cpm functions...
I would also argue that the STOP_TX command is needed at shutdown, since
this is the canonical way serial ports operate in linux. Also you might want
to change the protocol running on an SCC port after shutdown.
The rest are fine...
Regards
Pantelis
@@ -67,6 +69,8 @@ struct uart_cpm_port {intbits;/* Keep track of 'odd' SMC2 wirings */intis_portb;+/* wait on close if needed */+intwait_closing;};externintcpm_uart_port_map[UART_NR];
perhaps, more like...
unsigned long target_jiffies = jiffies + pinfo->wait_closing;
while (!time_after(jiffies, target_jiffies))
schedule();
quoted hunk
/*
* Shutdown the uart
*/
static void cpm_uart_shutdown(struct uart_port *port)
{
struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
- int line = pinfo - cpm_uart_ports;
pr_debug("CPM uart[%d]:shutdown\n", port->line);
@@ -394,6 +413,12 @@ static void cpm_uart_shutdown(struct uar /* If the port is not the console, disable Rx and Tx. */ if (!(pinfo->flags & FLAG_CONSOLE)) {+ /* Wait for all the BDs marked sent */+ while(!cpm_uart_tx_empty(port))+ schedule_timeout(2);+ if(pinfo->wait_closing)+ cpm_uart_wait_until_send(pinfo);+ /* Stop uarts */ if (IS_SMC(pinfo)) { volatile smc_t *smcp = pinfo->smcp;
@@ -405,9 +430,6 @@ static void cpm_uart_shutdown(struct uar sccp->scc_sccm &= ~(UART_SCCM_TX | UART_SCCM_RX); }- /* Shut them really down and reinit buffer descriptors */- cpm_line_cr_cmd(line, CPM_CR_STOP_TX);- cpm_uart_initbd(pinfo); } }
@@ -569,7 +591,10 @@ static int cpm_uart_tx_pump(struct uart_ /* Pick next descriptor and fill from buffer */ bdp = pinfo->tx_cur;- p = bus_to_virt(bdp->cbd_bufaddr);+ if (pinfo->dma_addr)+ p=(u8*)((ulong)(pinfo->mem_addr) + bdp->cbd_bufaddr - pinfo->dma_addr);+ else+ p = bus_to_virt(bdp->cbd_bufaddr);
int bits;
/* Keep track of 'odd' SMC2 wirings */
int is_portb;
+ /* wait on close if needed */
+ int wait_closing;
};
extern int cpm_uart_port_map[UART_NR];
Why the need to mess with the global SCC transmit enable here?
It's dubious IMO.
But without it (at least my boards) will have TX disabled. Just look -
we have enabled this bit in pinfo->sccp->scc_gsmrl within ..._init_scc.
Then all will
be fine until shutdown which will clear it and related in sccp->scc_sccm
as well. The latter will be restored in start_tx, but scc_gsmrl will
not. This results in the only first successful transmission.
/* If the port is not the console, disable Rx and Tx. */
if (!(pinfo->flags & FLAG_CONSOLE)) {
+ /* Wait for all the BDs marked sent */
+ while(!cpm_uart_tx_empty(port))
+ schedule_timeout(2);
+ if(pinfo->wait_closing)
+ cpm_uart_wait_until_send(pinfo);
+
/* Stop uarts */
if (IS_SMC(pinfo)) {
volatile smc_t *smcp = pinfo->smcp;
sccp->scc_sccm &= ~(UART_SCCM_TX | UART_SCCM_RX);
}
- /* Shut them really down and reinit buffer descriptors */
- cpm_line_cr_cmd(line, CPM_CR_STOP_TX);
- cpm_uart_initbd(pinfo);
}
}
@@ -569,7 +591,10 @@ static int cpm_uart_tx_pump(struct uart_
/* Pick next descriptor and fill from buffer */
bdp = pinfo->tx_cur;
- p = bus_to_virt(bdp->cbd_bufaddr);
+ if (pinfo->dma_addr)
+ p=(u8*)((ulong)(pinfo->mem_addr) + bdp->cbd_bufaddr - pinfo->dma_addr);
+ else
+ p = bus_to_virt(bdp->cbd_bufaddr);
this looks bogus to me...
Well, all the stuff works on 8272 even without this and likewise stuff,
but don't on 866ADS, where bus_to_virt returns value not equal to where
we allocated DMA. I didn't dig too deep to track why this happens, since
if we're using DMA, we should remember addresses upon allocation and
avoid using bus_to_virt.
--
Sincerely,
Vitaly
Well, all the stuff works on 8272 even without this and likewise stuff,
but don't on 866ADS, where bus_to_virt returns value not equal to where
we allocated DMA. I didn't dig too deep to track why this happens, since
if we're using DMA, we should remember addresses upon allocation and
avoid using bus_to_virt.
Well, this is weird cause I've tested my latest patch on 8xx and had no
problems...
I'll try to test your patch, some time later today.
However, what is important now is to get the fs_enet driver posted.
Please test the latest patch I've send you on a linus tree and report if you
have any problems...
Regards
Pantelis
Well, all the stuff works on 8272 even without this and likewise stuff,
but don't on 866ADS, where bus_to_virt returns value not equal to where
we allocated DMA. I didn't dig too deep to track why this happens, since
if we're using DMA, we should remember addresses upon allocation and
avoid using bus_to_virt.
Well, this is weird cause I've tested my latest patch on 8xx and had no
problems...
Since currently I have no ability to reproduce this issue, I'm inclined
to drop those hunks. BTW, why those bus_to_virt and virt_to_bus are
used? Isn't it more clear to use pure addresses if they are dma-allocated?
I'll try to test your patch, some time later today.
However, what is important now is to get the fs_enet driver posted.
Please test the latest patch I've send you on a linus tree and report if you
have any problems...
I'll try to test it today/tomorrow as time permits... But do you think
it can proceed with those mii issues? Though they are almost harmless,
the driver will complain that no PHY found but all seem to work fine
subsequently. As far as Andy's phy will likely to be in rc14, maybe we
can try to push this upstream (as what we have currently for 82xx and
especially for 8xx is IMO worse than even incomplete implementation).
I'll try to investigate mii troubles, but it's hard to estimate efforts...