예제 #1
0
파일: tahvo-usb.c 프로젝트: mozyg/kernel
static void tahvo_usb_power_off(struct tahvo_usb *tu)
{
	u32 l;
	int id;

	/* Disable gadget controller if any */
	if (tu->otg.gadget)
		usb_gadget_vbus_disconnect(tu->otg.gadget);

	host_suspend(tu);

	/* Disable OTG and interrupts */
	if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
		id = OTG_ID;
	else
		id = 0;
	l = OTG_CTRL_REG;
	l &= ~(OTG_CTRL_XCVR_MASK | OTG_CTRL_SYS_MASK | OTG_BSESSVLD);
	l |= id | OTG_BSESSEND;
	OTG_CTRL_REG = l;
	OTG_IRQ_EN_REG = 0;

	OTG_SYSCON_2_REG &= ~OTG_EN;

	OTG_SYSCON_1_REG |= OTG_IDLE_EN;

	/* Power off transceiver */
	tahvo_write_reg(TAHVO_REG_USBR, 0);
	tu->otg.state = OTG_STATE_UNDEFINED;
}
예제 #2
0
파일: tahvo-usb.c 프로젝트: tmlind/linux
static void tahvo_usb_power_off(struct tahvo_usb *tu)
{
	u32 l;
	int id;

	/* Disable gadget controller if any */
	if (tu->otg.gadget)
		usb_gadget_vbus_disconnect(tu->otg.gadget);

	/* Disable OTG and interrupts */
	if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
		id = OTG_ID;
	else
		id = 0;
	l = omap_readl(OTG_CTRL);
	l &= ~(OTG_CTRL_XCVR_MASK | OTG_CTRL_SYS_MASK | OTG_BSESSVLD);
	l |= id | OTG_BSESSEND;
	omap_writel(l, OTG_CTRL);
	omap_writew(0, OTG_IRQ_EN);

	l = omap_readl(OTG_SYSCON_2);
	l &= ~OTG_EN;
	omap_writel(l, OTG_SYSCON_2);

	l = omap_readl(OTG_SYSCON_1);
	l |= OTG_IDLE_EN;
	omap_writel(l, OTG_SYSCON_1);

	/* Power off transceiver */
	tahvo_write_reg(tu->dev, TAHVO_REG_USBR, 0);
	tu->otg.state = OTG_STATE_UNDEFINED;
}
예제 #3
0
파일: tahvo-usb.c 프로젝트: mozyg/kernel
static void tahvo_usb_become_peripheral(struct tahvo_usb *tu)
{
	/* Clear system and transceiver controlled bits
	 * and enable ID to mark peripheral mode and
	 * BSESSEND to mark no Vbus */
	omap_otg_init();
	OTG_CTRL_REG = (OTG_CTRL_REG & ~(OTG_CTRL_XCVR_MASK|OTG_CTRL_SYS_MASK|OTG_BSESSVLD))
		| OTG_ID | OTG_BSESSEND;

	/* Power up transceiver and set it in USB perhiperal mode */
	tahvo_write_reg(TAHVO_REG_USBR, USBR_SLAVE_CONTROL | USBR_REGOUT | USBR_NSUSPEND | USBR_SLAVE_SW);
	tu->otg.state = OTG_STATE_B_IDLE;

	check_vbus_state(tu);
}
예제 #4
0
파일: tahvo-usb.c 프로젝트: mozyg/kernel
static int tahvo_usb_set_suspend(struct otg_transceiver *dev, int suspend)
{
	struct tahvo_usb *tu = container_of(dev, struct tahvo_usb, otg);
	u16 w;

	dev_dbg(&tu->pt_dev->dev, "set_suspend\n");

	w = tahvo_read_reg(TAHVO_REG_USBR);
	if (suspend)
		w &= ~USBR_NSUSPEND;
	else
		w |= USBR_NSUSPEND;
	tahvo_write_reg(TAHVO_REG_USBR, w);

	return 0;
}
예제 #5
0
파일: tahvo-usb.c 프로젝트: mozyg/kernel
static void tahvo_usb_become_host(struct tahvo_usb *tu)
{
	u32 l;

	/* Clear system and transceiver controlled bits
	 * also mark the A-session is always valid */
	omap_otg_init();

	l = OTG_CTRL_REG;
	l &= ~(OTG_CTRL_XCVR_MASK|OTG_CTRL_SYS_MASK);
	l |= OTG_ASESSVLD;
	OTG_CTRL_REG = l;

	/* Power up the transceiver in USB host mode */
	tahvo_write_reg(TAHVO_REG_USBR, USBR_REGOUT | USBR_NSUSPEND |
			USBR_MASTER_SW2 | USBR_MASTER_SW1);
	tu->otg.state = OTG_STATE_A_IDLE;

	check_vbus_state(tu);
}