aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/chips/isp1301_omap.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c
index 9fafadb92510..fe04e46991aa 100644
--- a/drivers/i2c/chips/isp1301_omap.c
+++ b/drivers/i2c/chips/isp1301_omap.c
@@ -18,8 +18,6 @@
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21#undef DEBUG
22#undef VERBOSE
23 21
24#include <linux/kernel.h> 22#include <linux/kernel.h>
25#include <linux/module.h> 23#include <linux/module.h>
@@ -44,7 +42,7 @@
44 42
45 43
46#define DRIVER_VERSION "24 August 2004" 44#define DRIVER_VERSION "24 August 2004"
47#define DRIVER_NAME (isp1301_driver.name) 45#define DRIVER_NAME (isp1301_driver.driver.name)
48 46
49MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver"); 47MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver");
50MODULE_LICENSE("GPL"); 48MODULE_LICENSE("GPL");
@@ -55,6 +53,7 @@ struct isp1301 {
55 void (*i2c_release)(struct device *dev); 53 void (*i2c_release)(struct device *dev);
56 54
57 int irq; 55 int irq;
56 int irq_type;
58 57
59 u32 last_otg_ctrl; 58 u32 last_otg_ctrl;
60 unsigned working:1; 59 unsigned working:1;
@@ -63,7 +62,7 @@ struct isp1301 {
63 62
64 /* use keventd context to change the state for us */ 63 /* use keventd context to change the state for us */
65 struct work_struct work; 64 struct work_struct work;
66 65
67 unsigned long todo; 66 unsigned long todo;
68# define WORK_UPDATE_ISP 0 /* update ISP from OTG */ 67# define WORK_UPDATE_ISP 0 /* update ISP from OTG */
69# define WORK_UPDATE_OTG 1 /* update OTG from ISP */ 68# define WORK_UPDATE_OTG 1 /* update OTG from ISP */
@@ -94,7 +93,7 @@ struct isp1301 {
94 93
95/* board-specific PM hooks */ 94/* board-specific PM hooks */
96 95
97#include <asm/arch/gpio.h> 96#include <asm/gpio.h>
98#include <asm/arch/mux.h> 97#include <asm/arch/mux.h>
99#include <asm/mach-types.h> 98#include <asm/mach-types.h>
100 99
@@ -291,7 +290,7 @@ static void power_up(struct isp1301 *isp)
291{ 290{
292 // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); 291 // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN);
293 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG); 292 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG);
294 293
295 /* do this only when cpu is driving transceiver, 294 /* do this only when cpu is driving transceiver,
296 * so host won't see a low speed device... 295 * so host won't see a low speed device...
297 */ 296 */
@@ -799,7 +798,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
799 /* role is host */ 798 /* role is host */
800 } else { 799 } else {
801 if (!(otg_ctrl & OTG_ID)) { 800 if (!(otg_ctrl & OTG_ID)) {
802 otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; 801 otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
803 OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ; 802 OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ;
804 } 803 }
805 804
@@ -1100,9 +1099,9 @@ static u8 isp1301_clear_latch(struct isp1301 *isp)
1100} 1099}
1101 1100
1102static void 1101static void
1103isp1301_work(void *data) 1102isp1301_work(struct work_struct *work)
1104{ 1103{
1105 struct isp1301 *isp = data; 1104 struct isp1301 *isp = container_of(work, struct isp1301, work);
1106 int stop; 1105 int stop;
1107 1106
1108 /* implicit lock: we're the only task using this device */ 1107 /* implicit lock: we're the only task using this device */
@@ -1244,7 +1243,7 @@ static int isp1301_detach_client(struct i2c_client *i2c)
1244 * - DEVICE mode, for when there's a B/Mini-B (device) connector 1243 * - DEVICE mode, for when there's a B/Mini-B (device) connector
1245 * 1244 *
1246 * As a rule, you won't have an isp1301 chip unless it's there to 1245 * As a rule, you won't have an isp1301 chip unless it's there to
1247 * support the OTG mode. Other modes help testing USB controllers 1246 * support the OTG mode. Other modes help testing USB controllers
1248 * in isolation from (full) OTG support, or maybe so later board 1247 * in isolation from (full) OTG support, or maybe so later board
1249 * revisions can help to support those feature. 1248 * revisions can help to support those feature.
1250 */ 1249 */
@@ -1260,9 +1259,9 @@ static int isp1301_otg_enable(struct isp1301 *isp)
1260 * a few more interrupts than are strictly needed. 1259 * a few more interrupts than are strictly needed.
1261 */ 1260 */
1262 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, 1261 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
1263 INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); 1262 INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
1264 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, 1263 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
1265 INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); 1264 INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
1266 1265
1267 dev_info(&isp->client.dev, "ready for dual-role USB ...\n"); 1266 dev_info(&isp->client.dev, "ready for dual-role USB ...\n");
1268 1267
@@ -1306,9 +1305,9 @@ isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host)
1306 1305
1307 dev_info(&isp->client.dev, "A-Host sessions ok\n"); 1306 dev_info(&isp->client.dev, "A-Host sessions ok\n");
1308 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, 1307 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
1309 INTR_ID_GND); 1308 INTR_ID_GND);
1310 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, 1309 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
1311 INTR_ID_GND); 1310 INTR_ID_GND);
1312 1311
1313 /* If this has a Mini-AB connector, this mode is highly 1312 /* If this has a Mini-AB connector, this mode is highly
1314 * nonstandard ... but can be handy for testing, especially with 1313 * nonstandard ... but can be handy for testing, especially with
@@ -1368,9 +1367,9 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget)
1368 isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); 1367 isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0);
1369 1368
1370 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, 1369 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
1371 INTR_SESS_VLD); 1370 INTR_SESS_VLD);
1372 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, 1371 isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
1373 INTR_VBUS_VLD); 1372 INTR_VBUS_VLD);
1374 dev_info(&isp->client.dev, "B-Peripheral sessions ok\n"); 1373 dev_info(&isp->client.dev, "B-Peripheral sessions ok\n");
1375 dump_regs(isp, __FUNCTION__); 1374 dump_regs(isp, __FUNCTION__);
1376 1375
@@ -1494,7 +1493,7 @@ static int isp1301_probe(struct i2c_adapter *bus, int address, int kind)
1494 if (!isp) 1493 if (!isp)
1495 return 0; 1494 return 0;
1496 1495
1497 INIT_WORK(&isp->work, isp1301_work, isp); 1496 INIT_WORK(&isp->work, isp1301_work);
1498 init_timer(&isp->timer); 1497 init_timer(&isp->timer);
1499 isp->timer.function = isp1301_timer; 1498 isp->timer.function = isp1301_timer;
1500 isp->timer.data = (unsigned long) isp; 1499 isp->timer.data = (unsigned long) isp;
@@ -1572,13 +1571,14 @@ fail1:
1572 /* IRQ wired at M14 */ 1571 /* IRQ wired at M14 */
1573 omap_cfg_reg(M14_1510_GPIO2); 1572 omap_cfg_reg(M14_1510_GPIO2);
1574 isp->irq = OMAP_GPIO_IRQ(2); 1573 isp->irq = OMAP_GPIO_IRQ(2);
1575 omap_request_gpio(2); 1574 if (gpio_request(2, "isp1301") == 0)
1576 omap_set_gpio_direction(2, 1); 1575 gpio_direction_input(2);
1577 omap_set_gpio_edge_ctrl(2, OMAP_GPIO_FALLING_EDGE); 1576 isp->irq_type = IRQF_TRIGGER_FALLING;
1578 } 1577 }
1579 1578
1579 isp->irq_type |= IRQF_SAMPLE_RANDOM;
1580 status = request_irq(isp->irq, isp1301_irq, 1580 status = request_irq(isp->irq, isp1301_irq,
1581 IRQF_SAMPLE_RANDOM, DRIVER_NAME, isp); 1581 isp->irq_type, DRIVER_NAME, isp);
1582 if (status < 0) { 1582 if (status < 0) {
1583 dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n", 1583 dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n",
1584 isp->irq, status); 1584 isp->irq, status);