All of lore.kernel.org
 help / color / mirror / Atom feed
* am335x: spi driver and two chip select
@ 2016-04-12 13:42 Micka
       [not found] ` <CAF+MRt=ZJP2fssLHRUoR9T9EPfWEPN1LC0CLxZ0CgJQy01S3Rw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Micka @ 2016-04-12 13:42 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA

Hi,

I've two MAX3107 connected to the spi 1 line. ( chip select 0 and 1 )

The problem is that when the spi driver start the probe function of
the driver, the chip select of the second max3107 is set to low .....

During the first call of the probe function, the driver try to read a
register on the first device, but because of the second chip select
set to low, the two device answer at the same time .... I don't really
understand why ?

I've correctly configured the CS1 and CS0 to be set as an output with
a pull up ....


&spi1{
#address-cells = <1>;
#size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&bb_spi1_pins>;
status = "okay";
ti,pindir-d0-out-d1-in;

max3107a: max3107a@0 {
 compatible = "maxim,max3107";
 reg = <0>;
 clock-frequency = <1843200>;
 interrupt-parent = <&gpio1>;
 interrupts =<7 IRQ_TYPE_EDGE_FALLING>;
 gpio-controller;
 spi-max-frequency = <4000000>;
 status = "okay";
};

max3107b: max3107b@1 {
compatible = "maxim,max3107";
reg = <1>;
clock-frequency = <1843200>;
interrupt-parent = <&gpio2>;
interrupts=<5 IRQ_TYPE_EDGE_FALLING>;
spi-max-frequency = <4000000>;
status = "okay";
};

};
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: am335x: spi driver and two chip select
       [not found] ` <CAF+MRt=ZJP2fssLHRUoR9T9EPfWEPN1LC0CLxZ0CgJQy01S3Rw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-04-12 13:50   ` Geert Uytterhoeven
       [not found]     ` <CAMuHMdWtHYNLcbX65HzuV6fyPENMR75XrVQ8RkW=y_T=hN44+g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
       [not found]     ` <CAF+MRtkyjeu6baWXX-hJathGjAkwz+REExzUBNWtJCROv5KrtA@mail.gmail.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2016-04-12 13:50 UTC (permalink / raw)
  To: Micka; +Cc: Mark Brown, linux-spi

Hi Micka,

On Tue, Apr 12, 2016 at 3:42 PM, Micka <mickamusset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> I've two MAX3107 connected to the spi 1 line. ( chip select 0 and 1 )
>
> The problem is that when the spi driver start the probe function of
> the driver, the chip select of the second max3107 is set to low .....
>
> During the first call of the probe function, the driver try to read a
> register on the first device, but because of the second chip select
> set to low, the two device answer at the same time .... I don't really
> understand why ?
>
> I've correctly configured the CS1 and CS0 to be set as an output with
> a pull up ....
>
>
> &spi1{
> #address-cells = <1>;
> #size-cells = <0>;
> pinctrl-names = "default";
> pinctrl-0 = <&bb_spi1_pins>;
> status = "okay";
> ti,pindir-d0-out-d1-in;

Guessing from the DT, you're using "ti,omap4-mcspi"?

AFAIU, spi_master.setup() should not modify registers immediately when
supporting more than a single CS signal, while omap2_mcspi_setup_transfer()
seems to do that.

Probably the second SPI slave is set up while performing a transfer to
the first SPI slave.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: am335x: spi driver and two chip select
       [not found]     ` <CAMuHMdWtHYNLcbX65HzuV6fyPENMR75XrVQ8RkW=y_T=hN44+g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-04-13  4:51       ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2016-04-13  4:51 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Micka, linux-spi

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

On Tue, Apr 12, 2016 at 03:50:21PM +0200, Geert Uytterhoeven wrote:

> AFAIU, spi_master.setup() should not modify registers immediately when
> supporting more than a single CS signal, while omap2_mcspi_setup_transfer()
> seems to do that.

Yes, this is a very common bug.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: am335x: spi driver and two chip select
       [not found]       ` <CAF+MRtkyjeu6baWXX-hJathGjAkwz+REExzUBNWtJCROv5KrtA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-04-13  4:57         ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2016-04-13  4:57 UTC (permalink / raw)
  To: Micka; +Cc: Geert Uytterhoeven, linux-spi

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

On Tue, Apr 12, 2016 at 01:56:27PM +0000, Micka wrote:

Please don't top post, reply in line with needed context.  This allows
readers to readily follow the flow of conversation and understand what
you are talking about and also helps ensure that everything in the
discussion is being addressed.

> Do you know a way to fix that ? Idea ? How can I prevent the problem ?

The driver should store settings in driver data (probably using the
device controller_data) in setup() and only write them to the hardware
only when it starts to actually interact with the device.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2016-04-13  4:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-12 13:42 am335x: spi driver and two chip select Micka
     [not found] ` <CAF+MRt=ZJP2fssLHRUoR9T9EPfWEPN1LC0CLxZ0CgJQy01S3Rw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-12 13:50   ` Geert Uytterhoeven
     [not found]     ` <CAMuHMdWtHYNLcbX65HzuV6fyPENMR75XrVQ8RkW=y_T=hN44+g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-13  4:51       ` Mark Brown
     [not found]     ` <CAF+MRtkyjeu6baWXX-hJathGjAkwz+REExzUBNWtJCROv5KrtA@mail.gmail.com>
     [not found]       ` <CAF+MRtkyjeu6baWXX-hJathGjAkwz+REExzUBNWtJCROv5KrtA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-13  4:57         ` Mark Brown

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.