Commit c0eaffa03959a97e6c139ea023e4041170e105e6
Committed by
Jagan Teki
1 parent
51dce7d2bf
spi: omap3: fix claim/release bus within DM
The claim/release bus function must not reset the whole SPI core because settings regarding wordlen, clock-frequency and so on made by set_wordlen, set_mode, set_speed get lost with this action. Resulting in a non-functional SPI. Without DM the failure didn't came up since after the spi_reset within claim bus all the setup (wordlen, mode, ...) was called, in DM they are called by the spi uclass. We change now the things as following for having a working SPI instance in DM: - move the spi_reset(...) to the probe call in DM for having a known hardware state after probe. Without DM we don't have a probe call, so we issue the reset as before during the claim_bus call. - in release bus we just reset the modulctrl to the reset-value (spi- slave) Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at> Reviewed-by: Jagan Teki <jagan@openedev.com>
Showing 1 changed file with 7 additions and 7 deletions Side-by-side Diff
drivers/spi/omap3_spi.c
... | ... | @@ -443,9 +443,6 @@ |
443 | 443 | static void _omap3_spi_claim_bus(struct omap3_spi_priv *priv) |
444 | 444 | { |
445 | 445 | unsigned int conf; |
446 | - | |
447 | - spi_reset(priv->regs); | |
448 | - | |
449 | 446 | /* |
450 | 447 | * setup when switching from (reset default) slave mode |
451 | 448 | * to single-channel master mode |
... | ... | @@ -480,6 +477,8 @@ |
480 | 477 | { |
481 | 478 | struct omap3_spi_priv *priv = to_omap3_spi(slave); |
482 | 479 | |
480 | + spi_reset(priv->regs); | |
481 | + | |
483 | 482 | _omap3_spi_claim_bus(priv); |
484 | 483 | _omap3_spi_set_wordlen(priv); |
485 | 484 | _omap3_spi_set_mode(priv); |
... | ... | @@ -492,8 +491,7 @@ |
492 | 491 | { |
493 | 492 | struct omap3_spi_priv *priv = to_omap3_spi(slave); |
494 | 493 | |
495 | - /* Reset the SPI hardware */ | |
496 | - spi_reset(priv->regs); | |
494 | + writel(OMAP3_MCSPI_MODULCTRL_MS, &priv->regs->modulctrl); | |
497 | 495 | } |
498 | 496 | |
499 | 497 | struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, |
... | ... | @@ -602,8 +600,7 @@ |
602 | 600 | struct udevice *bus = dev->parent; |
603 | 601 | struct omap3_spi_priv *priv = dev_get_priv(bus); |
604 | 602 | |
605 | - /* Reset the SPI hardware */ | |
606 | - spi_reset(priv->regs); | |
603 | + writel(OMAP3_MCSPI_MODULCTRL_MS, &priv->regs->modulctrl); | |
607 | 604 | |
608 | 605 | return 0; |
609 | 606 | } |
... | ... | @@ -636,6 +633,9 @@ |
636 | 633 | else |
637 | 634 | priv->pin_dir = MCSPI_PINDIR_D0_IN_D1_OUT; |
638 | 635 | priv->wordlen = SPI_DEFAULT_WORDLEN; |
636 | + | |
637 | + spi_reset(priv->regs); | |
638 | + | |
639 | 639 | return 0; |
640 | 640 | } |
641 | 641 |