Skip to contentSkip to conversation

ARM: davinci: fix UART clock enabling

PATCH Superseded Manjunathappa, Prakash 2 participants 13 messages May 28, 2013 – Jun 19, 2013

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover ARM: davinci: fix UART clock enabling

Patch series addresses below issues:
1) Do clk_get on dev_id when there is single clock for a module
2) Fix garbled UART log with DT kernel on da850-evm.
3) Cleanup of serila platform code.

Applies on top of v3.9-rc9 of Linus's.
Tested on da850-evm. Able to see proper bootup log and console on UART2.

Since v1:
Change names of platform data names appropriately. Added 5/5: platform code cleanup.

Manjunathappa, Prakash (5):
ARM: davinci: uart: move to devid based clk_get
ARM: davinci: da850: override device name of UART in DT kernel
ARM: davinci: da850: do not specify clock_frequency for UART DT node
ARM: davinci: da8xx: remove da8xx_uart_clk_enable
ARM: davinci: serial: platform code cleanup

 arch/arm/boot/dts/da850.dtsi                   |    3 -
 arch/arm/mach-davinci/board-da830-evm.c        |    6 +--
 arch/arm/mach-davinci/board-da850-evm.c        |    6 +--
 arch/arm/mach-davinci/board-dm355-evm.c        |    6 +--
 arch/arm/mach-davinci/board-dm355-leopard.c    |    6 +--
 arch/arm/mach-davinci/board-dm365-evm.c        |    6 +--
 arch/arm/mach-davinci/board-dm644x-evm.c       |    6 +--
 arch/arm/mach-davinci/board-dm646x-evm.c       |    6 +--
 arch/arm/mach-davinci/board-mityomapl138.c     |    6 +--
 arch/arm/mach-davinci/board-neuros-osd2.c      |    6 +--
 arch/arm/mach-davinci/board-omapl138-hawk.c    |    6 +--
 arch/arm/mach-davinci/board-sffsdr.c           |    7 +--
 arch/arm/mach-davinci/da830.c                  |    7 +--
 arch/arm/mach-davinci/da850.c                  |    7 +--
 arch/arm/mach-davinci/da8xx-dt.c               |   11 +----
 arch/arm/mach-davinci/devices-da8xx.c          |   41 +++++++++++++-----
 arch/arm/mach-davinci/devices-tnetv107x.c      |   36 +++++++++++-----
 arch/arm/mach-davinci/dm355.c                  |   48 ++++++++++++++-------
 arch/arm/mach-davinci/dm365.c                  |   36 ++++++++++------
 arch/arm/mach-davinci/dm644x.c                 |   48 ++++++++++++++-------
 arch/arm/mach-davinci/dm646x.c                 |   47 ++++++++++++++-------
 arch/arm/mach-davinci/include/mach/common.h    |    1 -
 arch/arm/mach-davinci/include/mach/da8xx.h     |    2 +-
 arch/arm/mach-davinci/include/mach/serial.h    |   14 ++++---
 arch/arm/mach-davinci/include/mach/tnetv107x.h |    3 +-
 arch/arm/mach-davinci/serial.c                 |   54 +++++++++---------------
 arch/arm/mach-davinci/tnetv107x.c              |    8 ++--
 27 files changed, 227 insertions(+), 206 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH v2 1/5 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.

---
 arch/arm/mach-davinci/da830.c                  |    8 ++--
 arch/arm/mach-davinci/da850.c                  |    8 ++--
 arch/arm/mach-davinci/devices-da8xx.c          |   41 ++++++++++++++------
 arch/arm/mach-davinci/devices-tnetv107x.c      |   34 ++++++++++++-----
 arch/arm/mach-davinci/dm355.c                  |   49 ++++++++++++++++--------
 arch/arm/mach-davinci/dm365.c                  |   37 +++++++++++-------
 arch/arm/mach-davinci/dm644x.c                 |   49 ++++++++++++++++--------
 arch/arm/mach-davinci/dm646x.c                 |   48 ++++++++++++++++-------
 arch/arm/mach-davinci/include/mach/da8xx.h     |    2 +-
 arch/arm/mach-davinci/include/mach/serial.h    |    4 ++
 arch/arm/mach-davinci/include/mach/tnetv107x.h |    2 +-
 arch/arm/mach-davinci/serial.c                 |   19 ++++++---
 arch/arm/mach-davinci/tnetv107x.c              |    8 ++--
 13 files changed, 205 insertions(+), 104 deletions(-)
