linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* MRST SPI
       [not found] ` <AANLkTimry3-NehWrundOuB_PWb420yOdrD1APaMXYkr6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-02-10 10:48   ` Tom
       [not found]     ` <AANLkTin60qjesNcaPRiDftt8s83i7JTRkB7zbt1pW31--JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Tom @ 2011-02-10 10:48 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[-- Attachment #1: Type: text/plain, Size: 1718 bytes --]

Hi All,

I have a SPI device problem on MRST CDK.

I use a GPIO as SS because my slave device expects the SS to be low between
byte transfers.
My probe function does a read as:

int read_val;
-------
---
read_val = spi_w8r8(&spi_dev,0x20);
 if ( read_val < 0 )
printk ( "spi_read err\n");
else
 printk ( "spi_read %d\n",read_val );
----
--

The MRST SFI interface passes the device board info. Because, my device is
not listed in the IA32 f/w I modified the MRST.c code sfi_handle_spi_dev
function as:

while(dev->name[0])
{
                if (dev->type == SFI_DEV_TYPE_SPI &&
                                !strncmp(dev->name, spi_info->modalias, 16))
{
                        if (!strncmp("spi_old_device", spi_info->modalias,
16)){
                                strncpy (spi_info->modalias,
"spi_my_dev",16);
                                pdata = dev->get_platform_data(spi_info);
                                pr_info ( "spi_old_device modalias to
spi_my_dev ");
                        }
                       else
                       {
                             pdata = dev->get_platform_data(spi_info);
                       }
                      break;
                }
          dev++;
}

i also modified the devs_id array to change the platform_data

 {"spi_old_dev", SFI_DEV_TYPE_SPI, 0, &no_platform_data}

The issue is  that for the spi_w8r8 call, i get multiple read (multiple * (8
clock cycles/SS toggle))on the SPI bus.

Also regarding the spi->irq, is it the responsibility of the protocol driver
to register for this irq and handle it or does the spi framework or master
driver take care of this ?

Any pointers would be really helpful. ( attached is the test code)

Regards,
Tom

[-- Attachment #2: Type: text/plain, Size: 387 bytes --]

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb

[-- Attachment #3: Type: text/plain, Size: 210 bytes --]

_______________________________________________
spi-devel-general mailing list
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: MRST SPI
       [not found]     ` <AANLkTin60qjesNcaPRiDftt8s83i7JTRkB7zbt1pW31--JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-02-10 10:50       ` Tom
  2011-02-14  1:05       ` Feng Tang
  1 sibling, 0 replies; 3+ messages in thread
From: Tom @ 2011-02-10 10:50 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Following is the debug log from messages after enabling spi debug (starts at
point when i call spi_w8r8()) :

Jan 10 01:54:35 localhost klogd: [  100.202663]  [<c012484f>]
__might_sleep+0xd9/0xe0
Jan 10 01:54:35 localhost klogd: [  100.202699]  [<c059da0b>]
wait_for_common+0x21/0xfd
Jan 10 01:54:35 localhost klogd: [  100.202733]  [<c034b585>] ?
dw_spi_transfer+0x97/0xaa
Jan 10 01:54:35 localhost klogd: [  100.202764]  [<c0349417>] ?
spi_async+0x7f/0x8d
Jan 10 01:54:35 localhost klogd: [  100.202794]  [<c059db68>]
wait_for_completion+0x12/0x14
Jan 10 01:54:35 localhost klogd: [  100.202825]  [<c03496d0>]
spi_sync+0x41/0x53
Jan 10 01:54:35 localhost klogd: [  100.202859]  [<c0349835>]
spi_write_then_read+0x153/0x193
Jan 10 01:54:35 localhost klogd: [  100.202900]  [<c0349875>] ?
spi_complete+0x0/0xa
Jan 10 01:54:35 localhost klogd: [  100.202941]  [<dfbed212>]
spi_trx_probe+0x1cd/0x220 [spitest]
Jan 10 01:54:35 localhost klogd: [  100.202975]  [<c0349350>]
spi_drv_probe+0x14/0x17
Jan 10 01:54:35 localhost klogd: [  100.203009]  [<c031510f>]
driver_probe_device+0x8f/0x117
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<c03151da>]
__driver_attach+0x43/0x5f
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<c0314a8d>]
bus_for_each_dev+0x3d/0x67
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<c0314fd2>]
driver_attach+0x14/0x16
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<c0315197>] ?
__driver_attach+0x0/0x5f
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<c0314520>]
bus_add_driver+0x10b/0x23b
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<c0287e8f>] ?
kset_find_obj+0x56/0x5e
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<dfbf0000>] ?
spi_trx_init+0x0/0x4c [spitest]
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<c0315417>]
driver_register+0x79/0xe0
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<dfbf0000>] ?
spi_trx_init+0x0/0x4c [spitest]
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<c0349e37>]
spi_register_driver+0x39/0x3e
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<dfbf0018>]
spi_trx_init+0x18/0x4c [spitest]
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<c0101051>]
do_one_initcall+0x4c/0x131
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<c015a25e>]
sys_init_module+0x77/0x199
Jan 10 01:54:35 localhost klogd: [  100.203041]  [<c01027d7>]
sysenter_do_call+0x12/0x26


**************** my printk messages *******************************

Regards,
Tom


