public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 03/18] sf: fix sf probe
Date: Mon, 4 Aug 2014 10:02:42 -0400	[thread overview]
Message-ID: <20140804140242.GE19374@bill-the-cat> (raw)
In-Reply-To: <53DF8E95.1000702@compulab.co.il>

On Mon, Aug 04, 2014 at 04:45:57PM +0300, Nikita Kiryanov wrote:
> 
> 
> On 04/08/14 16:10, Marek Vasut wrote:
> >On Monday, August 04, 2014 at 02:48:54 PM, Nikita Kiryanov wrote:
> >>Hi Marek,
> >>
> >>On 03/08/14 16:46, Marek Vasut wrote:
> >>>On Sunday, August 03, 2014 at 09:34:33 AM, Nikita Kiryanov wrote:
> >>>>MXC SPI driver has a feature whereas a GPIO line can be used as a CS
> >>>>signal. This is set up by joining the CS and GPIO values into a single
> >>>>value using (cs | gpio << 8), and passing it off as a CS value. This
> >>>>breaks the sf probe command, because it is no longer possible to invoke
> >>>>it as sf probe <cs>. Instead, the user must use sf probe <cs | gpio <<
> >>>>8>.
> >>>>
> >>>>Fix this by introducing a new board function: board_spi_cs_gpio().
> >>>>When called, board_spi_cs_gpio() will return the gpio number for the
> >>>>cs value it is given.
> >>>>
> >>>>Cc: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
> >>>>Cc: Eric Nelson <eric.nelson@boundarydevices.com>
> >>>>Cc: Eric Benard <eric@eukrea.com>
> >>>>Cc: Fabio Estevam <fabio.estevam@freescale.com>
> >>>>Cc: Tim Harvey <tharvey@gateworks.com>
> >>>>Cc: Stefano Babic <sbabic@denx.de>
> >>>>Cc: Tom Rini <trini@ti.com>
> >>>>Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> >>>
> >>>Just curious, but is this fixing generic SF code or MXC SPI driver ? I'd
> >>>think the later, but it's not obvious from neither the description nor
> >>>the subject. I don't quite understand the problem that you're trying to
> >>>fix either, what happened, did the user command interface change ?
> >>
> >>The U-Boot shell command "sf probe" can accept a chip select value, but
> >>if the SPI device on the other end requires an active chip-select over
> >>multiple transactions (achieved in the MXC SPI driver using a GPIO),
> >>simply typing something like "sf probe 0" will not work.
> >
> >Why not ?
> >
> >>This is because whatever the user passes as chip select is propagated
> >>to the driver, and the driver expects this value to have GPIO
> >>information. So for example, if IMX_GPIO_NR(2, 30) is used to force
> >>active chip select 0, then instead of "sf probe 0" the user will have
> >>to type "sf probe 15872".
> >
> >You mean sf probe 0:15872 , right ?
> 
> It's the same thing:
> sf probe [[bus:]cs] [hz] [mode]
> 
> The point is that cs 0 has to be represented as "15872", instead of "0".

Eeep.  That seems very likely to be gotten incorrect by users.

Can we do something like:
mxc_spi.c:
__weak int board_map_spi_cs_value(int desired_cs) { return -EINVAL; }

fooboard.c:
board_map_spi_cs_value(int desired_cs) {
  if (desired_cs == 0)
    return IMX_GPIO_NR(2, 30);
  else
    return -EINVAL;
}

