b53_srab.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. /*
  2. * B53 register access through Switch Register Access Bridge Registers
  3. *
  4. * Copyright (C) 2013 Hauke Mehrtens <hauke@hauke-m.de>
  5. *
  6. * Permission to use, copy, modify, and/or distribute this software for any
  7. * purpose with or without fee is hereby granted, provided that the above
  8. * copyright notice and this permission notice appear in all copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #include <linux/kernel.h>
  19. #include <linux/module.h>
  20. #include <linux/delay.h>
  21. #include <linux/interrupt.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/platform_data/b53.h>
  24. #include <linux/of.h>
  25. #include "b53_priv.h"
  26. #include "b53_serdes.h"
  27. /* command and status register of the SRAB */
  28. #define B53_SRAB_CMDSTAT 0x2c
  29. #define B53_SRAB_CMDSTAT_RST BIT(2)
  30. #define B53_SRAB_CMDSTAT_WRITE BIT(1)
  31. #define B53_SRAB_CMDSTAT_GORDYN BIT(0)
  32. #define B53_SRAB_CMDSTAT_PAGE 24
  33. #define B53_SRAB_CMDSTAT_REG 16
  34. /* high order word of write data to switch registe */
  35. #define B53_SRAB_WD_H 0x30
  36. /* low order word of write data to switch registe */
  37. #define B53_SRAB_WD_L 0x34
  38. /* high order word of read data from switch register */
  39. #define B53_SRAB_RD_H 0x38
  40. /* low order word of read data from switch register */
  41. #define B53_SRAB_RD_L 0x3c
  42. /* command and status register of the SRAB */
  43. #define B53_SRAB_CTRLS 0x40
  44. #define B53_SRAB_CTRLS_HOST_INTR BIT(1)
  45. #define B53_SRAB_CTRLS_RCAREQ BIT(3)
  46. #define B53_SRAB_CTRLS_RCAGNT BIT(4)
  47. #define B53_SRAB_CTRLS_SW_INIT_DONE BIT(6)
  48. /* the register captures interrupt pulses from the switch */
  49. #define B53_SRAB_INTR 0x44
  50. #define B53_SRAB_INTR_P(x) BIT(x)
  51. #define B53_SRAB_SWITCH_PHY BIT(8)
  52. #define B53_SRAB_1588_SYNC BIT(9)
  53. #define B53_SRAB_IMP1_SLEEP_TIMER BIT(10)
  54. #define B53_SRAB_P7_SLEEP_TIMER BIT(11)
  55. #define B53_SRAB_IMP0_SLEEP_TIMER BIT(12)
  56. /* Port mux configuration registers */
  57. #define B53_MUX_CONFIG_P5 0x00
  58. #define MUX_CONFIG_SGMII 0
  59. #define MUX_CONFIG_MII_LITE 1
  60. #define MUX_CONFIG_RGMII 2
  61. #define MUX_CONFIG_GMII 3
  62. #define MUX_CONFIG_GPHY 4
  63. #define MUX_CONFIG_INTERNAL 5
  64. #define MUX_CONFIG_MASK 0x7
  65. #define B53_MUX_CONFIG_P4 0x04
  66. struct b53_srab_port_priv {
  67. int irq;
  68. bool irq_enabled;
  69. struct b53_device *dev;
  70. unsigned int num;
  71. phy_interface_t mode;
  72. };
  73. struct b53_srab_priv {
  74. void __iomem *regs;
  75. void __iomem *mux_config;
  76. struct b53_srab_port_priv port_intrs[B53_N_PORTS];
  77. };
  78. static int b53_srab_request_grant(struct b53_device *dev)
  79. {
  80. struct b53_srab_priv *priv = dev->priv;
  81. u8 __iomem *regs = priv->regs;
  82. u32 ctrls;
  83. int i;
  84. ctrls = readl(regs + B53_SRAB_CTRLS);
  85. ctrls |= B53_SRAB_CTRLS_RCAREQ;
  86. writel(ctrls, regs + B53_SRAB_CTRLS);
  87. for (i = 0; i < 20; i++) {
  88. ctrls = readl(regs + B53_SRAB_CTRLS);
  89. if (ctrls & B53_SRAB_CTRLS_RCAGNT)
  90. break;
  91. usleep_range(10, 100);
  92. }
  93. if (WARN_ON(i == 5))
  94. return -EIO;
  95. return 0;
  96. }
  97. static void b53_srab_release_grant(struct b53_device *dev)
  98. {
  99. struct b53_srab_priv *priv = dev->priv;
  100. u8 __iomem *regs = priv->regs;
  101. u32 ctrls;
  102. ctrls = readl(regs + B53_SRAB_CTRLS);
  103. ctrls &= ~B53_SRAB_CTRLS_RCAREQ;
  104. writel(ctrls, regs + B53_SRAB_CTRLS);
  105. }
  106. static int b53_srab_op(struct b53_device *dev, u8 page, u8 reg, u32 op)
  107. {
  108. struct b53_srab_priv *priv = dev->priv;
  109. u8 __iomem *regs = priv->regs;
  110. int i;
  111. u32 cmdstat;
  112. /* set register address */
  113. cmdstat = (page << B53_SRAB_CMDSTAT_PAGE) |
  114. (reg << B53_SRAB_CMDSTAT_REG) |
  115. B53_SRAB_CMDSTAT_GORDYN |
  116. op;
  117. writel(cmdstat, regs + B53_SRAB_CMDSTAT);
  118. /* check if operation completed */
  119. for (i = 0; i < 5; ++i) {
  120. cmdstat = readl(regs + B53_SRAB_CMDSTAT);
  121. if (!(cmdstat & B53_SRAB_CMDSTAT_GORDYN))
  122. break;
  123. usleep_range(10, 100);
  124. }
  125. if (WARN_ON(i == 5))
  126. return -EIO;
  127. return 0;
  128. }
  129. static int b53_srab_read8(struct b53_device *dev, u8 page, u8 reg, u8 *val)
  130. {
  131. struct b53_srab_priv *priv = dev->priv;
  132. u8 __iomem *regs = priv->regs;
  133. int ret = 0;
  134. ret = b53_srab_request_grant(dev);
  135. if (ret)
  136. goto err;
  137. ret = b53_srab_op(dev, page, reg, 0);
  138. if (ret)
  139. goto err;
  140. *val = readl(regs + B53_SRAB_RD_L) & 0xff;
  141. err:
  142. b53_srab_release_grant(dev);
  143. return ret;
  144. }
  145. static int b53_srab_read16(struct b53_device *dev, u8 page, u8 reg, u16 *val)
  146. {
  147. struct b53_srab_priv *priv = dev->priv;
  148. u8 __iomem *regs = priv->regs;
  149. int ret = 0;
  150. ret = b53_srab_request_grant(dev);
  151. if (ret)
  152. goto err;
  153. ret = b53_srab_op(dev, page, reg, 0);
  154. if (ret)
  155. goto err;
  156. *val = readl(regs + B53_SRAB_RD_L) & 0xffff;
  157. err:
  158. b53_srab_release_grant(dev);
  159. return ret;
  160. }
  161. static int b53_srab_read32(struct b53_device *dev, u8 page, u8 reg, u32 *val)
  162. {
  163. struct b53_srab_priv *priv = dev->priv;
  164. u8 __iomem *regs = priv->regs;
  165. int ret = 0;
  166. ret = b53_srab_request_grant(dev);
  167. if (ret)
  168. goto err;
  169. ret = b53_srab_op(dev, page, reg, 0);
  170. if (ret)
  171. goto err;
  172. *val = readl(regs + B53_SRAB_RD_L);
  173. err:
  174. b53_srab_release_grant(dev);
  175. return ret;
  176. }
  177. static int b53_srab_read48(struct b53_device *dev, u8 page, u8 reg, u64 *val)
  178. {
  179. struct b53_srab_priv *priv = dev->priv;
  180. u8 __iomem *regs = priv->regs;
  181. int ret = 0;
  182. ret = b53_srab_request_grant(dev);
  183. if (ret)
  184. goto err;
  185. ret = b53_srab_op(dev, page, reg, 0);
  186. if (ret)
  187. goto err;
  188. *val = readl(regs + B53_SRAB_RD_L);
  189. *val += ((u64)readl(regs + B53_SRAB_RD_H) & 0xffff) << 32;
  190. err:
  191. b53_srab_release_grant(dev);
  192. return ret;
  193. }
  194. static int b53_srab_read64(struct b53_device *dev, u8 page, u8 reg, u64 *val)
  195. {
  196. struct b53_srab_priv *priv = dev->priv;
  197. u8 __iomem *regs = priv->regs;
  198. int ret = 0;
  199. ret = b53_srab_request_grant(dev);
  200. if (ret)
  201. goto err;
  202. ret = b53_srab_op(dev, page, reg, 0);
  203. if (ret)
  204. goto err;
  205. *val = readl(regs + B53_SRAB_RD_L);
  206. *val += (u64)readl(regs + B53_SRAB_RD_H) << 32;
  207. err:
  208. b53_srab_release_grant(dev);
  209. return ret;
  210. }
  211. static int b53_srab_write8(struct b53_device *dev, u8 page, u8 reg, u8 value)
  212. {
  213. struct b53_srab_priv *priv = dev->priv;
  214. u8 __iomem *regs = priv->regs;
  215. int ret = 0;
  216. ret = b53_srab_request_grant(dev);
  217. if (ret)
  218. goto err;
  219. writel(value, regs + B53_SRAB_WD_L);
  220. ret = b53_srab_op(dev, page, reg, B53_SRAB_CMDSTAT_WRITE);
  221. err:
  222. b53_srab_release_grant(dev);
  223. return ret;
  224. }
  225. static int b53_srab_write16(struct b53_device *dev, u8 page, u8 reg,
  226. u16 value)
  227. {
  228. struct b53_srab_priv *priv = dev->priv;
  229. u8 __iomem *regs = priv->regs;
  230. int ret = 0;
  231. ret = b53_srab_request_grant(dev);
  232. if (ret)
  233. goto err;
  234. writel(value, regs + B53_SRAB_WD_L);
  235. ret = b53_srab_op(dev, page, reg, B53_SRAB_CMDSTAT_WRITE);
  236. err:
  237. b53_srab_release_grant(dev);
  238. return ret;
  239. }
  240. static int b53_srab_write32(struct b53_device *dev, u8 page, u8 reg,
  241. u32 value)
  242. {
  243. struct b53_srab_priv *priv = dev->priv;
  244. u8 __iomem *regs = priv->regs;
  245. int ret = 0;
  246. ret = b53_srab_request_grant(dev);
  247. if (ret)
  248. goto err;
  249. writel(value, regs + B53_SRAB_WD_L);
  250. ret = b53_srab_op(dev, page, reg, B53_SRAB_CMDSTAT_WRITE);
  251. err:
  252. b53_srab_release_grant(dev);
  253. return ret;
  254. }
  255. static int b53_srab_write48(struct b53_device *dev, u8 page, u8 reg,
  256. u64 value)
  257. {
  258. struct b53_srab_priv *priv = dev->priv;
  259. u8 __iomem *regs = priv->regs;
  260. int ret = 0;
  261. ret = b53_srab_request_grant(dev);
  262. if (ret)
  263. goto err;
  264. writel((u32)value, regs + B53_SRAB_WD_L);
  265. writel((u16)(value >> 32), regs + B53_SRAB_WD_H);
  266. ret = b53_srab_op(dev, page, reg, B53_SRAB_CMDSTAT_WRITE);
  267. err:
  268. b53_srab_release_grant(dev);
  269. return ret;
  270. }
  271. static int b53_srab_write64(struct b53_device *dev, u8 page, u8 reg,
  272. u64 value)
  273. {
  274. struct b53_srab_priv *priv = dev->priv;
  275. u8 __iomem *regs = priv->regs;
  276. int ret = 0;
  277. ret = b53_srab_request_grant(dev);
  278. if (ret)
  279. goto err;
  280. writel((u32)value, regs + B53_SRAB_WD_L);
  281. writel((u32)(value >> 32), regs + B53_SRAB_WD_H);
  282. ret = b53_srab_op(dev, page, reg, B53_SRAB_CMDSTAT_WRITE);
  283. err:
  284. b53_srab_release_grant(dev);
  285. return ret;
  286. }
  287. static irqreturn_t b53_srab_port_thread(int irq, void *dev_id)
  288. {
  289. struct b53_srab_port_priv *port = dev_id;
  290. struct b53_device *dev = port->dev;
  291. if (port->mode == PHY_INTERFACE_MODE_SGMII)
  292. b53_port_event(dev->ds, port->num);
  293. return IRQ_HANDLED;
  294. }
  295. static irqreturn_t b53_srab_port_isr(int irq, void *dev_id)
  296. {
  297. struct b53_srab_port_priv *port = dev_id;
  298. struct b53_device *dev = port->dev;
  299. struct b53_srab_priv *priv = dev->priv;
  300. /* Acknowledge the interrupt */
  301. writel(BIT(port->num), priv->regs + B53_SRAB_INTR);
  302. return IRQ_WAKE_THREAD;
  303. }
  304. #if IS_ENABLED(CONFIG_B53_SERDES)
  305. static u8 b53_srab_serdes_map_lane(struct b53_device *dev, int port)
  306. {
  307. struct b53_srab_priv *priv = dev->priv;
  308. struct b53_srab_port_priv *p = &priv->port_intrs[port];
  309. if (p->mode != PHY_INTERFACE_MODE_SGMII)
  310. return B53_INVALID_LANE;
  311. switch (port) {
  312. case 5:
  313. return 0;
  314. case 4:
  315. return 1;
  316. default:
  317. return B53_INVALID_LANE;
  318. }
  319. }
  320. #endif
  321. static int b53_srab_irq_enable(struct b53_device *dev, int port)
  322. {
  323. struct b53_srab_priv *priv = dev->priv;
  324. struct b53_srab_port_priv *p = &priv->port_intrs[port];
  325. int ret = 0;
  326. /* Interrupt is optional and was not specified, do not make
  327. * this fatal
  328. */
  329. if (p->irq == -ENXIO)
  330. return ret;
  331. ret = request_threaded_irq(p->irq, b53_srab_port_isr,
  332. b53_srab_port_thread, 0,
  333. dev_name(dev->dev), p);
  334. if (!ret)
  335. p->irq_enabled = true;
  336. return ret;
  337. }
  338. static void b53_srab_irq_disable(struct b53_device *dev, int port)
  339. {
  340. struct b53_srab_priv *priv = dev->priv;
  341. struct b53_srab_port_priv *p = &priv->port_intrs[port];
  342. if (p->irq_enabled) {
  343. free_irq(p->irq, p);
  344. p->irq_enabled = false;
  345. }
  346. }
  347. static const struct b53_io_ops b53_srab_ops = {
  348. .read8 = b53_srab_read8,
  349. .read16 = b53_srab_read16,
  350. .read32 = b53_srab_read32,
  351. .read48 = b53_srab_read48,
  352. .read64 = b53_srab_read64,
  353. .write8 = b53_srab_write8,
  354. .write16 = b53_srab_write16,
  355. .write32 = b53_srab_write32,
  356. .write48 = b53_srab_write48,
  357. .write64 = b53_srab_write64,
  358. .irq_enable = b53_srab_irq_enable,
  359. .irq_disable = b53_srab_irq_disable,
  360. #if IS_ENABLED(CONFIG_B53_SERDES)
  361. .serdes_map_lane = b53_srab_serdes_map_lane,
  362. .serdes_link_state = b53_serdes_link_state,
  363. .serdes_config = b53_serdes_config,
  364. .serdes_an_restart = b53_serdes_an_restart,
  365. .serdes_link_set = b53_serdes_link_set,
  366. .serdes_phylink_validate = b53_serdes_phylink_validate,
  367. #endif
  368. };
  369. static const struct of_device_id b53_srab_of_match[] = {
  370. { .compatible = "brcm,bcm53010-srab" },
  371. { .compatible = "brcm,bcm53011-srab" },
  372. { .compatible = "brcm,bcm53012-srab" },
  373. { .compatible = "brcm,bcm53018-srab" },
  374. { .compatible = "brcm,bcm53019-srab" },
  375. { .compatible = "brcm,bcm5301x-srab" },
  376. { .compatible = "brcm,bcm11360-srab", .data = (void *)BCM583XX_DEVICE_ID },
  377. { .compatible = "brcm,bcm58522-srab", .data = (void *)BCM58XX_DEVICE_ID },
  378. { .compatible = "brcm,bcm58525-srab", .data = (void *)BCM58XX_DEVICE_ID },
  379. { .compatible = "brcm,bcm58535-srab", .data = (void *)BCM58XX_DEVICE_ID },
  380. { .compatible = "brcm,bcm58622-srab", .data = (void *)BCM58XX_DEVICE_ID },
  381. { .compatible = "brcm,bcm58623-srab", .data = (void *)BCM58XX_DEVICE_ID },
  382. { .compatible = "brcm,bcm58625-srab", .data = (void *)BCM58XX_DEVICE_ID },
  383. { .compatible = "brcm,bcm88312-srab", .data = (void *)BCM58XX_DEVICE_ID },
  384. { .compatible = "brcm,cygnus-srab", .data = (void *)BCM583XX_DEVICE_ID },
  385. { .compatible = "brcm,nsp-srab", .data = (void *)BCM58XX_DEVICE_ID },
  386. { .compatible = "brcm,omega-srab", .data = (void *)BCM583XX_DEVICE_ID },
  387. { /* sentinel */ },
  388. };
  389. MODULE_DEVICE_TABLE(of, b53_srab_of_match);
  390. static void b53_srab_intr_set(struct b53_srab_priv *priv, bool set)
  391. {
  392. u32 reg;
  393. reg = readl(priv->regs + B53_SRAB_CTRLS);
  394. if (set)
  395. reg |= B53_SRAB_CTRLS_HOST_INTR;
  396. else
  397. reg &= ~B53_SRAB_CTRLS_HOST_INTR;
  398. writel(reg, priv->regs + B53_SRAB_CTRLS);
  399. }
  400. static void b53_srab_prepare_irq(struct platform_device *pdev)
  401. {
  402. struct b53_device *dev = platform_get_drvdata(pdev);
  403. struct b53_srab_priv *priv = dev->priv;
  404. struct b53_srab_port_priv *port;
  405. unsigned int i;
  406. char *name;
  407. /* Clear all pending interrupts */
  408. writel(0xffffffff, priv->regs + B53_SRAB_INTR);
  409. for (i = 0; i < B53_N_PORTS; i++) {
  410. port = &priv->port_intrs[i];
  411. /* There is no port 6 */
  412. if (i == 6)
  413. continue;
  414. name = kasprintf(GFP_KERNEL, "link_state_p%d", i);
  415. if (!name)
  416. return;
  417. port->num = i;
  418. port->dev = dev;
  419. port->irq = platform_get_irq_byname(pdev, name);
  420. kfree(name);
  421. }
  422. b53_srab_intr_set(priv, true);
  423. }
  424. static void b53_srab_mux_init(struct platform_device *pdev)
  425. {
  426. struct b53_device *dev = platform_get_drvdata(pdev);
  427. struct b53_srab_priv *priv = dev->priv;
  428. struct b53_srab_port_priv *p;
  429. unsigned int port;
  430. u32 reg, off = 0;
  431. int ret;
  432. if (dev->pdata && dev->pdata->chip_id != BCM58XX_DEVICE_ID)
  433. return;
  434. priv->mux_config = devm_platform_ioremap_resource(pdev, 1);
  435. if (IS_ERR(priv->mux_config))
  436. return;
  437. /* Obtain the port mux configuration so we know which lanes
  438. * actually map to SerDes lanes
  439. */
  440. for (port = 5; port > 3; port--, off += 4) {
  441. p = &priv->port_intrs[port];
  442. reg = readl(priv->mux_config + B53_MUX_CONFIG_P5 + off);
  443. switch (reg & MUX_CONFIG_MASK) {
  444. case MUX_CONFIG_SGMII:
  445. p->mode = PHY_INTERFACE_MODE_SGMII;
  446. ret = b53_serdes_init(dev, port);
  447. if (ret)
  448. continue;
  449. break;
  450. case MUX_CONFIG_MII_LITE:
  451. p->mode = PHY_INTERFACE_MODE_MII;
  452. break;
  453. case MUX_CONFIG_GMII:
  454. p->mode = PHY_INTERFACE_MODE_GMII;
  455. break;
  456. case MUX_CONFIG_RGMII:
  457. p->mode = PHY_INTERFACE_MODE_RGMII;
  458. break;
  459. case MUX_CONFIG_INTERNAL:
  460. p->mode = PHY_INTERFACE_MODE_INTERNAL;
  461. break;
  462. default:
  463. p->mode = PHY_INTERFACE_MODE_NA;
  464. break;
  465. }
  466. if (p->mode != PHY_INTERFACE_MODE_NA)
  467. dev_info(&pdev->dev, "Port %d mode: %s\n",
  468. port, phy_modes(p->mode));
  469. }
  470. }
  471. static int b53_srab_probe(struct platform_device *pdev)
  472. {
  473. struct b53_platform_data *pdata = pdev->dev.platform_data;
  474. struct device_node *dn = pdev->dev.of_node;
  475. const struct of_device_id *of_id = NULL;
  476. struct b53_srab_priv *priv;
  477. struct b53_device *dev;
  478. if (dn)
  479. of_id = of_match_node(b53_srab_of_match, dn);
  480. if (of_id) {
  481. pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
  482. if (!pdata)
  483. return -ENOMEM;
  484. pdata->chip_id = (u32)(unsigned long)of_id->data;
  485. }
  486. priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
  487. if (!priv)
  488. return -ENOMEM;
  489. priv->regs = devm_platform_ioremap_resource(pdev, 0);
  490. if (IS_ERR(priv->regs))
  491. return -ENOMEM;
  492. dev = b53_switch_alloc(&pdev->dev, &b53_srab_ops, priv);
  493. if (!dev)
  494. return -ENOMEM;
  495. if (pdata)
  496. dev->pdata = pdata;
  497. platform_set_drvdata(pdev, dev);
  498. b53_srab_prepare_irq(pdev);
  499. b53_srab_mux_init(pdev);
  500. return b53_switch_register(dev);
  501. }
  502. static int b53_srab_remove(struct platform_device *pdev)
  503. {
  504. struct b53_device *dev = platform_get_drvdata(pdev);
  505. struct b53_srab_priv *priv = dev->priv;
  506. b53_srab_intr_set(priv, false);
  507. if (dev)
  508. b53_switch_remove(dev);
  509. return 0;
  510. }
  511. static struct platform_driver b53_srab_driver = {
  512. .probe = b53_srab_probe,
  513. .remove = b53_srab_remove,
  514. .driver = {
  515. .name = "b53-srab-switch",
  516. .of_match_table = b53_srab_of_match,
  517. },
  518. };
  519. module_platform_driver(b53_srab_driver);
  520. MODULE_AUTHOR("Hauke Mehrtens <hauke@hauke-m.de>");
  521. MODULE_DESCRIPTION("B53 Switch Register Access Bridge Registers (SRAB) access driver");
  522. MODULE_LICENSE("Dual BSD/GPL");