; -------------------------------------------------------------------------------- ; @Title: OMAP-AM1808 Serial FLASH Programming Script ; @Description: ; ; Serial FLASH(ST, 25P64) is connected to SPI1_SCS[0] by the SPI ; (Serial Peripheral Interface). ; ; S(D)RAM: 0x80002000 ; Serial FLASH Controller Tx Addr: 0x01F0E03C (SPIDAT1) ; Serial FLASH Controller Rx Addr: 0x01F0E040 (SPIBUF) ; The Chip select register is included in the SPIDAT1 register ; ; @Chip: AM1808 ; @Keywords: OMAP OMAP-AM1808 ST 25P64 flash spi ; @Author: jjeong ; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only ; -------------------------------------------------------------------------------- ; $Id: am1808-spi.cmm 10516 2022-02-02 11:39:30Z bschroefel $ LOCAL &arg1 ENTRY &arg1 &arg1=STRing.UPpeR("&arg1") // for example "PREPAREONLY" LOCAL &spi_BaseAddr &spi_BaseAddr=0x01F0E000 SYStem.RESet SYStem.CPU AM1808 SYStem.Option EnReset OFF SYStem.JtagClock RTCK SYStem.Mode Up IF STATE.RUN() Break.direct PER.Set.simple C15:0x1 %Long (Data.Long(C15:0x1)&~(0x1005)) ; disable MMU and cache //PLL configuration Data.Set 0x01C11100 %Long 0x00000049 //enable function for PSC1_SPI1 //#define PD0 0 /*Power Domain-0*/ // PSC1_LPSC_enable(0, LPSC_SPI1); &addr_mdctl_spi1=(0x01E27000+0xA00+4*10.) &data=Data.Long(AD:&addr_mdctl_spi1)&0xFFFFFFE0 Data.Set &addr_mdctl_spi1 %Long (&data|0x3) Data.Set 0x01E27120 %Long (0x1<<0) ; 0x1< 0 FLASHFILE.CONFIG &spi_BaseAddr+0x3C &spi_BaseAddr+0x40 0x0 0x0 //FLASHFILE.TARGET FLASHFILE.TARGET 0x80002000++0x1FFF 0x80004000++0x1FFF ~~/demo/arm/flash/byte/spi64_dm365.bin /KEEP ; for the SDRAM FLASHFILE.GETID ; Read FLASH Manufacture and Device ID //End of the test prepareonly IF "&arg1"=="PREPAREONLY" ENDDO //FLASHFILE.UNLOCK 0x0--0xFFFFF ; Unlock when the flash is locked //FLASHFILE.ERASE 0x0--0xFFFFF ; Erase the serial flash 0x0--0xFFFFF //FLASHFILE.LOAD uboot.bin 0x0 ; Write uboot.bin to 0x0 on the serial flash //FLASHFILE.LOAD uboot.bin 0x0 /ComPare ; Verify FLASHFILE.DUMP 0x0 ; Read out from the serial flash ENDDO enable: Data.Set 0x1F0E000 %Long 0x0 //Reset SPI WAIT 100.ms Data.Set 0x1F0E000 %Long 0x1 //Release SPI Data.Set 0x1F0E004 %Long 0x3 Data.Set 0x1F0E014 %Long 0x0E03 Data.Set 0x1F0E050 %Long 0x00010908 ; clk PRESCALE[15:8] 0x09 Data.Set 0x1F0E03C %Long 0x10020000 Data.Set 0x1F0E048 %Long 0x06060000 ; delay C2TDELAY = 06h Data.Set 0x1F0E04C %Long 0x3 Data.Set 0x1F0E008 %Long 0x10 Data.Set 0x1F0E00C %Long 0x0 Data.Set 0x1F0E004 %Long 0x01000003 RETURN