From patchwork Mon Sep 1 15:06:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 36384 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 18D6920792 for ; Mon, 1 Sep 2014 15:07:21 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id v10sf31729595pde.10 for ; Mon, 01 Sep 2014 08:07:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=CT9X73rrH8zQ2rED2/vUm8oh9h5F5FTyafaxhYo/9C8=; b=PYb/apdCUPlU8nOQNDsVo2IvTWQngEbdhoIn5i9ow64fKuyvdF4Xtifykxdks4lfu3 e5/vfqg9afZ9LHpEICT+Za5GbEDKcXPcMSUOr5QdDP9FDKXU4BzPo9e0EkNBYBINRAF4 Op8rij26H1/07Q3gFg67gYe6LvM2f/DdWxS6Qlz4jhSvKKtQY8itiZuyYc1o6byaxD7D Fia+o/1SzzXG2VJdQAlWe02/mqlk9iWlVMFtg4A83HQqBKQl5eW5egItx/enqhs70GTb 7SXIVwL6AEpQ6AiCIP8xwzBopSbTlV/m5w5lwI+poonDd4mhTpE4fVfYqdLWzs1r8C2D cvuQ== X-Gm-Message-State: ALoCoQlM/qk4Ya6KdjWnlEDoeuXB1HxratS5fbMFV427at6W0rQf7dasD17bKNdq2YdbRJctu4Qp X-Received: by 10.67.5.228 with SMTP id cp4mr15646985pad.8.1409584039297; Mon, 01 Sep 2014 08:07:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.103.74 with SMTP id x68ls2037823qge.28.gmail; Mon, 01 Sep 2014 08:07:19 -0700 (PDT) X-Received: by 10.220.80.207 with SMTP id u15mr306688vck.72.1409584039182; Mon, 01 Sep 2014 08:07:19 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id rx9si582660vdc.64.2014.09.01.08.07.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Sep 2014 08:07:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id lf12so5597624vcb.34 for ; Mon, 01 Sep 2014 08:07:19 -0700 (PDT) X-Received: by 10.220.118.136 with SMTP id v8mr803523vcq.50.1409584039097; Mon, 01 Sep 2014 08:07:19 -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.221.45.67 with SMTP id uj3csp400677vcb; Mon, 1 Sep 2014 08:07:18 -0700 (PDT) X-Received: by 10.70.37.227 with SMTP id b3mr5166307pdk.147.1409584038208; Mon, 01 Sep 2014 08:07:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fj5si1426545pbb.233.2014.09.01.08.07.16 for ; Mon, 01 Sep 2014 08:07:16 -0700 (PDT) Received-SPF: none (google.com: linux-acpi-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753696AbaIAPHD (ORCPT + 7 others); Mon, 1 Sep 2014 11:07:03 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:32955 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751665AbaIAPHB (ORCPT ); Mon, 1 Sep 2014 11:07:01 -0400 Received: by mail-pa0-f49.google.com with SMTP id kq14so12482016pab.36 for ; Mon, 01 Sep 2014 08:07:01 -0700 (PDT) X-Received: by 10.68.68.162 with SMTP id x2mr40528741pbt.84.1409584021303; Mon, 01 Sep 2014 08:07:01 -0700 (PDT) Received: from localhost ([202.104.114.248]) by mx.google.com with ESMTPSA id qz2sm3279700pab.27.2014.09.01.08.06.56 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 01 Sep 2014 08:07:00 -0700 (PDT) From: Hanjun Guo To: Catalin Marinas , "Rafael J. Wysocki" , Mark Rutland , Olof Johansson , Grant Likely Cc: Graeme Gregory , Arnd Bergmann , Sudeep Holla , Will Deacon , Jason Cooper , Marc Zyngier , Bjorn Helgaas , Daniel Lezcano , Mark Brown , Rob Herring , Robert Richter , Lv Zheng , Robert Moore , Lorenzo Pieralisi , Liviu Dudau , Randy Dunlap , Charles.Garcia-Tobin@arm.com, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org Subject: [RFC PATCH for Juno 1/2] net: smsc911x add support for probing from ACPI Date: Mon, 1 Sep 2014 23:06:00 +0800 Message-Id: <1409583961-7466-2-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1409583961-7466-1-git-send-email-hanjun.guo@linaro.org> References: <1409583961-7466-1-git-send-email-hanjun.guo@linaro.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) smtp.mail=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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Graeme Gregory This is a standard platform device to resources are converted in the ACPI core in the same fasion as DT resources. For the other DT provided information there is _DSD for ACPI. Signed-off-by: Graeme Gregory --- drivers/net/ethernet/smsc/smsc911x.c | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index 5e13fa5..69d725a 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" @@ -2369,9 +2370,36 @@ static inline int smsc911x_probe_config_dt( } #endif /* CONFIG_OF */ +#ifdef CONFIG_ACPI +/* Configure some sensible defaults for ACPI mode */ +static int smsc911x_probe_config_acpi(struct smsc911x_platform_config *config, + acpi_handle *ahandle) +{ + if (!ahandle) + return -ENOSYS; + + config->phy_interface = PHY_INTERFACE_MODE_MII; + + config->flags |= SMSC911X_USE_32BIT; + + config->irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH; + + config->irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL; + + return 0; +} +#else +static int smsc911x_probe_config_acpi(struct smsc911x_platform_config *config, + acpi_handle *ahandle) +{ + return -ENOSYS; +} +#endif /* CONFIG_ACPI */ + static int smsc911x_drv_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; + acpi_handle *ahandle = ACPI_HANDLE(&pdev->dev); struct net_device *dev; struct smsc911x_data *pdata; struct smsc911x_platform_config *config = dev_get_platdata(&pdev->dev); @@ -2436,6 +2464,9 @@ static int smsc911x_drv_probe(struct platform_device *pdev) } retval = smsc911x_probe_config_dt(&pdata->config, np); + if (retval) + retval = smsc911x_probe_config_acpi(&pdata->config, ahandle); + if (retval && config) { /* copy config parameters across to pdata */ memcpy(&pdata->config, config, sizeof(pdata->config)); @@ -2606,6 +2637,12 @@ static const struct of_device_id smsc911x_dt_ids[] = { MODULE_DEVICE_TABLE(of, smsc911x_dt_ids); #endif +static const struct acpi_device_id smsc911x_acpi_ids[] = { + { "LNRO001B", }, + { "ARMH9118", }, + { } +}; + static struct platform_driver smsc911x_driver = { .probe = smsc911x_drv_probe, .remove = smsc911x_drv_remove, @@ -2614,6 +2651,7 @@ static struct platform_driver smsc911x_driver = { .owner = THIS_MODULE, .pm = SMSC911X_PM_OPS, .of_match_table = of_match_ptr(smsc911x_dt_ids), + .acpi_match_table = ACPI_PTR(smsc911x_acpi_ids), }, };