Beispiel #1
0
static void ventana_usb_init(void)
{
	char *src = NULL;
	int i;

	tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));

	tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
	platform_device_register(&tegra_otg_device);

	tegra_ehci3_device.dev.platform_data=&tegra_ehci_pdata[2];
	platform_device_register(&tegra_ehci3_device);

#ifdef CONFIG_USB_ANDROID_RNDIS
	src = usb_serial_num;

	/* create a fake MAC address from our serial number.
	 * first byte is 0x02 to signify locally administered.
	 */
	rndis_pdata.ethaddr[0] = 0x02;
	for (i = 0; *src; i++) {
		/* XOR the USB serial across the remaining bytes */
		rndis_pdata.ethaddr[i % (ETH_ALEN - 1) + 1] ^= *src++;
	}
	platform_device_register(&rndis_device);
#endif
}
static void enterprise_usb_init(void)
{
    struct	fsl_usb2_platform_data *udc_pdata;

    tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));

    tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
    platform_device_register(&tegra_otg_device);

    udc_pdata = tegra_udc_device.dev.platform_data;
}
static void kai_usb_init(void)
{
	tegra_usb_phy_init(tegra_usb_phy_pdata,
			ARRAY_SIZE(tegra_usb_phy_pdata));

	tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
	platform_device_register(&tegra_otg_device);

	tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1];
	platform_device_register(&tegra_ehci2_device);
}
static void ventana_usb_init(void)
{
	tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));
	/* OTG should be the first to be registered */
	tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
	platform_device_register(&tegra_otg_device);

	platform_device_register(&tegra_udc_device);
	platform_device_register(&tegra_ehci2_device);

	tegra_ehci3_device.dev.platform_data=&tegra_ehci_pdata[2];
	platform_device_register(&tegra_ehci3_device);
}
Beispiel #5
0
static void cardhu_usb_init(void)
{
	struct board_info bi;

	tegra_get_board_info(&bi);

	tegra_usb_phy_init(tegra_usb_phy_pdata,
			ARRAY_SIZE(tegra_usb_phy_pdata));

	tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
	platform_device_register(&tegra_otg_device);
	if (bi.board_id == BOARD_PM267) {
		uhsic_phy_config.reset_gpio =
			PM267_SMSC4640_HSIC_HUB_RESET_GPIO;
		tegra_ehci2_device.dev.platform_data = &tegra_ehci_uhsic_pdata;
		platform_device_register(&tegra_ehci2_device);
	} else if (bi.board_id == BOARD_E1256) {
		tegra_ehci2_device.dev.platform_data = &tegra_ehci_uhsic_pdata;
		platform_device_register(&tegra_ehci2_device);
	} else if (bi.board_id == BOARD_E1186) {
		/* for baseband devices do not switch off phy during suspend */
		tegra_ehci_uhsic_pdata.power_down_on_bus_suspend = 0;
		uhsic_phy_config.postsuspend = cardhu_usb_hsic_postsupend;
		uhsic_phy_config.preresume = cardhu_usb_hsic_preresume;
		uhsic_phy_config.usb_phy_ready = cardhu_usb_hsic_phy_ready;
		uhsic_phy_config.post_phy_off = cardhu_usb_hsic_phy_off;
		tegra_ehci2_device.dev.platform_data = &tegra_ehci_uhsic_pdata;
		/* baseband registration happens in baseband-xmm-power  */
	} else {
		u32 project_info = tegra3_get_project_id();
		if (project_info == TEGRA3_PROJECT_TF300TG) {
			/* for baseband devices do not switch off phy during suspend */
			tegra_ehci_uhsic_pdata.power_down_on_bus_suspend = 0;
			uhsic_phy_config.postsuspend = cardhu_usb_hsic_postsupend;
			uhsic_phy_config.preresume = cardhu_usb_hsic_preresume;
			uhsic_phy_config.usb_phy_ready = cardhu_usb_hsic_phy_ready;
			uhsic_phy_config.post_phy_off = cardhu_usb_hsic_phy_off;
			tegra_ehci2_device.dev.platform_data = &tegra_ehci_uhsic_pdata;
			/* baseband registration happens in baseband-xmm-power  */
		} else if (project_info == TEGRA3_PROJECT_TF300TL) {
			printk("[TF300TL] register tegra_ehci2_device\n");
			tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1];
			platform_device_register(&tegra_ehci2_device);
		}
	}

	tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2];
	platform_device_register(&tegra_ehci3_device);
}
Beispiel #6
0
static void ventana_usb_init(void)
{
	tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));
	/* OTG should be the first to be registered */
	tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
	platform_device_register(&tegra_otg_device);

	platform_device_register(&tegra_udc_device);
