All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Schmidt <stefan@datenfreihafen.org>
To: Stefan Schmidt <stefan@datenfreihafen.org>
Cc: spi-devel-general@lists.sourceforge.net,
	Eric Miao <eric.y.miao@gmail.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: Slow spi_sync() on pxa2xx_spi
Date: Thu, 16 Jun 2011 11:59:34 +0200	[thread overview]
Message-ID: <20110616095934.GC10075@excalibur.local> (raw)
In-Reply-To: <20110616091931.GB10075@excalibur.local>

Hello.

On Thu, 2011-06-16 at 11:19, Stefan Schmidt wrote:
> 
> On Thu, 2011-06-16 at 16:34, Eric Miao wrote:
> > 
> > What is the SPI frequency?
> 
> I tried various settings in .max_speed_hz from the original 6.6 MHt to
> 10 MHz and 13MHz as maximum of the controller. Did also not change
> anything for me.
> 
> That reminds me that after defining DEBUG in pxa2xx_spi it did always
> report 13MHz to me. Need to have a look at it.

Either the debug statement or the setting is indeed wrong.

[    0.696759] spi spi1.0: 13000000 Hz actual, PIO
[    0.715760] spi spi3.0: 13000000 Hz actual, PIO

Which comes from this part of the driver (with #define DEBUG set):

        /* NOTE:  PXA25x_SSP _could_ use external clocking ... */
        if (!pxa25x_ssp_comp(drv_data))
                dev_dbg(&spi->dev, "%ld Hz actual, %s\n",
                        clk_get_rate(ssp->clk)
                                / (1 + ((chip->cr0 & SSCR0_SCR(0xfff)) >> 8)),
                        chip->enable_dma ? "DMA" : "PIO");
        else
                dev_dbg(&spi->dev, "%ld Hz actual, %s\n",
                        clk_get_rate(ssp->clk) / 2
                                / (1 + ((chip->cr0 & SSCR0_SCR(0x0ff)) >> 8)),
                        chip->enable_dma ? "DMA" : "PIO");

But the board file has this:

static struct spi_board_info spi_board_info[] __initdata = {
        {
                .modalias = "lis3l02dq",
                .max_speed_hz = 8000000,/* 8MHz max spi frequency at 3V */
                .bus_num = 1,
                .chip_select = 0,
                .controller_data = &staccel_chip_info,
                .irq = IRQ_GPIO(96),
        }, {
                .modalias = "cc2420",
//              .max_speed_hz = 6500000,
                .max_speed_hz = 10000000, /* 10MHz */
                .bus_num = 3,
                .chip_select = 0,
                .controller_data = &cc2420_info,
                .platform_data = &cc2420_pdata,

        },
};

Its neither 8MHz for spi1.0 nor 10MHz for spi3.0.

Adding some debug info shows me that the driver gets the data fine form the
platform data:
[    0.695770] spi spi1.0: chip->speed_hz: 8000000, spi->max_speed_hz: 8000000
[    0.695872] spi spi1.0: 13000000 Hz actual, PIO
[    0.714824] spi spi3.0: chip->speed_hz: 10000000, spi->max_speed_hz: 10000000
[    0.714929] spi spi3.0: 13000000 Hz actual, PIO

Thats directly above the chip->cr0 and chip->cr1 calculations. Is this just the
initial seeting and it gets overwritten before a transfer or is the speed
calculation wrong?

regards
Stefan Schmidt

WARNING: multiple messages have this Message-ID (diff)
From: stefan@datenfreihafen.org (Stefan Schmidt)
To: linux-arm-kernel@lists.infradead.org
Subject: Slow spi_sync() on pxa2xx_spi
Date: Thu, 16 Jun 2011 11:59:34 +0200	[thread overview]
Message-ID: <20110616095934.GC10075@excalibur.local> (raw)
In-Reply-To: <20110616091931.GB10075@excalibur.local>

Hello.

On Thu, 2011-06-16 at 11:19, Stefan Schmidt wrote:
> 
> On Thu, 2011-06-16 at 16:34, Eric Miao wrote:
> > 
> > What is the SPI frequency?
> 
> I tried various settings in .max_speed_hz from the original 6.6 MHt to
> 10 MHz and 13MHz as maximum of the controller. Did also not change
> anything for me.
> 
> That reminds me that after defining DEBUG in pxa2xx_spi it did always
> report 13MHz to me. Need to have a look at it.

Either the debug statement or the setting is indeed wrong.

[    0.696759] spi spi1.0: 13000000 Hz actual, PIO
[    0.715760] spi spi3.0: 13000000 Hz actual, PIO

Which comes from this part of the driver (with #define DEBUG set):

        /* NOTE:  PXA25x_SSP _could_ use external clocking ... */
        if (!pxa25x_ssp_comp(drv_data))
                dev_dbg(&spi->dev, "%ld Hz actual, %s\n",
                        clk_get_rate(ssp->clk)
                                / (1 + ((chip->cr0 & SSCR0_SCR(0xfff)) >> 8)),
                        chip->enable_dma ? "DMA" : "PIO");
        else
                dev_dbg(&spi->dev, "%ld Hz actual, %s\n",
                        clk_get_rate(ssp->clk) / 2
                                / (1 + ((chip->cr0 & SSCR0_SCR(0x0ff)) >> 8)),
                        chip->enable_dma ? "DMA" : "PIO");

But the board file has this:

static struct spi_board_info spi_board_info[] __initdata = {
        {
                .modalias = "lis3l02dq",
                .max_speed_hz = 8000000,/* 8MHz max spi frequency at 3V */
                .bus_num = 1,
                .chip_select = 0,
                .controller_data = &staccel_chip_info,
                .irq = IRQ_GPIO(96),
        }, {
                .modalias = "cc2420",
//              .max_speed_hz = 6500000,
                .max_speed_hz = 10000000, /* 10MHz */
                .bus_num = 3,
                .chip_select = 0,
                .controller_data = &cc2420_info,
                .platform_data = &cc2420_pdata,

        },
};

Its neither 8MHz for spi1.0 nor 10MHz for spi3.0.

Adding some debug info shows me that the driver gets the data fine form the
platform data:
[    0.695770] spi spi1.0: chip->speed_hz: 8000000, spi->max_speed_hz: 8000000
[    0.695872] spi spi1.0: 13000000 Hz actual, PIO
[    0.714824] spi spi3.0: chip->speed_hz: 10000000, spi->max_speed_hz: 10000000
[    0.714929] spi spi3.0: 13000000 Hz actual, PIO

Thats directly above the chip->cr0 and chip->cr1 calculations. Is this just the
initial seeting and it gets overwritten before a transfer or is the speed
calculation wrong?

regards
Stefan Schmidt

  parent reply	other threads:[~2011-06-16  9:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-16  8:21 Slow spi_sync() on pxa2xx_spi Stefan Schmidt
2011-06-16  8:21 ` Stefan Schmidt
2011-06-16  8:34 ` Eric Miao
2011-06-16  8:34   ` Eric Miao
     [not found]   ` <BANLkTikuo_fHbw9FFMtorpg15vOnXMK-+g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-16  9:19     ` Stefan Schmidt
2011-06-16  9:19       ` Stefan Schmidt
2011-06-16  9:44       ` Eric Miao
2011-06-16  9:44         ` Eric Miao
2011-06-21 14:03         ` Stefan Schmidt
2011-06-21 14:03           ` Stefan Schmidt
2011-06-21 14:08           ` Eric Miao
2011-06-21 14:08             ` Eric Miao
2011-06-21 14:20             ` Stefan Schmidt
2011-06-21 14:20               ` Stefan Schmidt
2011-06-21 15:04               ` Eric Miao
2011-06-21 15:04                 ` Eric Miao
     [not found]                 ` <BANLkTi=+oNHYYL_=gYUCC+zFBfnkxZqJWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-21 15:18                   ` Stefan Schmidt
2011-06-21 15:18                     ` Stefan Schmidt
2011-06-16  9:59       ` Stefan Schmidt [this message]
2011-06-16  9:59         ` Stefan Schmidt
2011-06-16 10:02         ` Eric Miao
2011-06-16 10:02           ` Eric Miao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110616095934.GC10075@excalibur.local \
    --to=stefan@datenfreihafen.org \
    --cc=eric.y.miao@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.