Ejemplo n.º 1
0
extern void stx5206_usb_init(void)
{
	unsigned long sysconf;

	/* USB_HOST_SOFT_RESET: active low usb host sof reset */
//	sc = sysconf_claim(SYS_CFG, 4, 1, 1, "USB");
//	sysconf_write(sc, 1);
	sysconf = readl(STX5206_SYSCONF_SYS_CFG04);
	SET_SYSCONF_BIT(sysconf, 1, 1);
	writel(sysconf, STX5206_SYSCONF_SYS_CFG04);

	/* suspend_from_config: Signal to suspend USB PHY */
//	sc = sysconf_claim(SYS_CFG, 10, 5, 5, "USB");
//	sysconf_write(sc, 0);
	sysconf = readl(STX5206_SYSCONF_SYS_CFG10);
	SET_SYSCONF_BIT(sysconf, 0, 5);
	writel(sysconf, STX5206_SYSCONF_SYS_CFG10);

	/* usb_power_down_req: power down request for USB Host module */
//	sc = sysconf_claim(SYS_CFG, 32, 4, 4, "USB");
//	sysconf_write(sc, 0);
	sysconf = readl(STX5206_SYSCONF_SYS_CFG32);
	SET_SYSCONF_BIT(sysconf, 0, 4);
	writel(sysconf, STX5206_SYSCONF_SYS_CFG32);

	/* start the USB Wrapper Host Controller */
	ST40_start_host_control(
		USB_FLAGS_STRAP_8BIT |
		USB_FLAGS_STBUS_CONFIG_THRESHOLD128);
}
Ejemplo n.º 2
0
extern int stx7108_usb_init(int port, int over_current, int power_ctrl)
{
#ifdef QQQ	/* QQQ - DELETE */
	unsigned long reg;
	const unsigned char oc_pins[2]    = {4, 6};	/* PIO4 */
	const unsigned char power_pins[2] = {5, 7};	/* PIO4 */

	if (port >= sizeof(oc_pins))	/* invalid port number ? */
		return -1;		/* failed to initialize! */

	/* Power on the USB */
	reg = readl(STX7105_SYSCONF_SYS_CFG32);
	/* Power up USB host controller */
	/* USBn_HC_POWER_DOWN_REQ = 0 = Powered Up */
	reg &= ~(1ul<<(4+port));
	/* Power up USB PHY */
	/* USBn_PHY_POWER_DOWN_REQ = 0 = Powered Up */
	reg &= ~(1ul<<(6+port));
	writel(reg, STX7105_SYSCONF_SYS_CFG32);

	if (over_current) {
		/* USB overcurrent enable */
		reg = readl(STX7105_SYSCONF_SYS_CFG04);
		/* USB0_PRT_OVCURR_POL = 0 = Active Low */
		reg &= ~(1ul<<(3+port));
		/* USBn_PRT_OVCURR_IN = 0 = PIO4[oc_pins[port]] */
		reg &= ~(1ul<<(5+port));
		/* CFG_USBn_OVRCURR_ENABLE = 1 = OC Enabled */
		reg |= 1ul<<(11+port);
		writel(reg, STX7105_SYSCONF_SYS_CFG04);

		/* Route USBn OC Routing via PIO4[oc_pins[port]] */
		reg = readl(STX7105_SYSCONF_SYS_CFG34);
		/* PIO4[oc_pins[port]] CFG34[8+oc_pins[port],oc_pins[port]] = Alternate4 */
		reg &= ~(0x0101ul<<(oc_pins[port]));	/* Mask=3 */
		reg |=   0x0101ul<<(oc_pins[port]);	/* OR=3 */
		writel(reg, STX7105_SYSCONF_SYS_CFG34);
		/* set PIO directionality, for OC as IN */
		SET_PIO_PIN(ST40_PIO_BASE(4), oc_pins[port], STPIO_IN);
	}

	if (power_ctrl) {
		/* Route USBn POWER Routing via PIO4[power_pins[port]] */
		reg = readl(STX7105_SYSCONF_SYS_CFG34);
		/* PIO4[power_pins[port]] CFG34[8+power_pins[port],power_pins[port]] = Alternate4 */
		reg &= ~(0x0101ul<<(power_pins[port]));	/* Mask=3 */
		reg |=   0x0101ul<<(power_pins[port]);	/* OR=3 */
		writel(reg, STX7105_SYSCONF_SYS_CFG34);
		/* set PIO directionality, for POWER as ALT_OUT */
		SET_PIO_PIN(ST40_PIO_BASE(4), power_pins[port], STPIO_ALT_OUT);
	}

	/* start the USB Wrapper Host Controller */
	ST40_start_host_control(
		USB_FLAGS_STRAP_8BIT |
		USB_FLAGS_STBUS_CONFIG_THRESHOLD128);

	return 0;
#endif		/* QQQ - DELETE */
}
Ejemplo n.º 3
0
extern void fli7510_usb_init(const enum fli7510_usb_ovrcur_mode ovrcur_mode)
{
	unsigned long sysconf;

	switch (ovrcur_mode) {
	case fli7510_usb_ovrcur_disabled:
		/* CONFIG_SYS_COMMS_CONFIG_1[12] = usba_enable_pad_override */
		sysconf = readl(CONFIG_SYS_COMMS_CONFIG_1);
		SET_SYSCONF_BIT(sysconf, 1, USBA_ENABLE_PAD_OVERRIDE);
		writel(sysconf, CONFIG_SYS_COMMS_CONFIG_1);

		/* CONFIG_SYS_COMMS_CONFIG_1[13] = usba_ovrcur */
		sysconf = readl(CONFIG_SYS_COMMS_CONFIG_1);
		SET_SYSCONF_BIT(sysconf, 1, USBA_OVRCUR);
		writel(sysconf, CONFIG_SYS_COMMS_CONFIG_1);
		break;
	default:
		/* CONFIG_SYS_COMMS_CONFIG_1[12] = usba_enable_pad_override */
		sysconf = readl(CONFIG_SYS_COMMS_CONFIG_1);
		SET_SYSCONF_BIT(sysconf, 0, USBA_ENABLE_PAD_OVERRIDE);
		writel(sysconf, CONFIG_SYS_COMMS_CONFIG_1);

		/* CONFIG_SYS_COMMS_CONFIG_1[11] = usba_ovrcur_polarity */
		switch (ovrcur_mode) {
		case fli7510_usb_ovrcur_active_high:
			sysconf = readl(CONFIG_SYS_COMMS_CONFIG_1);
			SET_SYSCONF_BIT(sysconf, 0, USBA_OVRCUR_POLARITY);
			writel(sysconf, CONFIG_SYS_COMMS_CONFIG_1);
			break;
		case fli7510_usb_ovrcur_active_low:
			sysconf = readl(CONFIG_SYS_COMMS_CONFIG_1);
			SET_SYSCONF_BIT(sysconf, 1, USBA_OVRCUR_POLARITY);
			writel(sysconf, CONFIG_SYS_COMMS_CONFIG_1);
			break;
		default:
			BUG();
			break;
		}
		break;
	}

	/* now route the PIOs corectly */
	SET_PIO_PIN(ST40_PIO_BASE(27), 1, STPIO_IN);		/* USB_A_OVRCUR */
	SET_PIO_PIN(ST40_PIO_BASE(27), 2, STPIO_ALT_OUT);	/* USB_A_PWREN */

	/* start the USB Wrapper Host Controller */
	ST40_start_host_control(
		USB_FLAGS_STRAP_16BIT		|
		USB_FLAGS_STRAP_PLL		|
		USB_FLAGS_STBUS_CONFIG_THRESHOLD256);
}
extern void stx5197_usb_init(void)
{
	unsigned long sysconf;

	/* USB power down */
	sysconf = *STX5197_HD_CONF_MON_CONFIG_CONTROL_H;
	sysconf &= ~(1ul<<8);	/* CFG_CTRL_H.USB_POWERDOWN_REQ = 0 [8] */
	*STX5197_HD_CONF_MON_CONFIG_CONTROL_H = sysconf;

	/* DDR enable for ULPI */
	sysconf = *STX5197_HD_CONF_MON_CONFIG_CONTROL_M;
	sysconf &= ~(1ul<<12);	/* CFG_CTRL_M.ULPI_DDR_EN_I = 0 [12] */
				/* 0=8-bit SDR ULPI, 1=4-bit DDR ULPI */
	*STX5197_HD_CONF_MON_CONFIG_CONTROL_M = sysconf;

	/* start the USB Wrapper Host Controller */
	ST40_start_host_control(
		USB_FLAGS_STRAP_16BIT		|
		USB_FLAGS_STRAP_PLL		|
		USB_FLAGS_STBUS_CONFIG_THRESHOLD256);
}