提交 74c33576 编写于 作者: A Andrew Lunn 提交者: Mike Turquette

ARM: Orion: UART: Get the clock rate via clk_get_rate().

Let the machine pass to the platform which clock is used by the uart.
Enable the clock and use clk_get_rate() to determine its rate.
Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
Tested-by: NJamie Lentin <jm@lentin.co.uk>
Signed-off-by: NMike Turquette <mturquette@linaro.org>
上级 4f04be62
...@@ -128,7 +128,7 @@ void __init dove_sata_init(struct mv_sata_platform_data *sata_data) ...@@ -128,7 +128,7 @@ void __init dove_sata_init(struct mv_sata_platform_data *sata_data)
void __init dove_uart0_init(void) void __init dove_uart0_init(void)
{ {
orion_uart0_init(DOVE_UART0_VIRT_BASE, DOVE_UART0_PHYS_BASE, orion_uart0_init(DOVE_UART0_VIRT_BASE, DOVE_UART0_PHYS_BASE,
IRQ_DOVE_UART_0, get_tclk()); IRQ_DOVE_UART_0, tclk);
} }
/***************************************************************************** /*****************************************************************************
...@@ -137,7 +137,7 @@ void __init dove_uart0_init(void) ...@@ -137,7 +137,7 @@ void __init dove_uart0_init(void)
void __init dove_uart1_init(void) void __init dove_uart1_init(void)
{ {
orion_uart1_init(DOVE_UART1_VIRT_BASE, DOVE_UART1_PHYS_BASE, orion_uart1_init(DOVE_UART1_VIRT_BASE, DOVE_UART1_PHYS_BASE,
IRQ_DOVE_UART_1, get_tclk()); IRQ_DOVE_UART_1, tclk);
} }
/***************************************************************************** /*****************************************************************************
...@@ -146,7 +146,7 @@ void __init dove_uart1_init(void) ...@@ -146,7 +146,7 @@ void __init dove_uart1_init(void)
void __init dove_uart2_init(void) void __init dove_uart2_init(void)
{ {
orion_uart2_init(DOVE_UART2_VIRT_BASE, DOVE_UART2_PHYS_BASE, orion_uart2_init(DOVE_UART2_VIRT_BASE, DOVE_UART2_PHYS_BASE,
IRQ_DOVE_UART_2, get_tclk()); IRQ_DOVE_UART_2, tclk);
} }
/***************************************************************************** /*****************************************************************************
...@@ -155,7 +155,7 @@ void __init dove_uart2_init(void) ...@@ -155,7 +155,7 @@ void __init dove_uart2_init(void)
void __init dove_uart3_init(void) void __init dove_uart3_init(void)
{ {
orion_uart3_init(DOVE_UART3_VIRT_BASE, DOVE_UART3_PHYS_BASE, orion_uart3_init(DOVE_UART3_VIRT_BASE, DOVE_UART3_PHYS_BASE,
IRQ_DOVE_UART_3, get_tclk()); IRQ_DOVE_UART_3, tclk);
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -299,7 +299,7 @@ void __init kirkwood_i2c_init(void) ...@@ -299,7 +299,7 @@ void __init kirkwood_i2c_init(void)
void __init kirkwood_uart0_init(void) void __init kirkwood_uart0_init(void)
{ {
orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE, orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
IRQ_KIRKWOOD_UART_0, kirkwood_tclk); IRQ_KIRKWOOD_UART_0, tclk);
} }
...@@ -309,7 +309,7 @@ void __init kirkwood_uart0_init(void) ...@@ -309,7 +309,7 @@ void __init kirkwood_uart0_init(void)
void __init kirkwood_uart1_init(void) void __init kirkwood_uart1_init(void)
{ {
orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE, orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
IRQ_KIRKWOOD_UART_1, kirkwood_tclk); IRQ_KIRKWOOD_UART_1, tclk);
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -299,7 +299,7 @@ void __init mv78xx0_sata_init(struct mv_sata_platform_data *sata_data) ...@@ -299,7 +299,7 @@ void __init mv78xx0_sata_init(struct mv_sata_platform_data *sata_data)
void __init mv78xx0_uart0_init(void) void __init mv78xx0_uart0_init(void)
{ {
orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE, orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
IRQ_MV78XX0_UART_0, get_tclk()); IRQ_MV78XX0_UART_0, tclk);
} }
...@@ -309,7 +309,7 @@ void __init mv78xx0_uart0_init(void) ...@@ -309,7 +309,7 @@ void __init mv78xx0_uart0_init(void)
void __init mv78xx0_uart1_init(void) void __init mv78xx0_uart1_init(void)
{ {
orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE, orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
IRQ_MV78XX0_UART_1, get_tclk()); IRQ_MV78XX0_UART_1, tclk);
} }
...@@ -319,7 +319,7 @@ void __init mv78xx0_uart1_init(void) ...@@ -319,7 +319,7 @@ void __init mv78xx0_uart1_init(void)
void __init mv78xx0_uart2_init(void) void __init mv78xx0_uart2_init(void)
{ {
orion_uart2_init(UART2_VIRT_BASE, UART2_PHYS_BASE, orion_uart2_init(UART2_VIRT_BASE, UART2_PHYS_BASE,
IRQ_MV78XX0_UART_2, get_tclk()); IRQ_MV78XX0_UART_2, tclk);
} }
/***************************************************************************** /*****************************************************************************
...@@ -328,7 +328,7 @@ void __init mv78xx0_uart2_init(void) ...@@ -328,7 +328,7 @@ void __init mv78xx0_uart2_init(void)
void __init mv78xx0_uart3_init(void) void __init mv78xx0_uart3_init(void)
{ {
orion_uart3_init(UART3_VIRT_BASE, UART3_PHYS_BASE, orion_uart3_init(UART3_VIRT_BASE, UART3_PHYS_BASE,
IRQ_MV78XX0_UART_3, get_tclk()); IRQ_MV78XX0_UART_3, tclk);
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -156,7 +156,7 @@ void __init orion5x_spi_init() ...@@ -156,7 +156,7 @@ void __init orion5x_spi_init()
void __init orion5x_uart0_init(void) void __init orion5x_uart0_init(void)
{ {
orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE, orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
IRQ_ORION5X_UART0, orion5x_tclk); IRQ_ORION5X_UART0, tclk);
} }
/***************************************************************************** /*****************************************************************************
...@@ -165,7 +165,7 @@ void __init orion5x_uart0_init(void) ...@@ -165,7 +165,7 @@ void __init orion5x_uart0_init(void)
void __init orion5x_uart1_init(void) void __init orion5x_uart1_init(void)
{ {
orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE, orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
IRQ_ORION5X_UART1, orion5x_tclk); IRQ_ORION5X_UART1, tclk);
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -75,6 +75,12 @@ static void fill_resources(struct platform_device *device, ...@@ -75,6 +75,12 @@ static void fill_resources(struct platform_device *device,
/***************************************************************************** /*****************************************************************************
* UART * UART
****************************************************************************/ ****************************************************************************/
static unsigned long __init uart_get_clk_rate(struct clk *clk)
{
clk_prepare_enable(clk);
return clk_get_rate(clk);
}
static void __init uart_complete( static void __init uart_complete(
struct platform_device *orion_uart, struct platform_device *orion_uart,
struct plat_serial8250_port *data, struct plat_serial8250_port *data,
...@@ -82,12 +88,12 @@ static void __init uart_complete( ...@@ -82,12 +88,12 @@ static void __init uart_complete(
unsigned int membase, unsigned int membase,
resource_size_t mapbase, resource_size_t mapbase,
unsigned int irq, unsigned int irq,
unsigned int uartclk) struct clk *clk)
{ {
data->mapbase = mapbase; data->mapbase = mapbase;
data->membase = (void __iomem *)membase; data->membase = (void __iomem *)membase;
data->irq = irq; data->irq = irq;
data->uartclk = uartclk; data->uartclk = uart_get_clk_rate(clk);
orion_uart->dev.platform_data = data; orion_uart->dev.platform_data = data;
fill_resources(orion_uart, resources, mapbase, 0xff, irq); fill_resources(orion_uart, resources, mapbase, 0xff, irq);
...@@ -116,10 +122,10 @@ static struct platform_device orion_uart0 = { ...@@ -116,10 +122,10 @@ static struct platform_device orion_uart0 = {
void __init orion_uart0_init(unsigned int membase, void __init orion_uart0_init(unsigned int membase,
resource_size_t mapbase, resource_size_t mapbase,
unsigned int irq, unsigned int irq,
unsigned int uartclk) struct clk *clk)
{ {
uart_complete(&orion_uart0, orion_uart0_data, orion_uart0_resources, uart_complete(&orion_uart0, orion_uart0_data, orion_uart0_resources,
membase, mapbase, irq, uartclk); membase, mapbase, irq, clk);
} }
/***************************************************************************** /*****************************************************************************
...@@ -144,10 +150,10 @@ static struct platform_device orion_uart1 = { ...@@ -144,10 +150,10 @@ static struct platform_device orion_uart1 = {
void __init orion_uart1_init(unsigned int membase, void __init orion_uart1_init(unsigned int membase,
resource_size_t mapbase, resource_size_t mapbase,
unsigned int irq, unsigned int irq,
unsigned int uartclk) struct clk *clk)
{ {
uart_complete(&orion_uart1, orion_uart1_data, orion_uart1_resources, uart_complete(&orion_uart1, orion_uart1_data, orion_uart1_resources,
membase, mapbase, irq, uartclk); membase, mapbase, irq, clk);
} }
/***************************************************************************** /*****************************************************************************
...@@ -172,10 +178,10 @@ static struct platform_device orion_uart2 = { ...@@ -172,10 +178,10 @@ static struct platform_device orion_uart2 = {
void __init orion_uart2_init(unsigned int membase, void __init orion_uart2_init(unsigned int membase,
resource_size_t mapbase, resource_size_t mapbase,
unsigned int irq, unsigned int irq,
unsigned int uartclk) struct clk *clk)
{ {
uart_complete(&orion_uart2, orion_uart2_data, orion_uart2_resources, uart_complete(&orion_uart2, orion_uart2_data, orion_uart2_resources,
membase, mapbase, irq, uartclk); membase, mapbase, irq, clk);
} }
/***************************************************************************** /*****************************************************************************
...@@ -200,10 +206,10 @@ static struct platform_device orion_uart3 = { ...@@ -200,10 +206,10 @@ static struct platform_device orion_uart3 = {
void __init orion_uart3_init(unsigned int membase, void __init orion_uart3_init(unsigned int membase,
resource_size_t mapbase, resource_size_t mapbase,
unsigned int irq, unsigned int irq,
unsigned int uartclk) struct clk *clk)
{ {
uart_complete(&orion_uart3, orion_uart3_data, orion_uart3_resources, uart_complete(&orion_uart3, orion_uart3_data, orion_uart3_resources,
membase, mapbase, irq, uartclk); membase, mapbase, irq, clk);
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -16,22 +16,22 @@ struct dsa_platform_data; ...@@ -16,22 +16,22 @@ struct dsa_platform_data;
void __init orion_uart0_init(unsigned int membase, void __init orion_uart0_init(unsigned int membase,
resource_size_t mapbase, resource_size_t mapbase,
unsigned int irq, unsigned int irq,
unsigned int uartclk); struct clk *clk);
void __init orion_uart1_init(unsigned int membase, void __init orion_uart1_init(unsigned int membase,
resource_size_t mapbase, resource_size_t mapbase,
unsigned int irq, unsigned int irq,
unsigned int uartclk); struct clk *clk);
void __init orion_uart2_init(unsigned int membase, void __init orion_uart2_init(unsigned int membase,
resource_size_t mapbase, resource_size_t mapbase,
unsigned int irq, unsigned int irq,
unsigned int uartclk); struct clk *clk);
void __init orion_uart3_init(unsigned int membase, void __init orion_uart3_init(unsigned int membase,
resource_size_t mapbase, resource_size_t mapbase,
unsigned int irq, unsigned int irq,
unsigned int uartclk); struct clk *clk);
void __init orion_rtc_init(unsigned long mapbase, void __init orion_rtc_init(unsigned long mapbase,
unsigned long irq); unsigned long irq);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册