blob: 35278a8356b3661659899094fbb011ff44c85c3f [file] [log] [blame]
Laurent Pinchart4b1a5772015-01-21 00:55:57 +02001/*
2 * Driver for the NXP ISP1760 chip
3 *
4 * Copyright 2014 Laurent Pinchart
5 * Copyright 2007 Sebastian Siewior
6 *
7 * Contacts:
8 * Sebastian Siewior <bigeasy@linutronix.de>
9 * Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * version 2 as published by the Free Software Foundation.
14 */
15
16#include <linux/gpio.h>
17#include <linux/io.h>
18#include <linux/kernel.h>
19#include <linux/module.h>
20#include <linux/slab.h>
21#include <linux/usb.h>
22
23#include "isp1760-core.h"
24#include "isp1760-hcd.h"
25
26int isp1760_register(struct resource *mem, int irq, unsigned long irqflags,
27 struct device *dev, unsigned int devflags)
28{
29 struct isp1760_device *isp;
30 int ret;
31
32 if (usb_disabled())
33 return -ENODEV;
34
35 /* prevent usb-core allocating DMA pages */
36 dev->dma_mask = NULL;
37
38 isp = devm_kzalloc(dev, sizeof(*isp), GFP_KERNEL);
39 if (!isp)
40 return -ENOMEM;
41
42 isp->regs = devm_ioremap_resource(dev, mem);
43 if (IS_ERR(isp->regs))
44 return PTR_ERR(isp->regs);
45
Laurent Pinchart667c45c2015-01-21 00:55:58 +020046 ret = isp1760_hcd_register(&isp->hcd, isp->regs, mem, irq,
47 irqflags | IRQF_SHARED, dev, devflags);
Laurent Pinchart4b1a5772015-01-21 00:55:57 +020048 if (ret < 0)
49 return ret;
50
51 dev_set_drvdata(dev, isp);
52
53 return 0;
54}
55
56void isp1760_unregister(struct device *dev)
57{
58 struct isp1760_device *isp = dev_get_drvdata(dev);
59
60 isp1760_hcd_unregister(&isp->hcd);
61}
62
63MODULE_DESCRIPTION("Driver for the ISP1760 USB-controller from NXP");
64MODULE_AUTHOR("Sebastian Siewior <bigeasy@linuxtronix.de>");
65MODULE_LICENSE("GPL v2");