From 65ae089853ddd9652103b4052af4b351d66f2374 Mon Sep 17 00:00:00 2001 From: Kenneth Johansson <kenneth@southpole.se> Date: Wed, 28 Dec 2016 16:56:21 +0100 Subject: [PATCH] Set led to red when executing from internal SRAM. then set it to yellow/orange when executing from DRAM. --- Makefile | 14 ++++++-- board/inteno/ex400/jtag/ex400_led.cmm | 15 ++++++++ board/inteno/ex400/led.c | 2 +- inteno_led.S | 50 ++++++++++++++++++++++++++ mt7621_stage_L2.bin | Bin 19896 -> 19896 bytes 5 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 board/inteno/ex400/jtag/ex400_led.cmm create mode 100644 inteno_led.S diff --git a/Makefile b/Makefile index 68acf1096a5..497a13d29ae 100644 --- a/Makefile +++ b/Makefile @@ -848,7 +848,8 @@ endif DDR_CHIP=DEFAULT_DDR3_2048M CFG_ENV_IS=IN_NAND -PHONY += mt7621_ram_init +PHONY += mt7621_ram_init inteno_led_hack + mt7621_ram_init: u-boot.bin cp mt7621_stage_L2.bin nand.bin @@ -864,7 +865,16 @@ mt7621_ram_init: u-boot.bin seek=$(shell echo "(($(shell stat -c %s mt7621_stage_L2.bin)+4095)/4096)*4096-64" | bc) \ conv=notrunc -uboot.img: mt7621_ram_init +inteno_led_hack: mt7621_ram_init + $(CC) $(c_flags) -c inteno_led.S -o inteno_led-elf.o + $(LD) -EL -static -n -nostdlib -e_start -pie -Bstatic --gc-sections -Texamples/standalone/mips.lds -Ttext=0x89004ec0 inteno_led-elf.o -o inteno_led.o + $(OBJCOPY) -O binary -j .text inteno_led.o inteno_led.bin + dd if=inteno_led.bin of=nand.bin bs=1 count=$(shell stat -c %s u-boot.bin) \ + seek=$(shell echo "(($(shell stat -c %s mt7621_stage_L2.bin)+4095)/4096)*4096-64-256" | bc) \ + conv=notrunc + + +uboot.img: inteno_led_hack ./tools/mkimage_mediatek -A mips -T standalone -C none \ -a 0xA0200000 -e 0xa0200000 \ -n "NAND Flash Image" \ diff --git a/board/inteno/ex400/jtag/ex400_led.cmm b/board/inteno/ex400/jtag/ex400_led.cmm new file mode 100644 index 00000000000..0d9315c8b21 --- /dev/null +++ b/board/inteno/ex400/jtag/ex400_led.cmm @@ -0,0 +1,15 @@ +/////////////////////////////////////////////////////////////////////////////// +// basic cpu config for lauterbach +// +B::RES +B::SYS.CPU MIPS1004KMT +B::sys.jc 25.mhz +//B::sys.jc 75.mhz +//enddo +B::SYS.M UP +go +wait 500.ms +break +//B::B::R.S PC 0x89000148 + +enddo diff --git a/board/inteno/ex400/led.c b/board/inteno/ex400/led.c index 3ced143f086..358ac29dddd 100644 --- a/board/inteno/ex400/led.c +++ b/board/inteno/ex400/led.c @@ -16,7 +16,7 @@ void ex400_init_leds( void ) /* set led status_g on and rest to off */ set_led(LED_STATUS_G, LED_STATE_ON); - set_led(LED_STATUS_R, LED_STATE_OFF); + set_led(LED_STATUS_R, LED_STATE_ON); set_led(LED_WPS, LED_STATE_OFF); } diff --git a/inteno_led.S b/inteno_led.S new file mode 100644 index 00000000000..90097e1edb4 --- /dev/null +++ b/inteno_led.S @@ -0,0 +1,50 @@ + .set noreorder + .globl _start + .section .text + +_start: + nop +1: + // uncomment this to be able to attach jtag debugger. +// b 1b + nop + + /* setup gpio pinmux + + led status green, gpio 8 as gpio function + + RALINK_REG(0xbe000060) &= ~(3 << 3); //clear bit 3 & 4 + RALINK_REG(0xbe000060) |= (1 << 3); //set bit 3 + + led status red, gpio 11 as gpio function + led wps (green), gpio 12 as gpio function + + RALINK_REG(0xbe000060) &= ~(3 << 5); //clear bit 5 & 6 + RALINK_REG(0xbe000060) |= (1 << 5); //set bit 5 + + */ + + li $11, 0xbe000060 + lw $12, 0($11) + and $12, 0xffffff87 /* (3 << 3) | (3 << 5) */ + or $12, 0x00000028 /* (1 << 3) | (1 << 5) */ + sw $12, 0($11) + + + /* set gpio 8,11,12 to output */ + li $11, 0xbe000600 + lw $12, 0($11) + or $12, 0x00001900 /* 1<<8 | 1<<11 | 1<<12 */ + sw $12, 0($11) + + /* set status to red, bit 11 -> 1(on) 12&8 -> 1(off)*/ + li $11, 0xbe000620 + lw $12, 0($11) + or $12, 0x1900 /* 1<<11 1<<8 1<<12 */ + sw $12, 0($11) + +/* jump back to 0x89000140 */ + li $11, 0x89000140 + j $11 + nop + diff --git a/mt7621_stage_L2.bin b/mt7621_stage_L2.bin index 71a616d92f61004e8b31906286c28af182a232ec..fdbd4e64b75abaa8c97e61c80cbc37334f68b3b0 100755 GIT binary patch delta 27 gcmdlnn{mf%Mu82&4qOZj3=Ewhf+2umqreJZ0A(EpRR910 delta 27 gcmdlnn{mf%Mu7kZ2QCH%28K=$!Qi`NqreJZ0AIQWmjD0& -- GitLab