Skip to content

Commit 258c95b

Browse files
committed
WIP
1 parent a642e43 commit 258c95b

File tree

1 file changed

+42
-13
lines changed
  • src/mainboard/sunxi/nezha/bt0/src

1 file changed

+42
-13
lines changed

src/mainboard/sunxi/nezha/bt0/src/main.rs

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ unsafe fn sunxi_mmc_reset_host(host: SMHC0) -> Result<(), &'static str> {
687687
}
688688

689689
unsafe fn sunxi_mmc_init_host(host: SMHC0) {
690-
print!("=========== init smhc ...");
690+
print!("reset smhc ...");
691691
/*
692692
if let Err(msg) = sunxi_mmc_reset_host(host) {
693693
println!("failed to reset smhc host: {}", msg);
@@ -732,29 +732,58 @@ unsafe fn sunxi_mmc_init_host(host: SMHC0) {
732732
/* Unmask SDIO interrupt if needed */
733733
//mmc_writel(host, REG_IMASK, host->sdio_imask);
734734
//skip for now.
735+
//host.smhc_intmask.sdio_int_en()
735736

737+
/* SMC Raw Interrupt Status Register */
736738
/* Clear all pending interrupts */
737739
//mmc_writel(host, REG_RINTR, 0xffffffff);
740+
host.smhc_rintsts.write(|w| w.bits(0xffffffff));
738741

742+
/* SMC Debug Enable Register */
739743
/* Debug register? undocumented */
740744
// 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+
*/
743756
//mmc_writel(host, REG_FUNS, SDXC_CEATA_ON);
757+
host.smhc_funs.write(|w| w.read_wait().assert());
744758

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+
*/
747764
//skip for now.
765+
//host.smhc_dlba.write(|w| w.bits(0x00000000);
748766

749767
/*
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+
*/
758787
}
759788

760789
// ************** End port *******

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy