mx5: Align SPI CS naming with i.MX53 reference manual
Subsystems (3)
Fabio Estevam
reviewerPATCH 1/4 mx5: Align SPI CS naming with i.MX53 reference manual
From: Fabio Estevam <[email protected]>
Align SPI chip select naming with i.MX53 reference manual.
--- arch/arm/include/asm/arch-mx5/mx5x_pins.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/include/asm/arch-mx5/mx5x_pins.h +3 -3
@@ -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,
Signature · 1 line
1.7.9.5
Fabio Estevam
reviewerPATCH 2/4 mx5: Print CSPI clock in 'clock' command
From: Fabio Estevam <[email protected]>
Print CSPI clock in 'clock' command.
--- arch/arm/cpu/armv7/mx5/clock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/mx5/clock.c +3 -1
@@ -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 ; }
Signature · 1 line
1.7.9.5
PATCH 2/4 mx5: Print CSPI clock in 'clock' command
Am 15.11.2012 22:23, schrieb Fabio Estevam:
Quoted 14 lines
From: Fabio Estevam <[email protected]>
Print CSPI clock in 'clock' command.
Signed-off-by Fabio Estevam <[email protected]>--- arch/arm/cpu/armv7/mx5/clock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)arch/arm/cpu/armv7/mx5/clock.c +0
-0
arch/arm/cpu/armv7/mx5/clock.c int do_mx5_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 933
Quoted 7 lines
arch/arm/cpu/armv7/mx5/clock.c +3
-1@@ -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.
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
Fabio Estevam
reviewerPATCH 2/4 mx5: Print CSPI clock in 'clock' command
Hi Dirk,
Quoted 7 lines · Dirk Behme
I wondered if we want something similar for i.MX6, too. And found that we have this on i.MX6, already. But without #ifdef.
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
PATCH 2/4 mx5: Print CSPI clock in 'clock' command
Quoted 7 lines · Fabio Estevam
Hi Dirk,
Quoted 3 lines · Dirk Behme
I wondered if we want something similar for i.MX6, too. And found that we have this on i.MX6, already. But without #ifdef.
Quoted 9 lines
Quoted 4 lines
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
Signature · 5 lines
===================================================================== 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 =====================================================================
Fabio Estevam
reviewerPATCH 3/4 spi: mxc_spi: Fix handling of chip select
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
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.
--- drivers/spi/mxc_spi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/spi/mxc_spi.c +3 -2
@@ -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) {
Signature · 1 line
1.7.9.5
Fabio Estevam
reviewerPATCH 4/4 spi: mxc_spi: Fix spi clock glitch durant reset
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
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.
--- drivers/spi/mxc_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/mxc_spi.c +2 -2
@@ -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.
Signature · 1 line
1.7.9.5
PATCH 4/4 spi: mxc_spi: Fix spi clock glitch durant reset
Quoted 18 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
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_ENbit, so that the clock line becomes always stable.Signed-off-by Fabio Estevam <[email protected]>--- drivers/spi/mxc_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/spi/mxc_spi.c +0
-0
drivers/spi/mxc_spi.c static s32 spi_cfg_mxc(struct mxc_spi_slave *mxcs, unsigned int cs, · line 145
Quoted 8 lines
drivers/spi/mxc_spi.c +2
-2@@ -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.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== 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 =====================================================================
PATCH 1/4 mx5: Align SPI CS naming with i.MX53 reference manual
In reply to Fabio EstevamQuoted 6 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Align SPI chip select naming with i.MX53 reference manual.
Signed-off-by Fabio Estevam <[email protected]>---
Applied (whole series) to u-boot-imx, thanks.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== 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 =====================================================================