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: 4820691 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 838879F314 for ; Mon, 1 Sep 2014 15:10:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 69028200F3 for ; Mon, 1 Sep 2014 15:10:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 14795200F0 for ; Mon, 1 Sep 2014 15:10:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XOTCW-0007Vr-WF; Mon, 01 Sep 2014 15:07:25 +0000 Received: from mail-pa0-f42.google.com ([209.85.220.42]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XOTCU-00079a-1D for linux-arm-kernel@lists.infradead.org; Mon, 01 Sep 2014 15:07:22 +0000 Received: by mail-pa0-f42.google.com with SMTP id lf10so12506110pab.1 for ; Mon, 01 Sep 2014 08:07:01 -0700 (PDT) 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=vbPAaYrjcK50y4cMEDJwytEfgUka29TCmWsbWOmJNEg=; b=LdBQ/6fI+Ah5Qp3rj52e29UuY0T5hxqz3pYiuXji4nkvEr16eg4NadJzCbxuW7o258 i3L/+BFoIF1F7g1beihs6qP2c3E5DJsrP+AbedG+a1S9Qp69/ZPH2UREprdDYPuf7be0 1DnsuPDpMXDDvgjDag8MfEQx1Yko6eR/8lmxlOwWMSrHy761DbxowWeDKt5s9USVStvw B0Fn3Z/qCnDgz3mF0a0lKz1NT71b8LiolJqOJuFsbi6oAQqPdcKBRefRES1x2oPx/uZx G9pTwkFKjToHRMbcKnHhsrO5soFuOOHFulexMZu1F/fngI+95N4BmIalo7s0AFzq1X+0 654Q== X-Gm-Message-State: ALoCoQm82Wq7ns7nNkwjxOupvcmYGUckXT9+K8tlhFEoHTwdVvDo4zsHYDgnkpgWrAMxBPt9l7mL 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140901_080722_130643_8DC73540 X-CRM114-Status: GOOD ( 14.79 ) X-Spam-Score: -0.7 (/) Cc: Rob Herring , Lorenzo Pieralisi , Robert Richter , Jason Cooper , Arnd Bergmann , linaro-acpi@lists.linaro.org, Marc Zyngier , Liviu Dudau , Daniel Lezcano , Will Deacon , Robert Moore , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Mark Brown , Randy Dunlap , Lv Zheng , Sudeep Holla , Bjorn Helgaas , Graeme Gregory , linux-arm-kernel@lists.infradead.org, Charles.Garcia-Tobin@arm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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), }, };