Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 1 | /* |
| 2 | * SAMSUNG S5P USB HOST EHCI Controller |
| 3 | * |
| 4 | * Copyright (C) 2011 Samsung Electronics Co.Ltd |
| 5 | * Author: Jingoo Han <jg1.han@samsung.com> |
| 6 | * Author: Joonyoung Shim <jy0922.shim@samsung.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License as published by the |
| 10 | * Free Software Foundation; either version 2 of the License, or (at your |
| 11 | * option) any later version. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #include <linux/clk.h> |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 16 | #include <linux/dma-mapping.h> |
| 17 | #include <linux/io.h> |
| 18 | #include <linux/kernel.h> |
| 19 | #include <linux/module.h> |
Vivek Gautam | 2c026e2 | 2012-07-16 11:25:37 +0530 | [diff] [blame] | 20 | #include <linux/of.h> |
Vivek Gautam | fd81d59 | 2012-07-17 10:10:50 +0530 | [diff] [blame] | 21 | #include <linux/of_gpio.h> |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 22 | #include <linux/platform_device.h> |
Arnd Bergmann | 436d42c | 2012-08-24 15:22:12 +0200 | [diff] [blame] | 23 | #include <linux/platform_data/usb-ehci-s5p.h> |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 24 | #include <linux/usb/phy.h> |
Vivek Gautam | b506eeb | 2013-01-22 18:30:40 +0530 | [diff] [blame] | 25 | #include <linux/usb/samsung_usb_phy.h> |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 26 | #include <linux/usb.h> |
| 27 | #include <linux/usb/hcd.h> |
| 28 | #include <linux/usb/otg.h> |
| 29 | |
| 30 | #include "ehci.h" |
| 31 | |
| 32 | #define DRIVER_DESC "EHCI s5p driver" |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 33 | |
Jingoo Han | 88555a6 | 2012-03-05 10:40:14 +0900 | [diff] [blame] | 34 | #define EHCI_INSNREG00(base) (base + 0x90) |
| 35 | #define EHCI_INSNREG00_ENA_INCR16 (0x1 << 25) |
| 36 | #define EHCI_INSNREG00_ENA_INCR8 (0x1 << 24) |
| 37 | #define EHCI_INSNREG00_ENA_INCR4 (0x1 << 23) |
| 38 | #define EHCI_INSNREG00_ENA_INCRX_ALIGN (0x1 << 22) |
| 39 | #define EHCI_INSNREG00_ENABLE_DMA_BURST \ |
| 40 | (EHCI_INSNREG00_ENA_INCR16 | EHCI_INSNREG00_ENA_INCR8 | \ |
| 41 | EHCI_INSNREG00_ENA_INCR4 | EHCI_INSNREG00_ENA_INCRX_ALIGN) |
| 42 | |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 43 | static const char hcd_name[] = "ehci-s5p"; |
| 44 | static struct hc_driver __read_mostly s5p_ehci_hc_driver; |
| 45 | |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 46 | struct s5p_ehci_hcd { |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 47 | struct clk *clk; |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 48 | struct usb_phy *phy; |
| 49 | struct usb_otg *otg; |
| 50 | struct s5p_ehci_platdata *pdata; |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 51 | }; |
| 52 | |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 53 | #define to_s5p_ehci(hcd) (struct s5p_ehci_hcd *)(hcd_to_ehci(hcd)->priv) |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 54 | |
Vivek Gautam | fd81d59 | 2012-07-17 10:10:50 +0530 | [diff] [blame] | 55 | static void s5p_setup_vbus_gpio(struct platform_device *pdev) |
| 56 | { |
Doug Anderson | 3f3b55b | 2013-03-14 20:15:37 -0700 | [diff] [blame] | 57 | struct device *dev = &pdev->dev; |
Vivek Gautam | fd81d59 | 2012-07-17 10:10:50 +0530 | [diff] [blame] | 58 | int err; |
| 59 | int gpio; |
| 60 | |
Doug Anderson | 3f3b55b | 2013-03-14 20:15:37 -0700 | [diff] [blame] | 61 | if (!dev->of_node) |
Vivek Gautam | fd81d59 | 2012-07-17 10:10:50 +0530 | [diff] [blame] | 62 | return; |
| 63 | |
Doug Anderson | 3f3b55b | 2013-03-14 20:15:37 -0700 | [diff] [blame] | 64 | gpio = of_get_named_gpio(dev->of_node, "samsung,vbus-gpio", 0); |
Vivek Gautam | fd81d59 | 2012-07-17 10:10:50 +0530 | [diff] [blame] | 65 | if (!gpio_is_valid(gpio)) |
| 66 | return; |
| 67 | |
Doug Anderson | 3f3b55b | 2013-03-14 20:15:37 -0700 | [diff] [blame] | 68 | err = devm_gpio_request_one(dev, gpio, GPIOF_OUT_INIT_HIGH, |
| 69 | "ehci_vbus_gpio"); |
Vivek Gautam | fd81d59 | 2012-07-17 10:10:50 +0530 | [diff] [blame] | 70 | if (err) |
Doug Anderson | 3f3b55b | 2013-03-14 20:15:37 -0700 | [diff] [blame] | 71 | dev_err(dev, "can't request ehci vbus gpio %d", gpio); |
Vivek Gautam | fd81d59 | 2012-07-17 10:10:50 +0530 | [diff] [blame] | 72 | } |
| 73 | |
Vivek Gautam | 2c026e2 | 2012-07-16 11:25:37 +0530 | [diff] [blame] | 74 | static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32); |
| 75 | |
Bill Pemberton | 41ac7b3 | 2012-11-19 13:21:48 -0500 | [diff] [blame] | 76 | static int s5p_ehci_probe(struct platform_device *pdev) |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 77 | { |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 78 | struct s5p_ehci_platdata *pdata = pdev->dev.platform_data; |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 79 | struct s5p_ehci_hcd *s5p_ehci; |
| 80 | struct usb_hcd *hcd; |
| 81 | struct ehci_hcd *ehci; |
| 82 | struct resource *res; |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 83 | struct usb_phy *phy; |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 84 | int irq; |
| 85 | int err; |
| 86 | |
Vivek Gautam | 2c026e2 | 2012-07-16 11:25:37 +0530 | [diff] [blame] | 87 | /* |
| 88 | * Right now device-tree probed devices don't get dma_mask set. |
| 89 | * Since shared usb code relies on it, set it here for now. |
| 90 | * Once we move to full device tree support this will vanish off. |
| 91 | */ |
| 92 | if (!pdev->dev.dma_mask) |
| 93 | pdev->dev.dma_mask = &ehci_s5p_dma_mask; |
| 94 | if (!pdev->dev.coherent_dma_mask) |
| 95 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); |
| 96 | |
Vivek Gautam | fd81d59 | 2012-07-17 10:10:50 +0530 | [diff] [blame] | 97 | s5p_setup_vbus_gpio(pdev); |
| 98 | |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 99 | hcd = usb_create_hcd(&s5p_ehci_hc_driver, |
| 100 | &pdev->dev, dev_name(&pdev->dev)); |
| 101 | if (!hcd) { |
| 102 | dev_err(&pdev->dev, "Unable to create HCD\n"); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 103 | return -ENOMEM; |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 104 | } |
| 105 | s5p_ehci = to_s5p_ehci(hcd); |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 106 | phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2); |
Felipe Balbi | a16283e | 2013-03-15 11:04:15 +0200 | [diff] [blame] | 107 | if (IS_ERR(phy)) { |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 108 | /* Fallback to pdata */ |
| 109 | if (!pdata) { |
| 110 | dev_warn(&pdev->dev, "no platform data or transceiver defined\n"); |
| 111 | return -EPROBE_DEFER; |
| 112 | } else { |
| 113 | s5p_ehci->pdata = pdata; |
| 114 | } |
| 115 | } else { |
| 116 | s5p_ehci->phy = phy; |
| 117 | s5p_ehci->otg = phy->otg; |
| 118 | } |
| 119 | |
Julia Lawall | 63fd0ae | 2012-07-30 16:43:44 +0200 | [diff] [blame] | 120 | s5p_ehci->clk = devm_clk_get(&pdev->dev, "usbhost"); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 121 | |
| 122 | if (IS_ERR(s5p_ehci->clk)) { |
| 123 | dev_err(&pdev->dev, "Failed to get usbhost clock\n"); |
| 124 | err = PTR_ERR(s5p_ehci->clk); |
| 125 | goto fail_clk; |
| 126 | } |
| 127 | |
Thomas Abraham | e1deb56 | 2012-10-03 08:40:42 +0900 | [diff] [blame] | 128 | err = clk_prepare_enable(s5p_ehci->clk); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 129 | if (err) |
Julia Lawall | 63fd0ae | 2012-07-30 16:43:44 +0200 | [diff] [blame] | 130 | goto fail_clk; |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 131 | |
| 132 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 133 | if (!res) { |
| 134 | dev_err(&pdev->dev, "Failed to get I/O memory\n"); |
| 135 | err = -ENXIO; |
| 136 | goto fail_io; |
| 137 | } |
| 138 | |
| 139 | hcd->rsrc_start = res->start; |
| 140 | hcd->rsrc_len = resource_size(res); |
Jingoo Han | 9cb0756 | 2012-06-28 16:29:46 +0900 | [diff] [blame] | 141 | hcd->regs = devm_ioremap(&pdev->dev, res->start, hcd->rsrc_len); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 142 | if (!hcd->regs) { |
| 143 | dev_err(&pdev->dev, "Failed to remap I/O memory\n"); |
| 144 | err = -ENOMEM; |
| 145 | goto fail_io; |
| 146 | } |
| 147 | |
| 148 | irq = platform_get_irq(pdev, 0); |
| 149 | if (!irq) { |
| 150 | dev_err(&pdev->dev, "Failed to get IRQ\n"); |
| 151 | err = -ENODEV; |
Jingoo Han | 9cb0756 | 2012-06-28 16:29:46 +0900 | [diff] [blame] | 152 | goto fail_io; |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 153 | } |
| 154 | |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 155 | if (s5p_ehci->otg) |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 156 | s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self); |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 157 | |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 158 | if (s5p_ehci->phy) |
| 159 | usb_phy_init(s5p_ehci->phy); |
| 160 | else if (s5p_ehci->pdata->phy_init) |
| 161 | s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 162 | |
| 163 | ehci = hcd_to_ehci(hcd); |
| 164 | ehci->caps = hcd->regs; |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 165 | |
Jingoo Han | 88555a6 | 2012-03-05 10:40:14 +0900 | [diff] [blame] | 166 | /* DMA burst Enable */ |
| 167 | writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs)); |
| 168 | |
Yong Zhang | b5dd18d | 2011-09-07 16:10:52 +0800 | [diff] [blame] | 169 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 170 | if (err) { |
| 171 | dev_err(&pdev->dev, "Failed to add USB HCD\n"); |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 172 | goto fail_add_hcd; |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 173 | } |
| 174 | |
Vivek Gautam | bbcd85a | 2013-04-09 18:42:11 +0530 | [diff] [blame] | 175 | platform_set_drvdata(pdev, hcd); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 176 | |
| 177 | return 0; |
| 178 | |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 179 | fail_add_hcd: |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 180 | if (s5p_ehci->phy) |
| 181 | usb_phy_shutdown(s5p_ehci->phy); |
| 182 | else if (s5p_ehci->pdata->phy_exit) |
| 183 | s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 184 | fail_io: |
Thomas Abraham | e1deb56 | 2012-10-03 08:40:42 +0900 | [diff] [blame] | 185 | clk_disable_unprepare(s5p_ehci->clk); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 186 | fail_clk: |
| 187 | usb_put_hcd(hcd); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 188 | return err; |
| 189 | } |
| 190 | |
Bill Pemberton | fb4e98a | 2012-11-19 13:26:20 -0500 | [diff] [blame] | 191 | static int s5p_ehci_remove(struct platform_device *pdev) |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 192 | { |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 193 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
| 194 | struct s5p_ehci_hcd *s5p_ehci = to_s5p_ehci(hcd); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 195 | |
| 196 | usb_remove_hcd(hcd); |
| 197 | |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 198 | if (s5p_ehci->otg) |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 199 | s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self); |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 200 | |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 201 | if (s5p_ehci->phy) |
| 202 | usb_phy_shutdown(s5p_ehci->phy); |
| 203 | else if (s5p_ehci->pdata->phy_exit) |
| 204 | s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 205 | |
Thomas Abraham | e1deb56 | 2012-10-03 08:40:42 +0900 | [diff] [blame] | 206 | clk_disable_unprepare(s5p_ehci->clk); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 207 | |
| 208 | usb_put_hcd(hcd); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 209 | |
| 210 | return 0; |
| 211 | } |
| 212 | |
| 213 | static void s5p_ehci_shutdown(struct platform_device *pdev) |
| 214 | { |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 215 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 216 | |
| 217 | if (hcd->driver->shutdown) |
| 218 | hcd->driver->shutdown(hcd); |
| 219 | } |
| 220 | |
Jingoo Han | 1acb30e | 2011-05-20 20:48:33 +0900 | [diff] [blame] | 221 | #ifdef CONFIG_PM |
| 222 | static int s5p_ehci_suspend(struct device *dev) |
| 223 | { |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 224 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
| 225 | struct s5p_ehci_hcd *s5p_ehci = to_s5p_ehci(hcd); |
| 226 | struct platform_device *pdev = to_platform_device(dev); |
| 227 | |
Alan Stern | c5cf921 | 2012-06-28 11:19:02 -0400 | [diff] [blame] | 228 | bool do_wakeup = device_may_wakeup(dev); |
Alan Stern | c5cf921 | 2012-06-28 11:19:02 -0400 | [diff] [blame] | 229 | int rc; |
Jingoo Han | 1acb30e | 2011-05-20 20:48:33 +0900 | [diff] [blame] | 230 | |
Alan Stern | c5cf921 | 2012-06-28 11:19:02 -0400 | [diff] [blame] | 231 | rc = ehci_suspend(hcd, do_wakeup); |
Jingoo Han | 1acb30e | 2011-05-20 20:48:33 +0900 | [diff] [blame] | 232 | |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 233 | if (s5p_ehci->otg) |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 234 | s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self); |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 235 | |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 236 | if (s5p_ehci->phy) |
| 237 | usb_phy_shutdown(s5p_ehci->phy); |
| 238 | else if (s5p_ehci->pdata->phy_exit) |
| 239 | s5p_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST); |
Jingoo Han | 1acb30e | 2011-05-20 20:48:33 +0900 | [diff] [blame] | 240 | |
Thomas Abraham | e1deb56 | 2012-10-03 08:40:42 +0900 | [diff] [blame] | 241 | clk_disable_unprepare(s5p_ehci->clk); |
Jingoo Han | 8b4fc8c | 2012-04-13 11:06:36 +0900 | [diff] [blame] | 242 | |
Jingoo Han | 1acb30e | 2011-05-20 20:48:33 +0900 | [diff] [blame] | 243 | return rc; |
| 244 | } |
| 245 | |
| 246 | static int s5p_ehci_resume(struct device *dev) |
| 247 | { |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 248 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
| 249 | struct s5p_ehci_hcd *s5p_ehci = to_s5p_ehci(hcd); |
| 250 | struct platform_device *pdev = to_platform_device(dev); |
Jingoo Han | 1acb30e | 2011-05-20 20:48:33 +0900 | [diff] [blame] | 251 | |
Thomas Abraham | e1deb56 | 2012-10-03 08:40:42 +0900 | [diff] [blame] | 252 | clk_prepare_enable(s5p_ehci->clk); |
Jingoo Han | 8b4fc8c | 2012-04-13 11:06:36 +0900 | [diff] [blame] | 253 | |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 254 | if (s5p_ehci->otg) |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 255 | s5p_ehci->otg->set_host(s5p_ehci->otg, &hcd->self); |
Vivek Gautam | d233c19 | 2013-01-22 18:30:42 +0530 | [diff] [blame] | 256 | |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 257 | if (s5p_ehci->phy) |
| 258 | usb_phy_init(s5p_ehci->phy); |
| 259 | else if (s5p_ehci->pdata->phy_init) |
| 260 | s5p_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST); |
Jingoo Han | 1acb30e | 2011-05-20 20:48:33 +0900 | [diff] [blame] | 261 | |
Jingoo Han | 88555a6 | 2012-03-05 10:40:14 +0900 | [diff] [blame] | 262 | /* DMA burst Enable */ |
| 263 | writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs)); |
| 264 | |
Alan Stern | c5cf921 | 2012-06-28 11:19:02 -0400 | [diff] [blame] | 265 | ehci_resume(hcd, false); |
Jingoo Han | 1acb30e | 2011-05-20 20:48:33 +0900 | [diff] [blame] | 266 | return 0; |
| 267 | } |
| 268 | #else |
| 269 | #define s5p_ehci_suspend NULL |
| 270 | #define s5p_ehci_resume NULL |
| 271 | #endif |
| 272 | |
| 273 | static const struct dev_pm_ops s5p_ehci_pm_ops = { |
| 274 | .suspend = s5p_ehci_suspend, |
| 275 | .resume = s5p_ehci_resume, |
| 276 | }; |
| 277 | |
Vivek Gautam | 2c026e2 | 2012-07-16 11:25:37 +0530 | [diff] [blame] | 278 | #ifdef CONFIG_OF |
| 279 | static const struct of_device_id exynos_ehci_match[] = { |
Vivek Gautam | 6e24777 | 2013-01-24 19:15:29 +0530 | [diff] [blame] | 280 | { .compatible = "samsung,exynos4210-ehci" }, |
Vivek Gautam | 2c026e2 | 2012-07-16 11:25:37 +0530 | [diff] [blame] | 281 | {}, |
| 282 | }; |
| 283 | MODULE_DEVICE_TABLE(of, exynos_ehci_match); |
| 284 | #endif |
| 285 | |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 286 | static struct platform_driver s5p_ehci_driver = { |
| 287 | .probe = s5p_ehci_probe, |
Bill Pemberton | 7690417 | 2012-11-19 13:21:08 -0500 | [diff] [blame] | 288 | .remove = s5p_ehci_remove, |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 289 | .shutdown = s5p_ehci_shutdown, |
| 290 | .driver = { |
| 291 | .name = "s5p-ehci", |
| 292 | .owner = THIS_MODULE, |
Jingoo Han | 1acb30e | 2011-05-20 20:48:33 +0900 | [diff] [blame] | 293 | .pm = &s5p_ehci_pm_ops, |
Vivek Gautam | 2c026e2 | 2012-07-16 11:25:37 +0530 | [diff] [blame] | 294 | .of_match_table = of_match_ptr(exynos_ehci_match), |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 295 | } |
| 296 | }; |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 297 | static const struct ehci_driver_overrides s5p_overrides __initdata = { |
| 298 | .extra_priv_size = sizeof(struct s5p_ehci_hcd), |
| 299 | }; |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 300 | |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 301 | static int __init ehci_s5p_init(void) |
| 302 | { |
| 303 | if (usb_disabled()) |
| 304 | return -ENODEV; |
| 305 | |
| 306 | pr_info("%s: " DRIVER_DESC "\n", hcd_name); |
| 307 | ehci_init_driver(&s5p_ehci_hc_driver, &s5p_overrides); |
| 308 | return platform_driver_register(&s5p_ehci_driver); |
| 309 | } |
| 310 | module_init(ehci_s5p_init); |
| 311 | |
| 312 | static void __exit ehci_s5p_cleanup(void) |
| 313 | { |
| 314 | platform_driver_unregister(&s5p_ehci_driver); |
| 315 | } |
| 316 | module_exit(ehci_s5p_cleanup); |
| 317 | |
| 318 | MODULE_DESCRIPTION(DRIVER_DESC); |
Joonyoung Shim | 1bcc5aa | 2011-04-08 14:08:50 +0900 | [diff] [blame] | 319 | MODULE_ALIAS("platform:s5p-ehci"); |
Manjunath Goudar | 7edb3da | 2013-04-02 18:24:01 +0200 | [diff] [blame] | 320 | MODULE_AUTHOR("Jingoo Han"); |
| 321 | MODULE_AUTHOR("Joonyoung Shim"); |
| 322 | MODULE_LICENSE("GPL v2"); |