GNU Linux-libre 4.14.332-gnu1
[releases.git] / drivers / net / phy / mdio_bus.c
1 /* MDIO Bus interface
2  *
3  * Author: Andy Fleming
4  *
5  * Copyright (c) 2004 Freescale Semiconductor, Inc.
6  *
7  * This program is free software; you can redistribute  it and/or modify it
8  * under  the terms of  the GNU General  Public License as published by the
9  * Free Software Foundation;  either version 2 of the  License, or (at your
10  * option) any later version.
11  *
12  */
13
14 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15
16 #include <linux/kernel.h>
17 #include <linux/string.h>
18 #include <linux/errno.h>
19 #include <linux/unistd.h>
20 #include <linux/slab.h>
21 #include <linux/interrupt.h>
22 #include <linux/init.h>
23 #include <linux/delay.h>
24 #include <linux/device.h>
25 #include <linux/gpio.h>
26 #include <linux/gpio/consumer.h>
27 #include <linux/of_device.h>
28 #include <linux/of_mdio.h>
29 #include <linux/of_gpio.h>
30 #include <linux/netdevice.h>
31 #include <linux/etherdevice.h>
32 #include <linux/skbuff.h>
33 #include <linux/spinlock.h>
34 #include <linux/mm.h>
35 #include <linux/module.h>
36 #include <linux/mii.h>
37 #include <linux/ethtool.h>
38 #include <linux/phy.h>
39 #include <linux/io.h>
40 #include <linux/uaccess.h>
41
42 #include <asm/irq.h>
43
44 #define CREATE_TRACE_POINTS
45 #include <trace/events/mdio.h>
46
47 #include "mdio-boardinfo.h"
48
49 int mdiobus_register_device(struct mdio_device *mdiodev)
50 {
51         if (mdiodev->bus->mdio_map[mdiodev->addr])
52                 return -EBUSY;
53
54         mdiodev->bus->mdio_map[mdiodev->addr] = mdiodev;
55
56         return 0;
57 }
58 EXPORT_SYMBOL(mdiobus_register_device);
59
60 int mdiobus_unregister_device(struct mdio_device *mdiodev)
61 {
62         if (mdiodev->bus->mdio_map[mdiodev->addr] != mdiodev)
63                 return -EINVAL;
64
65         mdiodev->bus->mdio_map[mdiodev->addr] = NULL;
66
67         return 0;
68 }
69 EXPORT_SYMBOL(mdiobus_unregister_device);
70
71 struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr)
72 {
73         struct mdio_device *mdiodev;
74
75         if (addr < 0 || addr >= ARRAY_SIZE(bus->mdio_map))
76                 return NULL;
77
78         mdiodev = bus->mdio_map[addr];
79
80         if (!mdiodev)
81                 return NULL;
82
83         if (!(mdiodev->flags & MDIO_DEVICE_FLAG_PHY))
84                 return NULL;
85
86         return container_of(mdiodev, struct phy_device, mdio);
87 }
88 EXPORT_SYMBOL(mdiobus_get_phy);
89
90 bool mdiobus_is_registered_device(struct mii_bus *bus, int addr)
91 {
92         return bus->mdio_map[addr];
93 }
94 EXPORT_SYMBOL(mdiobus_is_registered_device);
95
96 /**
97  * mdiobus_alloc_size - allocate a mii_bus structure
98  * @size: extra amount of memory to allocate for private storage.
99  * If non-zero, then bus->priv is points to that memory.
100  *
101  * Description: called by a bus driver to allocate an mii_bus
102  * structure to fill in.
103  */
104 struct mii_bus *mdiobus_alloc_size(size_t size)
105 {
106         struct mii_bus *bus;
107         size_t aligned_size = ALIGN(sizeof(*bus), NETDEV_ALIGN);
108         size_t alloc_size;
109         int i;
110
111         /* If we alloc extra space, it should be aligned */
112         if (size)
113                 alloc_size = aligned_size + size;
114         else
115                 alloc_size = sizeof(*bus);
116
117         bus = kzalloc(alloc_size, GFP_KERNEL);
118         if (!bus)
119                 return NULL;
120
121         bus->state = MDIOBUS_ALLOCATED;
122         if (size)
123                 bus->priv = (void *)bus + aligned_size;
124
125         /* Initialise the interrupts to polling */
126         for (i = 0; i < PHY_MAX_ADDR; i++)
127                 bus->irq[i] = PHY_POLL;
128
129         return bus;
130 }
131 EXPORT_SYMBOL(mdiobus_alloc_size);
132
133 static void _devm_mdiobus_free(struct device *dev, void *res)
134 {
135         mdiobus_free(*(struct mii_bus **)res);
136 }
137
138 static int devm_mdiobus_match(struct device *dev, void *res, void *data)
139 {
140         struct mii_bus **r = res;
141
142         if (WARN_ON(!r || !*r))
143                 return 0;
144
145         return *r == data;
146 }
147
148 /**
149  * devm_mdiobus_alloc_size - Resource-managed mdiobus_alloc_size()
150  * @dev:                Device to allocate mii_bus for
151  * @sizeof_priv:        Space to allocate for private structure.
152  *
153  * Managed mdiobus_alloc_size. mii_bus allocated with this function is
154  * automatically freed on driver detach.
155  *
156  * If an mii_bus allocated with this function needs to be freed separately,
157  * devm_mdiobus_free() must be used.
158  *
159  * RETURNS:
160  * Pointer to allocated mii_bus on success, NULL on failure.
161  */
162 struct mii_bus *devm_mdiobus_alloc_size(struct device *dev, int sizeof_priv)
163 {
164         struct mii_bus **ptr, *bus;
165
166         ptr = devres_alloc(_devm_mdiobus_free, sizeof(*ptr), GFP_KERNEL);
167         if (!ptr)
168                 return NULL;
169
170         /* use raw alloc_dr for kmalloc caller tracing */
171         bus = mdiobus_alloc_size(sizeof_priv);
172         if (bus) {
173                 *ptr = bus;
174                 devres_add(dev, ptr);
175         } else {
176                 devres_free(ptr);
177         }
178
179         return bus;
180 }
181 EXPORT_SYMBOL_GPL(devm_mdiobus_alloc_size);
182
183 /**
184  * devm_mdiobus_free - Resource-managed mdiobus_free()
185  * @dev:                Device this mii_bus belongs to
186  * @bus:                the mii_bus associated with the device
187  *
188  * Free mii_bus allocated with devm_mdiobus_alloc_size().
189  */
190 void devm_mdiobus_free(struct device *dev, struct mii_bus *bus)
191 {
192         int rc;
193
194         rc = devres_release(dev, _devm_mdiobus_free,
195                             devm_mdiobus_match, bus);
196         WARN_ON(rc);
197 }
198 EXPORT_SYMBOL_GPL(devm_mdiobus_free);
199
200 /**
201  * mdiobus_release - mii_bus device release callback
202  * @d: the target struct device that contains the mii_bus
203  *
204  * Description: called when the last reference to an mii_bus is
205  * dropped, to free the underlying memory.
206  */
207 static void mdiobus_release(struct device *d)
208 {
209         struct mii_bus *bus = to_mii_bus(d);
210         BUG_ON(bus->state != MDIOBUS_RELEASED &&
211                /* for compatibility with error handling in drivers */
212                bus->state != MDIOBUS_ALLOCATED);
213         kfree(bus);
214 }
215
216 static struct class mdio_bus_class = {
217         .name           = "mdio_bus",
218         .dev_release    = mdiobus_release,
219 };
220
221 #if IS_ENABLED(CONFIG_OF_MDIO)
222 /* Helper function for of_mdio_find_bus */
223 static int of_mdio_bus_match(struct device *dev, const void *mdio_bus_np)
224 {
225         return dev->of_node == mdio_bus_np;
226 }
227 /**
228  * of_mdio_find_bus - Given an mii_bus node, find the mii_bus.
229  * @mdio_bus_np: Pointer to the mii_bus.
230  *
231  * Returns a reference to the mii_bus, or NULL if none found.  The
232  * embedded struct device will have its reference count incremented,
233  * and this must be put once the bus is finished with.
234  *
235  * Because the association of a device_node and mii_bus is made via
236  * of_mdiobus_register(), the mii_bus cannot be found before it is
237  * registered with of_mdiobus_register().
238  *
239  */
240 struct mii_bus *of_mdio_find_bus(struct device_node *mdio_bus_np)
241 {
242         struct device *d;
243
244         if (!mdio_bus_np)
245                 return NULL;
246
247         d = class_find_device(&mdio_bus_class, NULL,  mdio_bus_np,
248                               of_mdio_bus_match);
249
250         return d ? to_mii_bus(d) : NULL;
251 }
252 EXPORT_SYMBOL(of_mdio_find_bus);
253
254 /* Walk the list of subnodes of a mdio bus and look for a node that
255  * matches the mdio device's address with its 'reg' property. If
256  * found, set the of_node pointer for the mdio device. This allows
257  * auto-probed phy devices to be supplied with information passed in
258  * via DT.
259  */
260 static void of_mdiobus_link_mdiodev(struct mii_bus *bus,
261                                     struct mdio_device *mdiodev)
262 {
263         struct device *dev = &mdiodev->dev;
264         struct device_node *child;
265
266         if (dev->of_node || !bus->dev.of_node)
267                 return;
268
269         for_each_available_child_of_node(bus->dev.of_node, child) {
270                 int addr;
271
272                 addr = of_mdio_parse_addr(dev, child);
273                 if (addr < 0)
274                         continue;
275
276                 if (addr == mdiodev->addr) {
277                         dev->of_node = child;
278                         return;
279                 }
280         }
281 }
282 #else /* !IS_ENABLED(CONFIG_OF_MDIO) */
283 static inline void of_mdiobus_link_mdiodev(struct mii_bus *mdio,
284                                            struct mdio_device *mdiodev)
285 {
286 }
287 #endif
288
289 /**
290  * mdiobus_create_device_from_board_info - create a full MDIO device given
291  * a mdio_board_info structure
292  * @bus: MDIO bus to create the devices on
293  * @bi: mdio_board_info structure describing the devices
294  *
295  * Returns 0 on success or < 0 on error.
296  */
297 static int mdiobus_create_device(struct mii_bus *bus,
298                                  struct mdio_board_info *bi)
299 {
300         struct mdio_device *mdiodev;
301         int ret = 0;
302
303         mdiodev = mdio_device_create(bus, bi->mdio_addr);
304         if (IS_ERR(mdiodev))
305                 return -ENODEV;
306
307         strncpy(mdiodev->modalias, bi->modalias,
308                 sizeof(mdiodev->modalias));
309         mdiodev->bus_match = mdio_device_bus_match;
310         mdiodev->dev.platform_data = (void *)bi->platform_data;
311
312         ret = mdio_device_register(mdiodev);
313         if (ret)
314                 mdio_device_free(mdiodev);
315
316         return ret;
317 }
318
319 /**
320  * __mdiobus_register - bring up all the PHYs on a given bus and attach them to bus
321  * @bus: target mii_bus
322  * @owner: module containing bus accessor functions
323  *
324  * Description: Called by a bus driver to bring up all the PHYs
325  *   on a given bus, and attach them to the bus. Drivers should use
326  *   mdiobus_register() rather than __mdiobus_register() unless they
327  *   need to pass a specific owner module. MDIO devices which are not
328  *   PHYs will not be brought up by this function. They are expected to
329  *   to be explicitly listed in DT and instantiated by of_mdiobus_register().
330  *
331  * Returns 0 on success or < 0 on error.
332  */
333 int __mdiobus_register(struct mii_bus *bus, struct module *owner)
334 {
335         struct mdio_device *mdiodev;
336         int i, err;
337         struct gpio_desc *gpiod;
338
339         if (NULL == bus || NULL == bus->name ||
340             NULL == bus->read || NULL == bus->write)
341                 return -EINVAL;
342
343         BUG_ON(bus->state != MDIOBUS_ALLOCATED &&
344                bus->state != MDIOBUS_UNREGISTERED);
345
346         bus->owner = owner;
347         bus->dev.parent = bus->parent;
348         bus->dev.class = &mdio_bus_class;
349         bus->dev.groups = NULL;
350         dev_set_name(&bus->dev, "%s", bus->id);
351
352         /* We need to set state to MDIOBUS_UNREGISTERED to correctly release
353          * the device in mdiobus_free()
354          *
355          * State will be updated later in this function in case of success
356          */
357         bus->state = MDIOBUS_UNREGISTERED;
358
359         err = device_register(&bus->dev);
360         if (err) {
361                 pr_err("mii_bus %s failed to register\n", bus->id);
362                 return -EINVAL;
363         }
364
365         mutex_init(&bus->mdio_lock);
366
367         /* de-assert bus level PHY GPIO reset */
368         gpiod = devm_gpiod_get_optional(&bus->dev, "reset", GPIOD_OUT_LOW);
369         if (IS_ERR(gpiod)) {
370                 dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n",
371                         bus->id);
372                 device_del(&bus->dev);
373                 return PTR_ERR(gpiod);
374         } else  if (gpiod) {
375                 bus->reset_gpiod = gpiod;
376
377                 gpiod_set_value_cansleep(gpiod, 1);
378                 udelay(bus->reset_delay_us);
379                 gpiod_set_value_cansleep(gpiod, 0);
380         }
381
382         if (bus->reset)
383                 bus->reset(bus);
384
385         for (i = 0; i < PHY_MAX_ADDR; i++) {
386                 if ((bus->phy_mask & BIT(i)) == 0) {
387                         struct phy_device *phydev;
388
389                         phydev = mdiobus_scan(bus, i);
390                         if (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV)) {
391                                 err = PTR_ERR(phydev);
392                                 goto error;
393                         }
394                 }
395         }
396
397         mdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device);
398
399         bus->state = MDIOBUS_REGISTERED;
400         dev_dbg(&bus->dev, "probed\n");
401         return 0;
402
403 error:
404         while (--i >= 0) {
405                 mdiodev = bus->mdio_map[i];
406                 if (!mdiodev)
407                         continue;
408
409                 mdiodev->device_remove(mdiodev);
410                 mdiodev->device_free(mdiodev);
411         }
412
413         /* Put PHYs in RESET to save power */
414         if (bus->reset_gpiod)
415                 gpiod_set_value_cansleep(bus->reset_gpiod, 1);
416
417         device_del(&bus->dev);
418         return err;
419 }
420 EXPORT_SYMBOL(__mdiobus_register);
421
422 void mdiobus_unregister(struct mii_bus *bus)
423 {
424         struct mdio_device *mdiodev;
425         int i;
426
427         if (WARN_ON_ONCE(bus->state != MDIOBUS_REGISTERED))
428                 return;
429         bus->state = MDIOBUS_UNREGISTERED;
430
431         for (i = 0; i < PHY_MAX_ADDR; i++) {
432                 mdiodev = bus->mdio_map[i];
433                 if (!mdiodev)
434                         continue;
435
436                 mdiodev->device_remove(mdiodev);
437                 mdiodev->device_free(mdiodev);
438         }
439
440         /* Put PHYs in RESET to save power */
441         if (bus->reset_gpiod)
442                 gpiod_set_value_cansleep(bus->reset_gpiod, 1);
443
444         device_del(&bus->dev);
445 }
446 EXPORT_SYMBOL(mdiobus_unregister);
447
448 /**
449  * mdiobus_free - free a struct mii_bus
450  * @bus: mii_bus to free
451  *
452  * This function releases the reference to the underlying device
453  * object in the mii_bus.  If this is the last reference, the mii_bus
454  * will be freed.
455  */
456 void mdiobus_free(struct mii_bus *bus)
457 {
458         /* For compatibility with error handling in drivers. */
459         if (bus->state == MDIOBUS_ALLOCATED) {
460                 kfree(bus);
461                 return;
462         }
463
464         BUG_ON(bus->state != MDIOBUS_UNREGISTERED);
465         bus->state = MDIOBUS_RELEASED;
466
467         put_device(&bus->dev);
468 }
469 EXPORT_SYMBOL(mdiobus_free);
470
471 /**
472  * mdiobus_scan - scan a bus for MDIO devices.
473  * @bus: mii_bus to scan
474  * @addr: address on bus to scan
475  *
476  * This function scans the MDIO bus, looking for devices which can be
477  * identified using a vendor/product ID in registers 2 and 3. Not all
478  * MDIO devices have such registers, but PHY devices typically
479  * do. Hence this function assumes anything found is a PHY, or can be
480  * treated as a PHY. Other MDIO devices, such as switches, will
481  * probably not be found during the scan.
482  */
483 struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr)
484 {
485         struct phy_device *phydev;
486         int err;
487
488         phydev = get_phy_device(bus, addr, false);
489         if (IS_ERR(phydev))
490                 return phydev;
491
492         /*
493          * For DT, see if the auto-probed phy has a correspoding child
494          * in the bus node, and set the of_node pointer in this case.
495          */
496         of_mdiobus_link_mdiodev(bus, &phydev->mdio);
497
498         err = phy_device_register(phydev);
499         if (err) {
500                 phy_device_free(phydev);
501                 return ERR_PTR(-ENODEV);
502         }
503
504         return phydev;
505 }
506 EXPORT_SYMBOL(mdiobus_scan);
507
508 /**
509  * mdiobus_read_nested - Nested version of the mdiobus_read function
510  * @bus: the mii_bus struct
511  * @addr: the phy address
512  * @regnum: register number to read
513  *
514  * In case of nested MDIO bus access avoid lockdep false positives by
515  * using mutex_lock_nested().
516  *
517  * NOTE: MUST NOT be called from interrupt context,
518  * because the bus read/write functions may wait for an interrupt
519  * to conclude the operation.
520  */
521 int mdiobus_read_nested(struct mii_bus *bus, int addr, u32 regnum)
522 {
523         int retval;
524
525         BUG_ON(in_interrupt());
526
527         mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
528         retval = bus->read(bus, addr, regnum);
529         mutex_unlock(&bus->mdio_lock);
530
531         trace_mdio_access(bus, 1, addr, regnum, retval, retval);
532
533         return retval;
534 }
535 EXPORT_SYMBOL(mdiobus_read_nested);
536
537 /**
538  * mdiobus_read - Convenience function for reading a given MII mgmt register
539  * @bus: the mii_bus struct
540  * @addr: the phy address
541  * @regnum: register number to read
542  *
543  * NOTE: MUST NOT be called from interrupt context,
544  * because the bus read/write functions may wait for an interrupt
545  * to conclude the operation.
546  */
547 int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum)
548 {
549         int retval;
550
551         BUG_ON(in_interrupt());
552
553         mutex_lock(&bus->mdio_lock);
554         retval = bus->read(bus, addr, regnum);
555         mutex_unlock(&bus->mdio_lock);
556
557         trace_mdio_access(bus, 1, addr, regnum, retval, retval);
558
559         return retval;
560 }
561 EXPORT_SYMBOL(mdiobus_read);
562
563 /**
564  * mdiobus_write_nested - Nested version of the mdiobus_write function
565  * @bus: the mii_bus struct
566  * @addr: the phy address
567  * @regnum: register number to write
568  * @val: value to write to @regnum
569  *
570  * In case of nested MDIO bus access avoid lockdep false positives by
571  * using mutex_lock_nested().
572  *
573  * NOTE: MUST NOT be called from interrupt context,
574  * because the bus read/write functions may wait for an interrupt
575  * to conclude the operation.
576  */
577 int mdiobus_write_nested(struct mii_bus *bus, int addr, u32 regnum, u16 val)
578 {
579         int err;
580
581         BUG_ON(in_interrupt());
582
583         mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
584         err = bus->write(bus, addr, regnum, val);
585         mutex_unlock(&bus->mdio_lock);
586
587         trace_mdio_access(bus, 0, addr, regnum, val, err);
588
589         return err;
590 }
591 EXPORT_SYMBOL(mdiobus_write_nested);
592
593 /**
594  * mdiobus_write - Convenience function for writing a given MII mgmt register
595  * @bus: the mii_bus struct
596  * @addr: the phy address
597  * @regnum: register number to write
598  * @val: value to write to @regnum
599  *
600  * NOTE: MUST NOT be called from interrupt context,
601  * because the bus read/write functions may wait for an interrupt
602  * to conclude the operation.
603  */
604 int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val)
605 {
606         int err;
607
608         BUG_ON(in_interrupt());
609
610         mutex_lock(&bus->mdio_lock);
611         err = bus->write(bus, addr, regnum, val);
612         mutex_unlock(&bus->mdio_lock);
613
614         trace_mdio_access(bus, 0, addr, regnum, val, err);
615
616         return err;
617 }
618 EXPORT_SYMBOL(mdiobus_write);
619
620 /**
621  * mdio_bus_match - determine if given MDIO driver supports the given
622  *                  MDIO device
623  * @dev: target MDIO device
624  * @drv: given MDIO driver
625  *
626  * Description: Given a MDIO device, and a MDIO driver, return 1 if
627  *   the driver supports the device.  Otherwise, return 0. This may
628  *   require calling the devices own match function, since different classes
629  *   of MDIO devices have different match criteria.
630  */
631 static int mdio_bus_match(struct device *dev, struct device_driver *drv)
632 {
633         struct mdio_device *mdio = to_mdio_device(dev);
634
635         if (of_driver_match_device(dev, drv))
636                 return 1;
637
638         if (mdio->bus_match)
639                 return mdio->bus_match(dev, drv);
640
641         return 0;
642 }
643
644 static int mdio_uevent(struct device *dev, struct kobj_uevent_env *env)
645 {
646         int rc;
647
648         /* Some devices have extra OF data and an OF-style MODALIAS */
649         rc = of_device_uevent_modalias(dev, env);
650         if (rc != -ENODEV)
651                 return rc;
652
653         return 0;
654 }
655
656 #ifdef CONFIG_PM
657 static int mdio_bus_suspend(struct device *dev)
658 {
659         struct mdio_device *mdio = to_mdio_device(dev);
660
661         if (mdio->pm_ops && mdio->pm_ops->suspend)
662                 return mdio->pm_ops->suspend(dev);
663
664         return 0;
665 }
666
667 static int mdio_bus_resume(struct device *dev)
668 {
669         struct mdio_device *mdio = to_mdio_device(dev);
670
671         if (mdio->pm_ops && mdio->pm_ops->resume)
672                 return mdio->pm_ops->resume(dev);
673
674         return 0;
675 }
676
677 static int mdio_bus_restore(struct device *dev)
678 {
679         struct mdio_device *mdio = to_mdio_device(dev);
680
681         if (mdio->pm_ops && mdio->pm_ops->restore)
682                 return mdio->pm_ops->restore(dev);
683
684         return 0;
685 }
686
687 static const struct dev_pm_ops mdio_bus_pm_ops = {
688         .suspend = mdio_bus_suspend,
689         .resume = mdio_bus_resume,
690         .freeze = mdio_bus_suspend,
691         .thaw = mdio_bus_resume,
692         .restore = mdio_bus_restore,
693 };
694
695 #define MDIO_BUS_PM_OPS (&mdio_bus_pm_ops)
696
697 #else
698
699 #define MDIO_BUS_PM_OPS NULL
700
701 #endif /* CONFIG_PM */
702
703 struct bus_type mdio_bus_type = {
704         .name           = "mdio_bus",
705         .match          = mdio_bus_match,
706         .uevent         = mdio_uevent,
707         .pm             = MDIO_BUS_PM_OPS,
708 };
709 EXPORT_SYMBOL(mdio_bus_type);
710
711 int __init mdio_bus_init(void)
712 {
713         int ret;
714
715         ret = class_register(&mdio_bus_class);
716         if (!ret) {
717                 ret = bus_register(&mdio_bus_type);
718                 if (ret)
719                         class_unregister(&mdio_bus_class);
720         }
721
722         return ret;
723 }
724
725 #if IS_ENABLED(CONFIG_PHYLIB)
726 void mdio_bus_exit(void)
727 {
728         class_unregister(&mdio_bus_class);
729         bus_unregister(&mdio_bus_type);
730 }
731 EXPORT_SYMBOL_GPL(mdio_bus_exit);
732 #else
733 module_init(mdio_bus_init);
734 /* no module_exit, intentional */
735 MODULE_LICENSE("GPL");
736 MODULE_DESCRIPTION("MDIO bus/device layer");
737 #endif