|
@@ -18,8 +18,6 @@
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
*/
|
|
|
-#undef DEBUG
|
|
|
-#undef VERBOSE
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
#include <linux/module.h>
|
|
@@ -44,7 +42,7 @@
|
|
|
|
|
|
|
|
|
#define DRIVER_VERSION "24 August 2004"
|
|
|
-#define DRIVER_NAME (isp1301_driver.name)
|
|
|
+#define DRIVER_NAME (isp1301_driver.driver.name)
|
|
|
|
|
|
MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver");
|
|
|
MODULE_LICENSE("GPL");
|
|
@@ -55,6 +53,7 @@ struct isp1301 {
|
|
|
void (*i2c_release)(struct device *dev);
|
|
|
|
|
|
int irq;
|
|
|
+ int irq_type;
|
|
|
|
|
|
u32 last_otg_ctrl;
|
|
|
unsigned working:1;
|
|
@@ -63,7 +62,7 @@ struct isp1301 {
|
|
|
|
|
|
/* use keventd context to change the state for us */
|
|
|
struct work_struct work;
|
|
|
-
|
|
|
+
|
|
|
unsigned long todo;
|
|
|
# define WORK_UPDATE_ISP 0 /* update ISP from OTG */
|
|
|
# define WORK_UPDATE_OTG 1 /* update OTG from ISP */
|
|
@@ -94,7 +93,7 @@ struct isp1301 {
|
|
|
|
|
|
/* board-specific PM hooks */
|
|
|
|
|
|
-#include <asm/arch/gpio.h>
|
|
|
+#include <asm/gpio.h>
|
|
|
#include <asm/arch/mux.h>
|
|
|
#include <asm/mach-types.h>
|
|
|
|
|
@@ -291,7 +290,7 @@ static void power_up(struct isp1301 *isp)
|
|
|
{
|
|
|
// isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN);
|
|
|
isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG);
|
|
|
-
|
|
|
+
|
|
|
/* do this only when cpu is driving transceiver,
|
|
|
* so host won't see a low speed device...
|
|
|
*/
|
|
@@ -799,7 +798,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
|
|
|
/* role is host */
|
|
|
} else {
|
|
|
if (!(otg_ctrl & OTG_ID)) {
|
|
|
- otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
|
|
|
+ otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
|
|
|
OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ;
|
|
|
}
|
|
|
|
|
@@ -1100,9 +1099,9 @@ static u8 isp1301_clear_latch(struct isp1301 *isp)
|
|
|
}
|
|
|
|
|
|
static void
|
|
|
-isp1301_work(void *data)
|
|
|
+isp1301_work(struct work_struct *work)
|
|
|
{
|
|
|
- struct isp1301 *isp = data;
|
|
|
+ struct isp1301 *isp = container_of(work, struct isp1301, work);
|
|
|
int stop;
|
|
|
|
|
|
/* implicit lock: we're the only task using this device */
|
|
@@ -1244,7 +1243,7 @@ static int isp1301_detach_client(struct i2c_client *i2c)
|
|
|
* - DEVICE mode, for when there's a B/Mini-B (device) connector
|
|
|
*
|
|
|
* As a rule, you won't have an isp1301 chip unless it's there to
|
|
|
- * support the OTG mode. Other modes help testing USB controllers
|
|
|
+ * support the OTG mode. Other modes help testing USB controllers
|
|
|
* in isolation from (full) OTG support, or maybe so later board
|
|
|
* revisions can help to support those feature.
|
|
|
*/
|
|
@@ -1260,9 +1259,9 @@ static int isp1301_otg_enable(struct isp1301 *isp)
|
|
|
* a few more interrupts than are strictly needed.
|
|
|
*/
|
|
|
isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
|
|
|
- INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
|
|
|
+ INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
|
|
|
isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
|
|
|
- INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
|
|
|
+ INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
|
|
|
|
|
|
dev_info(&isp->client.dev, "ready for dual-role USB ...\n");
|
|
|
|
|
@@ -1306,9 +1305,9 @@ isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host)
|
|
|
|
|
|
dev_info(&isp->client.dev, "A-Host sessions ok\n");
|
|
|
isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
|
|
|
- INTR_ID_GND);
|
|
|
+ INTR_ID_GND);
|
|
|
isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
|
|
|
- INTR_ID_GND);
|
|
|
+ INTR_ID_GND);
|
|
|
|
|
|
/* If this has a Mini-AB connector, this mode is highly
|
|
|
* nonstandard ... but can be handy for testing, especially with
|
|
@@ -1368,9 +1367,9 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget)
|
|
|
isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0);
|
|
|
|
|
|
isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
|
|
|
- INTR_SESS_VLD);
|
|
|
+ INTR_SESS_VLD);
|
|
|
isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
|
|
|
- INTR_VBUS_VLD);
|
|
|
+ INTR_VBUS_VLD);
|
|
|
dev_info(&isp->client.dev, "B-Peripheral sessions ok\n");
|
|
|
dump_regs(isp, __FUNCTION__);
|
|
|
|
|
@@ -1494,7 +1493,7 @@ static int isp1301_probe(struct i2c_adapter *bus, int address, int kind)
|
|
|
if (!isp)
|
|
|
return 0;
|
|
|
|
|
|
- INIT_WORK(&isp->work, isp1301_work, isp);
|
|
|
+ INIT_WORK(&isp->work, isp1301_work);
|
|
|
init_timer(&isp->timer);
|
|
|
isp->timer.function = isp1301_timer;
|
|
|
isp->timer.data = (unsigned long) isp;
|
|
@@ -1572,13 +1571,14 @@ fail1:
|
|
|
/* IRQ wired at M14 */
|
|
|
omap_cfg_reg(M14_1510_GPIO2);
|
|
|
isp->irq = OMAP_GPIO_IRQ(2);
|
|
|
- omap_request_gpio(2);
|
|
|
- omap_set_gpio_direction(2, 1);
|
|
|
- omap_set_gpio_edge_ctrl(2, OMAP_GPIO_FALLING_EDGE);
|
|
|
+ if (gpio_request(2, "isp1301") == 0)
|
|
|
+ gpio_direction_input(2);
|
|
|
+ isp->irq_type = IRQF_TRIGGER_FALLING;
|
|
|
}
|
|
|
|
|
|
+ isp->irq_type |= IRQF_SAMPLE_RANDOM;
|
|
|
status = request_irq(isp->irq, isp1301_irq,
|
|
|
- IRQF_SAMPLE_RANDOM, DRIVER_NAME, isp);
|
|
|
+ isp->irq_type, DRIVER_NAME, isp);
|
|
|
if (status < 0) {
|
|
|
dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n",
|
|
|
isp->irq, status);
|