4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19 * Copyright (c) 2007 Freescale Semiconductor, Inc.
24 /* IP101A/G - IP1001 */
25 #define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */
26 #define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */
27 #define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */
28 #define IP1001_APS_ON 11 /* IP1001 APS Mode bit */
29 #define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */
30 #define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */
31 #define IP101A_G_IRQ_PIN_USED (1<<15) /* INTR pin used */
32 #define IP101A_G_IRQ_DEFAULT IP101A_G_IRQ_PIN_USED
34 static int ip1001_config(struct phy_device *phydev)
38 /* Enable Auto Power Saving mode */
39 c = phy_read(phydev, MDIO_DEVAD_NONE, IP1001_SPEC_CTRL_STATUS_2);
43 c = phy_write(phydev, MDIO_DEVAD_NONE, IP1001_SPEC_CTRL_STATUS_2, c);
47 /* INTR pin used: speed/link/duplex will cause an interrupt */
48 c = phy_write(phydev, MDIO_DEVAD_NONE, IP101A_G_IRQ_CONF_STATUS,
49 IP101A_G_IRQ_DEFAULT);
53 if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
55 * Additional delay (2ns) used to adjust RX clock phase
58 c = phy_read(phydev, MDIO_DEVAD_NONE, IP10XX_SPEC_CTRL_STATUS);
62 c |= IP1001_PHASE_SEL_MASK;
63 c = phy_write(phydev, MDIO_DEVAD_NONE, IP10XX_SPEC_CTRL_STATUS,
72 static int ip1001_startup(struct phy_device *phydev)
74 genphy_update_link(phydev);
75 genphy_parse_link(phydev);
79 static struct phy_driver IP1001_driver = {
80 .name = "ICPlus IP1001",
83 .features = PHY_GBIT_FEATURES,
84 .config = &ip1001_config,
85 .startup = &ip1001_startup,
86 .shutdown = &genphy_shutdown,
89 int phy_icplus_init(void)
91 phy_register(&IP1001_driver);