phy-core.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. /*
  2. * phy-core.c -- Generic Phy framework.
  3. *
  4. * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
  5. *
  6. * Author: Kishon Vijay Abraham I <kishon@ti.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. #include <linux/kernel.h>
  14. #include <linux/export.h>
  15. #include <linux/module.h>
  16. #include <linux/err.h>
  17. #include <linux/device.h>
  18. #include <linux/slab.h>
  19. #include <linux/of.h>
  20. #include <linux/phy/phy.h>
  21. #include <linux/idr.h>
  22. #include <linux/pm_runtime.h>
  23. static struct class *phy_class;
  24. static DEFINE_MUTEX(phy_provider_mutex);
  25. static LIST_HEAD(phy_provider_list);
  26. static DEFINE_IDA(phy_ida);
  27. static void devm_phy_release(struct device *dev, void *res)
  28. {
  29. struct phy *phy = *(struct phy **)res;
  30. phy_put(phy);
  31. }
  32. static void devm_phy_provider_release(struct device *dev, void *res)
  33. {
  34. struct phy_provider *phy_provider = *(struct phy_provider **)res;
  35. of_phy_provider_unregister(phy_provider);
  36. }
  37. static void devm_phy_consume(struct device *dev, void *res)
  38. {
  39. struct phy *phy = *(struct phy **)res;
  40. phy_destroy(phy);
  41. }
  42. static int devm_phy_match(struct device *dev, void *res, void *match_data)
  43. {
  44. return res == match_data;
  45. }
  46. static struct phy *phy_lookup(struct device *device, const char *port)
  47. {
  48. unsigned int count;
  49. struct phy *phy;
  50. struct device *dev;
  51. struct phy_consumer *consumers;
  52. struct class_dev_iter iter;
  53. class_dev_iter_init(&iter, phy_class, NULL, NULL);
  54. while ((dev = class_dev_iter_next(&iter))) {
  55. phy = to_phy(dev);
  56. count = phy->init_data->num_consumers;
  57. consumers = phy->init_data->consumers;
  58. while (count--) {
  59. if (!strcmp(consumers->dev_name, dev_name(device)) &&
  60. !strcmp(consumers->port, port)) {
  61. class_dev_iter_exit(&iter);
  62. return phy;
  63. }
  64. consumers++;
  65. }
  66. }
  67. class_dev_iter_exit(&iter);
  68. return ERR_PTR(-ENODEV);
  69. }
  70. static struct phy_provider *of_phy_provider_lookup(struct device_node *node)
  71. {
  72. struct phy_provider *phy_provider;
  73. list_for_each_entry(phy_provider, &phy_provider_list, list) {
  74. if (phy_provider->dev->of_node == node)
  75. return phy_provider;
  76. }
  77. return ERR_PTR(-EPROBE_DEFER);
  78. }
  79. int phy_pm_runtime_get(struct phy *phy)
  80. {
  81. if (!pm_runtime_enabled(&phy->dev))
  82. return -ENOTSUPP;
  83. return pm_runtime_get(&phy->dev);
  84. }
  85. EXPORT_SYMBOL_GPL(phy_pm_runtime_get);
  86. int phy_pm_runtime_get_sync(struct phy *phy)
  87. {
  88. if (!pm_runtime_enabled(&phy->dev))
  89. return -ENOTSUPP;
  90. return pm_runtime_get_sync(&phy->dev);
  91. }
  92. EXPORT_SYMBOL_GPL(phy_pm_runtime_get_sync);
  93. int phy_pm_runtime_put(struct phy *phy)
  94. {
  95. if (!pm_runtime_enabled(&phy->dev))
  96. return -ENOTSUPP;
  97. return pm_runtime_put(&phy->dev);
  98. }
  99. EXPORT_SYMBOL_GPL(phy_pm_runtime_put);
  100. int phy_pm_runtime_put_sync(struct phy *phy)
  101. {
  102. if (!pm_runtime_enabled(&phy->dev))
  103. return -ENOTSUPP;
  104. return pm_runtime_put_sync(&phy->dev);
  105. }
  106. EXPORT_SYMBOL_GPL(phy_pm_runtime_put_sync);
  107. void phy_pm_runtime_allow(struct phy *phy)
  108. {
  109. if (!pm_runtime_enabled(&phy->dev))
  110. return;
  111. pm_runtime_allow(&phy->dev);
  112. }
  113. EXPORT_SYMBOL_GPL(phy_pm_runtime_allow);
  114. void phy_pm_runtime_forbid(struct phy *phy)
  115. {
  116. if (!pm_runtime_enabled(&phy->dev))
  117. return;
  118. pm_runtime_forbid(&phy->dev);
  119. }
  120. EXPORT_SYMBOL_GPL(phy_pm_runtime_forbid);
  121. int phy_init(struct phy *phy)
  122. {
  123. int ret;
  124. ret = phy_pm_runtime_get_sync(phy);
  125. if (ret < 0 && ret != -ENOTSUPP)
  126. return ret;
  127. mutex_lock(&phy->mutex);
  128. if (phy->init_count++ == 0 && phy->ops->init) {
  129. ret = phy->ops->init(phy);
  130. if (ret < 0) {
  131. dev_err(&phy->dev, "phy init failed --> %d\n", ret);
  132. goto out;
  133. }
  134. }
  135. out:
  136. mutex_unlock(&phy->mutex);
  137. phy_pm_runtime_put(phy);
  138. return ret;
  139. }
  140. EXPORT_SYMBOL_GPL(phy_init);
  141. int phy_exit(struct phy *phy)
  142. {
  143. int ret;
  144. ret = phy_pm_runtime_get_sync(phy);
  145. if (ret < 0 && ret != -ENOTSUPP)
  146. return ret;
  147. mutex_lock(&phy->mutex);
  148. if (--phy->init_count == 0 && phy->ops->exit) {
  149. ret = phy->ops->exit(phy);
  150. if (ret < 0) {
  151. dev_err(&phy->dev, "phy exit failed --> %d\n", ret);
  152. goto out;
  153. }
  154. }
  155. out:
  156. mutex_unlock(&phy->mutex);
  157. phy_pm_runtime_put(phy);
  158. return ret;
  159. }
  160. EXPORT_SYMBOL_GPL(phy_exit);
  161. int phy_power_on(struct phy *phy)
  162. {
  163. int ret = -ENOTSUPP;
  164. ret = phy_pm_runtime_get_sync(phy);
  165. if (ret < 0 && ret != -ENOTSUPP)
  166. return ret;
  167. mutex_lock(&phy->mutex);
  168. if (phy->power_count++ == 0 && phy->ops->power_on) {
  169. ret = phy->ops->power_on(phy);
  170. if (ret < 0) {
  171. dev_err(&phy->dev, "phy poweron failed --> %d\n", ret);
  172. goto out;
  173. }
  174. }
  175. out:
  176. mutex_unlock(&phy->mutex);
  177. return ret;
  178. }
  179. EXPORT_SYMBOL_GPL(phy_power_on);
  180. int phy_power_off(struct phy *phy)
  181. {
  182. int ret = -ENOTSUPP;
  183. mutex_lock(&phy->mutex);
  184. if (--phy->power_count == 0 && phy->ops->power_off) {
  185. ret = phy->ops->power_off(phy);
  186. if (ret < 0) {
  187. dev_err(&phy->dev, "phy poweroff failed --> %d\n", ret);
  188. goto out;
  189. }
  190. }
  191. out:
  192. mutex_unlock(&phy->mutex);
  193. phy_pm_runtime_put(phy);
  194. return ret;
  195. }
  196. EXPORT_SYMBOL_GPL(phy_power_off);
  197. /**
  198. * of_phy_get() - lookup and obtain a reference to a phy by phandle
  199. * @dev: device that requests this phy
  200. * @index: the index of the phy
  201. *
  202. * Returns the phy associated with the given phandle value,
  203. * after getting a refcount to it or -ENODEV if there is no such phy or
  204. * -EPROBE_DEFER if there is a phandle to the phy, but the device is
  205. * not yet loaded. This function uses of_xlate call back function provided
  206. * while registering the phy_provider to find the phy instance.
  207. */
  208. static struct phy *of_phy_get(struct device *dev, int index)
  209. {
  210. int ret;
  211. struct phy_provider *phy_provider;
  212. struct phy *phy = NULL;
  213. struct of_phandle_args args;
  214. ret = of_parse_phandle_with_args(dev->of_node, "phys", "#phy-cells",
  215. index, &args);
  216. if (ret) {
  217. dev_dbg(dev, "failed to get phy in %s node\n",
  218. dev->of_node->full_name);
  219. return ERR_PTR(-ENODEV);
  220. }
  221. mutex_lock(&phy_provider_mutex);
  222. phy_provider = of_phy_provider_lookup(args.np);
  223. if (IS_ERR(phy_provider) || !try_module_get(phy_provider->owner)) {
  224. phy = ERR_PTR(-EPROBE_DEFER);
  225. goto err0;
  226. }
  227. phy = phy_provider->of_xlate(phy_provider->dev, &args);
  228. module_put(phy_provider->owner);
  229. err0:
  230. mutex_unlock(&phy_provider_mutex);
  231. of_node_put(args.np);
  232. return phy;
  233. }
  234. /**
  235. * phy_put() - release the PHY
  236. * @phy: the phy returned by phy_get()
  237. *
  238. * Releases a refcount the caller received from phy_get().
  239. */
  240. void phy_put(struct phy *phy)
  241. {
  242. if (IS_ERR(phy))
  243. return;
  244. module_put(phy->ops->owner);
  245. put_device(&phy->dev);
  246. }
  247. EXPORT_SYMBOL_GPL(phy_put);
  248. /**
  249. * devm_phy_put() - release the PHY
  250. * @dev: device that wants to release this phy
  251. * @phy: the phy returned by devm_phy_get()
  252. *
  253. * destroys the devres associated with this phy and invokes phy_put
  254. * to release the phy.
  255. */
  256. void devm_phy_put(struct device *dev, struct phy *phy)
  257. {
  258. int r;
  259. r = devres_destroy(dev, devm_phy_release, devm_phy_match, phy);
  260. dev_WARN_ONCE(dev, r, "couldn't find PHY resource\n");
  261. }
  262. EXPORT_SYMBOL_GPL(devm_phy_put);
  263. /**
  264. * of_phy_simple_xlate() - returns the phy instance from phy provider
  265. * @dev: the PHY provider device
  266. * @args: of_phandle_args (not used here)
  267. *
  268. * Intended to be used by phy provider for the common case where #phy-cells is
  269. * 0. For other cases where #phy-cells is greater than '0', the phy provider
  270. * should provide a custom of_xlate function that reads the *args* and returns
  271. * the appropriate phy.
  272. */
  273. struct phy *of_phy_simple_xlate(struct device *dev, struct of_phandle_args
  274. *args)
  275. {
  276. struct phy *phy;
  277. struct class_dev_iter iter;
  278. struct device_node *node = dev->of_node;
  279. class_dev_iter_init(&iter, phy_class, NULL, NULL);
  280. while ((dev = class_dev_iter_next(&iter))) {
  281. phy = to_phy(dev);
  282. if (node != phy->dev.of_node)
  283. continue;
  284. class_dev_iter_exit(&iter);
  285. return phy;
  286. }
  287. class_dev_iter_exit(&iter);
  288. return ERR_PTR(-ENODEV);
  289. }
  290. EXPORT_SYMBOL_GPL(of_phy_simple_xlate);
  291. /**
  292. * phy_get() - lookup and obtain a reference to a phy.
  293. * @dev: device that requests this phy
  294. * @string: the phy name as given in the dt data or the name of the controller
  295. * port for non-dt case
  296. *
  297. * Returns the phy driver, after getting a refcount to it; or
  298. * -ENODEV if there is no such phy. The caller is responsible for
  299. * calling phy_put() to release that count.
  300. */
  301. struct phy *phy_get(struct device *dev, const char *string)
  302. {
  303. int index = 0;
  304. struct phy *phy = NULL;
  305. if (string == NULL) {
  306. dev_WARN(dev, "missing string\n");
  307. return ERR_PTR(-EINVAL);
  308. }
  309. if (dev->of_node) {
  310. index = of_property_match_string(dev->of_node, "phy-names",
  311. string);
  312. phy = of_phy_get(dev, index);
  313. if (IS_ERR(phy)) {
  314. dev_err(dev, "unable to find phy\n");
  315. return phy;
  316. }
  317. } else {
  318. phy = phy_lookup(dev, string);
  319. if (IS_ERR(phy)) {
  320. dev_err(dev, "unable to find phy\n");
  321. return phy;
  322. }
  323. }
  324. if (!try_module_get(phy->ops->owner))
  325. return ERR_PTR(-EPROBE_DEFER);
  326. get_device(&phy->dev);
  327. return phy;
  328. }
  329. EXPORT_SYMBOL_GPL(phy_get);
  330. /**
  331. * devm_phy_get() - lookup and obtain a reference to a phy.
  332. * @dev: device that requests this phy
  333. * @string: the phy name as given in the dt data or phy device name
  334. * for non-dt case
  335. *
  336. * Gets the phy using phy_get(), and associates a device with it using
  337. * devres. On driver detach, release function is invoked on the devres data,
  338. * then, devres data is freed.
  339. */
  340. struct phy *devm_phy_get(struct device *dev, const char *string)
  341. {
  342. struct phy **ptr, *phy;
  343. ptr = devres_alloc(devm_phy_release, sizeof(*ptr), GFP_KERNEL);
  344. if (!ptr)
  345. return ERR_PTR(-ENOMEM);
  346. phy = phy_get(dev, string);
  347. if (!IS_ERR(phy)) {
  348. *ptr = phy;
  349. devres_add(dev, ptr);
  350. } else {
  351. devres_free(ptr);
  352. }
  353. return phy;
  354. }
  355. EXPORT_SYMBOL_GPL(devm_phy_get);
  356. /**
  357. * phy_create() - create a new phy
  358. * @dev: device that is creating the new phy
  359. * @ops: function pointers for performing phy operations
  360. * @init_data: contains the list of PHY consumers or NULL
  361. *
  362. * Called to create a phy using phy framework.
  363. */
  364. struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
  365. struct phy_init_data *init_data)
  366. {
  367. int ret;
  368. int id;
  369. struct phy *phy;
  370. if (!dev) {
  371. dev_WARN(dev, "no device provided for PHY\n");
  372. ret = -EINVAL;
  373. goto err0;
  374. }
  375. phy = kzalloc(sizeof(*phy), GFP_KERNEL);
  376. if (!phy) {
  377. ret = -ENOMEM;
  378. goto err0;
  379. }
  380. id = ida_simple_get(&phy_ida, 0, 0, GFP_KERNEL);
  381. if (id < 0) {
  382. dev_err(dev, "unable to get id\n");
  383. ret = id;
  384. goto err0;
  385. }
  386. device_initialize(&phy->dev);
  387. mutex_init(&phy->mutex);
  388. phy->dev.class = phy_class;
  389. phy->dev.parent = dev;
  390. phy->dev.of_node = dev->of_node;
  391. phy->id = id;
  392. phy->ops = ops;
  393. phy->init_data = init_data;
  394. ret = dev_set_name(&phy->dev, "phy-%s.%d", dev_name(dev), id);
  395. if (ret)
  396. goto err1;
  397. ret = device_add(&phy->dev);
  398. if (ret)
  399. goto err1;
  400. if (pm_runtime_enabled(dev)) {
  401. pm_runtime_enable(&phy->dev);
  402. pm_runtime_no_callbacks(&phy->dev);
  403. }
  404. return phy;
  405. err1:
  406. ida_remove(&phy_ida, phy->id);
  407. put_device(&phy->dev);
  408. kfree(phy);
  409. err0:
  410. return ERR_PTR(ret);
  411. }
  412. EXPORT_SYMBOL_GPL(phy_create);
  413. /**
  414. * devm_phy_create() - create a new phy
  415. * @dev: device that is creating the new phy
  416. * @ops: function pointers for performing phy operations
  417. * @init_data: contains the list of PHY consumers or NULL
  418. *
  419. * Creates a new PHY device adding it to the PHY class.
  420. * While at that, it also associates the device with the phy using devres.
  421. * On driver detach, release function is invoked on the devres data,
  422. * then, devres data is freed.
  423. */
  424. struct phy *devm_phy_create(struct device *dev, const struct phy_ops *ops,
  425. struct phy_init_data *init_data)
  426. {
  427. struct phy **ptr, *phy;
  428. ptr = devres_alloc(devm_phy_consume, sizeof(*ptr), GFP_KERNEL);
  429. if (!ptr)
  430. return ERR_PTR(-ENOMEM);
  431. phy = phy_create(dev, ops, init_data);
  432. if (!IS_ERR(phy)) {
  433. *ptr = phy;
  434. devres_add(dev, ptr);
  435. } else {
  436. devres_free(ptr);
  437. }
  438. return phy;
  439. }
  440. EXPORT_SYMBOL_GPL(devm_phy_create);
  441. /**
  442. * phy_destroy() - destroy the phy
  443. * @phy: the phy to be destroyed
  444. *
  445. * Called to destroy the phy.
  446. */
  447. void phy_destroy(struct phy *phy)
  448. {
  449. pm_runtime_disable(&phy->dev);
  450. device_unregister(&phy->dev);
  451. }
  452. EXPORT_SYMBOL_GPL(phy_destroy);
  453. /**
  454. * devm_phy_destroy() - destroy the PHY
  455. * @dev: device that wants to release this phy
  456. * @phy: the phy returned by devm_phy_get()
  457. *
  458. * destroys the devres associated with this phy and invokes phy_destroy
  459. * to destroy the phy.
  460. */
  461. void devm_phy_destroy(struct device *dev, struct phy *phy)
  462. {
  463. int r;
  464. r = devres_destroy(dev, devm_phy_consume, devm_phy_match, phy);
  465. dev_WARN_ONCE(dev, r, "couldn't find PHY resource\n");
  466. }
  467. EXPORT_SYMBOL_GPL(devm_phy_destroy);
  468. /**
  469. * __of_phy_provider_register() - create/register phy provider with the framework
  470. * @dev: struct device of the phy provider
  471. * @owner: the module owner containing of_xlate
  472. * @of_xlate: function pointer to obtain phy instance from phy provider
  473. *
  474. * Creates struct phy_provider from dev and of_xlate function pointer.
  475. * This is used in the case of dt boot for finding the phy instance from
  476. * phy provider.
  477. */
  478. struct phy_provider *__of_phy_provider_register(struct device *dev,
  479. struct module *owner, struct phy * (*of_xlate)(struct device *dev,
  480. struct of_phandle_args *args))
  481. {
  482. struct phy_provider *phy_provider;
  483. phy_provider = kzalloc(sizeof(*phy_provider), GFP_KERNEL);
  484. if (!phy_provider)
  485. return ERR_PTR(-ENOMEM);
  486. phy_provider->dev = dev;
  487. phy_provider->owner = owner;
  488. phy_provider->of_xlate = of_xlate;
  489. mutex_lock(&phy_provider_mutex);
  490. list_add_tail(&phy_provider->list, &phy_provider_list);
  491. mutex_unlock(&phy_provider_mutex);
  492. return phy_provider;
  493. }
  494. EXPORT_SYMBOL_GPL(__of_phy_provider_register);
  495. /**
  496. * __devm_of_phy_provider_register() - create/register phy provider with the
  497. * framework
  498. * @dev: struct device of the phy provider
  499. * @owner: the module owner containing of_xlate
  500. * @of_xlate: function pointer to obtain phy instance from phy provider
  501. *
  502. * Creates struct phy_provider from dev and of_xlate function pointer.
  503. * This is used in the case of dt boot for finding the phy instance from
  504. * phy provider. While at that, it also associates the device with the
  505. * phy provider using devres. On driver detach, release function is invoked
  506. * on the devres data, then, devres data is freed.
  507. */
  508. struct phy_provider *__devm_of_phy_provider_register(struct device *dev,
  509. struct module *owner, struct phy * (*of_xlate)(struct device *dev,
  510. struct of_phandle_args *args))
  511. {
  512. struct phy_provider **ptr, *phy_provider;
  513. ptr = devres_alloc(devm_phy_provider_release, sizeof(*ptr), GFP_KERNEL);
  514. if (!ptr)
  515. return ERR_PTR(-ENOMEM);
  516. phy_provider = __of_phy_provider_register(dev, owner, of_xlate);
  517. if (!IS_ERR(phy_provider)) {
  518. *ptr = phy_provider;
  519. devres_add(dev, ptr);
  520. } else {
  521. devres_free(ptr);
  522. }
  523. return phy_provider;
  524. }
  525. EXPORT_SYMBOL_GPL(__devm_of_phy_provider_register);
  526. /**
  527. * of_phy_provider_unregister() - unregister phy provider from the framework
  528. * @phy_provider: phy provider returned by of_phy_provider_register()
  529. *
  530. * Removes the phy_provider created using of_phy_provider_register().
  531. */
  532. void of_phy_provider_unregister(struct phy_provider *phy_provider)
  533. {
  534. if (IS_ERR(phy_provider))
  535. return;
  536. mutex_lock(&phy_provider_mutex);
  537. list_del(&phy_provider->list);
  538. kfree(phy_provider);
  539. mutex_unlock(&phy_provider_mutex);
  540. }
  541. EXPORT_SYMBOL_GPL(of_phy_provider_unregister);
  542. /**
  543. * devm_of_phy_provider_unregister() - remove phy provider from the framework
  544. * @dev: struct device of the phy provider
  545. *
  546. * destroys the devres associated with this phy provider and invokes
  547. * of_phy_provider_unregister to unregister the phy provider.
  548. */
  549. void devm_of_phy_provider_unregister(struct device *dev,
  550. struct phy_provider *phy_provider) {
  551. int r;
  552. r = devres_destroy(dev, devm_phy_provider_release, devm_phy_match,
  553. phy_provider);
  554. dev_WARN_ONCE(dev, r, "couldn't find PHY provider device resource\n");
  555. }
  556. EXPORT_SYMBOL_GPL(devm_of_phy_provider_unregister);
  557. /**
  558. * phy_release() - release the phy
  559. * @dev: the dev member within phy
  560. *
  561. * When the last reference to the device is removed, it is called
  562. * from the embedded kobject as release method.
  563. */
  564. static void phy_release(struct device *dev)
  565. {
  566. struct phy *phy;
  567. phy = to_phy(dev);
  568. dev_vdbg(dev, "releasing '%s'\n", dev_name(dev));
  569. ida_remove(&phy_ida, phy->id);
  570. kfree(phy);
  571. }
  572. static int __init phy_core_init(void)
  573. {
  574. phy_class = class_create(THIS_MODULE, "phy");
  575. if (IS_ERR(phy_class)) {
  576. pr_err("failed to create phy class --> %ld\n",
  577. PTR_ERR(phy_class));
  578. return PTR_ERR(phy_class);
  579. }
  580. phy_class->dev_release = phy_release;
  581. return 0;
  582. }
  583. module_init(phy_core_init);
  584. static void __exit phy_core_exit(void)
  585. {
  586. class_destroy(phy_class);
  587. }
  588. module_exit(phy_core_exit);
  589. MODULE_DESCRIPTION("Generic PHY Framework");
  590. MODULE_AUTHOR("Kishon Vijay Abraham I <kishon@ti.com>");
  591. MODULE_LICENSE("GPL v2");