equal
deleted
inserted
replaced
42 |
42 |
43 const TPinConfig &csConf = ModulePinConfig[aModule + aPinSetId].iCs[aChannel]; |
43 const TPinConfig &csConf = ModulePinConfig[aModule + aPinSetId].iCs[aChannel]; |
44 __ASSERT_DEBUG(csConf.iAddress, Kern::Fault("omap3530_spi.inl, line: ", __LINE__)); // don't try to use non-existing CS! |
44 __ASSERT_DEBUG(csConf.iAddress, Kern::Fault("omap3530_spi.inl, line: ", __LINE__)); // don't try to use non-existing CS! |
45 |
45 |
46 // now switch the pin mode back to the SPI |
46 // now switch the pin mode back to the SPI |
47 SCM::SetPadConfig(csConf.iAddress, csConf.iMswLsw, csConf.iFlags | SCM::EInputEnable); // revert to intended mode |
47 SCM::SetPadConfig(csConf.iAddress, csConf.iMswLsw, csConf.iFlags); |
48 } |
48 } |
49 |
49 |
50 |
50 |
51 // Setup pad function for SPI pins.. |
51 // Setup pad function for SPI pins.. |
52 inline void SetupSpiPins(TUint aModule, TUint aPinSetId = 0) |
52 inline void SetupSpiPins(TUint aModule, TUint aPinSetId = 0) |
73 { |
73 { |
74 break; // no more channels (cs signals) |
74 break; // no more channels (cs signals) |
75 } |
75 } |
76 } |
76 } |
77 } |
77 } |
|
78 |
|
79 // McSPI3 can have 3 different pin configuration, but only one can be active at the time. |
|
80 // for that reason, before switching to different mode -at least SOMI has to be deactivated |
|
81 // otherwise the newly activated pin does not work (why??). Changing these pins to the GPIO (mode 4) |
|
82 inline void DeactivateSpiPins(TUint aModule, TUint aPinSetId = 0) |
|
83 { |
|
84 __ASSERT_DEBUG(aModule < KMaxSpiChannelsPerModule, Kern::Fault("omap3530_spi.inl, line: ", __LINE__)); // aChannel > module channels |
|
85 __ASSERT_DEBUG(aModule != 2 ? !aPinSetId : ETrue, Kern::Fault("omap3530_spi.inl, line: ", __LINE__)); // only channel 3 supports other pin configurations |
|
86 |
|
87 const TSpiPinConfig& pinCnf = ModulePinConfig[aModule + aPinSetId]; |
|
88 |
|
89 SCM::SetPadConfig(pinCnf.iClk.iAddress, pinCnf.iClk.iMswLsw, SCM::EMode4 | SCM::EInputEnable); |
|
90 SCM::SetPadConfig(pinCnf.iSimo.iAddress, pinCnf.iSimo.iMswLsw, SCM::EMode4 | SCM::EInputEnable); |
|
91 SCM::SetPadConfig(pinCnf.iSomi.iAddress, pinCnf.iSomi.iMswLsw, SCM::EMode4 | SCM::EInputEnable); |
|
92 } |
|
93 |
78 |
94 |
79 // helper function - returns appropriate value for the register for a given mode |
95 // helper function - returns appropriate value for the register for a given mode |
80 inline TUint32 SpiClkMode(TSpiClkMode aClkMode) |
96 inline TUint32 SpiClkMode(TSpiClkMode aClkMode) |
81 { |
97 { |
82 // (POL) (PHA) |
98 // (POL) (PHA) |