Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 338436
b: refs/heads/master
c: f4b1f03
h: refs/heads/master
v: v3
  • Loading branch information
Huang Shijie authored and Greg Kroah-Hartman committed Nov 16, 2012
1 parent 8d0b8a7 commit 888c2f2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 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: ed71871bed7198ca4aa6a79b7a93b73ad6408e98
refs/heads/master: f4b1f03b826ba22c9835e9e89a1ca03541313e04
42 changes: 36 additions & 6 deletions trunk/drivers/tty/serial/mxs-auart.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,47 @@

static struct uart_driver auart_driver;

enum mxs_auart_type {
IMX23_AUART,
IMX28_AUART,
};

struct mxs_auart_port {
struct uart_port port;

unsigned int flags;
unsigned int ctrl;
enum mxs_auart_type devtype;

unsigned int irq;

struct clk *clk;
struct device *dev;
};

static struct platform_device_id mxs_auart_devtype[] = {
{ .name = "mxs-auart-imx23", .driver_data = IMX23_AUART },
{ .name = "mxs-auart-imx28", .driver_data = IMX28_AUART },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, mxs_auart_devtype);

static struct of_device_id mxs_auart_dt_ids[] = {
{
.compatible = "fsl,imx28-auart",
.data = &mxs_auart_devtype[IMX28_AUART]
}, {
.compatible = "fsl,imx23-auart",
.data = &mxs_auart_devtype[IMX23_AUART]
}, { /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids);

static inline int is_imx28_auart(struct mxs_auart_port *s)
{
return s->devtype == IMX28_AUART;
}

static void mxs_auart_stop_tx(struct uart_port *u);

#define to_auart_port(u) container_of(u, struct mxs_auart_port, port)
Expand Down Expand Up @@ -706,6 +735,8 @@ static int serial_mxs_probe_dt(struct mxs_auart_port *s,

static int __devinit mxs_auart_probe(struct platform_device *pdev)
{
const struct of_device_id *of_id =
of_match_device(mxs_auart_dt_ids, &pdev->dev);
struct mxs_auart_port *s;
u32 version;
int ret = 0;
Expand All @@ -730,6 +761,11 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev)
goto out_free;
}

if (of_id) {
pdev->id_entry = of_id->data;
s->devtype = pdev->id_entry->driver_data;
}

s->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(s->clk)) {
ret = PTR_ERR(s->clk);
Expand Down Expand Up @@ -805,12 +841,6 @@ static int __devexit mxs_auart_remove(struct platform_device *pdev)
return 0;
}

static struct of_device_id mxs_auart_dt_ids[] = {
{ .compatible = "fsl,imx23-auart", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids);

static struct platform_driver mxs_auart_driver = {
.probe = mxs_auart_probe,
.remove = __devexit_p(mxs_auart_remove),
Expand Down

0 comments on commit 888c2f2

Please sign in to comment.