From patchwork Sat Jun 2 06:06:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Schmelzer X-Patchwork-Id: 924433 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=oevsv.at Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40yW1v41Jkz9ry1 for ; Sat, 2 Jun 2018 16:07:14 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 96DDDC21E0B; Sat, 2 Jun 2018 06:07:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id CF8A1C21C2F; Sat, 2 Jun 2018 06:07:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4C328C21C51; Sat, 2 Jun 2018 06:07:00 +0000 (UTC) Received: from mail.schmelzer.or.at (mail.schmelzer.or.at [87.106.47.214]) by lists.denx.de (Postfix) with ESMTP id 0158AC21C2F for ; Sat, 2 Jun 2018 06:07:00 +0000 (UTC) Received: from localhost (s15287728.onlinehome-server.info [127.0.0.1]) by hamspirit.at (Postfix) with ESMTP id D2D638F480BC; Sat, 2 Jun 2018 06:06:59 +0000 (UTC) Received: from mail.schmelzer.or.at ([127.0.0.1]) by localhost (s15287728.onlinehome-server.info [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8BMlw8CsqYvD; Sat, 2 Jun 2018 06:06:54 +0000 (UTC) Received: from scm-ws12.ad.schmelzer.or.at (188-22-122-81.adsl.highway.telekom.at [188.22.122.81]) by hamspirit.at (Postfix) with ESMTP id 7A5718F480C0; Sat, 2 Jun 2018 06:06:54 +0000 (UTC) From: Hannes Schmelzer To: u-boot@lists.denx.de Date: Sat, 2 Jun 2018 08:06:48 +0200 Message-Id: <1527919608-5414-2-git-send-email-oe5hpm@oevsv.at> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527919608-5414-1-git-send-email-oe5hpm@oevsv.at> References: <1527919608-5414-1-git-send-email-oe5hpm@oevsv.at> Cc: Hannes Schmelzer , Jagan Teki Subject: [U-Boot] [PATCH 2/2] spi: omap3: fix set_speed and set_mode dm callbacks X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" commit 84807922874e03895bbf15c4472a2dcee8fbbd03 ("spi: omap3: Skip set_mode, set_speed from claim") did break SPI support on my AM335x board. The named commit: - ignored the responsible arguments (speed, mode) The set speed/mode function must use the supplied function arguments to work properly. With this commit we take those arguments and transfer them to the priv-data. - used wrong udevice pointer for getting priv data the udevice-pointer within function argument is already the spi-bus device, so it is wrong looking here for some parent (ocp-bus in this case) and getting priv-pointer from there. Signed-off-by: Hannes Schmelzer --- drivers/spi/omap3_spi.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c index a149abe..766436e 100644 --- a/drivers/spi/omap3_spi.c +++ b/drivers/spi/omap3_spi.c @@ -650,12 +650,10 @@ static int omap3_spi_xfer(struct udevice *dev, unsigned int bitlen, static int omap3_spi_set_speed(struct udevice *dev, unsigned int speed) { - struct udevice *bus = dev->parent; - struct omap3_spi_priv *priv = dev_get_priv(bus); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); - priv->cs = slave_plat->cs; - priv->freq = slave_plat->max_hz; + struct omap3_spi_priv *priv = dev_get_priv(dev); + + priv->freq = speed; _omap3_spi_set_speed(priv); return 0; @@ -663,12 +661,10 @@ static int omap3_spi_set_speed(struct udevice *dev, unsigned int speed) static int omap3_spi_set_mode(struct udevice *dev, uint mode) { - struct udevice *bus = dev->parent; - struct omap3_spi_priv *priv = dev_get_priv(bus); - struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct omap3_spi_priv *priv = dev_get_priv(dev); + + priv->mode = mode; - priv->cs = slave_plat->cs; - priv->mode = slave_plat->mode; _omap3_spi_set_mode(priv); return 0;