Commit 7ae87036 authored by Scott Wood's avatar Scott Wood Committed by Kumar Gala

[POWERPC] 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: default avatarScott Wood <scottwood@freescale.com>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent a94b89a4
...@@ -80,14 +80,18 @@ struct uart_cpm_port { ...@@ -80,14 +80,18 @@ struct uart_cpm_port {
int is_portb; int is_portb;
/* wait on close if needed */ /* wait on close if needed */
int wait_closing; 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]; extern int cpm_uart_port_map[UART_NR];
#endif
extern int cpm_uart_nr; extern int cpm_uart_nr;
extern struct uart_cpm_port cpm_uart_ports[UART_NR]; extern struct uart_cpm_port cpm_uart_ports[UART_NR];
/* these are located in their respective files */ /* 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_init_portdesc(void);
int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con); int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con);
void cpm_uart_freebuf(struct uart_cpm_port *pinfo); void cpm_uart_freebuf(struct uart_cpm_port *pinfo);
......
This diff is collapsed.
...@@ -49,9 +49,20 @@ ...@@ -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; ushort val;
int line = port - cpm_uart_ports;
volatile cpm8xx_t *cp = cpmp; volatile cpm8xx_t *cp = cpmp;
switch (line) { switch (line) {
...@@ -114,6 +125,7 @@ void scc4_lineif(struct uart_cpm_port *pinfo) ...@@ -114,6 +125,7 @@ void scc4_lineif(struct uart_cpm_port *pinfo)
/* XXX SCC4: insert port configuration here */ /* XXX SCC4: insert port configuration here */
pinfo->brg = 4; pinfo->brg = 4;
} }
#endif
/* /*
* Allocate DP-Ram and memory buffers. We need to allocate a transmit and * 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) ...@@ -184,6 +196,7 @@ void cpm_uart_freebuf(struct uart_cpm_port *pinfo)
cpm_dpfree(pinfo->dp_addr); cpm_dpfree(pinfo->dp_addr);
} }
#ifndef CONFIG_PPC_CPM_NEW_BINDING
/* Setup any dynamic params in the uart desc */ /* Setup any dynamic params in the uart desc */
int cpm_uart_init_portdesc(void) int cpm_uart_init_portdesc(void)
{ {
...@@ -279,3 +292,4 @@ int cpm_uart_init_portdesc(void) ...@@ -279,3 +292,4 @@ int cpm_uart_init_portdesc(void)
#endif #endif
return 0; return 0;
} }
#endif
...@@ -13,12 +13,14 @@ ...@@ -13,12 +13,14 @@
#include <asm/commproc.h> #include <asm/commproc.h>
/* defines for IRQs */ /* defines for IRQs */
#ifndef CONFIG_PPC_CPM_NEW_BINDING
#define SMC1_IRQ (CPM_IRQ_OFFSET + CPMVEC_SMC1) #define SMC1_IRQ (CPM_IRQ_OFFSET + CPMVEC_SMC1)
#define SMC2_IRQ (CPM_IRQ_OFFSET + CPMVEC_SMC2) #define SMC2_IRQ (CPM_IRQ_OFFSET + CPMVEC_SMC2)
#define SCC1_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC1) #define SCC1_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC1)
#define SCC2_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC2) #define SCC2_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC2)
#define SCC3_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC3) #define SCC3_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC3)
#define SCC4_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC4) #define SCC4_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC4)
#endif
static inline void cpm_set_brg(int brg, int baud) static inline void cpm_set_brg(int brg, int baud)
{ {
......
...@@ -49,9 +49,22 @@ ...@@ -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; ulong val;
int line = port - cpm_uart_ports;
volatile cpm_cpm2_t *cp = cpm2_map(im_cpm); volatile cpm_cpm2_t *cp = cpm2_map(im_cpm);
...@@ -211,6 +224,7 @@ void scc4_lineif(struct uart_cpm_port *pinfo) ...@@ -211,6 +224,7 @@ void scc4_lineif(struct uart_cpm_port *pinfo)
cpm2_unmap(cpmux); cpm2_unmap(cpmux);
cpm2_unmap(io); cpm2_unmap(io);
} }
#endif
/* /*
* Allocate DP-Ram and memory buffers. We need to allocate a transmit and * 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) ...@@ -281,6 +295,7 @@ void cpm_uart_freebuf(struct uart_cpm_port *pinfo)
cpm_dpfree(pinfo->dp_addr); cpm_dpfree(pinfo->dp_addr);
} }
#ifndef CONFIG_PPC_CPM_NEW_BINDING
/* Setup any dynamic params in the uart desc */ /* Setup any dynamic params in the uart desc */
int cpm_uart_init_portdesc(void) int cpm_uart_init_portdesc(void)
{ {
...@@ -386,3 +401,4 @@ int cpm_uart_init_portdesc(void) ...@@ -386,3 +401,4 @@ int cpm_uart_init_portdesc(void)
return 0; return 0;
} }
#endif
...@@ -13,12 +13,14 @@ ...@@ -13,12 +13,14 @@
#include <asm/cpm2.h> #include <asm/cpm2.h>
/* defines for IRQs */ /* defines for IRQs */
#ifndef CONFIG_PPC_CPM_NEW_BINDING
#define SMC1_IRQ SIU_INT_SMC1 #define SMC1_IRQ SIU_INT_SMC1
#define SMC2_IRQ SIU_INT_SMC2 #define SMC2_IRQ SIU_INT_SMC2
#define SCC1_IRQ SIU_INT_SCC1 #define SCC1_IRQ SIU_INT_SCC1
#define SCC2_IRQ SIU_INT_SCC2 #define SCC2_IRQ SIU_INT_SCC2
#define SCC3_IRQ SIU_INT_SCC3 #define SCC3_IRQ SIU_INT_SCC3
#define SCC4_IRQ SIU_INT_SCC4 #define SCC4_IRQ SIU_INT_SCC4
#endif
static inline void cpm_set_brg(int brg, int baud) static inline void cpm_set_brg(int brg, int baud)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment