From mboxrd@z Thu Jan 1 00:00:00 1970 From: Feng Tang Subject: Re: [PATCH] spi: add a bits_per_word to struct spi_board_info Date: Thu, 2 Sep 2010 14:13:48 +0800 Message-ID: <20100902141348.669aa817@feng-i7> References: <20100902100128.5d5b7d87@feng-i7> <930634.1250.qm@web180310.mail.gq1.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: "spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org" To: David Brownell Return-path: In-Reply-To: <930634.1250.qm-4JhmkcZgSkk/JfqJOfUXs/u2YVrzzGjVVpNB7YpNyf8@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: linux-spi.vger.kernel.org Hi David, > > Grant also asked me the same question. > > > I saw him ask a different question (which > I quoted) ... My mistake, I tried to answer Grant's and your questions in one email to keep the discussion in one thread. > > > Yes, driver itself > > know the bits_per_word info best in most case, but there > > is > > some device (Option GTM501L spi modem) which supports > > multiple > > bits_per_mode option, and here platform code > is the good place to set it. > > > Not unless it knows which mode the driver uses... > a kind of layering violation. spi_board_info has a member of "mode", so for my platform, I prefer to set all these infos in platform code, while protocol driver can check if the preset infos like speed_hz/mode/bits_per_word are supported. I thought platform code have to know the detail of the spi device when setting spi_board_info for it. Also the following code quoted from spi_setup() indicates it supports setting mode for spi_board_info ------------------------------------------------------------------------ bad_bits = spi->mode & ~spi->master->mode_bits; if (bad_bits) { dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n", bad_bits); return -EINVAL; } Thanks, Feng ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd