From patchwork Thu Nov 20 14:33:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 5348591 Return-Path: X-Original-To: patchwork-linux-spi@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 C937C9F387 for ; Thu, 20 Nov 2014 14:33:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1B1B201ED for ; Thu, 20 Nov 2014 14:33:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 07EAE201E4 for ; Thu, 20 Nov 2014 14:33:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756009AbaKTOd2 (ORCPT ); Thu, 20 Nov 2014 09:33:28 -0500 Received: from mail-pa0-f49.google.com ([209.85.220.49]:50099 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755887AbaKTOd2 (ORCPT ); Thu, 20 Nov 2014 09:33:28 -0500 Received: by mail-pa0-f49.google.com with SMTP id eu11so2650124pac.22 for ; Thu, 20 Nov 2014 06:33:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=m6j82jsYxBNVEtl9XLtjRIBXbJ9wCJ7+HMzIC767Ov0=; b=CZKn03LJABl9MGGZXrcDlk2/E5OVVA+KZU/ApQUvx+QNGqew7OH+Sn5nb4d9t6nlxl bCyCrfXABidDndrnODsWiim+sTTFMDQEQWqb58DN5mTz0N8JsQ2PU2LQoF4qfJSnYFm9 AmLPsNyD+5qXFnnBxoi1nlJCjdskawYguZBcwzlhZ8NtJ9LQlzgLGjrw8jcdBRtIkBSM nem2RaMKN78fuCpWx09R9f7cpE9VY7RTPmptYvXcEgf48OtcyVLhs7kMNPJiptlPSr7U jcl325rzoGVIUUNxHfipBXU+/+eyvehK/HGkk6dU46mlcWxfEu4H+p2IP9uEer2NtQl3 YxxA== X-Received: by 10.68.106.66 with SMTP id gs2mr56067218pbb.76.1416494007625; Thu, 20 Nov 2014 06:33:27 -0800 (PST) Received: from localhost.localdomain ([140.207.223.187]) by mx.google.com with ESMTPSA id vf10sm2281458pbc.11.2014.11.20.06.33.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Nov 2014 06:33:27 -0800 (PST) From: Barry Song <21cnbao@gmail.com> To: broonie@kernel.org, linux-spi@vger.kernel.org Cc: workgroup.linux@csr.com, Qipan Li , Barry Song Subject: [PATCH] spi: sirf: reset SPI controller in init stage Date: Thu, 20 Nov 2014 22:33:07 +0800 Message-Id: <1416493987-6024-1-git-send-email-21cnbao@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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: Qipan Li in SPI boot mode, romcode uses SPI controller to fetch data from NOR flash. Here we need to reset the hardware IP to restore its state. Signed-off-by: Qipan Li Signed-off-by: Barry Song --- drivers/spi/spi-sirf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index 90dc05b..73a88b3 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c @@ -23,6 +23,7 @@ #include #include #include +#include #define DRIVER_NAME "sirfsoc_spi" @@ -647,6 +648,12 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) int irq; int i, ret; + ret = device_reset(&pdev->dev); + if (ret) { + dev_err(&pdev->dev, "SPI reset failed!\n"); + return ret; + } + master = spi_alloc_master(&pdev->dev, sizeof(*sspi)); if (!master) { dev_err(&pdev->dev, "Unable to allocate SPI master\n");