I think it'll be very bad if the user has to type 'sf probe 0:15872' or
'sf probe 15872' since that's a programming detail rather than saying
bank 2, gpio 30 (which I assume is what IMX_GPIO_NR means).

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140804/52d1cbab/attachment.pgp>

  parent reply	other threads:[~2014-08-04 14:02 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-03  7:34 [U-Boot] [PATCH 00/18] Introduce cm-fx6 board Nikita Kiryanov
2014-08-03  7:34 ` [U-Boot] [PATCH 01/18] spl: improve spi configuration Nikita Kiryanov
2014-08-03 13:44   ` Marek Vasut
2014-08-05 13:28     ` Nikita Kiryanov
2014-08-05 14:11       ` Marek Vasut
2014-08-06 10:53         ` Nikita Kiryanov
2014-08-06 11:32           ` Marek Vasut
2014-08-03  7:34 ` [U-Boot] [PATCH 02/18] mx6: add clock enabling functions Nikita Kiryanov
2014-08-03  7:34 ` [U-Boot] [PATCH 03/18] sf: fix sf probe Nikita Kiryanov
2014-08-03 13:46   ` Marek Vasut
2014-08-04 12:48     ` Nikita Kiryanov
2014-08-04 13:10       ` Marek Vasut
2014-08-04 13:45         ` Nikita Kiryanov
2014-08-04 13:51           ` Marek Vasut
2014-08-04 14:11             ` Nikita Kiryanov
2014-08-04 14:20               ` Marek Vasut
2014-08-04 14:02           ` Tom Rini [this message]
2014-08-04 14:09             ` Marek Vasut
2014-08-04 14:19             ` Nikita Kiryanov
2014-08-04 14:58               ` Tom Rini
2014-08-03  7:34 ` [U-Boot] [PATCH 04/18] mtd: spi: add support for M25PE16 and M25PX16 Nikita Kiryanov
2014-08-03 13:47   ` Marek Vasut
2014-08-03  7:34 ` [U-Boot] [PATCH 05/18] compulab: eeprom: add support for defining eeprom i2c bus Nikita Kiryanov
2014-08-03 13:48   ` Marek Vasut
2014-08-04 12:49     ` Nikita Kiryanov
2014-08-03  7:34 ` [U-Boot] [PATCH 06/18] sata: dwc_ahsata: implement sata_port_status Nikita Kiryanov
2014-08-03 13:49   ` Marek Vasut
2014-08-04 12:49     ` Nikita Kiryanov
2014-08-04 13:10       ` Marek Vasut
2014-08-03  7:34 ` [U-Boot] [PATCH 07/18] i2c: imx: add macros to setup pads for multiple SoC types Nikita Kiryanov
2014-08-04  4:28   ` Tim Harvey
2014-08-03  7:34 ` [U-Boot] [PATCH 08/18] arm: mx6: ddr: cleanup Nikita Kiryanov
2014-08-04  5:26   ` Tim Harvey
2014-08-03  7:34 ` [U-Boot] [PATCH 09/18] arm: mx6: ddr: do not write into reserved bit Nikita Kiryanov
2014-08-04  5:43   ` Tim Harvey
2014-08-04 12:49     ` Nikita Kiryanov
2014-08-06  8:18       ` Tim Harvey
2014-08-06  8:31         ` Stefano Babic
2014-08-03  7:34 ` [U-Boot] [PATCH 10/18] arm: mx6: ddr: configure MMDC for slow_pd Nikita Kiryanov
2014-08-04  5:42   ` Tim Harvey
2014-08-04 12:49     ` Nikita Kiryanov
2014-08-03  7:34 ` [U-Boot] [PATCH 11/18] arm: mx6: ddr: fix cs0_end calculation Nikita Kiryanov
2014-08-03  7:34 ` [U-Boot] [PATCH 12/18] arm: mx6: add support for Compulab cm-fx6 CoM Nikita Kiryanov
2014-08-03 14:09   ` Marek Vasut
2014-08-04 14:41     ` Nikita Kiryanov
2014-08-04 15:12       ` Marek Vasut
2014-08-05  7:36         ` Nikita Kiryanov
2014-08-05  7:58           ` Marek Vasut
2014-08-04  4:45   ` Tim Harvey
2014-08-04 13:36     ` Nikita Kiryanov
2014-08-06 17:29       ` Nikita Kiryanov
2014-08-08  7:19         ` Tim Harvey
2014-08-10 16:20           ` Nikita Kiryanov
2014-08-04  6:02   ` Tim Harvey
2014-08-04 14:24     ` Nikita Kiryanov
2014-08-07 11:27       ` Nikita Kiryanov
2014-08-03  7:34 ` [U-Boot] [PATCH 13/18] arm: mx6: cm_fx6: add nand support Nikita Kiryanov
2014-08-03  7:34 ` [U-Boot] [PATCH 14/18] arm: mx6: cm_fx6: add ethernet support Nikita Kiryanov
2014-08-03  7:34 ` [U-Boot] [PATCH 15/18] arm: mx6: cm_fx6: add usb support Nikita Kiryanov
2014-08-03  7:34 ` [U-Boot] [PATCH 16/18] arm: mx6: cm_fx6: add i2c support Nikita Kiryanov
2014-08-03  7:34 ` [U-Boot] [PATCH 17/18] arm: mx6: cm_fx6: use eeprom Nikita Kiryanov
2014-08-03  7:34 ` [U-Boot] [PATCH 18/18] arm: mx6: cm_fx6: add sata support Nikita Kiryanov
2014-08-03 14:10   ` Marek Vasut
2014-08-04  7:23     ` Igor Grinberg
2014-08-04  8:27       ` Marek Vasut
2014-08-04 10:47         ` Igor Grinberg
2014-08-04 10:53           ` 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=20140804140242.GE19374@bill-the-cat \
    --to=trini@ti.com \
    --cc=u-boot@lists.denx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox