From patchwork Tue Jun 23 22:38:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Brownell X-Patchwork-Id: 29098 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 1D3DFB70CA for ; Wed, 24 Jun 2009 08:45:43 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MJEdj-0005qS-TJ; Tue, 23 Jun 2009 22:38:55 +0000 Received: from smtp102.sbc.mail.gq1.yahoo.com ([67.195.15.61]) by bombadil.infradead.org with smtp (Exim 4.69 #1 (Red Hat Linux)) id 1MJEdX-0004ms-3I for linux-mtd@lists.infradead.org; Tue, 23 Jun 2009 22:38:51 +0000 Received: (qmail 91665 invoked from network); 23 Jun 2009 22:38:40 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=pacbell.net; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:From:To:Subject:Date:User-Agent:Cc:References:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-Disposition:Message-Id; b=bEoT18Clf7JFAJEXQfhpjk1Iabphv8DMCZN4sTnohCyN3Ajq8PrUR3884bkl0k1PbYdFf0Ea+iHDYRNLaC+1llR20eyH032PyLkCevawEvrUkDqJfMOvNa/PkmvcI8izBKLYh4yUqPTNCeWpvfT76T60koRsgoxJfnuVZq77xwA= ; Received: from unknown (HELO albert) (david-b@69.226.220.141 with plain) by smtp102.sbc.mail.gq1.yahoo.com with SMTP; 23 Jun 2009 22:38:40 -0000 X-Yahoo-SMTP: HIlLYKCswBDnjrunw3O.NnLyvismjGf1HBYfVTvuneM- X-YMail-OSG: E1WI6kMVM1lFLftuVN14E86ZrMV8C2hERGUbsxuLcsbsyEOR7rvRFwGYe5f7tk6gL8oqNqW_5t7UBDQ.kxLF11.tiSjx_50cijfRsZBDFUO5rPs8uWXrkCbDUEfCenIb7bOeHCyLO70IHiYKfC9t4UlPiepmywd6FKD4Ezel.T2JAgjRHajVvyXTRGgqDPlpTp5UhBhUYvzuoL.sOIDSZqan0SFE7TaZFKu_kb5NgQPJhi2VFXNQv2_IHz369kcrF06irJxNAqjXpjmAMO5vMmF5havqMMmVOWT6AEWejiZMve7OuqHP X-Yahoo-Newman-Property: ymail-3 From: David Brownell To: "Steven A. Falco" Subject: Re: [Question] m25p80 driver versus spi clock rate Date: Tue, 23 Jun 2009 15:38:39 -0700 User-Agent: KMail/1.9.10 References: <4A3FEE98.60700@harris.com> <200906231408.26912.david-b@pacbell.net> <4A414E07.5050303@harris.com> In-Reply-To: <4A414E07.5050303@harris.com> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200906231538.40125.david-b@pacbell.net> X-Spam-Score: 0.0 (/) Cc: "linuxppc-dev@ozlabs.org" , Stefan Roese , linux-mtd@lists.infradead.org, Mike Frysinger X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On Tuesday 23 June 2009, Steven A. Falco wrote: > m25p80 spi0.0: invalid bits-per-word (0) > > This message comes from spi_ppc4xx_setupxfer.  I believe your patch > is doing what you intended (i.e. forcing an initial call to > spi_ppc4xx_setupxfer), but it exposes an OF / SPI linkage problem. > > Namely, of_register_spi_devices does not support a bits-per-word > property, so bits-per-word is zero. Bits-per-word == 0 must be interpreted as == 8. Simple bug in the ppc4xx code. It currently rejects values other than 8. Speaking of spi_ppc4xx issues ... I still have an oldish copy in my review queue, it needs something like the appended patch. (Plus something to accept bpw == 0.) Is there a newer version? - Dave Acked-by: Steven A. Falco --- a/drivers/spi/spi_ppc4xx.c +++ b/drivers/spi/spi_ppc4xx.c @@ -61,9 +61,6 @@ /* RxD ready */ #define SPI_PPC4XX_SR_RBR (0x80 >> 7) -/* the spi->mode bits understood by this driver: */ -#define MODEBITS (SPI_CPHA | SPI_CPOL | SPI_CS_HIGH | SPI_LSB_FIRST) - /* clock settings (SCP and CI) for various SPI modes */ #define SPI_CLK_MODE0 SPI_PPC4XX_MODE_SCP #define SPI_CLK_MODE1 0 @@ -198,9 +195,6 @@ static int spi_ppc4xx_setup(struct spi_d struct spi_ppc4xx_cs *cs = spi->controller_state; int init = 0; - if (!spi->bits_per_word) - spi->bits_per_word = 8; - if (spi->bits_per_word != 8) { dev_err(&spi->dev, "invalid bits-per-word (%d)\n", spi->bits_per_word); @@ -212,12 +206,6 @@ static int spi_ppc4xx_setup(struct spi_d return -EINVAL; } - if (spi->mode & ~MODEBITS) { - dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n", - spi->mode & ~MODEBITS); - return -EINVAL; - } - if (cs == NULL) { cs = kzalloc(sizeof *cs, GFP_KERNEL); if (!cs) @@ -268,10 +256,6 @@ static int spi_ppc4xx_setup(struct spi_d } } - dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n", - __func__, spi->mode, spi->bits_per_word, - spi->max_speed_hz); - return 0; } @@ -442,6 +426,9 @@ static int __init spi_ppc4xx_of_probe(st } } + /* the spi->mode bits understood by this driver: */ + master->modebits = SPI_CPHA | SPI_CPOL | SPI_CS_HIGH | SPI_LSB_FIRST; + /* Setup the state for the bitbang driver */ bbp = &hw->bitbang; bbp->master = hw->master;