Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354826
b: refs/heads/master
c: 2326669
h: refs/heads/master
v: v3
  • Loading branch information
Josh Cartwright authored and Greg Kroah-Hartman committed Jan 21, 2013
1 parent 2429e94 commit abac44e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1f9db0921f212ad8fdf4bacfdf23590e64272f90
refs/heads/master: 2326669ccbd901dffeefb66ed742c294b2e8041b
4 changes: 2 additions & 2 deletions trunk/arch/arm/boot/dts/zynq-7000.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
compatible = "xlnx,xuartps";
reg = <0xE0000000 0x1000>;
interrupts = <0 27 4>;
clock = <50000000>;
clocks = <&uart_clk 0>;
};

uart1: uart@e0001000 {
compatible = "xlnx,xuartps";
reg = <0xE0001000 0x1000>;
interrupts = <0 50 4>;
clock = <50000000>;
clocks = <&uart_clk 1>;
};

slcr: slcr@f8000000 {
Expand Down
34 changes: 19 additions & 15 deletions trunk/drivers/tty/serial/xilinx_uartps.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/console.h>
#include <linux/clk.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <linux/of.h>
Expand Down Expand Up @@ -936,16 +937,18 @@ static int xuartps_probe(struct platform_device *pdev)
int rc;
struct uart_port *port;
struct resource *res, *res2;
int clk = 0;
struct clk *clk;

const unsigned int *prop;

prop = of_get_property(pdev->dev.of_node, "clock", NULL);
if (prop)
clk = be32_to_cpup(prop);
if (!clk) {
clk = of_clk_get(pdev->dev.of_node, 0);
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "no clock specified\n");
return -ENODEV;
return PTR_ERR(clk);
}

rc = clk_prepare_enable(clk);
if (rc) {
dev_err(&pdev->dev, "could not enable clock\n");
return -EBUSY;
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Expand All @@ -970,7 +973,8 @@ static int xuartps_probe(struct platform_device *pdev)
port->mapbase = res->start;
port->irq = res2->start;
port->dev = &pdev->dev;
port->uartclk = clk;
port->uartclk = clk_get_rate(clk);
port->private_data = clk;
dev_set_drvdata(&pdev->dev, port);
rc = uart_add_one_port(&xuartps_uart_driver, port);
if (rc) {
Expand All @@ -992,14 +996,14 @@ static int xuartps_probe(struct platform_device *pdev)
static int xuartps_remove(struct platform_device *pdev)
{
struct uart_port *port = dev_get_drvdata(&pdev->dev);
int rc = 0;
struct clk *clk = port->private_data;
int rc;

/* Remove the xuartps port from the serial core */
if (port) {
rc = uart_remove_one_port(&xuartps_uart_driver, port);
dev_set_drvdata(&pdev->dev, NULL);
port->mapbase = 0;
}
rc = uart_remove_one_port(&xuartps_uart_driver, port);
dev_set_drvdata(&pdev->dev, NULL);
port->mapbase = 0;
clk_disable_unprepare(clk);
return rc;
}

Expand Down

0 comments on commit abac44e

Please sign in to comment.