Skip to content

Commit

Permalink
d1: add D1 SMHC pins on Function 2 of PF0 to PF5
Browse files Browse the repository at this point in the history
Signed-off-by: Zhouqi Jiang <[email protected]>
  • Loading branch information
luojia65 committed Oct 8, 2024
1 parent 5a4b5d3 commit e9a6877
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml → .github/workflows/Cargo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI
name: Cargo

on: [push,pull_request]
on: [push, pull_request]

env:
CARGO_TERM_COLOR: always
Expand Down
11 changes: 11 additions & 0 deletions src/smhc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,17 @@ impl DriveDelayControl {
}
}

/// Clock signal pad.
pub trait Clk {}

/// Command signal pad.
pub trait Cmd {}

/// Data input and output pad.
///
/// This is documented in the User Manual as `D[3:0]`.
pub trait Data<const I: usize> {}

#[cfg(test)]
mod tests {
use super::{
Expand Down
31 changes: 21 additions & 10 deletions src/wafer/d1.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! SoC configuration on D1-like chips.
use crate::{
spi::{Clk, Miso, Mosi},
smhc, spi,
uart::{Receive, Transmit},
};
use core::num::NonZeroU32;
Expand Down Expand Up @@ -155,15 +155,26 @@ impl_pins_trait! {

// SPI PINS
impl_pins_trait! {
('B', 9, 5): Miso<1>;
('B', 10, 5): Mosi<1>;
('B', 11, 5): Clk<1>;
('C', 2, 2): Clk<0>;
('C', 4, 2): Mosi<0>;
('C', 5, 2): Miso<0>;
('D', 11, 4): Clk<1>;
('D', 12, 4): Mosi<1>;
('D', 13, 4): Miso<1>;
('B', 9, 5): spi::Miso<1>;
('B', 10, 5): spi::Mosi<1>;
('B', 11, 5): spi::Clk<1>;
('C', 2, 2): spi::Clk<0>;
('C', 4, 2): spi::Mosi<0>;
('C', 5, 2): spi::Miso<0>;
('D', 11, 4): spi::Clk<1>;
('D', 12, 4): spi::Mosi<1>;
('D', 13, 4): spi::Miso<1>;
}

// SMHC pins
impl_pins_trait! {
('F', 0, 2): smhc::Data<1>;
('F', 1, 2): smhc::Data<0>;
('F', 2, 2): smhc::Clk;
('F', 3, 2): smhc::Cmd;
('F', 4, 2): smhc::Data<3>;
('F', 5, 2): smhc::Data<2>;
// TODO other SDC{0,1,2} pins. Please refer to Section 9.7.3.2 'GPIO Multiplex Function'.
}

/// Allwinner D1 interrupts.
Expand Down

0 comments on commit e9a6877

Please sign in to comment.