#if !defined(CONFIG_MACH_PICASSO_E)
	platform_device_register(&tegra_ehci2_device);
#endif

	tegra_ehci3_device.dev.platform_data=&tegra_ehci_pdata[2];
	platform_device_register(&tegra_ehci3_device);
}
static void p1852_usb_init(void)
{
	/* Need to parse sku info to decide host/device mode */
	tegra_usb_phy_init(tegra_usb_phy_pdata,
				ARRAY_SIZE(tegra_usb_phy_pdata));

	tegra_ehci1_device.dev.platform_data = &tegra_ehci_pdata[0];
	platform_device_register(&tegra_ehci1_device);

	tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1];
	platform_device_register(&tegra_ehci2_device);

	tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2];
	platform_device_register(&tegra_ehci3_device);

}
static void ventana_usb_init(void)
{
	tegra_pm_irq_set_wake_type(INT_USB, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING);
	enable_irq_wake(INT_USB);

	tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));
	/* OTG should be the first to be registered */
	tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
	platform_device_register(&tegra_otg_device);

	platform_device_register(&tegra_udc_device);
	platform_device_register(&tegra_ehci2_device);

	tegra_ehci3_device.dev.platform_data=&tegra_ehci_pdata[2];
	platform_device_register(&tegra_ehci3_device);
}
static void ventana_usb_init(void)
{
	tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));
	/* OTG should be the first to be registered */
	tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
	platform_device_register(&tegra_otg_device);

	platform_device_register(&tegra_udc_device);
#if !defined(CONFIG_MACH_PICASSO_E)
	if(get_sku_id() == BOARD_PICASSO_3G || get_sku_id() == BOARD_VANGOGH_3G)
		platform_device_register(&tegra_ehci2_device);
#endif

#if !defined(CONFIG_MACH_VANGOGH)
	tegra_ehci3_device.dev.platform_data=&tegra_ehci_pdata[2];
	platform_device_register(&tegra_ehci3_device);
