/* restore gpios */ r0 = (0x8300000d); result = exynos_smc(r0, r1, r2, r3); rt = result; break; } return NOTIFY_OK; } #endif static struct of_device_id mst_match_ldo_table[] = { { .compatible = "sec-mst",}, {}, }; static int mst_ldo_device_suspend(struct platform_device *dev, pm_message_t state) { u64 r0 = 0, r1 = 0, r2 = 0, r3 = 0; int result=0; printk(KERN_INFO "%s\n", __func__); printk(KERN_INFO "MST_LDO_DRV]]] suspend"); //Will Add here r0 = (0x8300000c); result = exynos_smc(r0, r1, r2, r3); if(result == MST_NOT_SUPPORT){ printk(KERN_INFO "MST_LDO_DRV]]] suspend do nothing after smc : %x\n", result); }else{ printk(KERN_INFO "MST_LDO_DRV]]] suspend success after smc : %x\n", result); } return 0; } static int mst_ldo_device_resume(struct platform_device *dev) { u64 r0 = 0, r1 = 0, r2 = 0, r3 = 0; int result=0; printk(KERN_INFO "%s\n", __func__); printk(KERN_INFO "MST_LDO_DRV]]] resume"); //Will Add here r0 = (0x8300000d); result = exynos_smc(r0, r1, r2, r3); if(result == MST_NOT_SUPPORT){ printk(KERN_INFO "MST_LDO_DRV]]] resume do nothing after smc : %x\n", result); }else{ printk(KERN_INFO "MST_LDO_DRV]]] resume success after smc : %x\n", result); } rt = result; return 0; } static struct platform_driver sec_mst_ldo_driver = { .driver = { .owner = THIS_MODULE, .name = "mstldo", .of_match_table = mst_match_ldo_table, }, .probe = mst_ldo_device_probe, .suspend = mst_ldo_device_suspend, .resume = mst_ldo_device_resume, }; #ifdef CONFIG_CPU_IDLE static struct notifier_block sec_mst_notifier_block = { .notifier_call = sec_mst_notifier, .priority = 1, }; #endif /*CONFIG_CPU_IDLE */ static int __init mst_drv_init(void) { int ret=0; printk(KERN_ERR "%s\n", __func__); #ifdef CONFIG_CPU_IDLE exynos_pm_register_notifier(&sec_mst_notifier_block); #endif ret = platform_driver_register(&sec_mst_ldo_driver); printk(KERN_ERR "MST_LDO_DRV]]] init , ret val : %d\n",ret); return ret; }
void exynos_register_notifier(void *data) { #ifdef CONFIG_ARCH_EXYNOS5 #ifdef CONFIG_CPU_IDLE struct dw_mci *host = (struct dw_mci *)data; /* * Should be called sequentially */ dw_mci_lpa_host[dw_mci_host_count] = host; exynos_pm_register_notifier(&(dw_mmc_exynos_notifier_block[dw_mci_host_count++])); #endif #endif }
static int exynos_ohci_probe(struct platform_device *pdev) { struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data; struct exynos_ohci_hcd *exynos_ohci; struct usb_hcd *hcd; struct ohci_hcd *ohci; struct resource *res; struct usb_phy *phy; int irq; int err; /* * Right now device-tree probed devices don't get dma_mask set. * Since shared usb code relies on it, set it here for now. * Once we move to full device tree support this will vanish off. */ if (!pdev->dev.dma_mask) pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; if (!pdev->dev.coherent_dma_mask) pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); exynos_ohci = devm_kzalloc(&pdev->dev, sizeof(struct exynos_ohci_hcd), GFP_KERNEL); if (!exynos_ohci) return -ENOMEM; if (of_device_is_compatible(pdev->dev.of_node, "samsung,exynos5440-ohci")) goto skip_phy; phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0); if (IS_ERR(phy)) { /* Fallback to pdata */ if (!pdata) { dev_warn(&pdev->dev, "no platform data or transceiver defined\n"); return -EPROBE_DEFER; } else { exynos_ohci->pdata = pdata; } } else { exynos_ohci->phy = phy; exynos_ohci->otg = phy->otg; } skip_phy: exynos_ohci->dev = &pdev->dev; hcd = usb_create_hcd(&exynos_ohci_hc_driver, &pdev->dev, dev_name(&pdev->dev)); if (!hcd) { dev_err(&pdev->dev, "Unable to create HCD\n"); return -ENOMEM; } exynos_ohci->hcd = hcd; exynos_ohci->clk = devm_clk_get(&pdev->dev, "usbhost"); if (IS_ERR(exynos_ohci->clk)) { dev_err(&pdev->dev, "Failed to get usbhost clock\n"); err = PTR_ERR(exynos_ohci->clk); goto fail_clk; } err = clk_prepare_enable(exynos_ohci->clk); if (err) goto fail_clk; 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 = devm_ioremap(&pdev->dev, res->start, hcd->rsrc_len); 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) { dev_err(&pdev->dev, "Failed to get IRQ\n"); err = -ENODEV; goto fail_io; } if (exynos_ohci->otg) exynos_ohci->otg->set_host(exynos_ohci->otg, &exynos_ohci->hcd->self); /* Make sure PHY is initialized */ exynos_ohci_phy_enable(exynos_ohci); if (exynos_ohci->phy) /* * PHY can be runtime suspended (e.g. by EHCI driver), so * make sure PHY is active */ pm_runtime_get_sync(exynos_ohci->phy->dev); ohci = hcd_to_ohci(hcd); ohci_hcd_init(ohci); err = usb_add_hcd(hcd, irq, IRQF_SHARED); if (err) { dev_err(&pdev->dev, "Failed to add USB HCD\n"); goto fail_add_hcd; } platform_set_drvdata(pdev, exynos_ohci); /* * OHCI root hubs are expected to handle remote wakeup. * So, wakeup flag init defaults for root hubs. */ device_wakeup_enable(&hcd->self.root_hub->dev); if (create_ohci_sys_file(ohci)) dev_err(&pdev->dev, "Failed to create ehci sys file\n"); exynos_ohci->lpa_nb.notifier_call = exynos_ohci_lpa_event; exynos_ohci->lpa_nb.next = NULL; exynos_ohci->lpa_nb.priority = 0; err = exynos_pm_register_notifier(&exynos_ohci->lpa_nb); if (err) dev_err(&pdev->dev, "Failed to register lpa notifier\n"); exynos_ohci->power_on = 1; pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); return 0; fail_add_hcd: if (exynos_ohci->phy) pm_runtime_put_sync(exynos_ohci->phy->dev); exynos_ohci_phy_disable(exynos_ohci); fail_io: clk_disable_unprepare(exynos_ohci->clk); fail_clk: usb_put_hcd(hcd); return err; }
static int s5p_ehci_probe(struct platform_device *pdev) { struct s5p_ehci_platdata *pdata = pdev->dev.platform_data; struct device_node *node = (&pdev->dev)->of_node; struct s5p_ehci_hcd *s5p_ehci; struct usb_hcd *hcd; struct ehci_hcd *ehci; struct resource *res; struct usb_phy *phy; const struct exynos_ehci_drvdata *drv_data; int irq; int err; /* * Right now device-tree probed devices don't get dma_mask set. * Since shared usb code relies on it, set it here for now. * Once we move to full device tree support this will vanish off. */ if (!pdev->dev.dma_mask) pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; if (!pdev->dev.coherent_dma_mask) pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); s5p_setup_vbus_gpio(pdev); hcd = usb_create_hcd(&s5p_ehci_hc_driver, &pdev->dev, dev_name(&pdev->dev)); if (!hcd) { dev_err(&pdev->dev, "Unable to create HCD\n"); return -ENOMEM; } s5p_ehci = to_s5p_ehci(hcd); phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0); if (IS_ERR(phy)) { /* Fallback to pdata */ if (!pdata) { usb_put_hcd(hcd); dev_warn(&pdev->dev, "no platform data or transceiver defined\n"); return -EPROBE_DEFER; } else { s5p_ehci->pdata = pdata; } } else { s5p_ehci->phy = phy; s5p_ehci->otg = phy->otg; } err = of_property_read_u32_index(node, "l2-retention", 0, &s5p_ehci->retention); if (err) dev_err(&pdev->dev, " can not find l2-retention value\n"); drv_data = exynos_ehci_get_driver_data(pdev); s5p_ehci->drvdata = drv_data; err = s5p_ehci_clk_get(s5p_ehci, &pdev->dev); if (err) { dev_err(&pdev->dev, "Failed to get clocks\n"); goto fail_clk; } err = s5p_ehci_clk_prepare_enable(s5p_ehci); if (err) goto fail_clk; 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 = devm_ioremap(&pdev->dev, res->start, hcd->rsrc_len); 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) { dev_err(&pdev->dev, "Failed to get IRQ\n"); err = -ENODEV; goto fail_io; } if (s5p_ehci->otg) s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self); if (s5p_ehci->phy) { /* Make sure PHY is initialized */ usb_phy_init(s5p_ehci->phy); /* * PHY can be runtime suspended (e.g. by OHCI driver), so * make sure PHY is active */ pm_runtime_get_sync(s5p_ehci->phy->dev); } else if (s5p_ehci->pdata->phy_init) { s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST); } ehci = hcd_to_ehci(hcd); ehci->caps = hcd->regs; if (node) { u32 tmp_hsic_ports; ehci->has_synopsys_hsic_bug = of_property_read_bool(node, "has-synopsys-hsic"); err = of_property_read_u32(node, "hsic-ports", &tmp_hsic_ports); if (err) { ehci->hsic_ports = 0; dev_info(&pdev->dev, "HSIC ports are not defined\n"); } else { ehci->hsic_ports = tmp_hsic_ports; } } else { ehci->has_synopsys_hsic_bug = s5p_ehci->pdata->has_synopsys_hsic_bug; ehci->hsic_ports = s5p_ehci->pdata->hsic_ports; } /* DMA burst Enable */ writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs)); err = usb_add_hcd(hcd, irq, IRQF_SHARED); if (err) { dev_err(&pdev->dev, "Failed to add USB HCD\n"); goto fail_add_hcd; } platform_set_drvdata(pdev, hcd); /* * EHCI root hubs are expected to handle remote wakeup. * So, wakeup flag init defaults for root hubs. */ device_wakeup_enable(&hcd->self.root_hub->dev); if (create_ehci_sys_file(ehci)) dev_err(&pdev->dev, "Failed to create ehci sys file\n"); s5p_ehci->lpa_nb.notifier_call = s5p_ehci_lpa_event; s5p_ehci->lpa_nb.next = NULL; s5p_ehci->lpa_nb.priority = 0; if (!s5p_ehci->retention) { err = exynos_pm_register_notifier(&s5p_ehci->lpa_nb); if (err) dev_err(&pdev->dev, "Failed to register lpa notifier\n"); } s5p_ehci->power_on = 1; if (s5p_ehci->drvdata->rpm_enable) { pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); } return 0; fail_add_hcd: if (s5p_ehci->phy) { pm_runtime_put_sync(s5p_ehci->phy->dev); usb_phy_shutdown(s5p_ehci->phy); } else if (s5p_ehci->pdata->phy_exit) { s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST); } fail_io: s5p_ehci_clk_disable_unprepare(s5p_ehci); fail_clk: usb_put_hcd(hcd); return err; }