Skip to content

Commit

Permalink
8250: three way resolve of the 8250 diffs
Browse files Browse the repository at this point in the history
This resolves the differences between the original 8250 patch, the revised 8250 patch
and the independant clean up of the octeon driver (to use platform devices properly yay!)

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Jul 17, 2012
1 parent 9833fac commit ce7240e
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 60 deletions.
16 changes: 8 additions & 8 deletions drivers/char/mwave/mwavedd.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ static ssize_t mwave_write(struct file *file, const char __user *buf,

static int register_serial_portandirq(unsigned int port, int irq)
{
struct uart_port uart;
struct uart_8250_port uart;

switch ( port ) {
case 0x3f8:
Expand Down Expand Up @@ -462,14 +462,14 @@ static int register_serial_portandirq(unsigned int port, int irq)
} /* switch */
/* irq is okay */

memset(&uart, 0, sizeof(struct uart_port));
memset(&uart, 0, sizeof(uart));

uart.uartclk = 1843200;
uart.iobase = port;
uart.irq = irq;
uart.iotype = UPIO_PORT;
uart.flags = UPF_SHARE_IRQ;
return serial8250_register_port(&uart);
uart.port.uartclk = 1843200;
uart.port.iobase = port;
uart.port.irq = irq;
uart.port.iotype = UPIO_PORT;
uart.port.flags = UPF_SHARE_IRQ;
return serial8250_register_8250_port(&uart);
}


Expand Down
16 changes: 8 additions & 8 deletions drivers/misc/ibmasm/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

void ibmasm_register_uart(struct service_processor *sp)
{
struct uart_port uport;
struct uart_8250_port uart;
void __iomem *iomem_base;

iomem_base = sp->base_address + SCOUT_COM_B_BASE;
Expand All @@ -47,14 +47,14 @@ void ibmasm_register_uart(struct service_processor *sp)
return;
}

memset(&uport, 0, sizeof(struct uart_port));
uport.irq = sp->irq;
uport.uartclk = 3686400;
uport.flags = UPF_SHARE_IRQ;
uport.iotype = UPIO_MEM;
uport.membase = iomem_base;
memset(&uart, 0, sizeof(uart));
uart.port.irq = sp->irq;
uart.port.uartclk = 3686400;
uart.port.flags = UPF_SHARE_IRQ;
uart.port.iotype = UPIO_MEM;
uart.port.membase = iomem_base;

sp->serial_line = serial8250_register_port(&uport);
sp->serial_line = serial8250_register_8250_port(&uart);
if (sp->serial_line < 0) {
dev_err(sp->dev, "Failed to register serial port\n");
return;
Expand Down
22 changes: 12 additions & 10 deletions drivers/net/ethernet/sgi/ioc3-eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1147,15 +1147,17 @@ static void __devinit ioc3_8250_register(struct ioc3_uartregs __iomem *uart)
{
#define COSMISC_CONSTANT 6

struct uart_port port = {
.irq = 0,
.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
.regshift = 0,
.uartclk = (22000000 << 1) / COSMISC_CONSTANT,

.membase = (unsigned char __iomem *) uart,
.mapbase = (unsigned long) uart,
struct uart_8250_port port = {
.port = {
.irq = 0,
.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
.regshift = 0,
.uartclk = (22000000 << 1) / COSMISC_CONSTANT,

.membase = (unsigned char __iomem *) uart,
.mapbase = (unsigned long) uart,
}
};
unsigned char lcr;

Expand All @@ -1164,7 +1166,7 @@ static void __devinit ioc3_8250_register(struct ioc3_uartregs __iomem *uart)
uart->iu_scr = COSMISC_CONSTANT,
uart->iu_lcr = lcr;
uart->iu_lcr;
serial8250_register_port(&port);
serial8250_register_8250_port(&port);
}

static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3)
Expand Down
30 changes: 0 additions & 30 deletions drivers/tty/serial/8250/8250.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,6 @@

#include <linux/serial_8250.h>

struct uart_8250_port {
struct uart_port port;
struct timer_list timer; /* "no irq" timer */
struct list_head list; /* ports on this IRQ */
unsigned short capabilities; /* port capabilities */
unsigned short bugs; /* port bugs */
unsigned int tx_loadsz; /* transmit fifo load size */
unsigned char acr;
unsigned char ier;
unsigned char lcr;
unsigned char mcr;
unsigned char mcr_mask; /* mask of user bits */
unsigned char mcr_force; /* mask of forced bits */
unsigned char cur_iotype; /* Running I/O type */

/*
* Some bits in registers are cleared on a read, so they must
* be saved whenever the register is read but the bits will not
* be immediately processed.
*/
#define LSR_SAVE_FLAGS UART_LSR_BRK_ERROR_BITS
unsigned char lsr_saved_flags;
#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
unsigned char msr_saved_flags;

/* 8250 specific callbacks */
int (*dl_read)(struct uart_8250_port *);
void (*dl_write)(struct uart_8250_port *, int);
};

struct old_serial_port {
unsigned int uart;
unsigned int baud_base;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/8250/8250_dw.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static int __devinit dw8250_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "no clock-frequency property set\n");
return -EINVAL;
}
uart.uart.port.uartclk = val;
uart.port.uartclk = val;

data->line = serial8250_register_8250_port(&uart);
if (data->line < 0)
Expand Down
9 changes: 8 additions & 1 deletion drivers/tty/serial/of_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,15 @@ static int __devinit of_platform_serial_probe(struct platform_device *ofdev)
switch (port_type) {
#ifdef CONFIG_SERIAL_8250
case PORT_8250 ... PORT_MAX_8250:
ret = serial8250_register_port(&port);
{
/* For now the of bindings don't support the extra
8250 specific bits */
struct uart_8250_port port8250;
memset(&port8250, 0, sizeof(port8250));
port8250.port = port;
ret = serial8250_register_8250_port(&port8250);
break;
}
#endif
#ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL
case PORT_NWPSERIAL:
Expand Down
32 changes: 30 additions & 2 deletions include/linux/serial_8250.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,36 @@ enum {
* platform device. Using these will make your driver
* dependent on the 8250 driver.
*/
struct uart_port;
struct uart_8250_port;

struct uart_8250_port {
struct uart_port port;
struct timer_list timer; /* "no irq" timer */
struct list_head list; /* ports on this IRQ */
unsigned short capabilities; /* port capabilities */
unsigned short bugs; /* port bugs */
unsigned int tx_loadsz; /* transmit fifo load size */
unsigned char acr;
unsigned char ier;
unsigned char lcr;
unsigned char mcr;
unsigned char mcr_mask; /* mask of user bits */
unsigned char mcr_force; /* mask of forced bits */
unsigned char cur_iotype; /* Running I/O type */

/*
* Some bits in registers are cleared on a read, so they must
* be saved whenever the register is read but the bits will not
* be immediately processed.
*/
#define LSR_SAVE_FLAGS UART_LSR_BRK_ERROR_BITS
unsigned char lsr_saved_flags;
#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
unsigned char msr_saved_flags;

/* 8250 specific callbacks */
int (*dl_read)(struct uart_8250_port *);
void (*dl_write)(struct uart_8250_port *, int);
};

int serial8250_register_8250_port(struct uart_8250_port *);
void serial8250_unregister_port(int line);
Expand Down

0 comments on commit ce7240e

Please sign in to comment.