cpm_uart: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
PATCH 9/28 cpm_uart: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
The existing OF glue code was crufty and broken. Rather than fix it, it has been removed, and the serial driver now talks to the device tree directly.
The non-CONFIG_PPC_CPM_NEW_BINDING code can go away once CPM platforms are dropped from arch/ppc (which will hopefully be soon), and existing arch/powerpc boards that I wasn't able to test on for this patchset get converted (which should be even sooner).
Signed-off-by Scott Wood <[email protected]>
---
Resent with asm/of_platform.h -> linux/of_platform.h
drivers/serial/cpm_uart/cpm_uart.h | 6 +- drivers/serial/cpm_uart/cpm_uart_core.c | 241 ++++++++++++++++++++++++++++--- drivers/serial/cpm_uart/cpm_uart_cpm1.c | 16 ++- drivers/serial/cpm_uart/cpm_uart_cpm1.h | 2 + drivers/serial/cpm_uart/cpm_uart_cpm2.c | 18 +++- drivers/serial/cpm_uart/cpm_uart_cpm2.h | 2 + 6 files changed, 260 insertions(+), 25 deletions(-)
drivers/serial/cpm_uart/cpm_uart.h +5 -1
@@ -80,14 +80,18 @@ struct uart_cpm_port {int is_portb;/* wait on close if needed */ int wait_closing; +/* value to combine with opcode to form cpm command */ +u32 command; }; +#ifndef CONFIG_PPC_CPM_NEW_BINDING extern int cpm_uart_port_map[UART_NR ]; +#endif extern int cpm_uart_nr;extern struct uart_cpm_port cpm_uart_ports[UART_NR ];/* these are located in their respective files */ -void cpm_line_cr_cmd (int line,int cmd); +void cpm_line_cr_cmd (struct uart_cpm_port *port,int cmd);int cpm_uart_init_portdesc (void );int cpm_uart_allocbuf (struct uart_cpm_port *pinfo,unsigned int is_con);void cpm_uart_freebuf (struct uart_cpm_port *pinfo);
drivers/serial/cpm_uart/cpm_uart_core.c +219 -22
394 lines not on this page · raw message
drivers/serial/cpm_uart/cpm_uart_cpm1.c +15 -1
@@ -49,9 +49,20 @@/**************************************************************/ -void cpm_line_cr_cmd (int line,int cmd) +#ifdef CONFIG_PPC_CPM_NEW_BINDING +void cpm_line_cr_cmd (struct uart_cpm_port *port,int cmd) +{ +u16 __iomem *cpcr = &cpmp->cp_cpcr; + +out_be16 (cpcr, port->command | (cmd <<8 ) |CPM_CR_FLG ); +while (in_be16 (cpcr) &CPM_CR_FLG ) + ; +} +#else +void cpm_line_cr_cmd (struct uart_cpm_port *port,int cmd) {ushort val; +int line = port - cpm_uart_ports;volatile cpm8xx_t *cp = cpmp;switch (line) {
@@ -114,6 +125,7 @@ void scc4_lineif(struct uart_cpm_port *pinfo)/* XXX SCC4: insert port configuration here */ pinfo->brg = 4; } +#endif /* * Allocate DP-Ram and memory buffers. We need to allocate a transmit and
@@ -184,6 +196,7 @@ void cpm_uart_freebuf(struct uart_cpm_port *pinfo)cpm_dpfree (pinfo->dp_addr); } +#ifndef CONFIG_PPC_CPM_NEW_BINDING /* Setup any dynamic params in the uart desc */ int cpm_uart_init_portdesc (void ) {
@@ -279,3 +292,4 @@ int cpm_uart_init_portdesc(void)#endif return 0; } +#endif
drivers/serial/cpm_uart/cpm_uart_cpm1.h +2 -0
@@ -13,12 +13,14 @@#include <asm/commproc.h> /* defines for IRQs */ +#ifndef CONFIG_PPC_CPM_NEW_BINDING #define SMC1_IRQ (CPM_IRQ_OFFSET + CPMVEC_SMC1)#define SMC2_IRQ (CPM_IRQ_OFFSET + CPMVEC_SMC2)#define SCC1_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC1)#define SCC2_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC2)#define SCC3_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC3)#define SCC4_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC4) +#endif static inline void cpm_set_brg (int brg,int baud) {
drivers/serial/cpm_uart/cpm_uart_cpm2.c +17 -1
@@ -49,9 +49,22 @@/**************************************************************/ -void cpm_line_cr_cmd (int line,int cmd) +#ifdef CONFIG_PPC_CPM_NEW_BINDING +void cpm_line_cr_cmd (struct uart_cpm_port *port,int cmd) +{ +cpm_cpm2_t __iomem *cp =cpm2_map (im_cpm); + +out_be32 (&cp->cp_cpcr, port->command | cmd |CPM_CR_FLG ); +while (in_be32 (&cp->cp_cpcr) &CPM_CR_FLG ) + ; + +cpm2_unmap (cp); +} +#else +void cpm_line_cr_cmd (struct uart_cpm_port *port,int cmd) {ulong val; +int line = port - cpm_uart_ports;volatile cpm_cpm2_t *cp =cpm2_map (im_cpm);
@@ -211,6 +224,7 @@ void scc4_lineif(struct uart_cpm_port *pinfo)cpm2_unmap (cpmux); cpm2_unmap(io); } +#endif /* * Allocate DP-Ram and memory buffers. We need to allocate a transmit and
@@ -281,6 +295,7 @@ void cpm_uart_freebuf(struct uart_cpm_port *pinfo)cpm_dpfree (pinfo->dp_addr); } +#ifndef CONFIG_PPC_CPM_NEW_BINDING /* Setup any dynamic params in the uart desc */ int cpm_uart_init_portdesc (void ) {
@@ -386,3 +401,4 @@ int cpm_uart_init_portdesc(void) return 0; } +#endif
drivers/serial/cpm_uart/cpm_uart_cpm2.h +2 -0
@@ -13,12 +13,14 @@#include <asm/cpm2.h> /* defines for IRQs */ +#ifndef CONFIG_PPC_CPM_NEW_BINDING #define SMC1_IRQ SIU_INT_SMC1#define SMC2_IRQ SIU_INT_SMC2#define SCC1_IRQ SIU_INT_SCC1#define SCC2_IRQ SIU_INT_SCC2#define SCC3_IRQ SIU_INT_SCC3#define SCC4_IRQ SIU_INT_SCC4 +#endif static inline void cpm_set_brg (int brg,int baud) {
Signature · 1 line
1.5.3.1