@@ -687,7 +687,7 @@ unsafe fn sunxi_mmc_reset_host(host: SMHC0) -> Result<(), &'static str> {
687
687
}
688
688
689
689
unsafe fn sunxi_mmc_init_host ( host : SMHC0 ) {
690
- print ! ( "=========== init smhc ..." ) ;
690
+ print ! ( "reset smhc ..." ) ;
691
691
/*
692
692
if let Err(msg) = sunxi_mmc_reset_host(host) {
693
693
println!("failed to reset smhc host: {}", msg);
@@ -732,29 +732,58 @@ unsafe fn sunxi_mmc_init_host(host: SMHC0) {
732
732
/* Unmask SDIO interrupt if needed */
733
733
//mmc_writel(host, REG_IMASK, host->sdio_imask);
734
734
//skip for now.
735
+ //host.smhc_intmask.sdio_int_en()
735
736
737
+ /* SMC Raw Interrupt Status Register */
736
738
/* Clear all pending interrupts */
737
739
//mmc_writel(host, REG_RINTR, 0xffffffff);
740
+ host. smhc_rintsts . write ( |w| w. bits ( 0xffffffff ) ) ;
738
741
742
+ /* SMC Debug Enable Register */
739
743
/* Debug register? undocumented */
740
744
// mmc_writel(host, REG_DBGC, 0xdeb);
741
-
742
- /* Enable CEATA support */
745
+ host. smhc_dbgc . write ( |w| w. bits ( 0xdeb ) ) ;
746
+
747
+ /* SMC Function Select Register */
748
+ /* Enable CEATA support
749
+ * SDXC_CEATA_ON (0xceaa << 16)
750
+ * 0xceaa = 1100 1110 1010 1010
751
+ * xxxx xxxx xxxx x
752
+ * a Abort Read Data
753
+ * b Read Wait
754
+ * c Host Send MMC IRQ Response
755
+ */
743
756
//mmc_writel(host, REG_FUNS, SDXC_CEATA_ON);
757
+ host. smhc_funs . write ( |w| w. read_wait ( ) . assert ( ) ) ;
744
758
745
- /* Set DMA descriptor list base address */
746
- //mmc_writel(host, REG_DLBA, host->sg_dma >> host->cfg->idma_des_shift);
759
+ /*
760
+ * /* SMC IDMAC Descriptor List Base Address */
761
+ * /* Set DMA descriptor list base address */
762
+ * mmc_writel(host, REG_DLBA, host->sg_dma >> host->cfg->idma_des_shift);
763
+ */
747
764
//skip for now.
765
+ //host.smhc_dlba.write(|w| w.bits(0x00000000);
748
766
749
767
/*
750
- rval = mmc_readl(host, REG_GCTRL);
751
- rval |= SDXC_INTERRUPT_ENABLE_BIT;
752
- /* Undocumented, but found in Allwinner code */
753
- rval &= ~SDXC_ACCESS_DONE_DIRECT;
754
- mmc_writel(host, REG_GCTRL, rval);
755
-
756
- return 0;
757
- */
768
+ * /* SMC Global Control Register */
769
+ *
770
+ * rval = mmc_readl(host, REG_GCTRL);
771
+ * //#define SDXC_INTERRUPT_ENABLE_BIT BIT(4) -> Global Interrupt Enable
772
+ * rval |= SDXC_INTERRUPT_ENABLE_BIT;
773
+ * Undocumented, but found in Allwinner code
774
+ * #define SDXC_ACCESS_DONE_DIRECT BIT(30) -> "/"
775
+ * rval &= ~SDXC_ACCESS_DONE_DIRECT;
776
+ * mmc_writel(host, REG_GCTRL, rval);
777
+ * return 0;
778
+ */
779
+ /*
780
+ * Skipping for now.
781
+ * * "Supports Command Completion signals and interrupts to host processor, and
782
+ * Command Completion signal disable feature"
783
+ * * Pretty sure we can't take interrupts while anything has "Peripherals::take()":
784
+ * * riscv: critical-section-single-hart: For bare-metal single core, disabling interrupts globally.
785
+ * host.smhc_ctrl.read()
786
+ */
758
787
}
759
788
760
789
// ************** End port *******
0 commit comments