atmel_serial: keep the platform_device unchanged
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Sun, 10 Apr 2011 06:10:05 +0000 (14:10 +0800)
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Wed, 25 May 2011 15:04:33 +0000 (23:04 +0800)
specify the port num via platform_data this will allow to match the clock
with the plaform_dev staticaly

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Alan 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>
12 files changed:
arch/arm/mach-at91/at572d940hf_devices.c
arch/arm/mach-at91/at91cap9_devices.c
arch/arm/mach-at91/at91rm9200_devices.c
arch/arm/mach-at91/at91sam9260_devices.c
arch/arm/mach-at91/at91sam9261_devices.c
arch/arm/mach-at91/at91sam9263_devices.c
arch/arm/mach-at91/at91sam9g45_devices.c
arch/arm/mach-at91/at91sam9rl_devices.c
arch/arm/mach-at91/include/mach/board.h
arch/avr32/mach-at32ap/at32ap700x.c
arch/avr32/mach-at32ap/include/mach/board.h
drivers/tty/serial/atmel_serial.c

index 0fc20a240782a933a3f18e70c94668d10294d2b9..e52c8e078b0ff73185705aa792dbd61155861fa8 100644 (file)
@@ -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)
 {
        struct platform_device *pdev;
+       struct atmel_uart_data *pdata;
 
        switch (id) {
                case 0:         /* DBGU */
@@ -847,7 +848,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
                default:
                        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)
                at91_uarts[portnr] = pdev;
index 21020ceb2f3ac308064c52d5e5379c02c9d8ca73..ffda9099f6faccc41c2955eddc5fc7e860c17e13 100644 (file)
@@ -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)
 {
        struct platform_device *pdev;
+       struct atmel_uart_data *pdata;
 
        switch (id) {
                case 0:         /* DBGU */
@@ -1224,7 +1225,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
                default:
                        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)
                at91_uarts[portnr] = pdev;
index 7b539228e0efb324b258d8e247c1e14c060fb30a..761559e589a3b20542f561ebb6af15f5fe5b3210 100644 (file)
@@ -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)
 {
        struct platform_device *pdev;
+       struct atmel_uart_data *pdata;
 
        switch (id) {
                case 0:         /* DBGU */
@@ -1139,7 +1140,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
                default:
                        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)
                at91_uarts[portnr] = pdev;
index 07eb7b07e442a69c9499b71cf49387f6ecd240e6..6f8ec8d16d5ad621a383c829f2112a6d7b147ba6 100644 (file)
@@ -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)
 {
        struct platform_device *pdev;
+       struct atmel_uart_data *pdata;
 
        switch (id) {
                case 0:         /* DBGU */
@@ -1179,7 +1180,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
                default:
                        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)
                at91_uarts[portnr] = pdev;
index 59fc48311fb07d11760382e85e5ff386986a93f6..8792f9bfb6b0fab870e6fe5845d3bf7d1f7fba17 100644 (file)
@@ -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)
 {
        struct platform_device *pdev;
+       struct atmel_uart_data *pdata;
 
        switch (id) {
                case 0:         /* DBGU */
@@ -1014,7 +1015,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
                default:
                        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)
                at91_uarts[portnr] = pdev;
index fb5c23af1017ed13c480ae324bf90b6b7d566bf1..47a9f965bbb59ee23218aec197d71c9c6c79a923 100644 (file)
@@ -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)
 {
        struct platform_device *pdev;
+       struct atmel_uart_data *pdata;
 
        switch (id) {
                case 0:         /* DBGU */
@@ -1395,7 +1396,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
                default:
                        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)
                at91_uarts[portnr] = pdev;
index 5e9f8a4c38df0d900c326287debd0ea8ce57f604..eee27eed913341ccac1e14c5e1a2edbac7219caa 100644 (file)
@@ -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)
 {
        struct platform_device *pdev;
+       struct atmel_uart_data *pdata;
 
        switch (id) {
                case 0:         /* DBGU */
@@ -1557,7 +1558,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
                default:
                        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)
                at91_uarts[portnr] = pdev;
index c49262bddd851db28d12415c73203a532ae3d431..d194b085848efc7138bf6688420cb7f176f7e221 100644 (file)
@@ -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)
 {
        struct platform_device *pdev;
+       struct atmel_uart_data *pdata;
 
        switch (id) {
                case 0:         /* DBGU */
@@ -1171,7 +1172,8 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
                default:
                        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)
                at91_uarts[portnr] = pdev;
index 2b499eb343a12a082ad5d0a862c0fb3fb9e722a5..c44e94e22857093fa2324d72ed6399922b734ba4 100644 (file)
@@ -140,6 +140,7 @@ extern void __init at91_set_serial_console(unsigned portnr);
 extern struct platform_device *atmel_default_console_device;
 
 struct atmel_uart_data {
+       int                     num;            /* port num */
        short                   use_dma_tx;     /* use transmit DMA? */
        short                   use_dma_rx;     /* use receive DMA? */
        void __iomem            *regs;          /* virt. base address, if any */
index bfc9d071db9bce219985b62a5c80446ff7a1f3e5..aa677e2a3823d89272ed42a367400be93598c2fa 100644 (file)
@@ -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)
 {
        struct platform_device *pdev;
+       struct atmel_uart_data *pdata;
 
        switch (hw_id) {
        case 0:
@@ -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;
        }
 
-       pdev->id = line;
+       pdata = pdev->dev.platform_data;
+       pdata->num = portnr;
        at32_usarts[line] = pdev;
 }
 
index 61740201b3115eb7988ff3eca6728195f5d90d8b..679458d9a622365afd30fe371c229567dedc83cb 100644 (file)
@@ -33,6 +33,7 @@ extern struct platform_device *atmel_default_console_device;
 #define        ATMEL_USART_CLK         0x04
 
 struct atmel_uart_data {
+       int             num;            /* port num */
        short           use_dma_tx;     /* use transmit DMA? */
        short           use_dma_rx;     /* use receive DMA? */
        void __iomem    *regs;          /* virtual base address, if any */
index 652bdac8ce8ec4a56e9cb99506d0d61744c9661b..6d5d6e679fc7f59c568a0a1afbac800e51f91e49 100644 (file)
@@ -1420,7 +1420,7 @@ static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port,
        port->flags             = UPF_BOOT_AUTOCONF;
        port->ops               = &atmel_pops;
        port->fifosize          = 1;
-       port->line              = pdev->id;
+       port->line              = data->num;
        port->dev               = &pdev->dev;
        port->mapbase   = pdev->resource[0].start;
        port->irq       = pdev->resource[1].start;