arch/arm/mach-davinci/da830.c +4 -4
index abbaf02..a3ffd52 100644
@@ -395,9 +395,9 @@ static struct clk_lookup da830_clks[] = {
 	CLK(NULL,		"tptc0",	&tptc0_clk),
 	CLK(NULL,		"tptc1",	&tptc1_clk),
 	CLK("da830-mmc.0",	NULL,		&mmcsd_clk),
-	CLK(NULL,		"uart0",	&uart0_clk),
-	CLK(NULL,		"uart1",	&uart1_clk),
-	CLK(NULL,		"uart2",	&uart2_clk),
+	CLK("serial8250.0",	NULL,		&uart0_clk),
+	CLK("serial8250.1",	NULL,		&uart1_clk),
+	CLK("serial8250.2",	NULL,		&uart2_clk),
 	CLK("spi_davinci.0",	NULL,		&spi0_clk),
 	CLK("spi_davinci.1",	NULL,		&spi1_clk),
 	CLK(NULL,		"ecap0",	&ecap0_clk),
@@ -1199,7 +1199,7 @@ static struct davinci_soc_info davinci_soc_info_da830 = {
 	.gpio_base		= DA8XX_GPIO_BASE,
 	.gpio_num		= 128,
 	.gpio_irq		= IRQ_DA8XX_GPIO0,
-	.serial_dev		= &da8xx_serial_device,
+	.serial_dev		= da8xx_serial_device,
 	.emac_pdata		= &da8xx_emac_pdata,
 };
 
arch/arm/mach-davinci/da850.c +4 -4
index 4d69338..7ce691c 100644
@@ -451,9 +451,9 @@ static struct clk_lookup da850_clks[] = {
 	CLK(NULL,		"tpcc1",	&tpcc1_clk),
 	CLK(NULL,		"tptc2",	&tptc2_clk),
 	CLK("pruss_uio",	"pruss",	&pruss_clk),
-	CLK(NULL,		"uart0",	&uart0_clk),
-	CLK(NULL,		"uart1",	&uart1_clk),
-	CLK(NULL,		"uart2",	&uart2_clk),
+	CLK("serial8250.0",	NULL,		&uart0_clk),
+	CLK("serial8250.1",	NULL,		&uart1_clk),
+	CLK("serial8250.2",	NULL,		&uart2_clk),
 	CLK(NULL,		"aintc",	&aintc_clk),
 	CLK(NULL,		"gpio",		&gpio_clk),
 	CLK("i2c_davinci.2",	NULL,		&i2c1_clk),
@@ -1301,7 +1301,7 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
 	.gpio_base		= DA8XX_GPIO_BASE,
 	.gpio_num		= 144,
 	.gpio_irq		= IRQ_DA8XX_GPIO0,
-	.serial_dev		= &da8xx_serial_device,
+	.serial_dev		= da8xx_serial_device,
 	.emac_pdata		= &da8xx_emac_pdata,
 	.sram_dma		= DA8XX_SHARED_RAM_BASE,
 	.sram_len		= SZ_128K,
arch/arm/mach-davinci/devices-da8xx.c +29 -12

68 lines not on this page · raw message

arch/arm/mach-davinci/devices-tnetv107x.c +24 -10
index cfb194d..35e5594 100644
@@ -126,7 +126,7 @@ static struct platform_device edma_device = {
 	.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,
 		.irq		= IRQ_TNETV107X_UART0,
@@ -135,7 +135,9 @@ static struct plat_serial8250_port serial_data[] = {
 		.type		= PORT_AR7,
 		.iotype		= UPIO_MEM32,
 		.regshift	= 2,
-	},
+	}
+};
+static struct plat_serial8250_port serial1_platform_data[] = {
 	{
 		.mapbase	= TNETV107X_UART1_BASE,
 		.irq		= IRQ_TNETV107X_UART1,
@@ -144,7 +146,9 @@ static struct plat_serial8250_port serial_data[] = {
 		.type		= PORT_AR7,
 		.iotype		= UPIO_MEM32,
 		.regshift	= 2,
-	},
+	}
+};
+static struct plat_serial8250_port serial2_platform_data[] = {
 	{
 		.mapbase	= TNETV107X_UART2_BASE,
 		.irq		= IRQ_TNETV107X_UART2,
@@ -153,16 +157,26 @@ static struct plat_serial8250_port serial_data[] = {
 		.type		= PORT_AR7,
 		.iotype		= UPIO_MEM32,
 		.regshift	= 2,
+	}
+};
+
+
+struct platform_device tnetv107x_serial_device[] = {
+	{
+		.name			= "serial8250",
+		.id			= PLAT8250_DEV_PLATFORM,
+		.dev.platform_data	= serial0_platform_data
 	},
 	{
-		.flags	= 0,
+		.name			= "serial8250",
+		.id			= PLAT8250_DEV_PLATFORM1,
+		.dev.platform_data	= serial1_platform_data
 	},
-};
-
-struct platform_device tnetv107x_serial_device = {
-	.name			= "serial8250",
-	.id			= PLAT8250_DEV_PLATFORM,
-	.dev.platform_data	= serial_data,
+	{
+		.name			= "serial8250",
+		.id			= PLAT8250_DEV_PLATFORM2,
+		.dev.platform_data	= serial2_platform_data
+	}
 };
 
 static struct resource mmc0_resources[] = {
arch/arm/mach-davinci/dm355.c +33 -16

88 lines not on this page · raw message

arch/arm/mach-davinci/dm365.c +23 -14
index 40fa4fe..abeac28 100644
@@ -455,8 +455,8 @@ static struct clk_lookup dm365_clks[] = {
 	CLK("vpss", "master", &vpss_master_clk),
 	CLK("vpss", "slave", &vpss_slave_clk),
 	CLK(NULL, "arm", &arm_clk),
-	CLK(NULL, "uart0", &uart0_clk),
-	CLK(NULL, "uart1", &uart1_clk),
+	CLK("serial8250.0", NULL, &uart0_clk),
+	CLK("serial8250.1", NULL, &uart1_clk),
 	CLK("i2c_davinci.1", NULL, &i2c_clk),
 	CLK("da830-mmc.0", NULL, &mmcsd0_clk),
 	CLK("da830-mmc.1", NULL, &mmcsd1_clk),
@@ -1041,7 +1041,7 @@ static struct davinci_timer_info dm365_timer_info = {
 
 #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,
 		.irq		= IRQ_UARTINT0,
@@ -1049,7 +1049,9 @@ static struct plat_serial8250_port dm365_serial_platform_data[] = {
 				  UPF_IOREMAP,
 		.iotype		= UPIO_MEM,
 		.regshift	= 2,
-	},
+	}
+};
+static struct plat_serial8250_port dm365_serial1_platform_data[] = {
 	{
 		.mapbase	= DM365_UART1_BASE,
 		.irq		= IRQ_UARTINT1,
@@ -1057,20 +1059,27 @@ static struct plat_serial8250_port dm365_serial_platform_data[] = {
 				  UPF_IOREMAP,
 		.iotype		= UPIO_MEM,
 		.regshift	= 2,
-	},
-	{
-		.flags		= 0
-	},
+	}
 };
 
-static struct platform_device dm365_serial_device = {
-	.name			= "serial8250",
-	.id			= PLAT8250_DEV_PLATFORM,
-	.dev			= {
-		.platform_data	= dm365_serial_platform_data,
+static struct platform_device dm365_serial_device[] = {
+	{
+		.name			= "serial8250",
+		.id			= PLAT8250_DEV_PLATFORM,
+		.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 = {
 	.io_desc		= dm365_io_desc,
 	.io_desc_num		= ARRAY_SIZE(dm365_io_desc),
@@ -1093,7 +1102,7 @@ static struct davinci_soc_info davinci_soc_info_dm365 = {
 	.gpio_num		= 104,
 	.gpio_irq		= IRQ_DM365_GPIO0,
 	.gpio_unbanked		= 8,	/* really 16 ... skip muxed GPIOs */
-	.serial_dev		= &dm365_serial_device,
+	.serial_dev		= dm365_serial_device,
 	.emac_pdata		= &dm365_emac_pdata,
 	.sram_dma		= 0x00010000,
 	.sram_len		= SZ_32K,
arch/arm/mach-davinci/dm644x.c +33 -16

88 lines not on this page · raw message

arch/arm/mach-davinci/dm646x.c +33 -15

89 lines not on this page · raw message

arch/arm/mach-davinci/include/mach/da8xx.h +1 -1
index 2e1c9ea..71aa7d0 100644
@@ -110,7 +110,7 @@ void da8xx_restart(char mode, const char *cmd);
 void da8xx_rproc_reserve_cma(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 da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata;
 extern struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata;
arch/arm/mach-davinci/include/mach/serial.h +4 -0
index 62ad300..34d9877 100644
@@ -44,6 +44,10 @@ struct davinci_uart_config {
 
 extern int davinci_serial_init(struct davinci_uart_config *);
 extern int davinci_serial_setup_clk(unsigned instance, unsigned int *rate);
+extern struct platform_device dm365_serial_device[];
+extern struct platform_device dm355_serial_device[];
+extern struct platform_device dm644x_serial_device[];
+extern struct platform_device dm646x_serial_device[];
 #endif
 
 #endif /* __ASM_ARCH_SERIAL_H */
arch/arm/mach-davinci/include/mach/tnetv107x.h +1 -1
index 1656a02..07948a5 100644
@@ -49,7 +49,7 @@ struct tnetv107x_device_info {
 };
 
 extern struct platform_device tnetv107x_wdt_device;
-extern struct platform_device tnetv107x_serial_device;
+extern struct platform_device tnetv107x_serial_device[];
 
 extern void __init tnetv107x_init(void);
 extern void __init tnetv107x_devices_init(struct tnetv107x_device_info *);
arch/arm/mach-davinci/serial.c +12 -7
index f262581..57e6150 100644
@@ -76,7 +76,7 @@ int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate)
 	char name[16];
 	struct clk *clk;
 	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, name);
@@ -96,19 +96,25 @@ int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate)
 
 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 device *dev = &soc_info->serial_dev->dev;
-	struct plat_serial8250_port *p = dev->platform_data;
+	struct device *dev;
+	struct plat_serial8250_port *p;
 
 	/*
 	 * 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.
 	 */
-	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)))
 			continue;
 
+		ret = platform_device_register(&soc_info->serial_dev[i]);
+		if (ret)
+			continue;
+
 		ret = davinci_serial_setup_clk(i, &p->uartclk);
 		if (ret)
 			continue;
@@ -125,6 +131,5 @@ int __init davinci_serial_init(struct davinci_uart_config *info)
 		if (p->membase && p->type != PORT_AR7)
 			davinci_serial_reset(p);
 	}
-
-	return platform_device_register(soc_info->serial_dev);
+	return ret;
 }
arch/arm/mach-davinci/tnetv107x.c +4 -4
index 3b2a70d..d8a9516 100644
@@ -263,7 +263,7 @@ static struct clk_lookup clks[] = {
 	CLK(NULL,		"clk_chipcfg",		&clk_chipcfg),
 	CLK("tnetv107x-ts.0",	NULL,			&clk_tsc),
 	CLK(NULL,		"clk_rom",		&clk_rom),
-	CLK(NULL,		"uart2",		&clk_uart2),
+	CLK("serial8250.2",     NULL,			&clk_uart2),
 	CLK(NULL,		"clk_pktsec",		&clk_pktsec),
 	CLK("tnetv107x-rng.0",	NULL,			&clk_rng),
 	CLK("tnetv107x-pka.0",	NULL,			&clk_pka),
@@ -273,8 +273,8 @@ static struct clk_lookup clks[] = {
 	CLK(NULL,		"clk_gpio",		&clk_gpio),
 	CLK(NULL,		"clk_mdio",		&clk_mdio),
 	CLK("dm6441-mmc.0",	NULL,			&clk_sdio0),
-	CLK(NULL,		"uart0",		&clk_uart0),
-	CLK(NULL,		"uart1",		&clk_uart1),
+	CLK("serial8250.0",	NULL,			&clk_uart0),
+	CLK("serial8250.1",	NULL,			&clk_uart1),
 	CLK(NULL,		"timer0",		&clk_timer0),
 	CLK(NULL,		"timer1",		&clk_timer1),
 	CLK("tnetv107x_wdt.0",	NULL,			&clk_wdt_arm),
@@ -756,7 +756,7 @@ static struct davinci_soc_info tnetv107x_soc_info = {
 	.gpio_type		= GPIO_TYPE_TNETV107X,
 	.gpio_num		= TNETV107X_N_GPIO,
 	.timer_info		= &timer_info,
-	.serial_dev		= &tnetv107x_serial_device,
+	.serial_dev		= tnetv107x_serial_device,
 };
 
 void __init tnetv107x_init(void)
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH v2 1/5 ARM: davinci: uart: move to devid based clk_get

Hi Prakash,

It appears that this patch was not tested thoroughly. See below:

Quoted 37 lines · Prakash

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.

---

arch/arm/mach-davinci/devices-da8xx.c +7 -3
-static struct plat_serial8250_port da8xx_serial_pdata[] = {
+static struct plat_serial8250_port da8xx_serial0_pdata[] = {
 	{
 		.mapbase	= DA8XX_UART0_BASE,
 		.irq		= IRQ_DA8XX_UARTINT0,
@@ -75,7 +75,9 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = {
 					UPF_IOREMAP,
 		.iotype		= UPIO_MEM,
 		.regshift	= 2,
-	},
+	}
+};
+static struct plat_serial8250_port da8xx_serial1_pdata[] = {
 	{
 		.mapbase	= DA8XX_UART1_BASE,
 		.irq		= IRQ_DA8XX_UARTINT1,
@@ -83,7 +85,9 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = {
 					UPF_IOREMAP,
 		.iotype		= UPIO_MEM,
 		.regshift	= 2,
-	},
+	}
+};
+static struct plat_serial8250_port da8xx_serial2_pdata[] = {
 	{
 		.mapbase	= DA8XX_UART2_BASE,
 		.irq		= IRQ_DA8XX_UARTINT2,

arch/arm/mach-davinci/devices-da8xx.c static struct plat_serial8250_port da8xx_serial_pdata[] = { · line 98

Quoted 8 lines
arch/arm/mach-davinci/devices-da8xx.c +1 -4
@@ -91,18 +95,31 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = {
 					UPF_IOREMAP,
 		.iotype		= UPIO_MEM,
 		.regshift	= 2,
-	},
-	{
-		.flags	= 0,
-	},
+	}

8250_core.c relies on sentinel value with p->flags = 0 to terminate looking for more ports. You don't have sentinel values in any of pdata the arrays you introduced so the code basically goes looking into areas of memory not its own. This caused bunch of "cannot register port" errors for me but I can easily imagine more serious errors.

Thanks,
Sekhar

#3 lore raw

PATCH v2 1/5 ARM: davinci: uart: move to devid based clk_get

Quoted 48 lines · Sekhar Nori

Hi Prakash,

It appears that this patch was not tested thoroughly. See below:

Quoted 43 lines · Prakash

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.

---

arch/arm/mach-davinci/devices-da8xx.c +7 -6
-static struct plat_serial8250_port da8xx_serial_pdata[] = {
+static struct plat_serial8250_port da8xx_serial0_pdata[] = {
 	{
 		.mapbase	= DA8XX_UART0_BASE,
 		.irq		= IRQ_DA8XX_UARTINT0,
@@ -75,7 +75,9 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = {
 					UPF_IOREMAP,
 		.iotype		= UPIO_MEM,
 		.regshift	= 2,
-	},
+	}
+};
+static struct plat_serial8250_port da8xx_serial1_pdata[] = {
 	{
 		.mapbase	= DA8XX_UART1_BASE,
 		.irq		= IRQ_DA8XX_UARTINT1,
@@ -83,7 +85,9 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = {
 					UPF_IOREMAP,
 		.iotype		= UPIO_MEM,
 		.regshift	= 2,
-	},
+	}
+};
+static struct plat_serial8250_port da8xx_serial2_pdata[] = {
 	{
 		.mapbase	= DA8XX_UART2_BASE,
 		.irq		= IRQ_DA8XX_UARTINT2,
@@ -91,18 +95,31 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = {
 					UPF_IOREMAP,
 		.iotype		= UPIO_MEM,
 		.regshift	= 2,
-	},
-	{
-		.flags	= 0,
Quoted 8 lines

Review static struct plat_serial8250_port da8xx_serial_pdata[] = { · line 98

Quoted 2 lines
(quoted diff) +1 -1
-	},
+	}

8250_core.c relies on sentinel value with p->flags = 0 to terminate looking for more ports. You don't have sentinel values in any of pdata the arrays you introduced so the code basically goes looking into areas of memory not its own. This caused bunch of "cannot register port" errors for me but I can easily imagine more serious errors.

Similarly, you check for platform_data being NULL to go over the list of serial devices in the code in serial.c you introduced, but don't have a sentinel when you define the serial device array.

Thanks,
Sekhar

#4 lore raw

PATCH v2 1/5 ARM: davinci: uart: move to devid based clk_get

Hi Sekhar,

Thanks for the review.

Quoted 51 lines · Sekhar
Quoted 48 lines · Sekhar Nori

Hi Prakash,

It appears that this patch was not tested thoroughly. See below:

Quoted 43 lines · Prakash

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.

---

arch/arm/mach-davinci/devices-da8xx.c +7 -6
-static struct plat_serial8250_port da8xx_serial_pdata[] = {
+static struct plat_serial8250_port da8xx_serial0_pdata[] = {
 	{
 		.mapbase	= DA8XX_UART0_BASE,
 		.irq		= IRQ_DA8XX_UARTINT0,
@@ -75,7 +75,9 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = {
 					UPF_IOREMAP,
 		.iotype		= UPIO_MEM,
 		.regshift	= 2,
-	},
+	}
+};
+static struct plat_serial8250_port da8xx_serial1_pdata[] = {
 	{
 		.mapbase	= DA8XX_UART1_BASE,
 		.irq		= IRQ_DA8XX_UARTINT1,
@@ -83,7 +85,9 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = {
 					UPF_IOREMAP,
 		.iotype		= UPIO_MEM,
 		.regshift	= 2,
-	},
+	}
+};
+static struct plat_serial8250_port da8xx_serial2_pdata[] = {
 	{
 		.mapbase	= DA8XX_UART2_BASE,
 		.irq		= IRQ_DA8XX_UARTINT2,
@@ -91,18 +95,31 @@ static struct plat_serial8250_port da8xx_serial_pdata[] = {
 					UPF_IOREMAP,
 		.iotype		= UPIO_MEM,
 		.regshift	= 2,
-	},
-	{
-		.flags	= 0,
Quoted 8 lines
Quoted 8 lines

Review static struct plat_serial8250_port da8xx_serial_pdata[] = { · line 98

Quoted 2 lines
(quoted diff) +1 -1
-	},
+	}

8250_core.c relies on sentinel value with p->flags = 0 to terminate looking for more ports. You don't have sentinel values in any of pdata the arrays you introduced so the code basically goes looking into areas of memory not its own. This caused bunch of "cannot register port" errors for me but I can easily imagine more serious errors.

Will fix this.

Quoted 5 lines

Similarly, you check for platform_data being NULL to go over the list of serial devices in the code in serial.c you introduced, but don't have a sentinel when you define the serial device array.

I have fixed this and above, posted patch here:
http://davinci-linux-open-source.1494791.n2.nabble.com/PATCH-v3-0-5-ARM-davinci-fix-UART-clock-enabling-tt7583378.html

Thanks,
Prakash

#5 lore raw

PATCH v2 1/5 ARM: davinci: uart: move to devid based clk_get

In reply to Manjunathappa, Prakash
Quoted 20 lines · Prakash

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.

arch/arm/mach-davinci/devices-da8xx.c +11 -0
+struct platform_device da8xx_serial_device[] = {
+	{
+		.name	= "serial8250",
+		.id	= PLAT8250_DEV_PLATFORM,
+		.dev	= {
+			.platform_data	= da8xx_serial0_pdata
+		}
 	},
+	{
+		.name	= "serial8250",
+		.id	= PLAT8250_DEV_PLATFORM1,
+		.dev	= {

arch/arm/mach-davinci/devices-da8xx.c static struct plat_serial8250_port da8xx_serial_pdata[] = { · line 122

Quoted 10 lines
arch/arm/mach-davinci/devices-da8xx.c +10 -0
+			.platform_data	= da8xx_serial1_pdata
+		}
+	},
+	{
+		.name	= "serial8250",
+		.id	= PLAT8250_DEV_PLATFORM2,
+		.dev	= {
+			.platform_data	= da8xx_serial2_pdata
+		}
+	}

You should include trailing ',' when defining structures like these (except on the sentinel value).

arch/arm/mach-davinci/include/mach/serial.h struct davinci_uart_config { · line 50

Quoted 12 lines
arch/arm/mach-davinci/include/mach/serial.h +4 -0
index 62ad300..34d9877 100644
@@ -44,6 +44,10 @@ struct davinci_uart_config {
 
 extern int davinci_serial_init(struct davinci_uart_config *);
 extern int davinci_serial_setup_clk(unsigned instance, unsigned int *rate);
+extern struct platform_device dm365_serial_device[];
+extern struct platform_device dm355_serial_device[];
+extern struct platform_device dm644x_serial_device[];
+extern struct platform_device dm646x_serial_device[];

This patch fails to build because of these extern definitions here. Looks like they belong to 5/5. Also, add them to the local davinci.h instead of globally visible serial.h - no need for rest of the kernel to know about these.

After this is fixed locally, applying this patch to master branch of my tree leads to the attached crash (sorry about the broken linewrap, I hope its readable). Please fix this issue along with others that I already pointed out and resubmit.

Thanks,
Sekhar

Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled serial8250.0: ttyS0 at MMIO 0x1c20000 (irq = 40) is a 16550A console [ttyS0] enabled
serial8250 serial8250.0: unable to register port at index 1 (IO0 MEM1c20400 IRQ41): -22
serial8250 serial8250.0: unable to register port at index 2 (IO0 MEM1c20800 IRQ42): -22

Unable to handle kernel paging request at virtual address 019bfcc0
pgd = c0004000
[019bfcc0] *pgd=00000000
Internal error: Oops: 80000005 [#1] PREEMPT ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.0-rc4-08028-gc89afd8-dirty #32
task: cf836000 ti: cf838000 task.ti: cf838000
PC is at 0x19bfcc0
LR is at serial8250_config_port+0x13c/0x668
pc : [<019bfcc0>]    lr : [<c01bb99c>]    psr: 40000093

sp : cf839bd0 ip : cf839bd0 fp : cf839c04
r10: c03f6528 r9 : c0396484 r8 : 00000000
r7 : 20000013 r6 : fffffffe r5 : 00000001 r4 : c03f6628 r3 : 019bfcc0 r2 : 10000002 r1 : 00000001 r0 : c03f6628
Flags: nZcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 0005317f Table: 80004000 DAC: 00000017
Process swapper (pid: 1, stack limit = 0xcf8381b8)

Stack: (0xcf839bd0 to 0xcf83a000)

9bc0: cf8acd08 cf838000 c0396484
cf8accb0
9be0: c03ccbf4 c03f6628 cf8acd08 cf838000 c0396484 c03f6528 cf839c94 cf839c08
9c00: c01b6584 c01bb870 cf8e3cfc 0000000f cf8acd08 c03ccbf4 cf839c44 cf839c28
9c20: c0178bf8 c0178d08 0000000f cf8acd08 c03ccacc cf838000 cf839c64 cf839c48
9c40: c02a8150 c005167c 00000000 cf8accb0 cf8acd08 c03ccbf4 cf839c74 cf839c68
9c60: c02a8224 c02a80f4 cf839c94 cf839cd0 c03f6628 00000003 c03f6728 c03f6524
9c80: c0396484 c03f6528 cf839cbc cf839c98 c01ba788 c01b6434 c03aecb0 00000003
9ca0: c03ada80 00000000 00000000 00000000 cf839df4 cf839cc0 c01ba8d8 c01ba518
9cc0: 01c20800 00000000 0000002a ffffffea 01c40800 fec40800 019bfcc0 0000001f
9ce0: c0332db0 ffffffff 00000000 00000000 00000000 019bfcc0 0000001f 00000000
9d00: 000c0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9d20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9d40: 00000000 00000002 00000000 00000000 00000000 00000000 00000000 00000000
9d60: 00000001 c03ada80 000000c4 00000000 01c40c00 00000000 00000000 00000000
9d80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9da0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9dc0: 00000000 00000000 00000000 00000000 c00fb518 c03ada80 c03f6d70 c03adab4
9de0: c03ccc40 cfa0da10 cf839e04 cf839df8 c01c472c c01ba7c8 cf839e24 cf839e08
9e00: c01c32f8 c01c4720 c03ada80 c03ccc40 c03adab4 00000000 cf839e44 cf839e28
9e20: c01c352c c01c3284 00000000 00000000 c03ccc40 c01c3498 cf839e6c cf839e48
9e40: c01c1894 c01c34a8 cf822258 cf894270 cf9b7cf4 c03ccc40 cf9b7cc0 c03cd240
9e60: cf839e7c cf839e70 c01c2e80 c01c1844 cf839eac cf839e80 c01c29fc c01c2e70
9e80: c0332ed0 00000003 cf839eac c03ccc40 c03f6528 00000003 c02c3ba4 cfa0da10
9ea0: cf839ed4 cf839eb0 c01c3a54 c01c2930 c03ccbf4 c03f6528 00000003 c02c3ba4
9ec0: cfa0da10 00000000 cf839ee4 cf839ed8 c01c49f4 c01c39e4 cf839f0c cf839ee8
9ee0: c038c0d8 c01c49b8 00000000 c039df5c 00000006 cf838000 c03d39a0 c038bfd0
9f00: cf839f4c cf839f10 c00088c4 c038bfe0 00000006 c0376610 00000000 c034b6ac
9f20: cf839f4c c039df5c 00000006 c03d39a0 c037826c c0396490 c0396484 0000004f
9f40: cf839f94 cf839f50 c0378968 c00087e8 00000006 00000006 c037826c 00000000
9f60: 00000000 00000000 cf839f94 00000000 c02a2a90 00000000 00000000 00000000
9f80: 00000000 00000000 cf839fac cf839f98 c02a2aa0 c0378884 00000000 00000000
9fa0: 00000000 cf839fb0 c00094d0 c02a2aa0 00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000

Backtrace:
[<c01bb860>] (serial8250_config_port+0x0/0x668) from [<c01b6584>]
(uart_add_one_port+0x160/0x3d4)
[<c01b6424>] (uart_add_one_port+0x0/0x3d4) from [<c01ba788>]
(serial8250_register_8250_port+0x280/0x2b0)
[<c01ba508>] (serial8250_register_8250_port+0x0/0x2b0) from [<c01ba8d8>]
(serial8250_probe+0x120/0x174)
[<c01ba7b8>] (serial8250_probe+0x0/0x174) from [<c01c472c>]
(platform_drv_probe+0x1c/0x20)
 r8:cfa0da10 r7:c03ccc40 r6:c03adab4 r5:c03f6d70 r4:c03ada80
[<c01c4710>] (platform_drv_probe+0x0/0x20) from [<c01c32f8>]
(driver_probe_device+0x84/0x224)
[<c01c3274>] (driver_probe_device+0x0/0x224) from [<c01c352c>]
(__driver_attach+0x94/0x98)
 r7:00000000 r6:c03adab4 r5:c03ccc40 r4:c03ada80
[<c01c3498>] (__driver_attach+0x0/0x98) from [<c01c1894>]
(bus_for_each_dev+0x60/0x90)
 r6:c01c3498 r5:c03ccc40 r4:00000000 r3:00000000
[<c01c1834>] (bus_for_each_dev+0x0/0x90) from [<c01c2e80>]
(driver_attach+0x20/0x28)
 r6:c03cd240 r5:cf9b7cc0 r4:c03ccc40
[<c01c2e60>] (driver_attach+0x0/0x28) from [<c01c29fc>]
(bus_add_driver+0xdc/0x238)
[<c01c2920>] (bus_add_driver+0x0/0x238) from [<c01c3a54>]
(driver_register+0x80/0x154)
 r8:cfa0da10 r7:c02c3ba4 r6:00000003 r5:c03f6528 r4:c03ccc40
[<c01c39d4>] (driver_register+0x0/0x154) from [<c01c49f4>]
(platform_driver_register+0x4c/0x60)
[<c01c49a8>] (platform_driver_register+0x0/0x60) from [<c038c0d8>]
(serial8250_init+0x108/0x160)
[<c038bfd0>] (serial8250_init+0x0/0x160) from [<c00088c4>]
(do_one_initcall+0xec/0x158)
 r8:c038bfd0 r7:c03d39a0 r6:cf838000 r5:00000006 r4:c039df5c

r3:00000000
[<c00087d8>] (do_one_initcall+0x0/0x158) from [<c0378968>] (kernel_init_freeable+0xf4/0x1b8)
[<c0378874>] (kernel_init_freeable+0x0/0x1b8) from [<c02a2aa0>] (kernel_init+0x10/0xec)
[<c02a2a90>] (kernel_init+0x0/0xec) from [<c00094d0>] (ret_from_fork+0x14/0x24)
r4:00000000 r3:00000000

Code: bad PC value
---[ end trace ad321c8a03a56474 ]---
#6 lore raw

PATCH v2 1/5 ARM: davinci: uart: move to devid based clk_get

Hi Sekhar,

Quoted 26 lines · Sekhar
Quoted 25 lines · Prakash

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.

arch/arm/mach-davinci/devices-da8xx.c +16 -0
+struct platform_device da8xx_serial_device[] = {
+	{
+		.name	= "serial8250",
+		.id	= PLAT8250_DEV_PLATFORM,
+		.dev	= {
+			.platform_data	= da8xx_serial0_pdata
+		}
 	},
+	{
+		.name	= "serial8250",
+		.id	= PLAT8250_DEV_PLATFORM1,
+		.dev	= {
+			.platform_data	= da8xx_serial1_pdata
+		}
+	},
+	{
+		.name	= "serial8250",
Quoted 9 lines

arch/arm/mach-davinci/devices-da8xx.c static struct plat_serial8250_port da8xx_serial_pdata[] = { · line 122

Quoted 5 lines
arch/arm/mach-davinci/devices-da8xx.c +5 -0
+		.id	= PLAT8250_DEV_PLATFORM2,
+		.dev	= {
+			.platform_data	= da8xx_serial2_pdata
+		}
+	}

You should include trailing ',' when defining structures like these (except on the sentinel value).

Will fix this.

Quoted 6 lines
Quoted 6 lines
arch/arm/mach-davinci/include/mach/serial.h +0 -0
index 62ad300..34d9877 100644
@@ -44,6 +44,10 @@ struct davinci_uart_config {
 
Quoted 12 lines

arch/arm/mach-davinci/include/mach/serial.h struct davinci_uart_config { · line 50

Quoted 6 lines
arch/arm/mach-davinci/include/mach/serial.h +4 -0
 extern int davinci_serial_init(struct davinci_uart_config *);
 extern int davinci_serial_setup_clk(unsigned instance, unsigned int *rate);
+extern struct platform_device dm365_serial_device[];
+extern struct platform_device dm355_serial_device[];
+extern struct platform_device dm644x_serial_device[];
+extern struct platform_device dm646x_serial_device[];

This patch fails to build because of these extern definitions here. Looks like they belong to 5/5. Also, add them to the local davinci.h instead of globally visible serial.h - no need for rest of the kernel to know about these.

Moved them to davinci.h and merged it with 5/5.

Quoted 5 lines

After this is fixed locally, applying this patch to master branch of my tree leads to the attached crash (sorry about the broken linewrap, I hope its readable). Please fix this issue along with others that I already pointed out and resubmit.

I do not see this crash any more, with earlier comments fixed. I tested it on da850-evm for both DT and non-DT boot.

Submitted next version of patch considering all comments:
http://davinci-linux-open-source.1494791.n2.nabble.com/PATCH-v3-0-5-ARM-davinci-fix-UART-clock-enabling-tt7583378.html

Thanks,
Prakash

Quoted 140 lines

Thanks,
Sekhar

Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled serial8250.0: ttyS0 at MMIO 0x1c20000 (irq = 40) is a 16550A console [ttyS0] enabled
serial8250 serial8250.0: unable to register port at index 1 (IO0 MEM1c20400 IRQ41): -22
serial8250 serial8250.0: unable to register port at index 2 (IO0 MEM1c20800 IRQ42): -22

Unable to handle kernel paging request at virtual address 019bfcc0
pgd = c0004000
[019bfcc0] *pgd=00000000
Internal error: Oops: 80000005 [#1] PREEMPT ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.0-rc4-08028-gc89afd8-dirty #32
task: cf836000 ti: cf838000 task.ti: cf838000
PC is at 0x19bfcc0
LR is at serial8250_config_port+0x13c/0x668
pc : [<019bfcc0>]    lr : [<c01bb99c>]    psr: 40000093

sp : cf839bd0 ip : cf839bd0 fp : cf839c04
r10: c03f6528 r9 : c0396484 r8 : 00000000
r7 : 20000013 r6 : fffffffe r5 : 00000001 r4 : c03f6628 r3 : 019bfcc0 r2 : 10000002 r1 : 00000001 r0 : c03f6628
Flags: nZcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 0005317f Table: 80004000 DAC: 00000017
Process swapper (pid: 1, stack limit = 0xcf8381b8)

Stack: (0xcf839bd0 to 0xcf83a000)

9bc0: cf8acd08 cf838000 c0396484
cf8accb0
9be0: c03ccbf4 c03f6628 cf8acd08 cf838000 c0396484 c03f6528 cf839c94 cf839c08
9c00: c01b6584 c01bb870 cf8e3cfc 0000000f cf8acd08 c03ccbf4 cf839c44 cf839c28
9c20: c0178bf8 c0178d08 0000000f cf8acd08 c03ccacc cf838000 cf839c64 cf839c48
9c40: c02a8150 c005167c 00000000 cf8accb0 cf8acd08 c03ccbf4 cf839c74 cf839c68
9c60: c02a8224 c02a80f4 cf839c94 cf839cd0 c03f6628 00000003 c03f6728 c03f6524
9c80: c0396484 c03f6528 cf839cbc cf839c98 c01ba788 c01b6434 c03aecb0 00000003
9ca0: c03ada80 00000000 00000000 00000000 cf839df4 cf839cc0 c01ba8d8 c01ba518
9cc0: 01c20800 00000000 0000002a ffffffea 01c40800 fec40800 019bfcc0 0000001f
9ce0: c0332db0 ffffffff 00000000 00000000 00000000 019bfcc0 0000001f 00000000
9d00: 000c0000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9d20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9d40: 00000000 00000002 00000000 00000000 00000000 00000000 00000000 00000000
9d60: 00000001 c03ada80 000000c4 00000000 01c40c00 00000000 00000000 00000000
9d80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9da0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9dc0: 00000000 00000000 00000000 00000000 c00fb518 c03ada80 c03f6d70 c03adab4
9de0: c03ccc40 cfa0da10 cf839e04 cf839df8 c01c472c c01ba7c8 cf839e24 cf839e08
9e00: c01c32f8 c01c4720 c03ada80 c03ccc40 c03adab4 00000000 cf839e44 cf839e28
9e20: c01c352c c01c3284 00000000 00000000 c03ccc40 c01c3498 cf839e6c cf839e48
9e40: c01c1894 c01c34a8 cf822258 cf894270 cf9b7cf4 c03ccc40 cf9b7cc0 c03cd240
9e60: cf839e7c cf839e70 c01c2e80 c01c1844 cf839eac cf839e80 c01c29fc c01c2e70
9e80: c0332ed0 00000003 cf839eac c03ccc40 c03f6528 00000003 c02c3ba4 cfa0da10
9ea0: cf839ed4 cf839eb0 c01c3a54 c01c2930 c03ccbf4 c03f6528 00000003 c02c3ba4
9ec0: cfa0da10 00000000 cf839ee4 cf839ed8 c01c49f4 c01c39e4 cf839f0c cf839ee8
9ee0: c038c0d8 c01c49b8 00000000 c039df5c 00000006 cf838000 c03d39a0 c038bfd0
9f00: cf839f4c cf839f10 c00088c4 c038bfe0 00000006 c0376610 00000000 c034b6ac
9f20: cf839f4c c039df5c 00000006 c03d39a0 c037826c c0396490 c0396484 0000004f
9f40: cf839f94 cf839f50 c0378968 c00087e8 00000006 00000006 c037826c 00000000
9f60: 00000000 00000000 cf839f94 00000000 c02a2a90 00000000 00000000 00000000
9f80: 00000000 00000000 cf839fac cf839f98 c02a2aa0 c0378884 00000000 00000000
9fa0: 00000000 cf839fb0 c00094d0 c02a2aa0 00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000

Backtrace:
[<c01bb860>] (serial8250_config_port+0x0/0x668) from [<c01b6584>]
(uart_add_one_port+0x160/0x3d4)
[<c01b6424>] (uart_add_one_port+0x0/0x3d4) from [<c01ba788>]
(serial8250_register_8250_port+0x280/0x2b0)
[<c01ba508>] (serial8250_register_8250_port+0x0/0x2b0) from [<c01ba8d8>]
(serial8250_probe+0x120/0x174)
[<c01ba7b8>] (serial8250_probe+0x0/0x174) from [<c01c472c>]
(platform_drv_probe+0x1c/0x20)
 r8:cfa0da10 r7:c03ccc40 r6:c03adab4 r5:c03f6d70 r4:c03ada80
[<c01c4710>] (platform_drv_probe+0x0/0x20) from [<c01c32f8>]
(driver_probe_device+0x84/0x224)
[<c01c3274>] (driver_probe_device+0x0/0x224) from [<c01c352c>]
(__driver_attach+0x94/0x98)
 r7:00000000 r6:c03adab4 r5:c03ccc40 r4:c03ada80
[<c01c3498>] (__driver_attach+0x0/0x98) from [<c01c1894>]
(bus_for_each_dev+0x60/0x90)
 r6:c01c3498 r5:c03ccc40 r4:00000000 r3:00000000
[<c01c1834>] (bus_for_each_dev+0x0/0x90) from [<c01c2e80>]
(driver_attach+0x20/0x28)
 r6:c03cd240 r5:cf9b7cc0 r4:c03ccc40
[<c01c2e60>] (driver_attach+0x0/0x28) from [<c01c29fc>]
(bus_add_driver+0xdc/0x238)
[<c01c2920>] (bus_add_driver+0x0/0x238) from [<c01c3a54>]
(driver_register+0x80/0x154)
 r8:cfa0da10 r7:c02c3ba4 r6:00000003 r5:c03f6528 r4:c03ccc40
[<c01c39d4>] (driver_register+0x0/0x154) from [<c01c49f4>]
(platform_driver_register+0x4c/0x60)
[<c01c49a8>] (platform_driver_register+0x0/0x60) from [<c038c0d8>]
(serial8250_init+0x108/0x160)
[<c038bfd0>] (serial8250_init+0x0/0x160) from [<c00088c4>]
(do_one_initcall+0xec/0x158)
 r8:c038bfd0 r7:c03d39a0 r6:cf838000 r5:00000006 r4:c039df5c

r3:00000000
[<c00087d8>] (do_one_initcall+0x0/0x158) from [<c0378968>] (kernel_init_freeable+0xf4/0x1b8)
[<c0378874>] (kernel_init_freeable+0x0/0x1b8) from [<c02a2aa0>] (kernel_init+0x10/0xec)
[<c02a2a90>] (kernel_init+0x0/0xec) from [<c00094d0>] (ret_from_fork+0x14/0x24)
r4:00000000 r3:00000000

Code: bad PC value
---[ end trace ad321c8a03a56474 ]---
#7 lore raw

PATCH v2 2/5 ARM: davinci: da850: override device name of UART in DT kernel

In reply to Manjunathappa, Prakash

Populate OF_DEV_AUXDATA with desired device name so as to prevent clk_get failures.

---
 arch/arm/mach-davinci/da8xx-dt.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/da8xx-dt.c +3 -0
index 961aea8..e429945 100644
@@ -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", 0x01f08000, "ecap", 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),
 	{}
 };
 
Signature · 1 line
1.7.4.1
#8 lore raw

PATCH v2 3/5 ARM: davinci: da850: do not specify clock_frequency for UART DT node

In reply to Manjunathappa, Prakash

DT kernel on da850-evm comes up with garbled UART logs. This is because of mismatch in actual module clock rate and rate specified(clock-frequency) in DT blob. kernel should not assume or depend on bootloaders clock configuration, instead let it find the clock rate at runtime.

Issue discussed here before arriving on this implementation:
"ARM: davinci: da850 evm: update clock rate for UART 1/2 DT nodes"
https://patchwork.kernel.org/patch/2162271/

---
 arch/arm/boot/dts/da850.dtsi |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
arch/arm/boot/dts/da850.dtsi +0 -3
index 2c88313..4d43046 100644
@@ -129,7 +129,6 @@
 		serial0: serial@1c42000 {
 			compatible = "ns16550a";
 			reg = <0x42000 0x100>;
-			clock-frequency = <150000000>;
 			reg-shift = <2>;
 			interrupts = <25>;
 			status = "disabled";
@@ -137,7 +136,6 @@
 		serial1: serial@1d0c000 {
 			compatible = "ns16550a";
 			reg = <0x10c000 0x100>;
-			clock-frequency = <150000000>;
 			reg-shift = <2>;
 			interrupts = <53>;
 			status = "disabled";
@@ -145,7 +143,6 @@
 		serial2: serial@1d0d000 {
 			compatible = "ns16550a";
 			reg = <0x10d000 0x100>;
-			clock-frequency = <150000000>;
 			reg-shift = <2>;
 			interrupts = <61>;
 			status = "disabled";
Signature · 1 line
1.7.4.1
#9 lore raw

PATCH v2 4/5 ARM: davinci: da8xx: remove da8xx_uart_clk_enable

In reply to Manjunathappa, Prakash

Serial clocks are enabled from of_platform_serial_setup:of_serial.c, so remove davinci_serial_setup_clk from here.

---
 arch/arm/mach-davinci/da8xx-dt.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
arch/arm/mach-davinci/da8xx-dt.c +0 -8
index e429945..9683cbd 100644
@@ -20,13 +20,6 @@
 
 #define DA8XX_NUM_UARTS	3
 
-static void __init da8xx_uart_clk_enable(void)
-{
-	int i;
-	for (i = 0; i < DA8XX_NUM_UARTS; i++)
-		davinci_serial_setup_clk(i, NULL);
-}
-
 static struct of_device_id da8xx_irq_match[] __initdata = {
 	{ .compatible = "ti,cp-intc", .data = cp_intc_of_init, },
 	{ }
@@ -60,7 +53,6 @@ static void __init da850_init_machine(void)
 	of_platform_populate(NULL, of_default_bus_match_table,
 			     da850_auxdata_lookup, NULL);
 
-	da8xx_uart_clk_enable();
 }
 
 static const char *da850_boards_compat[] __initdata = {
Signature · 1 line
1.7.4.1
#10 lore raw

PATCH v2 5/5 ARM: davinci: serial: platform code cleanup

In reply to Manjunathappa, Prakash

1) "struct davinci_uart_config" is introduced to specify UART ports brought out or enabled on the board. But none of the boards use them for that purpose, so clean it up.
2) Have pointer to platform device as a argument for davinci_serial_init(), no need of serial_dev in struct soc_info now.
3) No need of davinci_serial_setup_clk(), not called from multiple places, hence reduce function call overhead.

---
 arch/arm/mach-davinci/board-da830-evm.c        |    6 +---
 arch/arm/mach-davinci/board-da850-evm.c        |    6 +---
 arch/arm/mach-davinci/board-dm355-evm.c        |    6 +---
 arch/arm/mach-davinci/board-dm355-leopard.c    |    6 +---
 arch/arm/mach-davinci/board-dm365-evm.c        |    6 +---
 arch/arm/mach-davinci/board-dm644x-evm.c       |    6 +---
 arch/arm/mach-davinci/board-dm646x-evm.c       |    6 +---
 arch/arm/mach-davinci/board-mityomapl138.c     |    6 +---
 arch/arm/mach-davinci/board-neuros-osd2.c      |    6 +---
 arch/arm/mach-davinci/board-omapl138-hawk.c    |    6 +---
 arch/arm/mach-davinci/board-sffsdr.c           |    7 +---
 arch/arm/mach-davinci/da830.c                  |    1 -
 arch/arm/mach-davinci/da850.c                  |    1 -
 arch/arm/mach-davinci/devices-tnetv107x.c      |    2 +-
 arch/arm/mach-davinci/dm355.c                  |    3 +-
 arch/arm/mach-davinci/dm365.c                  |    3 +-
 arch/arm/mach-davinci/dm644x.c                 |    3 +-
 arch/arm/mach-davinci/dm646x.c                 |    3 +-
 arch/arm/mach-davinci/include/mach/common.h    |    1 -
 arch/arm/mach-davinci/include/mach/serial.h    |   10 ++---
 arch/arm/mach-davinci/include/mach/tnetv107x.h |    1 -
 arch/arm/mach-davinci/serial.c                 |   47 +++++++-----------------
 22 files changed, 35 insertions(+), 107 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +1 -5
index 1332de8..c4bdc0a 100644
@@ -185,10 +185,6 @@ static __init void da830_evm_usb_init(void)
 			   __func__, ret);
 }
 
-static struct davinci_uart_config da830_evm_uart_config __initdata = {
-	.enabled_uarts = 0x7,
-};
-
 static const short da830_evm_mcasp1_pins[] = {
 	DA830_AHCLKX1, DA830_ACLKX1, DA830_AFSX1, DA830_AHCLKR1, DA830_AFSR1,
 	DA830_AMUTE1, DA830_AXR1_0, DA830_AXR1_1, DA830_AXR1_2, DA830_AXR1_5,
@@ -630,7 +626,7 @@ static __init void da830_evm_init(void)
 		pr_warning("da830_evm_init: watchdog registration failed: %d\n",
 				ret);
 
-	davinci_serial_init(&da830_evm_uart_config);
+	davinci_serial_init(da8xx_serial_device);
 	i2c_register_board_info(1, da830_evm_i2c_devices,
 			ARRAY_SIZE(da830_evm_i2c_devices));
 
arch/arm/mach-davinci/board-da850-evm.c +1 -5
index 8a24b6c..9ac76ee 100644
@@ -746,10 +746,6 @@ static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = {
 	.bus_delay	= 0,	/* usec */
 };
 
-static struct davinci_uart_config da850_evm_uart_config __initdata = {
-	.enabled_uarts = 0x7,
-};
-
 /* davinci da850 evm audio machine driver */
 static u8 da850_iis_serializer_direction[] = {
 	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
@@ -1495,7 +1491,7 @@ static __init void da850_evm_init(void)
 				__func__, ret);
 	}
 
-	davinci_serial_init(&da850_evm_uart_config);
+	davinci_serial_init(da8xx_serial_device);
 
 	i2c_register_board_info(1, da850_evm_i2c_devices,
 			ARRAY_SIZE(da850_evm_i2c_devices));
arch/arm/mach-davinci/board-dm355-evm.c +1 -5
index c2a0a67..42b23a3 100644
@@ -314,10 +314,6 @@ static struct platform_device *davinci_evm_devices[] __initdata = {
 	&davinci_nand_device,
 };
 
-static struct davinci_uart_config uart_config __initdata = {
-	.enabled_uarts = (1 << 0),
-};
-
 static void __init dm355_evm_map_io(void)
 {
 	dm355_init();
@@ -393,7 +389,7 @@ static __init void dm355_evm_init(void)
 	platform_add_devices(davinci_evm_devices,
 			     ARRAY_SIZE(davinci_evm_devices));
 	evm_init_i2c();
-	davinci_serial_init(&uart_config);
+	davinci_serial_init(dm355_serial_device);
 
 	/* NOTE:  NAND flash timings set by the UBL are slower than
 	 * needed by MT29F16G08FAA chips ... EMIF.A1CR is 0x40400204
arch/arm/mach-davinci/board-dm355-leopard.c +1 -5
index dff4ddc..d9eb1c9 100644
@@ -172,10 +172,6 @@ static struct platform_device *davinci_leopard_devices[] __initdata = {
 	&davinci_nand_device,
 };
 
-static struct davinci_uart_config uart_config __initdata = {
-	.enabled_uarts = (1 << 0),
-};
-
 static void __init dm355_leopard_map_io(void)
 {
 	dm355_init();
@@ -251,7 +247,7 @@ static __init void dm355_leopard_init(void)
 	platform_add_devices(davinci_leopard_devices,
 			     ARRAY_SIZE(davinci_leopard_devices));
 	leopard_init_i2c();
-	davinci_serial_init(&uart_config);
+	davinci_serial_init(dm355_serial_device);
 
 	/* NOTE:  NAND flash timings set by the UBL are slower than
 	 * needed by MT29F16G08FAA chips ... EMIF.A1CR is 0x40400204
arch/arm/mach-davinci/board-dm365-evm.c +1 -5
index fd38c8d..5f1ec9d 100644
@@ -719,10 +719,6 @@ fail:
 	/* REVISIT export switches: NTSC/PAL (SW5.6), EXTRA1 (SW5.2), etc */
 }
 
-static struct davinci_uart_config uart_config __initdata = {
-	.enabled_uarts = (1 << 0),
-};
-
 static void __init dm365_evm_map_io(void)
 {
 	dm365_init();
@@ -749,7 +745,7 @@ static struct spi_board_info dm365_evm_spi_info[] __initconst = {
 static __init void dm365_evm_init(void)
 {
 	evm_init_i2c();
-	davinci_serial_init(&uart_config);
+	davinci_serial_init(dm365_serial_device);
 
 	dm365evm_emac_configure();
 	dm365evm_mmc_configure();
arch/arm/mach-davinci/board-dm644x-evm.c +1 -5
index a33686a..462812b 100644
@@ -726,10 +726,6 @@ static struct platform_device *davinci_evm_devices[] __initdata = {
 	&rtc_dev,
 };
 
-static struct davinci_uart_config uart_config __initdata = {
-	.enabled_uarts = (1 << 0),
-};
-
 static void __init
 davinci_evm_map_io(void)
 {
@@ -791,7 +787,7 @@ static __init void davinci_evm_init(void)
 	davinci_setup_mmc(0, &dm6446evm_mmc_config);
 	dm644x_init_video(&dm644xevm_capture_cfg, &dm644xevm_display_cfg);
 
-	davinci_serial_init(&uart_config);
+	davinci_serial_init(dm644x_serial_device);
 	dm644x_init_asp(&dm644x_evm_snd_data);
 
 	/* irlml6401 switches over 1A, in under 8 msec */
arch/arm/mach-davinci/board-dm646x-evm.c +1 -5
index fbb8e5a..734cc02 100644
@@ -749,10 +749,6 @@ static void __init davinci_map_io(void)
 	cdce_clk_init();
 }
 
-static struct davinci_uart_config uart_config __initdata = {
-	.enabled_uarts = (1 << 0),
-};
-
 #define DM646X_EVM_PHY_ID		"davinci_mdio-0:01"
 /*
  * The following EDMA channels/slots are not being used by drivers (for
@@ -792,7 +788,7 @@ static __init void evm_init(void)
 	struct davinci_soc_info *soc_info = &davinci_soc_info;
 
 	evm_init_i2c();
-	davinci_serial_init(&uart_config);
+	davinci_serial_init(dm646x_serial_device);
 	dm646x_init_mcasp0(&dm646x_evm_snd_data[0]);
 	dm646x_init_mcasp1(&dm646x_evm_snd_data[1]);
 
arch/arm/mach-davinci/board-mityomapl138.c +1 -5
index 9549d53..cd0f587 100644
@@ -434,10 +434,6 @@ static void __init mityomapl138_setup_nand(void)
 				 ARRAY_SIZE(mityomapl138_devices));
 }
 
-static struct davinci_uart_config mityomapl138_uart_config __initdata = {
-	.enabled_uarts = 0x7,
-};
-
 static const short mityomap_mii_pins[] = {
 	DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
 	DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
@@ -517,7 +513,7 @@ static void __init mityomapl138_init(void)
 	if (ret)
 		pr_warning("watchdog registration failed: %d\n", ret);
 
-	davinci_serial_init(&mityomapl138_uart_config);
+	davinci_serial_init(da8xx_serial_device);
 
 	ret = da8xx_register_i2c(0, &mityomap_i2c_0_pdata);
 	if (ret)
arch/arm/mach-davinci/board-neuros-osd2.c +1 -5
index 2bc112a..8e156e0 100644
@@ -153,10 +153,6 @@ static struct platform_device *davinci_ntosd2_devices[] __initdata = {
 	&ntosd2_leds_dev,
 };
 
-static struct davinci_uart_config uart_config __initdata = {
-	.enabled_uarts = (1 << 0),
-};
-
 static void __init davinci_ntosd2_map_io(void)
 {
 	dm644x_init();
@@ -197,7 +193,7 @@ static __init void davinci_ntosd2_init(void)
 	platform_add_devices(davinci_ntosd2_devices,
 				ARRAY_SIZE(davinci_ntosd2_devices));
 
-	davinci_serial_init(&uart_config);
+	davinci_serial_init(dm644x_serial_device);
 	dm644x_init_asp(&dm644x_ntosd2_snd_data);
 
 	soc_info->emac_pdata->phy_id = NEUROS_OSD2_PHY_ID;
arch/arm/mach-davinci/board-omapl138-hawk.c +1 -5
index b8c20de..ab98c75 100644
@@ -286,15 +286,11 @@ usb11_setup_oc_fail:
 	gpio_free(DA850_USB1_VBUS_PIN);
 }
 
-static struct davinci_uart_config omapl138_hawk_uart_config __initdata = {
-	.enabled_uarts = 0x7,
-};
-
 static __init void omapl138_hawk_init(void)
 {
 	int ret;
 
-	davinci_serial_init(&omapl138_hawk_uart_config);
+	davinci_serial_init(da8xx_serial_device);
 
 	omapl138_hawk_config_emac();
 
arch/arm/mach-davinci/board-sffsdr.c +2 -5
index 739be7e..96ca11b 100644
@@ -44,6 +44,7 @@
 #include "davinci.h"
 
 #define SFFSDR_PHY_ID		"davinci_mdio-0:01"
+
 static struct mtd_partition davinci_sffsdr_nandflash_partition[] = {
 	/* U-Boot Environment: Block 0
 	 * UBL:                Block 1
@@ -125,10 +126,6 @@ static struct platform_device *davinci_sffsdr_devices[] __initdata = {
 	&davinci_sffsdr_nandflash_device,
 };
 
-static struct davinci_uart_config uart_config __initdata = {
-	.enabled_uarts = (1 << 0),
-};
-
 static void __init davinci_sffsdr_map_io(void)
 {
 	dm644x_init();
@@ -141,7 +138,7 @@ static __init void davinci_sffsdr_init(void)
 	platform_add_devices(davinci_sffsdr_devices,
 			     ARRAY_SIZE(davinci_sffsdr_devices));
 	sffsdr_init_i2c();
-	davinci_serial_init(&uart_config);
+	davinci_serial_init(dm644x_serial_device);
 	soc_info->emac_pdata->phy_id = SFFSDR_PHY_ID;
 	davinci_setup_usb(0, 0); /* We support only peripheral mode. */
 
arch/arm/mach-davinci/da830.c +0 -1
index a3ffd52..111613b 100644
@@ -1199,7 +1199,6 @@ static struct davinci_soc_info davinci_soc_info_da830 = {
 	.gpio_base		= DA8XX_GPIO_BASE,
 	.gpio_num		= 128,
 	.gpio_irq		= IRQ_DA8XX_GPIO0,
-	.serial_dev		= da8xx_serial_device,
 	.emac_pdata		= &da8xx_emac_pdata,
 };
 
arch/arm/mach-davinci/da850.c +0 -1
index 7ce691c..b1d56e5 100644
@@ -1301,7 +1301,6 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
 	.gpio_base		= DA8XX_GPIO_BASE,
 	.gpio_num		= 144,
 	.gpio_irq		= IRQ_DA8XX_GPIO0,
-	.serial_dev		= da8xx_serial_device,
 	.emac_pdata		= &da8xx_emac_pdata,
 	.sram_dma		= DA8XX_SHARED_RAM_BASE,
 	.sram_len		= SZ_128K,
arch/arm/mach-davinci/devices-tnetv107x.c +1 -1
index 35e5594..549cfad 100644
@@ -399,7 +399,7 @@ void __init tnetv107x_devices_init(struct tnetv107x_device_info *info)
 	platform_device_register(&tsc_device);
 
 	if (info->serial_config)
-		davinci_serial_init(info->serial_config);
+		davinci_serial_init(tnetv107x_serial_device);
 
 	for (i = 0; i < 2; i++)
 		if (info->mmc_config[i]) {
arch/arm/mach-davinci/dm355.c +1 -2
index a7ef0e3..006d5aa 100644
@@ -953,7 +953,7 @@ static struct plat_serial8250_port dm355_serial2_platform_data[] = {
 	}
 };
 
-static struct platform_device dm355_serial_device[] = {
+struct platform_device dm355_serial_device[] = {
 	{
 		.name			= "serial8250",
 		.id			= PLAT8250_DEV_PLATFORM,
@@ -998,7 +998,6 @@ static struct davinci_soc_info davinci_soc_info_dm355 = {
 	.gpio_base		= DAVINCI_GPIO_BASE,
 	.gpio_num		= 104,
 	.gpio_irq		= IRQ_DM355_GPIOBNK0,
-	.serial_dev		= dm355_serial_device,
 	.sram_dma		= 0x00010000,
 	.sram_len		= SZ_32K,
 };
arch/arm/mach-davinci/dm365.c +1 -2
index abeac28..a8c4c95 100644
@@ -1062,7 +1062,7 @@ static struct plat_serial8250_port dm365_serial1_platform_data[] = {
 	}
 };
 
-static struct platform_device dm365_serial_device[] = {
+struct platform_device dm365_serial_device[] = {
 	{
 		.name			= "serial8250",
 		.id			= PLAT8250_DEV_PLATFORM,
@@ -1102,7 +1102,6 @@ static struct davinci_soc_info davinci_soc_info_dm365 = {
 	.gpio_num		= 104,
 	.gpio_irq		= IRQ_DM365_GPIO0,
 	.gpio_unbanked		= 8,	/* really 16 ... skip muxed GPIOs */
-	.serial_dev		= dm365_serial_device,
 	.emac_pdata		= &dm365_emac_pdata,
 	.sram_dma		= 0x00010000,
 	.sram_len		= SZ_32K,
arch/arm/mach-davinci/dm644x.c +1 -2
index cc68266..f4da786 100644
@@ -844,7 +844,7 @@ static struct plat_serial8250_port dm644x_serial2_platform_data[] = {
 	}
 };
 
-static struct platform_device dm644x_serial_device[] = {
+struct platform_device dm644x_serial_device[] = {
 	{
 		.name			= "serial8250",
 		.id			= PLAT8250_DEV_PLATFORM,
@@ -889,7 +889,6 @@ static struct davinci_soc_info davinci_soc_info_dm644x = {
 	.gpio_base		= DAVINCI_GPIO_BASE,
 	.gpio_num		= 71,
 	.gpio_irq		= IRQ_GPIOBNK0,
-	.serial_dev		= dm644x_serial_device,
 	.emac_pdata		= &dm644x_emac_pdata,
 	.sram_dma		= 0x00008000,
 	.sram_len		= SZ_16K,
arch/arm/mach-davinci/dm646x.c +1 -2
index 1fec246..72cc683 100644
@@ -821,7 +821,7 @@ static struct plat_serial8250_port dm646x_serial2_platform_data[] = {
 	}
 };
 
-static struct platform_device dm646x_serial_device[] = {
+struct platform_device dm646x_serial_device[] = {
 	{
 		.name			= "serial8250",
 		.id			= PLAT8250_DEV_PLATFORM,
@@ -867,7 +867,6 @@ static struct davinci_soc_info davinci_soc_info_dm646x = {
 	.gpio_base		= DAVINCI_GPIO_BASE,
 	.gpio_num		= 43, /* Only 33 usable */
 	.gpio_irq		= IRQ_DM646X_GPIOBNK0,
-	.serial_dev		= dm646x_serial_device,
 	.emac_pdata		= &dm646x_emac_pdata,
 	.sram_dma		= 0x10010000,
 	.sram_len		= SZ_32K,
arch/arm/mach-davinci/include/mach/common.h +0 -1
index b124b77..7f5a2e9 100644
@@ -71,7 +71,6 @@ struct davinci_soc_info {
 	unsigned			gpio_unbanked;
 	struct davinci_gpio_controller	*gpio_ctlrs;
 	int				gpio_ctlrs_num;
-	struct platform_device		*serial_dev;
 	struct emac_platform_data	*emac_pdata;
 	dma_addr_t			sram_dma;
 	unsigned			sram_len;
arch/arm/mach-davinci/include/mach/serial.h +4 -6
index 34d9877..c7303d0 100644
@@ -15,6 +15,8 @@
 
 #include <mach/hardware.h>
 
+#include <linux/platform_device.h>
+
 #define DAVINCI_UART0_BASE	(IO_PHYS + 0x20000)
 #define DAVINCI_UART1_BASE	(IO_PHYS + 0x20400)
 #define DAVINCI_UART2_BASE	(IO_PHYS + 0x20800)
@@ -37,13 +39,9 @@
 #define UART_DM646X_SCR_TX_WATERMARK	0x08
 
 #ifndef __ASSEMBLY__
-struct davinci_uart_config {
-	/* Bit field of UARTs present; bit 0 --> UART0 */
-	unsigned int enabled_uarts;
-};
 
-extern int davinci_serial_init(struct davinci_uart_config *);
-extern int davinci_serial_setup_clk(unsigned instance, unsigned int *rate);
+extern int davinci_serial_init(struct platform_device *);
+
 extern struct platform_device dm365_serial_device[];
 extern struct platform_device dm355_serial_device[];
 extern struct platform_device dm644x_serial_device[];
arch/arm/mach-davinci/include/mach/tnetv107x.h +0 -1
index 07948a5..c68c7a9 100644
@@ -41,7 +41,6 @@
 #include <mach/serial.h>
 
 struct tnetv107x_device_info {
-	struct davinci_uart_config	*serial_config;
 	struct davinci_mmc_config	*mmc_config[2];  /* 2 controllers */
 	struct davinci_nand_pdata	*nand_config[4]; /* 4 chipsels */
 	struct matrix_keypad_platform_data *keypad_config;
arch/arm/mach-davinci/serial.c +14 -33

68 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#11 lore raw

PATCH v2 5/5 ARM: davinci: serial: platform code cleanup

Quoted 10 lines · Prakash

1) "struct davinci_uart_config" is introduced to specify UART ports brought out or enabled on the board. But none of the boards use them for that purpose, so clean it up.
2) Have pointer to platform device as a argument for davinci_serial_init(), no need of serial_dev in struct soc_info now.
3) No need of davinci_serial_setup_clk(), not called from multiple places, hence reduce function call overhead.

Quoted 2 lines

We generally clean up code before undertaking modifications. Is there a reason why this cannot be done first-up?

Thanks,
Sekhar

#12 lore raw

PATCH v2 5/5 ARM: davinci: serial: platform code cleanup

Quoted 12 lines · Sekhar Nori
Quoted 10 lines · Prakash

1) "struct davinci_uart_config" is introduced to specify UART ports brought out or enabled on the board. But none of the boards use them for that purpose, so clean it up.
2) Have pointer to platform device as a argument for davinci_serial_init(), no need of serial_dev in struct soc_info now.
3) No need of davinci_serial_setup_clk(), not called from multiple places, hence reduce function call overhead.

Quoted 5 lines
Quoted 2 lines

We generally clean up code before undertaking modifications. Is there a reason why this cannot be done first-up?

Never mind this question. I figured it out myself. You need to have the serial clock setup removed from DT before you can do any reasonable clean-up and that happens only with 4/5.

Thanks,
Sekhar