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