From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vikram Narayanan Subject: Re: Configuration of MAX7301 Date: Fri, 4 Mar 2011 02:30:05 +0530 Message-ID: References: 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: Grant Likely , jassisinghbrar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Return-path: In-Reply-To: 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 I have made changes in the BSP such that the SPI works fine. Now I made changes in max7301.c 1. changed the bits/word to 8 2. called spi_write twice to transfer the 16 bits (yet to check with a DSO to ensure that this method works fine) 3. commented the gpiochip_add call. Reason: The error when I call this from my probe function is gpiochip_add: gpios -1..26 (max7301) not registered max7301: probe of spi0.0 failed with error -28 Finally, the MAX7301 doesn't seem to work :( On Thu, Mar 3, 2011 at 10:38 PM, Vikram Narayanan wrote: > I agree with you. Even in an example for MAX7301 with 8051 controller, they > are sending the first 8 bits followed by the next 8 bits. I am now clear > with the idea that this can be achieved this way. Thanks for your > suggestions. > I did some changes and the driver loads fine now. I want to know whether > the clock should be enabled by me or it ll be enabled when the pins are > configured as SPI pins. > > > On Thu, Mar 3, 2011 at 10:27 PM, Grant Likely wrote: > >> On Thu, Mar 3, 2011 at 3:57 AM, Vikram Narayanan >> wrote: >> > Hi, >> > >> > I am trying to interface the MAX7301 IC with my Samsung S3C2440 >> processor. >> > The problem is the S3c supports only 8 bit word length for SPI transfer, >> > whereas my MAX requires 16 bit word length. >> >> You're talking about spi which at it's heart is just a stream of bits. >> Not 8 bit, not 16 bit. Just a stream. The device may make >> assumptions about how the stream is framed into 16 bit hunks, and the >> spi_master may have limitations on how the data buffer is organized (8 >> bit bytes), but that does not prevent the two from working together. >> >> What you need to do is arrange the data in the transfer buffer so that >> the bits get streamed out in the order expected by the MAX7301. It's >> educational to break out an oscilloscope and experiment with different >> transfers so you can get familiar with how the bits appear on the >> wire. Then you'll be able to figure out how to arrange the transfer >> so that the device gets what it needs. >> >> I do *not* recommend using the bitbang driver when you've got a proper >> spi master at your disposal. >> >> g. >> >> > I couldn't find any info on the datasheet to use the IC on a 8 bit word >> > length. can i make the max7301_write function, >> > >> > static int max7301_write(struct spi_device *spi, unsigned int reg, >> unsigned >> > int val) >> > { >> > u8 command = reg & 0x7F; >> > u8 data = val & 0xFF; >> > spi_write(spi, (const u8*)&command, sizeof(command)); >> > spi_write(spi, (const u8*)&data, sizeof(data)); >> > return 0; >> > } >> > >> > Will this make the IC work? Please share your ideas. >> > -- >> > Regards >> > Vikram >> > >> ------------------------------------------------------------------------------ >> > Free Software Download: Index, Search & Analyze Logs and other IT data >> in >> > Real-Time with Splunk. Collect, index and harness all the fast moving IT >> data >> > generated by your applications, servers and devices whether physical, >> virtual >> > or in the cloud. Deliver compliance at lower cost and gain new business >> > insights. http://p.sf.net/sfu/splunk-dev2dev >> > _______________________________________________ >> > spi-devel-general mailing list >> > spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org >> > https://lists.sourceforge.net/lists/listinfo/spi-devel-general >> > >> >> >> >> -- >> Grant Likely, B.Sc., P.Eng. >> Secret Lab Technologies Ltd. >> > > ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev