blob: 8762458ca7da1f09d5094f5f0490bd2bb22c3c2b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * i2c-au1550.c: SMBus (i2c) adapter for Alchemy PSC interface
3 * Copyright (C) 2004 Embedded Edge, LLC <dan@embeddededge.com>
4 *
5 * 2.6 port by Matt Porter <mporter@kernel.crashing.org>
6 *
7 * The documentation describes this as an SMBus controller, but it doesn't
8 * understand any of the SMBus protocol in hardware. It's really an I2C
9 * controller that could emulate most of the SMBus in software.
10 *
11 * This is just a skeleton adapter to use with the Au1550 PSC
12 * algorithm. It was developed for the Pb1550, but will work with
13 * any Au1550 board that has a similar PSC configuration.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 */
29
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#include <linux/delay.h>
31#include <linux/kernel.h>
32#include <linux/module.h>
Manuel Lauss8b798c42008-01-27 18:14:52 +010033#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include <linux/errno.h>
35#include <linux/i2c.h>
Manuel Lauss8b798c42008-01-27 18:14:52 +010036#include <linux/slab.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
Manuel Lauss50d56762011-08-12 11:39:43 +020038#include <asm/mach-au1x00/au1000.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070039#include <asm/mach-au1x00/au1xxx_psc.h>
40
Manuel Laussc5de6462011-10-22 13:34:36 +020041#define PSC_SEL 0x00
42#define PSC_CTRL 0x04
43#define PSC_SMBCFG 0x08
44#define PSC_SMBMSK 0x0C
45#define PSC_SMBPCR 0x10
46#define PSC_SMBSTAT 0x14
47#define PSC_SMBEVNT 0x18
48#define PSC_SMBTXRX 0x1C
49#define PSC_SMBTMR 0x20
50
Manuel Lauss8b798c42008-01-27 18:14:52 +010051struct i2c_au1550_data {
Manuel Laussc5de6462011-10-22 13:34:36 +020052 void __iomem *psc_base;
Manuel Lauss8b798c42008-01-27 18:14:52 +010053 int xfer_timeout;
Manuel Lauss8b798c42008-01-27 18:14:52 +010054 struct i2c_adapter adap;
55 struct resource *ioarea;
56};
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
Manuel Laussc5de6462011-10-22 13:34:36 +020058static inline void WR(struct i2c_au1550_data *a, int r, unsigned long v)
Linus Torvalds1da177e2005-04-16 15:20:36 -070059{
Manuel Laussc5de6462011-10-22 13:34:36 +020060 __raw_writel(v, a->psc_base + r);
61 wmb();
62}
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
Manuel Laussc5de6462011-10-22 13:34:36 +020064static inline unsigned long RD(struct i2c_au1550_data *a, int r)
65{
66 return __raw_readl(a->psc_base + r);
67}
Linus Torvalds1da177e2005-04-16 15:20:36 -070068
Manuel Laussc5de6462011-10-22 13:34:36 +020069static int wait_xfer_done(struct i2c_au1550_data *adap)
70{
71 int i;
72
73 /* Wait for Tx Buffer Empty */
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 for (i = 0; i < adap->xfer_timeout; i++) {
Manuel Laussc5de6462011-10-22 13:34:36 +020075 if (RD(adap, PSC_SMBSTAT) & PSC_SMBSTAT_TE)
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 return 0;
Chris Davida2027072007-10-13 23:56:33 +020077
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 udelay(1);
79 }
80
81 return -ETIMEDOUT;
82}
83
Manuel Laussc5de6462011-10-22 13:34:36 +020084static int wait_ack(struct i2c_au1550_data *adap)
Linus Torvalds1da177e2005-04-16 15:20:36 -070085{
Manuel Laussc5de6462011-10-22 13:34:36 +020086 unsigned long stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -070087
88 if (wait_xfer_done(adap))
89 return -ETIMEDOUT;
90
Manuel Laussc5de6462011-10-22 13:34:36 +020091 stat = RD(adap, PSC_SMBEVNT);
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 if ((stat & (PSC_SMBEVNT_DN | PSC_SMBEVNT_AN | PSC_SMBEVNT_AL)) != 0)
93 return -ETIMEDOUT;
94
95 return 0;
96}
97
Manuel Laussc5de6462011-10-22 13:34:36 +020098static int wait_master_done(struct i2c_au1550_data *adap)
Linus Torvalds1da177e2005-04-16 15:20:36 -070099{
Manuel Laussc5de6462011-10-22 13:34:36 +0200100 int i;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101
Manuel Laussc5de6462011-10-22 13:34:36 +0200102 /* Wait for Master Done. */
Manuel Lauss84785f12011-10-22 13:34:38 +0200103 for (i = 0; i < 2 * adap->xfer_timeout; i++) {
Manuel Laussc5de6462011-10-22 13:34:36 +0200104 if ((RD(adap, PSC_SMBEVNT) & PSC_SMBEVNT_MD) != 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 return 0;
106 udelay(1);
107 }
108
109 return -ETIMEDOUT;
110}
111
112static int
Manuel Lauss91f27952008-01-27 18:14:52 +0100113do_address(struct i2c_au1550_data *adap, unsigned int addr, int rd, int q)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114{
Manuel Laussc5de6462011-10-22 13:34:36 +0200115 unsigned long stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116
Manuel Laussc5de6462011-10-22 13:34:36 +0200117 /* Reset the FIFOs, clear events. */
118 stat = RD(adap, PSC_SMBSTAT);
119 WR(adap, PSC_SMBEVNT, PSC_SMBEVNT_ALLCLR);
Domen Puncer88599422006-08-13 23:35:40 +0200120
121 if (!(stat & PSC_SMBSTAT_TE) || !(stat & PSC_SMBSTAT_RE)) {
Manuel Laussc5de6462011-10-22 13:34:36 +0200122 WR(adap, PSC_SMBPCR, PSC_SMBPCR_DC);
123 while ((RD(adap, PSC_SMBPCR) & PSC_SMBPCR_DC) != 0)
124 cpu_relax();
Domen Puncer88599422006-08-13 23:35:40 +0200125 udelay(50);
126 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127
Manuel Laussc5de6462011-10-22 13:34:36 +0200128 /* Write out the i2c chip address and specify operation */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 addr <<= 1;
130 if (rd)
131 addr |= 1;
132
Manuel Lauss91f27952008-01-27 18:14:52 +0100133 /* zero-byte xfers stop immediately */
134 if (q)
135 addr |= PSC_SMBTXRX_STP;
136
Manuel Laussc5de6462011-10-22 13:34:36 +0200137 /* Put byte into fifo, start up master. */
138 WR(adap, PSC_SMBTXRX, addr);
139 WR(adap, PSC_SMBPCR, PSC_SMBPCR_MS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140 if (wait_ack(adap))
141 return -EIO;
Manuel Lauss91f27952008-01-27 18:14:52 +0100142 return (q) ? wait_master_done(adap) : 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143}
144
Manuel Laussc5de6462011-10-22 13:34:36 +0200145static int wait_for_rx_byte(struct i2c_au1550_data *adap, unsigned char *out)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146{
Manuel Laussc5de6462011-10-22 13:34:36 +0200147 int j;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148
149 if (wait_xfer_done(adap))
150 return -EIO;
151
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 j = adap->xfer_timeout * 100;
153 do {
154 j--;
155 if (j <= 0)
156 return -EIO;
157
Manuel Laussc5de6462011-10-22 13:34:36 +0200158 if ((RD(adap, PSC_SMBSTAT) & PSC_SMBSTAT_RE) == 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159 j = 0;
160 else
161 udelay(1);
162 } while (j > 0);
Manuel Laussc5de6462011-10-22 13:34:36 +0200163
164 *out = RD(adap, PSC_SMBTXRX);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165
166 return 0;
167}
168
Manuel Laussc5de6462011-10-22 13:34:36 +0200169static int i2c_read(struct i2c_au1550_data *adap, unsigned char *buf,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 unsigned int len)
171{
Manuel Laussc5de6462011-10-22 13:34:36 +0200172 int i;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173
174 if (len == 0)
175 return 0;
176
177 /* A read is performed by stuffing the transmit fifo with
178 * zero bytes for timing, waiting for bytes to appear in the
179 * receive fifo, then reading the bytes.
180 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 i = 0;
Manuel Laussc5de6462011-10-22 13:34:36 +0200182 while (i < (len - 1)) {
183 WR(adap, PSC_SMBTXRX, 0);
184 if (wait_for_rx_byte(adap, &buf[i]))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185 return -EIO;
186
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187 i++;
188 }
189
Manuel Laussc5de6462011-10-22 13:34:36 +0200190 /* The last byte has to indicate transfer done. */
191 WR(adap, PSC_SMBTXRX, PSC_SMBTXRX_STP);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192 if (wait_master_done(adap))
193 return -EIO;
194
Manuel Laussc5de6462011-10-22 13:34:36 +0200195 buf[i] = (unsigned char)(RD(adap, PSC_SMBTXRX) & 0xff);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196 return 0;
197}
198
Manuel Laussc5de6462011-10-22 13:34:36 +0200199static int i2c_write(struct i2c_au1550_data *adap, unsigned char *buf,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 unsigned int len)
201{
Manuel Laussc5de6462011-10-22 13:34:36 +0200202 int i;
203 unsigned long data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204
205 if (len == 0)
206 return 0;
207
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 i = 0;
209 while (i < (len-1)) {
210 data = buf[i];
Manuel Laussc5de6462011-10-22 13:34:36 +0200211 WR(adap, PSC_SMBTXRX, data);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 if (wait_ack(adap))
213 return -EIO;
214 i++;
215 }
216
Manuel Laussc5de6462011-10-22 13:34:36 +0200217 /* The last byte has to indicate transfer done. */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218 data = buf[i];
219 data |= PSC_SMBTXRX_STP;
Manuel Laussc5de6462011-10-22 13:34:36 +0200220 WR(adap, PSC_SMBTXRX, data);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 if (wait_master_done(adap))
222 return -EIO;
223 return 0;
224}
225
226static int
227au1550_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num)
228{
229 struct i2c_au1550_data *adap = i2c_adap->algo_data;
230 struct i2c_msg *p;
231 int i, err = 0;
232
Manuel Laussc5de6462011-10-22 13:34:36 +0200233 WR(adap, PSC_CTRL, PSC_CTRL_ENABLE);
Manuel Laussf09f71b2008-07-14 22:38:34 +0200234
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235 for (i = 0; !err && i < num; i++) {
236 p = &msgs[i];
Manuel Lauss91f27952008-01-27 18:14:52 +0100237 err = do_address(adap, p->addr, p->flags & I2C_M_RD,
238 (p->len == 0));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 if (err || !p->len)
240 continue;
241 if (p->flags & I2C_M_RD)
242 err = i2c_read(adap, p->buf, p->len);
243 else
244 err = i2c_write(adap, p->buf, p->len);
245 }
246
247 /* Return the number of messages processed, or the error code.
248 */
249 if (err == 0)
250 err = num;
Manuel Laussf09f71b2008-07-14 22:38:34 +0200251
Manuel Laussc5de6462011-10-22 13:34:36 +0200252 WR(adap, PSC_CTRL, PSC_CTRL_SUSPEND);
Manuel Laussf09f71b2008-07-14 22:38:34 +0200253
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254 return err;
255}
256
Manuel Laussc5de6462011-10-22 13:34:36 +0200257static u32 au1550_func(struct i2c_adapter *adap)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258{
Domen Puncer6ed07132006-08-13 23:36:27 +0200259 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260}
261
Jean Delvare8f9082c2006-09-03 22:39:46 +0200262static const struct i2c_algorithm au1550_algo = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263 .master_xfer = au1550_xfer,
264 .functionality = au1550_func,
265};
266
Manuel Laussf09f71b2008-07-14 22:38:34 +0200267static void i2c_au1550_setup(struct i2c_au1550_data *priv)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268{
Manuel Laussc5de6462011-10-22 13:34:36 +0200269 unsigned long cfg;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270
Manuel Laussc5de6462011-10-22 13:34:36 +0200271 WR(priv, PSC_CTRL, PSC_CTRL_DISABLE);
272 WR(priv, PSC_SEL, PSC_SEL_PS_SMBUSMODE);
273 WR(priv, PSC_SMBCFG, 0);
274 WR(priv, PSC_CTRL, PSC_CTRL_ENABLE);
275 while ((RD(priv, PSC_SMBSTAT) & PSC_SMBSTAT_SR) == 0)
276 cpu_relax();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277
Manuel Laussc5de6462011-10-22 13:34:36 +0200278 cfg = PSC_SMBCFG_RT_FIFO8 | PSC_SMBCFG_TT_FIFO8 | PSC_SMBCFG_DD_DISABLE;
279 WR(priv, PSC_SMBCFG, cfg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280
281 /* Divide by 8 to get a 6.25 MHz clock. The later protocol
282 * timings are based on this clock.
283 */
Manuel Laussc5de6462011-10-22 13:34:36 +0200284 cfg |= PSC_SMBCFG_SET_DIV(PSC_SMBCFG_DIV8);
285 WR(priv, PSC_SMBCFG, cfg);
286 WR(priv, PSC_SMBMSK, PSC_SMBMSK_ALLMASK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287
288 /* Set the protocol timer values. See Table 71 in the
289 * Au1550 Data Book for standard timing values.
290 */
Manuel Laussc5de6462011-10-22 13:34:36 +0200291 WR(priv, PSC_SMBTMR, PSC_SMBTMR_SET_TH(0) | PSC_SMBTMR_SET_PS(15) | \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292 PSC_SMBTMR_SET_PU(15) | PSC_SMBTMR_SET_SH(15) | \
293 PSC_SMBTMR_SET_SU(15) | PSC_SMBTMR_SET_CL(15) | \
Manuel Laussc5de6462011-10-22 13:34:36 +0200294 PSC_SMBTMR_SET_CH(15));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295
Manuel Laussc5de6462011-10-22 13:34:36 +0200296 cfg |= PSC_SMBCFG_DE_ENABLE;
297 WR(priv, PSC_SMBCFG, cfg);
298 while ((RD(priv, PSC_SMBSTAT) & PSC_SMBSTAT_SR) == 0)
299 cpu_relax();
Manuel Laussf09f71b2008-07-14 22:38:34 +0200300
Manuel Laussc5de6462011-10-22 13:34:36 +0200301 WR(priv, PSC_CTRL, PSC_CTRL_SUSPEND);
Manuel Laussf09f71b2008-07-14 22:38:34 +0200302}
303
304static void i2c_au1550_disable(struct i2c_au1550_data *priv)
305{
Manuel Laussc5de6462011-10-22 13:34:36 +0200306 WR(priv, PSC_SMBCFG, 0);
307 WR(priv, PSC_CTRL, PSC_CTRL_DISABLE);
Manuel Laussf09f71b2008-07-14 22:38:34 +0200308}
309
310/*
311 * registering functions to load algorithms at runtime
312 * Prior to calling us, the 50MHz clock frequency and routing
313 * must have been set up for the PSC indicated by the adapter.
314 */
Bill Pemberton0b255e92012-11-27 15:59:38 -0500315static int
Manuel Laussf09f71b2008-07-14 22:38:34 +0200316i2c_au1550_probe(struct platform_device *pdev)
317{
318 struct i2c_au1550_data *priv;
319 struct resource *r;
320 int ret;
321
322 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
323 if (!r) {
324 ret = -ENODEV;
325 goto out;
326 }
327
328 priv = kzalloc(sizeof(struct i2c_au1550_data), GFP_KERNEL);
329 if (!priv) {
330 ret = -ENOMEM;
331 goto out;
332 }
333
Linus Walleijc6ffdde2009-06-14 00:20:36 +0200334 priv->ioarea = request_mem_region(r->start, resource_size(r),
Manuel Laussf09f71b2008-07-14 22:38:34 +0200335 pdev->name);
336 if (!priv->ioarea) {
337 ret = -EBUSY;
338 goto out_mem;
339 }
340
Manuel Laussc5de6462011-10-22 13:34:36 +0200341 priv->psc_base = ioremap(r->start, resource_size(r));
342 if (!priv->psc_base) {
343 ret = -EIO;
344 goto out_map;
345 }
Manuel Laussf09f71b2008-07-14 22:38:34 +0200346 priv->xfer_timeout = 200;
Manuel Laussf09f71b2008-07-14 22:38:34 +0200347
Manuel Laussf09f71b2008-07-14 22:38:34 +0200348 priv->adap.nr = pdev->id;
349 priv->adap.algo = &au1550_algo;
350 priv->adap.algo_data = priv;
351 priv->adap.dev.parent = &pdev->dev;
352 strlcpy(priv->adap.name, "Au1xxx PSC I2C", sizeof(priv->adap.name));
353
Manuel Laussc5de6462011-10-22 13:34:36 +0200354 /* Now, set up the PSC for SMBus PIO mode. */
Manuel Laussf09f71b2008-07-14 22:38:34 +0200355 i2c_au1550_setup(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356
Manuel Lauss8b798c42008-01-27 18:14:52 +0100357 ret = i2c_add_numbered_adapter(&priv->adap);
358 if (ret == 0) {
359 platform_set_drvdata(pdev, priv);
360 return 0;
361 }
362
Manuel Laussf09f71b2008-07-14 22:38:34 +0200363 i2c_au1550_disable(priv);
Manuel Laussc5de6462011-10-22 13:34:36 +0200364 iounmap(priv->psc_base);
365out_map:
Manuel Lauss8b798c42008-01-27 18:14:52 +0100366 release_resource(priv->ioarea);
367 kfree(priv->ioarea);
368out_mem:
369 kfree(priv);
370out:
371 return ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372}
373
Bill Pemberton0b255e92012-11-27 15:59:38 -0500374static int i2c_au1550_remove(struct platform_device *pdev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375{
Manuel Lauss8b798c42008-01-27 18:14:52 +0100376 struct i2c_au1550_data *priv = platform_get_drvdata(pdev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377
Manuel Lauss8b798c42008-01-27 18:14:52 +0100378 i2c_del_adapter(&priv->adap);
Manuel Laussf09f71b2008-07-14 22:38:34 +0200379 i2c_au1550_disable(priv);
Manuel Laussc5de6462011-10-22 13:34:36 +0200380 iounmap(priv->psc_base);
Manuel Lauss8b798c42008-01-27 18:14:52 +0100381 release_resource(priv->ioarea);
382 kfree(priv->ioarea);
383 kfree(priv);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384 return 0;
385}
386
Manuel Laussf09f71b2008-07-14 22:38:34 +0200387#ifdef CONFIG_PM
Manuel Lauss46f344e22011-10-22 13:34:39 +0200388static int i2c_au1550_suspend(struct device *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389{
Manuel Lauss46f344e22011-10-22 13:34:39 +0200390 struct i2c_au1550_data *priv = dev_get_drvdata(dev);
Manuel Lauss8b798c42008-01-27 18:14:52 +0100391
Manuel Laussf09f71b2008-07-14 22:38:34 +0200392 i2c_au1550_disable(priv);
393
Linus Torvalds1da177e2005-04-16 15:20:36 -0700394 return 0;
395}
396
Manuel Lauss46f344e22011-10-22 13:34:39 +0200397static int i2c_au1550_resume(struct device *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700398{
Manuel Lauss46f344e22011-10-22 13:34:39 +0200399 struct i2c_au1550_data *priv = dev_get_drvdata(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400
Manuel Laussf09f71b2008-07-14 22:38:34 +0200401 i2c_au1550_setup(priv);
402
Manuel Lauss8b798c42008-01-27 18:14:52 +0100403 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404}
Manuel Lauss46f344e22011-10-22 13:34:39 +0200405
406static const struct dev_pm_ops i2c_au1550_pmops = {
407 .suspend = i2c_au1550_suspend,
408 .resume = i2c_au1550_resume,
409};
410
411#define AU1XPSC_SMBUS_PMOPS (&i2c_au1550_pmops)
412
Manuel Laussf09f71b2008-07-14 22:38:34 +0200413#else
Manuel Lauss46f344e22011-10-22 13:34:39 +0200414#define AU1XPSC_SMBUS_PMOPS NULL
Manuel Laussf09f71b2008-07-14 22:38:34 +0200415#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416
Manuel Lauss8b798c42008-01-27 18:14:52 +0100417static struct platform_driver au1xpsc_smbus_driver = {
418 .driver = {
419 .name = "au1xpsc_smbus",
420 .owner = THIS_MODULE,
Manuel Lauss46f344e22011-10-22 13:34:39 +0200421 .pm = AU1XPSC_SMBUS_PMOPS,
Manuel Lauss8b798c42008-01-27 18:14:52 +0100422 },
423 .probe = i2c_au1550_probe,
Bill Pemberton0b255e92012-11-27 15:59:38 -0500424 .remove = i2c_au1550_remove,
Manuel Lauss8b798c42008-01-27 18:14:52 +0100425};
426
Axel Lina3664b52012-01-12 20:32:04 +0100427module_platform_driver(au1xpsc_smbus_driver);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428
429MODULE_AUTHOR("Dan Malek, Embedded Edge, LLC.");
430MODULE_DESCRIPTION("SMBus adapter Alchemy pb1550");
431MODULE_LICENSE("GPL");
Kay Sieversadd8eda2008-04-22 22:16:49 +0200432MODULE_ALIAS("platform:au1xpsc_smbus");