public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver
@ 2018-06-20 20:51 Michael Trimarchi
  2018-06-20 20:51 ` [U-Boot] [PATCH 2/3] spi: mxc_spi: Fix chipselect on DM_SPI driver uclass Michael Trimarchi
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Michael Trimarchi @ 2018-06-20 20:51 UTC (permalink / raw)
  To: u-boot

drivers/spi/mxc_spi.c:507: undefined reference to `dev_get_addr'
linux-ld.bfd: BFD (GNU Binutils) 2.29.1 assertion fail elf32-arm.c:9509

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/spi/mxc_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index b77129c..fcb214a 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -504,7 +504,7 @@ static int mxc_spi_probe(struct udevice *bus)
 		return -EINVAL;
 	}
 
-	plat->base = dev_get_addr(bus);
+	plat->base = devfdt_get_addr(bus);
 	if (plat->base == FDT_ADDR_T_NONE)
 		return -ENODEV;
 
-- 
2.7.4

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

* [U-Boot] [PATCH 2/3] spi: mxc_spi: Fix chipselect on DM_SPI driver uclass
  2018-06-20 20:51 [U-Boot] [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver Michael Trimarchi
@ 2018-06-20 20:51 ` Michael Trimarchi
  2018-06-24 11:40   ` Peng Fan
  2018-06-25  9:54   ` Jagan Teki
  2018-06-20 20:51 ` [U-Boot] [PATCH 3/3] spi: mxc_spi: Fix spi mode communication where clock is inverted Michael Trimarchi
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 10+ messages in thread
From: Michael Trimarchi @ 2018-06-20 20:51 UTC (permalink / raw)
  To: u-boot

CS GPIO activation low/high is determinated by the device tree
so we don't need to take in accoung in cs_activate and cs_deactivate

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/spi/mxc_spi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index fcb214a..0dccc38 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -60,7 +60,7 @@ static inline struct mxc_spi_slave *to_mxc_spi_slave(struct spi_slave *slave)
 static void mxc_spi_cs_activate(struct mxc_spi_slave *mxcs)
 {
 	if (CONFIG_IS_ENABLED(DM_SPI)) {
-		dm_gpio_set_value(&mxcs->ss, mxcs->ss_pol);
+		dm_gpio_set_value(&mxcs->ss, 1);
 	} else {
 		if (mxcs->gpio > 0)
 			gpio_set_value(mxcs->gpio, mxcs->ss_pol);
@@ -70,7 +70,7 @@ static void mxc_spi_cs_activate(struct mxc_spi_slave *mxcs)
 static void mxc_spi_cs_deactivate(struct mxc_spi_slave *mxcs)
 {
 	if (CONFIG_IS_ENABLED(DM_SPI)) {
-		dm_gpio_set_value(&mxcs->ss, !(mxcs->ss_pol));
+		dm_gpio_set_value(&mxcs->ss, 0);
 	} else {
 		if (mxcs->gpio > 0)
 			gpio_set_value(mxcs->gpio, !(mxcs->ss_pol));
@@ -508,7 +508,7 @@ static int mxc_spi_probe(struct udevice *bus)
 	if (plat->base == FDT_ADDR_T_NONE)
 		return -ENODEV;
 
-	ret = dm_gpio_set_value(&plat->ss, !(mxcs->ss_pol));
+	ret = dm_gpio_set_value(&plat->ss, 0);
 	if (ret) {
 		dev_err(bus, "Setting cs error\n");
 		return ret;
-- 
2.7.4

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

* [U-Boot] [PATCH 3/3] spi: mxc_spi: Fix spi mode communication where clock is inverted
  2018-06-20 20:51 [U-Boot] [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver Michael Trimarchi
  2018-06-20 20:51 ` [U-Boot] [PATCH 2/3] spi: mxc_spi: Fix chipselect on DM_SPI driver uclass Michael Trimarchi
@ 2018-06-20 20:51 ` Michael Trimarchi
  2018-06-24 11:44   ` Peng Fan
  2018-06-20 20:52 ` [U-Boot] [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver Fabio Estevam
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Michael Trimarchi @ 2018-06-20 20:51 UTC (permalink / raw)
  To: u-boot

During spi initialization logic creates a glitch on the clock and
if this is followed by the chip select this can be interpretated
as clock. Add a delay let the glitch out of chip select

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/spi/mxc_spi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index 0dccc38..d450f16 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -387,6 +387,7 @@ static int mxc_spi_claim_bus_internal(struct mxc_spi_slave *mxcs, int cs)
 	}
 	reg_write(&regs->period, MXC_CSPIPERIOD_32KHZ);
 	reg_write(&regs->intr, 0);
+	udelay(50);
 
 	return 0;
 }
-- 
2.7.4

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

* [U-Boot] [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver
  2018-06-20 20:51 [U-Boot] [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver Michael Trimarchi
  2018-06-20 20:51 ` [U-Boot] [PATCH 2/3] spi: mxc_spi: Fix chipselect on DM_SPI driver uclass Michael Trimarchi
  2018-06-20 20:51 ` [U-Boot] [PATCH 3/3] spi: mxc_spi: Fix spi mode communication where clock is inverted Michael Trimarchi
@ 2018-06-20 20:52 ` Fabio Estevam
  2018-06-24 11:41 ` Peng Fan
  2018-06-25  8:54 ` Jagan Teki
  4 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2018-06-20 20:52 UTC (permalink / raw)
  To: u-boot

On Wed, Jun 20, 2018 at 5:51 PM, Michael Trimarchi
<michael@amarulasolutions.com> wrote:
> drivers/spi/mxc_spi.c:507: undefined reference to `dev_get_addr'
> linux-ld.bfd: BFD (GNU Binutils) 2.29.1 assertion fail elf32-arm.c:9509
>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>

Yes, this has been reported before. Thanks for fixing it:

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

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

* [U-Boot] [PATCH 2/3] spi: mxc_spi: Fix chipselect on DM_SPI driver uclass
  2018-06-20 20:51 ` [U-Boot] [PATCH 2/3] spi: mxc_spi: Fix chipselect on DM_SPI driver uclass Michael Trimarchi
@ 2018-06-24 11:40   ` Peng Fan
  2018-06-25  9:54   ` Jagan Teki
  1 sibling, 0 replies; 10+ messages in thread
From: Peng Fan @ 2018-06-24 11:40 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Michael Trimarchi [mailto:michael at amarulasolutions.com]
> Sent: 2018年6月21日 4:51
> To: Jagan Teki <jagan@openedev.com>
> Cc: Stefano Babic <sbabic@denx.de>; Peng Fan <peng.fan@nxp.com>;
> shyam.saini at amarulasolutions.com; u-boot at lists.denx.de
> Subject: [PATCH 2/3] spi: mxc_spi: Fix chipselect on DM_SPI driver uclass
> 
> CS GPIO activation low/high is determinated by the device tree so we don't
> need to take in accoung in cs_activate and cs_deactivate

Yes.

> 
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---
>  drivers/spi/mxc_spi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c index fcb214a..0dccc38
> 100644
> --- a/drivers/spi/mxc_spi.c
> +++ b/drivers/spi/mxc_spi.c
> @@ -60,7 +60,7 @@ static inline struct mxc_spi_slave
> *to_mxc_spi_slave(struct spi_slave *slave)  static void
> mxc_spi_cs_activate(struct mxc_spi_slave *mxcs)  {
>  	if (CONFIG_IS_ENABLED(DM_SPI)) {
> -		dm_gpio_set_value(&mxcs->ss, mxcs->ss_pol);
> +		dm_gpio_set_value(&mxcs->ss, 1);
>  	} else {
>  		if (mxcs->gpio > 0)
>  			gpio_set_value(mxcs->gpio, mxcs->ss_pol); @@ -70,7 +70,7 @@
> static void mxc_spi_cs_activate(struct mxc_spi_slave *mxcs)  static void
> mxc_spi_cs_deactivate(struct mxc_spi_slave *mxcs)  {
>  	if (CONFIG_IS_ENABLED(DM_SPI)) {
> -		dm_gpio_set_value(&mxcs->ss, !(mxcs->ss_pol));
> +		dm_gpio_set_value(&mxcs->ss, 0);
>  	} else {
>  		if (mxcs->gpio > 0)
>  			gpio_set_value(mxcs->gpio, !(mxcs->ss_pol)); @@ -508,7 +508,7
> @@ static int mxc_spi_probe(struct udevice *bus)
>  	if (plat->base == FDT_ADDR_T_NONE)
>  		return -ENODEV;
> 
> -	ret = dm_gpio_set_value(&plat->ss, !(mxcs->ss_pol));
> +	ret = dm_gpio_set_value(&plat->ss, 0);
>  	if (ret) {
>  		dev_err(bus, "Setting cs error\n");
>  		return ret;
> --

Reviewed-by: Peng Fan <peng.fan@nxp.com>

> 2.7.4

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

* [U-Boot] [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver
  2018-06-20 20:51 [U-Boot] [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver Michael Trimarchi
                   ` (2 preceding siblings ...)
  2018-06-20 20:52 ` [U-Boot] [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver Fabio Estevam
@ 2018-06-24 11:41 ` Peng Fan
  2018-06-25  8:54 ` Jagan Teki
  4 siblings, 0 replies; 10+ messages in thread
From: Peng Fan @ 2018-06-24 11:41 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Michael Trimarchi [mailto:michael at amarulasolutions.com]
> Sent: 2018年6月21日 4:51
> To: Jagan Teki <jagan@openedev.com>
> Cc: Stefano Babic <sbabic@denx.de>; Peng Fan <peng.fan@nxp.com>;
> shyam.saini at amarulasolutions.com; u-boot at lists.denx.de
> Subject: [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver
> 
> drivers/spi/mxc_spi.c:507: undefined reference to `dev_get_addr'
> linux-ld.bfd: BFD (GNU Binutils) 2.29.1 assertion fail elf32-arm.c:9509
> 
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---
>  drivers/spi/mxc_spi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c index b77129c..fcb214a
> 100644
> --- a/drivers/spi/mxc_spi.c
> +++ b/drivers/spi/mxc_spi.c
> @@ -504,7 +504,7 @@ static int mxc_spi_probe(struct udevice *bus)
>  		return -EINVAL;
>  	}
> 
> -	plat->base = dev_get_addr(bus);
> +	plat->base = devfdt_get_addr(bus);
>  	if (plat->base == FDT_ADDR_T_NONE)
>  		return -ENODEV;

Reviewed-by: Peng Fan <peng.fan@nxp.com>
> 
> --
> 2.7.4

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

* [U-Boot] [PATCH 3/3] spi: mxc_spi: Fix spi mode communication where clock is inverted
  2018-06-20 20:51 ` [U-Boot] [PATCH 3/3] spi: mxc_spi: Fix spi mode communication where clock is inverted Michael Trimarchi
@ 2018-06-24 11:44   ` Peng Fan
  2018-06-30 10:35     ` Michael Nazzareno Trimarchi
  0 siblings, 1 reply; 10+ messages in thread
From: Peng Fan @ 2018-06-24 11:44 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Michael Trimarchi [mailto:michael at amarulasolutions.com]
> Sent: 2018年6月21日 4:51
> To: Jagan Teki <jagan@openedev.com>
> Cc: Stefano Babic <sbabic@denx.de>; Peng Fan <peng.fan@nxp.com>;
> shyam.saini at amarulasolutions.com; u-boot at lists.denx.de
> Subject: [PATCH 3/3] spi: mxc_spi: Fix spi mode communication where clock is
> inverted
> 
> During spi initialization logic creates a glitch on the clock and if this is followed
> by the chip select this can be interpretated as clock. Add a delay let the glitch
> out of chip select

I did not see issue. What issue do you see and which platform? Adding a delay here seems hacky which
forces all SoC using this driver needs a delay.
 
> 
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---
>  drivers/spi/mxc_spi.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c index 0dccc38..d450f16
> 100644
> --- a/drivers/spi/mxc_spi.c
> +++ b/drivers/spi/mxc_spi.c
> @@ -387,6 +387,7 @@ static int mxc_spi_claim_bus_internal(struct
> mxc_spi_slave *mxcs, int cs)
>  	}
>  	reg_write(&regs->period, MXC_CSPIPERIOD_32KHZ);
>  	reg_write(&regs->intr, 0);
> +	udelay(50);
> 
>  	return 0;
>  }
> --
> 2.7.4

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

* [U-Boot] [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver
  2018-06-20 20:51 [U-Boot] [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver Michael Trimarchi
                   ` (3 preceding siblings ...)
  2018-06-24 11:41 ` Peng Fan
@ 2018-06-25  8:54 ` Jagan Teki
  4 siblings, 0 replies; 10+ messages in thread
From: Jagan Teki @ 2018-06-25  8:54 UTC (permalink / raw)
  To: u-boot

On Thu, Jun 21, 2018 at 2:21 AM, Michael Trimarchi
<michael@amarulasolutions.com> wrote:
> drivers/spi/mxc_spi.c:507: undefined reference to `dev_get_addr'
> linux-ld.bfd: BFD (GNU Binutils) 2.29.1 assertion fail elf32-arm.c:9509
>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---

Applied to u-boot-spi/master

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

* [U-Boot] [PATCH 2/3] spi: mxc_spi: Fix chipselect on DM_SPI driver uclass
  2018-06-20 20:51 ` [U-Boot] [PATCH 2/3] spi: mxc_spi: Fix chipselect on DM_SPI driver uclass Michael Trimarchi
  2018-06-24 11:40   ` Peng Fan
@ 2018-06-25  9:54   ` Jagan Teki
  1 sibling, 0 replies; 10+ messages in thread
From: Jagan Teki @ 2018-06-25  9:54 UTC (permalink / raw)
  To: u-boot

On Thu, Jun 21, 2018 at 2:21 AM, Michael Trimarchi
<michael@amarulasolutions.com> wrote:
> CS GPIO activation low/high is determinated by the device tree
> so we don't need to take in accoung in cs_activate and cs_deactivate
>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---

Applied to u-boot-spi/master

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

* [U-Boot] [PATCH 3/3] spi: mxc_spi: Fix spi mode communication where clock is inverted
  2018-06-24 11:44   ` Peng Fan
@ 2018-06-30 10:35     ` Michael Nazzareno Trimarchi
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Nazzareno Trimarchi @ 2018-06-30 10:35 UTC (permalink / raw)
  To: u-boot

Hi Peng

On Sun, Jun 24, 2018 at 1:44 PM, Peng Fan <peng.fan@nxp.com> wrote:
>
>
>> -----Original Message-----
>> From: Michael Trimarchi [mailto:michael at amarulasolutions.com]
>> Sent: 2018年6月21日 4:51
>> To: Jagan Teki <jagan@openedev.com>
>> Cc: Stefano Babic <sbabic@denx.de>; Peng Fan <peng.fan@nxp.com>;
>> shyam.saini at amarulasolutions.com; u-boot at lists.denx.de
>> Subject: [PATCH 3/3] spi: mxc_spi: Fix spi mode communication where clock is
>> inverted
>>
>> During spi initialization logic creates a glitch on the clock and if this is followed
>> by the chip select this can be interpretated as clock. Add a delay let the glitch
>> out of chip select
>
> I did not see issue. What issue do you see and which platform? Adding a delay here seems hacky which
> forces all SoC using this driver needs a delay.
>

You can test it with

sspi 1:0.3 24 700003

-------------\  /------------
               |  |
               |  |
               ---

The glitch look like a clock size and if it happen next to the cs you
inject one clock more

Michael


>>
>> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
>> ---
>>  drivers/spi/mxc_spi.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c index 0dccc38..d450f16
>> 100644
>> --- a/drivers/spi/mxc_spi.c
>> +++ b/drivers/spi/mxc_spi.c
>> @@ -387,6 +387,7 @@ static int mxc_spi_claim_bus_internal(struct
>> mxc_spi_slave *mxcs, int cs)
>>       }
>>       reg_write(&regs->period, MXC_CSPIPERIOD_32KHZ);
>>       reg_write(&regs->intr, 0);
>> +     udelay(50);
>>
>>       return 0;
>>  }
>> --
>> 2.7.4
>



-- 
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |

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

end of thread, other threads:[~2018-06-30 10:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-20 20:51 [U-Boot] [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver Michael Trimarchi
2018-06-20 20:51 ` [U-Boot] [PATCH 2/3] spi: mxc_spi: Fix chipselect on DM_SPI driver uclass Michael Trimarchi
2018-06-24 11:40   ` Peng Fan
2018-06-25  9:54   ` Jagan Teki
2018-06-20 20:51 ` [U-Boot] [PATCH 3/3] spi: mxc_spi: Fix spi mode communication where clock is inverted Michael Trimarchi
2018-06-24 11:44   ` Peng Fan
2018-06-30 10:35     ` Michael Nazzareno Trimarchi
2018-06-20 20:52 ` [U-Boot] [PATCH 1/3] spi: mxc: Fix compilation problem of DM_SPI class driver Fabio Estevam
2018-06-24 11:41 ` Peng Fan
2018-06-25  8:54 ` Jagan Teki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox