atmel_serial: keep the platform_device unchanged

specify the port num via platform_data this will allow to match the clock
with the plaform_dev staticaly
Signed-off-by: default avatarJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: default avatarAlan Cox <alan@linux.intel.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Patrice Vilchez <patrice.vilchez@atmel.com>
Cc: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
parent dd41d321
...@@ -822,6 +822,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi ...@@ -822,6 +822,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi
void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
{ {
struct platform_device *pdev; struct platform_device *pdev;
struct atmel_uart_data *pdata;
switch (id) { switch (id) {
case 0: /* DBGU */ case 0: /* DBGU */
...@@ -847,7 +848,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) ...@@ -847,7 +848,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
default: default:
return; return;
} }
pdev->id = portnr; /* update to mapped ID */ pdata = pdev->dev.platform_data;
pdata->num = portnr; /* update to mapped ID */
if (portnr < ATMEL_MAX_UART) if (portnr < ATMEL_MAX_UART)
at91_uarts[portnr] = pdev; at91_uarts[portnr] = pdev;
......
...@@ -1199,6 +1199,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi ...@@ -1199,6 +1199,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi
void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
{ {
struct platform_device *pdev; struct platform_device *pdev;
struct atmel_uart_data *pdata;
switch (id) { switch (id) {
case 0: /* DBGU */ case 0: /* DBGU */
...@@ -1224,7 +1225,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) ...@@ -1224,7 +1225,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
default: default:
return; return;
} }
pdev->id = portnr; /* update to mapped ID */ pdata = pdev->dev.platform_data;
pdata->num = portnr; /* update to mapped ID */
if (portnr < ATMEL_MAX_UART) if (portnr < ATMEL_MAX_UART)
at91_uarts[portnr] = pdev; at91_uarts[portnr] = pdev;
......
...@@ -1109,6 +1109,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi ...@@ -1109,6 +1109,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi
void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
{ {
struct platform_device *pdev; struct platform_device *pdev;
struct atmel_uart_data *pdata;
switch (id) { switch (id) {
case 0: /* DBGU */ case 0: /* DBGU */
...@@ -1139,7 +1140,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) ...@@ -1139,7 +1140,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
default: default:
return; return;
} }
pdev->id = portnr; /* update to mapped ID */ pdata = pdev->dev.platform_data;
pdata->num = portnr; /* update to mapped ID */
if (portnr < ATMEL_MAX_UART) if (portnr < ATMEL_MAX_UART)
at91_uarts[portnr] = pdev; at91_uarts[portnr] = pdev;
......
...@@ -1139,6 +1139,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi ...@@ -1139,6 +1139,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi
void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
{ {
struct platform_device *pdev; struct platform_device *pdev;
struct atmel_uart_data *pdata;
switch (id) { switch (id) {
case 0: /* DBGU */ case 0: /* DBGU */
...@@ -1179,7 +1180,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) ...@@ -1179,7 +1180,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
default: default:
return; return;
} }
pdev->id = portnr; /* update to mapped ID */ pdata = pdev->dev.platform_data;
pdata->num = portnr; /* update to mapped ID */
if (portnr < ATMEL_MAX_UART) if (portnr < ATMEL_MAX_UART)
at91_uarts[portnr] = pdev; at91_uarts[portnr] = pdev;
......
...@@ -989,6 +989,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi ...@@ -989,6 +989,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi
void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
{ {
struct platform_device *pdev; struct platform_device *pdev;
struct atmel_uart_data *pdata;
switch (id) { switch (id) {
case 0: /* DBGU */ case 0: /* DBGU */
...@@ -1014,7 +1015,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) ...@@ -1014,7 +1015,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
default: default:
return; return;
} }
pdev->id = portnr; /* update to mapped ID */ pdata = pdev->dev.platform_data;
pdata->num = portnr; /* update to mapped ID */
if (portnr < ATMEL_MAX_UART) if (portnr < ATMEL_MAX_UART)
at91_uarts[portnr] = pdev; at91_uarts[portnr] = pdev;
......
...@@ -1370,6 +1370,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi ...@@ -1370,6 +1370,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi
void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
{ {
struct platform_device *pdev; struct platform_device *pdev;
struct atmel_uart_data *pdata;
switch (id) { switch (id) {
case 0: /* DBGU */ case 0: /* DBGU */
...@@ -1395,7 +1396,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) ...@@ -1395,7 +1396,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
default: default:
return; return;
} }
pdev->id = portnr; /* update to mapped ID */ pdata = pdev->dev.platform_data;
pdata->num = portnr; /* update to mapped ID */
if (portnr < ATMEL_MAX_UART) if (portnr < ATMEL_MAX_UART)
at91_uarts[portnr] = pdev; at91_uarts[portnr] = pdev;
......
...@@ -1527,6 +1527,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi ...@@ -1527,6 +1527,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi
void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
{ {
struct platform_device *pdev; struct platform_device *pdev;
struct atmel_uart_data *pdata;
switch (id) { switch (id) {
case 0: /* DBGU */ case 0: /* DBGU */
...@@ -1557,7 +1558,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) ...@@ -1557,7 +1558,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
default: default:
return; return;
} }
pdev->id = portnr; /* update to mapped ID */ pdata = pdev->dev.platform_data;
pdata->num = portnr; /* update to mapped ID */
if (portnr < ATMEL_MAX_UART) if (portnr < ATMEL_MAX_UART)
at91_uarts[portnr] = pdev; at91_uarts[portnr] = pdev;
......
...@@ -1141,6 +1141,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi ...@@ -1141,6 +1141,7 @@ struct platform_device *atmel_default_console_device; /* the serial console devi
void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
{ {
struct platform_device *pdev; struct platform_device *pdev;
struct atmel_uart_data *pdata;
switch (id) { switch (id) {
case 0: /* DBGU */ case 0: /* DBGU */
...@@ -1171,7 +1172,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) ...@@ -1171,7 +1172,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
default: default:
return; return;
} }
pdev->id = portnr; /* update to mapped ID */ pdata = pdev->dev.platform_data;
pdata->num = portnr; /* update to mapped ID */
if (portnr < ATMEL_MAX_UART) if (portnr < ATMEL_MAX_UART)
at91_uarts[portnr] = pdev; at91_uarts[portnr] = pdev;
......
...@@ -140,6 +140,7 @@ extern void __init at91_set_serial_console(unsigned portnr); ...@@ -140,6 +140,7 @@ extern void __init at91_set_serial_console(unsigned portnr);
extern struct platform_device *atmel_default_console_device; extern struct platform_device *atmel_default_console_device;
struct atmel_uart_data { struct atmel_uart_data {
int num; /* port num */
short use_dma_tx; /* use transmit DMA? */ short use_dma_tx; /* use transmit DMA? */
short use_dma_rx; /* use receive DMA? */ short use_dma_rx; /* use receive DMA? */
void __iomem *regs; /* virt. base address, if any */ void __iomem *regs; /* virt. base address, if any */
......
...@@ -1014,6 +1014,7 @@ static struct platform_device *__initdata at32_usarts[4]; ...@@ -1014,6 +1014,7 @@ static struct platform_device *__initdata at32_usarts[4];
void __init at32_map_usart(unsigned int hw_id, unsigned int line, int flags) void __init at32_map_usart(unsigned int hw_id, unsigned int line, int flags)
{ {
struct platform_device *pdev; struct platform_device *pdev;
struct atmel_uart_data *pdata;
switch (hw_id) { switch (hw_id) {
case 0: case 0:
...@@ -1042,7 +1043,8 @@ void __init at32_map_usart(unsigned int hw_id, unsigned int line, int flags) ...@@ -1042,7 +1043,8 @@ void __init at32_map_usart(unsigned int hw_id, unsigned int line, int flags)
data->regs = (void __iomem *)pdev->resource[0].start; data->regs = (void __iomem *)pdev->resource[0].start;
} }
pdev->id = line; pdata = pdev->dev.platform_data;
pdata->num = portnr;
at32_usarts[line] = pdev; at32_usarts[line] = pdev;
} }
......
...@@ -33,6 +33,7 @@ extern struct platform_device *atmel_default_console_device; ...@@ -33,6 +33,7 @@ extern struct platform_device *atmel_default_console_device;
#define ATMEL_USART_CLK 0x04 #define ATMEL_USART_CLK 0x04
struct atmel_uart_data { struct atmel_uart_data {
int num; /* port num */
short use_dma_tx; /* use transmit DMA? */ short use_dma_tx; /* use transmit DMA? */
short use_dma_rx; /* use receive DMA? */ short use_dma_rx; /* use receive DMA? */
void __iomem *regs; /* virtual base address, if any */ void __iomem *regs; /* virtual base address, if any */
......
...@@ -1420,7 +1420,7 @@ static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port, ...@@ -1420,7 +1420,7 @@ static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port,
port->flags = UPF_BOOT_AUTOCONF; port->flags = UPF_BOOT_AUTOCONF;
port->ops = &atmel_pops; port->ops = &atmel_pops;
port->fifosize = 1; port->fifosize = 1;
port->line = pdev->id; port->line = data->num;
port->dev = &pdev->dev; port->dev = &pdev->dev;
port->mapbase = pdev->resource[0].start; port->mapbase = pdev->resource[0].start;
port->irq = pdev->resource[1].start; port->irq = pdev->resource[1].start;
......
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