All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alain-Serge Nagni <alainsergenagni-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH 7/7] ARM: mxs: Add SPI driver for mx233/mx28
Date: Tue, 26 Jun 2012 01:42:30 +0000 (UTC)	[thread overview]
Message-ID: <loom.20120626T032724-306@post.gmane.org> (raw)
In-Reply-To: 201206251530.32203.marex@denx.de



Marek Vasut <marex@...> writes:

> 
> Dear Fabio Estevam,
> 
> > Hi Marek,
> > 
> > On Sat, Jun 23, 2012 at 3:43 PM, Marek Vasut <marex@...> wrote:
> > > +       ssp->clk = clk_get(&pdev->dev, NULL);
> > > +       if (IS_ERR(ssp->clk)) {
> > > +               ret = PTR_ERR(ssp->clk);
> > > +               goto out_spi_free;
> > > +       }
> > 
> > You could use devm_clk_get here instead,
> > 
> > > +
> > > +       clk_prepare_enable(ssp->clk);
> > > +       ssp->clk_rate = clk_get_rate(ssp->clk) / 1000;
> > > +
> > > +       stmp_reset_block(ssp->base);
> > > +
> > > +       platform_set_drvdata(pdev, host);
> > > +
> > > +       ret = spi_register_master(host);
> > > +       if (ret) {
> > > +               dev_err(&pdev->dev, "Cannot register SPI master, %d\n",
> > > ret); +               goto out_clk_put;
> > > +       }
> > > +
> > > +       return 0;
> > > +
> > > +out_clk_put:
> > > +       clk_disable_unprepare(ssp->clk);
> > > +       clk_put(ssp->clk);
> > 
> > ,and then you would not need this clk_put here.
> 
> Oh, good point! I'll wait a little bit more until someone else reviews it and 
> then I'll resubmit new version.
> 
> btw. I'm already working on a combined PIO/DMA-capable version -- seems like 
> using PIO for small transfers and DMA for large transfers is good strategy
that 
> gives me about 200kbps boost 
> 
> > Driver looks good. Thanks for working on it.
> > 
> > Regards,
> > 
> > Fabio Estevam
> 
> Best regards,
> Marek Vasut
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> 



Hi Marek and Fabio,
 I have been testing your latest patch and have some problem to have it working.
The driver is crashing in the "mxs_spi_probe(struct platform_device *pdev)"
function (which is in the file spi-mxs.c) :
  It fails at this call:
          ssp->devid = pdev->id_entry->driver_data;

          after investigation, I can say that: pdev->id_entry  is null. So when
we access it, the kernel crashes.



I added these information in the mach-mx28evk.c file:

    a) in the static const iomux_cfg_t mx28evk_pads[] __initconst table:

       /* SPI2 */
       MX28_PAD_SSP2_SCK__SSP2_SCK,
       MX28_PAD_SSP2_MOSI__SSP2_CMD,
       MX28_PAD_SSP2_MISO__SSP2_D0,
       MX28_PAD_SSP2_SS0__SSP2_D3 |
        (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP),
       MX28_PAD_SSP2_SS1__SSP2_D4 |
        (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP),
       MX28_PAD_SSP2_SS2__SSP2_D5 |
        (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP),


       /* SPI3 */
       MX28_PAD_SSP3_SCK__SSP3_SCK,
       MX28_PAD_SSP3_MOSI__SSP3_CMD,
       MX28_PAD_SSP3_MISO__SSP3_D0,
       MX28_PAD_SSP3_SS0__SSP3_D3 |
        (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP),   



   b) I added an spi device definition:

      static struct spi_board_info mx28evk_spi_nor_device[] = {
      {
         .modalias    = "spidev",
         .chip_select    = 0,
         .max_speed_hz    = 5000000, // max spi clock (SCK) speed in HZ): 5MHz
         .bus_num    = 2,
         .mode = SPI_MODE_0,
      }, 
     };


    c) I added these calls in the "mx28evk_init(void)" function:

	mx28_add_mxs_spi(2);
	spi_register_board_info(mx28evk_spi_nor_device,
				ARRAY_SIZE(mx28evk_spi_nor_device));



