Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 1 | /* |
| 2 | * drivers/usb/otg/nop-usb-xceiv.c |
| 3 | * |
| 4 | * NOP USB transceiver for all USB transceiver which are either built-in |
| 5 | * into USB IP or which are mostly autonomous. |
| 6 | * |
| 7 | * Copyright (C) 2009 Texas Instruments Inc |
| 8 | * Author: Ajay Kumar Gupta <ajay.gupta@ti.com> |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 23 | * |
| 24 | * Current status: |
David Brownell | cc835e3 | 2009-03-31 12:28:31 -0700 | [diff] [blame] | 25 | * This provides a "nop" transceiver for PHYs which are |
| 26 | * autonomous such as isp1504, isp1707, etc. |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 27 | */ |
| 28 | |
| 29 | #include <linux/module.h> |
| 30 | #include <linux/platform_device.h> |
| 31 | #include <linux/dma-mapping.h> |
| 32 | #include <linux/usb/otg.h> |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 33 | #include <linux/usb/usb_phy_gen_xceiv.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 34 | #include <linux/slab.h> |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 35 | #include <linux/clk.h> |
Roger Quadros | 58f735f | 2013-03-12 13:24:22 +0200 | [diff] [blame] | 36 | #include <linux/regulator/consumer.h> |
Roger Quadros | 0eba387 | 2013-03-12 13:24:25 +0200 | [diff] [blame] | 37 | #include <linux/of.h> |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 38 | |
Sebastian Andrzej Siewior | 53b6fc2 | 2013-07-30 17:20:06 +0200 | [diff] [blame] | 39 | #include "phy-generic.h" |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 40 | |
David Brownell | cc835e3 | 2009-03-31 12:28:31 -0700 | [diff] [blame] | 41 | static struct platform_device *pd; |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 42 | |
| 43 | void usb_nop_xceiv_register(void) |
| 44 | { |
David Brownell | cc835e3 | 2009-03-31 12:28:31 -0700 | [diff] [blame] | 45 | if (pd) |
| 46 | return; |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 47 | pd = platform_device_register_simple("usb_phy_gen_xceiv", -1, NULL, 0); |
David Brownell | cc835e3 | 2009-03-31 12:28:31 -0700 | [diff] [blame] | 48 | if (!pd) { |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 49 | pr_err("Unable to register generic usb transceiver\n"); |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 50 | return; |
| 51 | } |
| 52 | } |
David Brownell | cc835e3 | 2009-03-31 12:28:31 -0700 | [diff] [blame] | 53 | EXPORT_SYMBOL(usb_nop_xceiv_register); |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 54 | |
| 55 | void usb_nop_xceiv_unregister(void) |
| 56 | { |
David Brownell | cc835e3 | 2009-03-31 12:28:31 -0700 | [diff] [blame] | 57 | platform_device_unregister(pd); |
Ajay Kumar Gupta | dc7520c | 2009-07-03 13:18:45 +0530 | [diff] [blame] | 58 | pd = NULL; |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 59 | } |
David Brownell | cc835e3 | 2009-03-31 12:28:31 -0700 | [diff] [blame] | 60 | EXPORT_SYMBOL(usb_nop_xceiv_unregister); |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 61 | |
Heikki Krogerus | 8675381 | 2012-02-13 13:24:02 +0200 | [diff] [blame] | 62 | static int nop_set_suspend(struct usb_phy *x, int suspend) |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 63 | { |
| 64 | return 0; |
| 65 | } |
| 66 | |
Sebastian Andrzej Siewior | 53b6fc2 | 2013-07-30 17:20:06 +0200 | [diff] [blame] | 67 | int usb_gen_phy_init(struct usb_phy *phy) |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 68 | { |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 69 | struct usb_phy_gen_xceiv *nop = dev_get_drvdata(phy->dev); |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 70 | |
Roger Quadros | 58f735f | 2013-03-12 13:24:22 +0200 | [diff] [blame] | 71 | if (!IS_ERR(nop->vcc)) { |
| 72 | if (regulator_enable(nop->vcc)) |
| 73 | dev_err(phy->dev, "Failed to enable power\n"); |
| 74 | } |
| 75 | |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 76 | if (!IS_ERR(nop->clk)) |
| 77 | clk_enable(nop->clk); |
| 78 | |
Roger Quadros | ad63ebfc | 2013-03-12 13:24:23 +0200 | [diff] [blame] | 79 | if (!IS_ERR(nop->reset)) { |
| 80 | /* De-assert RESET */ |
| 81 | if (regulator_enable(nop->reset)) |
| 82 | dev_err(phy->dev, "Failed to de-assert reset\n"); |
| 83 | } |
| 84 | |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 85 | return 0; |
| 86 | } |
Sebastian Andrzej Siewior | 53b6fc2 | 2013-07-30 17:20:06 +0200 | [diff] [blame] | 87 | EXPORT_SYMBOL_GPL(usb_gen_phy_init); |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 88 | |
Sebastian Andrzej Siewior | 53b6fc2 | 2013-07-30 17:20:06 +0200 | [diff] [blame] | 89 | void usb_gen_phy_shutdown(struct usb_phy *phy) |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 90 | { |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 91 | struct usb_phy_gen_xceiv *nop = dev_get_drvdata(phy->dev); |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 92 | |
Roger Quadros | ad63ebfc | 2013-03-12 13:24:23 +0200 | [diff] [blame] | 93 | if (!IS_ERR(nop->reset)) { |
| 94 | /* Assert RESET */ |
| 95 | if (regulator_disable(nop->reset)) |
| 96 | dev_err(phy->dev, "Failed to assert reset\n"); |
| 97 | } |
| 98 | |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 99 | if (!IS_ERR(nop->clk)) |
| 100 | clk_disable(nop->clk); |
Roger Quadros | 58f735f | 2013-03-12 13:24:22 +0200 | [diff] [blame] | 101 | |
| 102 | if (!IS_ERR(nop->vcc)) { |
| 103 | if (regulator_disable(nop->vcc)) |
| 104 | dev_err(phy->dev, "Failed to disable power\n"); |
| 105 | } |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 106 | } |
Sebastian Andrzej Siewior | 53b6fc2 | 2013-07-30 17:20:06 +0200 | [diff] [blame] | 107 | EXPORT_SYMBOL_GPL(usb_gen_phy_shutdown); |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 108 | |
Heikki Krogerus | 41adf10 | 2012-02-13 13:24:10 +0200 | [diff] [blame] | 109 | static int nop_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 110 | { |
Heikki Krogerus | 41adf10 | 2012-02-13 13:24:10 +0200 | [diff] [blame] | 111 | if (!otg) |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 112 | return -ENODEV; |
| 113 | |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 114 | if (!gadget) { |
Heikki Krogerus | 41adf10 | 2012-02-13 13:24:10 +0200 | [diff] [blame] | 115 | otg->gadget = NULL; |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 116 | return -ENODEV; |
| 117 | } |
| 118 | |
Heikki Krogerus | 41adf10 | 2012-02-13 13:24:10 +0200 | [diff] [blame] | 119 | otg->gadget = gadget; |
| 120 | otg->phy->state = OTG_STATE_B_IDLE; |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 121 | return 0; |
| 122 | } |
| 123 | |
Heikki Krogerus | 41adf10 | 2012-02-13 13:24:10 +0200 | [diff] [blame] | 124 | static int nop_set_host(struct usb_otg *otg, struct usb_bus *host) |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 125 | { |
Heikki Krogerus | 41adf10 | 2012-02-13 13:24:10 +0200 | [diff] [blame] | 126 | if (!otg) |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 127 | return -ENODEV; |
| 128 | |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 129 | if (!host) { |
Heikki Krogerus | 41adf10 | 2012-02-13 13:24:10 +0200 | [diff] [blame] | 130 | otg->host = NULL; |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 131 | return -ENODEV; |
| 132 | } |
| 133 | |
Heikki Krogerus | 41adf10 | 2012-02-13 13:24:10 +0200 | [diff] [blame] | 134 | otg->host = host; |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 135 | return 0; |
| 136 | } |
| 137 | |
Sebastian Andrzej Siewior | 53b6fc2 | 2013-07-30 17:20:06 +0200 | [diff] [blame] | 138 | int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_gen_xceiv *nop, |
| 139 | enum usb_phy_type type, u32 clk_rate, bool needs_vcc, |
| 140 | bool needs_reset) |
| 141 | { |
| 142 | int err; |
| 143 | |
| 144 | nop->phy.otg = devm_kzalloc(dev, sizeof(*nop->phy.otg), |
| 145 | GFP_KERNEL); |
| 146 | if (!nop->phy.otg) |
| 147 | return -ENOMEM; |
| 148 | |
| 149 | nop->clk = devm_clk_get(dev, "main_clk"); |
| 150 | if (IS_ERR(nop->clk)) { |
| 151 | dev_dbg(dev, "Can't get phy clock: %ld\n", |
| 152 | PTR_ERR(nop->clk)); |
| 153 | } |
| 154 | |
| 155 | if (!IS_ERR(nop->clk) && clk_rate) { |
| 156 | err = clk_set_rate(nop->clk, clk_rate); |
| 157 | if (err) { |
| 158 | dev_err(dev, "Error setting clock rate\n"); |
| 159 | return err; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | if (!IS_ERR(nop->clk)) { |
| 164 | err = clk_prepare(nop->clk); |
| 165 | if (err) { |
| 166 | dev_err(dev, "Error preparing clock\n"); |
| 167 | return err; |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | nop->vcc = devm_regulator_get(dev, "vcc"); |
| 172 | if (IS_ERR(nop->vcc)) { |
| 173 | dev_dbg(dev, "Error getting vcc regulator: %ld\n", |
| 174 | PTR_ERR(nop->vcc)); |
| 175 | if (needs_vcc) |
| 176 | return -EPROBE_DEFER; |
| 177 | } |
| 178 | |
| 179 | nop->reset = devm_regulator_get(dev, "reset"); |
| 180 | if (IS_ERR(nop->reset)) { |
| 181 | dev_dbg(dev, "Error getting reset regulator: %ld\n", |
| 182 | PTR_ERR(nop->reset)); |
| 183 | if (needs_reset) |
| 184 | return -EPROBE_DEFER; |
| 185 | } |
| 186 | |
| 187 | nop->dev = dev; |
| 188 | nop->phy.dev = nop->dev; |
| 189 | nop->phy.label = "nop-xceiv"; |
| 190 | nop->phy.set_suspend = nop_set_suspend; |
| 191 | nop->phy.state = OTG_STATE_UNDEFINED; |
| 192 | nop->phy.type = type; |
| 193 | |
| 194 | nop->phy.otg->phy = &nop->phy; |
| 195 | nop->phy.otg->set_host = nop_set_host; |
| 196 | nop->phy.otg->set_peripheral = nop_set_peripheral; |
| 197 | |
| 198 | ATOMIC_INIT_NOTIFIER_HEAD(&nop->phy.notifier); |
| 199 | return 0; |
| 200 | } |
| 201 | EXPORT_SYMBOL_GPL(usb_phy_gen_create_phy); |
| 202 | |
| 203 | void usb_phy_gen_cleanup_phy(struct usb_phy_gen_xceiv *nop) |
| 204 | { |
| 205 | if (!IS_ERR(nop->clk)) |
| 206 | clk_unprepare(nop->clk); |
| 207 | } |
| 208 | EXPORT_SYMBOL_GPL(usb_phy_gen_cleanup_phy); |
| 209 | |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 210 | static int usb_phy_gen_xceiv_probe(struct platform_device *pdev) |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 211 | { |
Roger Quadros | 0eba387 | 2013-03-12 13:24:25 +0200 | [diff] [blame] | 212 | struct device *dev = &pdev->dev; |
Felipe Balbi | 9e5f9c8 | 2013-08-09 17:31:23 +0300 | [diff] [blame] | 213 | struct usb_phy_gen_xceiv_platform_data *pdata = |
Jingoo Han | 19f9e18 | 2013-07-30 17:02:13 +0900 | [diff] [blame] | 214 | dev_get_platdata(&pdev->dev); |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 215 | struct usb_phy_gen_xceiv *nop; |
Felipe Balbi | c84d364 | 2012-07-19 13:38:06 +0300 | [diff] [blame] | 216 | enum usb_phy_type type = USB_PHY_TYPE_USB2; |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 217 | int err; |
Roger Quadros | 0eba387 | 2013-03-12 13:24:25 +0200 | [diff] [blame] | 218 | u32 clk_rate = 0; |
Roger Quadros | b54b5f5 | 2013-03-12 13:24:26 +0200 | [diff] [blame] | 219 | bool needs_vcc = false; |
| 220 | bool needs_reset = false; |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 221 | |
Roger Quadros | 0eba387 | 2013-03-12 13:24:25 +0200 | [diff] [blame] | 222 | if (dev->of_node) { |
| 223 | struct device_node *node = dev->of_node; |
| 224 | |
| 225 | if (of_property_read_u32(node, "clock-frequency", &clk_rate)) |
| 226 | clk_rate = 0; |
| 227 | |
Roger Quadros | b54b5f5 | 2013-03-12 13:24:26 +0200 | [diff] [blame] | 228 | needs_vcc = of_property_read_bool(node, "vcc-supply"); |
| 229 | needs_reset = of_property_read_bool(node, "reset-supply"); |
| 230 | |
Roger Quadros | 0eba387 | 2013-03-12 13:24:25 +0200 | [diff] [blame] | 231 | } else if (pdata) { |
Felipe Balbi | c84d364 | 2012-07-19 13:38:06 +0300 | [diff] [blame] | 232 | type = pdata->type; |
Roger Quadros | 0eba387 | 2013-03-12 13:24:25 +0200 | [diff] [blame] | 233 | clk_rate = pdata->clk_rate; |
Roger Quadros | b54b5f5 | 2013-03-12 13:24:26 +0200 | [diff] [blame] | 234 | needs_vcc = pdata->needs_vcc; |
| 235 | needs_reset = pdata->needs_reset; |
Roger Quadros | 0eba387 | 2013-03-12 13:24:25 +0200 | [diff] [blame] | 236 | } |
Felipe Balbi | c84d364 | 2012-07-19 13:38:06 +0300 | [diff] [blame] | 237 | |
Sebastian Andrzej Siewior | 53b6fc2 | 2013-07-30 17:20:06 +0200 | [diff] [blame] | 238 | nop = devm_kzalloc(dev, sizeof(*nop), GFP_KERNEL); |
| 239 | if (!nop) |
| 240 | return -ENOMEM; |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 241 | |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 242 | |
Sebastian Andrzej Siewior | 53b6fc2 | 2013-07-30 17:20:06 +0200 | [diff] [blame] | 243 | err = usb_phy_gen_create_phy(dev, nop, type, clk_rate, needs_vcc, |
| 244 | needs_reset); |
| 245 | if (err) |
| 246 | return err; |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 247 | |
Sebastian Andrzej Siewior | 53b6fc2 | 2013-07-30 17:20:06 +0200 | [diff] [blame] | 248 | nop->phy.init = usb_gen_phy_init; |
| 249 | nop->phy.shutdown = usb_gen_phy_shutdown; |
Heikki Krogerus | 41adf10 | 2012-02-13 13:24:10 +0200 | [diff] [blame] | 250 | |
Roger Quadros | 90f4232 | 2013-03-12 13:24:24 +0200 | [diff] [blame] | 251 | err = usb_add_phy_dev(&nop->phy); |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 252 | if (err) { |
| 253 | dev_err(&pdev->dev, "can't register transceiver, err: %d\n", |
| 254 | err); |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 255 | goto err_add; |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | platform_set_drvdata(pdev, nop); |
| 259 | |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 260 | return 0; |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 261 | |
| 262 | err_add: |
Sebastian Andrzej Siewior | 53b6fc2 | 2013-07-30 17:20:06 +0200 | [diff] [blame] | 263 | usb_phy_gen_cleanup_phy(nop); |
Roger Quadros | 2319fb8 | 2013-03-12 13:24:21 +0200 | [diff] [blame] | 264 | return err; |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 265 | } |
| 266 | |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 267 | static int usb_phy_gen_xceiv_remove(struct platform_device *pdev) |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 268 | { |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 269 | struct usb_phy_gen_xceiv *nop = platform_get_drvdata(pdev); |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 270 | |
Sebastian Andrzej Siewior | 53b6fc2 | 2013-07-30 17:20:06 +0200 | [diff] [blame] | 271 | usb_phy_gen_cleanup_phy(nop); |
Kishon Vijay Abraham I | 662dca5 | 2012-06-22 17:02:46 +0530 | [diff] [blame] | 272 | usb_remove_phy(&nop->phy); |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 273 | |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 274 | return 0; |
| 275 | } |
| 276 | |
Roger Quadros | 0eba387 | 2013-03-12 13:24:25 +0200 | [diff] [blame] | 277 | static const struct of_device_id nop_xceiv_dt_ids[] = { |
| 278 | { .compatible = "usb-nop-xceiv" }, |
| 279 | { } |
| 280 | }; |
| 281 | |
| 282 | MODULE_DEVICE_TABLE(of, nop_xceiv_dt_ids); |
| 283 | |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 284 | static struct platform_driver usb_phy_gen_xceiv_driver = { |
| 285 | .probe = usb_phy_gen_xceiv_probe, |
| 286 | .remove = usb_phy_gen_xceiv_remove, |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 287 | .driver = { |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 288 | .name = "usb_phy_gen_xceiv", |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 289 | .owner = THIS_MODULE, |
Sachin Kamat | 5462b0d | 2013-05-21 17:17:22 +0530 | [diff] [blame] | 290 | .of_match_table = nop_xceiv_dt_ids, |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 291 | }, |
| 292 | }; |
| 293 | |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 294 | static int __init usb_phy_gen_xceiv_init(void) |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 295 | { |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 296 | return platform_driver_register(&usb_phy_gen_xceiv_driver); |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 297 | } |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 298 | subsys_initcall(usb_phy_gen_xceiv_init); |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 299 | |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 300 | static void __exit usb_phy_gen_xceiv_exit(void) |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 301 | { |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 302 | platform_driver_unregister(&usb_phy_gen_xceiv_driver); |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 303 | } |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 304 | module_exit(usb_phy_gen_xceiv_exit); |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 305 | |
Sebastian Andrzej Siewior | 3fa4d73 | 2013-07-26 12:16:42 +0200 | [diff] [blame] | 306 | MODULE_ALIAS("platform:usb_phy_gen_xceiv"); |
Ajay Kumar Gupta | f6d92a0 | 2009-02-06 17:32:35 +0530 | [diff] [blame] | 307 | MODULE_AUTHOR("Texas Instruments Inc"); |
| 308 | MODULE_DESCRIPTION("NOP USB Transceiver driver"); |
| 309 | MODULE_LICENSE("GPL"); |