i2c/isp1301_omap: Build fixes, whitespace

Build fixes for isp1301_omap driver.  I think an earlier version
of this must have gotten lost somewhere, or maybe it only went
into the Linux-OMAP tree.

Also, some whitespace fixes to bring this more into sync with the
version of this found in the Linux-OMAP tree.  (That version has
updates for the OTG controller on the OMAP 1710 which break that
functionality on OMAP 161x boards like the H2, so merging all of
it is not currently an option.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
This commit is contained in:
David Brownell 2007-08-14 18:37:14 +02:00 committed by Jean Delvare
parent 322454a653
commit 25da383d26

View file

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