From patchwork Tue Feb 16 19:57:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ernst Schwab X-Patchwork-Id: 79773 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1GJw6fb014328 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 16 Feb 2010 19:58:47 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NhTYc-0006O9-Lp; Tue, 16 Feb 2010 19:58:06 +0000 Received: from sfi-mx-2.v28.ch3.sourceforge.com ([172.29.28.122] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NhTYb-0006Ni-Be for spi-devel-general@lists.sourceforge.net; Tue, 16 Feb 2010 19:58:05 +0000 X-ACL-Warn: Received: from moutng.kundenserver.de ([212.227.17.10]) by sfi-mx-2.v28.ch3.sourceforge.com with esmtp (Exim 4.69) id 1NhTYa-0007ai-C5; Tue, 16 Feb 2010 19:58:05 +0000 Received: from ip065 (koln-5d8135c9.pool.mediaWays.net [93.129.53.201]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MB1l6-1NZkJ52JOO-00ASfV; Tue, 16 Feb 2010 20:57:32 +0100 Date: Tue, 16 Feb 2010 20:57:33 +0100 From: Ernst Schwab To: Grant Likely , Kumar Gala , David Brownell , spi-devel-general@lists.sourceforge.net Message-Id: <20100216205733.580dbf93.eschwab@online.de> X-Mailer: Sylpheed 3.0.0beta8 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 X-Provags-ID: V01U2FsdGVkX1+Tr/eyLYo3SaZzzngGpVLEm9hpniPCHBAOadT aabS8SVBnFSzsq421cxfgv5ry9z+jKPrSEh1zdlTwdJ1g7FwHy 7OgqqYk5U+gUbs9bs4SzJoUvo+B2zT8 X-Spam-Score: -0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-Headers-End: 1NhTYa-0007ai-C5 Cc: yi.li@analog.com, vapier@gentoo.org Subject: [spi-devel-general] [PATCH 3/5] mmc_spi: added spi_lock_bus X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 16 Feb 2010 19:58:47 +0000 (UTC) diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index a461017..a96e058 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c @@ -1084,6 +1084,7 @@ static void mmc_spi_request(struct mmc_host *mmc, struct mmc_request *mrq) #endif /* issue command; then optionally data and stop */ + spi_lock_bus(host->spi); status = mmc_spi_command_send(host, mrq, mrq->cmd, mrq->data != NULL); if (status == 0 && mrq->data) { mmc_spi_data_do(host, mrq->cmd, mrq->data, mrq->data->blksz); @@ -1092,7 +1093,7 @@ static void mmc_spi_request(struct mmc_host *mmc, struct mmc_request *mrq) else mmc_cs_off(host); } - + spi_unlock_bus(host->spi); mmc_request_done(host->mmc, mrq); } @@ -1337,32 +1338,6 @@ static int mmc_spi_probe(struct spi_device *spi) return status; } - /* We can use the bus safely iff nobody else will interfere with us. - * Most commands consist of one SPI message to issue a command, then - * several more to collect its response, then possibly more for data - * transfer. Clocking access to other devices during that period will - * corrupt the command execution. - * - * Until we have software primitives which guarantee non-interference, - * we'll aim for a hardware-level guarantee. - * - * REVISIT we can't guarantee another device won't be added later... - */ - if (spi->master->num_chipselect > 1) { - struct count_children cc; - - cc.n = 0; - cc.bus = spi->dev.bus; - status = device_for_each_child(spi->dev.parent, &cc, - maybe_count_child); - if (status < 0) { - dev_err(&spi->dev, "can't share SPI bus\n"); - return status; - } - - dev_warn(&spi->dev, "ASSUMING SPI bus stays unshared!\n"); - } - /* We need a supply of ones to transmit. This is the only time * the CPU touches these, so cache coherency isn't a concern. *