On Thu, Feb 10, 2011 at 4:18 PM, Tom <tom.spi.devel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Hi All,
>
> I have a SPI device problem on MRST CDK.
>
> I use a GPIO as SS because my slave device expects the SS to be low between
> byte transfers.
> My probe function does a read as:
>
> int read_val;
> -------
> ---
> read_val = spi_w8r8(&spi_dev,0x20);
>  if ( read_val < 0 )
> printk ( "spi_read err\n");
> else
>  printk ( "spi_read %d\n",read_val );
> ----
> --
>
> The MRST SFI interface passes the device board info. Because, my device is
> not listed in the IA32 f/w I modified the MRST.c code sfi_handle_spi_dev
> function as:
>
> while(dev->name[0])
> {
>                 if (dev->type == SFI_DEV_TYPE_SPI &&
>                                 !strncmp(dev->name, spi_info->modalias,
> 16)) {
>                         if (!strncmp("spi_old_device", spi_info->modalias,
> 16)){
>                                 strncpy (spi_info->modalias,
> "spi_my_dev",16);
>                                 pdata = dev->get_platform_data(spi_info);
>                                 pr_info ( "spi_old_device modalias to
> spi_my_dev ");
>                         }
>                        else
>                        {
>                              pdata = dev->get_platform_data(spi_info);
>                        }
>                       break;
>                 }
>           dev++;
> }
>
> i also modified the devs_id array to change the platform_data
>
>  {"spi_old_dev", SFI_DEV_TYPE_SPI, 0, &no_platform_data}
>
> The issue is  that for the spi_w8r8 call, i get multiple read (multiple *
> (8 clock cycles/SS toggle))on the SPI bus.
>
> Also regarding the spi->irq, is it the responsibility of the protocol
> driver to register for this irq and handle it or does the spi framework or
> master driver take care of this ?
>
> Any pointers would be really helpful. ( attached is the test code)
>
> Regards,
> Tom
>
>
>
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: MRST SPI
       [not found]     ` <AANLkTin60qjesNcaPRiDftt8s83i7JTRkB7zbt1pW31--JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2011-02-10 10:50       ` Tom
@ 2011-02-14  1:05       ` Feng Tang
  1 sibling, 0 replies; 3+ messages in thread
From: Feng Tang @ 2011-02-14  1:05 UTC (permalink / raw)
  To: Tom
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	alan-VuQAYsv1563Yd54FQh9/CA

Hi Tom,

On Thu, 10 Feb 2011 18:48:00 +0800
Tom <tom.spi.devel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Hi All,
> 
> I have a SPI device problem on MRST CDK.
> 
> I use a GPIO as SS because my slave device expects the SS to be low
> between byte transfers.

The DW spi controller has a slave select register for that purpose, and
myself don't have experience of using an external GPIO lines for SS, so
no comment here.

> My probe function does a read as:
> 
> int read_val;
> -------
> ---
> read_val = spi_w8r8(&spi_dev,0x20);
>  if ( read_val < 0 )
> printk ( "spi_read err\n");
> else
>  printk ( "spi_read %d\n",read_val );
> ----
> --
> 
> The MRST SFI interface passes the device board info. Because, my
> device is not listed in the IA32 f/w I modified the MRST.c code
> sfi_handle_spi_dev function as:
> 
> while(dev->name[0])
> {
>                 if (dev->type == SFI_DEV_TYPE_SPI &&
>                                 !strncmp(dev->name,
> spi_info->modalias, 16)) {
>                         if (!strncmp("spi_old_device",
> spi_info->modalias, 16)){
>                                 strncpy (spi_info->modalias,
> "spi_my_dev",16);
>                                 pdata =
> dev->get_platform_data(spi_info); pr_info ( "spi_old_device modalias
> to spi_my_dev ");
>                         }
>                        else
>                        {
>                              pdata = dev->get_platform_data(spi_info);
>                        }
>                       break;
>                 }
>           dev++;
> }
> 
> i also modified the devs_id array to change the platform_data
> 
>  {"spi_old_dev", SFI_DEV_TYPE_SPI, 0, &no_platform_data}
> 
> The issue is  that for the spi_w8r8 call, i get multiple read
> (multiple * (8 clock cycles/SS toggle))on the SPI bus.
> 
> Also regarding the spi->irq, is it the responsibility of the protocol
> driver to register for this irq and handle it or does the spi
> framework or master driver take care of this ?
> 
> Any pointers would be really helpful. ( attached is the test code)

Suggest you refer the arch/platform/mrst/mrst.c about setting up
the max3110 spi device's platform and controller data, you can 
find it in Alan Cox's MID reference tree:

git://git.kernel.org/pub/scm/linux/kernel/git/alan/linux-2.6-mid-ref.git 

Thanks,
Feng

> 
> Regards,
> Tom

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-14  1:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AANLkTimry3-NehWrundOuB_PWb420yOdrD1APaMXYkr6@mail.gmail.com>
     [not found] ` <AANLkTimry3-NehWrundOuB_PWb420yOdrD1APaMXYkr6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-10 10:48   ` MRST SPI Tom
     [not found]     ` <AANLkTin60qjesNcaPRiDftt8s83i7JTRkB7zbt1pW31--JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-10 10:50       ` Tom
2011-02-14  1:05       ` Feng Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).