[PATCH] PHY Layer fixup
[linux-2.6/linux-2.6-openrd.git] / drivers / net / phy / phy.c
blobd9e11f93bf3a34c54560dc724d56ce71b85d8141
1 /*
2 * drivers/net/phy/phy.c
4 * Framework for configuring and reading PHY devices
5 * Based on code in sungem_phy.c and gianfar_phy.c
7 * Author: Andy Fleming
9 * Copyright (c) 2004 Freescale Semiconductor, Inc.
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
17 #include <linux/config.h>
18 #include <linux/kernel.h>
19 #include <linux/sched.h>
20 #include <linux/string.h>
21 #include <linux/errno.h>
22 #include <linux/unistd.h>
23 #include <linux/slab.h>
24 #include <linux/interrupt.h>
25 #include <linux/init.h>
26 #include <linux/delay.h>
27 #include <linux/netdevice.h>
28 #include <linux/etherdevice.h>
29 #include <linux/skbuff.h>
30 #include <linux/spinlock.h>
31 #include <linux/mm.h>
32 #include <linux/module.h>
33 #include <linux/version.h>
34 #include <linux/mii.h>
35 #include <linux/ethtool.h>
36 #include <linux/phy.h>
38 #include <asm/io.h>
39 #include <asm/irq.h>
40 #include <asm/uaccess.h>
42 /* Convenience function to print out the current phy status
44 void phy_print_status(struct phy_device *phydev)
46 pr_info("%s: Link is %s", phydev->dev.bus_id,
47 phydev->link ? "Up" : "Down");
48 if (phydev->link)
49 printk(" - %d/%s", phydev->speed,
50 DUPLEX_FULL == phydev->duplex ?
51 "Full" : "Half");
53 printk("\n");
55 EXPORT_SYMBOL(phy_print_status);
58 /* Convenience functions for reading/writing a given PHY
59 * register. They MUST NOT be called from interrupt context,
60 * because the bus read/write functions may wait for an interrupt
61 * to conclude the operation. */
62 int phy_read(struct phy_device *phydev, u16 regnum)
64 int retval;
65 struct mii_bus *bus = phydev->bus;
67 spin_lock_bh(&bus->mdio_lock);
68 retval = bus->read(bus, phydev->addr, regnum);
69 spin_unlock_bh(&bus->mdio_lock);
71 return retval;
73 EXPORT_SYMBOL(phy_read);
75 int phy_write(struct phy_device *phydev, u16 regnum, u16 val)
77 int err;
78 struct mii_bus *bus = phydev->bus;
80 spin_lock_bh(&bus->mdio_lock);
81 err = bus->write(bus, phydev->addr, regnum, val);
82 spin_unlock_bh(&bus->mdio_lock);
84 return err;
86 EXPORT_SYMBOL(phy_write);
89 int phy_clear_interrupt(struct phy_device *phydev)
91 int err = 0;
93 if (phydev->drv->ack_interrupt)
94 err = phydev->drv->ack_interrupt(phydev);
96 return err;
100 int phy_config_interrupt(struct phy_device *phydev, u32 interrupts)
102 int err = 0;
104 phydev->interrupts = interrupts;
105 if (phydev->drv->config_intr)
106 err = phydev->drv->config_intr(phydev);
108 return err;
112 /* phy_aneg_done
114 * description: Reads the status register and returns 0 either if
115 * auto-negotiation is incomplete, or if there was an error.
116 * Returns BMSR_ANEGCOMPLETE if auto-negotiation is done.
118 static inline int phy_aneg_done(struct phy_device *phydev)
120 int retval;
122 retval = phy_read(phydev, MII_BMSR);
124 return (retval < 0) ? retval : (retval & BMSR_ANEGCOMPLETE);
127 /* A structure for mapping a particular speed and duplex
128 * combination to a particular SUPPORTED and ADVERTISED value */
129 struct phy_setting {
130 int speed;
131 int duplex;
132 u32 setting;
135 /* A mapping of all SUPPORTED settings to speed/duplex */
136 static struct phy_setting settings[] = {
138 .speed = 10000,
139 .duplex = DUPLEX_FULL,
140 .setting = SUPPORTED_10000baseT_Full,
143 .speed = SPEED_1000,
144 .duplex = DUPLEX_FULL,
145 .setting = SUPPORTED_1000baseT_Full,
148 .speed = SPEED_1000,
149 .duplex = DUPLEX_HALF,
150 .setting = SUPPORTED_1000baseT_Half,
153 .speed = SPEED_100,
154 .duplex = DUPLEX_FULL,
155 .setting = SUPPORTED_100baseT_Full,
158 .speed = SPEED_100,
159 .duplex = DUPLEX_HALF,
160 .setting = SUPPORTED_100baseT_Half,
163 .speed = SPEED_10,
164 .duplex = DUPLEX_FULL,
165 .setting = SUPPORTED_10baseT_Full,
168 .speed = SPEED_10,
169 .duplex = DUPLEX_HALF,
170 .setting = SUPPORTED_10baseT_Half,
174 #define MAX_NUM_SETTINGS (sizeof(settings)/sizeof(struct phy_setting))
176 /* phy_find_setting
178 * description: Searches the settings array for the setting which
179 * matches the desired speed and duplex, and returns the index
180 * of that setting. Returns the index of the last setting if
181 * none of the others match.
183 static inline int phy_find_setting(int speed, int duplex)
185 int idx = 0;
187 while (idx < ARRAY_SIZE(settings) &&
188 (settings[idx].speed != speed ||
189 settings[idx].duplex != duplex))
190 idx++;
192 return idx < MAX_NUM_SETTINGS ? idx : MAX_NUM_SETTINGS - 1;
195 /* phy_find_valid
196 * idx: The first index in settings[] to search
197 * features: A mask of the valid settings
199 * description: Returns the index of the first valid setting less
200 * than or equal to the one pointed to by idx, as determined by
201 * the mask in features. Returns the index of the last setting
202 * if nothing else matches.
204 static inline int phy_find_valid(int idx, u32 features)
206 while (idx < MAX_NUM_SETTINGS && !(settings[idx].setting & features))
207 idx++;
209 return idx < MAX_NUM_SETTINGS ? idx : MAX_NUM_SETTINGS - 1;
212 /* phy_sanitize_settings
214 * description: Make sure the PHY is set to supported speeds and
215 * duplexes. Drop down by one in this order: 1000/FULL,
216 * 1000/HALF, 100/FULL, 100/HALF, 10/FULL, 10/HALF
218 void phy_sanitize_settings(struct phy_device *phydev)
220 u32 features = phydev->supported;
221 int idx;
223 /* Sanitize settings based on PHY capabilities */
224 if ((features & SUPPORTED_Autoneg) == 0)
225 phydev->autoneg = 0;
227 idx = phy_find_valid(phy_find_setting(phydev->speed, phydev->duplex),
228 features);
230 phydev->speed = settings[idx].speed;
231 phydev->duplex = settings[idx].duplex;
233 EXPORT_SYMBOL(phy_sanitize_settings);
235 /* phy_ethtool_sset:
236 * A generic ethtool sset function. Handles all the details
238 * A few notes about parameter checking:
239 * - We don't set port or transceiver, so we don't care what they
240 * were set to.
241 * - phy_start_aneg() will make sure forced settings are sane, and
242 * choose the next best ones from the ones selected, so we don't
243 * care if ethtool tries to give us bad values
245 * A note about the PHYCONTROL Layer. If you turn off
246 * CONFIG_PHYCONTROL, you will need to read the PHY status
247 * registers after this function completes, and update your
248 * controller manually.
250 int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
252 if (cmd->phy_address != phydev->addr)
253 return -EINVAL;
255 /* We make sure that we don't pass unsupported
256 * values in to the PHY */
257 cmd->advertising &= phydev->supported;
259 /* Verify the settings we care about. */
260 if (cmd->autoneg != AUTONEG_ENABLE && cmd->autoneg != AUTONEG_DISABLE)
261 return -EINVAL;
263 if (cmd->autoneg == AUTONEG_ENABLE && cmd->advertising == 0)
264 return -EINVAL;
266 if (cmd->autoneg == AUTONEG_DISABLE
267 && ((cmd->speed != SPEED_1000
268 && cmd->speed != SPEED_100
269 && cmd->speed != SPEED_10)
270 || (cmd->duplex != DUPLEX_HALF
271 && cmd->duplex != DUPLEX_FULL)))
272 return -EINVAL;
274 phydev->autoneg = cmd->autoneg;
276 phydev->speed = cmd->speed;
278 phydev->advertising = cmd->advertising;
280 if (AUTONEG_ENABLE == cmd->autoneg)
281 phydev->advertising |= ADVERTISED_Autoneg;
282 else
283 phydev->advertising &= ~ADVERTISED_Autoneg;
285 phydev->duplex = cmd->duplex;
287 /* Restart the PHY */
288 phy_start_aneg(phydev);
290 return 0;
293 int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd)
295 cmd->supported = phydev->supported;
297 cmd->advertising = phydev->advertising;
299 cmd->speed = phydev->speed;
300 cmd->duplex = phydev->duplex;
301 cmd->port = PORT_MII;
302 cmd->phy_address = phydev->addr;
303 cmd->transceiver = XCVR_EXTERNAL;
304 cmd->autoneg = phydev->autoneg;
306 return 0;
310 /* Note that this function is currently incompatible with the
311 * PHYCONTROL layer. It changes registers without regard to
312 * current state. Use at own risk
314 int phy_mii_ioctl(struct phy_device *phydev,
315 struct mii_ioctl_data *mii_data, int cmd)
317 u16 val = mii_data->val_in;
319 switch (cmd) {
320 case SIOCGMIIPHY:
321 mii_data->phy_id = phydev->addr;
322 break;
323 case SIOCGMIIREG:
324 mii_data->val_out = phy_read(phydev, mii_data->reg_num);
325 break;
327 case SIOCSMIIREG:
328 if (!capable(CAP_NET_ADMIN))
329 return -EPERM;
331 if (mii_data->phy_id == phydev->addr) {
332 switch(mii_data->reg_num) {
333 case MII_BMCR:
334 if (val & (BMCR_RESET|BMCR_ANENABLE))
335 phydev->autoneg = AUTONEG_DISABLE;
336 else
337 phydev->autoneg = AUTONEG_ENABLE;
338 if ((!phydev->autoneg) && (val & BMCR_FULLDPLX))
339 phydev->duplex = DUPLEX_FULL;
340 else
341 phydev->duplex = DUPLEX_HALF;
342 break;
343 case MII_ADVERTISE:
344 phydev->advertising = val;
345 break;
346 default:
347 /* do nothing */
348 break;
352 phy_write(phydev, mii_data->reg_num, val);
354 if (mii_data->reg_num == MII_BMCR
355 && val & BMCR_RESET
356 && phydev->drv->config_init)
357 phydev->drv->config_init(phydev);
358 break;
361 return 0;
364 /* phy_start_aneg
366 * description: Sanitizes the settings (if we're not
367 * autonegotiating them), and then calls the driver's
368 * config_aneg function. If the PHYCONTROL Layer is operating,
369 * we change the state to reflect the beginning of
370 * Auto-negotiation or forcing.
372 int phy_start_aneg(struct phy_device *phydev)
374 int err;
376 spin_lock(&phydev->lock);
378 if (AUTONEG_DISABLE == phydev->autoneg)
379 phy_sanitize_settings(phydev);
381 err = phydev->drv->config_aneg(phydev);
383 #ifdef CONFIG_PHYCONTROL
384 if (err < 0)
385 goto out_unlock;
387 if (phydev->state != PHY_HALTED) {
388 if (AUTONEG_ENABLE == phydev->autoneg) {
389 phydev->state = PHY_AN;
390 phydev->link_timeout = PHY_AN_TIMEOUT;
391 } else {
392 phydev->state = PHY_FORCING;
393 phydev->link_timeout = PHY_FORCE_TIMEOUT;
397 out_unlock:
398 #endif
399 spin_unlock(&phydev->lock);
400 return err;
402 EXPORT_SYMBOL(phy_start_aneg);
405 #ifdef CONFIG_PHYCONTROL
406 static void phy_change(void *data);
407 static void phy_timer(unsigned long data);
409 /* phy_start_machine:
411 * description: The PHY infrastructure can run a state machine
412 * which tracks whether the PHY is starting up, negotiating,
413 * etc. This function starts the timer which tracks the state
414 * of the PHY. If you want to be notified when the state
415 * changes, pass in the callback, otherwise, pass NULL. If you
416 * want to maintain your own state machine, do not call this
417 * function. */
418 void phy_start_machine(struct phy_device *phydev,
419 void (*handler)(struct net_device *))
421 phydev->adjust_state = handler;
423 init_timer(&phydev->phy_timer);
424 phydev->phy_timer.function = &phy_timer;
425 phydev->phy_timer.data = (unsigned long) phydev;
426 mod_timer(&phydev->phy_timer, jiffies + HZ);
429 /* phy_stop_machine
431 * description: Stops the state machine timer, sets the state to
432 * UP (unless it wasn't up yet), and then frees the interrupt,
433 * if it is in use. This function must be called BEFORE
434 * phy_detach.
436 void phy_stop_machine(struct phy_device *phydev)
438 del_timer_sync(&phydev->phy_timer);
440 spin_lock(&phydev->lock);
441 if (phydev->state > PHY_UP)
442 phydev->state = PHY_UP;
443 spin_unlock(&phydev->lock);
445 if (phydev->irq != PHY_POLL)
446 phy_stop_interrupts(phydev);
448 phydev->adjust_state = NULL;
451 /* phy_force_reduction
453 * description: Reduces the speed/duplex settings by
454 * one notch. The order is so:
455 * 1000/FULL, 1000/HALF, 100/FULL, 100/HALF,
456 * 10/FULL, 10/HALF. The function bottoms out at 10/HALF.
458 static void phy_force_reduction(struct phy_device *phydev)
460 int idx;
462 idx = phy_find_setting(phydev->speed, phydev->duplex);
464 idx++;
466 idx = phy_find_valid(idx, phydev->supported);
468 phydev->speed = settings[idx].speed;
469 phydev->duplex = settings[idx].duplex;
471 pr_info("Trying %d/%s\n", phydev->speed,
472 DUPLEX_FULL == phydev->duplex ?
473 "FULL" : "HALF");
477 /* phy_error:
479 * Moves the PHY to the HALTED state in response to a read
480 * or write error, and tells the controller the link is down.
481 * Must not be called from interrupt context, or while the
482 * phydev->lock is held.
484 void phy_error(struct phy_device *phydev)
486 spin_lock(&phydev->lock);
487 phydev->state = PHY_HALTED;
488 spin_unlock(&phydev->lock);
491 /* phy_interrupt
493 * description: When a PHY interrupt occurs, the handler disables
494 * interrupts, and schedules a work task to clear the interrupt.
496 static irqreturn_t phy_interrupt(int irq, void *phy_dat, struct pt_regs *regs)
498 struct phy_device *phydev = phy_dat;
500 /* The MDIO bus is not allowed to be written in interrupt
501 * context, so we need to disable the irq here. A work
502 * queue will write the PHY to disable and clear the
503 * interrupt, and then reenable the irq line. */
504 disable_irq_nosync(irq);
506 schedule_work(&phydev->phy_queue);
508 return IRQ_HANDLED;
511 /* Enable the interrupts from the PHY side */
512 int phy_enable_interrupts(struct phy_device *phydev)
514 int err;
516 err = phy_clear_interrupt(phydev);
518 if (err < 0)
519 return err;
521 err = phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED);
523 return err;
525 EXPORT_SYMBOL(phy_enable_interrupts);
527 /* Disable the PHY interrupts from the PHY side */
528 int phy_disable_interrupts(struct phy_device *phydev)
530 int err;
532 /* Disable PHY interrupts */
533 err = phy_config_interrupt(phydev, PHY_INTERRUPT_DISABLED);
535 if (err)
536 goto phy_err;
538 /* Clear the interrupt */
539 err = phy_clear_interrupt(phydev);
541 if (err)
542 goto phy_err;
544 return 0;
546 phy_err:
547 phy_error(phydev);
549 return err;
551 EXPORT_SYMBOL(phy_disable_interrupts);
553 /* phy_start_interrupts
555 * description: Request the interrupt for the given PHY. If
556 * this fails, then we set irq to PHY_POLL.
557 * Otherwise, we enable the interrupts in the PHY.
558 * Returns 0 on success.
559 * This should only be called with a valid IRQ number.
561 int phy_start_interrupts(struct phy_device *phydev)
563 int err = 0;
565 INIT_WORK(&phydev->phy_queue, phy_change, phydev);
567 if (request_irq(phydev->irq, phy_interrupt,
568 SA_SHIRQ,
569 "phy_interrupt",
570 phydev) < 0) {
571 printk(KERN_WARNING "%s: Can't get IRQ %d (PHY)\n",
572 phydev->bus->name,
573 phydev->irq);
574 phydev->irq = PHY_POLL;
575 return 0;
578 err = phy_enable_interrupts(phydev);
580 return err;
582 EXPORT_SYMBOL(phy_start_interrupts);
584 int phy_stop_interrupts(struct phy_device *phydev)
586 int err;
588 err = phy_disable_interrupts(phydev);
590 if (err)
591 phy_error(phydev);
593 free_irq(phydev->irq, phydev);
595 return err;
597 EXPORT_SYMBOL(phy_stop_interrupts);
600 /* Scheduled by the phy_interrupt/timer to handle PHY changes */
601 static void phy_change(void *data)
603 int err;
604 struct phy_device *phydev = data;
606 err = phy_disable_interrupts(phydev);
608 if (err)
609 goto phy_err;
611 spin_lock(&phydev->lock);
612 if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state))
613 phydev->state = PHY_CHANGELINK;
614 spin_unlock(&phydev->lock);
616 enable_irq(phydev->irq);
618 /* Reenable interrupts */
619 err = phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED);
621 if (err)
622 goto irq_enable_err;
624 return;
626 irq_enable_err:
627 disable_irq(phydev->irq);
628 phy_err:
629 phy_error(phydev);
632 /* Bring down the PHY link, and stop checking the status. */
633 void phy_stop(struct phy_device *phydev)
635 spin_lock(&phydev->lock);
637 if (PHY_HALTED == phydev->state)
638 goto out_unlock;
640 if (phydev->irq != PHY_POLL) {
641 /* Clear any pending interrupts */
642 phy_clear_interrupt(phydev);
644 /* Disable PHY Interrupts */
645 phy_config_interrupt(phydev, PHY_INTERRUPT_DISABLED);
648 phydev->state = PHY_HALTED;
650 out_unlock:
651 spin_unlock(&phydev->lock);
655 /* phy_start
657 * description: Indicates the attached device's readiness to
658 * handle PHY-related work. Used during startup to start the
659 * PHY, and after a call to phy_stop() to resume operation.
660 * Also used to indicate the MDIO bus has cleared an error
661 * condition.
663 void phy_start(struct phy_device *phydev)
665 spin_lock(&phydev->lock);
667 switch (phydev->state) {
668 case PHY_STARTING:
669 phydev->state = PHY_PENDING;
670 break;
671 case PHY_READY:
672 phydev->state = PHY_UP;
673 break;
674 case PHY_HALTED:
675 phydev->state = PHY_RESUMING;
676 default:
677 break;
679 spin_unlock(&phydev->lock);
681 EXPORT_SYMBOL(phy_stop);
682 EXPORT_SYMBOL(phy_start);
684 /* PHY timer which handles the state machine */
685 static void phy_timer(unsigned long data)
687 struct phy_device *phydev = (struct phy_device *)data;
688 int needs_aneg = 0;
689 int err = 0;
691 spin_lock(&phydev->lock);
693 if (phydev->adjust_state)
694 phydev->adjust_state(phydev->attached_dev);
696 switch(phydev->state) {
697 case PHY_DOWN:
698 case PHY_STARTING:
699 case PHY_READY:
700 case PHY_PENDING:
701 break;
702 case PHY_UP:
703 needs_aneg = 1;
705 phydev->link_timeout = PHY_AN_TIMEOUT;
707 break;
708 case PHY_AN:
709 /* Check if negotiation is done. Break
710 * if there's an error */
711 err = phy_aneg_done(phydev);
712 if (err < 0)
713 break;
715 /* If auto-negotiation is done, we change to
716 * either RUNNING, or NOLINK */
717 if (err > 0) {
718 err = phy_read_status(phydev);
720 if (err)
721 break;
723 if (phydev->link) {
724 phydev->state = PHY_RUNNING;
725 netif_carrier_on(phydev->attached_dev);
726 } else {
727 phydev->state = PHY_NOLINK;
728 netif_carrier_off(phydev->attached_dev);
731 phydev->adjust_link(phydev->attached_dev);
733 } else if (0 == phydev->link_timeout--) {
734 /* The counter expired, so either we
735 * switch to forced mode, or the
736 * magic_aneg bit exists, and we try aneg
737 * again */
738 if (!(phydev->drv->flags & PHY_HAS_MAGICANEG)) {
739 int idx;
741 /* We'll start from the
742 * fastest speed, and work
743 * our way down */
744 idx = phy_find_valid(0,
745 phydev->supported);
747 phydev->speed = settings[idx].speed;
748 phydev->duplex = settings[idx].duplex;
750 phydev->autoneg = AUTONEG_DISABLE;
751 phydev->state = PHY_FORCING;
752 phydev->link_timeout =
753 PHY_FORCE_TIMEOUT;
755 pr_info("Trying %d/%s\n",
756 phydev->speed,
757 DUPLEX_FULL ==
758 phydev->duplex ?
759 "FULL" : "HALF");
762 needs_aneg = 1;
764 break;
765 case PHY_NOLINK:
766 err = phy_read_status(phydev);
768 if (err)
769 break;
771 if (phydev->link) {
772 phydev->state = PHY_RUNNING;
773 netif_carrier_on(phydev->attached_dev);
774 phydev->adjust_link(phydev->attached_dev);
776 break;
777 case PHY_FORCING:
778 err = phy_read_status(phydev);
780 if (err)
781 break;
783 if (phydev->link) {
784 phydev->state = PHY_RUNNING;
785 netif_carrier_on(phydev->attached_dev);
786 } else {
787 if (0 == phydev->link_timeout--) {
788 phy_force_reduction(phydev);
789 needs_aneg = 1;
793 phydev->adjust_link(phydev->attached_dev);
794 break;
795 case PHY_RUNNING:
796 /* Only register a CHANGE if we are
797 * polling */
798 if (PHY_POLL == phydev->irq)
799 phydev->state = PHY_CHANGELINK;
800 break;
801 case PHY_CHANGELINK:
802 err = phy_read_status(phydev);
804 if (err)
805 break;
807 if (phydev->link) {
808 phydev->state = PHY_RUNNING;
809 netif_carrier_on(phydev->attached_dev);
810 } else {
811 phydev->state = PHY_NOLINK;
812 netif_carrier_off(phydev->attached_dev);
815 phydev->adjust_link(phydev->attached_dev);
817 if (PHY_POLL != phydev->irq)
818 err = phy_config_interrupt(phydev,
819 PHY_INTERRUPT_ENABLED);
820 break;
821 case PHY_HALTED:
822 if (phydev->link) {
823 phydev->link = 0;
824 netif_carrier_off(phydev->attached_dev);
825 phydev->adjust_link(phydev->attached_dev);
827 break;
828 case PHY_RESUMING:
830 err = phy_clear_interrupt(phydev);
832 if (err)
833 break;
835 err = phy_config_interrupt(phydev,
836 PHY_INTERRUPT_ENABLED);
838 if (err)
839 break;
841 if (AUTONEG_ENABLE == phydev->autoneg) {
842 err = phy_aneg_done(phydev);
843 if (err < 0)
844 break;
846 /* err > 0 if AN is done.
847 * Otherwise, it's 0, and we're
848 * still waiting for AN */
849 if (err > 0) {
850 phydev->state = PHY_RUNNING;
851 } else {
852 phydev->state = PHY_AN;
853 phydev->link_timeout = PHY_AN_TIMEOUT;
855 } else
856 phydev->state = PHY_RUNNING;
857 break;
860 spin_unlock(&phydev->lock);
862 if (needs_aneg)
863 err = phy_start_aneg(phydev);
865 if (err < 0)
866 phy_error(phydev);
868 mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ);
871 #endif /* CONFIG_PHYCONTROL */