コード例 #1
0
ファイル: c67x00-drv.c プロジェクト: 3null/linux
static void c67x00_probe_sie(struct c67x00_sie *sie,
			     struct c67x00_device *dev, int sie_num)
{
	spin_lock_init(&sie->lock);
	sie->dev = dev;
	sie->sie_num = sie_num;
	sie->mode = c67x00_sie_config(dev->pdata->sie_config, sie_num);

	switch (sie->mode) {
	case C67X00_SIE_HOST:
		c67x00_hcd_probe(sie);
		break;

	case C67X00_SIE_UNUSED:
		dev_info(sie_dev(sie),
			 "Not using SIE %d as requested\n", sie->sie_num);
		break;

	default:
		dev_err(sie_dev(sie),
			"Unsupported configuration: 0x%x for SIE %d\n",
			sie->mode, sie->sie_num);
		break;
	}
}
コード例 #2
0
int c67x00_hcd_probe(struct c67x00_sie *sie)
{
	struct c67x00_hcd *c67x00;
	struct usb_hcd *hcd;
	unsigned long flags;
	int retval;

	if (usb_disabled())
		return -ENODEV;

	hcd = usb_create_hcd(&c67x00_hc_driver, sie_dev(sie), "c67x00_sie");
	if (!hcd) {
		retval = -ENOMEM;
		goto err0;
	}
	c67x00 = hcd_to_c67x00_hcd(hcd);

	spin_lock_init(&c67x00->lock);
	c67x00->sie = sie;

	INIT_LIST_HEAD(&c67x00->list[PIPE_ISOCHRONOUS]);
	INIT_LIST_HEAD(&c67x00->list[PIPE_INTERRUPT]);
	INIT_LIST_HEAD(&c67x00->list[PIPE_CONTROL]);
	INIT_LIST_HEAD(&c67x00->list[PIPE_BULK]);
	c67x00->urb_count = 0;
	INIT_LIST_HEAD(&c67x00->td_list);
	c67x00->td_base_addr = CY_HCD_BUF_ADDR + SIE_TD_OFFSET(sie->sie_num);
	c67x00->buf_base_addr = CY_HCD_BUF_ADDR + SIE_BUF_OFFSET(sie->sie_num);
	c67x00->max_frame_bw = MAX_FRAME_BW_STD;

	c67x00_ll_husb_init_host_port(sie);

	init_completion(&c67x00->endpoint_disable);
	retval = c67x00_sched_start_scheduler(c67x00);
	if (retval)
		goto err1;

	retval = usb_add_hcd(hcd, 0, 0);
	if (retval) {
		dev_dbg(sie_dev(sie), "%s: usb_add_hcd returned %d\n",
			__func__, retval);
		goto err2;
	}

	spin_lock_irqsave(&sie->lock, flags);
	sie->private_data = c67x00;
	sie->irq = c67x00_hcd_irq;
	spin_unlock_irqrestore(&sie->lock, flags);

	return retval;

 err2:
	c67x00_sched_stop_scheduler(c67x00);
 err1:
	usb_put_hcd(hcd);
 err0:
	return retval;
}
コード例 #3
0
ファイル: c67x00-ll-hpi.c プロジェクト: CSCLOG/beaglebone
void c67x00_ll_husb_init_host_port(struct c67x00_sie *sie)
{
	/* Set port into host mode */
	hpi_set_bits(sie->dev, USB_CTL_REG(sie->sie_num), HOST_MODE);
	c67x00_ll_husb_sie_init(sie);
	/* Clear interrupts */
	c67x00_ll_usb_clear_status(sie, HOST_STAT_MASK);
	/* Check */
	if (!(hpi_read_word(sie->dev, USB_CTL_REG(sie->sie_num)) & HOST_MODE))
		dev_warn(sie_dev(sie),
			 "SIE %d not set to host mode\n", sie->sie_num);
}