From patchwork Tue Aug 2 11:31:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 654684 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 3s3YwN46Xwz9t3p for ; Tue, 2 Aug 2016 21:32:52 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=V3grmHdj; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C0C00A7559; Tue, 2 Aug 2016 13:32:40 +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 LlcRLR9h3SCe; Tue, 2 Aug 2016 13:32:40 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E8098A7621; Tue, 2 Aug 2016 13:32:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 692D8A7559 for ; Tue, 2 Aug 2016 13:32:18 +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 0K7LpYnSFXV7 for ; Tue, 2 Aug 2016 13:32: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 mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by theia.denx.de (Postfix) with ESMTPS id 174B6A751E for ; Tue, 2 Aug 2016 13:32:14 +0200 (CEST) Received: by mail-lf0-f65.google.com with SMTP id f93so9800061lfi.0 for ; Tue, 02 Aug 2016 04:32:14 -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:in-reply-to:references; bh=pWTG15s95KunujJQOOfptaKmWPahMTrisiU0jVYFk+8=; b=V3grmHdjuSguqtJIDB8NaNUYSEa0VSxiQ4yhjndrIJYWzhnzhL1nOJw479dN+KdGcq 3Jnr+L6MZTyt2vA1iT4u1z2E6MaaudUhphl1jUfbhx0iUbNeOzDN//NmipCyEbRnBDc6 XNIUccZCR+3dy5/bX3i0yDHf/1TkL+N0ySq3UyFzI32F1ug61eVU4+vJQTjSBF6+9T7K O/llfAPl1gZZDQO6onIQ1HAwgxPmrSOodRcwg01O6G8rGU1L6fNRQ18qGq6Gsu7u+ARj 36HwdLYLpiXYqWogCHFRJpmaO3+h047liXCUlo78sDEIPxBriU/gNhOp1chx6beD2x+S U/Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pWTG15s95KunujJQOOfptaKmWPahMTrisiU0jVYFk+8=; b=LB0/7qikCqMAS3cOeGZCcSdkvZvSVRDVJCqFfYz7i0XFFBv4iBqjRLlYZ94g0nVCfT G56LiYg3MS0kWpcg1ASuoOenotwOq0b/u01uFAV5/yXGLQDJ9f6fXLmFBlvX5HbmApUk G+ypm4P/oh47BFp5bViRZfmTIbUopkIUFEstYvAbC71VTbzbWTAW76mrRlQNvT7r0V75 E8D9N3RCo+SjYmoi2vD6cfCcR/ubuaU+w0Ohe+gneqx0urJF2WTBufNLMNqQTIFNE2dW mD7i1WVQpVWyo+0ZIGt4iH3ZzTbL/GMKu+Q2CNcAPhi2Zehy9JiowHtpOrclpvJP+//d CA/g== X-Gm-Message-State: AEkoouus95B2veYGi2dGhoPKkNYeE3B9yy0hJnM+0Z6NlzFVPPvPfbE64YHyk8qyus4ItA== X-Received: by 10.46.5.6 with SMTP id 6mr18368466ljf.66.1470137534316; Tue, 02 Aug 2016 04:32:14 -0700 (PDT) Received: from octofox.metropolis ([5.19.183.212]) by smtp.gmail.com with ESMTPSA id f69sm417906lji.19.2016.08.02.04.32.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Aug 2016 04:32:13 -0700 (PDT) From: Max Filippov To: u-boot@lists.denx.de Date: Tue, 2 Aug 2016 14:31:07 +0300 Message-Id: <1470137470-6051-5-git-send-email-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1470137470-6051-1-git-send-email-jcmvbkbc@gmail.com> References: <1470137470-6051-1-git-send-email-jcmvbkbc@gmail.com> Cc: Joe Hershberger Subject: [U-Boot] [PATCH 4/7] net/ethoc: support device tree X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion 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" Add .of_match table and .ofdata_to_platdata callback to allow for ethoc device configuration from the device tree. Signed-off-by: Max Filippov Acked-by: Joe Hershberger --- drivers/net/ethoc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c index 0225595..8cb15c7 100644 --- a/drivers/net/ethoc.c +++ b/drivers/net/ethoc.c @@ -600,6 +600,14 @@ static void ethoc_stop(struct udevice *dev) ethoc_disable_rx_and_tx(priv); } +static int ethoc_ofdata_to_platdata(struct udevice *dev) +{ + struct ethoc_eth_pdata *pdata = dev_get_platdata(dev); + + pdata->eth_pdata.iobase = dev_get_addr(dev); + return 0; +} + static int ethoc_probe(struct udevice *dev) { struct ethoc_eth_pdata *pdata = dev_get_platdata(dev); @@ -626,9 +634,16 @@ static const struct eth_ops ethoc_ops = { .write_hwaddr = ethoc_write_hwaddr, }; +static const struct udevice_id ethoc_ids[] = { + { .compatible = "opencores,ethoc" }, + { } +}; + U_BOOT_DRIVER(ethoc) = { .name = "ethoc", .id = UCLASS_ETH, + .of_match = ethoc_ids, + .ofdata_to_platdata = ethoc_ofdata_to_platdata, .probe = ethoc_probe, .remove = ethoc_remove, .ops = ðoc_ops,