-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(imx8mn): bug fixes for usdhc impl
- Loading branch information
1 parent
e461fe1
commit 79d8f13
Showing
16 changed files
with
3,009 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
pub mod ccm; | ||
mod ccm; | ||
pub mod uartclks; | ||
pub mod usdhcclks; | ||
pub mod scntrclk; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//! Enable or Disable system counter | ||
|
||
use super::ccm::*; | ||
|
||
/// Allow system counter i.e. ungate clock gate for SCTR. | ||
pub fn enable_sctr() { | ||
clock_enable(CCGRIdx::CcgrSctr, true) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//! The `i.MX8MN` has 4 UARTs in total. Although, a UART interface does not use a clock signal i.e. | ||
//! it is an asynchronous protocol, the i.MX8MN requires the corresponding clock for a UART to be enabled | ||
//! before you can start using the peripheral. | ||
|
||
use super::ccm::*; | ||
use crate::info; | ||
|
||
/// Enable UART clocks. | ||
pub fn enable_uart_clk(index: u32) { | ||
/* | ||
* set uart clock root | ||
* 24M OSC | ||
*/ | ||
match index { | ||
0 => { | ||
clock_enable(CCGRIdx::CcgrUart1, false); | ||
clock_set_target_val( | ||
ClkRootIdx::Uart1ClkRoot, | ||
CLK_ROOT_ON | clk_root_source_sel(0), | ||
); | ||
clock_enable(CCGRIdx::CcgrUart1, true); | ||
} | ||
1 => { | ||
clock_enable(CCGRIdx::CcgrUart2, false); | ||
clock_set_target_val( | ||
ClkRootIdx::Uart2ClkRoot, | ||
CLK_ROOT_ON | clk_root_source_sel(0), | ||
); | ||
clock_enable(CCGRIdx::CcgrUart2, true); | ||
} | ||
2 => { | ||
clock_enable(CCGRIdx::CcgrUart3, false); | ||
clock_set_target_val( | ||
ClkRootIdx::Uart3ClkRoot, | ||
CLK_ROOT_ON | clk_root_source_sel(0), | ||
); | ||
clock_enable(CCGRIdx::CcgrUart3, true); | ||
} | ||
3 => { | ||
clock_enable(CCGRIdx::CcgrUart4, false); | ||
clock_set_target_val( | ||
ClkRootIdx::Uart4ClkRoot, | ||
CLK_ROOT_ON | clk_root_source_sel(0), | ||
); | ||
clock_enable(CCGRIdx::CcgrUart4, true); | ||
} | ||
_ => { | ||
info!("invalid uart selection \n"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//! The i.MX8 has 3 uSDHC(s). We use a default 400mhz source clock. | ||
|
||
use super::ccm::*; | ||
use crate::info; | ||
|
||
/// Enable uSDHC clocks. | ||
pub fn enable_usdhc_clk(index: u32) { | ||
match index { | ||
1 => { | ||
clock_enable(CCGRIdx::CcgrUsdhc1, false); | ||
clock_set_target_val( | ||
ClkRootIdx::Usdhc1ClkRoot, | ||
CLK_ROOT_ON | clk_root_source_sel(1), | ||
); | ||
clock_enable(CCGRIdx::CcgrUsdhc1, true); | ||
} | ||
2 => { | ||
clock_enable(CCGRIdx::CcgrUsdhc2, false); | ||
clock_set_target_val( | ||
ClkRootIdx::Usdhc2ClkRoot, | ||
CLK_ROOT_ON | clk_root_source_sel(0), | ||
); | ||
clock_enable(CCGRIdx::CcgrUsdhc2, true); | ||
} | ||
3 => { | ||
clock_enable(CCGRIdx::CcgrUsdhc3, false); | ||
clock_set_target_val( | ||
ClkRootIdx::Usdhc3ClkRoot, | ||
CLK_ROOT_ON | clk_root_source_sel(1), | ||
); | ||
clock_enable(CCGRIdx::CcgrUsdhc3, true); | ||
} | ||
_ => { | ||
info!("invalid uSDHC selection \n"); | ||
} | ||
} | ||
} |
Oops, something went wrong.