serial: tegra_hsuart: Use resources instead of platform data.
authorJaikumar Ganesh <jaikumar@google.com>
Sat, 20 Nov 2010 02:23:29 +0000 (18:23 -0800)
committerJaikumar Ganesh <jaikumar@google.com>
Wed, 24 Nov 2010 23:11:24 +0000 (15:11 -0800)
Use resources to pass data to tegra_hsuart to set
mapbase, irq.

Signed-off-by: Jaikumar Ganesh <jaikumar@google.com>
arch/arm/mach-tegra/devices.c
arch/arm/mach-tegra/devices.h
drivers/serial/tegra_hsuart.c

index d976fc49ec527f264f61b506876ccca439a4f690..8059e039fc0125a194327882f0e74ed812d7060c 100644 (file)
@@ -638,102 +638,117 @@ struct platform_device tegra_pwfm3_device = {
        .resource       = &tegra_pwfm3_resource,
 };
 
-static struct plat_serial8250_port tegra_uart0_port[] = {
+static struct resource tegra_uarta_resources[] = {
        [0] = {
-               .mapbase        = TEGRA_UARTA_BASE,
-               .membase        = IO_ADDRESS(TEGRA_UARTA_BASE),
-               .irq            = INT_UARTA,
+               .start  = TEGRA_UARTA_BASE,
+               .end    = TEGRA_UARTA_BASE + TEGRA_UARTA_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .flags          = 0,
+               .start  = INT_UARTA,
+               .end    = INT_UARTA,
+               .flags  = IORESOURCE_IRQ,
        },
 };
 
-static struct plat_serial8250_port tegra_uart1_port[] = {
+static struct resource tegra_uartb_resources[]= {
        [0] = {
-               .mapbase        = TEGRA_UARTB_BASE,
-               .membase        = IO_ADDRESS(TEGRA_UARTB_BASE),
-               .irq            = INT_UARTB,
+               .start  = TEGRA_UARTB_BASE,
+               .end    = TEGRA_UARTB_BASE + TEGRA_UARTB_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .flags          = 0,
+               .start  = INT_UARTB,
+               .end    = INT_UARTB,
+               .flags  = IORESOURCE_IRQ,
        },
 };
 
-static struct plat_serial8250_port tegra_uart2_port[] = {
+static struct resource tegra_uartc_resources[] = {
        [0] = {
-               .mapbase        = TEGRA_UARTC_BASE,
-               .membase        = IO_ADDRESS(TEGRA_UARTC_BASE),
-               .irq            = INT_UARTC,
+               .start  = TEGRA_UARTC_BASE,
+               .end    = TEGRA_UARTC_BASE + TEGRA_UARTC_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .flags          = 0,
+               .start  = INT_UARTC,
+               .end    = INT_UARTC,
+               .flags  = IORESOURCE_IRQ,
        },
 };
 
-static struct plat_serial8250_port tegra_uart3_port[] = {
+static struct resource tegra_uartd_resources[] = {
        [0] = {
-               .mapbase        = TEGRA_UARTD_BASE,
-               .membase        = IO_ADDRESS(TEGRA_UARTD_BASE),
-               .irq            = INT_UARTD,
+               .start  = TEGRA_UARTD_BASE,
+               .end    = TEGRA_UARTD_BASE + TEGRA_UARTD_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .flags          = 0,
+               .start  = INT_UARTD,
+               .end    = INT_UARTD,
+               .flags  = IORESOURCE_IRQ,
        },
 };
 
-static struct plat_serial8250_port tegra_uart4_port[] = {
+static struct resource tegra_uarte_resources[] = {
        [0] = {
-               .mapbase        = TEGRA_UARTE_BASE,
-               .membase        = IO_ADDRESS(TEGRA_UARTE_BASE),
-               .irq            = INT_UARTE,
+               .start  = TEGRA_UARTE_BASE,
+               .end    = TEGRA_UARTE_BASE + TEGRA_UARTE_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .flags          = 0,
+               .start  = INT_UARTE,
+               .end    = INT_UARTE,
+               .flags  = IORESOURCE_IRQ,
        },
 };
 
-struct platform_device tegra_uart0_device = {
+struct platform_device tegra_uarta_device = {
        .name   = "tegra_uart",
        .id     = 0,
+       .num_resources  = ARRAY_SIZE(tegra_uarta_resources),
+       .resource       = tegra_uarta_resources,
        .dev    = {
-               .platform_data          = tegra_uart0_port,
                .coherent_dma_mask      = DMA_BIT_MASK(32),
        },
 };
 
-struct platform_device tegra_uart1_device = {
+struct platform_device tegra_uartb_device = {
        .name   = "tegra_uart",
        .id     = 1,
+       .num_resources  = ARRAY_SIZE(tegra_uartb_resources),
+       .resource       = tegra_uartb_resources,
        .dev    = {
-               .platform_data          = tegra_uart1_port,
                .coherent_dma_mask      = DMA_BIT_MASK(32),
        },
 };
 
-struct platform_device tegra_uart2_device = {
+struct platform_device tegra_uartc_device = {
        .name   = "tegra_uart",
        .id     = 2,
+       .num_resources  = ARRAY_SIZE(tegra_uartc_resources),
+       .resource       = tegra_uartc_resources,
        .dev    = {
-               .platform_data          = tegra_uart2_port,
                .coherent_dma_mask      = DMA_BIT_MASK(32),
        },
 };
 
-struct platform_device tegra_uart3_device = {
+struct platform_device tegra_uartd_device = {
        .name   = "tegra_uart",
        .id     = 3,
+       .num_resources  = ARRAY_SIZE(tegra_uartd_resources),
+       .resource       = tegra_uartd_resources,
        .dev    = {
-               .platform_data          = tegra_uart3_port,
                .coherent_dma_mask      = DMA_BIT_MASK(32),
        },
 };
 
-struct platform_device tegra_uart4_device = {
+struct platform_device tegra_uarte_device = {
        .name   = "tegra_uart",
        .id     = 4,
+       .num_resources  = ARRAY_SIZE(tegra_uarte_resources),
+       .resource       = tegra_uarte_resources,
        .dev    = {
-               .platform_data          = tegra_uart4_port,
                .coherent_dma_mask      = DMA_BIT_MASK(32),
        },
 };
index d309313bf7dc590052b9dd64b9cd96ed6672fd25..cbf1416829891a653289472aff4ac131605b33c7 100644 (file)
@@ -50,11 +50,11 @@ extern struct platform_device tegra_pwfm1_device;
 extern struct platform_device tegra_pwfm2_device;
 extern struct platform_device tegra_pwfm3_device;
 extern struct platform_device tegra_otg_device;
-extern struct platform_device tegra_uart0_device;
-extern struct platform_device tegra_uart1_device;
-extern struct platform_device tegra_uart2_device;
-extern struct platform_device tegra_uart3_device;
-extern struct platform_device tegra_uart4_device;
+extern struct platform_device tegra_uarta_device;
+extern struct platform_device tegra_uartb_device;
+extern struct platform_device tegra_uartc_device;
+extern struct platform_device tegra_uartd_device;
+extern struct platform_device tegra_uarte_device;
 extern struct platform_device tegra_spdif_device;
 extern struct platform_device tegra_grhost_device;
 extern struct platform_device tegra_spdif_device;
index 292863ccaaa099528c2cb4c4d83b3c890ec90471..09f5f454683cb3e5ac5525a5521872164486babe 100644 (file)
@@ -1221,8 +1221,8 @@ static int __devexit tegra_uart_remove(struct platform_device *pdev)
 static int tegra_uart_probe(struct platform_device *pdev)
 {
        struct tegra_uart_port *t;
-       struct plat_serial8250_port *pdata = pdev->dev.platform_data;
        struct uart_port *u;
+       struct resource *resource;
        int ret;
        char name[64];
        if (pdev->id < 0 || pdev->id > tegra_uart_driver.nr) {
@@ -1242,9 +1242,20 @@ static int tegra_uart_probe(struct platform_device *pdev)
        u->ops = &tegra_uart_ops;
        u->type = ~PORT_UNKNOWN;
        u->fifosize = 32;
-       u->mapbase = pdata->mapbase;
-       u->membase = pdata->membase;
-       u->irq = pdata->irq;
+
+       resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (unlikely(!resource))
+               return -ENXIO;
+
+       u->mapbase = resource->start;
+       u->membase = IO_ADDRESS(u->mapbase);
+       if (unlikely(!u->membase))
+               return -ENOMEM;
+
+       u->irq = platform_get_irq(pdev, 0);
+       if (unlikely(u->irq < 0))
+               return -ENXIO;
+
        u->regshift = 2;
 
        t->clk = clk_get(&pdev->dev, NULL);