Commit 19955c3d authored by Manjunathappa, Prakash's avatar Manjunathappa, Prakash Committed by Sekhar Nori

ARM: davinci: uart: move to devid based clk_get

For modules having single clock, clk_get should be done with dev_id.
But current davinci implementation handles multiple instances
of the UART devices with single platform_device_register. Hence clk_get
is based on con_id rather than dev_id, this is not correct. Do
platform_device_register for each instance and clk_get on dev_id.
Signed-off-by: default avatarManjunathappa, Prakash <prakash.pm@ti.com>
[nsekhar@ti.com: actually stop using con_id in clk_get(), squash the
		 patch adding OF aux data into this one]
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
parent 3b2f64d0
...@@ -395,9 +395,9 @@ static struct clk_lookup da830_clks[] = { ...@@ -395,9 +395,9 @@ static struct clk_lookup da830_clks[] = {
CLK(NULL, "tptc0", &tptc0_clk), CLK(NULL, "tptc0", &tptc0_clk),
CLK(NULL, "tptc1", &tptc1_clk), CLK(NULL, "tptc1", &tptc1_clk),
CLK("da830-mmc.0", NULL, &mmcsd_clk), CLK("da830-mmc.0", NULL, &mmcsd_clk),
CLK(NULL, "uart0", &uart0_clk), CLK("serial8250.0", NULL, &uart0_clk),
CLK(NULL, "uart1", &uart1_clk), CLK("serial8250.1", NULL, &uart1_clk),
CLK(NULL, "uart2", &uart2_clk), CLK("serial8250.2", NULL, &uart2_clk),
CLK("spi_davinci.0", NULL, &spi0_clk), CLK("spi_davinci.0", NULL, &spi0_clk),
CLK("spi_davinci.1", NULL, &spi1_clk), CLK("spi_davinci.1", NULL, &spi1_clk),
CLK(NULL, "ecap0", &ecap0_clk), CLK(NULL, "ecap0", &ecap0_clk),
...@@ -1199,7 +1199,7 @@ static struct davinci_soc_info davinci_soc_info_da830 = { ...@@ -1199,7 +1199,7 @@ static struct davinci_soc_info davinci_soc_info_da830 = {
.gpio_base = DA8XX_GPIO_BASE, .gpio_base = DA8XX_GPIO_BASE,
.gpio_num = 128, .gpio_num = 128,
.gpio_irq = IRQ_DA8XX_GPIO0, .gpio_irq = IRQ_DA8XX_GPIO0,
.serial_dev = &da8xx_serial_device, .serial_dev = da8xx_serial_device,
.emac_pdata = &da8xx_emac_pdata, .emac_pdata = &da8xx_emac_pdata,
}; };
......
...@@ -451,9 +451,9 @@ static struct clk_lookup da850_clks[] = { ...@@ -451,9 +451,9 @@ static struct clk_lookup da850_clks[] = {
CLK(NULL, "tpcc1", &tpcc1_clk), CLK(NULL, "tpcc1", &tpcc1_clk),
CLK(NULL, "tptc2", &tptc2_clk), CLK(NULL, "tptc2", &tptc2_clk),
CLK("pruss_uio", "pruss", &pruss_clk), CLK("pruss_uio", "pruss", &pruss_clk),
CLK(NULL, "uart0", &uart0_clk), CLK("serial8250.0", NULL, &uart0_clk),
CLK(NULL, "uart1", &uart1_clk), CLK("serial8250.1", NULL, &uart1_clk),
CLK(NULL, "uart2", &uart2_clk), CLK("serial8250.2", NULL, &uart2_clk),
CLK(NULL, "aintc", &aintc_clk), CLK(NULL, "aintc", &aintc_clk),
CLK(NULL, "gpio", &gpio_clk), CLK(NULL, "gpio", &gpio_clk),
CLK("i2c_davinci.2", NULL, &i2c1_clk), CLK("i2c_davinci.2", NULL, &i2c1_clk),
...@@ -1301,7 +1301,7 @@ static struct davinci_soc_info davinci_soc_info_da850 = { ...@@ -1301,7 +1301,7 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
.gpio_base = DA8XX_GPIO_BASE, .gpio_base = DA8XX_GPIO_BASE,
.gpio_num = 144, .gpio_num = 144,
.gpio_irq = IRQ_DA8XX_GPIO0, .gpio_irq = IRQ_DA8XX_GPIO0,
.serial_dev = &da8xx_serial_device, .serial_dev = da8xx_serial_device,
.emac_pdata = &da8xx_emac_pdata, .emac_pdata = &da8xx_emac_pdata,
.sram_dma = DA8XX_SHARED_RAM_BASE, .sram_dma = DA8XX_SHARED_RAM_BASE,
.sram_len = SZ_128K, .sram_len = SZ_128K,
......
...@@ -47,6 +47,9 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { ...@@ -47,6 +47,9 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("ti,da850-ecap", 0x01f07000, "ecap", NULL), OF_DEV_AUXDATA("ti,da850-ecap", 0x01f07000, "ecap", NULL),
OF_DEV_AUXDATA("ti,da850-ecap", 0x01f08000, "ecap", NULL), OF_DEV_AUXDATA("ti,da850-ecap", 0x01f08000, "ecap", NULL),
OF_DEV_AUXDATA("ti,da830-spi", 0x01f0e000, "spi_davinci.1", NULL), OF_DEV_AUXDATA("ti,da830-spi", 0x01f0e000, "spi_davinci.1", NULL),
OF_DEV_AUXDATA("ns16550a", 0x01c42000, "serial8250.0", NULL),
OF_DEV_AUXDATA("ns16550a", 0x01d0c000, "serial8250.1", NULL),
OF_DEV_AUXDATA("ns16550a", 0x01d0d000, "serial8250.2", NULL),
{} {}
}; };
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
void __iomem *da8xx_syscfg0_base; void __iomem *da8xx_syscfg0_base;
void __iomem *da8xx_syscfg1_base; void __iomem *da8xx_syscfg1_base;
static struct plat_serial8250_port da8xx_serial_pdata[] = { static struct plat_serial8250_port da8xx_serial0_pdata[] = {
{ {
.mapbase = DA8XX_UART0_BASE, .mapbase = DA8XX_UART0_BASE,
.irq = IRQ_DA8XX_UARTINT0, .irq = IRQ_DA8XX_UARTINT0,
...@@ -77,6 +77,11 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = { ...@@ -77,6 +77,11 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = {
.iotype = UPIO_MEM, .iotype = UPIO_MEM,
.regshift = 2, .regshift = 2,
}, },
{
.flags = 0,
}
};
static struct plat_serial8250_port da8xx_serial1_pdata[] = {
{ {
.mapbase = DA8XX_UART1_BASE, .mapbase = DA8XX_UART1_BASE,
.irq = IRQ_DA8XX_UARTINT1, .irq = IRQ_DA8XX_UARTINT1,
...@@ -85,6 +90,11 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = { ...@@ -85,6 +90,11 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = {
.iotype = UPIO_MEM, .iotype = UPIO_MEM,
.regshift = 2, .regshift = 2,
}, },
{
.flags = 0,
}
};
static struct plat_serial8250_port da8xx_serial2_pdata[] = {
{ {
.mapbase = DA8XX_UART2_BASE, .mapbase = DA8XX_UART2_BASE,
.irq = IRQ_DA8XX_UARTINT2, .irq = IRQ_DA8XX_UARTINT2,
...@@ -95,15 +105,33 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = { ...@@ -95,15 +105,33 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = {
}, },
{ {
.flags = 0, .flags = 0,
}, }
}; };
struct platform_device da8xx_serial_device = { struct platform_device da8xx_serial_device[] = {
.name = "serial8250", {
.id = PLAT8250_DEV_PLATFORM, .name = "serial8250",
.dev = { .id = PLAT8250_DEV_PLATFORM,
.platform_data = da8xx_serial_pdata, .dev = {
.platform_data = da8xx_serial0_pdata,
}
},
{
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM1,
.dev = {
.platform_data = da8xx_serial1_pdata,
}
}, },
{
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM2,
.dev = {
.platform_data = da8xx_serial2_pdata,
}
},
{
}
}; };
static s8 da8xx_queue_tc_mapping[][2] = { static s8 da8xx_queue_tc_mapping[][2] = {
......
...@@ -126,7 +126,7 @@ static struct platform_device edma_device = { ...@@ -126,7 +126,7 @@ static struct platform_device edma_device = {
.dev.platform_data = tnetv107x_edma_info, .dev.platform_data = tnetv107x_edma_info,
}; };
static struct plat_serial8250_port serial_data[] = { static struct plat_serial8250_port serial0_platform_data[] = {
{ {
.mapbase = TNETV107X_UART0_BASE, .mapbase = TNETV107X_UART0_BASE,
.irq = IRQ_TNETV107X_UART0, .irq = IRQ_TNETV107X_UART0,
...@@ -136,6 +136,11 @@ static struct plat_serial8250_port serial_data[] = { ...@@ -136,6 +136,11 @@ static struct plat_serial8250_port serial_data[] = {
.iotype = UPIO_MEM32, .iotype = UPIO_MEM32,
.regshift = 2, .regshift = 2,
}, },
{
.flags = 0,
}
};
static struct plat_serial8250_port serial1_platform_data[] = {
{ {
.mapbase = TNETV107X_UART1_BASE, .mapbase = TNETV107X_UART1_BASE,
.irq = IRQ_TNETV107X_UART1, .irq = IRQ_TNETV107X_UART1,
...@@ -145,6 +150,11 @@ static struct plat_serial8250_port serial_data[] = { ...@@ -145,6 +150,11 @@ static struct plat_serial8250_port serial_data[] = {
.iotype = UPIO_MEM32, .iotype = UPIO_MEM32,
.regshift = 2, .regshift = 2,
}, },
{
.flags = 0,
}
};
static struct plat_serial8250_port serial2_platform_data[] = {
{ {
.mapbase = TNETV107X_UART2_BASE, .mapbase = TNETV107X_UART2_BASE,
.irq = IRQ_TNETV107X_UART2, .irq = IRQ_TNETV107X_UART2,
...@@ -156,13 +166,28 @@ static struct plat_serial8250_port serial_data[] = { ...@@ -156,13 +166,28 @@ static struct plat_serial8250_port serial_data[] = {
}, },
{ {
.flags = 0, .flags = 0,
}, }
}; };
struct platform_device tnetv107x_serial_device = {
.name = "serial8250", struct platform_device tnetv107x_serial_device[] = {
.id = PLAT8250_DEV_PLATFORM, {
.dev.platform_data = serial_data, .name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev.platform_data = serial0_platform_data,
},
{
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM1,
.dev.platform_data = serial1_platform_data,
},
{
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM2,
.dev.platform_data = serial2_platform_data,
},
{
}
}; };
static struct resource mmc0_resources[] = { static struct resource mmc0_resources[] = {
......
...@@ -357,9 +357,9 @@ static struct clk_lookup dm355_clks[] = { ...@@ -357,9 +357,9 @@ static struct clk_lookup dm355_clks[] = {
CLK(NULL, "clkout3", &clkout3_clk), CLK(NULL, "clkout3", &clkout3_clk),
CLK(NULL, "arm", &arm_clk), CLK(NULL, "arm", &arm_clk),
CLK(NULL, "mjcp", &mjcp_clk), CLK(NULL, "mjcp", &mjcp_clk),
CLK(NULL, "uart0", &uart0_clk), CLK("serial8250.0", NULL, &uart0_clk),
CLK(NULL, "uart1", &uart1_clk), CLK("serial8250.1", NULL, &uart1_clk),
CLK(NULL, "uart2", &uart2_clk), CLK("serial8250.2", NULL, &uart2_clk),
CLK("i2c_davinci.1", NULL, &i2c_clk), CLK("i2c_davinci.1", NULL, &i2c_clk),
CLK("davinci-mcbsp.0", NULL, &asp0_clk), CLK("davinci-mcbsp.0", NULL, &asp0_clk),
CLK("davinci-mcbsp.1", NULL, &asp1_clk), CLK("davinci-mcbsp.1", NULL, &asp1_clk),
...@@ -922,7 +922,7 @@ static struct davinci_timer_info dm355_timer_info = { ...@@ -922,7 +922,7 @@ static struct davinci_timer_info dm355_timer_info = {
.clocksource_id = T0_TOP, .clocksource_id = T0_TOP,
}; };
static struct plat_serial8250_port dm355_serial_platform_data[] = { static struct plat_serial8250_port dm355_serial0_platform_data[] = {
{ {
.mapbase = DAVINCI_UART0_BASE, .mapbase = DAVINCI_UART0_BASE,
.irq = IRQ_UARTINT0, .irq = IRQ_UARTINT0,
...@@ -931,6 +931,11 @@ static struct plat_serial8250_port dm355_serial_platform_data[] = { ...@@ -931,6 +931,11 @@ static struct plat_serial8250_port dm355_serial_platform_data[] = {
.iotype = UPIO_MEM, .iotype = UPIO_MEM,
.regshift = 2, .regshift = 2,
}, },
{
.flags = 0,
}
};
static struct plat_serial8250_port dm355_serial1_platform_data[] = {
{ {
.mapbase = DAVINCI_UART1_BASE, .mapbase = DAVINCI_UART1_BASE,
.irq = IRQ_UARTINT1, .irq = IRQ_UARTINT1,
...@@ -939,6 +944,11 @@ static struct plat_serial8250_port dm355_serial_platform_data[] = { ...@@ -939,6 +944,11 @@ static struct plat_serial8250_port dm355_serial_platform_data[] = {
.iotype = UPIO_MEM, .iotype = UPIO_MEM,
.regshift = 2, .regshift = 2,
}, },
{
.flags = 0,
}
};
static struct plat_serial8250_port dm355_serial2_platform_data[] = {
{ {
.mapbase = DM355_UART2_BASE, .mapbase = DM355_UART2_BASE,
.irq = IRQ_DM355_UARTINT2, .irq = IRQ_DM355_UARTINT2,
...@@ -948,16 +958,34 @@ static struct plat_serial8250_port dm355_serial_platform_data[] = { ...@@ -948,16 +958,34 @@ static struct plat_serial8250_port dm355_serial_platform_data[] = {
.regshift = 2, .regshift = 2,
}, },
{ {
.flags = 0 .flags = 0,
}, }
}; };
static struct platform_device dm355_serial_device = { static struct platform_device dm355_serial_device[] = {
.name = "serial8250", {
.id = PLAT8250_DEV_PLATFORM, .name = "serial8250",
.dev = { .id = PLAT8250_DEV_PLATFORM,
.platform_data = dm355_serial_platform_data, .dev = {
.platform_data = dm355_serial0_platform_data,
}
},
{
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM1,
.dev = {
.platform_data = dm355_serial1_platform_data,
}
}, },
{
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM2,
.dev = {
.platform_data = dm355_serial2_platform_data,
}
},
{
}
}; };
static struct davinci_soc_info davinci_soc_info_dm355 = { static struct davinci_soc_info davinci_soc_info_dm355 = {
...@@ -981,7 +1009,7 @@ static struct davinci_soc_info davinci_soc_info_dm355 = { ...@@ -981,7 +1009,7 @@ static struct davinci_soc_info davinci_soc_info_dm355 = {
.gpio_base = DAVINCI_GPIO_BASE, .gpio_base = DAVINCI_GPIO_BASE,
.gpio_num = 104, .gpio_num = 104,
.gpio_irq = IRQ_DM355_GPIOBNK0, .gpio_irq = IRQ_DM355_GPIOBNK0,
.serial_dev = &dm355_serial_device, .serial_dev = dm355_serial_device,
.sram_dma = 0x00010000, .sram_dma = 0x00010000,
.sram_len = SZ_32K, .sram_len = SZ_32K,
}; };
......
...@@ -455,8 +455,8 @@ static struct clk_lookup dm365_clks[] = { ...@@ -455,8 +455,8 @@ static struct clk_lookup dm365_clks[] = {
CLK("vpss", "master", &vpss_master_clk), CLK("vpss", "master", &vpss_master_clk),
CLK("vpss", "slave", &vpss_slave_clk), CLK("vpss", "slave", &vpss_slave_clk),
CLK(NULL, "arm", &arm_clk), CLK(NULL, "arm", &arm_clk),
CLK(NULL, "uart0", &uart0_clk), CLK("serial8250.0", NULL, &uart0_clk),
CLK(NULL, "uart1", &uart1_clk), CLK("serial8250.1", NULL, &uart1_clk),
CLK("i2c_davinci.1", NULL, &i2c_clk), CLK("i2c_davinci.1", NULL, &i2c_clk),
CLK("da830-mmc.0", NULL, &mmcsd0_clk), CLK("da830-mmc.0", NULL, &mmcsd0_clk),
CLK("da830-mmc.1", NULL, &mmcsd1_clk), CLK("da830-mmc.1", NULL, &mmcsd1_clk),
...@@ -1041,7 +1041,7 @@ static struct davinci_timer_info dm365_timer_info = { ...@@ -1041,7 +1041,7 @@ static struct davinci_timer_info dm365_timer_info = {
#define DM365_UART1_BASE (IO_PHYS + 0x106000) #define DM365_UART1_BASE (IO_PHYS + 0x106000)
static struct plat_serial8250_port dm365_serial_platform_data[] = { static struct plat_serial8250_port dm365_serial0_platform_data[] = {
{ {
.mapbase = DAVINCI_UART0_BASE, .mapbase = DAVINCI_UART0_BASE,
.irq = IRQ_UARTINT0, .irq = IRQ_UARTINT0,
...@@ -1050,6 +1050,11 @@ static struct plat_serial8250_port dm365_serial_platform_data[] = { ...@@ -1050,6 +1050,11 @@ static struct plat_serial8250_port dm365_serial_platform_data[] = {
.iotype = UPIO_MEM, .iotype = UPIO_MEM,
.regshift = 2, .regshift = 2,
}, },
{
.flags = 0,
}
};
static struct plat_serial8250_port dm365_serial1_platform_data[] = {
{ {
.mapbase = DM365_UART1_BASE, .mapbase = DM365_UART1_BASE,
.irq = IRQ_UARTINT1, .irq = IRQ_UARTINT1,
...@@ -1059,16 +1064,27 @@ static struct plat_serial8250_port dm365_serial_platform_data[] = { ...@@ -1059,16 +1064,27 @@ static struct plat_serial8250_port dm365_serial_platform_data[] = {
.regshift = 2, .regshift = 2,
}, },
{ {
.flags = 0 .flags = 0,
}, }
}; };
static struct platform_device dm365_serial_device = { static struct platform_device dm365_serial_device[] = {
.name = "serial8250", {
.id = PLAT8250_DEV_PLATFORM, .name = "serial8250",
.dev = { .id = PLAT8250_DEV_PLATFORM,
.platform_data = dm365_serial_platform_data, .dev = {
.platform_data = dm365_serial0_platform_data,
}
},
{
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM1,
.dev = {
.platform_data = dm365_serial1_platform_data,
}
}, },
{
}
}; };
static struct davinci_soc_info davinci_soc_info_dm365 = { static struct davinci_soc_info davinci_soc_info_dm365 = {
...@@ -1093,7 +1109,7 @@ static struct davinci_soc_info davinci_soc_info_dm365 = { ...@@ -1093,7 +1109,7 @@ static struct davinci_soc_info davinci_soc_info_dm365 = {
.gpio_num = 104, .gpio_num = 104,
.gpio_irq = IRQ_DM365_GPIO0, .gpio_irq = IRQ_DM365_GPIO0,
.gpio_unbanked = 8, /* really 16 ... skip muxed GPIOs */ .gpio_unbanked = 8, /* really 16 ... skip muxed GPIOs */
.serial_dev = &dm365_serial_device, .serial_dev = dm365_serial_device,
.emac_pdata = &dm365_emac_pdata, .emac_pdata = &dm365_emac_pdata,
.sram_dma = 0x00010000, .sram_dma = 0x00010000,
.sram_len = SZ_32K, .sram_len = SZ_32K,
......
...@@ -303,9 +303,9 @@ static struct clk_lookup dm644x_clks[] = { ...@@ -303,9 +303,9 @@ static struct clk_lookup dm644x_clks[] = {
CLK("vpss", "master", &vpss_master_clk), CLK("vpss", "master", &vpss_master_clk),
CLK("vpss", "slave", &vpss_slave_clk), CLK("vpss", "slave", &vpss_slave_clk),
CLK(NULL, "arm", &arm_clk), CLK(NULL, "arm", &arm_clk),
CLK(NULL, "uart0", &uart0_clk), CLK("serial8250.0", NULL, &uart0_clk),
CLK(NULL, "uart1", &uart1_clk), CLK("serial8250.1", NULL, &uart1_clk),
CLK(NULL, "uart2", &uart2_clk), CLK("serial8250.2", NULL, &uart2_clk),
CLK("davinci_emac.1", NULL, &emac_clk), CLK("davinci_emac.1", NULL, &emac_clk),
CLK("i2c_davinci.1", NULL, &i2c_clk), CLK("i2c_davinci.1", NULL, &i2c_clk),
CLK("palm_bk3710", NULL, &ide_clk), CLK("palm_bk3710", NULL, &ide_clk),
...@@ -813,7 +813,7 @@ static struct davinci_timer_info dm644x_timer_info = { ...@@ -813,7 +813,7 @@ static struct davinci_timer_info dm644x_timer_info = {
.clocksource_id = T0_TOP, .clocksource_id = T0_TOP,
}; };
static struct plat_serial8250_port dm644x_serial_platform_data[] = { static struct plat_serial8250_port dm644x_serial0_platform_data[] = {
{ {
.mapbase = DAVINCI_UART0_BASE, .mapbase = DAVINCI_UART0_BASE,
.irq = IRQ_UARTINT0, .irq = IRQ_UARTINT0,
...@@ -822,6 +822,11 @@ static struct plat_serial8250_port dm644x_serial_platform_data[] = { ...@@ -822,6 +822,11 @@ static struct plat_serial8250_port dm644x_serial_platform_data[] = {
.iotype = UPIO_MEM, .iotype = UPIO_MEM,
.regshift = 2, .regshift = 2,
}, },
{
.flags = 0,
}
};
static struct plat_serial8250_port dm644x_serial1_platform_data[] = {
{ {
.mapbase = DAVINCI_UART1_BASE, .mapbase = DAVINCI_UART1_BASE,
.irq = IRQ_UARTINT1, .irq = IRQ_UARTINT1,
...@@ -830,6 +835,11 @@ static struct plat_serial8250_port dm644x_serial_platform_data[] = { ...@@ -830,6 +835,11 @@ static struct plat_serial8250_port dm644x_serial_platform_data[] = {
.iotype = UPIO_MEM, .iotype = UPIO_MEM,
.regshift = 2, .regshift = 2,
}, },
{
.flags = 0,
}
};
static struct plat_serial8250_port dm644x_serial2_platform_data[] = {
{ {
.mapbase = DAVINCI_UART2_BASE, .mapbase = DAVINCI_UART2_BASE,
.irq = IRQ_UARTINT2, .irq = IRQ_UARTINT2,
...@@ -839,16 +849,34 @@ static struct plat_serial8250_port dm644x_serial_platform_data[] = { ...@@ -839,16 +849,34 @@ static struct plat_serial8250_port dm644x_serial_platform_data[] = {
.regshift = 2, .regshift = 2,
}, },
{ {
.flags = 0 .flags = 0,
}, }
}; };
static struct platform_device dm644x_serial_device = { static struct platform_device dm644x_serial_device[] = {
.name = "serial8250", {
.id = PLAT8250_DEV_PLATFORM, .name = "serial8250",
.dev = { .id = PLAT8250_DEV_PLATFORM,
.platform_data = dm644x_serial_platform_data, .dev = {
.platform_data = dm644x_serial0_platform_data,
}
}, },
{
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM1,
.dev = {
.platform_data = dm644x_serial1_platform_data,
}
},
{
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM2,
.dev = {
.platform_data = dm644x_serial2_platform_data,
}
},
{
}
}; };
static struct davinci_soc_info davinci_soc_info_dm644x = { static struct davinci_soc_info davinci_soc_info_dm644x = {
...@@ -872,7 +900,7 @@ static struct davinci_soc_info davinci_soc_info_dm644x = { ...@@ -872,7 +900,7 @@ static struct davinci_soc_info davinci_soc_info_dm644x = {
.gpio_base = DAVINCI_GPIO_BASE, .gpio_base = DAVINCI_GPIO_BASE,
.gpio_num = 71, .gpio_num = 71,
.gpio_irq = IRQ_GPIOBNK0, .gpio_irq = IRQ_GPIOBNK0,
.serial_dev = &dm644x_serial_device, .serial_dev = dm644x_serial_device,
.emac_pdata = &dm644x_emac_pdata, .emac_pdata = &dm644x_emac_pdata,
.sram_dma = 0x00008000, .sram_dma = 0x00008000,
.sram_len = SZ_16K, .sram_len = SZ_16K,
......
...@@ -342,9 +342,9 @@ static struct clk_lookup dm646x_clks[] = { ...@@ -342,9 +342,9 @@ static struct clk_lookup dm646x_clks[] = {
CLK(NULL, "edma_tc1", &edma_tc1_clk), CLK(NULL, "edma_tc1", &edma_tc1_clk),
CLK(NULL, "edma_tc2", &edma_tc2_clk), CLK(NULL, "edma_tc2", &edma_tc2_clk),
CLK(NULL, "edma_tc3", &edma_tc3_clk), CLK(NULL, "edma_tc3", &edma_tc3_clk),
CLK(NULL, "uart0", &uart0_clk), CLK("serial8250.0", NULL, &uart0_clk),
CLK(NULL, "uart1", &uart1_clk), CLK("serial8250.1", NULL, &uart1_clk),
CLK(NULL, "uart2", &uart2_clk), CLK("serial8250.2", NULL, &uart2_clk),
CLK("i2c_davinci.1", NULL, &i2c_clk), CLK("i2c_davinci.1", NULL, &i2c_clk),
CLK(NULL, "gpio", &gpio_clk), CLK(NULL, "gpio", &gpio_clk),
CLK("davinci-mcasp.0", NULL, &mcasp0_clk), CLK("davinci-mcasp.0", NULL, &mcasp0_clk),
...@@ -790,7 +790,7 @@ static struct davinci_timer_info dm646x_timer_info = { ...@@ -790,7 +790,7 @@ static struct davinci_timer_info dm646x_timer_info = {
.clocksource_id = T0_TOP, .clocksource_id = T0_TOP,
}; };
static struct plat_serial8250_port dm646x_serial_platform_data[] = { static struct plat_serial8250_port dm646x_serial0_platform_data[] = {
{ {
.mapbase = DAVINCI_UART0_BASE, .mapbase = DAVINCI_UART0_BASE,
.irq = IRQ_UARTINT0, .irq = IRQ_UARTINT0,
...@@ -799,6 +799,11 @@ static struct plat_serial8250_port dm646x_serial_platform_data[] = { ...@@ -799,6 +799,11 @@ static struct plat_serial8250_port dm646x_serial_platform_data[] = {
.iotype = UPIO_MEM32, .iotype = UPIO_MEM32,
.regshift = 2, .regshift = 2,
}, },
{
.flags = 0,
}
};
static struct plat_serial8250_port dm646x_serial1_platform_data[] = {
{ {
.mapbase = DAVINCI_UART1_BASE, .mapbase = DAVINCI_UART1_BASE,
.irq = IRQ_UARTINT1, .irq = IRQ_UARTINT1,
...@@ -807,6 +812,11 @@ static struct plat_serial8250_port dm646x_serial_platform_data[] = { ...@@ -807,6 +812,11 @@ static struct plat_serial8250_port dm646x_serial_platform_data[] = {
.iotype = UPIO_MEM32, .iotype = UPIO_MEM32,
.regshift = 2, .regshift = 2,
}, },
{
.flags = 0,
}
};
static struct plat_serial8250_port dm646x_serial2_platform_data[] = {
{ {
.mapbase = DAVINCI_UART2_BASE, .mapbase = DAVINCI_UART2_BASE,
.irq = IRQ_DM646X_UARTINT2, .irq = IRQ_DM646X_UARTINT2,
...@@ -816,16 +826,34 @@ static struct plat_serial8250_port dm646x_serial_platform_data[] = { ...@@ -816,16 +826,34 @@ static struct plat_serial8250_port dm646x_serial_platform_data[] = {
.regshift = 2, .regshift = 2,
}, },
{ {
.flags = 0 .flags = 0,
}, }
}; };
static struct platform_device dm646x_serial_device = { static struct platform_device dm646x_serial_device[] = {
.name = "serial8250", {
.id = PLAT8250_DEV_PLATFORM, .name = "serial8250",
.dev = { .id = PLAT8250_DEV_PLATFORM,
.platform_data = dm646x_serial_platform_data, .dev = {
.platform_data = dm646x_serial0_platform_data,
}
},
{
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM1,
.dev = {
.platform_data = dm646x_serial1_platform_data,
}
}, },
{
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM2,
.dev = {
.platform_data = dm646x_serial2_platform_data,
}
},
{
}
}; };
static struct davinci_soc_info davinci_soc_info_dm646x = { static struct davinci_soc_info davinci_soc_info_dm646x = {
...@@ -849,7 +877,7 @@ static struct davinci_soc_info davinci_soc_info_dm646x = { ...@@ -849,7 +877,7 @@ static struct davinci_soc_info davinci_soc_info_dm646x = {
.gpio_base = DAVINCI_GPIO_BASE, .gpio_base = DAVINCI_GPIO_BASE,
.gpio_num = 43, /* Only 33 usable */ .gpio_num = 43, /* Only 33 usable */
.gpio_irq = IRQ_DM646X_GPIOBNK0, .gpio_irq = IRQ_DM646X_GPIOBNK0,
.serial_dev = &dm646x_serial_device, .serial_dev = dm646x_serial_device,
.emac_pdata = &dm646x_emac_pdata, .emac_pdata = &dm646x_emac_pdata,
.sram_dma = 0x10010000, .sram_dma = 0x10010000,
.sram_len = SZ_32K, .sram_len = SZ_32K,
......
...@@ -111,7 +111,7 @@ void da8xx_restart(enum reboot_mode mode, const char *cmd); ...@@ -111,7 +111,7 @@ void da8xx_restart(enum reboot_mode mode, const char *cmd);
void da8xx_rproc_reserve_cma(void); void da8xx_rproc_reserve_cma(void);
int da8xx_register_rproc(void); int da8xx_register_rproc(void);
extern struct platform_device da8xx_serial_device; extern struct platform_device da8xx_serial_device[];
extern struct emac_platform_data da8xx_emac_pdata; extern struct emac_platform_data da8xx_emac_pdata;
extern struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata; extern struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata;
extern struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata; extern struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata;
......
...@@ -50,7 +50,7 @@ struct tnetv107x_device_info { ...@@ -50,7 +50,7 @@ struct tnetv107x_device_info {
}; };
extern struct platform_device tnetv107x_wdt_device; extern struct platform_device tnetv107x_wdt_device;
extern struct platform_device tnetv107x_serial_device; extern struct platform_device tnetv107x_serial_device[];
extern void tnetv107x_init(void); extern void tnetv107x_init(void);
extern void tnetv107x_devices_init(struct tnetv107x_device_info *); extern void tnetv107x_devices_init(struct tnetv107x_device_info *);
......
...@@ -73,13 +73,11 @@ static void __init davinci_serial_reset(struct plat_serial8250_port *p) ...@@ -73,13 +73,11 @@ static void __init davinci_serial_reset(struct plat_serial8250_port *p)
/* Enable UART clock and obtain its rate */ /* Enable UART clock and obtain its rate */
int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate) int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate)
{ {
char name[16];
struct clk *clk; struct clk *clk;
struct davinci_soc_info *soc_info = &davinci_soc_info; struct davinci_soc_info *soc_info = &davinci_soc_info;
struct device *dev = &soc_info->serial_dev->dev; struct device *dev = &soc_info->serial_dev[instance].dev;
sprintf(name, "uart%d", instance); clk = clk_get(dev, NULL);
clk = clk_get(dev, name);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
pr_err("%s:%d: failed to get UART%d clock\n", pr_err("%s:%d: failed to get UART%d clock\n",
__func__, __LINE__, instance); __func__, __LINE__, instance);
...@@ -96,19 +94,25 @@ int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate) ...@@ -96,19 +94,25 @@ int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate)
int __init davinci_serial_init(struct davinci_uart_config *info) int __init davinci_serial_init(struct davinci_uart_config *info)
{ {
int i, ret; int i, ret = 0;
struct davinci_soc_info *soc_info = &davinci_soc_info; struct davinci_soc_info *soc_info = &davinci_soc_info;
struct device *dev = &soc_info->serial_dev->dev; struct device *dev;
struct plat_serial8250_port *p = dev->platform_data; struct plat_serial8250_port *p;
/* /*
* Make sure the serial ports are muxed on at this point. * Make sure the serial ports are muxed on at this point.
* You have to mux them off in device drivers later on if not needed. * You have to mux them off in device drivers later on if not needed.
*/ */
for (i = 0; p->flags; i++, p++) { for (i = 0; soc_info->serial_dev[i].dev.platform_data != NULL; i++) {
dev = &soc_info->serial_dev[i].dev;
p = dev->platform_data;
if (!(info->enabled_uarts & (1 << i))) if (!(info->enabled_uarts & (1 << i)))
continue; continue;
ret = platform_device_register(&soc_info->serial_dev[i]);
if (ret)
continue;
ret = davinci_serial_setup_clk(i, &p->uartclk); ret = davinci_serial_setup_clk(i, &p->uartclk);
if (ret) if (ret)
continue; continue;
...@@ -125,6 +129,5 @@ int __init davinci_serial_init(struct davinci_uart_config *info) ...@@ -125,6 +129,5 @@ int __init davinci_serial_init(struct davinci_uart_config *info)
if (p->membase && p->type != PORT_AR7) if (p->membase && p->type != PORT_AR7)
davinci_serial_reset(p); davinci_serial_reset(p);
} }
return ret;
return platform_device_register(soc_info->serial_dev);
} }
...@@ -264,7 +264,7 @@ static struct clk_lookup clks[] = { ...@@ -264,7 +264,7 @@ static struct clk_lookup clks[] = {
CLK(NULL, "clk_chipcfg", &clk_chipcfg), CLK(NULL, "clk_chipcfg", &clk_chipcfg),
CLK("tnetv107x-ts.0", NULL, &clk_tsc), CLK("tnetv107x-ts.0", NULL, &clk_tsc),
CLK(NULL, "clk_rom", &clk_rom), CLK(NULL, "clk_rom", &clk_rom),
CLK(NULL, "uart2", &clk_uart2), CLK("serial8250.2", NULL, &clk_uart2),
CLK(NULL, "clk_pktsec", &clk_pktsec), CLK(NULL, "clk_pktsec", &clk_pktsec),
CLK("tnetv107x-rng.0", NULL, &clk_rng), CLK("tnetv107x-rng.0", NULL, &clk_rng),
CLK("tnetv107x-pka.0", NULL, &clk_pka), CLK("tnetv107x-pka.0", NULL, &clk_pka),
...@@ -274,8 +274,8 @@ static struct clk_lookup clks[] = { ...@@ -274,8 +274,8 @@ static struct clk_lookup clks[] = {
CLK(NULL, "clk_gpio", &clk_gpio), CLK(NULL, "clk_gpio", &clk_gpio),
CLK(NULL, "clk_mdio", &clk_mdio), CLK(NULL, "clk_mdio", &clk_mdio),
CLK("dm6441-mmc.0", NULL, &clk_sdio0), CLK("dm6441-mmc.0", NULL, &clk_sdio0),
CLK(NULL, "uart0", &clk_uart0), CLK("serial8250.0", NULL, &clk_uart0),
CLK(NULL, "uart1", &clk_uart1), CLK("serial8250.1", NULL, &clk_uart1),
CLK(NULL, "timer0", &clk_timer0), CLK(NULL, "timer0", &clk_timer0),
CLK(NULL, "timer1", &clk_timer1), CLK(NULL, "timer1", &clk_timer1),
CLK("tnetv107x_wdt.0", NULL, &clk_wdt_arm), CLK("tnetv107x_wdt.0", NULL, &clk_wdt_arm),
...@@ -757,7 +757,7 @@ static struct davinci_soc_info tnetv107x_soc_info = { ...@@ -757,7 +757,7 @@ static struct davinci_soc_info tnetv107x_soc_info = {
.gpio_type = GPIO_TYPE_TNETV107X, .gpio_type = GPIO_TYPE_TNETV107X,
.gpio_num = TNETV107X_N_GPIO, .gpio_num = TNETV107X_N_GPIO,
.timer_info = &timer_info, .timer_info = &timer_info,
.serial_dev = &tnetv107x_serial_device, .serial_dev = tnetv107x_serial_device,
}; };
void __init tnetv107x_init(void) void __init tnetv107x_init(void)
......
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