/*
 * 	probe - binds to the platform device
 */
static int s3c_udc_probe(struct platform_device *pdev)
{
	struct s3c_udc *dev = &memory;
	int retval;

	DEBUG("%s: %p\n", __FUNCTION__, pdev);

	spin_lock_init(&dev->lock);
	dev->dev = pdev;

	device_initialize(&dev->gadget.dev);
	dev->gadget.dev.parent = &pdev->dev;

	dev->gadget.is_dualspeed = 1;	// Hack only
	dev->gadget.is_otg = 0;
	dev->gadget.is_a_peripheral = 0;
	dev->gadget.b_hnp_enable = 0;
	dev->gadget.a_hnp_support = 0;
	dev->gadget.a_alt_hnp_support = 0;
	dev->udc_state = USB_STATE_NOTATTACHED;
	dev->config_gadget_driver = NO_GADGET_DRIVER;
	
#if defined (CONFIG_MACH_SMDK6410)
	dev->is_pm_lock = false;
#endif /* CONFIG_MACH_SMDK6410 */

	the_controller = dev;
	platform_set_drvdata(pdev, dev);

	otg_clock = clk_get(&pdev->dev, "otg");

	if (IS_ERR(otg_clock)) {
		printk(KERN_INFO "failed to find otg clock source\n");
		return -ENOENT;
	}
	clk_enable(otg_clock);

	udc_ep_list_reinit(dev);

	local_irq_disable();

	/* irq setup after old hardware state is cleaned up */
	retval =
	    request_irq(IRQ_OTG, s3c_udc_irq, 0, driver_name, dev);

	if (retval != 0) {
		DEBUG(KERN_ERR "%s: can't get irq %i, err %d\n", driver_name,
		      IRQ_OTG, retval);
		return -EBUSY;
	}

	disable_irq(IRQ_OTG);
	local_irq_enable();
	create_proc_files();

	//it just prints which file included regarding whether DMA mode or SLAVE mode
	s3c_show_mode();
	
	return retval;
}
Example #2
0
/*
 * 	probe - binds to the platform device
 */
static int s3c_udc_probe(struct platform_device *pdev)
{
	struct s3c_udc *dev = &memory;
	int retval;

	DEBUG("%s: %p\n", __func__, pdev);

#if 0// !NO_USING_USB_SWITCH 
	retval = i2c_add_driver(&fsa9480_i2c_driver);
	if (retval != 0)
		DEBUG_ERROR("[USB Switch] can't add i2c driver");
#endif

	spin_lock_init(&dev->lock);
	dev->dev = pdev;

	device_initialize(&dev->gadget.dev);
	dev->gadget.dev.parent = &pdev->dev;

	dev->gadget.is_dualspeed = 1;	// Hack only
	dev->gadget.is_otg = 0;
	dev->gadget.is_a_peripheral = 0;
	dev->gadget.b_hnp_enable = 0;
	dev->gadget.a_hnp_support = 0;
	dev->gadget.a_alt_hnp_support = 0;
	dev->udc_state = USB_STATE_NOTATTACHED;
	dev->config_gadget_driver = NO_GADGET_DRIVER;
	dev->clocked = 0;
	dev->powered = 0;
	
	the_controller = dev;
	platform_set_drvdata(pdev, dev);

	otg_clock = clk_get(&pdev->dev, "otg");

	if (IS_ERR(otg_clock)) {
		DEBUG_ERROR(KERN_INFO "failed to find otg clock source\n");
		return -ENOENT;
	}

#ifndef CONFIG_PM
	clk_enable(otg_clock);
#endif

	s3c_ep_list_reinit(dev);

	local_irq_disable();

	/* irq setup after old hardware state is cleaned up */
	retval =  request_irq(IRQ_OTG, s3c_udc_irq, 0, driver_name, dev);

	if (retval != 0) {
		DEBUG(KERN_ERR "%s: can't get irq %i, err %d\n", driver_name,
		      IRQ_OTG, retval);
		return -EBUSY;
	}

	disable_irq(IRQ_OTG);
	local_irq_enable();
	create_proc_files();

	//it just prints which file included regarding whether DMA mode or SLAVE mode
	s3c_show_mode();

	
#if TESTING_SOFT_CONNCTION
	soft_switch.name = SOFT_SWITCH_NAME;
	soft_switch.print_name = soft_switch_name;
	soft_switch.print_state = soft_switch_state;
	soft_switch.state = 0;
	if (switch_dev_register(&soft_switch) < 0)
		switch_dev_unregister(&soft_switch);
#endif

	return retval;
}