-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
usb: isp1760: Move core code to isp1760-core.c
Move core device initialization to a central location in order to share it with the device mode implementation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
- Loading branch information
Laurent Pinchart
authored and
Felipe Balbi
committed
Jan 27, 2015
1 parent
e19c99e
commit 4b1a577
Showing
6 changed files
with
114 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Driver for the NXP ISP1760 chip | ||
* | ||
* Copyright 2014 Laurent Pinchart | ||
* Copyright 2007 Sebastian Siewior | ||
* | ||
* Contacts: | ||
* Sebastian Siewior <bigeasy@linutronix.de> | ||
* Laurent Pinchart <laurent.pinchart@ideasonboard.com> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* version 2 as published by the Free Software Foundation. | ||
*/ | ||
|
||
#include <linux/gpio.h> | ||
#include <linux/io.h> | ||
#include <linux/kernel.h> | ||
#include <linux/module.h> | ||
#include <linux/slab.h> | ||
#include <linux/usb.h> | ||
|
||
#include "isp1760-core.h" | ||
#include "isp1760-hcd.h" | ||
|
||
int isp1760_register(struct resource *mem, int irq, unsigned long irqflags, | ||
struct device *dev, unsigned int devflags) | ||
{ | ||
struct isp1760_device *isp; | ||
int ret; | ||
|
||
if (usb_disabled()) | ||
return -ENODEV; | ||
|
||
/* prevent usb-core allocating DMA pages */ | ||
dev->dma_mask = NULL; | ||
|
||
isp = devm_kzalloc(dev, sizeof(*isp), GFP_KERNEL); | ||
if (!isp) | ||
return -ENOMEM; | ||
|
||
isp->regs = devm_ioremap_resource(dev, mem); | ||
if (IS_ERR(isp->regs)) | ||
return PTR_ERR(isp->regs); | ||
|
||
ret = isp1760_hcd_register(&isp->hcd, isp->regs, mem, irq, irqflags, | ||
dev, devflags); | ||
if (ret < 0) | ||
return ret; | ||
|
||
dev_set_drvdata(dev, isp); | ||
|
||
return 0; | ||
} | ||
|
||
void isp1760_unregister(struct device *dev) | ||
{ | ||
struct isp1760_device *isp = dev_get_drvdata(dev); | ||
|
||
isp1760_hcd_unregister(&isp->hcd); | ||
} | ||
|
||
MODULE_DESCRIPTION("Driver for the ISP1760 USB-controller from NXP"); | ||
MODULE_AUTHOR("Sebastian Siewior <bigeasy@linuxtronix.de>"); | ||
MODULE_LICENSE("GPL v2"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Driver for the NXP ISP1760 chip | ||
* | ||
* Copyright 2014 Laurent Pinchart | ||
* Copyright 2007 Sebastian Siewior | ||
* | ||
* Contacts: | ||
* Sebastian Siewior <bigeasy@linutronix.de> | ||
* Laurent Pinchart <laurent.pinchart@ideasonboard.com> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* version 2 as published by the Free Software Foundation. | ||
*/ | ||
|
||
#ifndef _ISP1760_CORE_H_ | ||
#define _ISP1760_CORE_H_ | ||
|
||
#include <linux/ioport.h> | ||
|
||
#include "isp1760-hcd.h" | ||
|
||
struct isp1760_device { | ||
void __iomem *regs; | ||
|
||
struct isp1760_hcd hcd; | ||
}; | ||
|
||
int isp1760_register(struct resource *mem, int irq, unsigned long irqflags, | ||
struct device *dev, unsigned int devflags); | ||
void isp1760_unregister(struct device *dev); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters