From patchwork Thu Jun 20 13:46:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SARTRE Leo X-Patchwork-Id: 252934 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 8F4302C023D for ; Thu, 20 Jun 2013 23:50:41 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BFC884A18B; Thu, 20 Jun 2013 15:50:36 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 530sNJXsMs0E; Thu, 20 Jun 2013 15:50:36 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2A2374A193; Thu, 20 Jun 2013 15:50:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CA2024A16D for ; Thu, 20 Jun 2013 15:50:22 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TRfVcJmefLTB for ; Thu, 20 Jun 2013 15:50:18 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail1.adetelgroup.com (mail1.adetelgroup.com [109.7.94.227]) by theia.denx.de (Postfix) with SMTP id 23BC54A171 for ; Thu, 20 Jun 2013 15:50:16 +0200 (CEST) Received: from mail.adetelgroup.com ([192.168.102.3]) by mail1.adetelgroup.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 20 Jun 2013 15:50:13 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Received: from 192.168.113.1 ([192.168.113.1]) by frontmail.adetel.com ([192.168.102.3]) with Microsoft Exchange Server HTTP-DAV ; Thu, 20 Jun 2013 13:50:09 +0000 MIME-Version: 1.0 In-Reply-To: <1371736010-24101-1-git-send-email-lsartre@adeneo-embedded.com> X-Mailer: git-send-email 1.7.10.4 Content-class: urn:content-classes:message Date: Thu, 20 Jun 2013 15:46:48 +0200 Message-ID: <3465D313FDFB824F9A9C8CD24FA4F6BC0108CD36@frontmail.adetel.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH v2 1/3] PHY: micrel: helper function for KSZ9031 Thread-Index: Ac5tvRRe77uNdtGYQWC0RT5tlqPN3w== References: <1371736010-24101-1-git-send-email-lsartre@adeneo-embedded.com> From: "SARTRE Leo" To: X-OriginalArrivalTime: 20 Jun 2013 13:50:13.0054 (UTC) FILETIME=[164A55E0:01CE6DBD] Cc: otavio@ossystems.com.br Subject: [U-Boot] [PATCH v2 1/3] PHY: micrel: helper function for KSZ9031 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de micrel.c: Add function ksz9031_phy_extended_write, helper to MDD register write micrel.h: Prototype and define MDD registers Signed-off-by: Leo Sartre Acked-by: Otavio Salvador --- drivers/net/phy/micrel.c | 25 +++++++++++++++++++++++++ include/micrel.h | 7 +++++++ 2 files changed, 32 insertions(+) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 2a8b6cb..404faac 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -151,6 +151,31 @@ static struct phy_driver ksz9021_driver = { /* * KSZ9031 */ + +/* PHY Registers */ +#define MII_KSZ9031_MMD_ACCES_CTRL 0x0d +#define MII_KSZ9031_MMD_REG_DATA 0x0e + +/* Accessors to extended registers*/ +int ksz9031_phy_extended_write(struct phy_device *phydev, + int devaddr, + int regnum, + u16 val) +{ + /*select register addr for mmd*/ + phy_write(phydev, MDIO_DEVAD_NONE, + MII_KSZ9031_MMD_ACCES_CTRL, devaddr); + /*select register for mmd*/ + phy_write(phydev, MDIO_DEVAD_NONE, + MII_KSZ9031_MMD_REG_DATA, regnum); + /*setup mode*/ + phy_write(phydev, MDIO_DEVAD_NONE, + MII_KSZ9031_MMD_ACCES_CTRL, (devaddr | 0xC000)); + /*write the value*/ + return phy_write(phydev, MDIO_DEVAD_NONE, + MII_KSZ9031_MMD_REG_DATA, val); +} + static struct phy_driver ksz9031_driver = { .name = "Micrel ksz9031", .uid = 0x221620, diff --git a/include/micrel.h b/include/micrel.h index 25e8a46..d63ff45 100644 --- a/include/micrel.h +++ b/include/micrel.h @@ -9,8 +9,15 @@ #define MII_KSZ9021_EXT_RGMII_TX_DATA_SKEW 0x106 #define MII_KSZ9021_EXT_ANALOG_TEST 0x107 +#define MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW 0x4 +#define MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW 0x5 +#define MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW 0x6 +#define MII_KSZ9031_EXT_RGMII_CLOCK_SKEW 0x8 + struct phy_device; int ksz9021_phy_extended_write(struct phy_device *phydev, int regnum, u16 val); int ksz9021_phy_extended_read(struct phy_device *phydev, int regnum); +int ksz9031_phy_extended_write(struct phy_device *phydev, int devaddr, + int regnum, u16 val); #endif