What do you think may be the problem? If you need more details please let me
know.



Thanks for your help,
Alain-Serge



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

  reply	other threads:[~2012-06-26  1:42 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-23 18:43 [PATCH 1/7] ARM: mxs: Move SSP register definitions into separate file Marek Vasut
2012-06-23 18:43 ` Marek Vasut
2012-06-23 18:43 ` [PATCH 2/7] ARM: mxs: Rename IMX2[38]_MMC to IMX2[38]_SSP Marek Vasut
2012-06-23 18:43   ` Marek Vasut
2012-06-23 18:43 ` [PATCH 3/7] ARM: mxs: Add necessary bits into mxs-spi.h Marek Vasut
2012-06-23 18:43   ` Marek Vasut
2012-06-23 18:43 ` [PATCH 4/7] ARM: mxs: Add SPI clock into clk framwork Marek Vasut
2012-06-23 18:43   ` Marek Vasut
2012-06-26  6:54   ` Shawn Guo
2012-06-26  6:54     ` Shawn Guo
     [not found]     ` <20120626065428.GM2342-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-06-26 12:16       ` Marek Vasut
2012-06-26 12:16         ` Marek Vasut
2012-06-26 12:24         ` Shawn Guo
2012-06-26 12:24           ` Shawn Guo
     [not found]           ` <20120626122424.GG8858-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-06-26 12:31             ` Marek Vasut
2012-06-26 12:31               ` Marek Vasut
2012-06-23 18:43 ` [PATCH 5/7] ARM: mxs: Pull out parts shared between MMC and SPI Marek Vasut
2012-06-23 18:43   ` Marek Vasut
2012-06-23 18:43 ` [PATCH 6/7] ARM: mxs: Pull out the SSP clock configuration function Marek Vasut
2012-06-23 18:43   ` Marek Vasut
2012-06-23 18:43 ` [PATCH 7/7] ARM: mxs: Add SPI driver for mx233/mx28 Marek Vasut
2012-06-23 18:43   ` Marek Vasut
     [not found]   ` <1340477033-2761-7-git-send-email-marex-ynQEQJNshbs@public.gmane.org>
2012-06-25 13:22     ` Fabio Estevam
2012-06-25 13:22       ` Fabio Estevam
     [not found]       ` <CAOMZO5BYoU5=tJCUH1nkT24FJhhXXhNwF46yYREGJj7G33HdVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-06-25 13:30         ` Marek Vasut
2012-06-25 13:30           ` Marek Vasut
2012-06-26  1:42           ` Alain-Serge Nagni [this message]
2012-06-26  7:43     ` Shawn Guo
2012-06-26  7:43       ` Shawn Guo
     [not found]       ` <20120626074342.GA4928-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-06-26 12:22         ` Marek Vasut
2012-06-26 12:22           ` Marek Vasut
2012-06-26 12:31           ` Shawn Guo
2012-06-26 12:31             ` Shawn Guo
     [not found]             ` <20120626123141.GH8858-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-06-26 12:50               ` Marek Vasut
2012-06-26 12:50                 ` Marek Vasut
2012-06-26  6:52 ` [PATCH 1/7] ARM: mxs: Move SSP register definitions into separate file Shawn Guo
2012-06-26  6:52   ` Shawn Guo
     [not found] <1340885853.84699.YahooMailClassic@web124903.mail.ne1.yahoo.com>
2012-06-28 22:09 ` [PATCH 7/7] ARM: mxs: Add SPI driver for mx233/mx28 Marek Vasut
2012-07-08  2:01   ` Alain-Serge Nagni
2012-07-08  5:15     ` Marek Vasut

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=loom.20120626T032724-306@post.gmane.org \
    --to=alainsergenagni-/e1597as9lqavxtiumwx3w@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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.