* [U-Boot] [PATCH 1/4] mx5: Align SPI CS naming with i.MX53 reference manual
@ 2012-11-15 21:23 Fabio Estevam
2012-11-15 21:23 ` [U-Boot] [PATCH 2/4] mx5: Print CSPI clock in 'clock' command Fabio Estevam
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Fabio Estevam @ 2012-11-15 21:23 UTC (permalink / raw)
To: u-boot
From: Fabio Estevam <fabio.estevam@freescale.com>
Align SPI chip select naming with i.MX53 reference manual.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
arch/arm/include/asm/arch-mx5/mx5x_pins.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/include/asm/arch-mx5/mx5x_pins.h b/arch/arm/include/asm/arch-mx5/mx5x_pins.h
index 122fbee..3457f6a 100644
--- a/arch/arm/include/asm/arch-mx5/mx5x_pins.h
+++ b/arch/arm/include/asm/arch-mx5/mx5x_pins.h
@@ -802,22 +802,22 @@ typedef enum iomux_input_select {
MX53_CSPI_IPP_CSPI_CLK_IN_SELECT_INPUT,
MX53_CSPI_IPP_IND_MISO_SELECT_INPUT,
MX53_CSPI_IPP_IND_MOSI_SELECT_INPUT,
+ MX53_CSPI_IPP_IND_SS_B_0_SELECT_INPUT,
MX53_CSPI_IPP_IND_SS_B_1_SELECT_INPUT,
MX53_CSPI_IPP_IND_SS_B_2_SELECT_INPUT,
MX53_CSPI_IPP_IND_SS_B_3_SELECT_INPUT,
- MX53_CSPI_IPP_IND_SS_B_4_SELECT_INPUT,
MX53_ECSPI1_IPP_CSPI_CLK_IN_SELECT_INPUT,
MX53_ECSPI1_IPP_IND_MISO_SELECT_INPUT,
MX53_ECSPI1_IPP_IND_MOSI_SELECT_INPUT,
+ MX53_ECSPI1_IPP_IND_SS_B_0_SELECT_INPUT,
MX53_ECSPI1_IPP_IND_SS_B_1_SELECT_INPUT,
MX53_ECSPI1_IPP_IND_SS_B_2_SELECT_INPUT,
MX53_ECSPI1_IPP_IND_SS_B_3_SELECT_INPUT,
- MX53_ECSPI1_IPP_IND_SS_B_4_SELECT_INPUT,
MX53_ECSPI2_IPP_CSPI_CLK_IN_SELECT_INPUT,
MX53_ECSPI2_IPP_IND_MISO_SELECT_INPUT,
MX53_ECSPI2_IPP_IND_MOSI_SELECT_INPUT,
+ MX53_ECSPI2_IPP_IND_SS_B_0_SELECT_INPUT,
MX53_ECSPI2_IPP_IND_SS_B_1_SELECT_INPUT,
- MX53_ECSPI2_IPP_IND_SS_B_2_SELECT_INPUT,
MX53_ESAI1_IPP_IND_FSR_SELECT_INPUT,
MX53_ESAI1_IPP_IND_FST_SELECT_INPUT,
MX53_ESAI1_IPP_IND_HCKR_SELECT_INPUT,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 2/4] mx5: Print CSPI clock in 'clock' command
2012-11-15 21:23 [U-Boot] [PATCH 1/4] mx5: Align SPI CS naming with i.MX53 reference manual Fabio Estevam
@ 2012-11-15 21:23 ` Fabio Estevam
2012-11-16 6:35 ` Dirk Behme
2012-11-15 21:23 ` [U-Boot] [PATCH 3/4] spi: mxc_spi: Fix handling of chip select Fabio Estevam
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Fabio Estevam @ 2012-11-15 21:23 UTC (permalink / raw)
To: u-boot
From: Fabio Estevam <fabio.estevam@freescale.com>
Print CSPI clock in 'clock' command.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
arch/arm/cpu/armv7/mx5/clock.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
index 1c9223f..76c2c52 100644
--- a/arch/arm/cpu/armv7/mx5/clock.c
+++ b/arch/arm/cpu/armv7/mx5/clock.c
@@ -928,7 +928,9 @@ int do_mx5_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf("IPG %8d kHz\n", mxc_get_clock(MXC_IPG_CLK) / 1000);
printf("IPG PERCLK %8d kHz\n", mxc_get_clock(MXC_IPG_PERCLK) / 1000);
printf("DDR %8d kHz\n", mxc_get_clock(MXC_DDR_CLK) / 1000);
-
+#ifdef CONFIG_MXC_SPI
+ printf("CSPI %8d kHz\n", mxc_get_clock(MXC_CSPI_CLK) / 1000);
+#endif
return 0;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 3/4] spi: mxc_spi: Fix handling of chip select
2012-11-15 21:23 [U-Boot] [PATCH 1/4] mx5: Align SPI CS naming with i.MX53 reference manual Fabio Estevam
2012-11-15 21:23 ` [U-Boot] [PATCH 2/4] mx5: Print CSPI clock in 'clock' command Fabio Estevam
@ 2012-11-15 21:23 ` Fabio Estevam
2012-11-15 21:23 ` [U-Boot] [PATCH 4/4] spi: mxc_spi: Fix spi clock glitch durant reset Fabio Estevam
2012-11-19 7:51 ` [U-Boot] [PATCH 1/4] mx5: Align SPI CS naming with i.MX53 reference manual Stefano Babic
3 siblings, 0 replies; 9+ messages in thread
From: Fabio Estevam @ 2012-11-15 21:23 UTC (permalink / raw)
To: u-boot
From: Fabio Estevam <fabio.estevam@freescale.com>
In decode_cs() function the polarity of the chip select must be taken into
account.
Also, for the case of low active chip select, the CS was activated too early.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/spi/mxc_spi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index 13bebe8..4bed4f0 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -387,7 +387,7 @@ static int decode_cs(struct mxc_spi_slave *mxcs, unsigned int cs)
if (cs > 3) {
mxcs->gpio = cs >> 8;
cs &= 3;
- ret = gpio_direction_output(mxcs->gpio, 0);
+ ret = gpio_direction_output(mxcs->gpio, !(mxcs->ss_pol));
if (ret) {
printf("mxc_spi: cannot setup gpio %d\n", mxcs->gpio);
return -EINVAL;
@@ -414,6 +414,8 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
return NULL;
}
+ mxcs->ss_pol = (mode & SPI_CS_HIGH) ? 1 : 0;
+
ret = decode_cs(mxcs, cs);
if (ret < 0) {
free(mxcs);
@@ -425,7 +427,6 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
mxcs->slave.bus = bus;
mxcs->slave.cs = cs;
mxcs->base = spi_bases[bus];
- mxcs->ss_pol = (mode & SPI_CS_HIGH) ? 1 : 0;
ret = spi_cfg_mxc(mxcs, cs, max_hz, mode);
if (ret) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 4/4] spi: mxc_spi: Fix spi clock glitch durant reset
2012-11-15 21:23 [U-Boot] [PATCH 1/4] mx5: Align SPI CS naming with i.MX53 reference manual Fabio Estevam
2012-11-15 21:23 ` [U-Boot] [PATCH 2/4] mx5: Print CSPI clock in 'clock' command Fabio Estevam
2012-11-15 21:23 ` [U-Boot] [PATCH 3/4] spi: mxc_spi: Fix handling of chip select Fabio Estevam
@ 2012-11-15 21:23 ` Fabio Estevam
2012-11-16 13:17 ` Stefano Babic
2012-11-19 7:51 ` [U-Boot] [PATCH 1/4] mx5: Align SPI CS naming with i.MX53 reference manual Stefano Babic
3 siblings, 1 reply; 9+ messages in thread
From: Fabio Estevam @ 2012-11-15 21:23 UTC (permalink / raw)
To: u-boot
From: Fabio Estevam <fabio.estevam@freescale.com>
Measuring the spi clock line on a scope shows a 'glitch' during the reset of the
spi.
Fix this by toggling only the MXC_CSPICTRL_EN bit, so that the clock line becomes
always stable.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/spi/mxc_spi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index 4bed4f0..102fca5 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -140,8 +140,8 @@ static s32 spi_cfg_mxc(struct mxc_spi_slave *mxcs, unsigned int cs,
reg_ctrl = reg_read(®s->ctrl);
/* Reset spi */
- reg_write(®s->ctrl, 0);
- reg_write(®s->ctrl, (reg_ctrl | 0x1));
+ reg_write(®s->ctrl, (reg_ctrl & ~MXC_CSPICTRL_EN));
+ reg_write(®s->ctrl, (reg_ctrl | MXC_CSPICTRL_EN));
/*
* The following computation is taken directly from Freescale's code.
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 2/4] mx5: Print CSPI clock in 'clock' command
2012-11-15 21:23 ` [U-Boot] [PATCH 2/4] mx5: Print CSPI clock in 'clock' command Fabio Estevam
@ 2012-11-16 6:35 ` Dirk Behme
2012-11-16 11:15 ` Fabio Estevam
0 siblings, 1 reply; 9+ messages in thread
From: Dirk Behme @ 2012-11-16 6:35 UTC (permalink / raw)
To: u-boot
Am 15.11.2012 22:23, schrieb Fabio Estevam:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Print CSPI clock in 'clock' command.
>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
> arch/arm/cpu/armv7/mx5/clock.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
> index 1c9223f..76c2c52 100644
> --- a/arch/arm/cpu/armv7/mx5/clock.c
> +++ b/arch/arm/cpu/armv7/mx5/clock.c
> @@ -928,7 +928,9 @@ int do_mx5_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> printf("IPG %8d kHz\n", mxc_get_clock(MXC_IPG_CLK) / 1000);
> printf("IPG PERCLK %8d kHz\n", mxc_get_clock(MXC_IPG_PERCLK) / 1000);
> printf("DDR %8d kHz\n", mxc_get_clock(MXC_DDR_CLK) / 1000);
> -
> +#ifdef CONFIG_MXC_SPI
> + printf("CSPI %8d kHz\n", mxc_get_clock(MXC_CSPI_CLK) / 1000);
> +#endif
I wondered if we want something similar for i.MX6, too. And found that
we have this on i.MX6, already. But without #ifdef.
http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=arch/arm/cpu/armv7/mx6/clock.c;h=a01d96f48e04377d705b7a587ec7b3ea59aee283;hb=HEAD#l407
Do we want to add the #ifdef for i.MX6, too? Or would it be nicer to
drop the #ifdef in this patch to make i.MX6 and i.MX5 equal?
Best regards
Dirk
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 2/4] mx5: Print CSPI clock in 'clock' command
2012-11-16 6:35 ` Dirk Behme
@ 2012-11-16 11:15 ` Fabio Estevam
2012-11-16 13:18 ` Stefano Babic
0 siblings, 1 reply; 9+ messages in thread
From: Fabio Estevam @ 2012-11-16 11:15 UTC (permalink / raw)
To: u-boot
Hi Dirk,
On Fri, Nov 16, 2012 at 4:35 AM, Dirk Behme <dirk.behme@gmail.com> wrote:
> I wondered if we want something similar for i.MX6, too. And found that we
> have this on i.MX6, already. But without #ifdef.
>
> http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=arch/arm/cpu/armv7/mx6/clock.c;h=a01d96f48e04377d705b7a587ec7b3ea59aee283;hb=HEAD#l407
>
> Do we want to add the #ifdef for i.MX6, too? Or would it be nicer to drop
> the #ifdef in this patch to make i.MX6 and i.MX5 equal?
The reason I added the ifdef was to avoid showing the cspi clock on a
board that does not use cspi. This would help
not 'polluting' the clock command output.
Regards,
Fabio Estevam
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 4/4] spi: mxc_spi: Fix spi clock glitch durant reset
2012-11-15 21:23 ` [U-Boot] [PATCH 4/4] spi: mxc_spi: Fix spi clock glitch durant reset Fabio Estevam
@ 2012-11-16 13:17 ` Stefano Babic
0 siblings, 0 replies; 9+ messages in thread
From: Stefano Babic @ 2012-11-16 13:17 UTC (permalink / raw)
To: u-boot
On 15/11/2012 22:23, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Measuring the spi clock line on a scope shows a 'glitch' during the reset of the
> spi.
>
> Fix this by toggling only the MXC_CSPICTRL_EN bit, so that the clock line becomes
> always stable.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> drivers/spi/mxc_spi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
> index 4bed4f0..102fca5 100644
> --- a/drivers/spi/mxc_spi.c
> +++ b/drivers/spi/mxc_spi.c
> @@ -140,8 +140,8 @@ static s32 spi_cfg_mxc(struct mxc_spi_slave *mxcs, unsigned int cs,
> reg_ctrl = reg_read(®s->ctrl);
>
> /* Reset spi */
> - reg_write(®s->ctrl, 0);
> - reg_write(®s->ctrl, (reg_ctrl | 0x1));
> + reg_write(®s->ctrl, (reg_ctrl & ~MXC_CSPICTRL_EN));
> + reg_write(®s->ctrl, (reg_ctrl | MXC_CSPICTRL_EN));
>
Right - the enabled was set after clearing the register, but before
setting it.
Acked-by: Stefano Babic <sbabic@denx.de>
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 2/4] mx5: Print CSPI clock in 'clock' command
2012-11-16 11:15 ` Fabio Estevam
@ 2012-11-16 13:18 ` Stefano Babic
0 siblings, 0 replies; 9+ messages in thread
From: Stefano Babic @ 2012-11-16 13:18 UTC (permalink / raw)
To: u-boot
On 16/11/2012 12:15, Fabio Estevam wrote:
> Hi Dirk,
>
> On Fri, Nov 16, 2012 at 4:35 AM, Dirk Behme <dirk.behme@gmail.com> wrote:
>
>> I wondered if we want something similar for i.MX6, too. And found that we
>> have this on i.MX6, already. But without #ifdef.
>>
>> http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=arch/arm/cpu/armv7/mx6/clock.c;h=a01d96f48e04377d705b7a587ec7b3ea59aee283;hb=HEAD#l407
>>
>> Do we want to add the #ifdef for i.MX6, too? Or would it be nicer to drop
>> the #ifdef in this patch to make i.MX6 and i.MX5 equal?
>
> The reason I added the ifdef was to avoid showing the cspi clock on a
> board that does not use cspi. This would help
> not 'polluting' the clock command output.
>
Agree. Boards that do not support SPI can have a completely wrong value,.
Regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 1/4] mx5: Align SPI CS naming with i.MX53 reference manual
2012-11-15 21:23 [U-Boot] [PATCH 1/4] mx5: Align SPI CS naming with i.MX53 reference manual Fabio Estevam
` (2 preceding siblings ...)
2012-11-15 21:23 ` [U-Boot] [PATCH 4/4] spi: mxc_spi: Fix spi clock glitch durant reset Fabio Estevam
@ 2012-11-19 7:51 ` Stefano Babic
3 siblings, 0 replies; 9+ messages in thread
From: Stefano Babic @ 2012-11-19 7:51 UTC (permalink / raw)
To: u-boot
On 15/11/2012 22:23, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Align SPI chip select naming with i.MX53 reference manual.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
Applied (whole series) to u-boot-imx, thanks.
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-11-19 7:51 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-15 21:23 [U-Boot] [PATCH 1/4] mx5: Align SPI CS naming with i.MX53 reference manual Fabio Estevam
2012-11-15 21:23 ` [U-Boot] [PATCH 2/4] mx5: Print CSPI clock in 'clock' command Fabio Estevam
2012-11-16 6:35 ` Dirk Behme
2012-11-16 11:15 ` Fabio Estevam
2012-11-16 13:18 ` Stefano Babic
2012-11-15 21:23 ` [U-Boot] [PATCH 3/4] spi: mxc_spi: Fix handling of chip select Fabio Estevam
2012-11-15 21:23 ` [U-Boot] [PATCH 4/4] spi: mxc_spi: Fix spi clock glitch durant reset Fabio Estevam
2012-11-16 13:17 ` Stefano Babic
2012-11-19 7:51 ` [U-Boot] [PATCH 1/4] mx5: Align SPI CS naming with i.MX53 reference manual Stefano Babic
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.