From patchwork Mon Sep 2 12:30:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 271920 X-Patchwork-Delegate: joe.hershberger@gmail.com 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 1CB422C008A for ; Mon, 2 Sep 2013 22:36:14 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 17F534A067; Mon, 2 Sep 2013 14:36:12 +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 iRBlqrGVGX6r; Mon, 2 Sep 2013 14:36:11 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B842C4A060; Mon, 2 Sep 2013 14:36:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2EFD54A060 for ; Mon, 2 Sep 2013 14:36:09 +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 1ZaeQmZdr-Tj for ; Mon, 2 Sep 2013 14:36:03 +0200 (CEST) X-Greylist: delayed 349 seconds by postgrey-1.27 at theia; Mon, 02 Sep 2013 14:35:57 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 mail-we0-f172.google.com (mail-we0-f172.google.com [74.125.82.172]) by theia.denx.de (Postfix) with ESMTPS id 2460A4A05F for ; Mon, 2 Sep 2013 14:35:57 +0200 (CEST) Received: by mail-we0-f172.google.com with SMTP id n5so2902898wev.17 for ; Mon, 02 Sep 2013 05:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=OQifyQcaOBKllphEm6tsRpv5gHgSTRGIyz+t27PDwvc=; b=xE9iV0hmzF364vcgADH/q1nlJV1FpWnOJUhDKD7YAitf15+R548Dl6yBgub99puRJ4 pY5CKjzGdezZ20KX/CNr6OlJo3N+egP2vp2Uh3A+30gW0ikXFnla/V4923z3lIfAPV7P LN/nNZthNrN/vdkFPqhtO67TqhQft17SHEovcr0gDnszB67PHk+W8zl52OW/aC69+1QP eSXySSMVoW2qqzcqeHmWU/Z0e40w8USHb9I0g+cEx8Wppp1n2B/UJVDUa43qaZjN7LzV fw3iI/MYMcmV9V0Bn1Ap3nHnPhW0jyQIX++P/in1VcXXZg5sgWmmm7Es7nmqv/Fn+J+o Magw== X-Received: by 10.194.104.42 with SMTP id gb10mr22727905wjb.16.1378125008142; Mon, 02 Sep 2013 05:30:08 -0700 (PDT) Received: from chgm-pc.lan (089144206167.atnat0015.highway.bob.at. [89.144.206.167]) by mx.google.com with ESMTPSA id mw9sm17856225wic.4.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Sep 2013 05:30:07 -0700 (PDT) From: Christian Gmeiner To: u-boot@lists.denx.de Date: Mon, 2 Sep 2013 14:30:01 +0200 Message-Id: <1378125001-27222-1-git-send-email-christian.gmeiner@gmail.com> X-Mailer: git-send-email 1.7.10.4 Subject: [U-Boot] [PATCH v2] net: Add fixed phy driver 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This patch is needed if the MAC is directly connected to a ethernet switch. In my case the FEC MAC is connected to a Micrel KSZ8895. All I need to to is configure my fixed phy/link like: #define IMX_FEC_BASE ENET_BASE_ADDR #define CONFIG_FEC_XCV_TYPE MII100 #define CONFIG_ETHPRIME "FEC" #define CONFIG_FEC_MXC_PHYADDR 0x5 #define CONFIG_PHYLIB #define CONFIG_PHY_FIXED #define CONFIG_PHY_FIXED_SPEED SPEED_100 #define CONFIG_PHY_FIXED_DUPLEX DUPLEX_FULL Signed-off-by: Christian Gmeiner --- drivers/net/phy/Makefile | 1 + drivers/net/phy/fixed.c | 34 ++++++++++++++++++++++++++++++++++ drivers/net/phy/phy.c | 3 +++ 3 files changed, 38 insertions(+) create mode 100644 drivers/net/phy/fixed.c diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index fe762e9..17e486f 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile @@ -19,6 +19,7 @@ COBJS-$(CONFIG_PHY_ATHEROS) += atheros.o COBJS-$(CONFIG_PHY_BROADCOM) += broadcom.o COBJS-$(CONFIG_PHY_DAVICOM) += davicom.o COBJS-$(CONFIG_PHY_ET1011C) += et1011c.o +COBJS-$(CONFIG_PHY_FIXED) += fixed.o COBJS-$(CONFIG_PHY_ICPLUS) += icplus.o COBJS-$(CONFIG_PHY_LXT) += lxt.o COBJS-$(CONFIG_PHY_MARVELL) += marvell.o diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c new file mode 100644 index 0000000..70ff7bb --- /dev/null +++ b/drivers/net/phy/fixed.c @@ -0,0 +1,34 @@ +/* + * Fixed PHY driver + * + * SPDX-License-Identifier: GPL-2.0+ + * + * Copyright 2013 Bachmann electronic GmbH + * author Gmeiner Christian + */ +#include +#include +#include + +int fixed_config(struct phy_device *phydev) +{ + phydev->link = 1; + phydev->duplex = CONFIG_PHY_FIXED_SPEED; + phydev->speed = CONFIG_PHY_FIXED_DUPLEX; + + return 0; +} + +static struct phy_driver fixed_driver = { + .uid = 0xffffffff, + .mask = 0x00000000, + .name = "Fixed PHY", + .features = 0, + .config = &fixed_config, +}; + +int phy_fixed_init(void) +{ + phy_register(&fixed_driver); + return 0; +} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 62925bb..f2bccaf 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -479,6 +479,9 @@ int phy_init(void) #ifdef CONFIG_PHY_VITESSE phy_vitesse_init(); #endif +#ifdef CONFIG_PHY_FIXED + phy_fixed_init(); +#endif return 0; }