From patchwork Sat Apr 13 17:22:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Fritz X-Patchwork-Id: 2441261 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A2A32DFB78 for ; Sat, 13 Apr 2013 17:22:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754070Ab3DMRWb (ORCPT ); Sat, 13 Apr 2013 13:22:31 -0400 Received: from mail-bk0-f53.google.com ([209.85.214.53]:63643 "EHLO mail-bk0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753698Ab3DMRWb (ORCPT ); Sat, 13 Apr 2013 13:22:31 -0400 Received: by mail-bk0-f53.google.com with SMTP id e19so1776332bku.26 for ; Sat, 13 Apr 2013 10:22:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=x-received:subject:from:to:cc:content-type:date:message-id :mime-version:x-mailer:content-transfer-encoding; bh=eJ8M1vGSk+CRG4nPj/jqW3iX+6JikzvnKn2emyeq/go=; b=oHqk+bt77FVi8He0y2pw4N3p3EqoIRIOBYHhyEUw+jAOEYSFTtKi8bpdeBrOzdasFB qxyaRllbLjOxzWUcucabjCh1QUleYpAJUkY3REwqMKRat4Bc96G192ZfCD3ubBz6I9Jo BT/oXqo1CCXgbQmKdpGgfgg+7vdn+QzSb8+IPzukqCzIlyJ/r3oixbISecp1ypo+SKzo nKSyjs5n/kVBz9HyfZnxX4UPpNLRT0ru88L1dJEnPWETusEl6HDfZ38T+s7IZv8q9cjU fyeMoEMj+Fsm/+NwvgEJ3B8O9L6KZ1sZp2pKw8Oc+gf1deQQ82Awu7TXKvxYxOegJnE2 wxVQ== X-Received: by 10.205.15.134 with SMTP id pu6mr5889663bkb.136.1365873749336; Sat, 13 Apr 2013 10:22:29 -0700 (PDT) Received: from [192.168.1.12] (p549E99B8.dip.t-dialin.net. [84.158.153.184]) by mx.google.com with ESMTPS id 2sm5665157bki.19.2013.04.13.10.22.27 (version=SSLv3 cipher=RC4-SHA bits=128/128); Sat, 13 Apr 2013 10:22:28 -0700 (PDT) Subject: [PATCH] net: smsc911x: adopt pinctrl support From: Christoph Fritz To: Steve Glendinning Cc: "netdev@vger.kernel.org" , Javier Martinez Canillas , Sebastien Guiriec , Daniel Mack , "Hans J. Koch" , linux-omap@vger.kernel.org Date: Sat, 13 Apr 2013 19:22:25 +0200 Message-ID: <1365873745.3812.37.camel@mars> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org This patch is derived from 2d4b4520a "i2c: omap: adopt pinctrl support": Some GPIO expanders need some early pin control muxing. Due to legacy boards sometimes the driver uses subsys_initcall instead of module_init. This patch takes advantage of defer probe feature and pin control in order to wait until pin control probing before GPIO driver probing. Signed-off-by: Christoph Fritz --- drivers/net/ethernet/smsc/smsc911x.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index da5cc9a..3e3547c 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -59,6 +59,7 @@ #include #include #include +#include #include "smsc911x.h" #define SMSC_CHIPNAME "smsc911x" @@ -144,6 +145,8 @@ struct smsc911x_data { /* regulators */ struct regulator_bulk_data supplies[SMSC911X_NUM_SUPPLIES]; + + struct pinctrl *pins; }; /* Easy access to information */ @@ -2433,6 +2436,18 @@ static int smsc911x_drv_probe(struct platform_device *pdev) if (retval < 0) goto out_disable_resources; + pdata->pins = devm_pinctrl_get_select_default(&pdev->dev); + if (IS_ERR(pdata->pins)) { + if (PTR_ERR(pdata->pins) == -EPROBE_DEFER) { + retval = -EPROBE_DEFER; + goto out_disable_resources; + } + + dev_warn(&pdev->dev, "No pins for smsc911x error: %li\n", + PTR_ERR(pdata->pins)); + pdata->pins = NULL; + } + /* configure irq polarity and type before connecting isr */ if (pdata->config.irq_polarity == SMSC911X_IRQ_POLARITY_ACTIVE_HIGH) intcfg |= INT_CFG_IRQ_POL_;