diff options
author | Yi Zhang <yizhang@marvell.com> | 2013-01-22 20:52:25 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-25 11:52:23 -0500 |
commit | 9429ccbf386c9fce9d998a96474a0926391208cf (patch) | |
tree | 11d8315f1e2be9019d123e9e88aaaa32580f1cad /drivers/tty/serial/pxa.c | |
parent | e8c5b56fdca7bb3006914f0bf7d09b4d64254172 (diff) |
serial: pxa: fine-tune clk useage
1) add clk_enable/disable in serial_pxa_console_write()
2) add clk_prepare() to follow common clock driver
Signed-off-by: Yi Zhang <yizhang@marvell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/pxa.c')
-rw-r--r-- | drivers/tty/serial/pxa.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index a67f9e156ada..05f504e0c271 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c | |||
@@ -672,7 +672,7 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count) | |||
672 | unsigned long flags; | 672 | unsigned long flags; |
673 | int locked = 1; | 673 | int locked = 1; |
674 | 674 | ||
675 | 675 | clk_enable(up->clk); | |
676 | local_irq_save(flags); | 676 | local_irq_save(flags); |
677 | if (up->port.sysrq) | 677 | if (up->port.sysrq) |
678 | locked = 0; | 678 | locked = 0; |
@@ -699,6 +699,7 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count) | |||
699 | if (locked) | 699 | if (locked) |
700 | spin_unlock(&up->port.lock); | 700 | spin_unlock(&up->port.lock); |
701 | local_irq_restore(flags); | 701 | local_irq_restore(flags); |
702 | clk_disable(up->clk); | ||
702 | 703 | ||
703 | } | 704 | } |
704 | 705 | ||
@@ -896,6 +897,12 @@ static int serial_pxa_probe(struct platform_device *dev) | |||
896 | goto err_free; | 897 | goto err_free; |
897 | } | 898 | } |
898 | 899 | ||
900 | ret = clk_prepare(sport->clk); | ||
901 | if (ret) { | ||
902 | clk_put(sport->clk); | ||
903 | goto err_free; | ||
904 | } | ||
905 | |||
899 | sport->port.type = PORT_PXA; | 906 | sport->port.type = PORT_PXA; |
900 | sport->port.iotype = UPIO_MEM; | 907 | sport->port.iotype = UPIO_MEM; |
901 | sport->port.mapbase = mmres->start; | 908 | sport->port.mapbase = mmres->start; |
@@ -927,6 +934,7 @@ static int serial_pxa_probe(struct platform_device *dev) | |||
927 | return 0; | 934 | return 0; |
928 | 935 | ||
929 | err_clk: | 936 | err_clk: |
937 | clk_unprepare(sport->clk); | ||
930 | clk_put(sport->clk); | 938 | clk_put(sport->clk); |
931 | err_free: | 939 | err_free: |
932 | kfree(sport); | 940 | kfree(sport); |
@@ -940,6 +948,8 @@ static int serial_pxa_remove(struct platform_device *dev) | |||
940 | platform_set_drvdata(dev, NULL); | 948 | platform_set_drvdata(dev, NULL); |
941 | 949 | ||
942 | uart_remove_one_port(&serial_pxa_reg, &sport->port); | 950 | uart_remove_one_port(&serial_pxa_reg, &sport->port); |
951 | |||
952 | clk_unprepare(sport->clk); | ||
943 | clk_put(sport->clk); | 953 | clk_put(sport->clk); |
944 | kfree(sport); | 954 | kfree(sport); |
945 | 955 | ||