#endif
}
static void grouper_usb_init(void)
{
	u32 project_info = grouper_get_project_id();
	unsigned int pcb_id_version = grouper_query_pcba_revision();

	tegra_usb_phy_init(tegra_usb_phy_pdata,
			ARRAY_SIZE(tegra_usb_phy_pdata));

	tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
	platform_device_register(&tegra_otg_device);

	if (project_info == GROUPER_PROJECT_NAKASI_3G) {
		printk(KERN_INFO"%s : pcb_id_version = %d \n", __func__, pcb_id_version);
		/* for baseband devices do not switch off phy during suspend */
		tegra_ehci_uhsic_pdata.power_down_on_bus_suspend = 0;
		tegra_ehci_pdata[1].power_down_on_bus_suspend = 0;
		uhsic_phy_config.postsuspend = grouper_usb_hsic_postsupend;
		uhsic_phy_config.preresume = grouper_usb_hsic_preresume;
		uhsic_phy_config.usb_phy_ready = grouper_usb_hsic_phy_ready;
		uhsic_phy_config.post_phy_off = grouper_usb_hsic_phy_off;
		tegra_ehci2_device.dev.platform_data = &tegra_ehci_uhsic_pdata;
		/* baseband registration happens in baseband-xmm-power  */

		switch (pcb_id_version) {
			case TILAPIA_PCBA_SR1:
			case TILAPIA_PCBA_SR2:
			case TILAPIA_PCBA_SR3:
				uhsic_phy_config.enable_gpio = TEGRA_GPIO_PR7;
				break;
			default:
				uhsic_phy_config.enable_gpio = TEGRA_GPIO_PU4;
		}

	} else {
		tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1];
		platform_device_register(&tegra_ehci2_device);
	}
}
static int tegra_ehci_probe(struct platform_device *pdev)
{
	struct resource *res;
	struct usb_hcd *hcd;
	struct tegra_ehci_hcd *tegra;
	int err = 0;
	int irq;

	pr_info("%s: ehci.id = %d\n", __func__, pdev->id);

	device_ehci_shutdown = false;

	tegra = devm_kzalloc(&pdev->dev, sizeof(struct tegra_ehci_hcd),
		GFP_KERNEL);
	if (!tegra) {
		dev_err(&pdev->dev, "memory alloc failed\n");
		return -ENOMEM;
	}

	mutex_init(&tegra->sync_lock);

	hcd = usb_create_hcd(&tegra_ehci_hc_driver, &pdev->dev,
					dev_name(&pdev->dev));
	if (!hcd) {
		dev_err(&pdev->dev, "unable to create HCD\n");
		return -ENOMEM;
	}

	platform_set_drvdata(pdev, tegra);

        //+Sophia:0608
         tegra->clk = clk_get(&pdev->dev, NULL);
	if (IS_ERR(tegra->clk)) {
		dev_err(&pdev->dev, "Can't get ehci clock\n");
		err = PTR_ERR(tegra->clk);
		goto fail_io;
	}

	err = clk_enable(tegra->clk);
	if (err)
		goto fail_clken;


	tegra_periph_reset_assert(tegra->clk);
	udelay(2);
	tegra_periph_reset_deassert(tegra->clk);
	udelay(2);
        //+Sophia:0608
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res) {
		dev_err(&pdev->dev, "failed to get I/O memory\n");
		err = -ENXIO;
		goto fail_io;
	}
	hcd->rsrc_start = res->start;
	hcd->rsrc_len = resource_size(res);
	hcd->regs = ioremap(res->start, resource_size(res));
	if (!hcd->regs) {
		dev_err(&pdev->dev, "failed to remap I/O memory\n");
		err = -ENOMEM;
		goto fail_io;
	}

	irq = platform_get_irq(pdev, 0);
	if (irq < 0) {
		dev_err(&pdev->dev, "failed to get IRQ\n");
		err = -ENODEV;
		goto fail_irq;
	}
	set_irq_flags(irq, IRQF_VALID);
	tegra->irq = irq;

	tegra->phy = tegra_usb_phy_open(pdev);
	if (IS_ERR(tegra->phy)) {
		dev_err(&pdev->dev, "failed to open USB phy\n");
		err = -ENXIO;
		goto fail_irq;
	}

	err = tegra_usb_phy_power_on(tegra->phy);
	if (err) {
		dev_err(&pdev->dev, "failed to power on the phy\n");
		goto fail_phy;
	}

	err = tegra_usb_phy_init(tegra->phy);
	if (err) {
		dev_err(&pdev->dev, "failed to init the phy\n");
		goto fail_phy;
	}

	err = usb_add_hcd(hcd, irq, IRQF_SHARED | IRQF_TRIGGER_HIGH);
	if (err) {
		dev_err(&pdev->dev, "Failed to add USB HCD, error=%d\n", err);
		goto fail_phy;
	}

	err = enable_irq_wake(tegra->irq);
	if (err < 0) {
		dev_warn(&pdev->dev,
				"Couldn't enable USB host mode wakeup, irq=%d, "
				"error=%d\n", irq, err);
		err = 0;
		tegra->irq = 0;
	}

	tegra->ehci = hcd_to_ehci(hcd);

	//htc++
	#ifdef CONFIG_QCT_9K_MODEM
	if (Modem_is_QCT_MDM9K())
	{
		extern struct platform_device tegra_ehci2_device;

		if (&tegra_ehci2_device == pdev)
		{
			mdm_hsic_ehci_hcd = tegra->ehci;
			mdm_hsic_usb_hcd = hcd;
			mdm_hsic_phy = tegra->phy;
			pr_info("%s:: mdm_hsic_ehci_hcd = %x, mdm_hsic_usb_hcd = %x, mdm_hsic_phy = %x\n",
				__func__, (unsigned int)mdm_hsic_ehci_hcd, (unsigned int)mdm_hsic_usb_hcd, (unsigned int)mdm_hsic_phy);
		}
	}
	#endif //CONFIG_QCT_9K_MODEM
	//htc--

#ifdef CONFIG_USB_OTG_UTILS
	if (tegra_usb_phy_otg_supported(tegra->phy)) {
		tegra->transceiver = otg_get_transceiver();
		if (tegra->transceiver)
			otg_set_host(tegra->transceiver, &hcd->self);
	}
#endif
	return err;

fail_phy:
	tegra_usb_phy_close(tegra->phy);
fail_irq:
	iounmap(hcd->regs);
fail_clken:
	clk_put(tegra->clk);
fail_io:
	usb_put_hcd(hcd);

	return err;
}