From patchwork Thu Oct 1 09:48:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sjoerd Simons X-Patchwork-Id: 54357 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 4BDBB205D0 for ; Thu, 1 Oct 2015 09:52:13 +0000 (UTC) Received: by labjk1 with SMTP id jk1sf34622234lab.0 for ; Thu, 01 Oct 2015 02:52:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=VIxfnp5SyFXPCMNfClHkWbFjzOi2m9fnod1k34pjcSI=; b=TdIIQiIiMkJjLcF/X2oKqCNEEqxU38+20DsMVCK1IdcwXkTwEJpkqhAKCQUVVk04hu iyg1MlnAtZqokMRxvmjWwrWO1vmZ5JEXtk6Wcz84PjT24alv37VxxUX6mEjN7t9FBOiM yonysDJFpT6b+Z3AAk3R5jqhbSmLEOaBj8/3Vuevt/0d7nAeHwCmZ5v1tXZSB5KPSCuN v45BY19JzPAJLOv5L/2XqZzhoFwljIvtbauZ2w+YO3dOiMOCyuIB84TxObWAcr2WS/N3 stAJc4KX2y0Bf9GMQ46yjz81itNntdK/IRcyaR6uKubycT0ZzC7+KHRAutlrbH3unQJX 1tcQ== X-Gm-Message-State: ALoCoQm3whOkRTX11/VjgA5Ft/vma+BxAv6n6835uh41REp5hJ+todzrOs7i/TDYaPjj8aDl0HtG X-Received: by 10.112.158.202 with SMTP id ww10mr1280203lbb.13.1443693131885; Thu, 01 Oct 2015 02:52:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.103 with SMTP id l7ls85550laf.78.gmail; Thu, 01 Oct 2015 02:52:11 -0700 (PDT) X-Received: by 10.112.159.136 with SMTP id xc8mr708013lbb.76.1443693131747; Thu, 01 Oct 2015 02:52:11 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id j82si2428929lfi.38.2015.10.01.02.52.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2015 02:52:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by labzv5 with SMTP id zv5so71537821lab.1 for ; Thu, 01 Oct 2015 02:52:11 -0700 (PDT) X-Received: by 10.112.129.202 with SMTP id ny10mr2445043lbb.112.1443693131278; Thu, 01 Oct 2015 02:52:11 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp484133lbq; Thu, 1 Oct 2015 02:52:10 -0700 (PDT) X-Received: by 10.180.188.33 with SMTP id fx1mr2365927wic.31.1443693130193; Thu, 01 Oct 2015 02:52:10 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id ea15si2673956wic.111.2015.10.01.02.52.09; Thu, 01 Oct 2015 02:52:10 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2D1754B9B3; Thu, 1 Oct 2015 11:51:16 +0200 (CEST) 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 RzDAjxmH2aTD; Thu, 1 Oct 2015 11:51:16 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A1B704B98D; Thu, 1 Oct 2015 11:51:00 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 51E9A4B976 for ; Thu, 1 Oct 2015 11:49:05 +0200 (CEST) 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 exBJX4G2_ceL for ; Thu, 1 Oct 2015 11:49:05 +0200 (CEST) X-policyd-weight: SBL_XBL_SPAMHAUS=ERR(-1.5) NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [93.93.135.160]) by theia.denx.de (Postfix) with ESMTPS id 6B2AD4B965 for ; Thu, 1 Oct 2015 11:48:55 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sjoerd) with ESMTPSA id 9904A6092C3 Received: by dusk.luon.net (Postfix, from userid 1000) id BEF9D235B3; Thu, 1 Oct 2015 11:48:13 +0200 (CEST) From: Sjoerd Simons To: Simon Glass Date: Thu, 1 Oct 2015 11:48:08 +0200 Message-Id: <1443692893-19905-6-git-send-email-sjoerd.simons@collabora.co.uk> X-Mailer: git-send-email 2.5.3 In-Reply-To: <1443692893-19905-1-git-send-email-sjoerd.simons@collabora.co.uk> References: <1443692893-19905-1-git-send-email-sjoerd.simons@collabora.co.uk> Cc: Joe Hershberger , Tom Rini , u-boot@lists.denx.de Subject: [U-Boot] [PATCH 05/10] net: designware: Add a post-started hook X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sjoerd.simons@collabora.co.uk X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Add the ability for e.g. drivers subclassing to register a function to be called after ethernet initialisation. This is useful if e.g. the driver needs to change configuration based on the negotiated speed. Signed-off-by: Sjoerd Simons --- drivers/net/designware.c | 11 ++++++++++- drivers/net/designware.h | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 0b7adc9..da27041 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -564,8 +564,17 @@ int designware_initialize(ulong base_addr, u32 interface) static int designware_eth_start(struct udevice *dev) { struct eth_pdata *pdata = dev_get_platdata(dev); + struct dw_eth_dev *priv = dev_get_priv(dev); + int ret; - return _dw_eth_init(dev->priv, pdata->enetaddr); + ret = _dw_eth_init(priv, pdata->enetaddr); + if (ret) + return ret; + + if (priv->started) + ret = priv->started(dev); + + return ret; } static int designware_eth_send(struct udevice *dev, void *packet, int length) diff --git a/drivers/net/designware.h b/drivers/net/designware.h index 47e727b..b45599b 100644 --- a/drivers/net/designware.h +++ b/drivers/net/designware.h @@ -236,6 +236,10 @@ struct dw_eth_dev { #endif struct phy_device *phydev; struct mii_dev *bus; + +#ifdef CONFIG_DM_ETH + int (*started)(struct udevice *dev); +#endif }; #ifdef CONFIG_DM_ETH