From patchwork Mon Jun 27 19:02:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Suchanek X-Patchwork-Id: 9201125 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 51C4160757 for ; Mon, 27 Jun 2016 19:03:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42C6A285BD for ; Mon, 27 Jun 2016 19:03:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37773285C0; Mon, 27 Jun 2016 19:03:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03F19285BD for ; Mon, 27 Jun 2016 19:03:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752084AbcF0TCq (ORCPT ); Mon, 27 Jun 2016 15:02:46 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35320 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751639AbcF0TCl (ORCPT ); Mon, 27 Jun 2016 15:02:41 -0400 Received: by mail-wm0-f65.google.com with SMTP id a66so27202940wme.2; Mon, 27 Jun 2016 12:02:40 -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 :in-reply-to:references; bh=msVmJgO+HGqhKuEzW7SJgxIlfltS785dIYrNAxAx5xA=; b=BIvszshIYV37UntMJo7wjnQH2B8kk6IUWHzGsK46KWz4Zy9k/c+ZaVL6gDISUXtpbf niiMa6dUQ9Hb3aodXzDfp39hU7dy1GbvEZQgVh3WS3hOkOXryNVstpMQ33m91VJX7DYp MJH2Z4sMnH8JTqw5tymI4mEVLNWbrXSy2VZGct0v4Z0Yg1aElforAsorwiFN3rYiShVZ fVLGX52OQoM8Th+VS5U3/C12r5iMqnhdfmUDwTKTa8ZHyjTrT3Ns7IMras/nUf/6YUd5 5xAjw5EO1uesQgNlNAMifZX77pzJ3fNkNscWr2hdvZpnsbAOL/yYGSsbYgw3nZ9ar3LG EPGQ== 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:in-reply-to:references; bh=msVmJgO+HGqhKuEzW7SJgxIlfltS785dIYrNAxAx5xA=; b=lSiFn6TFNxcEHHtj0SRIntrV1aht21d5vKMykGTNfb778629mgOpAKgv1cH9NXutin XTwz7BDsZIePKjueRC9ckxqWj2JpslXTBfj9lBBBg0dY1K1jCbUIvW8CkE32D3NOOyDr CpucmYI2Wdn6vvUAmg+pKqQKoLDW5MQRauU65yX2jpEgTV28WG59Ke+uVsqRV8Y3QoXO y7aTaF2o7CsdzdVkD2Ato7R2Ub09Sc78lBv9p5KHK3BYHVRoStlTVC5ehzWwBCKU+A2G 3BllUYrnMntQgu9LUY0kUcZ3VSJNZcKCkFAokOGXr1L9VCo9IknLa+64u1+nm1/l7Ndo ZmbQ== X-Gm-Message-State: ALyK8tKy84Zn28PskBWXthegkKg10K/YKOzqs2Dtkn/VdlxUC/hZPQFhexrl7q9kZJ8pAw== X-Received: by 10.194.104.40 with SMTP id gb8mr2486728wjb.146.1467054159512; Mon, 27 Jun 2016 12:02:39 -0700 (PDT) Received: from iscsi.burning-in.hell (2-166-195-217.cust.centrio.cz. [217.195.166.2]) by smtp.gmail.com with ESMTPSA id zg10sm3278760wjb.1.2016.06.27.12.02.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jun 2016 12:02:38 -0700 (PDT) From: Michal Suchanek To: Greg Kroah-Hartman , Mark Brown , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Cc: Michal Suchanek Subject: [PATCH v2 2/3] spi: of: allow instantiating slaves without a driver Date: Mon, 27 Jun 2016 21:02:31 +0200 Message-Id: X-Mailer: git-send-email 2.8.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP SPI slave devices are not created when looking up driver for the slave fails. Create a device anyway so it can be manually bound to a driver. This allows manually binding a driver to slave devices for which the driver specified by compatible is not available of for which no driver is specified at all. Drivers like spidev or m25p80 that require no configuratiom can be bound to such node. Since this allows slave DT nodes without specifying a slave driver make speed also optional. It makes no sense to specify speed when the device is not specified. The value is only advisory anyway and the slave driver can try to set arbitrary transfer speed. Signed-off-by: Michal Suchanek --- drivers/spi/spi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 0239b45..9b3b512 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1477,9 +1477,8 @@ of_register_spi_device(struct spi_master *master, struct device_node *nc) rc = of_modalias_node(nc, spi->modalias, sizeof(spi->modalias)); if (rc < 0) { - dev_err(&master->dev, "cannot find modalias for %s\n", + dev_warn(&master->dev, "cannot find modalias for %s\n", nc->full_name); - goto err_out; } /* Device address */ @@ -1543,11 +1542,11 @@ of_register_spi_device(struct spi_master *master, struct device_node *nc) /* Device speed */ rc = of_property_read_u32(nc, "spi-max-frequency", &value); if (rc) { - dev_err(&master->dev, "%s has no valid 'spi-max-frequency' property (%d)\n", + dev_warn(&master->dev, "%s has no valid 'spi-max-frequency' property (%d)\n", nc->full_name, rc); - goto err_out; + } else { + spi->max_speed_hz = value; } - spi->max_speed_hz = value; /* Store a pointer to the node in the device structure */ of_node_get(nc);