blob: 035e235e31186ecc629ce4903f771fe40799f1b1 [file] [log] [blame]
Wolfram Sangafa17a52009-11-13 06:14:52 +00001/*
2 * CAN bus driver for the Freescale MPC5xxx embedded CPU.
3 *
4 * Copyright (C) 2004-2005 Andrey Volkov <avolkov@varma-el.com>,
5 * Varma Electronics Oy
6 * Copyright (C) 2008-2009 Wolfgang Grandegger <wg@grandegger.com>
7 * Copyright (C) 2009 Wolfram Sang, Pengutronix <w.sang@pengutronix.de>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the version 2 of the GNU General Public License
11 * as published by the Free Software Foundation
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
Jeff Kirsher05780d92013-12-06 06:28:45 -080019 * along with this program; if not, see <http://www.gnu.org/licenses/>.
Wolfram Sangafa17a52009-11-13 06:14:52 +000020 */
21
22#include <linux/kernel.h>
23#include <linux/module.h>
24#include <linux/interrupt.h>
25#include <linux/platform_device.h>
26#include <linux/netdevice.h>
Wolfram Sangafa17a52009-11-13 06:14:52 +000027#include <linux/can/dev.h>
28#include <linux/of_platform.h>
29#include <sysdev/fsl_soc.h>
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +000030#include <linux/clk.h>
Wolfram Sangafa17a52009-11-13 06:14:52 +000031#include <linux/io.h>
32#include <asm/mpc52xx.h>
33
34#include "mscan.h"
35
Wolfram Sangafa17a52009-11-13 06:14:52 +000036#define DRV_NAME "mpc5xxx_can"
37
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +000038struct mpc5xxx_can_data {
39 unsigned int type;
Grant Likely2dc11582010-08-06 09:25:50 -060040 u32 (*get_clock)(struct platform_device *ofdev, const char *clock_name,
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +000041 int *mscan_clksrc);
Gerhard Sittig11491082013-08-23 13:09:03 +020042 void (*put_clock)(struct platform_device *ofdev);
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +000043};
44
Wolfgang Grandeggerc5bab5e2010-01-14 01:05:48 +000045#ifdef CONFIG_PPC_MPC52xx
Bill Pemberton3c8ac0f2012-12-03 09:22:44 -050046static struct of_device_id mpc52xx_cdm_ids[] = {
Wolfram Sangafa17a52009-11-13 06:14:52 +000047 { .compatible = "fsl,mpc5200-cdm", },
Wolfram Sangafa17a52009-11-13 06:14:52 +000048 {}
49};
50
Bill Pemberton3c8ac0f2012-12-03 09:22:44 -050051static u32 mpc52xx_can_get_clock(struct platform_device *ofdev,
Greg Kroah-Hartman1dd06ae2012-12-06 14:30:56 +000052 const char *clock_name, int *mscan_clksrc)
Wolfram Sangafa17a52009-11-13 06:14:52 +000053{
Wolfram Sang3f158c22009-11-16 12:57:50 +000054 unsigned int pvr;
Wolfram Sangafa17a52009-11-13 06:14:52 +000055 struct mpc52xx_cdm __iomem *cdm;
56 struct device_node *np_cdm;
57 unsigned int freq;
58 u32 val;
59
Wolfram Sang3f158c22009-11-16 12:57:50 +000060 pvr = mfspr(SPRN_PVR);
61
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +000062 /*
63 * Either the oscillator clock (SYS_XTAL_IN) or the IP bus clock
64 * (IP_CLK) can be selected as MSCAN clock source. According to
65 * the MPC5200 user's manual, the oscillator clock is the better
66 * choice as it has less jitter. For this reason, it is selected
67 * by default. Unfortunately, it can not be selected for the old
68 * MPC5200 Rev. A chips due to a hardware bug (check errata).
69 */
70 if (clock_name && strcmp(clock_name, "ip") == 0)
71 *mscan_clksrc = MSCAN_CLKSRC_BUS;
72 else
73 *mscan_clksrc = MSCAN_CLKSRC_XTAL;
74
Anatolij Gustschin6bd17eb2010-05-31 08:56:03 +000075 freq = mpc5xxx_get_bus_frequency(ofdev->dev.of_node);
Wolfram Sangafa17a52009-11-13 06:14:52 +000076 if (!freq)
77 return 0;
78
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +000079 if (*mscan_clksrc == MSCAN_CLKSRC_BUS || pvr == 0x80822011)
Wolfram Sang3f158c22009-11-16 12:57:50 +000080 return freq;
81
82 /* Determine SYS_XTAL_IN frequency from the clock domain settings */
Wolfram Sangafa17a52009-11-13 06:14:52 +000083 np_cdm = of_find_matching_node(NULL, mpc52xx_cdm_ids);
84 if (!np_cdm) {
Wolfgang Grandeggerc5bab5e2010-01-14 01:05:48 +000085 dev_err(&ofdev->dev, "can't get clock node!\n");
Wolfram Sangafa17a52009-11-13 06:14:52 +000086 return 0;
87 }
88 cdm = of_iomap(np_cdm, 0);
Wolfram Sangafa17a52009-11-13 06:14:52 +000089
90 if (in_8(&cdm->ipb_clk_sel) & 0x1)
91 freq *= 2;
Wolfram Sang0285e7c2009-11-16 12:57:45 +000092 val = in_be32(&cdm->rstcfg);
93
94 freq *= (val & (1 << 5)) ? 8 : 4;
95 freq /= (val & (1 << 6)) ? 12 : 16;
Wolfram Sangafa17a52009-11-13 06:14:52 +000096
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +000097 of_node_put(np_cdm);
Wolfram Sangafa17a52009-11-13 06:14:52 +000098 iounmap(cdm);
99
100 return freq;
101}
Wolfgang Grandeggerc5bab5e2010-01-14 01:05:48 +0000102#else /* !CONFIG_PPC_MPC52xx */
Bill Pemberton3c8ac0f2012-12-03 09:22:44 -0500103static u32 mpc52xx_can_get_clock(struct platform_device *ofdev,
Greg Kroah-Hartman1dd06ae2012-12-06 14:30:56 +0000104 const char *clock_name, int *mscan_clksrc)
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000105{
106 return 0;
107}
Wolfgang Grandeggerc5bab5e2010-01-14 01:05:48 +0000108#endif /* CONFIG_PPC_MPC52xx */
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000109
110#ifdef CONFIG_PPC_MPC512x
111struct mpc512x_clockctl {
112 u32 spmr; /* System PLL Mode Reg */
113 u32 sccr[2]; /* System Clk Ctrl Reg 1 & 2 */
114 u32 scfr1; /* System Clk Freq Reg 1 */
115 u32 scfr2; /* System Clk Freq Reg 2 */
116 u32 reserved;
117 u32 bcr; /* Bread Crumb Reg */
118 u32 pccr[12]; /* PSC Clk Ctrl Reg 0-11 */
119 u32 spccr; /* SPDIF Clk Ctrl Reg */
120 u32 cccr; /* CFM Clk Ctrl Reg */
121 u32 dccr; /* DIU Clk Cnfg Reg */
122 u32 mccr[4]; /* MSCAN Clk Ctrl Reg 1-3 */
123};
124
Bill Pemberton3c8ac0f2012-12-03 09:22:44 -0500125static struct of_device_id mpc512x_clock_ids[] = {
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000126 { .compatible = "fsl,mpc5121-clock", },
127 {}
128};
129
Bill Pemberton3c8ac0f2012-12-03 09:22:44 -0500130static u32 mpc512x_can_get_clock(struct platform_device *ofdev,
Greg Kroah-Hartman1dd06ae2012-12-06 14:30:56 +0000131 const char *clock_name, int *mscan_clksrc)
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000132{
133 struct mpc512x_clockctl __iomem *clockctl;
134 struct device_node *np_clock;
135 struct clk *sys_clk, *ref_clk;
136 int plen, clockidx, clocksrc = -1;
137 u32 sys_freq, val, clockdiv = 1, freq = 0;
138 const u32 *pval;
139
140 np_clock = of_find_matching_node(NULL, mpc512x_clock_ids);
141 if (!np_clock) {
142 dev_err(&ofdev->dev, "couldn't find clock node\n");
Julia Lawallaed50292010-08-31 07:44:00 +0000143 return 0;
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000144 }
145 clockctl = of_iomap(np_clock, 0);
146 if (!clockctl) {
147 dev_err(&ofdev->dev, "couldn't map clock registers\n");
Julia Lawallaed50292010-08-31 07:44:00 +0000148 goto exit_put;
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000149 }
150
Gerhard Sittig3a09b122013-08-23 13:09:02 +0200151 /* Determine the MSCAN device index from the peripheral's
152 * physical address. Register address offsets against the
153 * IMMR base are: 0x1300, 0x1380, 0x2300, 0x2380
154 */
Anatolij Gustschin6bd17eb2010-05-31 08:56:03 +0000155 pval = of_get_property(ofdev->dev.of_node, "reg", &plen);
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000156 BUG_ON(!pval || plen < sizeof(*pval));
157 clockidx = (*pval & 0x80) ? 1 : 0;
158 if (*pval & 0x2000)
159 clockidx += 2;
160
161 /*
162 * Clock source and divider selection: 3 different clock sources
163 * can be selected: "ip", "ref" or "sys". For the latter two, a
164 * clock divider can be defined as well. If the clock source is
165 * not specified by the device tree, we first try to find an
166 * optimal CAN source clock based on the system clock. If that
167 * is not posslible, the reference clock will be used.
168 */
169 if (clock_name && !strcmp(clock_name, "ip")) {
170 *mscan_clksrc = MSCAN_CLKSRC_IPS;
Anatolij Gustschin6bd17eb2010-05-31 08:56:03 +0000171 freq = mpc5xxx_get_bus_frequency(ofdev->dev.of_node);
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000172 } else {
173 *mscan_clksrc = MSCAN_CLKSRC_BUS;
174
Anatolij Gustschin6bd17eb2010-05-31 08:56:03 +0000175 pval = of_get_property(ofdev->dev.of_node,
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000176 "fsl,mscan-clock-divider", &plen);
177 if (pval && plen == sizeof(*pval))
178 clockdiv = *pval;
179 if (!clockdiv)
180 clockdiv = 1;
181
182 if (!clock_name || !strcmp(clock_name, "sys")) {
Gerhard Sittig11491082013-08-23 13:09:03 +0200183 sys_clk = devm_clk_get(&ofdev->dev, "sys_clk");
Wei Yongjunf61bd052012-09-21 15:09:47 +0800184 if (IS_ERR(sys_clk)) {
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000185 dev_err(&ofdev->dev, "couldn't get sys_clk\n");
186 goto exit_unmap;
187 }
188 /* Get and round up/down sys clock rate */
189 sys_freq = 1000000 *
190 ((clk_get_rate(sys_clk) + 499999) / 1000000);
191
192 if (!clock_name) {
193 /* A multiple of 16 MHz would be optimal */
194 if ((sys_freq % 16000000) == 0) {
195 clocksrc = 0;
196 clockdiv = sys_freq / 16000000;
197 freq = sys_freq / clockdiv;
198 }
199 } else {
200 clocksrc = 0;
201 freq = sys_freq / clockdiv;
202 }
203 }
204
205 if (clocksrc < 0) {
Gerhard Sittig11491082013-08-23 13:09:03 +0200206 ref_clk = devm_clk_get(&ofdev->dev, "ref_clk");
Wei Yongjunf61bd052012-09-21 15:09:47 +0800207 if (IS_ERR(ref_clk)) {
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000208 dev_err(&ofdev->dev, "couldn't get ref_clk\n");
209 goto exit_unmap;
210 }
211 clocksrc = 1;
212 freq = clk_get_rate(ref_clk) / clockdiv;
213 }
214 }
215
216 /* Disable clock */
217 out_be32(&clockctl->mccr[clockidx], 0x0);
218 if (clocksrc >= 0) {
219 /* Set source and divider */
220 val = (clocksrc << 14) | ((clockdiv - 1) << 17);
221 out_be32(&clockctl->mccr[clockidx], val);
222 /* Enable clock */
223 out_be32(&clockctl->mccr[clockidx], val | 0x10000);
224 }
225
226 /* Enable MSCAN clock domain */
227 val = in_be32(&clockctl->sccr[1]);
228 if (!(val & (1 << 25)))
229 out_be32(&clockctl->sccr[1], val | (1 << 25));
230
231 dev_dbg(&ofdev->dev, "using '%s' with frequency divider %d\n",
232 *mscan_clksrc == MSCAN_CLKSRC_IPS ? "ips_clk" :
233 clocksrc == 1 ? "ref_clk" : "sys_clk", clockdiv);
234
235exit_unmap:
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000236 iounmap(clockctl);
Julia Lawallaed50292010-08-31 07:44:00 +0000237exit_put:
238 of_node_put(np_clock);
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000239 return freq;
240}
241#else /* !CONFIG_PPC_MPC512x */
Bill Pemberton3c8ac0f2012-12-03 09:22:44 -0500242static u32 mpc512x_can_get_clock(struct platform_device *ofdev,
Greg Kroah-Hartman1dd06ae2012-12-06 14:30:56 +0000243 const char *clock_name, int *mscan_clksrc)
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000244{
245 return 0;
246}
247#endif /* CONFIG_PPC_MPC512x */
Wolfram Sangafa17a52009-11-13 06:14:52 +0000248
Marc Kleine-Budde8cf437a2012-10-04 16:22:13 +0200249static const struct of_device_id mpc5xxx_can_table[];
Bill Pemberton3c8ac0f2012-12-03 09:22:44 -0500250static int mpc5xxx_can_probe(struct platform_device *ofdev)
Wolfram Sangafa17a52009-11-13 06:14:52 +0000251{
Grant Likelyb1608d62011-05-18 11:19:24 -0600252 const struct of_device_id *match;
Marc Kleine-Budde0e84eb02012-07-13 14:54:59 +0200253 const struct mpc5xxx_can_data *data;
Anatolij Gustschin6bd17eb2010-05-31 08:56:03 +0000254 struct device_node *np = ofdev->dev.of_node;
Wolfram Sangafa17a52009-11-13 06:14:52 +0000255 struct net_device *dev;
256 struct mscan_priv *priv;
257 void __iomem *base;
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000258 const char *clock_name = NULL;
259 int irq, mscan_clksrc = 0;
260 int err = -ENOMEM;
Wolfram Sangafa17a52009-11-13 06:14:52 +0000261
Grant Likelyb1608d62011-05-18 11:19:24 -0600262 match = of_match_device(mpc5xxx_can_table, &ofdev->dev);
263 if (!match)
Grant Likely74888762011-02-22 21:05:51 -0700264 return -EINVAL;
Grant Likelyb1608d62011-05-18 11:19:24 -0600265 data = match->data;
Grant Likely74888762011-02-22 21:05:51 -0700266
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000267 base = of_iomap(np, 0);
Wolfram Sangafa17a52009-11-13 06:14:52 +0000268 if (!base) {
269 dev_err(&ofdev->dev, "couldn't ioremap\n");
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000270 return err;
Wolfram Sangafa17a52009-11-13 06:14:52 +0000271 }
272
273 irq = irq_of_parse_and_map(np, 0);
274 if (!irq) {
275 dev_err(&ofdev->dev, "no irq found\n");
276 err = -ENODEV;
277 goto exit_unmap_mem;
278 }
279
280 dev = alloc_mscandev();
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000281 if (!dev)
Wolfram Sangafa17a52009-11-13 06:14:52 +0000282 goto exit_dispose_irq;
Gerhard Sittig11491082013-08-23 13:09:03 +0200283 platform_set_drvdata(ofdev, dev);
284 SET_NETDEV_DEV(dev, &ofdev->dev);
Wolfram Sangafa17a52009-11-13 06:14:52 +0000285
286 priv = netdev_priv(dev);
287 priv->reg_base = base;
288 dev->irq = irq;
289
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000290 clock_name = of_get_property(np, "fsl,mscan-clock-source", NULL);
291
292 BUG_ON(!data);
293 priv->type = data->type;
294 priv->can.clock.freq = data->get_clock(ofdev, clock_name,
295 &mscan_clksrc);
Wolfram Sangafa17a52009-11-13 06:14:52 +0000296 if (!priv->can.clock.freq) {
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000297 dev_err(&ofdev->dev, "couldn't get MSCAN clock properties\n");
Wolfram Sangafa17a52009-11-13 06:14:52 +0000298 goto exit_free_mscan;
299 }
300
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000301 err = register_mscandev(dev, mscan_clksrc);
Wolfram Sangafa17a52009-11-13 06:14:52 +0000302 if (err) {
303 dev_err(&ofdev->dev, "registering %s failed (err=%d)\n",
304 DRV_NAME, err);
305 goto exit_free_mscan;
306 }
307
Wolfram Sangafa17a52009-11-13 06:14:52 +0000308 dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n",
309 priv->reg_base, dev->irq, priv->can.clock.freq);
310
311 return 0;
312
313exit_free_mscan:
314 free_candev(dev);
315exit_dispose_irq:
316 irq_dispose_mapping(irq);
317exit_unmap_mem:
318 iounmap(base);
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000319
Wolfram Sangafa17a52009-11-13 06:14:52 +0000320 return err;
321}
322
Bill Pemberton3c8ac0f2012-12-03 09:22:44 -0500323static int mpc5xxx_can_remove(struct platform_device *ofdev)
Wolfram Sangafa17a52009-11-13 06:14:52 +0000324{
Gerhard Sittig11491082013-08-23 13:09:03 +0200325 const struct of_device_id *match;
326 const struct mpc5xxx_can_data *data;
Jingoo Han00e4bbc2013-05-23 19:47:58 +0900327 struct net_device *dev = platform_get_drvdata(ofdev);
Wolfram Sangafa17a52009-11-13 06:14:52 +0000328 struct mscan_priv *priv = netdev_priv(dev);
329
Gerhard Sittig11491082013-08-23 13:09:03 +0200330 match = of_match_device(mpc5xxx_can_table, &ofdev->dev);
331 data = match ? match->data : NULL;
332
Wolfram Sangafa17a52009-11-13 06:14:52 +0000333 unregister_mscandev(dev);
Gerhard Sittig11491082013-08-23 13:09:03 +0200334 if (data && data->put_clock)
335 data->put_clock(ofdev);
Wolfram Sangafa17a52009-11-13 06:14:52 +0000336 iounmap(priv->reg_base);
337 irq_dispose_mapping(dev->irq);
338 free_candev(dev);
339
340 return 0;
341}
342
343#ifdef CONFIG_PM
344static struct mscan_regs saved_regs;
Grant Likely2dc11582010-08-06 09:25:50 -0600345static int mpc5xxx_can_suspend(struct platform_device *ofdev, pm_message_t state)
Wolfram Sangafa17a52009-11-13 06:14:52 +0000346{
Jingoo Han00e4bbc2013-05-23 19:47:58 +0900347 struct net_device *dev = platform_get_drvdata(ofdev);
Wolfram Sangafa17a52009-11-13 06:14:52 +0000348 struct mscan_priv *priv = netdev_priv(dev);
349 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
350
351 _memcpy_fromio(&saved_regs, regs, sizeof(*regs));
352
353 return 0;
354}
355
Grant Likely2dc11582010-08-06 09:25:50 -0600356static int mpc5xxx_can_resume(struct platform_device *ofdev)
Wolfram Sangafa17a52009-11-13 06:14:52 +0000357{
Jingoo Han00e4bbc2013-05-23 19:47:58 +0900358 struct net_device *dev = platform_get_drvdata(ofdev);
Wolfram Sangafa17a52009-11-13 06:14:52 +0000359 struct mscan_priv *priv = netdev_priv(dev);
360 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
361
362 regs->canctl0 |= MSCAN_INITRQ;
Wolfram Sang0285e7c2009-11-16 12:57:45 +0000363 while (!(regs->canctl1 & MSCAN_INITAK))
Wolfram Sangafa17a52009-11-13 06:14:52 +0000364 udelay(10);
365
366 regs->canctl1 = saved_regs.canctl1;
367 regs->canbtr0 = saved_regs.canbtr0;
368 regs->canbtr1 = saved_regs.canbtr1;
369 regs->canidac = saved_regs.canidac;
370
371 /* restore masks, buffers etc. */
372 _memcpy_toio(&regs->canidar1_0, (void *)&saved_regs.canidar1_0,
373 sizeof(*regs) - offsetof(struct mscan_regs, canidar1_0));
374
375 regs->canctl0 &= ~MSCAN_INITRQ;
376 regs->cantbsel = saved_regs.cantbsel;
377 regs->canrier = saved_regs.canrier;
378 regs->cantier = saved_regs.cantier;
379 regs->canctl0 = saved_regs.canctl0;
380
381 return 0;
382}
383#endif
384
Bill Pemberton3c8ac0f2012-12-03 09:22:44 -0500385static const struct mpc5xxx_can_data mpc5200_can_data = {
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000386 .type = MSCAN_TYPE_MPC5200,
387 .get_clock = mpc52xx_can_get_clock,
388};
389
Bill Pemberton3c8ac0f2012-12-03 09:22:44 -0500390static const struct mpc5xxx_can_data mpc5121_can_data = {
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000391 .type = MSCAN_TYPE_MPC5121,
392 .get_clock = mpc512x_can_get_clock,
393};
394
Bill Pemberton3c8ac0f2012-12-03 09:22:44 -0500395static const struct of_device_id mpc5xxx_can_table[] = {
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000396 { .compatible = "fsl,mpc5200-mscan", .data = &mpc5200_can_data, },
397 /* Note that only MPC5121 Rev. 2 (and later) is supported */
398 { .compatible = "fsl,mpc5121-mscan", .data = &mpc5121_can_data, },
Wolfram Sangafa17a52009-11-13 06:14:52 +0000399 {},
400};
Marc Kleine-Buddefc8f40b2012-10-12 10:19:27 +0200401MODULE_DEVICE_TABLE(of, mpc5xxx_can_table);
Wolfram Sangafa17a52009-11-13 06:14:52 +0000402
Grant Likely74888762011-02-22 21:05:51 -0700403static struct platform_driver mpc5xxx_can_driver = {
Grant Likely40182942010-04-13 16:13:02 -0700404 .driver = {
405 .name = "mpc5xxx_can",
406 .owner = THIS_MODULE,
407 .of_match_table = mpc5xxx_can_table,
408 },
Wolfram Sangafa17a52009-11-13 06:14:52 +0000409 .probe = mpc5xxx_can_probe,
Bill Pemberton3c8ac0f2012-12-03 09:22:44 -0500410 .remove = mpc5xxx_can_remove,
Wolfram Sangafa17a52009-11-13 06:14:52 +0000411#ifdef CONFIG_PM
412 .suspend = mpc5xxx_can_suspend,
413 .resume = mpc5xxx_can_resume,
414#endif
Wolfram Sangafa17a52009-11-13 06:14:52 +0000415};
416
Axel Lin871d3372011-11-27 15:42:31 +0000417module_platform_driver(mpc5xxx_can_driver);
Wolfram Sangafa17a52009-11-13 06:14:52 +0000418
419MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>");
Wolfgang Grandeggerbf3af542010-01-07 09:43:07 +0000420MODULE_DESCRIPTION("Freescale MPC5xxx CAN driver");
Wolfram Sangafa17a52009-11-13 06:14:52 +0000421MODULE_LICENSE("GPL v2");