From patchwork Sat Apr 23 21:43:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Heimpold X-Patchwork-Id: 614102 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3qsmGb5jFNz9t3s for ; Sun, 24 Apr 2016 07:44:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=heimpold.de header.i=@heimpold.de header.b=cyvKL3Ya; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752483AbcDWVoU (ORCPT ); Sat, 23 Apr 2016 17:44:20 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.217]:39473 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752455AbcDWVoP (ORCPT ); Sat, 23 Apr 2016 17:44:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1461447851; l=3045; s=domk; d=heimpold.de; h=References:In-Reply-To:Date:Subject:Cc:To:From; bh=A3k11Ax0WCYj2R/kmsfBCnpz47Q/+FyfuJ322FhX2sc=; b=cyvKL3YaMjEhTp0dsjMalncOSNrc8DAB6ZY8pzxhap8/ESmat1F8zAbn6qhs80w0795 HL4Po2lXiy9HZHE/M1I1uNtEbzxvzTtAer9Kp2xtNGlRtQ3U/a+N76cfQTtFo/hkdP/83 UV+U2b91M2YT4Yk8WKh8xJB8E+EQHH1Z3eA= X-RZG-AUTH: :O2kGeEG7b/pS1EW8QnKjhhg/vO4pzqdNys2z+NfqLSUoNNCTudAAFEJqC9JBN4JMEFSjTQ== X-RZG-CLASS-ID: mo00 Received: from tonne.mhei.heimpold.itr (p4FC8EF46.dip0.t-ipconnect.de [79.200.239.70]) by post.strato.de (RZmta 37.24 DYNA|AUTH) with ESMTPA id 00772as3NLi9Uxz; Sat, 23 Apr 2016 23:44:09 +0200 (CEST) Received: from kerker.fritz.box (kerker.mhei.heimpold.itr [192.168.8.1]) by tonne.mhei.heimpold.itr (Postfix) with ESMTP id 4030A24AD5; Sat, 23 Apr 2016 23:44:09 +0200 (CEST) From: Michael Heimpold To: Jonathan Cameron , "Andrew F . Davis" , Mark Brown , netdev@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Claudio Lanconelli Cc: Michael Heimpold Subject: [PATCH net-next 2/2] net: ethernet: enc28j60: add device tree support Date: Sat, 23 Apr 2016 23:43:20 +0200 Message-Id: <1461447800-11381-3-git-send-email-mhei@heimpold.de> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1461447800-11381-1-git-send-email-mhei@heimpold.de> References: <1461447800-11381-1-git-send-email-mhei@heimpold.de> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The following patch adds the required match table for device tree support (and while at, fix the indent). Also add the corresponding binding documentation file. Signed-off-by: Michael Heimpold --- .../devicetree/bindings/net/microchip-enc28j60.txt | 49 ++++++++++++++++++++++ drivers/net/ethernet/microchip/enc28j60.c | 13 +++++- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/net/microchip-enc28j60.txt diff --git a/Documentation/devicetree/bindings/net/microchip-enc28j60.txt b/Documentation/devicetree/bindings/net/microchip-enc28j60.txt new file mode 100644 index 0000000..c472427 --- /dev/null +++ b/Documentation/devicetree/bindings/net/microchip-enc28j60.txt @@ -0,0 +1,49 @@ +* Microchip ENC28J60 + +This is a standalone 10 MBit ethernet controller with SPI interface. + +For each device connected to a SPI bus, define a child node within +the SPI master node. + +Required properties: +- compatible: Should be "microchip,enc28j60" +- reg: Specify the SPI chip select the ENC28J60 is wired to +- interrupts: Specify the interrupt and interrupt type (usually falling edge) + +Optional properties: +- interrupt-parent: Specify the pHandle of the source interrupt +- spi-max-frequency: Maximum frequency of the SPI bus when accessing the ENC28J60. + According to the ENC28J80 datasheet, the chip allows a maximum of 20 MHz, however, + board designs may need to limit this value. + + +Example (for NXP i.MX28 with pin control stuff for GPIO irq): + + ssp2: ssp@80014000 { + compatible = "fsl,imx28-spi"; + pinctrl-names = "default"; + pinctrl-0 = <&spi2_pins_b &spi2_sck_cfg>; + status = "okay"; + + enc28j60: ethernet@0 { + compatible = "microchip,enc28j60"; + pinctrl-names = "default"; + pinctrl-0 = <&enc28j60_pins>; + reg = <0>; + interrupt-parent = <&gpio3>; + interrupts = <3 IRQ_TYPE_EDGE_FALLING>; + spi-max-frequency = <12000000>; + }; + }; + + pinctrl@80018000 { + enc28j60_pins: enc28j60_pins@0 { + reg = <0>; + fsl,pinmux-ids = < + MX28_PAD_AUART0_RTS__GPIO_3_3 /* Interrupt */ + >; + fsl,drive-strength = ; + fsl,voltage = ; + fsl,pull-up = ; + }; + }; diff --git a/drivers/net/ethernet/microchip/enc28j60.c b/drivers/net/ethernet/microchip/enc28j60.c index b723622..49635d7 100644 --- a/drivers/net/ethernet/microchip/enc28j60.c +++ b/drivers/net/ethernet/microchip/enc28j60.c @@ -1634,9 +1634,20 @@ static int enc28j60_remove(struct spi_device *spi) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id enc28j60_dt_ids[] = { + { .compatible = "microchip,enc28j60" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, enc28j60_dt_ids); +#else +#define enc28j60_dt_ids NULL +#endif + static struct spi_driver enc28j60_driver = { .driver = { - .name = DRV_NAME, + .name = DRV_NAME, + .of_match_table = enc28j60_dt_ids, }, .probe = enc28j60_probe, .remove = enc28j60_remove,