├── .gitignore ├── Makefile ├── README ├── boards ├── a0_ubi │ ├── board.c │ ├── board.mk │ └── partitions.tab ├── burner │ ├── board.c │ └── board.mk ├── halley2 │ ├── board.c │ ├── board.mk │ └── partitions.tab ├── ilock │ ├── board.c │ ├── board.mk │ └── partitions.tab ├── media │ ├── board.c │ ├── board.mk │ └── partitions.tab ├── phoenix │ ├── board.c │ ├── board.mk │ └── partitions.tab ├── qrcode │ ├── board.c │ ├── board.mk │ └── partitions.tab ├── skyworth │ ├── board.c │ ├── board.mk │ └── partitions.tab ├── speaker │ ├── board.c │ ├── board.mk │ └── partitions.tab ├── uboot │ ├── board.c │ ├── board.mk │ └── partitions.tab ├── yak │ ├── board.c │ ├── board.mk │ └── partitions.tab ├── yak_minios │ ├── board.c │ ├── board.mk │ └── partitions.tab └── zlm60 │ ├── board.c │ ├── board.mk │ └── partitions.tab ├── boot.c ├── boot_sel.c ├── common ├── check_socid.c ├── common.c ├── ddr_test.c └── printf.c ├── documents ├── cpu │ ├── X1000_DS.pdf │ ├── X1000_PM_20160113.pdf │ └── X1500_DS_20160709.pdf ├── lpddr │ └── X1000_EMD56164PC _45nm_256M_LPDDR_1.8V_rev1.2.pdf ├── spinand │ ├── ATO25D1GA-Rev.03.pdf │ ├── DS-00242-GD5F1GQ4xBxIG-Rev1.3.pdf │ ├── DS-00247-GD5F1GQ4xCxIG-Rev1.4.pdf │ ├── GD5F1GQ4UAY_Rev0_1.pdf │ ├── Paragon_SPI Nand_3.3V_1G_PN26G01A_A1.4.pdf │ └── da00-w25n01gva1.pdf └── spinor │ ├── DS-00019-GD25LQ128C-Rev2.0.pdf │ ├── DS-00020-GD25LQ256C-Rev1.7.pdf │ ├── DS-00086-GD25Q16C-Rev2.0.pdf │ └── DS-00164-GD25Q256C-Rev1.1.pdf ├── drivers ├── aes.c ├── clk.c ├── efuse.c ├── gpio.c ├── i2c.c ├── lpddr.c ├── mmc.c ├── pmu.c ├── rtc.c ├── sfc.c ├── spinand.c ├── spinor.c ├── uart.c └── wdt.c ├── include ├── aes.h ├── clk.h ├── common.h ├── configs │ ├── a0_ubi.h │ ├── boards_common.h │ ├── burner.h │ ├── halley2.h │ ├── ilock.h │ ├── media.h │ ├── phoenix.h │ ├── qrcode.h │ ├── skyworth.h │ ├── speaker.h │ ├── uboot.h │ ├── yak.h │ ├── yak_minios.h │ └── zlm60.h ├── cpm.h ├── efuse.h ├── gpio.h ├── i2c.h ├── lpddr │ ├── chip │ │ └── MDDR_H5MS5122DFR_J3M.h │ ├── lpddr.h │ └── lpddr_chip.h ├── mmc.h ├── pmon.h ├── pmu.h ├── rtc.h ├── sfc.h ├── spiflash.h ├── types.h ├── uart.h └── wdt.h ├── ldscripts ├── sleep_lib.lds ├── x-loader-burner.lds └── x-loader.lds ├── main.c ├── mkconfig ├── sleep-lib ├── sleep_lib.c ├── sleep_lib_clk.c ├── sleep_lib_entry.S └── sleep_lib_uart.c ├── start.S └── tools ├── ddr_params_creator.c ├── efuse_params_creator.c ├── gpt_creator ├── mbr_creator.c ├── sfc_boot_checksum.c ├── sfc_timing_params_creator.c ├── spl_params_fixer.c ├── uart_baudrate_lut.c └── wdt_params_creator.c /.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore 2 | .cproject 3 | .project 4 | out/* 5 | *.o 6 | *.i 7 | a.out 8 | *.swp 9 | ~.* 10 | *.tmp 11 | *.map 12 | *.bin 13 | *.elf 14 | *.map 15 | *.temp 16 | *.dump 17 | include/generated 18 | tools/sfc_boot_checksum 19 | tools/ddr_params_creator 20 | tools/uart_baudrate_lut 21 | tools/mbr_creator 22 | tools/spl_params_fixer 23 | tools/efuse_params_creator 24 | tools/sfc_timing_params_creator 25 | tools/wdt_params_creator 26 | 27 | # 28 | # ignore tags files 29 | tags 30 | TAGS 31 | .tags* 32 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | 这是什么? 20 | ============== 21 | bootloader - 用于加载引导u-boot/linux/rtos,支持spi nand/nor, mmc/sdcard启动 22 | 23 | 如何编译? 24 | ============== 25 | 以halley2板(spi nor)为例 26 | 27 | 第一步: 配置 28 | make halley2_nor_config 29 | 30 | 第二步:编译 31 | make 32 | 33 | 如何添加新板极? 34 | ============== 35 | 1.在boards下添加板极目录 36 | 2.打开Makefile添加新板极编译目标 37 | 38 | 如何引到u-boot? 39 | ============== 40 | 打开boards/BOARD_NAME/board.mk,修改BOOT_NEXT_STAGE := 0,重新编译 41 | 将编译出的x-loader-xxx.bin和u-boot.bin cat在一起 42 | cat x-loader-xxx.bin u-boot.bin > xxx.bin 43 | 44 | 如何引导RTOS? 45 | ============== 46 | 打开boards/BOARD_NAME/board.mk,修改BOOT_NEXT_STAGE := 2,重新编译 47 | 48 | 如何引导zImage? 49 | ============== 50 | 打开boards/BOARD_NAME/board.mk,修改BOOT_NEXT_STAGE := 1, 51 | KERNEL_IMAGE_TYPE := 0,重新编译 52 | 53 | 如何引导xImage? 54 | ============== 55 | 打开boards/BOARD_NAME/board.mk,修改BOOT_NEXT_STAGE := 1, 56 | KERNEL_IMAGE_TYPE := 1,重新编译 57 | 58 | 如何引导vmlinux? 59 | ============== 60 | 打开boards/BOARD_NAME/board.mk,修改BOOT_NEXT_STAGE := 1, 61 | KERNEL_IMAGE_TYPE := 2,重新编译 62 | kernel编译: make vmlinux.bin 63 | 64 | 板极配置文件在哪里? 65 | ============== 66 | 在include/configs/BOARD_NAME.h 67 | 68 | 如何针对板子做特定初始化? 69 | ============== 70 | boards/BOARD_NAME/board.c中board_init()用于在引导前对板子 71 | 进行初始化,当然也可以没有 72 | 73 | 如何修改Soc各时钟频率? 74 | ============== 75 | include/configs/boards_common.h为默认值 76 | 打开板极头文件BOARD.h,去定义默认值再重新定义期望值 77 | 78 | 如何修改串口号以及波特率? 79 | ============== 80 | 打开include/configs/BOARD_NAME.h 81 | 修改: 82 | #define CONFIG_CONSOLE_BAUDRATE 3000000 83 | #define CONFIG_CONSOLE_PC 84 | #define CONFIG_CONSOLE_INDEX 2 85 | 86 | 如何关闭系统串口打印? 87 | ============== 88 | 打开include/configs/BOARD_NAME.h 89 | #undef CONFIG_CONSOLE_ENABLE 90 | 91 | 如何添加自定义的kernel cmdline? 92 | ============== 93 | 打开include/configs/BOARD_NAME.h 94 | #define KERNEL_ARGS_BOARD "xxx " 95 | 96 | 系统没有32KHz晶振如何休眠唤醒? 97 | ============== 98 | 打开include/configs/BOARD_NAME.h 99 | 增加定义:#define CONFIG_RTCCLK_SRC_EXT 100 | 101 | 如何添加recovery引导功能? 102 | ============== 103 | 打开include/configs/BOARD_NAME.h 104 | 增加定义:#define CONFIG_RECOVERY 105 | 106 | 如何使能watch dog功能? 107 | ============== 108 | 打开include/configs/BOARD_NAME.h 109 | 增加定义:#define CONFIG_WDT 110 | 默认timeout为1000ms 111 | 通过#define CONFIG_WDT_TIMEOUT_MS修改默认值 112 | 113 | x-loader中如何进入低功耗状态? 114 | ============== 115 | 打开include/configs/BOARD_NAME.h 116 | 增加定义:#define CONFIG_PM_SUSPEND 117 | 以及 118 | #define CONFIG_PM_SUSPEND_STATE PM_SUSPEND_STANDY ---> CPU进入idle状态 119 | #define CONFIG_PM_SUSPEND_STATE PM_SYSPEND_MEM ---> CPU进入sleep状态 120 | 在boards/BOARD_NAME/board.c中实现gpio_ss_table[][2]数组设置休眠状态,可以不实现 121 | 122 | x-loader中如何进入USB烧录模式? 123 | ============== 124 | 打开include/configs/BOARD_NAME.h 125 | 增加定义:#define CONFIG_SOFT_BURN 126 | 在适当位置调用set_jump_to_usbboot();机器会重启进入烧录模式 127 | 128 | 烧录什么文件? 129 | ============== 130 | 编译完成会有提示:“Image: xxxxxx” is ready 131 | 132 | 添加了代码编译不过怎么办? 133 | ============== 134 | 首先确认代码没有超过12KByte,如果没有继续debug 135 | 136 | 引导不成功怎么办? 137 | ============== 138 | 1.执行make | tee make.txt 139 | 2.将out目录和make.txt打包 140 | 3.问题反馈 141 | 142 | 143 | 问题反馈:ZhangYanMing 144 | -------------------------------------------------------------------------------- /boards/a0_ubi/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | void board_early_init(void) { 22 | 23 | } 24 | 25 | void board_init(void) { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /boards/a0_ubi/board.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | # 20 | # Function: 21 | # bootloader: 0 22 | # burner: 1 23 | # 24 | FUNCTION := 0 25 | 26 | # 27 | # Next stage: 28 | # u-boot: 0 29 | # kernel: 1 30 | # rtos: 2 31 | # 32 | ifeq ($(FUNCTION), 0) 33 | BOOT_NEXT_STAGE := 1 34 | endif 35 | # 36 | # For boot from mmc/sdcard 37 | # 38 | ifeq ($(BOOT_FROM), mmc) 39 | CONFIG_GPT_TABLE=y 40 | 41 | # 42 | # MBR partitions 43 | # 44 | ifneq ($(CONFIG_GPT_TABLE), y) 45 | CONFIG_MBR_P0_OFF=3mb 46 | CONFIG_MBR_P0_END=15mb 47 | CONFIG_MBR_P0_TYPE=linux 48 | 49 | CONFIG_MBR_P1_OFF=0mb 50 | CONFIG_MBR_P1_END=0mb 51 | CONFIG_MBR_P1_TYPE=linux 52 | 53 | CONFIG_MBR_P2_OFF=0mb 54 | CONFIG_MBR_P2_END=0mb 55 | CONFIG_MBR_P2_TYPE=linux 56 | 57 | CONFIG_MBR_P3_OFF=0mb 58 | CONFIG_MBR_P3_END=0mb 59 | CONFIG_MBR_P3_TYPE=linux 60 | endif 61 | 62 | endif 63 | 64 | # 65 | # For boot kernel 66 | # 67 | ifeq ($(BOOT_NEXT_STAGE), 1) 68 | # 69 | # zImage: 0 70 | # xImage: 1 71 | # vmlinux: 2 72 | # 73 | KERNEL_IMAGE_TYPE := 1 74 | endif 75 | 76 | BOARD_CFLAGS := 77 | -------------------------------------------------------------------------------- /boards/a0_ubi/partitions.tab: -------------------------------------------------------------------------------- 1 | property: 2 | disk_size = 4096m 3 | gpt_header_lba = 512 4 | custom_signature = 0 5 | 6 | partition: 7 | #name = start, size, fstype 8 | xboot = 0m, 3m, 9 | boot = 3m, 8m, EMPTY 10 | recovery = 12m, 16m, EMPTY 11 | pretest = 28m, 16m, EMPTY 12 | reserved = 44m, 52m, EMPTY 13 | misc = 96m, 4m, EMPTY 14 | cache = 100m, 100m, LINUX_FS 15 | system = 200m, 700m, LINUX_FS 16 | data = 900m, 2048m, LINUX_FS 17 | 18 | #fstype could be: LINUX_FS, FAT_FS, EMPTY 19 | -------------------------------------------------------------------------------- /boards/burner/board.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | # 20 | # Function: 21 | # bootloader: 0 22 | # burner: 1 23 | # 24 | FUNCTION := 1 25 | 26 | # 27 | # Next stage: 28 | # u-boot: 0 29 | # kernel: 1 30 | # rtos: 2 31 | # 32 | ifeq ($(FUNCTION), 0) 33 | BOOT_NEXT_STAGE := 1 34 | endif 35 | 36 | # 37 | # For boot from mmc/sdcard 38 | # 39 | ifeq ($(BOOT_FROM), mmc) 40 | CONFIG_GPT_TABLE=y 41 | 42 | # 43 | # MBR partitions 44 | # 45 | ifneq ($(CONFIG_GPT_TABLE), y) 46 | CONFIG_MBR_P0_OFF=3mb 47 | CONFIG_MBR_P0_END=15mb 48 | CONFIG_MBR_P0_TYPE=linux 49 | 50 | CONFIG_MBR_P1_OFF=0mb 51 | CONFIG_MBR_P1_END=0mb 52 | CONFIG_MBR_P1_TYPE=linux 53 | 54 | CONFIG_MBR_P2_OFF=0mb 55 | CONFIG_MBR_P2_END=0mb 56 | CONFIG_MBR_P2_TYPE=linux 57 | 58 | CONFIG_MBR_P3_OFF=0mb 59 | CONFIG_MBR_P3_END=0mb 60 | CONFIG_MBR_P3_TYPE=linux 61 | endif 62 | 63 | endif 64 | 65 | # 66 | # For boot kernel 67 | # 68 | ifeq ($(BOOT_NEXT_STAGE), 1) 69 | # 70 | # zImage: 0 71 | # xImage: 1 72 | # vmlinux: 2 73 | # 74 | KERNEL_IMAGE_TYPE := 1 75 | endif 76 | 77 | BOARD_CFLAGS := 78 | -------------------------------------------------------------------------------- /boards/halley2/board.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | # 20 | # Function: 21 | # bootloader: 0 22 | # burner: 1 23 | # 24 | FUNCTION := 0 25 | 26 | # 27 | # Next stage: 28 | # u-boot: 0 29 | # kernel: 1 30 | # rtos: 2 31 | # 32 | ifeq ($(FUNCTION), 0) 33 | BOOT_NEXT_STAGE := 1 34 | endif 35 | 36 | # 37 | # For boot from mmc/sdcard 38 | # 39 | ifeq ($(BOOT_FROM), mmc) 40 | CONFIG_GPT_TABLE=y 41 | 42 | # 43 | # MBR partitions 44 | # 45 | ifneq ($(CONFIG_GPT_TABLE), y) 46 | CONFIG_MBR_P0_OFF=28mb 47 | CONFIG_MBR_P0_END=1052mb 48 | CONFIG_MBR_P0_TYPE=linux 49 | 50 | CONFIG_MBR_P1_OFF=1052mb 51 | CONFIG_MBR_P1_END=4096mb 52 | CONFIG_MBR_P1_TYPE=linux 53 | 54 | CONFIG_MBR_P2_OFF=0mb 55 | CONFIG_MBR_P2_END=0mb 56 | CONFIG_MBR_P2_TYPE=linux 57 | 58 | CONFIG_MBR_P3_OFF=0mb 59 | CONFIG_MBR_P3_END=0mb 60 | CONFIG_MBR_P3_TYPE=linux 61 | endif 62 | 63 | endif 64 | 65 | # 66 | # For boot kernel 67 | # 68 | ifeq ($(BOOT_NEXT_STAGE), 1) 69 | # 70 | # zImage: 0 71 | # xImage: 1 72 | # vmlinux: 2 73 | # 74 | KERNEL_IMAGE_TYPE := 1 75 | endif 76 | 77 | BOARD_CFLAGS := 78 | -------------------------------------------------------------------------------- /boards/halley2/partitions.tab: -------------------------------------------------------------------------------- 1 | property: 2 | disk_size = 4096m 3 | gpt_header_lba = 512 4 | custom_signature = 0 5 | 6 | partition: 7 | #name = start, size, fstype 8 | bootloader = 0m, 3m, 9 | kernel = 3m, 8m, EMPTY 10 | recovery = 12m, 16m, EMPTY 11 | rootfs = 28m, 1024m, LINUX_FS 12 | data = 052m, 3044m, LINUX_FS 13 | 14 | #fstype could be: LINUX_FS, FAT_FS, EMPTY 15 | -------------------------------------------------------------------------------- /boards/ilock/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | void board_early_init(void) { 22 | //enable 3.3V - DCDC 23 | gpio_direction_output(GPIO_PC(9), 1); 24 | 25 | //disable zigbee_gpio 26 | gpio_direction_output(GPIO_PD(0), 0); 27 | gpio_direction_output(GPIO_PD(1), 0); 28 | gpio_direction_output(GPIO_PD(2), 0); 29 | gpio_direction_output(GPIO_PD(3), 0); 30 | gpio_direction_output(GPIO_PD(5), 0); 31 | } 32 | 33 | void board_init(void) { 34 | 35 | } 36 | -------------------------------------------------------------------------------- /boards/ilock/board.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | # 20 | # Function: 21 | # bootloader: 0 22 | # burner: 1 23 | # 24 | FUNCTION := 0 25 | 26 | # 27 | # Next stage: 28 | # u-boot: 0 29 | # kernel: 1 30 | # rtos: 2 31 | # 32 | ifeq ($(FUNCTION), 0) 33 | BOOT_NEXT_STAGE := 1 34 | endif 35 | 36 | # 37 | # For boot from mmc/sdcard 38 | # 39 | ifeq ($(BOOT_FROM), mmc) 40 | CONFIG_GPT_TABLE=y 41 | 42 | # 43 | # MBR partitions 44 | # 45 | ifneq ($(CONFIG_GPT_TABLE), y) 46 | CONFIG_MBR_P0_OFF=28mb 47 | CONFIG_MBR_P0_END=1052mb 48 | CONFIG_MBR_P0_TYPE=linux 49 | 50 | CONFIG_MBR_P1_OFF=1052mb 51 | CONFIG_MBR_P1_END=4096mb 52 | CONFIG_MBR_P1_TYPE=linux 53 | 54 | CONFIG_MBR_P2_OFF=0mb 55 | CONFIG_MBR_P2_END=0mb 56 | CONFIG_MBR_P2_TYPE=linux 57 | 58 | CONFIG_MBR_P3_OFF=0mb 59 | CONFIG_MBR_P3_END=0mb 60 | CONFIG_MBR_P3_TYPE=linux 61 | endif 62 | 63 | endif 64 | 65 | # 66 | # For boot kernel 67 | # 68 | ifeq ($(BOOT_NEXT_STAGE), 1) 69 | # 70 | # zImage: 0 71 | # xImage: 1 72 | # vmlinux: 2 73 | # 74 | KERNEL_IMAGE_TYPE := 1 75 | endif 76 | 77 | BOARD_CFLAGS := 78 | -------------------------------------------------------------------------------- /boards/ilock/partitions.tab: -------------------------------------------------------------------------------- 1 | property: 2 | disk_size = 4096m 3 | gpt_header_lba = 512 4 | custom_signature = 0 5 | 6 | partition: 7 | #name = start, size, fstype 8 | bootloader = 0m, 3m, 9 | kernel = 3m, 8m, EMPTY 10 | recovery = 12m, 16m, EMPTY 11 | rootfs = 28m, 1024m, LINUX_FS 12 | data = 052m, 3044m, LINUX_FS 13 | 14 | #fstype could be: LINUX_FS, FAT_FS, EMPTY 15 | -------------------------------------------------------------------------------- /boards/media/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | void board_early_init(void) { 22 | 23 | } 24 | 25 | void board_init(void) { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /boards/media/board.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | # 20 | # Function: 21 | # bootloader: 0 22 | # burner: 1 23 | # 24 | FUNCTION := 0 25 | 26 | # 27 | # Next stage: 28 | # u-boot: 0 29 | # kernel: 1 30 | # rtos: 2 31 | # 32 | ifeq ($(FUNCTION), 0) 33 | BOOT_NEXT_STAGE := 1 34 | endif 35 | 36 | # 37 | # For boot from mmc/sdcard 38 | # 39 | ifeq ($(BOOT_FROM), mmc) 40 | CONFIG_GPT_TABLE=y 41 | 42 | # 43 | # MBR partitions 44 | # 45 | ifneq ($(CONFIG_GPT_TABLE), y) 46 | CONFIG_MBR_P0_OFF=3mb 47 | CONFIG_MBR_P0_END=15mb 48 | CONFIG_MBR_P0_TYPE=linux 49 | 50 | CONFIG_MBR_P1_OFF=0mb 51 | CONFIG_MBR_P1_END=0mb 52 | CONFIG_MBR_P1_TYPE=linux 53 | 54 | CONFIG_MBR_P2_OFF=0mb 55 | CONFIG_MBR_P2_END=0mb 56 | CONFIG_MBR_P2_TYPE=linux 57 | 58 | CONFIG_MBR_P3_OFF=0mb 59 | CONFIG_MBR_P3_END=0mb 60 | CONFIG_MBR_P3_TYPE=linux 61 | endif 62 | 63 | endif 64 | 65 | # 66 | # For boot kernel 67 | # 68 | ifeq ($(BOOT_NEXT_STAGE), 1) 69 | # 70 | # zImage: 0 71 | # xImage: 1 72 | # vmlinux: 2 73 | # 74 | KERNEL_IMAGE_TYPE := 1 75 | endif 76 | 77 | BOARD_CFLAGS := 78 | -------------------------------------------------------------------------------- /boards/media/partitions.tab: -------------------------------------------------------------------------------- 1 | property: 2 | disk_size = 4096m 3 | gpt_header_lba = 512 4 | custom_signature = 0 5 | 6 | partition: 7 | #name = start, size, fstype 8 | xboot = 0m, 3m, 9 | boot = 3m, 8m, EMPTY 10 | recovery = 12m, 16m, EMPTY 11 | pretest = 28m, 16m, EMPTY 12 | reserved = 44m, 52m, EMPTY 13 | misc = 96m, 4m, EMPTY 14 | cache = 100m, 100m, LINUX_FS 15 | system = 200m, 700m, LINUX_FS 16 | data = 900m, 2048m, LINUX_FS 17 | 18 | #fstype could be: LINUX_FS, FAT_FS, EMPTY 19 | -------------------------------------------------------------------------------- /boards/phoenix/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | void board_early_init(void) { 22 | 23 | } 24 | 25 | void board_init(void) { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /boards/phoenix/board.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | # 20 | # Function: 21 | # bootloader: 0 22 | # burner: 1 23 | # 24 | FUNCTION := 0 25 | 26 | # 27 | # Next stage: 28 | # u-boot: 0 29 | # kernel: 1 30 | # rtos: 2 31 | # 32 | ifeq ($(FUNCTION), 0) 33 | BOOT_NEXT_STAGE := 1 34 | endif 35 | 36 | # 37 | # For boot from mmc/sdcard 38 | # 39 | ifeq ($(BOOT_FROM), mmc) 40 | 41 | CONFIG_GPT_TABLE=y 42 | 43 | # 44 | # MBR partitions 45 | # 46 | ifneq ($(CONFIG_GPT_TABLE), y) 47 | CONFIG_MBR_P0_OFF=3mb 48 | CONFIG_MBR_P0_END=15mb 49 | CONFIG_MBR_P0_TYPE=linux 50 | 51 | CONFIG_MBR_P1_OFF=0mb 52 | CONFIG_MBR_P1_END=0mb 53 | CONFIG_MBR_P1_TYPE=linux 54 | 55 | CONFIG_MBR_P2_OFF=0mb 56 | CONFIG_MBR_P2_END=0mb 57 | CONFIG_MBR_P2_TYPE=linux 58 | 59 | CONFIG_MBR_P3_OFF=0mb 60 | CONFIG_MBR_P3_END=0mb 61 | CONFIG_MBR_P3_TYPE=linux 62 | endif 63 | 64 | endif 65 | 66 | # 67 | # For boot kernel 68 | # 69 | ifeq ($(BOOT_NEXT_STAGE), 1) 70 | # 71 | # zImage: 0 72 | # xImage: 1 73 | # vmlinux: 2 74 | # 75 | KERNEL_IMAGE_TYPE := 1 76 | endif 77 | 78 | BOARD_CFLAGS := 79 | -------------------------------------------------------------------------------- /boards/phoenix/partitions.tab: -------------------------------------------------------------------------------- 1 | property: 2 | disk_size = 4096m 3 | gpt_header_lba = 512 4 | custom_signature = 0 5 | 6 | partition: 7 | #name = start, size, fstype 8 | xboot = 0m, 3m, 9 | boot = 3m, 8m, EMPTY 10 | recovery = 12m, 16m, EMPTY 11 | pretest = 28m, 16m, EMPTY 12 | reserved = 44m, 52m, EMPTY 13 | misc = 96m, 4m, EMPTY 14 | cache = 100m, 100m, LINUX_FS 15 | system = 200m, 700m, LINUX_FS 16 | data = 900m, 2048m, LINUX_FS 17 | 18 | #fstype could be: LINUX_FS, FAT_FS, EMPTY 19 | -------------------------------------------------------------------------------- /boards/qrcode/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | void board_early_init(void) { 22 | 23 | } 24 | 25 | void board_init(void) { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /boards/qrcode/board.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | # 20 | # Function: 21 | # bootloader: 0 22 | # burner: 1 23 | # 24 | FUNCTION := 0 25 | 26 | # 27 | # Next stage: 28 | # u-boot: 0 29 | # kernel: 1 30 | # rtos: 2 31 | # 32 | ifeq ($(FUNCTION), 0) 33 | BOOT_NEXT_STAGE := 1 34 | endif 35 | 36 | # 37 | # For boot from mmc/sdcard 38 | # 39 | ifeq ($(BOOT_FROM), mmc) 40 | CONFIG_GPT_TABLE=y 41 | 42 | # 43 | # MBR partitions 44 | # 45 | ifneq ($(CONFIG_GPT_TABLE), y) 46 | CONFIG_MBR_P0_OFF=3mb 47 | CONFIG_MBR_P0_END=15mb 48 | CONFIG_MBR_P0_TYPE=linux 49 | 50 | CONFIG_MBR_P1_OFF=0mb 51 | CONFIG_MBR_P1_END=0mb 52 | CONFIG_MBR_P1_TYPE=linux 53 | 54 | CONFIG_MBR_P2_OFF=0mb 55 | CONFIG_MBR_P2_END=0mb 56 | CONFIG_MBR_P2_TYPE=linux 57 | 58 | CONFIG_MBR_P3_OFF=0mb 59 | CONFIG_MBR_P3_END=0mb 60 | CONFIG_MBR_P3_TYPE=linux 61 | endif 62 | 63 | endif 64 | 65 | # 66 | # For boot kernel 67 | # 68 | ifeq ($(BOOT_NEXT_STAGE), 1) 69 | # 70 | # zImage: 0 71 | # xImage: 1 72 | # vmlinux: 2 73 | # 74 | KERNEL_IMAGE_TYPE := 1 75 | endif 76 | 77 | BOARD_CFLAGS := 78 | -------------------------------------------------------------------------------- /boards/qrcode/partitions.tab: -------------------------------------------------------------------------------- 1 | property: 2 | disk_size = 4096m 3 | gpt_header_lba = 512 4 | custom_signature = 0 5 | 6 | partition: 7 | #name = start, size, fstype 8 | xboot = 0m, 3m, 9 | boot = 3m, 8m, EMPTY 10 | recovery = 12m, 16m, EMPTY 11 | pretest = 28m, 16m, EMPTY 12 | reserved = 44m, 52m, EMPTY 13 | misc = 96m, 4m, EMPTY 14 | cache = 100m, 100m, LINUX_FS 15 | system = 200m, 700m, LINUX_FS 16 | data = 900m, 2048m, LINUX_FS 17 | 18 | #fstype could be: LINUX_FS, FAT_FS, EMPTY 19 | -------------------------------------------------------------------------------- /boards/skyworth/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | void board_early_init(void) { 22 | 23 | } 24 | 25 | void board_init(void) { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /boards/skyworth/board.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | # 20 | # Function: 21 | # bootloader: 0 22 | # burner: 1 23 | # 24 | FUNCTION := 0 25 | 26 | # 27 | # Next stage: 28 | # u-boot: 0 29 | # kernel: 1 30 | # rtos: 2 31 | # 32 | ifeq ($(FUNCTION), 0) 33 | BOOT_NEXT_STAGE := 1 34 | endif 35 | 36 | # 37 | # For boot from mmc/sdcard 38 | # 39 | ifeq ($(BOOT_FROM), mmc) 40 | CONFIG_GPT_TABLE=y 41 | 42 | # 43 | # MBR partitions 44 | # 45 | ifneq ($(CONFIG_GPT_TABLE), y) 46 | CONFIG_MBR_P0_OFF=3mb 47 | CONFIG_MBR_P0_END=15mb 48 | CONFIG_MBR_P0_TYPE=linux 49 | 50 | CONFIG_MBR_P1_OFF=0mb 51 | CONFIG_MBR_P1_END=0mb 52 | CONFIG_MBR_P1_TYPE=linux 53 | 54 | CONFIG_MBR_P2_OFF=0mb 55 | CONFIG_MBR_P2_END=0mb 56 | CONFIG_MBR_P2_TYPE=linux 57 | 58 | CONFIG_MBR_P3_OFF=0mb 59 | CONFIG_MBR_P3_END=0mb 60 | CONFIG_MBR_P3_TYPE=linux 61 | endif 62 | 63 | endif 64 | 65 | # 66 | # For boot kernel 67 | # 68 | ifeq ($(BOOT_NEXT_STAGE), 1) 69 | # 70 | # zImage: 0 71 | # xImage: 1 72 | # vmlinux: 2 73 | # 74 | KERNEL_IMAGE_TYPE := 1 75 | endif 76 | 77 | BOARD_CFLAGS := 78 | -------------------------------------------------------------------------------- /boards/skyworth/partitions.tab: -------------------------------------------------------------------------------- 1 | property: 2 | disk_size = 4096m 3 | gpt_header_lba = 512 4 | custom_signature = 0 5 | 6 | partition: 7 | #name = start, size, fstype 8 | xboot = 0m, 3m, 9 | boot = 3m, 8m, EMPTY 10 | recovery = 12m, 16m, EMPTY 11 | pretest = 28m, 16m, EMPTY 12 | reserved = 44m, 52m, EMPTY 13 | misc = 96m, 4m, EMPTY 14 | cache = 100m, 100m, LINUX_FS 15 | system = 200m, 700m, LINUX_FS 16 | data = 900m, 2048m, LINUX_FS 17 | 18 | #fstype could be: LINUX_FS, FAT_FS, EMPTY 19 | -------------------------------------------------------------------------------- /boards/speaker/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | void board_early_init(void) { 22 | /* 23 | * Speaker AMP mute 24 | */ 25 | gpio_direction_output(GPIO_PB(7), 1); 26 | 27 | /* 28 | * set pwm_led 29 | */ 30 | gpio_direction_output(GPIO_PC(24), 0); 31 | gpio_direction_output(GPIO_PC(25), 0); 32 | gpio_direction_output(GPIO_PC(26), 1); 33 | gpio_direction_output(GPIO_PC(27), 0); 34 | /* 35 | * entable mcu_power 36 | */ 37 | gpio_direction_output(GPIO_PC(22), 1); 38 | 39 | /* 40 | * select charge current 41 | */ 42 | gpio_direction_output(GPIO_PB(13), 0); 43 | } 44 | 45 | void board_init(void) { 46 | 47 | } 48 | -------------------------------------------------------------------------------- /boards/speaker/board.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | # 20 | # Function: 21 | # bootloader: 0 22 | # burner: 1 23 | # 24 | FUNCTION := 0 25 | 26 | # 27 | # Next stage: 28 | # u-boot: 0 29 | # kernel: 1 30 | # rtos: 2 31 | # 32 | ifeq ($(FUNCTION), 0) 33 | BOOT_NEXT_STAGE := 1 34 | endif 35 | 36 | # 37 | # For boot from mmc/sdcard 38 | # 39 | ifeq ($(BOOT_FROM), mmc) 40 | CONFIG_GPT_TABLE=y 41 | 42 | # 43 | # MBR partitions 44 | # 45 | ifneq ($(CONFIG_GPT_TABLE), y) 46 | CONFIG_MBR_P0_OFF=3mb 47 | CONFIG_MBR_P0_END=15mb 48 | CONFIG_MBR_P0_TYPE=linux 49 | 50 | CONFIG_MBR_P1_OFF=0mb 51 | CONFIG_MBR_P1_END=0mb 52 | CONFIG_MBR_P1_TYPE=linux 53 | 54 | CONFIG_MBR_P2_OFF=0mb 55 | CONFIG_MBR_P2_END=0mb 56 | CONFIG_MBR_P2_TYPE=linux 57 | 58 | CONFIG_MBR_P3_OFF=0mb 59 | CONFIG_MBR_P3_END=0mb 60 | CONFIG_MBR_P3_TYPE=linux 61 | endif 62 | 63 | endif 64 | 65 | # 66 | # For boot kernel 67 | # 68 | ifeq ($(BOOT_NEXT_STAGE), 1) 69 | # 70 | # zImage: 0 71 | # xImage: 1 72 | # vmlinux: 2 73 | # 74 | KERNEL_IMAGE_TYPE := 1 75 | endif 76 | 77 | BOARD_CFLAGS := 78 | -------------------------------------------------------------------------------- /boards/speaker/partitions.tab: -------------------------------------------------------------------------------- 1 | property: 2 | disk_size = 4096m 3 | gpt_header_lba = 512 4 | custom_signature = 0 5 | 6 | partition: 7 | #name = start, size, fstype 8 | xboot = 0m, 3m, 9 | boot = 3m, 8m, EMPTY 10 | recovery = 12m, 16m, EMPTY 11 | pretest = 28m, 16m, EMPTY 12 | reserved = 44m, 52m, EMPTY 13 | misc = 96m, 4m, EMPTY 14 | cache = 100m, 100m, LINUX_FS 15 | system = 200m, 700m, LINUX_FS 16 | data = 900m, 2048m, LINUX_FS 17 | 18 | #fstype could be: LINUX_FS, FAT_FS, EMPTY 19 | -------------------------------------------------------------------------------- /boards/uboot/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | void board_early_init(void) { 22 | } 23 | 24 | void board_init(void) { 25 | #ifdef CONFIG_RTCCLK_SEL 26 | rtc_change_sel(); 27 | #endif 28 | } 29 | -------------------------------------------------------------------------------- /boards/uboot/board.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | # 20 | # Function: 21 | # bootloader: 0 22 | # burner: 1 23 | # 24 | FUNCTION := 0 25 | 26 | # 27 | # Next stage: 28 | # u-boot: 0 29 | # kernel: 1 30 | # rtos: 2 31 | # 32 | ifeq ($(FUNCTION), 0) 33 | BOOT_NEXT_STAGE := 0 34 | endif 35 | 36 | # 37 | # For boot from mmc/sdcard 38 | # 39 | ifeq ($(BOOT_FROM), mmc) 40 | CONFIG_GPT_TABLE=y 41 | 42 | # 43 | # MBR partitions 44 | # 45 | ifneq ($(CONFIG_GPT_TABLE), y) 46 | CONFIG_MBR_P0_OFF=28mb 47 | CONFIG_MBR_P0_END=1052mb 48 | CONFIG_MBR_P0_TYPE=linux 49 | 50 | CONFIG_MBR_P1_OFF=1052mb 51 | CONFIG_MBR_P1_END=4096mb 52 | CONFIG_MBR_P1_TYPE=linux 53 | 54 | CONFIG_MBR_P2_OFF=0mb 55 | CONFIG_MBR_P2_END=0mb 56 | CONFIG_MBR_P2_TYPE=linux 57 | 58 | CONFIG_MBR_P3_OFF=0mb 59 | CONFIG_MBR_P3_END=0mb 60 | CONFIG_MBR_P3_TYPE=linux 61 | endif 62 | 63 | endif 64 | 65 | # 66 | # For boot kernel 67 | # 68 | ifeq ($(BOOT_NEXT_STAGE), 1) 69 | # 70 | # zImage: 0 71 | # xImage: 1 72 | # vmlinux: 2 73 | # 74 | KERNEL_IMAGE_TYPE := 1 75 | endif 76 | 77 | BOARD_CFLAGS := 78 | -------------------------------------------------------------------------------- /boards/uboot/partitions.tab: -------------------------------------------------------------------------------- 1 | property: 2 | disk_size = 4096m 3 | gpt_header_lba = 512 4 | custom_signature = 0 5 | 6 | partition: 7 | #name = start, size, fstype 8 | bootloader = 0m, 3m, 9 | kernel = 3m, 8m, EMPTY 10 | recovery = 12m, 16m, EMPTY 11 | rootfs = 28m, 1024m, LINUX_FS 12 | data = 052m, 3044m, LINUX_FS 13 | 14 | #fstype could be: LINUX_FS, FAT_FS, EMPTY 15 | -------------------------------------------------------------------------------- /boards/yak/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | void board_early_init(void) { 22 | 23 | } 24 | 25 | void board_init(void) { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /boards/yak/board.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | # 20 | # Function: 21 | # bootloader: 0 22 | # burner: 1 23 | # 24 | FUNCTION := 0 25 | 26 | # 27 | # Next stage: 28 | # u-boot: 0 29 | # kernel: 1 30 | # rtos: 2 31 | # 32 | ifeq ($(FUNCTION), 0) 33 | BOOT_NEXT_STAGE := 1 34 | endif 35 | 36 | # 37 | # For boot from mmc/sdcard 38 | # 39 | ifeq ($(BOOT_FROM), mmc) 40 | CONFIG_GPT_TABLE=y 41 | 42 | # 43 | # MBR partitions 44 | # 45 | ifneq ($(CONFIG_GPT_TABLE), y) 46 | CONFIG_MBR_P0_OFF=3mb 47 | CONFIG_MBR_P0_END=15mb 48 | CONFIG_MBR_P0_TYPE=linux 49 | 50 | CONFIG_MBR_P1_OFF=0mb 51 | CONFIG_MBR_P1_END=0mb 52 | CONFIG_MBR_P1_TYPE=linux 53 | 54 | CONFIG_MBR_P2_OFF=0mb 55 | CONFIG_MBR_P2_END=0mb 56 | CONFIG_MBR_P2_TYPE=linux 57 | 58 | CONFIG_MBR_P3_OFF=0mb 59 | CONFIG_MBR_P3_END=0mb 60 | CONFIG_MBR_P3_TYPE=linux 61 | endif 62 | 63 | endif 64 | 65 | # 66 | # For boot kernel 67 | # 68 | ifeq ($(BOOT_NEXT_STAGE), 1) 69 | # 70 | # zImage: 0 71 | # xImage: 1 72 | # vmlinux: 2 73 | # 74 | KERNEL_IMAGE_TYPE := 1 75 | endif 76 | 77 | BOARD_CFLAGS := 78 | -------------------------------------------------------------------------------- /boards/yak/partitions.tab: -------------------------------------------------------------------------------- 1 | property: 2 | disk_size = 4096m 3 | gpt_header_lba = 512 4 | custom_signature = 0 5 | 6 | partition: 7 | #name = start, size, fstype 8 | xboot = 0m, 3m, 9 | boot = 3m, 8m, EMPTY 10 | recovery = 12m, 16m, EMPTY 11 | pretest = 28m, 16m, EMPTY 12 | reserved = 44m, 52m, EMPTY 13 | misc = 96m, 4m, EMPTY 14 | cache = 100m, 100m, LINUX_FS 15 | system = 200m, 700m, LINUX_FS 16 | data = 900m, 2048m, LINUX_FS 17 | 18 | #fstype could be: LINUX_FS, FAT_FS, EMPTY 19 | -------------------------------------------------------------------------------- /boards/yak_minios/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | void board_early_init(void) { 22 | 23 | } 24 | 25 | void board_init(void) { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /boards/yak_minios/board.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | # 20 | # Function: 21 | # bootloader: 0 22 | # burner: 1 23 | # 24 | FUNCTION := 0 25 | 26 | # 27 | # Next stage: 28 | # u-boot: 0 29 | # kernel: 1 30 | # rtos: 2 31 | # 32 | ifeq ($(FUNCTION), 0) 33 | BOOT_NEXT_STAGE := 2 34 | endif 35 | 36 | # 37 | # For boot from mmc/sdcard 38 | # 39 | ifeq ($(BOOT_FROM), mmc) 40 | CONFIG_GPT_TABLE=y 41 | 42 | # 43 | # MBR partitions 44 | # 45 | ifneq ($(CONFIG_GPT_TABLE), y) 46 | CONFIG_MBR_P0_OFF=3mb 47 | CONFIG_MBR_P0_END=15mb 48 | CONFIG_MBR_P0_TYPE=linux 49 | 50 | CONFIG_MBR_P1_OFF=0mb 51 | CONFIG_MBR_P1_END=0mb 52 | CONFIG_MBR_P1_TYPE=linux 53 | 54 | CONFIG_MBR_P2_OFF=0mb 55 | CONFIG_MBR_P2_END=0mb 56 | CONFIG_MBR_P2_TYPE=linux 57 | 58 | CONFIG_MBR_P3_OFF=0mb 59 | CONFIG_MBR_P3_END=0mb 60 | CONFIG_MBR_P3_TYPE=linux 61 | endif 62 | 63 | endif 64 | 65 | # 66 | # For boot kernel 67 | # 68 | ifeq ($(BOOT_NEXT_STAGE), 1) 69 | # 70 | # zImage: 0 71 | # xImage: 1 72 | # vmlinux: 2 73 | # 74 | KERNEL_IMAGE_TYPE := 1 75 | endif 76 | 77 | BOARD_CFLAGS := 78 | -------------------------------------------------------------------------------- /boards/yak_minios/partitions.tab: -------------------------------------------------------------------------------- 1 | property: 2 | disk_size = 4096m 3 | gpt_header_lba = 512 4 | custom_signature = 0 5 | 6 | partition: 7 | #name = start, size, fstype 8 | xboot = 0m, 3m, 9 | boot = 3m, 8m, EMPTY 10 | recovery = 12m, 16m, EMPTY 11 | pretest = 28m, 16m, EMPTY 12 | reserved = 44m, 52m, EMPTY 13 | misc = 96m, 4m, EMPTY 14 | cache = 100m, 100m, LINUX_FS 15 | system = 200m, 700m, LINUX_FS 16 | data = 900m, 2048m, LINUX_FS 17 | 18 | #fstype could be: LINUX_FS, FAT_FS, EMPTY 19 | -------------------------------------------------------------------------------- /boards/zlm60/board.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | void board_early_init(void) { 22 | 23 | } 24 | 25 | void board_init(void) { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /boards/zlm60/board.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | # 20 | # Function: 21 | # bootloader: 0 22 | # burner: 1 23 | # 24 | FUNCTION := 0 25 | 26 | # 27 | # Next stage: 28 | # u-boot: 0 29 | # kernel: 1 30 | # rtos: 2 31 | # 32 | ifeq ($(FUNCTION), 0) 33 | BOOT_NEXT_STAGE := 0 34 | endif 35 | 36 | # 37 | # For boot from mmc/sdcard 38 | # 39 | ifeq ($(BOOT_FROM), mmc) 40 | CONFIG_GPT_TABLE=y 41 | 42 | # 43 | # MBR partitions 44 | # 45 | ifneq ($(CONFIG_GPT_TABLE), y) 46 | CONFIG_MBR_P0_OFF=3mb 47 | CONFIG_MBR_P0_END=15mb 48 | CONFIG_MBR_P0_TYPE=linux 49 | 50 | CONFIG_MBR_P1_OFF=0mb 51 | CONFIG_MBR_P1_END=0mb 52 | CONFIG_MBR_P1_TYPE=linux 53 | 54 | CONFIG_MBR_P2_OFF=0mb 55 | CONFIG_MBR_P2_END=0mb 56 | CONFIG_MBR_P2_TYPE=linux 57 | 58 | CONFIG_MBR_P3_OFF=0mb 59 | CONFIG_MBR_P3_END=0mb 60 | CONFIG_MBR_P3_TYPE=linux 61 | endif 62 | 63 | endif 64 | 65 | # 66 | # For boot kernel 67 | # 68 | ifeq ($(BOOT_NEXT_STAGE), 1) 69 | # 70 | # zImage: 0 71 | # xImage: 1 72 | # vmlinux: 2 73 | # 74 | KERNEL_IMAGE_TYPE := 1 75 | endif 76 | 77 | BOARD_CFLAGS := 78 | -------------------------------------------------------------------------------- /boards/zlm60/partitions.tab: -------------------------------------------------------------------------------- 1 | property: 2 | disk_size = 4096m 3 | gpt_header_lba = 512 4 | custom_signature = 0 5 | 6 | partition: 7 | #name = start, size, fstype 8 | xboot = 0m, 3m, 9 | boot = 3m, 8m, EMPTY 10 | recovery = 12m, 16m, EMPTY 11 | pretest = 28m, 16m, EMPTY 12 | reserved = 44m, 52m, EMPTY 13 | misc = 96m, 4m, EMPTY 14 | cache = 100m, 100m, LINUX_FS 15 | system = 200m, 700m, LINUX_FS 16 | data = 900m, 2048m, LINUX_FS 17 | 18 | #fstype could be: LINUX_FS, FAT_FS, EMPTY 19 | -------------------------------------------------------------------------------- /boot_sel.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | #ifdef CONFIG_RECOVERY 22 | 23 | #if (CONFIG_RECOVERY_BOOT_KEY > 0) 24 | static int get_key_level(unsigned pin) 25 | { 26 | #define GPIO_DEBOUNCE 20 27 | int cnt = GPIO_DEBOUNCE,v = 0, t = 0; 28 | 29 | while (cnt--) { 30 | t = !!gpio_get_value(pin); 31 | if (v != t) { 32 | cnt = GPIO_DEBOUNCE; 33 | mdelay(1); 34 | } 35 | v = t; 36 | } 37 | 38 | return v; 39 | } 40 | 41 | static int get_key_status(int pin, int en_level) 42 | { 43 | gpio_direction_input(pin); 44 | gpio_disable_pull(pin); 45 | 46 | return en_level == get_key_level(pin) ? KEY_PRESS : KEY_UNPRESS; 47 | } 48 | #endif 49 | 50 | static int get_signature(const int signature) 51 | { 52 | unsigned int flag = cpm_get_scrpad(); 53 | 54 | if ((flag & 0xffff) == signature) { 55 | /* 56 | * Clear the signature, 57 | * reset the signature to force into normal boot after factory reset 58 | */ 59 | cpm_set_scrpad(flag & ~(0xffff)); 60 | return KEY_PRESS; 61 | } else { 62 | return KEY_UNPRESS; 63 | } 64 | } 65 | #endif /* CONFIG_RECOVERY */ 66 | 67 | int get_boot_sel(void) { 68 | #ifdef CONFIG_RECOVERY 69 | /* Recovery update flag check */ 70 | #ifdef RECOVERY_UPDATE_FLAG_CHECK 71 | if (is_recovery_update_failed() == 1) { 72 | return RECOVERY_BOOT; 73 | } 74 | #endif 75 | /* Recovery signature */ 76 | if (get_signature(RECOVERY_SIGNATURE)) 77 | return RECOVERY_BOOT; 78 | 79 | #if (CONFIG_RECOVERY_BOOT_KEY > 0) 80 | /* Recovery boot keys */ 81 | if (get_key_status(CONFIG_RECOVERY_BOOT_KEY, CONFIG_RECOVERY_BOOT_KEY_ENLEVEL)) 82 | return RECOVERY_BOOT; 83 | #endif 84 | 85 | #endif /* CONFIG_RECOVERY */ 86 | 87 | return NORMAL_BOOT; 88 | } 89 | -------------------------------------------------------------------------------- /common/check_socid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Wang Qiuwei 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | #include 19 | #include 20 | 21 | #define REG32(addr) *(volatile unsigned int *)(addr) 22 | 23 | #define EFUSE_CTRL 0xb3540000 24 | #define EFUSE_CFG 0xb3540004 25 | #define EFUSE_STATE 0xb3540008 26 | #define EFUSE_DATA0 0xb354000C 27 | 28 | enum socid { 29 | X1000 = 0xff00, 30 | X1000E = 0xff01, 31 | X1500 = 0xff02, 32 | X1000_NEW = 0xff08, 33 | X1000E_NEW = 0xff09, 34 | X1500_NEW = 0xff0a, 35 | }; 36 | 37 | #ifdef CONFIG_CHECK_SOC_ID 38 | int ddr_autosr = 0; 39 | #else 40 | int ddr_autosr = 1; 41 | #endif 42 | 43 | #define LOTID_LOW 0x07 44 | #define LOTID_LOW_MASK 0x1F 45 | #define LOTID_HIGH 0x0E90E02F 46 | #define LOTID_HIGH_MASK 0x3FFFFFFF 47 | #define WAFERID_BIT_SHIFT 11 48 | #define WAFERID_MASK 0x1f 49 | 50 | 51 | void check_socid(void) 52 | { 53 | unsigned int socid, waferid; 54 | unsigned int data1, data3; 55 | 56 | efuse_read(&socid, 0x3c + EFU_ROM_BASE, sizeof(socid)); 57 | socid &= 0xffff; 58 | 59 | switch(socid) { 60 | case X1000E: 61 | case X1000_NEW: 62 | case X1000E_NEW: 63 | case X1500_NEW: 64 | goto check_finished; 65 | case X1500: { 66 | efuse_read(&data1, 0x04 + EFU_ROM_BASE, sizeof(data1)); 67 | efuse_read(&data3, 0x0c + EFU_ROM_BASE, sizeof(data3)); 68 | 69 | if ((data1 & LOTID_LOW_MASK) == LOTID_LOW && \ 70 | (data3 & LOTID_HIGH_MASK) == LOTID_HIGH) { 71 | waferid = (data1 >> WAFERID_BIT_SHIFT) & WAFERID_MASK; 72 | if (waferid >= 0x10 && waferid <= 0x19) { 73 | goto check_finished; 74 | } 75 | } 76 | } 77 | case X1000: 78 | case 0: 79 | default: 80 | ddr_autosr = 0; 81 | } 82 | 83 | return; 84 | 85 | check_finished: 86 | ddr_autosr = 1; 87 | uart_puts("\nR"); 88 | } 89 | -------------------------------------------------------------------------------- /common/ddr_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | enum kseg_region { 22 | KSEG0_REGION, 23 | KSEG1_REGION, 24 | }; 25 | 26 | static int cpu_test_ddr(uint32_t start_addr, uint32_t end_addr, 27 | enum kseg_region region) { 28 | 29 | for (uint32_t i = start_addr; i < end_addr; i += sizeof(uint32_t)) 30 | writel(i, i); 31 | 32 | if (KSEG0_REGION == region) 33 | flush_dcache_all(); 34 | 35 | for (uint32_t i = start_addr; i < end_addr; i += sizeof(uint32_t)) { 36 | if (i != readl(i)) { 37 | printf("Error: write value: 0x%x, read value: 0x%x\n", i, readl(i)); 38 | return -1; 39 | } 40 | } 41 | 42 | for (uint32_t i = start_addr; i < end_addr; i += sizeof(uint32_t)) 43 | writel(end_addr - i, i); 44 | 45 | if (KSEG0_REGION == region) 46 | flush_dcache_all(); 47 | 48 | for (uint32_t i = start_addr; i < end_addr; i += sizeof(uint32_t)) { 49 | if ((end_addr - i) != readl(i)) { 50 | printf("Error: write value: 0x%x, read value: 0x%x\n", 51 | end_addr - i, readl(i)); 52 | return -1; 53 | } 54 | } 55 | 56 | for (uint32_t i = start_addr; i < end_addr; i += sizeof(uint32_t)) 57 | writel(0x5a5a5a5a, i); 58 | 59 | if (KSEG0_REGION == region) 60 | flush_dcache_all(); 61 | 62 | for (uint32_t i = start_addr; i < end_addr; i += sizeof(uint32_t)) { 63 | if (0x5a5a5a5a != readl(i)) { 64 | printf("Error: write value: 0x5a5a5a5a, read value: 0x%x\n", 65 | readl(i)); 66 | return -1; 67 | } 68 | } 69 | 70 | return 0; 71 | } 72 | 73 | static int ddr_cpu_test(enum kseg_region region, uint32_t test_size) { 74 | uint32_t start_addr, end_addr; 75 | uint32_t mem_size = get_lpddr_size(); 76 | 77 | if (test_size > mem_size || test_size == 0) 78 | test_size = mem_size; 79 | 80 | start_addr = 0x0; 81 | end_addr = start_addr + test_size; 82 | 83 | switch (region) { 84 | case KSEG0_REGION: 85 | start_addr += KSEG0; 86 | end_addr += KSEG0; 87 | if (end_addr >= 0x90000000) 88 | end_addr = 0x8ffffffc; 89 | printf("Memory test KSEG0 start, waiting...(start 0x%x, size=0x%x)\n", 90 | start_addr, test_size); 91 | break; 92 | 93 | case KSEG1_REGION: 94 | default: 95 | start_addr += KSEG1; 96 | end_addr += KSEG1; 97 | if (end_addr >= 0xb0000000) 98 | end_addr = 0xaffffffc; 99 | printf("Memory test KSEG1 start, waiting...(start 0x%x, size=0x%x)\n", 100 | start_addr, test_size); 101 | break; 102 | } 103 | 104 | if (cpu_test_ddr(start_addr, end_addr, region) == 0) 105 | printf("OK\n\n"); 106 | else 107 | printf("FAIL\n\n"); 108 | 109 | return 0; 110 | } 111 | 112 | static int ddr_dma_test(void) { 113 | return 0; 114 | } 115 | 116 | void ddr_access_test(void) { 117 | ddr_cpu_test(KSEG0_REGION, 0); 118 | ddr_cpu_test(KSEG1_REGION, 0); 119 | ddr_dma_test(); 120 | } 121 | -------------------------------------------------------------------------------- /common/printf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * printf function in spl. 3 | * 4 | * Copyright (c) 2013 Ingenic Semiconductor Co.,Ltd 5 | * Author: Zoro 6 | * Based on: newxboot/lib/sprintf.c 7 | * newxboot/lib/printf.c 8 | * Written by Sonil 9 | * 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 23 | * MA 02111-1307 USA 24 | */ 25 | 26 | #include 27 | #include 28 | 29 | #ifdef CONFIG_CONSOLE_ENABLE 30 | 31 | static int hex2asc(int n) { 32 | n &= 15; 33 | if(n > 9){ 34 | return ('a' - 10) + n; 35 | } else { 36 | return '0' + n; 37 | } 38 | } 39 | 40 | static int vsprintf(char *str, const char *fmt, va_list ap) { 41 | char scratch[16]; 42 | 43 | for(;;){ 44 | switch(*fmt){ 45 | case 0: 46 | *str++ = 0; 47 | return 0; 48 | case '%': 49 | switch(fmt[1]) { 50 | case 'p': 51 | case 'X': 52 | case 'x': { 53 | unsigned n = va_arg(ap, unsigned); 54 | char *p = scratch + 15; 55 | *p = 0; 56 | do { 57 | *--p = hex2asc(n); 58 | n = n >> 4; 59 | } while(n != 0); 60 | while(p > (scratch + 7)) *--p = '0'; 61 | while (*p) *str++ = *p++; 62 | fmt += 2; 63 | continue; 64 | } 65 | case 'd': { 66 | int n = va_arg(ap, int); 67 | char *p = scratch + 15; 68 | *p = 0; 69 | if(n < 0) { 70 | *str++ = ('-'); 71 | n = -n; 72 | } 73 | do { 74 | *--p = (n % 10) + '0'; 75 | n /= 10; 76 | } while(n != 0); 77 | while (*p) *str++ = (*p++); 78 | fmt += 2; 79 | continue; 80 | } 81 | case 's': { 82 | char *s = va_arg(ap, char*); 83 | if(s == 0) s = "(null)"; 84 | while (*s) *str++ = (*s++); 85 | fmt += 2; 86 | continue; 87 | } 88 | } 89 | *str++ = (*fmt++); 90 | break; 91 | case '\n': 92 | *str++ = ('\r'); 93 | default: 94 | *str++ = (*fmt++); 95 | } 96 | } 97 | } 98 | 99 | void serial_printf(const char *fmt, ...) { 100 | va_list args; 101 | char printbuffer[256]; 102 | 103 | va_start (args, fmt); 104 | vsprintf(printbuffer, fmt, args); 105 | va_end (args); 106 | 107 | uart_puts(printbuffer); 108 | } 109 | 110 | void panic(const char *fmt, ...) { 111 | va_list args; 112 | char printbuffer[256]; 113 | 114 | va_start (args, fmt); 115 | vsprintf(printbuffer, fmt, args); 116 | va_end (args); 117 | 118 | uart_puts(printbuffer); 119 | 120 | hang(); 121 | } 122 | #endif 123 | -------------------------------------------------------------------------------- /documents/cpu/X1000_DS.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/cpu/X1000_DS.pdf -------------------------------------------------------------------------------- /documents/cpu/X1000_PM_20160113.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/cpu/X1000_PM_20160113.pdf -------------------------------------------------------------------------------- /documents/cpu/X1500_DS_20160709.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/cpu/X1500_DS_20160709.pdf -------------------------------------------------------------------------------- /documents/lpddr/X1000_EMD56164PC _45nm_256M_LPDDR_1.8V_rev1.2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/lpddr/X1000_EMD56164PC _45nm_256M_LPDDR_1.8V_rev1.2.pdf -------------------------------------------------------------------------------- /documents/spinand/ATO25D1GA-Rev.03.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/spinand/ATO25D1GA-Rev.03.pdf -------------------------------------------------------------------------------- /documents/spinand/DS-00242-GD5F1GQ4xBxIG-Rev1.3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/spinand/DS-00242-GD5F1GQ4xBxIG-Rev1.3.pdf -------------------------------------------------------------------------------- /documents/spinand/DS-00247-GD5F1GQ4xCxIG-Rev1.4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/spinand/DS-00247-GD5F1GQ4xCxIG-Rev1.4.pdf -------------------------------------------------------------------------------- /documents/spinand/GD5F1GQ4UAY_Rev0_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/spinand/GD5F1GQ4UAY_Rev0_1.pdf -------------------------------------------------------------------------------- /documents/spinand/Paragon_SPI Nand_3.3V_1G_PN26G01A_A1.4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/spinand/Paragon_SPI Nand_3.3V_1G_PN26G01A_A1.4.pdf -------------------------------------------------------------------------------- /documents/spinand/da00-w25n01gva1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/spinand/da00-w25n01gva1.pdf -------------------------------------------------------------------------------- /documents/spinor/DS-00019-GD25LQ128C-Rev2.0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/spinor/DS-00019-GD25LQ128C-Rev2.0.pdf -------------------------------------------------------------------------------- /documents/spinor/DS-00020-GD25LQ256C-Rev1.7.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/spinor/DS-00020-GD25LQ256C-Rev1.7.pdf -------------------------------------------------------------------------------- /documents/spinor/DS-00086-GD25Q16C-Rev2.0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/spinor/DS-00086-GD25Q16C-Rev2.0.pdf -------------------------------------------------------------------------------- /documents/spinor/DS-00164-GD25Q256C-Rev1.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/documents/spinor/DS-00164-GD25Q256C-Rev1.1.pdf -------------------------------------------------------------------------------- /drivers/efuse.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Wang Qiuwei 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | #define EFUSE_CTRL 0x0 23 | #define EFUSE_CFG 0x4 24 | #define EFUSE_STATE 0x8 25 | #define EFUSE_DATA(n) (0xC + (n)*4) 26 | 27 | static int check_vaild(uint32_t addr, int length) 28 | { 29 | uint32_t length_bits = length * 8; 30 | 31 | if (addr >= CHIP_ID_ADDR && addr <= CHIP_ID_END) { 32 | debug("chip id\n"); 33 | if (length_bits > CHIP_ID_SIZE) 34 | goto error; 35 | } else if (addr >= CUT_ID_ADDR && addr <= CUT_ID_END) { 36 | debug("customer id\n"); 37 | if (length_bits > CUT_ID_SIZE) 38 | goto error; 39 | } else { 40 | debug("Invalid addr\n"); 41 | return -1; 42 | } 43 | 44 | return 0; 45 | 46 | error: 47 | debug("length too max\n"); 48 | return -1; 49 | } 50 | 51 | int efuse_read(void *buf, uint32_t addr, int length) { 52 | int i; 53 | uint32_t *pbuf = buf; 54 | uint32_t val, word_num; 55 | 56 | if (check_vaild(addr, length)) 57 | return -1; 58 | 59 | addr -= EFU_ROM_BASE; 60 | word_num = (length + 3) / 4; 61 | 62 | /* set efuse configure resister */ 63 | val = EFUCFG_RD_ADJ << 20 | EFUCFG_RD_STROBE << 16; 64 | efuse_writel(val, EFUSE_CFG); 65 | 66 | /* clear read done status */ 67 | efuse_writel(0, EFUSE_STATE); 68 | 69 | /*indicat addr and length, enable read */ 70 | val = addr << 21 | length << 16 | 1; 71 | efuse_writel(val, EFUSE_CTRL); 72 | 73 | /* wait read done status */ 74 | while(!(efuse_readl(EFUSE_STATE) & 1)); 75 | 76 | for(i = 0; i < word_num; i ++) { 77 | val = efuse_readl(EFUSE_DATA(i)); 78 | *(pbuf + i) = val; 79 | debug("word%d: 0x%x\n", i, val); 80 | } 81 | 82 | return word_num; 83 | } 84 | -------------------------------------------------------------------------------- /drivers/pmu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | void pmu_init(void) { 22 | 23 | } 24 | 25 | void pmu_set_voltage(void) { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /drivers/rtc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | static inline void wait_write_ready(void) { 22 | int timeout = 0x100000; 23 | 24 | while (!(rtc_inl(RTC_RTCCR) & RTC_RTCCR_WRDY) && timeout--); 25 | if (timeout <= 0) 26 | uart_puts("RTC wait_write_ready timeout!\n"); 27 | } 28 | 29 | void rtc_clk_src_to_ext(void) { 30 | /* 31 | * Set OPCR.ERCS of CPM to 1 32 | */ 33 | uint32_t opcr = cpm_inl(CPM_OPCR); 34 | opcr |= OPCR_ERCS; 35 | cpm_outl(opcr, CPM_OPCR); 36 | 37 | /* 38 | * Set CLKGR.RTC of CPM to 0 39 | */ 40 | uint32_t clkgr = cpm_inl(CPM_CLKGR); 41 | clkgr &= ~CPM_CLKGR_RTC; 42 | cpm_outl(clkgr, CPM_CLKGR); 43 | 44 | /* 45 | * Set RTCCR.SELEXC to 1 46 | */ 47 | wait_write_ready(); 48 | uint32_t rtccr = rtc_inl(RTC_RTCCR); 49 | rtccr |= RTC_RTCCR_SELEXC; 50 | rtc_outl(rtccr, RTC_RTCCR); 51 | 52 | /* 53 | * Wait two clock period of clock 54 | */ 55 | udelay(10); 56 | 57 | opcr &= ~OPCR_ERCS; 58 | cpm_outl(opcr, CPM_OPCR); 59 | 60 | udelay(10); 61 | 62 | /* 63 | * Check RTCCR.SELEXC == 1 64 | */ 65 | rtccr = rtc_inl(RTC_RTCCR); 66 | if (!(rtccr & RTC_RTCCR_SELEXC)) { 67 | hang_reason("rtc clock sel failed\n\n"); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /drivers/spinor.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | struct spi_mode_peer spi_mode_local[] = { 22 | [SPI_MODE_STANDARD] = {TRAN_SPI_STANDARD, CMD_READ}, 23 | [SPI_MODE_QUAD] = {TRAN_SPI_QUAD, CMD_QUAD_READ}, 24 | }; 25 | 26 | void jz_sfc_reset_address_mode(void) { 27 | uint32_t buf = 0; 28 | struct jz_sfc sfc; 29 | 30 | SFC_SEND_COMMAND(&sfc, CMD_WREN, 0, 0, 0, 0, 0, 1); 31 | SFC_SEND_COMMAND(&sfc, CMD_EX4B, 0, 0, 0, 0, 0, 1); 32 | SFC_SEND_COMMAND(&sfc, CMD_RDSR, 1, 0, 0, 0, 1, 0); 33 | 34 | sfc_read_data(&buf, 1); 35 | while(buf & CMD_SR_WIP) { 36 | SFC_SEND_COMMAND(&sfc, CMD_RDSR, 1, 0, 0, 0, 1, 0); 37 | sfc_read_data(&buf, 1); 38 | } 39 | } 40 | 41 | void spinor_set_quad_mode(void) { 42 | uint32_t buf; 43 | uint32_t tmp; 44 | int i = 10; 45 | struct jz_sfc sfc; 46 | 47 | SFC_SEND_COMMAND(&sfc, CMD_WREN, 0, 0, 0, 0, 0, 1); 48 | SFC_SEND_COMMAND(&sfc, CMD_WRSR_1, 1, 0, 0, 0, 1, 1); 49 | tmp = 0x02; 50 | sfc_write_data(&tmp, 1); 51 | 52 | SFC_SEND_COMMAND(&sfc, CMD_RDSR, 1, 0, 0, 0, 1, 0); 53 | sfc_read_data(&tmp, 1); 54 | while(tmp & CMD_SR_WIP) { 55 | SFC_SEND_COMMAND(&sfc, CMD_RDSR, 1, 0, 0, 0, 1, 0); 56 | sfc_read_data(&tmp, 1); 57 | } 58 | 59 | SFC_SEND_COMMAND(&sfc, CMD_RDSR_1, 1, 0, 0, 0, 1, 0); 60 | sfc_read_data(&buf, 1); 61 | while(!(buf & 0x2) && ((i--) > 0)) { 62 | SFC_SEND_COMMAND(&sfc, CMD_RDSR_1, 1, 0, 0, 0, 1, 0); 63 | sfc_read_data(&buf, 1); 64 | } 65 | } 66 | 67 | int spinor_read(uint32_t offset, uint32_t len, uint32_t data) { 68 | int addr_len = 3; 69 | struct jz_sfc sfc; 70 | int ret; 71 | 72 | #ifndef CONFIG_SPI_STANDARD 73 | int dummy_byte = 8; 74 | SFC_SEND_COMMAND(&sfc, SPI_MODE_QUAD, len, offset, addr_len, dummy_byte, 1, 0); 75 | #else 76 | SFC_SEND_COMMAND(&sfc, SPI_MODE_STANDARD, len, offset, addr_len, 0, 1, 0); 77 | #endif 78 | 79 | ret = sfc_read_data((void *) data, len); 80 | if (ret) 81 | return ret; 82 | else 83 | return 0; 84 | } 85 | 86 | int spinor_init(void) { 87 | jz_sfc_reset_address_mode(); 88 | 89 | #ifndef CONFIG_SPI_STANDARD 90 | spinor_set_quad_mode(); 91 | #endif 92 | 93 | return 0; 94 | } 95 | 96 | #ifdef CONFIG_BEIJING_OTA 97 | #define NV_AREA_START (288 * 1024) 98 | static void nv_map_area(unsigned int *base_addr) 99 | { 100 | unsigned int buf[3][2]; 101 | unsigned int tmp_buf[4]; 102 | unsigned int nv_num = 0, nv_count = 0; 103 | unsigned int addr, i; 104 | 105 | for (i = 0; i < 3; i++) { 106 | addr = NV_AREA_START + i * 32 * 1024; 107 | spinor_read(addr, 4, (void *)buf[i]); 108 | if (buf[i][0] == 0x5a5a5a5a) { 109 | spinor_read(addr + 1 *1024, 16, (void *)tmp_buf); 110 | addr += 32 * 1024 - 8; 111 | spinor_read(addr, 8, (void *)buf[i]); 112 | if (buf[i][1] == 0xa5a5a5a5) { 113 | if (nv_count < buf[i][0]) { 114 | nv_count = buf[i][0]; 115 | nv_num = i; 116 | } 117 | } 118 | } 119 | } 120 | 121 | *base_addr = NV_AREA_START + nv_num * 32 * 1024 + 1024; 122 | } 123 | 124 | int ota_load(unsigned int *argv, unsigned int dst_addr) 125 | { 126 | unsigned int nv_buf[4]; 127 | unsigned int count = 16; 128 | unsigned int src_addr, updata_flag; 129 | 130 | nv_map_area((unsigned int *)&src_addr); 131 | spinor_read(src_addr, count, (void *)nv_buf); 132 | updata_flag = nv_buf[3]; 133 | 134 | if ((updata_flag & 0x3) != 0x3) 135 | return spinor_read(CONFIG_KERNEL_OFFSET, CONFIG_KERNEL_LENGTH, (void *)dst_addr); 136 | else { 137 | *argv = (unsigned int)CONFIG_OTA_KERNEL_ARGS; 138 | return spinor_read(CONFIG_OTA_STEP2_KERNEL_OFFSET, CONFIG_KERNEL_LENGTH, (void *)dst_addr); 139 | } 140 | } 141 | #endif 142 | 143 | int is_recovery_update_failed(void) { 144 | unsigned int update_flag = 0; 145 | uint32_t offset = RECOVERY_UPDATE_FLAG_OFFSET; 146 | uint32_t length = RECOVERY_UPDATE_FLAG_SIZE; 147 | if (spinor_read(offset, length, (uint32_t)&update_flag) != 0) { 148 | return -1; 149 | } 150 | if (update_flag == RECOVERY_UPDATE_FLAG_UPDATING) 151 | return 1; 152 | return 0; 153 | } 154 | -------------------------------------------------------------------------------- /drivers/uart.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Jz4740 UART support 3 | * Copyright (c) 2011 4 | * Qi Hardware, Xiangfu Liu 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 19 | * MA 02111-1307 USA 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | struct jz_uart *uart; 26 | 27 | #ifdef CONFIG_CONSOLE_ENABLE 28 | static void uart_putc(const char c) { 29 | if (c == '\n') 30 | uart_putc('\r'); 31 | 32 | writeb((uint8_t)c, &uart->rbr_thr_dllr); 33 | 34 | /* Wait for fifo to shift out some bytes */ 35 | while (!((readb(&uart->lsr) & (UART_LSR_TDRQ | UART_LSR_TEMT)) == 0x60)); 36 | } 37 | #endif 38 | 39 | void uart_init(void) { 40 | uint8_t tmp; 41 | 42 | uart = (struct jz_uart *)(UART0_BASE + CONFIG_CONSOLE_INDEX * 0x1000); 43 | 44 | /* init uart gpio */ 45 | console_set_gpio(); 46 | 47 | /* open uart clk gate */ 48 | enable_uart_clk(); 49 | 50 | /* Disable port interrupts while changing hardware */ 51 | writeb(0, &uart->dlhr_ier); 52 | 53 | /* Disable UART unit function */ 54 | writeb(~UART_FCR_UUE, &uart->iir_fcr); 55 | 56 | /* Set both receiver and transmitter in UART mode (not SIR) */ 57 | writeb(~(SIRCR_RSIRE | SIRCR_TSIRE), &uart->isr); 58 | 59 | /* 60 | * Set databits, stopbits and parity. 61 | * (8-bit data, 1 stopbit, no parity) 62 | */ 63 | writeb(UART_LCR_WLEN_8 | UART_LCR_STOP_1, &uart->lcr); 64 | 65 | /* Set baud rate */ 66 | tmp = readb(&uart->lcr); 67 | tmp |= UART_LCR_DLAB; 68 | writeb(tmp, &uart->lcr); 69 | 70 | writeb((UART_BAUDRATE_DIV_BEST >> 8) & 0xff, &uart->dlhr_ier); 71 | writeb(UART_BAUDRATE_DIV_BEST & 0xff, &uart->rbr_thr_dllr); 72 | writeb(UART_UMR_BEST, &uart->umr); 73 | writeb(UART_UACR_BEST, &uart->uacr); 74 | 75 | tmp &= ~UART_LCR_DLAB; 76 | writeb(tmp, &uart->lcr); 77 | 78 | /* Enable UART unit, enable and clear FIFO */ 79 | writeb(UART_FCR_UUE | UART_FCR_FE | UART_FCR_TFLS | UART_FCR_RFLS, 80 | &uart->iir_fcr); 81 | } 82 | 83 | void uart_puts(const char* s) { 84 | #ifdef CONFIG_CONSOLE_ENABLE 85 | while (*s) 86 | uart_putc(*s++); 87 | #endif 88 | } 89 | 90 | void uart_put_hex_n(uint32_t d) { 91 | char c[9]; 92 | uint32_t i; 93 | for (i = 0; i < 8; i++) { 94 | c[i] = (d >> ((7 - i) * 4)) & 0xf; 95 | if (c[i] < 10) 96 | c[i] += 0x30; 97 | else 98 | c[i] += (0x41 - 10); 99 | } 100 | c[8] = 0; 101 | uart_puts(c); 102 | } 103 | 104 | void uart_put_hex(uint32_t d) { 105 | uart_put_hex_n(d); 106 | uart_puts("\n"); 107 | } 108 | -------------------------------------------------------------------------------- /drivers/wdt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | #define wdt_write(value, reg) writel(value, WDT_BASE + reg) 23 | #define wdt_read(reg) readl(WDT_BASE + reg) 24 | 25 | static inline void wdt_start(void) { 26 | writel(TSCR_WDTSC, TCU_BASE + TCU_TSCR); 27 | 28 | wdt_write(0, WDT_TCNT); 29 | wdt_write(WDT_CFG_TDR, WDT_TDR); 30 | wdt_write(WDT_CFG_TCSR, WDT_TCSR); 31 | wdt_write(0, WDT_TCER); 32 | wdt_write(TCER_TCEN, WDT_TCER); 33 | } 34 | 35 | void wdt_stop(void) { 36 | wdt_write(wdt_read(WDT_TCER) & ~TCER_TCEN, WDT_TCER); /* Timer stop */ 37 | writel(TSSR_WDTSS, TCU_BASE + TCU_TSSR); /* Set clock supplies to WDT is stopped */ 38 | } 39 | 40 | void wdt_feed(void) { 41 | wdt_write(0x0, WDT_TCNT); 42 | } 43 | 44 | void wdt_init(void) { 45 | wdt_start(); 46 | } 47 | 48 | void wdt_restart(void) { 49 | #define WDT_DIV 64 50 | #define RTC_FREQ 32768 51 | #define RESET_DELAY_MS 4 52 | #define TCSR_PRESCALE_64 (3 << 3) 53 | #define TCSR_PRESCALE TCSR_PRESCALE_64 54 | 55 | uint32_t src_freq; 56 | #ifdef CONFIG_RTCCLK_SRC_EXT 57 | src_freq = CONFIG_EXTAL_FREQ * 1000 * 1000 / 512; 58 | #else 59 | src_freq = RTC_FREQ; 60 | #endif 61 | 62 | int time = src_freq / WDT_DIV * RESET_DELAY_MS / 1000; 63 | 64 | if(time > 65535) 65 | time = 65535; 66 | 67 | writel(TSCR_WDTSC, TCU_BASE + TCU_TSCR); 68 | 69 | wdt_write(0, WDT_TCNT); 70 | wdt_write(time, WDT_TDR); 71 | wdt_write(TCSR_PRESCALE | TCSR_RTC_EN, WDT_TCSR); 72 | wdt_write(0, WDT_TCER); 73 | 74 | printf("reset in %dms\n", RESET_DELAY_MS); 75 | 76 | wdt_write(TCER_TCEN, WDT_TCER); 77 | 78 | while(1); 79 | 80 | #undef WDT_DIV 81 | #undef RTC_FREQ 82 | #undef RESET_DELAY_MS 83 | #undef TCSR_PRESCALE_64 84 | #undef TCSR_PRESCALE 85 | } 86 | -------------------------------------------------------------------------------- /include/aes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef AES_H 20 | #define AES_H 21 | 22 | /* 23 | * AES128 24 | */ 25 | #define AES_KEY_128BIT (0x00000000) 26 | 27 | /* 28 | * AES192 29 | */ 30 | #define AES_KEY_192BIT (0x00000001) 31 | 32 | /* 33 | * AES256 34 | */ 35 | #define AES_KEY_256BIT (0x00000002) 36 | 37 | /* 38 | * AES ECB mode 39 | */ 40 | #define AES_MODE_ECB (0x00000001) 41 | 42 | /* 43 | * AES CBC mode 44 | */ 45 | #define AES_MODE_CBC (0x00000002) 46 | 47 | #define AES_MODE_NONE (0x00000000) 48 | 49 | struct aes_key { 50 | uint8_t *key; 51 | uint32_t key_len; 52 | uint32_t bit_mode; 53 | uint32_t aes_mode; 54 | uint8_t* iv; 55 | uint32_t iv_len; 56 | }; 57 | 58 | struct aes_data { 59 | uint8_t* input; 60 | uint32_t input_len; 61 | uint8_t* output; 62 | }; 63 | 64 | void aes_init(void); 65 | void aes_load_key(struct aes_key*); 66 | void aes_decrypt(struct aes_data*); 67 | 68 | #endif /* AES_KEY */ 69 | -------------------------------------------------------------------------------- /include/clk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef CLK_H 20 | #define CLK_H 21 | 22 | enum clk_id { 23 | DDR, 24 | I2S, 25 | PCM, 26 | MACPHY, 27 | LCD, 28 | MSC, 29 | MSC0 = MSC, 30 | MSC1, 31 | OTG, 32 | SFC, 33 | SSI = SFC, 34 | CIM, 35 | CGU_CNT, 36 | CPU = CGU_CNT, 37 | H2CLK, 38 | APLL, 39 | MPLL, 40 | EXCLK, 41 | }; 42 | 43 | void clk_init(void); 44 | void enable_uart_clk(void); 45 | void enable_aes_clk(void); 46 | uint32_t get_mmc_freq(void); 47 | uint32_t get_ahb_rate(void); 48 | uint32_t get_ddr_rate(void); 49 | void set_mmc_freq(uint32_t); 50 | void set_sfc_freq(uint32_t); 51 | 52 | #endif /* CLK_H */ 53 | -------------------------------------------------------------------------------- /include/configs/a0_ubi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef A0_H 20 | #define A0_H 21 | 22 | /* 23 | * Console 24 | */ 25 | #define CONFIG_CONSOLE_BAUDRATE 2000000 26 | #define CONFIG_CONSOLE_PC 27 | #define CONFIG_CONSOLE_INDEX 2 28 | 29 | /* 30 | * The following configure only for boot kernel 31 | */ 32 | #ifdef CONFIG_BOOT_KERNEL 33 | 34 | #define KERNEL_ARGS_BOARD " " 35 | 36 | #ifdef CONFIG_CONSOLE_ENABLE 37 | #define KERNEL_ARGS_CONSOLE "no_console_suspend console=ttyS"STR(CONFIG_CONSOLE_INDEX)","STR(CONFIG_CONSOLE_BAUDRATE)"n8 " 38 | #else 39 | #define KERNEL_ARGS_CONSOLE "console=null " 40 | #endif 41 | 42 | #ifdef CONFIG_GET_WIFI_MAC 43 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_WIFI_MAC KERNEL_ARGS_BOARD 44 | #else 45 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_BOARD 46 | #endif 47 | 48 | #ifdef CONFIG_RECOVERY 49 | #define CONFIG_RECOVERY_BOOT_KEY GPIO_PA(10) 50 | #define CONFIG_RECOVERY_BOOT_KEY_ENLEVEL 0 51 | #define CONFIG_RECOVERY_ARGS KERNEL_ARGS_COMMON 52 | #endif /* CONFIG_RECOVERY */ 53 | 54 | #endif /* CONFIG_BOOT_KERNEL */ 55 | 56 | /* 57 | * The following configure only for NAND boot 58 | */ 59 | #ifdef CONFIG_BOOT_SPI_NAND 60 | 61 | #ifdef CONFIG_RECOVERY 62 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=4 root=ubi0:rootfs ubi.mtd=5 rootfstype=ubifs rw" 63 | #else 64 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs" 65 | //#define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "root=/dev/mtdblock2" 66 | #endif /* CONFIG_RECOVERY */ 67 | 68 | /* 69 | * unit(byte) 70 | */ 71 | #define CONFIG_UBOOT_OFFSET 0x6800 72 | #define CONFIG_UBOOT_LENGTH 0x40000 73 | 74 | #define CONFIG_RTOS_OFFSET 0x40000 75 | #define CONFIG_RTOS_LENGTH 0x40000 76 | 77 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 78 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 79 | 80 | #define CONFIG_KERNEL_OFFSET 0x100000 81 | #define CONFIG_KERNEL_LENGTH 0x800000 82 | 83 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 84 | 85 | #define CONFIG_KERNEL_OFFSET 0x100000 86 | #define CONFIG_KERNEL_LENGTH 0x800000 87 | 88 | #endif 89 | #endif 90 | 91 | #define CONFIG_RECOVERY_OFFSET 0x980000 92 | #define CONFIG_RECOVERY_LENGTH 0x800000 93 | 94 | #define CONFIG_WIFI_MAC_ADDR 0x901000 95 | 96 | #endif /* CONFIG_BOOT_SPI_NAND */ 97 | 98 | /* 99 | * The following configure only for NOR boot 100 | */ 101 | #ifdef CONFIG_BOOT_SPI_NOR 102 | 103 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock3 rw" 104 | 105 | /* 106 | * unit(byte) 107 | */ 108 | #define CONFIG_UBOOT_OFFSET 0x6800 109 | #define CONFIG_UBOOT_LENGTH 0x40000 110 | 111 | #define CONFIG_RTOS_OFFSET 0x40000 112 | #define CONFIG_RTOS_LENGTH 0x40000 113 | 114 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 115 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 116 | 117 | #define CONFIG_KERNEL_OFFSET 0x40000 118 | #define CONFIG_KERNEL_LENGTH 0x300000 119 | 120 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 121 | 122 | #define CONFIG_KERNEL_OFFSET 0x40000 123 | #define CONFIG_KERNEL_LENGTH 0x700000 124 | 125 | #endif 126 | #endif 127 | 128 | #define CONFIG_RECOVERY_OFFSET 0x400000 129 | #define CONFIG_RECOVERY_LENGTH 0x300000 130 | 131 | #define CONFIG_WIFI_MAC_ADDR 0x341000 132 | 133 | #endif /* CONFIG_BOOT_SPI_NOR */ 134 | 135 | /* 136 | * The following configure only for MMC boot 137 | */ 138 | #ifdef CONFIG_BOOT_MMC 139 | 140 | #define CONFIG_MMC_PA_4BIT 141 | #undef CONFIG_MMC_PA_8BIT 142 | #undef CONFIG_MMC_PC_4BIT 143 | 144 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=ext4 root=/dev/mmcblk0p3 rw" 145 | 146 | /* 147 | * unit(byte) 148 | */ 149 | #define CONFIG_UBOOT_OFFSET 0xA400 150 | #define CONFIG_UBOOT_LENGTH 0x40000 151 | 152 | #define CONFIG_RTOS_OFFSET 0x40000 153 | #define CONFIG_RTOS_LENGTH 0x40000 154 | 155 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 156 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 157 | 158 | #define CONFIG_KERNEL_OFFSET 0x300000 159 | #define CONFIG_KERNEL_LENGTH 0x800000 160 | 161 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 162 | 163 | #define CONFIG_KERNEL_OFFSET 0x300000 164 | #define CONFIG_KERNEL_LENGTH 0x800000 165 | 166 | #endif 167 | #endif 168 | 169 | #define CONFIG_RECOVERY_OFFSET 0x400000 170 | #define CONFIG_RECOVERY_LENGTH 0x300000 171 | 172 | #define CONFIG_WIFI_MAC_ADDR 0x39000 173 | 174 | #endif /* CONFIG_BOOT_MMC */ 175 | 176 | /* 177 | * OTA 178 | */ 179 | #undef CONFIG_BEIJING_OTA 180 | 181 | #ifdef CONFIG_BEIJING_OTA 182 | #define CONFIG_OTA_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=cramfs root=/dev/mtdblock4 rw" 183 | #define CONFIG_OTA_STEP2_KERNEL_OFFSET 0xd00000 184 | #endif 185 | 186 | #endif /* A0_H */ 187 | -------------------------------------------------------------------------------- /include/configs/boards_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef BOARDS_COMMON_H 20 | #define BOARDS_COMMON_H 21 | 22 | #define __STR__(S) #S 23 | #define STR(S) __STR__(S) 24 | 25 | /* 26 | * Kernel image type 27 | */ 28 | #define ZIMAGE 0 29 | #define XIMAGE 1 30 | #define VMLINUX 2 31 | 32 | /* 33 | * PM_SUSPEND_STANDBY: cpu enter idle & memory entry self-refresh 34 | * PM_SUSPEND_MEM: cpu enter sleep & memory entry self-refresh & clock 35 | * all stoped & cpu power down 36 | */ 37 | #define PM_SUSPEND_STANDBY 2 38 | #define PM_SUSPEND_MEM 3 39 | 40 | 41 | 42 | 43 | 44 | // =========================================================== 45 | // The following configure could be override at BOARD.h 46 | // =========================================================== 47 | 48 | /* 49 | * External crystal freq - unit(MHz) 50 | */ 51 | #define CONFIG_EXTAL_FREQ 24 52 | 53 | /* 54 | * PLL freq - unit(MHz) 55 | */ 56 | #define CONFIG_APLL_FREQ 1008 57 | #define CONFIG_MPLL_FREQ 600 58 | #define CONFIG_CPU_SEL_PLL APLL 59 | #define CONFIG_DDR_SEL_PLL MPLL 60 | #define CONFIG_DDR_FREQ_DIV 3 61 | #define CONFIG_L2CACHE_CLK_DIV 2 62 | #define CONFIG_AHB_CLK_DIV 3 63 | 64 | /* 65 | * DDR 66 | */ 67 | #define CONFIG_MDDR_H5MS5122DFR_J3M 68 | #define CONFIG_PROBE_MEM_SIZE 69 | 70 | #ifdef CONFIG_PROBE_MEM_SIZE 71 | #define CONFIG_MEM_SIZE_64M 72 | #endif 73 | 74 | /* 75 | * 000: Full strength driver 76 | * 001: Half strength driver 77 | * 110: Quarter strength driver 78 | * 111: Octant strength driver 79 | * 100: Three-quarters strength driver 80 | */ 81 | #define CONFIG_DDR_DRIVER_STRENGTH 4 82 | 83 | /* 84 | * 1: 32bits 85 | * 0: 1bits 86 | */ 87 | #define CONFIG_DDR_DW32 0 88 | 89 | /* 90 | * Check efuse SoC id 91 | */ 92 | #define CONFIG_CHECK_SOC_ID 93 | 94 | /* 95 | * Console 96 | */ 97 | #define CONFIG_CONSOLE_ENABLE 98 | 99 | /* 100 | * SFC 101 | */ 102 | #ifdef CONFIG_BOOT_SFC 103 | 104 | /* 105 | * SFC freq - unit(MHz) 106 | */ 107 | #define CONFIG_SFC_FREQ (150) 108 | 109 | #undef CONFIG_SPI_STANDARD 110 | 111 | #endif /* CONFIG_BOOT_SFC */ 112 | 113 | #ifdef CONFIG_BOOT_SPI_NAND 114 | /* 115 | * Nand - bytes per-page 116 | */ 117 | #define CONFIG_NAND_BPP (2048) 118 | 119 | /* 120 | * Nand - page per-block 121 | */ 122 | #define CONFIG_NAND_PPB (64) 123 | 124 | /* 125 | * Nand - bus width 126 | */ 127 | #define NAND_BUSWIDTH NAND_BUSWIDTH_8 128 | #endif /* CONFIG_BOOT_SPI_NAND */ 129 | 130 | #ifdef CONFIG_BOOT_MMC 131 | 132 | /* 133 | * MMC freq - unit(MHz) 134 | */ 135 | #define CONFIG_MSC_FREQ (50) 136 | 137 | #endif /* CONFIG_BOOT_MMC */ 138 | 139 | /* 140 | * RTC clk sel 141 | */ 142 | #undef CONFIG_RTCCLK_SRC_EXT 143 | 144 | /* 145 | * DDR R/W test 146 | */ 147 | #undef CONFIG_DDR_ACCESS_TEST 148 | 149 | /* 150 | * WIFI MAC 151 | */ 152 | #undef CONFIG_GET_WIFI_MAC 153 | #define KERNEL_ARGS_WIFI_MAC "wifi_mac=xxxxxxxxxxxx " 154 | 155 | /* 156 | * Kernel args common 157 | */ 158 | #define KERNEL_ARGS_MEM "mem=xxM@0x0 " 159 | #define KERNEL_ARGS_OTHERS "lpj=5009408 ip=off " 160 | #define KERNEL_ARGS_INIT "init=/linuxrc " 161 | 162 | /* 163 | * Recovery 164 | */ 165 | #undef CONFIG_RECOVERY 166 | #define RECOVERY_UPDATE_FLAG_CHECK 167 | 168 | #define RECOVERY_UPDATE_FLAG_OFFSET 0x6000 //24kb 169 | #define RECOVERY_UPDATE_FLAG_SIZE 4 //unit: byte 170 | #define RECOVERY_UPDATE_FLAG_UPDATING 0x5A5A5A5A 171 | 172 | /* 173 | * Watchdog 174 | */ 175 | #undef CONFIG_WDT 176 | #define CONFIG_WDT_CLK_SRC_RTC 177 | #define CONFIG_WDT_TIMEOUT_MS 1000 178 | 179 | /* 180 | * Debug power 181 | */ 182 | #undef CONFIG_PM_SUSPEND 183 | #undef CONFIG_PM_SUSPEND_STATE 184 | 185 | #endif /* BOARDS_COMMON_H */ 186 | -------------------------------------------------------------------------------- /include/configs/burner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef BURNER_H 20 | #define BURNER_H 21 | 22 | //#define CONFIG_PM_SUSPEND 23 | //#define CONFIG_PM_SUSPEND_STATE PM_SUSPEND_STANDBY 24 | 25 | /* 26 | * Console 27 | */ 28 | #define CONFIG_CONSOLE_BAUDRATE 3000000 29 | #define CONFIG_CONSOLE_PC 30 | #define CONFIG_CONSOLE_INDEX 2 31 | 32 | /* 33 | * Support burn SPI flash 34 | */ 35 | #define CONFIG_BURN_SPI_FLASH 36 | 37 | /* 38 | * Support burn emmc / sdcard 39 | */ 40 | #undef CONFIG_BURN_MMC 41 | #undef CONFIG_MMC_PA_4BIT 42 | #undef CONFIG_MMC_PC_4BIT 43 | #undef CONFIG_MMC_PA_8BIT 44 | 45 | /* 46 | * Ignore RTC 32KHz clk 47 | */ 48 | #define CONFIG_RTCCLK_SRC_EXT 49 | 50 | #endif /* BURNER_H */ 51 | -------------------------------------------------------------------------------- /include/configs/halley2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef HALLEY2_H 20 | #define HALLEY2_H 21 | 22 | /* 23 | * Console 24 | */ 25 | #define CONFIG_CONSOLE_BAUDRATE 3000000 26 | #define CONFIG_CONSOLE_PC 27 | #define CONFIG_CONSOLE_INDEX 2 28 | 29 | /* 30 | * The following configure only for boot kernel 31 | */ 32 | #ifdef CONFIG_BOOT_KERNEL 33 | 34 | #define KERNEL_ARGS_BOARD " " 35 | 36 | #ifdef CONFIG_CONSOLE_ENABLE 37 | #define KERNEL_ARGS_CONSOLE "no_console_suspend console=ttyS"STR(CONFIG_CONSOLE_INDEX)","STR(CONFIG_CONSOLE_BAUDRATE)"n8 " 38 | #else 39 | #define KERNEL_ARGS_CONSOLE "console=null " 40 | #endif 41 | 42 | #ifdef CONFIG_GET_WIFI_MAC 43 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_WIFI_MAC KERNEL_ARGS_BOARD 44 | #else 45 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_BOARD 46 | #endif 47 | 48 | #ifdef CONFIG_RECOVERY 49 | #define CONFIG_RECOVERY_BOOT_KEY GPIO_PA(10) 50 | #define CONFIG_RECOVERY_BOOT_KEY_ENLEVEL 0 51 | #define CONFIG_RECOVERY_ARGS KERNEL_ARGS_COMMON 52 | #endif /* CONFIG_RECOVERY */ 53 | 54 | #endif /* CONFIG_BOOT_KERNEL */ 55 | 56 | /* 57 | * The following configure only for NAND boot 58 | */ 59 | #ifdef CONFIG_BOOT_SPI_NAND 60 | 61 | #ifdef CONFIG_RECOVERY 62 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=4 root=ubi0:rootfs ubi.mtd=5 rootfstype=ubifs rw" 63 | #else 64 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw" 65 | #endif /* CONFIG_RECOVERY */ 66 | 67 | /* 68 | * unit(byte) 69 | */ 70 | #define CONFIG_UBOOT_OFFSET 0x6800 71 | #define CONFIG_UBOOT_LENGTH 0x40000 72 | 73 | #define CONFIG_RTOS_OFFSET 0x40000 74 | #define CONFIG_RTOS_LENGTH 0x40000 75 | 76 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 77 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 78 | 79 | #define CONFIG_KERNEL_OFFSET 0x100000 80 | #define CONFIG_KERNEL_LENGTH 0x800000 81 | 82 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 83 | 84 | #define CONFIG_KERNEL_OFFSET 0x100000 85 | #define CONFIG_KERNEL_LENGTH 0x800000 86 | 87 | #endif 88 | #endif 89 | 90 | #define CONFIG_RECOVERY_OFFSET 0x980000 91 | #define CONFIG_RECOVERY_LENGTH 0x800000 92 | 93 | #define CONFIG_WIFI_MAC_ADDR 0x901000 94 | 95 | #endif /* CONFIG_BOOT_SPI_NAND */ 96 | 97 | /* 98 | * The following configure only for NOR boot 99 | */ 100 | #ifdef CONFIG_BOOT_SPI_NOR 101 | 102 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock3 rw" 103 | 104 | /* 105 | * unit(byte) 106 | */ 107 | #define CONFIG_UBOOT_OFFSET 0x6800 108 | #define CONFIG_UBOOT_LENGTH 0x40000 109 | 110 | #define CONFIG_RTOS_OFFSET 0x40000 111 | #define CONFIG_RTOS_LENGTH 0x40000 112 | 113 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 114 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 115 | 116 | #define CONFIG_KERNEL_OFFSET 0x40000 117 | #define CONFIG_KERNEL_LENGTH 0x300000 118 | 119 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 120 | 121 | #define CONFIG_KERNEL_OFFSET 0x40000 122 | #define CONFIG_KERNEL_LENGTH 0x700000 123 | 124 | #endif 125 | #endif 126 | 127 | #define CONFIG_RECOVERY_OFFSET 0x400000 128 | #define CONFIG_RECOVERY_LENGTH 0x300000 129 | 130 | #define CONFIG_WIFI_MAC_ADDR 0x341000 131 | 132 | #endif /* CONFIG_BOOT_SPI_NOR */ 133 | 134 | /* 135 | * The following configure only for MMC boot 136 | */ 137 | #ifdef CONFIG_BOOT_MMC 138 | 139 | #define CONFIG_MMC_PA_4BIT 140 | #undef CONFIG_MMC_PA_8BIT 141 | #undef CONFIG_MMC_PC_4BIT 142 | 143 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=ext4 root=/dev/mmcblk0p3 rw" 144 | 145 | /* 146 | * unit(byte) 147 | */ 148 | #define CONFIG_UBOOT_OFFSET 0xA400 149 | #define CONFIG_UBOOT_LENGTH 0x40000 150 | 151 | #define CONFIG_RTOS_OFFSET 0x40000 152 | #define CONFIG_RTOS_LENGTH 0x40000 153 | 154 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 155 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 156 | 157 | #define CONFIG_KERNEL_OFFSET 0x300000 158 | #define CONFIG_KERNEL_LENGTH 0x800000 159 | 160 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 161 | 162 | #define CONFIG_KERNEL_OFFSET 0x100000 163 | #define CONFIG_KERNEL_LENGTH 0x800000 164 | 165 | #endif 166 | #endif 167 | 168 | #define CONFIG_RECOVERY_OFFSET 0x400000 169 | #define CONFIG_RECOVERY_LENGTH 0x300000 170 | 171 | #define CONFIG_WIFI_MAC_ADDR 0x39000 172 | 173 | #endif /* CONFIG_BOOT_MMC */ 174 | 175 | /* 176 | * OTA 177 | */ 178 | #undef CONFIG_BEIJING_OTA 179 | 180 | #ifdef CONFIG_BEIJING_OTA 181 | #define CONFIG_OTA_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=cramfs root=/dev/mtdblock4 rw" 182 | #define CONFIG_OTA_STEP2_KERNEL_OFFSET 0xd00000 183 | #endif 184 | 185 | #endif /* HALLEY2_H */ 186 | -------------------------------------------------------------------------------- /include/configs/ilock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef ILOCK_H 20 | #define ILOCK_H 21 | 22 | /* 23 | * Console 24 | */ 25 | #define CONFIG_CONSOLE_BAUDRATE 3000000 26 | #define CONFIG_CONSOLE_PC 27 | #define CONFIG_CONSOLE_INDEX 2 28 | 29 | /* 30 | * The following configure only for boot kernel 31 | */ 32 | #ifdef CONFIG_BOOT_KERNEL 33 | 34 | #define KERNEL_ARGS_BOARD " " 35 | 36 | #ifdef CONFIG_CONSOLE_ENABLE 37 | #define KERNEL_ARGS_CONSOLE "no_console_suspend console=ttyS"STR(CONFIG_CONSOLE_INDEX)","STR(CONFIG_CONSOLE_BAUDRATE)"n8 " 38 | #else 39 | #define KERNEL_ARGS_CONSOLE "console=null " 40 | #endif 41 | 42 | #ifdef CONFIG_GET_WIFI_MAC 43 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_WIFI_MAC KERNEL_ARGS_BOARD 44 | #else 45 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_BOARD 46 | #endif 47 | 48 | #ifdef CONFIG_RECOVERY 49 | #define CONFIG_RECOVERY_BOOT_KEY GPIO_PA(10) 50 | #define CONFIG_RECOVERY_BOOT_KEY_ENLEVEL 0 51 | #define CONFIG_RECOVERY_ARGS KERNEL_ARGS_COMMON 52 | #endif /* CONFIG_RECOVERY */ 53 | 54 | #endif /* CONFIG_BOOT_KERNEL */ 55 | 56 | /* 57 | * The following configure only for NAND boot 58 | */ 59 | #ifdef CONFIG_BOOT_SPI_NAND 60 | 61 | #ifdef CONFIG_RECOVERY 62 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=4 root=ubi0:rootfs ubi.mtd=5 rootfstype=ubifs rw" 63 | #else 64 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw" 65 | #endif /* CONFIG_RECOVERY */ 66 | 67 | /* 68 | * unit(byte) 69 | */ 70 | #define CONFIG_UBOOT_OFFSET 0x6800 71 | #define CONFIG_UBOOT_LENGTH 0x40000 72 | 73 | #define CONFIG_RTOS_OFFSET 0x40000 74 | #define CONFIG_RTOS_LENGTH 0x40000 75 | 76 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 77 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 78 | 79 | #define CONFIG_KERNEL_OFFSET 0x100000 80 | #define CONFIG_KERNEL_LENGTH 0x800000 81 | 82 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 83 | 84 | #define CONFIG_KERNEL_OFFSET 0x40000 85 | #define CONFIG_KERNEL_LENGTH 0x700000 86 | 87 | #endif 88 | #endif 89 | 90 | #define CONFIG_RECOVERY_OFFSET 0x980000 91 | #define CONFIG_RECOVERY_LENGTH 0x800000 92 | 93 | #define CONFIG_WIFI_MAC_ADDR 0x901000 94 | 95 | #endif /* CONFIG_BOOT_SPI_NAND */ 96 | 97 | /* 98 | * The following configure only for NOR boot 99 | */ 100 | #ifdef CONFIG_BOOT_SPI_NOR 101 | 102 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock3 rw" 103 | 104 | /* 105 | * unit(byte) 106 | */ 107 | #define CONFIG_UBOOT_OFFSET 0x6800 108 | #define CONFIG_UBOOT_LENGTH 0x40000 109 | 110 | #define CONFIG_RTOS_OFFSET 0x40000 111 | #define CONFIG_RTOS_LENGTH 0x40000 112 | 113 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 114 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 115 | 116 | #define CONFIG_KERNEL_OFFSET 0x40000 117 | #define CONFIG_KERNEL_LENGTH 0x300000 118 | 119 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 120 | 121 | #define CONFIG_KERNEL_OFFSET 0x100000 122 | #define CONFIG_KERNEL_LENGTH 0x800000 123 | 124 | #endif 125 | #endif 126 | 127 | #define CONFIG_RECOVERY_OFFSET 0x400000 128 | #define CONFIG_RECOVERY_LENGTH 0x300000 129 | 130 | #define CONFIG_WIFI_MAC_ADDR 0x341000 131 | 132 | #endif /* CONFIG_BOOT_SPI_NOR */ 133 | 134 | /* 135 | * The following configure only for MMC boot 136 | */ 137 | #ifdef CONFIG_BOOT_MMC 138 | 139 | #define CONFIG_MMC_PA_4BIT 140 | #undef CONFIG_MMC_PA_8BIT 141 | #undef CONFIG_MMC_PC_4BIT 142 | 143 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=ext4 root=/dev/mmcblk0p3 rw" 144 | 145 | /* 146 | * unit(byte) 147 | */ 148 | #define CONFIG_UBOOT_OFFSET 0xA400 149 | #define CONFIG_UBOOT_LENGTH 0x40000 150 | 151 | #define CONFIG_RTOS_OFFSET 0x40000 152 | #define CONFIG_RTOS_LENGTH 0x40000 153 | 154 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 155 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 156 | 157 | #define CONFIG_KERNEL_OFFSET 0x300000 158 | #define CONFIG_KERNEL_LENGTH 0x800000 159 | 160 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 161 | 162 | #define CONFIG_KERNEL_OFFSET 0x300000 163 | #define CONFIG_KERNEL_LENGTH 0x800000 164 | 165 | #endif 166 | #endif 167 | 168 | #define CONFIG_RECOVERY_OFFSET 0x400000 169 | #define CONFIG_RECOVERY_LENGTH 0x300000 170 | 171 | #define CONFIG_WIFI_MAC_ADDR 0x39000 172 | 173 | #endif /* CONFIG_BOOT_MMC */ 174 | 175 | /* 176 | * OTA 177 | */ 178 | #undef CONFIG_BEIJING_OTA 179 | 180 | #ifdef CONFIG_BEIJING_OTA 181 | #define CONFIG_OTA_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=cramfs root=/dev/mtdblock4 rw" 182 | #define CONFIG_OTA_STEP2_KERNEL_OFFSET 0xd00000 183 | #endif 184 | 185 | #endif /* ILOCK_H */ 186 | -------------------------------------------------------------------------------- /include/configs/phoenix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef PHOENIX_H 20 | #define PHOENIX_H 21 | 22 | /* 23 | * Console 24 | */ 25 | #define CONFIG_CONSOLE_BAUDRATE 3000000 26 | #define CONFIG_CONSOLE_PC 27 | #define CONFIG_CONSOLE_INDEX 2 28 | 29 | /* 30 | * The following configure only for boot kernel 31 | */ 32 | #ifdef CONFIG_BOOT_KERNEL 33 | 34 | #define KERNEL_ARGS_BOARD " " 35 | 36 | #ifdef CONFIG_CONSOLE_ENABLE 37 | #define KERNEL_ARGS_CONSOLE "no_console_suspend console=ttyS"STR(CONFIG_CONSOLE_INDEX)","STR(CONFIG_CONSOLE_BAUDRATE)"n8 " 38 | #else 39 | #define KERNEL_ARGS_CONSOLE "console=null " 40 | #endif 41 | 42 | #ifdef CONFIG_GET_WIFI_MAC 43 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_WIFI_MAC KERNEL_ARGS_BOARD 44 | #else 45 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_BOARD 46 | #endif 47 | 48 | #ifdef CONFIG_RECOVERY 49 | #define CONFIG_RECOVERY_BOOT_KEY -1 50 | #define CONFIG_RECOVERY_BOOT_KEY_ENLEVEL 0 51 | #define CONFIG_RECOVERY_ARGS KERNEL_ARGS_COMMON 52 | #endif /* CONFIG_RECOVERY */ 53 | 54 | #endif /* CONFIG_BOOT_KERNEL */ 55 | 56 | /* 57 | * The following configure only for NAND boot 58 | */ 59 | #ifdef CONFIG_BOOT_SPI_NAND 60 | 61 | #ifdef CONFIG_RECOVERY 62 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw" 63 | #else 64 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=2 root=ubi0:rootfs ubi.mtd=3 rootfstype=ubifs rw" 65 | #endif /* CONFIG_RECOVERY */ 66 | 67 | /* 68 | * unit(byte) 69 | */ 70 | #define CONFIG_UBOOT_OFFSET 0x6800 71 | #define CONFIG_UBOOT_LENGTH 0x40000 72 | 73 | #define CONFIG_RTOS_OFFSET 0x40000 74 | #define CONFIG_RTOS_LENGTH 0x40000 75 | 76 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 77 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 78 | 79 | #define CONFIG_KERNEL_OFFSET 0x100000 80 | #define CONFIG_KERNEL_LENGTH 0x800000 81 | 82 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 83 | 84 | #define CONFIG_KERNEL_OFFSET 0x100000 85 | #define CONFIG_KERNEL_LENGTH 0x800000 86 | 87 | #endif 88 | #endif 89 | 90 | #define CONFIG_RECOVERY_OFFSET 0x980000 91 | #define CONFIG_RECOVERY_LENGTH 0x800000 92 | 93 | #define CONFIG_WIFI_MAC_ADDR 0x901000 94 | 95 | #endif /* CONFIG_BOOT_SPI_NAND */ 96 | 97 | /* 98 | * The following configure only for NOR boot 99 | */ 100 | #ifdef CONFIG_BOOT_SPI_NOR 101 | 102 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock2 rw" 103 | 104 | /* 105 | * unit(byte) 106 | */ 107 | #define CONFIG_UBOOT_OFFSET 0x6800 108 | #define CONFIG_UBOOT_LENGTH 0x40000 109 | 110 | #define CONFIG_RTOS_OFFSET 0x40000 111 | #define CONFIG_RTOS_LENGTH 0x40000 112 | 113 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 114 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 115 | 116 | #define CONFIG_KERNEL_OFFSET 0x40000 117 | #define CONFIG_KERNEL_LENGTH 0x300000 118 | 119 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 120 | 121 | #define CONFIG_KERNEL_OFFSET 0x40000 122 | #define CONFIG_KERNEL_LENGTH 0x700000 123 | 124 | #endif 125 | #endif 126 | 127 | #define CONFIG_RECOVERY_OFFSET 0x400000 128 | #define CONFIG_RECOVERY_LENGTH 0x300000 129 | 130 | #define CONFIG_WIFI_MAC_ADDR 0x341000 131 | 132 | #endif /* CONFIG_BOOT_SPI_NOR */ 133 | 134 | /* 135 | * The following configure only for MMC boot 136 | */ 137 | #ifdef CONFIG_BOOT_MMC 138 | 139 | #define CONFIG_MMC_PA_4BIT 140 | #undef CONFIG_MMC_PA_8BIT 141 | #undef CONFIG_MMC_PC_4BIT 142 | 143 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock2 rw" 144 | 145 | /* 146 | * unit(byte) 147 | */ 148 | #define CONFIG_UBOOT_OFFSET 0xA400 149 | #define CONFIG_UBOOT_LENGTH 0x40000 150 | 151 | #define CONFIG_RTOS_OFFSET 0x40000 152 | #define CONFIG_RTOS_LENGTH 0x40000 153 | 154 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 155 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 156 | 157 | #define CONFIG_KERNEL_OFFSET 0x40000 158 | #define CONFIG_KERNEL_LENGTH 0x300000 159 | 160 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 161 | 162 | #define CONFIG_KERNEL_OFFSET 0x100000 163 | #define CONFIG_KERNEL_LENGTH 0x800000 164 | 165 | #endif 166 | #endif 167 | 168 | #define CONFIG_RECOVERY_OFFSET 0x400000 169 | #define CONFIG_RECOVERY_LENGTH 0x300000 170 | 171 | #define CONFIG_WIFI_MAC_ADDR 0x39000 172 | 173 | #endif /* CONFIG_BOOT_MMC */ 174 | 175 | /* 176 | * OTA 177 | */ 178 | #undef CONFIG_BEIJING_OTA 179 | 180 | #ifdef CONFIG_BEIJING_OTA 181 | #define CONFIG_OTA_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=cramfs root=/dev/mtdblock4 rw" 182 | #define CONFIG_OTA_STEP2_KERNEL_OFFSET 0xd00000 183 | #endif 184 | 185 | #endif /* PHOENIX_H */ 186 | -------------------------------------------------------------------------------- /include/configs/qrcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef YAK_H 20 | #define YAK_H 21 | 22 | /* 23 | * Console 24 | */ 25 | #define CONFIG_CONSOLE_BAUDRATE 3000000 26 | #define CONFIG_CONSOLE_PA 27 | #define CONFIG_CONSOLE_INDEX 2 28 | 29 | #undef CONFIG_PROBE_MEM_SIZE 30 | #undef CONFIG_MEM_SIZE_64M 31 | 32 | /* 33 | * The following configure only for boot kernel 34 | */ 35 | #ifdef CONFIG_BOOT_KERNEL 36 | 37 | #define KERNEL_ARGS_BOARD " " 38 | 39 | #ifdef CONFIG_CONSOLE_ENABLE 40 | #define KERNEL_ARGS_CONSOLE "no_console_suspend console=ttyS"STR(CONFIG_CONSOLE_INDEX)","STR(CONFIG_CONSOLE_BAUDRATE)"n8 " 41 | #else 42 | #define KERNEL_ARGS_CONSOLE "console=null " 43 | #endif 44 | 45 | #ifdef CONFIG_GET_WIFI_MAC 46 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_WIFI_MAC KERNEL_ARGS_BOARD 47 | #else 48 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_BOARD 49 | #endif 50 | 51 | #endif /* CONFIG_BOOT_KERNEL */ 52 | 53 | /* 54 | * The following configure only for NAND boot 55 | */ 56 | #ifdef CONFIG_BOOT_SPI_NAND 57 | 58 | #ifdef CONFIG_RECOVERY 59 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=4 root=ubi0:rootfs ubi.mtd=5 rootfstype=ubifs rw" 60 | #else 61 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw" 62 | #endif /* CONFIG_RECOVERY */ 63 | 64 | /* 65 | * unit(byte) 66 | */ 67 | #define CONFIG_UBOOT_OFFSET 0x6800 68 | #define CONFIG_UBOOT_LENGTH 0x40000 69 | 70 | #define CONFIG_RTOS_OFFSET 0x40000 71 | #define CONFIG_RTOS_LENGTH 0x40000 72 | 73 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 74 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 75 | 76 | #define CONFIG_KERNEL_OFFSET 0x100000 77 | #define CONFIG_KERNEL_LENGTH 0x800000 78 | 79 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 80 | 81 | #define CONFIG_KERNEL_OFFSET 0x100000 82 | #define CONFIG_KERNEL_LENGTH 0x800000 83 | 84 | #endif 85 | #endif 86 | 87 | #define CONFIG_RECOVERY_OFFSET 0x400000 88 | #define CONFIG_RECOVERY_LENGTH 0x300000 89 | 90 | #define CONFIG_WIFI_MAC_ADDR 0x901000 91 | 92 | #endif /* CONFIG_BOOT_SPI_NAND */ 93 | 94 | /* 95 | * The following configure only for NOR boot 96 | */ 97 | #ifdef CONFIG_BOOT_SPI_NOR 98 | 99 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT 100 | 101 | /* 102 | * unit(byte) 103 | */ 104 | #define CONFIG_UBOOT_OFFSET 0x6800 105 | #define CONFIG_UBOOT_LENGTH 0x40000 106 | 107 | #define CONFIG_RTOS_OFFSET 0x40000 108 | #define CONFIG_RTOS_LENGTH 0x40000 109 | 110 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 111 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 112 | 113 | #define CONFIG_KERNEL_OFFSET 0x8000 114 | #define CONFIG_KERNEL_LENGTH 0x600000 115 | 116 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 117 | 118 | #define CONFIG_KERNEL_OFFSET 0x8000 119 | #define CONFIG_KERNEL_LENGTH 0x700000 120 | 121 | #endif 122 | #endif 123 | 124 | #define CONFIG_RECOVERY_OFFSET 0x400000 125 | #define CONFIG_RECOVERY_LENGTH 0x400000 126 | 127 | #define CONFIG_WIFI_MAC_ADDR 0x341000 128 | 129 | #endif /* CONFIG_BOOT_SPI_NOR */ 130 | 131 | /* 132 | * The following configure only for MMC boot 133 | */ 134 | #ifdef CONFIG_BOOT_MMC 135 | 136 | #define CONFIG_MMC_PA_4BIT 137 | #undef CONFIG_MMC_PA_8BIT 138 | #undef CONFIG_MMC_PC_4BIT 139 | 140 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock2 rw" 141 | 142 | /* 143 | * unit(byte) 144 | */ 145 | #define CONFIG_UBOOT_OFFSET 0xA400 146 | #define CONFIG_UBOOT_LENGTH 0x40000 147 | 148 | #define CONFIG_RTOS_OFFSET 0x40000 149 | #define CONFIG_RTOS_LENGTH 0x40000 150 | 151 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 152 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 153 | 154 | #define CONFIG_KERNEL_OFFSET 0x40000 155 | #define CONFIG_KERNEL_LENGTH 0x400000 156 | 157 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 158 | 159 | #define CONFIG_KERNEL_OFFSET 0x100000 160 | #define CONFIG_KERNEL_LENGTH 0x800000 161 | 162 | #endif 163 | #endif 164 | 165 | #define CONFIG_RECOVERY_OFFSET 0x400000 166 | #define CONFIG_RECOVERY_LENGTH 0x300000 167 | 168 | #define CONFIG_WIFI_MAC_ADDR 0x39000 169 | 170 | #endif /* CONFIG_BOOT_MMC */ 171 | 172 | /* 173 | * OTA 174 | */ 175 | #undef CONFIG_BEIJING_OTA 176 | 177 | #ifdef CONFIG_BEIJING_OTA 178 | #define CONFIG_OTA_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=cramfs root=/dev/mtdblock4 rw" 179 | #define CONFIG_OTA_STEP2_KERNEL_OFFSET 0xd00000 180 | #endif 181 | 182 | #endif /* YAK_H */ 183 | -------------------------------------------------------------------------------- /include/configs/skyworth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef SKYWORTH_H 20 | #define SKYWORTH_H 21 | 22 | /* 23 | * Console 24 | */ 25 | #define CONFIG_CONSOLE_BAUDRATE 3000000 26 | #define CONFIG_CONSOLE_PC 27 | #define CONFIG_CONSOLE_INDEX 2 28 | 29 | /* 30 | * The following configure only for boot kernel 31 | */ 32 | #ifdef CONFIG_BOOT_KERNEL 33 | 34 | #define KERNEL_ARGS_BOARD " " 35 | 36 | #ifdef CONFIG_CONSOLE_ENABLE 37 | #define KERNEL_ARGS_CONSOLE "no_console_suspend console=ttyS"STR(CONFIG_CONSOLE_INDEX)","STR(CONFIG_CONSOLE_BAUDRATE)"n8 " 38 | #else 39 | #define KERNEL_ARGS_CONSOLE "console=null " 40 | #endif 41 | 42 | #ifdef CONFIG_GET_WIFI_MAC 43 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_WIFI_MAC KERNEL_ARGS_BOARD 44 | #else 45 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_BOARD 46 | #endif 47 | 48 | #ifdef CONFIG_RECOVERY 49 | #define CONFIG_RECOVERY_BOOT_KEY GPIO_PA(10) 50 | #define CONFIG_RECOVERY_BOOT_KEY_ENLEVEL 0 51 | #define CONFIG_RECOVERY_ARGS KERNEL_ARGS_COMMON 52 | #endif /* CONFIG_RECOVERY */ 53 | 54 | #endif /* CONFIG_BOOT_KERNEL */ 55 | 56 | /* 57 | * The following configure only for NAND boot 58 | */ 59 | #ifdef CONFIG_BOOT_SPI_NAND 60 | 61 | #ifdef CONFIG_RECOVERY 62 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=4 root=ubi0:rootfs ubi.mtd=5 rootfstype=ubifs rw" 63 | #else 64 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw" 65 | #endif /* CONFIG_RECOVERY */ 66 | 67 | /* 68 | * unit(byte) 69 | */ 70 | #define CONFIG_UBOOT_OFFSET 0x6800 71 | #define CONFIG_UBOOT_LENGTH 0x40000 72 | 73 | #define CONFIG_RTOS_OFFSET 0x40000 74 | #define CONFIG_RTOS_LENGTH 0x40000 75 | 76 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 77 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 78 | 79 | #define CONFIG_KERNEL_OFFSET 0x100000 80 | #define CONFIG_KERNEL_LENGTH 0x800000 81 | 82 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 83 | 84 | #define CONFIG_KERNEL_OFFSET 0x100000 85 | #define CONFIG_KERNEL_LENGTH 0x800000 86 | 87 | #endif 88 | #endif 89 | 90 | #define CONFIG_RECOVERY_OFFSET 0x980000 91 | #define CONFIG_RECOVERY_LENGTH 0x800000 92 | 93 | #define CONFIG_WIFI_MAC_ADDR 0x901000 94 | 95 | #endif /* CONFIG_BOOT_SPI_NAND */ 96 | 97 | /* 98 | * The following configure only for NOR boot 99 | */ 100 | #ifdef CONFIG_BOOT_SPI_NOR 101 | 102 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock3 rw" 103 | 104 | /* 105 | * unit(byte) 106 | */ 107 | #define CONFIG_UBOOT_OFFSET 0x6800 108 | #define CONFIG_UBOOT_LENGTH 0x40000 109 | 110 | #define CONFIG_RTOS_OFFSET 0x40000 111 | #define CONFIG_RTOS_LENGTH 0x40000 112 | 113 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 114 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 115 | 116 | #define CONFIG_KERNEL_OFFSET 0x40000 117 | #define CONFIG_KERNEL_LENGTH 0x300000 118 | 119 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 120 | 121 | #define CONFIG_KERNEL_OFFSET 0x40000 122 | #define CONFIG_KERNEL_LENGTH 0x700000 123 | 124 | #endif 125 | #endif 126 | 127 | #define CONFIG_RECOVERY_OFFSET 0x400000 128 | #define CONFIG_RECOVERY_LENGTH 0x300000 129 | 130 | #define CONFIG_WIFI_MAC_ADDR 0x341000 131 | 132 | #endif /* CONFIG_BOOT_SPI_NOR */ 133 | 134 | /* 135 | * The following configure only for MMC boot 136 | */ 137 | #ifdef CONFIG_BOOT_MMC 138 | 139 | #define CONFIG_MMC_PA_4BIT 140 | #undef CONFIG_MMC_PA_8BIT 141 | #undef CONFIG_MMC_PC_4BIT 142 | 143 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock2 rw" 144 | 145 | /* 146 | * unit(byte) 147 | */ 148 | #define CONFIG_UBOOT_OFFSET 0xA400 149 | #define CONFIG_UBOOT_LENGTH 0x40000 150 | 151 | #define CONFIG_RTOS_OFFSET 0x40000 152 | #define CONFIG_RTOS_LENGTH 0x40000 153 | 154 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 155 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 156 | 157 | #define CONFIG_KERNEL_OFFSET 0x40000 158 | #define CONFIG_KERNEL_LENGTH 0x300000 159 | 160 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 161 | 162 | #define CONFIG_KERNEL_OFFSET 0x100000 163 | #define CONFIG_KERNEL_LENGTH 0x800000 164 | 165 | #endif 166 | #endif 167 | 168 | #define CONFIG_RECOVERY_OFFSET 0x400000 169 | #define CONFIG_RECOVERY_LENGTH 0x300000 170 | 171 | #define CONFIG_WIFI_MAC_ADDR 0x39000 172 | 173 | #endif /* CONFIG_BOOT_MMC */ 174 | 175 | /* 176 | * OTA 177 | */ 178 | #undef CONFIG_BEIJING_OTA 179 | 180 | #ifdef CONFIG_BEIJING_OTA 181 | #define CONFIG_OTA_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=cramfs root=/dev/mtdblock4 rw" 182 | #define CONFIG_OTA_STEP2_KERNEL_OFFSET 0xd00000 183 | #endif 184 | 185 | #endif /* SKYWORTH_H */ 186 | -------------------------------------------------------------------------------- /include/configs/speaker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef SPEAKER_H 20 | #define SPEAKER_H 21 | 22 | /* 23 | * Console 24 | */ 25 | #define CONFIG_CONSOLE_BAUDRATE 3000000 26 | #define CONFIG_CONSOLE_PC 27 | #define CONFIG_CONSOLE_INDEX 2 28 | 29 | /* 30 | * The following configure only for boot kernel 31 | */ 32 | #ifdef CONFIG_BOOT_KERNEL 33 | 34 | #define KERNEL_ARGS_BOARD " " 35 | 36 | #ifdef CONFIG_CONSOLE_ENABLE 37 | #define KERNEL_ARGS_CONSOLE "no_console_suspend console=ttyS"STR(CONFIG_CONSOLE_INDEX)","STR(CONFIG_CONSOLE_BAUDRATE)"n8 " 38 | #else 39 | #define KERNEL_ARGS_CONSOLE "console=null " 40 | #endif 41 | 42 | #ifdef CONFIG_GET_WIFI_MAC 43 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_WIFI_MAC KERNEL_ARGS_BOARD 44 | #else 45 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_BOARD 46 | #endif 47 | 48 | #ifdef CONFIG_RECOVERY 49 | #define CONFIG_RECOVERY_BOOT_KEY -1 50 | #define CONFIG_RECOVERY_BOOT_KEY_ENLEVEL 0 51 | #define CONFIG_RECOVERY_ARGS KERNEL_ARGS_COMMON 52 | #endif 53 | 54 | #endif /* CONFIG_BOOT_KERNEL */ 55 | 56 | /* 57 | * The following configure only for NAND boot 58 | */ 59 | #ifdef CONFIG_BOOT_SPI_NAND 60 | 61 | #ifdef CONFIG_RECOVERY 62 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=4 root=ubi0:rootfs ubi.mtd=5 rootfstype=ubifs rw" 63 | #else 64 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw" 65 | #endif /* CONFIG_RECOVERY */ 66 | 67 | /* 68 | * unit(byte) 69 | */ 70 | #define CONFIG_UBOOT_OFFSET 0x6800 71 | #define CONFIG_UBOOT_LENGTH 0x40000 72 | 73 | #define CONFIG_RTOS_OFFSET 0x40000 74 | #define CONFIG_RTOS_LENGTH 0x40000 75 | 76 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 77 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 78 | 79 | #define CONFIG_KERNEL_OFFSET 0x100000 80 | #define CONFIG_KERNEL_LENGTH 0x800000 81 | 82 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 83 | 84 | #define CONFIG_KERNEL_OFFSET 0x100000 85 | #define CONFIG_KERNEL_LENGTH 0x800000 86 | 87 | #endif 88 | #endif 89 | 90 | #define CONFIG_RECOVERY_OFFSET 0x980000 91 | #define CONFIG_RECOVERY_LENGTH 0x800000 92 | 93 | #define CONFIG_WIFI_MAC_ADDR 0x901000 94 | 95 | #endif /* CONFIG_BOOT_SPI_NAND */ 96 | 97 | /* 98 | * The following configure only for NOR boot 99 | */ 100 | #ifdef CONFIG_BOOT_SPI_NOR 101 | 102 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock3 rw" 103 | 104 | /* 105 | * unit(byte) 106 | */ 107 | #define CONFIG_UBOOT_OFFSET 0x6800 108 | #define CONFIG_UBOOT_LENGTH 0x40000 109 | 110 | #define CONFIG_RTOS_OFFSET 0x40000 111 | #define CONFIG_RTOS_LENGTH 0x40000 112 | 113 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 114 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 115 | 116 | #define CONFIG_KERNEL_OFFSET 0x40000 117 | #define CONFIG_KERNEL_LENGTH 0x300000 118 | 119 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 120 | 121 | #define CONFIG_KERNEL_OFFSET 0x40000 122 | #define CONFIG_KERNEL_LENGTH 0x700000 123 | 124 | #endif 125 | #endif 126 | 127 | #define CONFIG_RECOVERY_OFFSET 0x400000 128 | #define CONFIG_RECOVERY_LENGTH 0x300000 129 | 130 | #define CONFIG_WIFI_MAC_ADDR 0x341000 131 | 132 | #endif /* CONFIG_BOOT_SPI_NOR */ 133 | 134 | /* 135 | * The following configure only for MMC boot 136 | */ 137 | #ifdef CONFIG_BOOT_MMC 138 | 139 | #define CONFIG_MMC_PA_4BIT 140 | #undef CONFIG_MMC_PA_8BIT 141 | #undef CONFIG_MMC_PC_4BIT 142 | 143 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock2 rw" 144 | 145 | /* 146 | * unit(byte) 147 | */ 148 | #define CONFIG_UBOOT_OFFSET 0xA400 149 | #define CONFIG_UBOOT_LENGTH 0x40000 150 | 151 | #define CONFIG_RTOS_OFFSET 0x40000 152 | #define CONFIG_RTOS_LENGTH 0x40000 153 | 154 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 155 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 156 | 157 | #define CONFIG_KERNEL_OFFSET 0x40000 158 | #define CONFIG_KERNEL_LENGTH 0x300000 159 | 160 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 161 | 162 | #define CONFIG_KERNEL_OFFSET 0x100000 163 | #define CONFIG_KERNEL_LENGTH 0x800000 164 | 165 | #endif 166 | #endif 167 | 168 | #define CONFIG_RECOVERY_OFFSET 0x400000 169 | #define CONFIG_RECOVERY_LENGTH 0x300000 170 | 171 | #define CONFIG_WIFI_MAC_ADDR 0x39000 172 | 173 | #endif /* CONFIG_BOOT_MMC */ 174 | 175 | /* 176 | * OTA 177 | */ 178 | #undef CONFIG_BEIJING_OTA 179 | 180 | #ifdef CONFIG_BEIJING_OTA 181 | #define CONFIG_OTA_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=cramfs root=/dev/mtdblock4 rw" 182 | #define CONFIG_OTA_STEP2_KERNEL_OFFSET 0xd00000 183 | #endif 184 | 185 | #endif /* SPEAKER_H */ 186 | -------------------------------------------------------------------------------- /include/configs/uboot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef _UBOOT_H 20 | #define _UBOOT_H 21 | 22 | /* 23 | * Console 24 | */ 25 | #define CONFIG_CONSOLE_BAUDRATE 115200 26 | #define CONFIG_CONSOLE_PC 27 | #define CONFIG_CONSOLE_INDEX 2 28 | 29 | /* 30 | * The following configure only for boot kernel 31 | */ 32 | #ifdef CONFIG_BOOT_KERNEL 33 | 34 | #define KERNEL_ARGS_BOARD " " 35 | 36 | #ifdef CONFIG_CONSOLE_ENABLE 37 | #define KERNEL_ARGS_CONSOLE "no_console_suspend console=ttyS"STR(CONFIG_CONSOLE_INDEX)","STR(CONFIG_CONSOLE_BAUDRATE)"n8 " 38 | #else 39 | #define KERNEL_ARGS_CONSOLE "console=null " 40 | #endif 41 | 42 | #ifdef CONFIG_GET_WIFI_MAC 43 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_WIFI_MAC KERNEL_ARGS_BOARD 44 | #else 45 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_BOARD 46 | #endif 47 | 48 | #ifdef CONFIG_RECOVERY 49 | #define CONFIG_RECOVERY_BOOT_KEY GPIO_PA(10) 50 | #define CONFIG_RECOVERY_BOOT_KEY_ENLEVEL 0 51 | #define CONFIG_RECOVERY_ARGS KERNEL_ARGS_COMMON 52 | #endif /* CONFIG_RECOVERY */ 53 | 54 | #endif /* CONFIG_BOOT_KERNEL */ 55 | 56 | /* 57 | * The following configure only for NAND boot 58 | */ 59 | #ifdef CONFIG_BOOT_SPI_NAND 60 | 61 | #ifdef CONFIG_RECOVERY 62 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=4 root=ubi0:rootfs ubi.mtd=5 rootfstype=ubifs rw" 63 | #else 64 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw" 65 | #endif /* CONFIG_RECOVERY */ 66 | 67 | /* 68 | * unit(byte) 69 | */ 70 | #define CONFIG_UBOOT_OFFSET (16 *1024) 71 | #define CONFIG_UBOOT_LENGTH (512 * 1024) 72 | 73 | #define CONFIG_RTOS_OFFSET 0x40000 74 | #define CONFIG_RTOS_LENGTH 0x40000 75 | 76 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 77 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 78 | 79 | #define CONFIG_KERNEL_OFFSET 0x100000 80 | #define CONFIG_KERNEL_LENGTH 0x800000 81 | 82 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 83 | 84 | #define CONFIG_KERNEL_OFFSET 0x40000 85 | #define CONFIG_KERNEL_LENGTH 0x700000 86 | 87 | #endif 88 | #endif 89 | 90 | #define CONFIG_RECOVERY_OFFSET 0x980000 91 | #define CONFIG_RECOVERY_LENGTH 0x800000 92 | 93 | #define CONFIG_WIFI_MAC_ADDR 0x901000 94 | 95 | #endif /* CONFIG_BOOT_SPI_NAND */ 96 | 97 | /* 98 | * The following configure only for NOR boot 99 | */ 100 | #ifdef CONFIG_BOOT_SPI_NOR 101 | 102 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock3 rw" 103 | 104 | /* 105 | * unit(byte) 106 | */ 107 | #define CONFIG_UBOOT_OFFSET (16 * 1024) 108 | #define CONFIG_UBOOT_LENGTH (256 * 1024) 109 | 110 | #define CONFIG_RTOS_OFFSET 0x40000 111 | #define CONFIG_RTOS_LENGTH 0x40000 112 | 113 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 114 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 115 | 116 | #define CONFIG_KERNEL_OFFSET 0x40000 117 | #define CONFIG_KERNEL_LENGTH 0x300000 118 | 119 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 120 | 121 | #define CONFIG_KERNEL_OFFSET 0x100000 122 | #define CONFIG_KERNEL_LENGTH 0x800000 123 | 124 | #endif 125 | #endif 126 | 127 | #define CONFIG_RECOVERY_OFFSET 0x400000 128 | #define CONFIG_RECOVERY_LENGTH 0x300000 129 | 130 | #define CONFIG_WIFI_MAC_ADDR 0x341000 131 | 132 | #endif /* CONFIG_BOOT_SPI_NOR */ 133 | 134 | /* 135 | * The following configure only for MMC boot 136 | */ 137 | #ifdef CONFIG_BOOT_MMC 138 | 139 | #define CONFIG_MMC_PA_4BIT 140 | #undef CONFIG_MMC_PA_8BIT 141 | #undef CONFIG_MMC_PC_4BIT 142 | 143 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=ext4 root=/dev/mmcblk0p3 rw" 144 | 145 | /* 146 | * unit(byte) 147 | */ 148 | #define CONFIG_UBOOT_OFFSET 0xA400 149 | #define CONFIG_UBOOT_LENGTH 0x40000 150 | 151 | #define CONFIG_RTOS_OFFSET 0x40000 152 | #define CONFIG_RTOS_LENGTH 0x40000 153 | 154 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 155 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 156 | 157 | #define CONFIG_KERNEL_OFFSET 0x300000 158 | #define CONFIG_KERNEL_LENGTH 0x800000 159 | 160 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 161 | 162 | #define CONFIG_KERNEL_OFFSET 0x300000 163 | #define CONFIG_KERNEL_LENGTH 0x800000 164 | 165 | #endif 166 | #endif 167 | 168 | #define CONFIG_RECOVERY_OFFSET 0x400000 169 | #define CONFIG_RECOVERY_LENGTH 0x300000 170 | 171 | #define CONFIG_WIFI_MAC_ADDR 0x39000 172 | 173 | #endif /* CONFIG_BOOT_MMC */ 174 | 175 | /* 176 | * OTA 177 | */ 178 | #undef CONFIG_BEIJING_OTA 179 | 180 | #ifdef CONFIG_BEIJING_OTA 181 | #define CONFIG_OTA_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=cramfs root=/dev/mtdblock4 rw" 182 | #define CONFIG_OTA_STEP2_KERNEL_OFFSET 0xd00000 183 | #endif 184 | 185 | #endif /* _UBOOT_H */ 186 | -------------------------------------------------------------------------------- /include/configs/yak.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef YAK_H 20 | #define YAK_H 21 | 22 | /* 23 | * Console 24 | */ 25 | #define CONFIG_CONSOLE_BAUDRATE 3000000 26 | #define CONFIG_CONSOLE_PA 27 | #define CONFIG_CONSOLE_INDEX 2 28 | 29 | #undef CONFIG_PROBE_MEM_SIZE 30 | #undef CONFIG_MEM_SIZE_64M 31 | 32 | /* 33 | * The following configure only for boot kernel 34 | */ 35 | #ifdef CONFIG_BOOT_KERNEL 36 | 37 | #define KERNEL_ARGS_BOARD " " 38 | 39 | #ifdef CONFIG_CONSOLE_ENABLE 40 | #define KERNEL_ARGS_CONSOLE "no_console_suspend console=ttyS"STR(CONFIG_CONSOLE_INDEX)","STR(CONFIG_CONSOLE_BAUDRATE)"n8 " 41 | #else 42 | #define KERNEL_ARGS_CONSOLE "console=null " 43 | #endif 44 | 45 | #ifdef CONFIG_GET_WIFI_MAC 46 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_WIFI_MAC KERNEL_ARGS_BOARD 47 | #else 48 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_BOARD 49 | #endif 50 | 51 | #ifdef CONFIG_RECOVERY 52 | #define CONFIG_RECOVERY_BOOT_KEY -1 53 | #define CONFIG_RECOVERY_BOOT_KEY_ENLEVEL 0 54 | #define CONFIG_RECOVERY_ARGS KERNEL_ARGS_COMMON 55 | #endif /* CONFIG_RECOVERY */ 56 | 57 | #endif /* CONFIG_BOOT_KERNEL */ 58 | 59 | /* 60 | * The following configure only for NAND boot 61 | */ 62 | #ifdef CONFIG_BOOT_SPI_NAND 63 | 64 | #ifdef CONFIG_RECOVERY 65 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=4 root=ubi0:rootfs ubi.mtd=5 rootfstype=ubifs rw" 66 | #else 67 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw" 68 | #endif /* CONFIG_RECOVERY */ 69 | 70 | /* 71 | * unit(byte) 72 | */ 73 | #define CONFIG_UBOOT_OFFSET 0x6800 74 | #define CONFIG_UBOOT_LENGTH 0x40000 75 | 76 | #define CONFIG_RTOS_OFFSET 0x40000 77 | #define CONFIG_RTOS_LENGTH 0x40000 78 | 79 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 80 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 81 | 82 | #define CONFIG_KERNEL_OFFSET 0x100000 83 | #define CONFIG_KERNEL_LENGTH 0x800000 84 | 85 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 86 | 87 | #define CONFIG_KERNEL_OFFSET 0x100000 88 | #define CONFIG_KERNEL_LENGTH 0x800000 89 | 90 | #endif 91 | #endif 92 | 93 | #define CONFIG_RECOVERY_OFFSET 0x400000 94 | #define CONFIG_RECOVERY_LENGTH 0x300000 95 | 96 | #define CONFIG_WIFI_MAC_ADDR 0x901000 97 | 98 | #endif /* CONFIG_BOOT_SPI_NAND */ 99 | 100 | /* 101 | * The following configure only for NOR boot 102 | */ 103 | #ifdef CONFIG_BOOT_SPI_NOR 104 | 105 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock3 rw" 106 | 107 | /* 108 | * unit(byte) 109 | */ 110 | #define CONFIG_UBOOT_OFFSET 0x6800 111 | #define CONFIG_UBOOT_LENGTH 0x40000 112 | 113 | #define CONFIG_RTOS_OFFSET 0x40000 114 | #define CONFIG_RTOS_LENGTH 0x40000 115 | 116 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 117 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 118 | 119 | #define CONFIG_KERNEL_OFFSET 0x40000 120 | #define CONFIG_KERNEL_LENGTH 0x300000 121 | 122 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 123 | 124 | #define CONFIG_KERNEL_OFFSET 0x40000 125 | #define CONFIG_KERNEL_LENGTH 0x700000 126 | 127 | #endif 128 | #endif 129 | 130 | #define CONFIG_RECOVERY_OFFSET 0x400000 131 | #define CONFIG_RECOVERY_LENGTH 0x300000 132 | 133 | #define CONFIG_WIFI_MAC_ADDR 0x341000 134 | 135 | #endif /* CONFIG_BOOT_SPI_NOR */ 136 | 137 | /* 138 | * The following configure only for MMC boot 139 | */ 140 | #ifdef CONFIG_BOOT_MMC 141 | 142 | #define CONFIG_MMC_PA_4BIT 143 | #undef CONFIG_MMC_PA_8BIT 144 | #undef CONFIG_MMC_PC_4BIT 145 | 146 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock2 rw" 147 | 148 | /* 149 | * unit(byte) 150 | */ 151 | #define CONFIG_UBOOT_OFFSET 0xA400 152 | #define CONFIG_UBOOT_LENGTH 0x40000 153 | 154 | #define CONFIG_RTOS_OFFSET 0x40000 155 | #define CONFIG_RTOS_LENGTH 0x40000 156 | 157 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 158 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 159 | 160 | #define CONFIG_KERNEL_OFFSET 0x40000 161 | #define CONFIG_KERNEL_LENGTH 0x300000 162 | 163 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 164 | 165 | #define CONFIG_KERNEL_OFFSET 0x100000 166 | #define CONFIG_KERNEL_LENGTH 0x800000 167 | 168 | #endif 169 | #endif 170 | 171 | #define CONFIG_RECOVERY_OFFSET 0x400000 172 | #define CONFIG_RECOVERY_LENGTH 0x300000 173 | 174 | #define CONFIG_WIFI_MAC_ADDR 0x39000 175 | 176 | #endif /* CONFIG_BOOT_MMC */ 177 | 178 | /* 179 | * OTA 180 | */ 181 | #undef CONFIG_BEIJING_OTA 182 | 183 | #ifdef CONFIG_BEIJING_OTA 184 | #define CONFIG_OTA_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=cramfs root=/dev/mtdblock4 rw" 185 | #define CONFIG_OTA_STEP2_KERNEL_OFFSET 0xd00000 186 | #endif 187 | 188 | #endif /* YAK_H */ 189 | -------------------------------------------------------------------------------- /include/configs/yak_minios.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef YAK_MINIOS_H 20 | #define YAK_MINIOS_H 21 | 22 | /* 23 | * Console 24 | */ 25 | #define CONFIG_CONSOLE_BAUDRATE 115200 26 | #define CONFIG_CONSOLE_PA 27 | #define CONFIG_CONSOLE_INDEX 2 28 | 29 | #undef CONFIG_PROBE_MEM_SIZE 30 | #undef CONFIG_MEM_SIZE_64M 31 | 32 | /* 33 | * The following configure only for boot kernel 34 | */ 35 | #ifdef CONFIG_BOOT_KERNEL 36 | 37 | #define KERNEL_ARGS_BOARD " " 38 | 39 | #ifdef CONFIG_CONSOLE_ENABLE 40 | #define KERNEL_ARGS_CONSOLE "no_console_suspend console=ttyS"STR(CONFIG_CONSOLE_INDEX)","STR(CONFIG_CONSOLE_BAUDRATE)"n8 " 41 | #else 42 | #define KERNEL_ARGS_CONSOLE "console=null " 43 | #endif 44 | 45 | #ifdef CONFIG_GET_WIFI_MAC 46 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_WIFI_MAC KERNEL_ARGS_BOARD 47 | #else 48 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_BOARD 49 | #endif 50 | 51 | #ifdef CONFIG_RECOVERY 52 | #define CONFIG_RECOVERY_BOOT_KEY -1 53 | #define CONFIG_RECOVERY_BOOT_KEY_ENLEVEL 0 54 | #define CONFIG_RECOVERY_ARGS KERNEL_ARGS_COMMON 55 | #endif /* CONFIG_RECOVERY */ 56 | 57 | #endif /* CONFIG_BOOT_KERNEL */ 58 | 59 | /* 60 | * The following configure only for NAND boot 61 | */ 62 | #ifdef CONFIG_BOOT_SPI_NAND 63 | 64 | #ifdef CONFIG_RECOVERY 65 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=4 root=ubi0:rootfs ubi.mtd=5 rootfstype=ubifs rw" 66 | #else 67 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw" 68 | #endif /* CONFIG_RECOVERY */ 69 | 70 | /* 71 | * unit(byte) 72 | */ 73 | #define CONFIG_UBOOT_OFFSET 0x6800 74 | #define CONFIG_UBOOT_LENGTH 0x40000 75 | 76 | #define CONFIG_RTOS_OFFSET 0x40000 77 | #define CONFIG_RTOS_LENGTH 0x40000 78 | 79 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 80 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 81 | 82 | #define CONFIG_KERNEL_OFFSET 0x100000 83 | #define CONFIG_KERNEL_LENGTH 0x800000 84 | 85 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 86 | 87 | #define CONFIG_KERNEL_OFFSET 0x100000 88 | #define CONFIG_KERNEL_LENGTH 0x800000 89 | 90 | #endif 91 | #endif 92 | 93 | #define CONFIG_RECOVERY_OFFSET 0x400000 94 | #define CONFIG_RECOVERY_LENGTH 0x300000 95 | 96 | #define CONFIG_WIFI_MAC_ADDR 0x901000 97 | 98 | #endif /* CONFIG_BOOT_SPI_NAND */ 99 | 100 | /* 101 | * The following configure only for NOR boot 102 | */ 103 | #ifdef CONFIG_BOOT_SPI_NOR 104 | 105 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock3 rw" 106 | 107 | /* 108 | * unit(byte) 109 | */ 110 | #define CONFIG_UBOOT_OFFSET 0x6800 111 | #define CONFIG_UBOOT_LENGTH 0x40000 112 | 113 | #define CONFIG_RTOS_OFFSET 0x40000 114 | #define CONFIG_RTOS_LENGTH 0x40000 115 | 116 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 117 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 118 | 119 | #define CONFIG_KERNEL_OFFSET 0x40000 120 | #define CONFIG_KERNEL_LENGTH 0x300000 121 | 122 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 123 | 124 | #define CONFIG_KERNEL_OFFSET 0x40000 125 | #define CONFIG_KERNEL_LENGTH 0x700000 126 | 127 | #endif 128 | #endif 129 | 130 | #define CONFIG_RECOVERY_OFFSET 0x400000 131 | #define CONFIG_RECOVERY_LENGTH 0x300000 132 | 133 | #define CONFIG_WIFI_MAC_ADDR 0x341000 134 | 135 | #endif /* CONFIG_BOOT_SPI_NOR */ 136 | 137 | /* 138 | * The following configure only for MMC boot 139 | */ 140 | #ifdef CONFIG_BOOT_MMC 141 | 142 | #define CONFIG_MMC_PA_4BIT 143 | #undef CONFIG_MMC_PA_8BIT 144 | #undef CONFIG_MMC_PC_4BIT 145 | 146 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock2 rw" 147 | 148 | /* 149 | * unit(byte) 150 | */ 151 | #define CONFIG_UBOOT_OFFSET 0xA400 152 | #define CONFIG_UBOOT_LENGTH 0x40000 153 | 154 | #define CONFIG_RTOS_OFFSET 0x40000 155 | #define CONFIG_RTOS_LENGTH 0x40000 156 | 157 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 158 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 159 | 160 | #define CONFIG_KERNEL_OFFSET 0x40000 161 | #define CONFIG_KERNEL_LENGTH 0x300000 162 | 163 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 164 | 165 | #define CONFIG_KERNEL_OFFSET 0x100000 166 | #define CONFIG_KERNEL_LENGTH 0x800000 167 | 168 | #endif 169 | #endif 170 | 171 | #define CONFIG_RECOVERY_OFFSET 0x400000 172 | #define CONFIG_RECOVERY_LENGTH 0x300000 173 | 174 | #define CONFIG_WIFI_MAC_ADDR 0x39000 175 | 176 | #endif /* CONFIG_BOOT_MMC */ 177 | 178 | /* 179 | * OTA 180 | */ 181 | #undef CONFIG_BEIJING_OTA 182 | 183 | #ifdef CONFIG_BEIJING_OTA 184 | #define CONFIG_OTA_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=cramfs root=/dev/mtdblock4 rw" 185 | #define CONFIG_OTA_STEP2_KERNEL_OFFSET 0xd00000 186 | #endif 187 | 188 | #endif /* YAK_MINIOS_H */ 189 | -------------------------------------------------------------------------------- /include/configs/zlm60.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef ZLM60_H 20 | #define ZLM60_H 21 | 22 | /* 23 | * Console 24 | */ 25 | #define CONFIG_CONSOLE_BAUDRATE 115200 26 | #define CONFIG_CONSOLE_PC 27 | #define CONFIG_CONSOLE_INDEX 2 28 | 29 | #define CONFIG_RTCCLK_SRC_EXT 30 | 31 | /* 32 | * The following configure only for boot kernel 33 | */ 34 | #ifdef CONFIG_BOOT_KERNEL 35 | 36 | #define KERNEL_ARGS_BOARD " " 37 | 38 | #ifdef CONFIG_CONSOLE_ENABLE 39 | #define KERNEL_ARGS_CONSOLE "no_console_suspend console=ttyS"STR(CONFIG_CONSOLE_INDEX)","STR(CONFIG_CONSOLE_BAUDRATE)"n8 " 40 | #else 41 | #define KERNEL_ARGS_CONSOLE "console=null " 42 | #endif 43 | 44 | #ifdef CONFIG_GET_WIFI_MAC 45 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_WIFI_MAC KERNEL_ARGS_BOARD 46 | #else 47 | #define KERNEL_ARGS_COMMON KERNEL_ARGS_MEM KERNEL_ARGS_CONSOLE KERNEL_ARGS_OTHERS KERNEL_ARGS_BOARD 48 | #endif 49 | 50 | #ifdef CONFIG_RECOVERY 51 | #define CONFIG_RECOVERY_BOOT_KEY GPIO_PA(10) 52 | #define CONFIG_RECOVERY_BOOT_KEY_ENLEVEL 0 53 | #define CONFIG_RECOVERY_ARGS KERNEL_ARGS_COMMON 54 | #endif /* CONFIG_RECOVERY */ 55 | 56 | #endif /* CONFIG_BOOT_KERNEL */ 57 | 58 | /* 59 | * The following configure only for NAND boot 60 | */ 61 | #ifdef CONFIG_BOOT_SPI_NAND 62 | 63 | #ifdef CONFIG_RECOVERY 64 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=4 root=ubi0:rootfs ubi.mtd=5 rootfstype=ubifs rw" 65 | #else 66 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw" 67 | #endif /* CONFIG_RECOVERY */ 68 | 69 | /* 70 | * unit(byte) 71 | */ 72 | 73 | #define CONFIG_UBOOT_OFFSET 0x4000 74 | #define CONFIG_UBOOT_LENGTH 0x40000 75 | 76 | #define CONFIG_RTOS_OFFSET 0x40000 77 | #define CONFIG_RTOS_LENGTH 0x40000 78 | 79 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 80 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 81 | 82 | #define CONFIG_KERNEL_OFFSET 0x100000 83 | #define CONFIG_KERNEL_LENGTH 0x800000 84 | 85 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 86 | 87 | #define CONFIG_KERNEL_OFFSET 0x100000 88 | #define CONFIG_KERNEL_LENGTH 0x800000 89 | 90 | #endif 91 | #endif 92 | 93 | #define CONFIG_RECOVERY_OFFSET 0x980000 94 | #define CONFIG_RECOVERY_LENGTH 0x800000 95 | 96 | #define CONFIG_WIFI_MAC_ADDR 0x901000 97 | 98 | #endif /* CONFIG_BOOT_SPI_NAND */ 99 | 100 | /* 101 | * The following configure only for NOR boot 102 | */ 103 | #ifdef CONFIG_BOOT_SPI_NOR 104 | 105 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock3 rw" 106 | 107 | /* 108 | * unit(byte) 109 | */ 110 | #define CONFIG_UBOOT_OFFSET 0x6800 111 | #define CONFIG_UBOOT_LENGTH 0x40000 112 | 113 | #define CONFIG_RTOS_OFFSET 0x40000 114 | #define CONFIG_RTOS_LENGTH 0x40000 115 | 116 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 117 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 118 | 119 | #define CONFIG_KERNEL_OFFSET 0x40000 120 | #define CONFIG_KERNEL_LENGTH 0x300000 121 | 122 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 123 | 124 | #define CONFIG_KERNEL_OFFSET 0x40000 125 | #define CONFIG_KERNEL_LENGTH 0x700000 126 | 127 | #endif 128 | #endif 129 | 130 | #define CONFIG_RECOVERY_OFFSET 0x400000 131 | #define CONFIG_RECOVERY_LENGTH 0x300000 132 | 133 | #define CONFIG_WIFI_MAC_ADDR 0x341000 134 | 135 | #endif /* CONFIG_BOOT_SPI_NOR */ 136 | 137 | /* 138 | * The following configure only for MMC boot 139 | */ 140 | #ifdef CONFIG_BOOT_MMC 141 | 142 | #define CONFIG_MMC_PA_4BIT 143 | #undef CONFIG_MMC_PA_8BIT 144 | #undef CONFIG_MMC_PC_4BIT 145 | 146 | #define CONFIG_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=jffs2 root=/dev/mtdblock2 rw" 147 | 148 | /* 149 | * unit(byte) 150 | */ 151 | #define CONFIG_UBOOT_OFFSET 0xA400 152 | #define CONFIG_UBOOT_LENGTH 0x40000 153 | 154 | #define CONFIG_RTOS_OFFSET 0x40000 155 | #define CONFIG_RTOS_LENGTH 0x40000 156 | 157 | #ifdef CONFIG_KERNEL_IMAGE_TYPE 158 | #if (CONFIG_KERNEL_IMAGE_TYPE == ZIMAGE || CONFIG_KERNEL_IMAGE_TYPE == XIMAGE) 159 | 160 | #define CONFIG_KERNEL_OFFSET 0x40000 161 | #define CONFIG_KERNEL_LENGTH 0x300000 162 | 163 | #elif (CONFIG_KERNEL_IMAGE_TYPE == VMLINUX) 164 | 165 | #define CONFIG_KERNEL_OFFSET 0x100000 166 | #define CONFIG_KERNEL_LENGTH 0x800000 167 | 168 | #endif 169 | #endif 170 | 171 | #define CONFIG_RECOVERY_OFFSET 0x400000 172 | #define CONFIG_RECOVERY_LENGTH 0x300000 173 | 174 | #define CONFIG_WIFI_MAC_ADDR 0x39000 175 | 176 | #endif /* CONFIG_BOOT_MMC */ 177 | 178 | /* 179 | * OTA 180 | */ 181 | #undef CONFIG_BEIJING_OTA 182 | 183 | #ifdef CONFIG_BEIJING_OTA 184 | #define CONFIG_OTA_KERNEL_ARGS KERNEL_ARGS_COMMON KERNEL_ARGS_INIT "rootfstype=cramfs root=/dev/mtdblock4 rw" 185 | #define CONFIG_OTA_STEP2_KERNEL_OFFSET 0xd00000 186 | #endif 187 | 188 | #endif /* ZLM60_H */ 189 | -------------------------------------------------------------------------------- /include/efuse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Wang Qiuwei 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | 20 | #ifndef EFUSE_H 21 | #define EFUSE_H 22 | 23 | #define EFU_ROM_BASE (0x200) 24 | 25 | #define CHIP_ID_ADDR (0x200) 26 | #define CHIP_ID_END (0x20F) 27 | #define CHIP_ID_SIZE (128) 28 | #define RN_ADDR (0x210) 29 | #define RN_END (0x21F) 30 | #define RN_SIZE (128) 31 | #define CUT_ID_ADDR (0x220) 32 | #define CUT_ID_END (0x23D) 33 | #define CUT_ID_SIZE (240) 34 | #define PTR_ADDR (0x23E) 35 | #define PTR_END (0x23F) 36 | #define PTR_SIZE (16) 37 | 38 | #define efuse_readl(offset) readl(EFUSE_BASE + offset) 39 | #define efuse_writel(value, offset) writel(value, EFUSE_BASE + offset) 40 | 41 | int efuse_read(void *buf, uint32_t addr, int length); 42 | 43 | #endif /* EFUSE */ 44 | -------------------------------------------------------------------------------- /include/gpio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef GPIO_H 20 | #define GPIO_H 21 | 22 | #define GPIO_PA(n) (0*32 + n) 23 | #define GPIO_PB(n) (1*32 + n) 24 | #define GPIO_PC(n) (2*32 + n) 25 | #define GPIO_PD(n) (3*32 + n) 26 | 27 | #define GSS_OUTPUT_LOW 1 28 | #define GSS_OUTPUT_HIGH 2 29 | #define GSS_INPUT_PULL 3 30 | #define GSS_INPUT_NOPULL 4 31 | #define GSS_IGNORE 5 32 | #define GSS_TABLET_END 0x999 33 | 34 | enum gpio_function { 35 | GPIO_FUNC_0 = 0x00, //0000, GPIO as function 0 / device 0 36 | GPIO_FUNC_1 = 0x01, //0001, GPIO as function 1 / device 1 37 | GPIO_FUNC_2 = 0x02, //0010, GPIO as function 2 / device 2 38 | GPIO_FUNC_3 = 0x03, //0011, GPIO as function 3 / device 3 39 | }; 40 | 41 | enum gpio_port { 42 | GPIO_PORT_Z = 0x07, 43 | GPIO_PORT_A = 0x0, 44 | GPIO_PORT_B, 45 | GPIO_PORT_C, 46 | GPIO_PORT_D, 47 | /* this must be last */ 48 | GPIO_NR_PORTS, 49 | }; 50 | 51 | #define MAX_GPIO_NUM 192 52 | 53 | #define PXPIN 0x00 /* PIN Level Register */ 54 | #define PXINT 0x10 /* Port Interrupt Register */ 55 | #define PXINTS 0x14 /* Port Interrupt Set Register */ 56 | #define PXINTC 0x18 /* Port Interrupt Clear Register */ 57 | #define PXMSK 0x20 /* Port Interrupt Mask Reg */ 58 | #define PXMSKS 0x24 /* Port Interrupt Mask Set Reg */ 59 | #define PXMSKC 0x28 /* Port Interrupt Mask Clear Reg */ 60 | #define PXPAT1 0x30 /* Port Pattern 1 Set Reg. */ 61 | #define PXPAT1S 0x34 /* Port Pattern 1 Set Reg. */ 62 | #define PXPAT1C 0x38 /* Port Pattern 1 Clear Reg. */ 63 | #define PXPAT0 0x40 /* Port Pattern 0 Register */ 64 | #define PXPAT0S 0x44 /* Port Pattern 0 Set Register */ 65 | #define PXPAT0C 0x48 /* Port Pattern 0 Clear Register */ 66 | #define PXFLG 0x50 /* Port Flag Register */ 67 | #define PXFLGC 0x58 /* Port Flag clear Register */ 68 | #define PXPE 0x70 /* Port Pull Disable Register */ 69 | #define PXPES 0x74 /* Port Pull Disable Set Register */ 70 | #define PXPEC 0x78 /* Port Pull Disable Clear Register */ 71 | #define PZGID2LD 0xF0 /* GPIOZ Group ID to load */ 72 | 73 | #define GPIO_PXPIN(n) (GPIO_BASE + (PXPIN + (n)*0x100)) /* PIN Level Register */ 74 | #define GPIO_PXINT(n) (GPIO_BASE + (PXINT + (n)*0x100)) /* Port Interrupt Register */ 75 | #define GPIO_PXINTS(n) (GPIO_BASE + (PXINTS + (n)*0x100)) /* Port Interrupt Set Register */ 76 | #define GPIO_PXINTC(n) (GPIO_BASE + (PXINTC + (n)*0x100)) /* Port Interrupt Clear Register */ 77 | #define GPIO_PXMSK(n) (GPIO_BASE + (PXMSK + (n)*0x100)) /* Port Interrupt Mask Register */ 78 | #define GPIO_PXMSKS(n) (GPIO_BASE + (PXMSKS + (n)*0x100)) /* Port Interrupt Mask Set Reg */ 79 | #define GPIO_PXMSKC(n) (GPIO_BASE + (PXMSKC + (n)*0x100)) /* Port Interrupt Mask Clear Reg */ 80 | #define GPIO_PXPAT1(n) (GPIO_BASE + (PXPAT1 + (n)*0x100)) /* Port Pattern 1 Register */ 81 | #define GPIO_PXPAT1S(n) (GPIO_BASE + (PXPAT1S + (n)*0x100)) /* Port Pattern 1 Set Reg. */ 82 | #define GPIO_PXPAT1C(n) (GPIO_BASE + (PXPAT1C + (n)*0x100)) /* Port Pattern 1 Clear Reg. */ 83 | #define GPIO_PXPAT0(n) (GPIO_BASE + (PXPAT0 + (n)*0x100)) /* Port Pattern 0 Register */ 84 | #define GPIO_PXPAT0S(n) (GPIO_BASE + (PXPAT0S + (n)*0x100)) /* Port Pattern 0 Set Register */ 85 | #define GPIO_PXPAT0C(n) (GPIO_BASE + (PXPAT0C + (n)*0x100)) /* Port Pattern 0 Clear Register */ 86 | #define GPIO_PXFLG(n) (GPIO_BASE + (PXFLG + (n)*0x100)) /* Port Flag Register */ 87 | #define GPIO_PXFLGC(n) (GPIO_BASE + (PXFLGC + (n)*0x100)) /* Port Flag clear Register */ 88 | #define GPIO_PXPE(n) (GPIO_BASE + (PXPE + (n)*0x100)) /* Port Pull Disable Register */ 89 | #define GPIO_PXPES(n) (GPIO_BASE + (PXPES + (n)*0x100)) /* Port Pull Disable Set Register */ 90 | #define GPIO_PXPEC(n) (GPIO_BASE + (PXPEC + (n)*0x100)) /* Port Pull Disable Clear Register */ 91 | #define GPIO_PZLOAD (GPIO_BASE + (PZGID2LD + (0x07)*0x100)) /* GPIOZ Group ID to load */ 92 | 93 | void gpio_set_func(unsigned int gpio, enum gpio_function func); 94 | void gpio_enable_pull(unsigned gpio); 95 | void gpio_disable_pull(unsigned gpio); 96 | void gpio_direction_input(unsigned gpio); 97 | void gpio_direction_output(unsigned gpio, int value); 98 | int gpio_get_value(unsigned gpio); 99 | 100 | void mmc_set_gpio(void); 101 | void sfc_set_gpio_pa_as_6bit(void); 102 | void console_set_gpio(void); 103 | 104 | #endif /* GPIO_H */ 105 | -------------------------------------------------------------------------------- /include/i2c.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright 2001, 2002 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4 | * 5 | * See file CREDITS for list of people who contributed to this 6 | * project. 7 | * 8 | * This program is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public License as 10 | * published by the Free Software Foundation; either version 2 of 11 | * the License, or (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21 | * MA 02111-1307 USA 22 | * 23 | * This has been changed substantially by Gerald Van Baren, Custom IDEAS, 24 | * vanbaren@cideas.com. It was heavily influenced by LiMon, written by 25 | * Neil Russell. 26 | */ 27 | 28 | #ifndef I2C_H 29 | #define I2C_H 30 | 31 | struct i2c { 32 | unsigned int scl; 33 | unsigned int sda; 34 | }; 35 | 36 | void i2c_init(struct i2c *i2c); 37 | int i2c_write(struct i2c *i2c, uint8_t chip, uint32_t addr, uint32_t alen, 38 | uint8_t *buffer, uint32_t len); 39 | int i2c_read(struct i2c *i2c,uint8_t chip, uint32_t addr, uint32_t alen, 40 | uint8_t *buffer, uint32_t len); 41 | int i2c_probe(struct i2c *i2c, uint8_t addr); 42 | 43 | #endif /* I2C_H */ 44 | -------------------------------------------------------------------------------- /include/lpddr/chip/MDDR_H5MS5122DFR_J3M.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDDR_CONFIG_H 2 | #define __MDDR_CONFIG_H 3 | 4 | /* 5 | * This file contains the memory configuration parameters for the cygnus board. 6 | */ 7 | /*-------------------------------------------------------------------------------- 8 | * MDDR info 9 | */ 10 | /* Chip Select */ 11 | //#define DDR_CS1EN 1 // CSEN : whether a ddr chip exists 0 - un-used, 1 - used 12 | //#define DDR_CS0EN 1 13 | //#define DDR_DW32 1/* 0 - 16-bit data width, 1 - 32-bit data width */ 14 | 15 | /* MDDR paramters */ 16 | #define DDR_ROW 13 /* ROW : 12 to 14 row address */ 17 | #define DDR_ROW1 13 /* ROW : 12 to 14 row address */ 18 | #ifdef CONFIG_MEM_SIZE_64M 19 | #define DDR_COL 10/* COL : 8 to 10 column address */ 20 | #define DDR_COL1 10/* COL : 8 to 10 column address */ 21 | #else 22 | #define DDR_COL 9/* COL : 8 to 10 column address */ 23 | #define DDR_COL1 9/* COL : 8 to 10 column address */ 24 | #endif 25 | 26 | #define DDR_BANK8 0 /* Banks each chip: 0-4bank, 1-8bank 0 for falcon fpga, 1 for develop board */ 27 | #define DDR_CL 4 /* CAS latency: 1 to 7 */ 28 | 29 | /* 30 | * MDDR controller timing1 register 31 | */ 32 | #define DDR_tRAS 45 /*tRAS: ACTIVE to PRECHARGE command period to the same bank. */ 33 | #define DDR_tRTP MAX(2,0) /* 7.5ns READ to PRECHARGE command period. */ 34 | #define DDR_tRP 18 /* tRP: PRECHARGE command period to the same bank */ 35 | #define DDR_tRCD 18 /* ACTIVE to READ or WRITE command period to the same bank. */ 36 | #define DDR_tRC (DDR_tRAS + DDR_tRP) /* ACTIVE to ACTIVE command period to the same bank.*/ 37 | #define DDR_tRRD 12 /* ACTIVE bank A to ACTIVE bank B command period. */ 38 | #define DDR_tWR 15 /* WRITE Recovery Time defined by register MR of DDR2 memory */ 39 | #define DDR_tWTR MAX(2,0) /* WRITE to READ command delay. */ 40 | 41 | /* 42 | * MDDR controller timing2 register 43 | */ 44 | #define DDR_tRFC 120 /* ns, AUTO-REFRESH command period. */ 45 | #define DDR_tMINSR DDR_GET_VALUE(DDR_tRFC, tck_g.ps) /* Minimum Self-Refresh / Deep-Power-Down */ 46 | #define DDR_tXP 5 /* EXIT-POWER-DOWN to next valid command period: 1 to 8 tCK. */ 47 | #define DDR_tMRD 2 /* unit: tCK Load-Mode-Register to next valid command period: 1 to 4 tCK */ 48 | 49 | /* new add */ 50 | #define DDR_BL 4 /* MDDR Burst length: 3 - 8 burst, 2 - 4 burst , 1 - 2 burst*/ 51 | #define DDR_tAL 0 /* Additive Latency, tCK*/ 52 | #define DDR_tRL (DDR_tAL + DDR_CL) /* MDDR: Read Latency = tAL + tCL */ 53 | #define DDR_tWL 1 /* MDDR: must 1 */ 54 | #define DDR_tRDLAT (DDR_tRL - 2) 55 | #define DDR_tWDLAT (DDR_tWL - 1) 56 | #define DDR_tCCD 4 /* CAS# to CAS# command delay , tCK, MDDR no*/ 57 | #define DDR_tRTW (DDR_tRL + DDR_tCCD + 2 - DDR_tWL) /* Read to Write delay */ 58 | #define DDR_tFAW 50 /* Four bank activate period, ns, MDDR no */ 59 | #define DDR_tCKE 3 /* CKE minimum pulse width, tCK */ 60 | #define DDR_tXS 200 /* Exit self-refresh to next valid command delay, ns */ 61 | #define DDR_tXSRD DDR_GET_VALUE(DDR_tXS,tck_g.ps) /* DDR2 only: Exit self refresh to a read command, tck */ 62 | #define DDR_tCKSRE MAX(1,0) /* Valid Clock Requirement after Self Refresh Entry or Power-Down Entry */ 63 | 64 | /* 65 | * MDDR controller refcnt register 66 | */ 67 | #define DDR_tREFI 7800 /* Refresh period: 4096 refresh cycles/64ms */ 68 | 69 | #define DDR_CLK_DIV 1 /* Clock Divider. auto refresh 70 | * cnt_clk = memclk/(16*(2^DDR_CLK_DIV)) 71 | */ 72 | 73 | #endif /* __MDDR_CONFIG_H */ 74 | 75 | 76 | -------------------------------------------------------------------------------- /include/lpddr/lpddr_chip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef LPDDR_CHIP_H 20 | #define LPDDR_CHIP_H 21 | 22 | #ifdef CONFIG_MDDR_H5MS5122DFR_J3M 23 | #include "./chip/MDDR_H5MS5122DFR_J3M.h" 24 | #endif 25 | 26 | #endif /* LPDDR_CHIP_H */ 27 | -------------------------------------------------------------------------------- /include/mmc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef MMC_H 20 | #define MMC_H 21 | 22 | int mmc_init(void); 23 | int mmc_read(uint32_t offset, uint32_t length, uint32_t dest); 24 | 25 | #endif /* MMC_H */ 26 | -------------------------------------------------------------------------------- /include/pmon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef PMON_H 20 | #define PMON_H 21 | 22 | #include 23 | 24 | #define get_pmon_csr() __read_32bit_c0_register($16, 7) 25 | #define set_pmon_csr(val) __write_32bit_c0_register($16, 7, val) 26 | 27 | #define get_pmon_high() __read_32bit_c0_register($16, 4) 28 | #define set_pmon_high(val) __write_32bit_c0_register($16, 4, val) 29 | #define get_pmon_lc() __read_32bit_c0_register($16, 5) 30 | #define set_pmon_lc(val) __write_32bit_c0_register($16, 5, val) 31 | #define get_pmon_rc() __read_32bit_c0_register($16, 6) 32 | #define set_pmon_rc(val) __write_32bit_c0_register($16, 6, val) 33 | 34 | #define pmon_clear_cnt() do { \ 35 | set_pmon_high(0); \ 36 | set_pmon_lc(0); \ 37 | set_pmon_rc(0); \ 38 | } while(0) 39 | 40 | #define pmon_start() do { \ 41 | unsigned int csr; \ 42 | csr = get_pmon_csr(); \ 43 | csr |= 0x100; \ 44 | set_pmon_csr(csr); \ 45 | } while(0) 46 | #define pmon_stop() do { \ 47 | unsigned int csr; \ 48 | csr = get_pmon_csr(); \ 49 | csr &= ~0x100; \ 50 | set_pmon_csr(csr); \ 51 | } while(0) 52 | 53 | #define PMON_EVENT_CYCLE 0 54 | #define PMON_EVENT_CACHE 1 55 | #define PMON_EVENT_INST 2 56 | 57 | #define pmon_prepare(event) do { \ 58 | unsigned int csr; \ 59 | pmon_stop(); \ 60 | pmon_clear_cnt(); \ 61 | csr = get_pmon_csr(); \ 62 | csr &= ~0xf000; \ 63 | csr |= (event)<<12; \ 64 | set_pmon_csr(csr); \ 65 | } while(0) 66 | 67 | 68 | #define pmon_get_cnt32(lc,rc) do { \ 69 | lc = get_pmon_lc(); \ 70 | rc = get_pmon_rc(); \ 71 | } while(0) 72 | 73 | 74 | #define pmon_btb_invalid() do { \ 75 | unsigned int csr; \ 76 | csr = get_pmon_csr(); \ 77 | csr |= 0x2; \ 78 | set_pmon_csr(csr); \ 79 | } while(0) 80 | 81 | #define pmon_btb_enable() do { \ 82 | unsigned int csr; \ 83 | csr = get_pmon_csr(); \ 84 | csr &= ~0x1; \ 85 | set_pmon_csr(csr); \ 86 | } while(0) 87 | 88 | #define pmon_btb_disable() do { \ 89 | pmon_btb_invalid(); \ 90 | unsigned int csr; \ 91 | csr = get_pmon_csr(); \ 92 | csr |= 0x1; \ 93 | set_pmon_csr(csr); \ 94 | } while(0) 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /include/pmu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | void pmu_init(void); 20 | void pmu_set_voltage(void); 21 | -------------------------------------------------------------------------------- /include/rtc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #define RTC_RTCCR 0x00 20 | #define RTC_RTCSR 0x04 21 | #define RTC_RTCSAR 0x08 22 | #define RTC_RTCGR 0x0C 23 | 24 | #define RTC_HCR 0x20 25 | #define RTC_HWFCR 0x24 26 | #define RTC_HRCR 0x28 27 | #define RTC_HWCR 0x2C 28 | #define RTC_HWRSR 0x30 29 | #define RTC_HSPR 0x34 30 | #define RTC_WENR 0x3C 31 | #define RTC_CKPCR 0x40 32 | #define RTC_PWRONCR 0x48 33 | 34 | /* RTC Control Register */ 35 | #define RTC_RTCCR_WRDY (1 << 7) 36 | #define RTC_RTCCR_1HZ (1 << 6) 37 | #define RTC_RTCCR_1HZIE (1 << 5) 38 | #define RTC_RTCCR_AF (1 << 4) 39 | #define RTC_RTCCR_AIE (1 << 3) 40 | #define RTC_RTCCR_AE (1 << 2) 41 | #define RTC_RTCCR_SELEXC (1 << 1) 42 | #define RTC_RTCCR_RTCE (1 << 0) 43 | 44 | /* Write Enable Pattern Register */ 45 | #define RTC_WENR_WEN (1 << 31) 46 | #define RTC_WENR_WENPAT_BIT 0 47 | #define RTC_WENR_WENPAT_MASK (0xffff << RTC_WENR_WENPAT_BIT) 48 | 49 | /* HIBERNATE Wakeup Status Register */ 50 | #define RTC_HWRSR_APD (1 << 8) 51 | #define RTC_HWRSR_HR (1 << 5) 52 | #define RTC_HWRSR_PPR (1 << 4) 53 | #define RTC_HWRSR_PIN (1 << 1) 54 | #define RTC_HWRSR_ALM (1 << 0) 55 | 56 | #define RTC_HCR_PD 1 57 | 58 | /* HIBERNATE mode Wakeup Filter Counter Register */ 59 | #define RTC_HWFCR_HWFCR_BIT 5 60 | #define RTC_HWFCR_HWFCR_MASK (0x7ff << RTC_HWFCR_HWFCR_BIT) 61 | #define HWFCR_WAIT_TIME(ms) \ 62 | (((ms) << RTC_HWFCR_HWFCR_BIT) > RTC_HWFCR_HWFCR_MASK ? \ 63 | RTC_HWFCR_HWFCR_MASK : ((ms) << RTC_HWFCR_HWFCR_BIT)) 64 | 65 | /* HIBERNATE Reset Counter Register */ 66 | #define RTC_HRCR_HRCR_BIT 11 67 | #define RTC_HRCR_HRCR_MASK (0xf << RTC_HRCR_HRCR_BIT) 68 | #define HRCR_WAIT_TIME(ms) \ 69 | (ms < 62 ? 0 : (((ms / 62 - 1) << RTC_HRCR_HRCR_BIT) > \ 70 | RTC_HRCR_HRCR_MASK ? RTC_HRCR_HRCR_MASK : \ 71 | ((ms / 62 - 1) << RTC_HRCR_HRCR_BIT))) 72 | 73 | #define RTC_WENR_WENPAT_WRITABLE (0xa55a) 74 | 75 | #define rtc_inl(off) readl(RTC_BASE + (off)) 76 | #define rtc_outl(val,off) writel(val, RTC_BASE + (off)) 77 | #define rtc_test_bit(bit,off) (rtc_inl(off) & (0x1<<(bit))) 78 | #define rtc_set_bit(bit,off) (rtc_outl((rtc_inl(off) | 0x1<<(bit)),off)) 79 | #define rtc_clear_bit(bit,off) (rtc_outl(rtc_inl(off) & ~(0x1 << bit), off)) 80 | 81 | void rtc_clk_src_to_ext(void); 82 | -------------------------------------------------------------------------------- /include/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef TYPES_H 20 | #define TYPES_H 21 | 22 | #include 23 | 24 | #undef NULL 25 | #if defined(__cplusplus) 26 | #define NULL 0 27 | #else 28 | #define NULL ((void *)0) 29 | #endif 30 | 31 | typedef __signed__ char __s8; 32 | typedef unsigned char __u8; 33 | 34 | typedef __signed__ short __s16; 35 | typedef unsigned short __u16; 36 | 37 | typedef __signed__ int __s32; 38 | typedef unsigned int __u32; 39 | 40 | typedef __signed__ long long __s64; 41 | typedef unsigned long long __u64; 42 | 43 | #ifndef __HOST__ 44 | typedef __u8 u_int8_t; 45 | typedef __s8 int8_t; 46 | typedef __u16 u_int16_t; 47 | typedef __s16 int16_t; 48 | typedef __u32 u_int32_t; 49 | typedef __s32 int32_t; 50 | typedef __s64 int64_t; 51 | typedef __u64 u_int64_t; 52 | #endif 53 | 54 | typedef __u8 uint8_t; 55 | typedef __u16 uint16_t; 56 | typedef __u32 uint32_t; 57 | typedef __u64 uint64_t; 58 | 59 | #ifndef __HOST__ 60 | typedef __u8 uint8; 61 | typedef __u16 uint16; 62 | typedef __u32 uint32; 63 | typedef __u64 uint64; 64 | 65 | typedef __u32 dma_addr_t; 66 | 67 | typedef unsigned long phys_addr_t; 68 | typedef unsigned long phys_size_t; 69 | 70 | /* bsd */ 71 | typedef unsigned char u_char; 72 | typedef unsigned short u_short; 73 | typedef unsigned int u_int; 74 | typedef unsigned long u_long; 75 | 76 | /* sysv */ 77 | typedef unsigned char unchar; 78 | typedef unsigned short ushort; 79 | typedef unsigned int uint; 80 | typedef unsigned long ulong; 81 | 82 | typedef unsigned int size_t; 83 | typedef unsigned long int uintptr_t; 84 | typedef ulong lbaint_t; 85 | #endif 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /include/wdt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #ifndef __WDT_H__ 20 | #define __WDT_H__ 21 | 22 | #define TCU_TSSR 0x2c 23 | #define TCU_TSCR 0x3c 24 | 25 | #define WDT_TCSR 0xc 26 | #define WDT_TCER 0x4 27 | #define WDT_TDR 0x0 28 | #define WDT_TCNT 0x8 29 | 30 | #define TSSR_WDTSS (1 << 16) 31 | #define TSCR_WDTSC (1 << 16) 32 | 33 | #define TCSR_PRESCALE_1 (0 << 3) 34 | #define TCSR_PRESCALE_4 (1 << 3) 35 | #define TCSR_PRESCALE_16 (2 << 3) 36 | #define TCSR_PRESCALE_64 (3 << 3) 37 | #define TCSR_PRESCALE_256 (4 << 3) 38 | #define TCSR_PRESCALE_1024 (5 << 3) 39 | 40 | #define TCSR_EXT_EN (1 << 2) 41 | #define TCSR_RTC_EN (1 << 1) 42 | #define TCSR_PCK_EN (1 << 0) 43 | 44 | #define TCER_TCEN (1 << 0) 45 | 46 | void wdt_init(void); 47 | void wdt_stop(void); 48 | void wdt_feed(void); 49 | void wdt_restart(void); 50 | 51 | #endif /* __WDT_H__ */ 52 | -------------------------------------------------------------------------------- /ldscripts/sleep_lib.lds: -------------------------------------------------------------------------------- 1 | /* 2 | * Ingenic X1000 PDMA TCSM size 8KByte 3 | */ 4 | MEMORY 5 | { 6 | .tcsm (rx) : ORIGIN = 0xb3422000, LENGTH = 8K 7 | } 8 | 9 | OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradlittlemips", "elf32-tradlittlemips") 10 | OUTPUT_ARCH(mips) 11 | ENTRY(sleep_lib_entry) 12 | SECTIONS 13 | { 14 | .text : { *(.text*) } >.tcsm 15 | 16 | . = ALIGN(4); 17 | .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.tcsm 18 | 19 | . = ALIGN(4); 20 | .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.tcsm 21 | 22 | . = ALIGN(4); 23 | __image_copy_end = .; 24 | 25 | .bss : { 26 | . = ALIGN(4); 27 | __bss_start = .; 28 | *(.sbss.*) 29 | *(.bss.*) 30 | *(COMMON) 31 | . = ALIGN(4); 32 | __bss_end = .; 33 | } >.tcsm 34 | 35 | /DISCARD/ : { 36 | *(.dynbss) 37 | *(.dynstr) 38 | *(.dynamic) 39 | *(.interp) 40 | *(.hash) 41 | *(.gnu.*) 42 | *(.plt) 43 | *(.got.plt) 44 | *(.rel.plt) 45 | *(.rel.dyn) 46 | } 47 | } -------------------------------------------------------------------------------- /ldscripts/x-loader-burner.lds: -------------------------------------------------------------------------------- 1 | /* 2 | * Ingenic X1000 TCSM size 12KByte 3 | */ 4 | MEMORY 5 | { 6 | .tcsm (rx) : ORIGIN = 0xf4001800, LENGTH = 12K 7 | } 8 | 9 | OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradbigmips", "elf32-tradlittlemips") 10 | OUTPUT_ARCH(mips) 11 | ENTRY(__start) 12 | SECTIONS 13 | { 14 | .text : { *(.text*) } >.tcsm 15 | 16 | . = ALIGN(4); 17 | .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.tcsm 18 | 19 | . = ALIGN(4); 20 | .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.tcsm 21 | 22 | . = ALIGN(4); 23 | __image_copy_end = .; 24 | 25 | .bss : { 26 | . = ALIGN(4); 27 | __bss_start = .; 28 | *(.sbss.*) 29 | *(.bss.*) 30 | *(COMMON) 31 | . = ALIGN(4); 32 | __bss_end = .; 33 | } >.tcsm 34 | 35 | /DISCARD/ : { 36 | *(.dynbss) 37 | *(.dynstr) 38 | *(.dynamic) 39 | *(.interp) 40 | *(.hash) 41 | *(.gnu.*) 42 | *(.plt) 43 | *(.got.plt) 44 | *(.rel.plt) 45 | *(.rel.dyn) 46 | } 47 | } -------------------------------------------------------------------------------- /ldscripts/x-loader.lds: -------------------------------------------------------------------------------- 1 | /* 2 | * Ingenic X1000 TCSM size 12KByte 3 | */ 4 | MEMORY 5 | { 6 | .tcsm (rx) : ORIGIN = 0xf4001000, LENGTH = 12K 7 | } 8 | 9 | OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradbigmips", "elf32-tradlittlemips") 10 | OUTPUT_ARCH(mips) 11 | ENTRY(__start) 12 | SECTIONS 13 | { 14 | .text : { *(.text*) } >.tcsm 15 | 16 | . = ALIGN(4); 17 | .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.tcsm 18 | 19 | . = ALIGN(4); 20 | .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.tcsm 21 | 22 | . = ALIGN(4); 23 | __image_copy_end = .; 24 | 25 | .bss : { 26 | . = ALIGN(4); 27 | __bss_start = .; 28 | *(.sbss.*) 29 | *(.bss.*) 30 | *(COMMON) 31 | . = ALIGN(4); 32 | __bss_end = .; 33 | } >.tcsm 34 | 35 | /DISCARD/ : { 36 | *(.dynbss) 37 | *(.dynstr) 38 | *(.dynamic) 39 | *(.interp) 40 | *(.hash) 41 | *(.gnu.*) 42 | *(.plt) 43 | *(.got.plt) 44 | *(.rel.plt) 45 | *(.rel.dyn) 46 | } 47 | } -------------------------------------------------------------------------------- /main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | 21 | #ifdef CONFIG_BOOT_MMC 22 | uint32_t cpu_freq = CONFIG_CPU_SEL_PLL == APLL ? CONFIG_APLL_FREQ : CONFIG_MPLL_FREQ; 23 | 24 | #elif (defined CONFIG_BOOT_USB) 25 | /* 26 | * Bootrom set apll freq for usb boot 27 | */ 28 | #if (CONFIG_EXTAL_FREQ == 24) 29 | uint32_t cpu_freq = 576; 30 | #elif (CONFIG_EXTAL_FREQ == 26) 31 | uint32_t cpu_freq = 624; 32 | #endif 33 | 34 | #else 35 | uint32_t cpu_freq = CONFIG_EXTAL_FREQ; 36 | #endif 37 | 38 | __attribute__((weak, alias("board_init"))) void board_init(void) {} 39 | __attribute__((weak, alias("board_early_init"))) void board_early_init(void) {} 40 | 41 | void x_loader_main(void) { 42 | 43 | #ifdef CONFIG_SOFT_BURN 44 | jump_to_usbboot(); 45 | #endif 46 | 47 | /* 48 | * Open CPU AHB0 APB RTC TCU EFUSE NEMC clock gate 49 | */ 50 | cpm_outl(0x87fbfffc, CPM_CLKGR); 51 | 52 | /* 53 | * Don't ask, it's magic... 54 | */ 55 | cpm_outl(0, CPM_PSWC0ST); 56 | cpm_outl(16, CPM_PSWC1ST); 57 | cpm_outl(24, CPM_PSWC2ST); 58 | cpm_outl(8, CPM_PSWC3ST); 59 | 60 | /* 61 | * Init board early 62 | */ 63 | board_early_init(); 64 | 65 | /* 66 | * Init uart 67 | */ 68 | uart_init(); 69 | 70 | /* 71 | * check SOC id 72 | */ 73 | #ifdef CONFIG_CHECK_SOC_ID 74 | check_socid(); 75 | #endif 76 | 77 | uart_puts("\n\nX-Loader Build: " X_LOADER_DATE " - " X_LOADER_TIME); 78 | 79 | /* 80 | * Print error pc register 81 | */ 82 | uint32_t errorpc; 83 | __asm__ __volatile__ ( 84 | "mfc0 %0, $30, 0\n\t" 85 | "nop \n\t" 86 | :"=r"(errorpc) 87 | :); 88 | printf("\nreset errorpc: 0x%x\n", errorpc); 89 | 90 | /* 91 | * Init clock 92 | */ 93 | clk_init(); 94 | 95 | #ifdef CONFIG_WDT 96 | /* 97 | * Init wdt 98 | */ 99 | wdt_init(); 100 | #endif 101 | 102 | /* 103 | * Init lpddr 104 | */ 105 | lpddr_init(); 106 | 107 | #ifdef CONFIG_DDR_ACCESS_TEST 108 | /* 109 | * DDR R/W test 110 | */ 111 | ddr_access_test(); 112 | 113 | hang_reason("Memory test done.\n"); 114 | #endif 115 | 116 | #ifdef CONFIG_RTCCLK_SRC_EXT 117 | /* 118 | * RTC clock source change to external main crystal 119 | */ 120 | rtc_clk_src_to_ext(); 121 | #endif 122 | 123 | /* 124 | * Init board 125 | */ 126 | board_init(); 127 | 128 | #ifndef CONFIG_BOOT_USB 129 | uart_puts("Going to boot next stage.\n"); 130 | 131 | /* 132 | * Boot next stage(kernel/u-boot/rtos) 133 | */ 134 | boot_next_stage(); 135 | 136 | #else /* CONFIG_BOOT_USB */ 137 | 138 | #ifdef CONFIG_PM_SUSPEND 139 | suspend_enter(CONFIG_PM_SUSPEND_STATE); 140 | #endif 141 | 142 | pass_params_to_uboot(); 143 | 144 | uart_puts("Going to start burner.\n"); 145 | 146 | /* 147 | * Return to rom 148 | */ 149 | return; 150 | #endif 151 | } 152 | -------------------------------------------------------------------------------- /mkconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | # 4 | # X1000 series bootloader for u-boot/rtos/linux 5 | # 6 | # Zhang YanMing 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by the 10 | # Free Software Foundation; either version 2 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, write to the Free Software Foundation, Inc., 15 | # 675 Mass Ave, Cambridge, MA 02139, USA. 16 | # 17 | # 18 | 19 | #!/bin/sh -e 20 | 21 | [ $# -lt 1 ] && exit 1 22 | [ $# -gt 2 ] && exit 1 23 | 24 | echo "Configuring for $1($2) board..." 25 | 26 | [ -d ./include/generated ] || mkdir -p ./include/generated 27 | cd ./include/generated 28 | 29 | echo "BOARD = $1" > config.mk 30 | echo "BOOT_FROM = $2" >> config.mk 31 | 32 | echo "/* Automatically generated - do not edit */" > config.h 33 | echo "#include " >> config.h 34 | echo "#include " >> config.h 35 | 36 | 37 | exit 0 38 | -------------------------------------------------------------------------------- /sleep-lib/sleep_lib_clk.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor 3 | * 4 | * SunWenZhong(Fighter) 5 | * 6 | * For project-5 7 | * 8 | * Release under GPLv2 9 | * 10 | */ 11 | 12 | 13 | #include 14 | 15 | __attribute__((weak)) uint32_t cpu_freq = CONFIG_CPU_SEL_PLL == APLL ? CONFIG_APLL_FREQ : CONFIG_MPLL_FREQ; 16 | 17 | static void dump_register(void) { 18 | debug("=====================\n"); 19 | debug("Dump CPM:\n"); 20 | debug("=====================\n"); 21 | debug("CPM_LCR = 0x%x\n", cpm_inl(CPM_LCR)); 22 | debug("CPM_CLKGR = 0x%x\n", cpm_inl(CPM_CLKGR)); 23 | debug("CPM_OPCR = 0x%x\n", cpm_inl(CPM_OPCR)); 24 | debug("=====================\n"); 25 | } 26 | 27 | static void wait_pll_stable(void) { 28 | uint32_t timeout = 0; 29 | 30 | if (CONFIG_APLL_FREQ > 0) { 31 | /* 32 | * Wait APLL 33 | */ 34 | timeout = 0x10000; 35 | while(!(cpm_inl(CPM_CPAPCR) & (1 << CPM_CPAPCR_PLLON_BIT)) && --timeout) { 36 | if (timeout == 0) 37 | panic("\n\tAPLL init timeout.\n"); 38 | } 39 | 40 | debug("CPM_CPAPCR = 0x%x\n", cpm_inl(CPM_CPAPCR)); 41 | } 42 | 43 | if (CONFIG_MPLL_FREQ > 0) { 44 | /* 45 | * Wait MPLL 46 | */ 47 | timeout = 0x10000; 48 | while(!(cpm_inl(CPM_CPMPCR) & (1 << CPM_CPMPCR_PLLON_BIT)) && --timeout) { 49 | if (timeout == 0) 50 | panic("\n\tMPLL init timeout.\n"); 51 | } 52 | 53 | debug("CPM_CPMPCR = 0x%x\n", cpm_inl(CPM_CPMPCR)); 54 | } 55 | } 56 | 57 | void sleep_lib_reset_clk_tree(void) { 58 | uint32_t reg; 59 | uint32_t cpccr_cfg = 0x55000000; 60 | 61 | cpccr_cfg |= ((1 - 1) << 16) /* PDIV */ 62 | | ((1 - 1) << 12) /* H2DIV */ 63 | | ((1 - 1) << 8) /* H0DIV */ 64 | | ((1 - 1) << 4) /* L2DIV */ 65 | | (1 - 1); /* CDIV */ 66 | 67 | /* Change sel */ 68 | reg = (cpccr_cfg & (0xff << 24)) | (cpm_inl(CPM_CPCCR) & ~(0xff << 24)); 69 | cpm_outl(reg, CPM_CPCCR); 70 | while(!(cpm_inl(CPM_CPCSR) & 0xf0000000)); 71 | 72 | /* Change div */ 73 | reg = (cpm_inl(CPM_CPCCR) & (0xff << 24)) 74 | | (cpccr_cfg & ~(0xff << 24)) 75 | | (7 << 20); 76 | cpm_outl(reg, CPM_CPCCR); 77 | while(cpm_inl(CPM_CPCSR) & 0x7); 78 | 79 | cpu_freq = CONFIG_EXTAL_FREQ; 80 | } 81 | 82 | static void init_clk_tree(void) { 83 | uint32_t pdiv, h0div, h2div, l2div, cdiv; 84 | 85 | l2div = CONFIG_L2CACHE_CLK_DIV; 86 | h0div = CONFIG_AHB_CLK_DIV; 87 | h2div = h0div; 88 | 89 | pdiv = h2div * 2; 90 | 91 | cdiv = 1; 92 | 93 | uint8_t soc_clk_sel = CONFIG_DDR_SEL_PLL == MPLL ? 0x2 : 0x1; 94 | uint8_t cpu_clk_sel = CONFIG_CPU_SEL_PLL == MPLL ? 0x2 : 0x1; 95 | 96 | uint32_t cpccr_cfg = (0x2 << 30) /* SCLK_A: APLL */ 97 | | (cpu_clk_sel << 28) /* Core & L2: cpu_clk_sel */ 98 | | (soc_clk_sel << 26) /* H0: soc_clk_sel */ 99 | | (soc_clk_sel << 24) /* H2: soc_clk_sel */ 100 | | ((pdiv - 1) << 16) /* PDIV */ 101 | | ((h2div - 1) << 12) /* H2DIV */ 102 | | ((h0div - 1) << 8) /* H0DIV */ 103 | | ((l2div - 1) << 4) /* L2DIV */ 104 | | (cdiv - 1) /* CDIV */ 105 | | (0x7 << 20); 106 | 107 | /* Change div */ 108 | uint32_t reg = (cpm_inl(CPM_CPCCR) & (0xff << 24)) 109 | | (cpccr_cfg & ~(0xff << 24)) 110 | | (7 << 20); 111 | cpm_outl(reg, CPM_CPCCR); 112 | while(cpm_inl(CPM_CPCSR) & 0x7); 113 | 114 | /* Change sel */ 115 | reg = (cpccr_cfg & (0xff << 24)) | (cpm_inl(CPM_CPCCR) & ~(0xff << 24)); 116 | cpm_outl(reg, CPM_CPCCR); 117 | while(!(cpm_inl(CPM_CPCSR) & 0xf0000000)); 118 | 119 | cpu_freq = CONFIG_CPU_SEL_PLL == APLL ? CONFIG_APLL_FREQ : CONFIG_MPLL_FREQ; 120 | 121 | debug("CPM_CPCCR = 0x%x\n",cpm_inl(CPM_CPCCR)); 122 | } 123 | 124 | void sleep_lib_init_clk(void) { 125 | dump_register(); 126 | 127 | wait_pll_stable(); 128 | init_clk_tree(); 129 | } 130 | 131 | -------------------------------------------------------------------------------- /sleep-lib/sleep_lib_entry.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor 3 | * 4 | * SunWenZhong(Fighter) 5 | * 6 | * For project-5 7 | * 8 | * Release under GPLv2 9 | * 10 | */ 11 | 12 | 13 | #include 14 | 15 | .extern restore_context 16 | .extern enter_sleep 17 | .extern enter_idle 18 | 19 | .extern context 20 | 21 | .global sleep_lib_entry 22 | 23 | .text 24 | sleep_lib_entry: 25 | .word restore_context 26 | .word enter_sleep 27 | .word enter_idle 28 | 29 | .global save_context_goto 30 | .align 2 31 | save_context_goto: 32 | .set push 33 | .set noreorder 34 | .set noat 35 | 36 | la k1, context 37 | lw k1, 0(k1) 38 | 39 | /* s0-s7 */ 40 | sw s0, 0*4(k1) 41 | sw s1, 1*4(k1) 42 | sw s2, 2*4(k1) 43 | sw s3, 3*4(k1) 44 | sw s4, 4*4(k1) 45 | sw s5, 5*4(k1) 46 | sw s6, 6*4(k1) 47 | sw s7, 7*4(k1) 48 | 49 | /* gp,sp,fp,ra */ 50 | sw gp, 8*4(k1) 51 | sw sp, 9*4(k1) 52 | sw fp, 10*4(k1) 53 | sw ra, 11*4(k1) 54 | 55 | mfc0 t0, CP0_PAGEMASK, 0 56 | sw t0, 12*4(k1) 57 | 58 | mfc0 t0, CP0_PAGEMASK, 4 59 | sw t0, 13*4(k1) 60 | 61 | mfc0 t0, CP0_STATUS, 0 62 | sw t0, 14*4(k1) 63 | 64 | mfc0 t0, CP0_STATUS, 1 65 | sw t0, 15*4(k1) 66 | 67 | mfc0 t0, CP0_CAUSE, 0 68 | sw t0, 16*4(k1) 69 | 70 | mfc0 t0, CP0_EBASE, 1 71 | sw t0, 17*4(k1) 72 | 73 | mfc0 t0, CP0_CONFIG, 0 74 | sw t0, 18*4(k1) 75 | 76 | mfc0 t0, CP0_CONFIG, 1 77 | sw t0, 19*4(k1) 78 | 79 | mfc0 t0, CP0_CONFIG, 2 80 | sw t0, 20*4(k1) 81 | 82 | mfc0 t0, CP0_CONFIG, 3 83 | sw t0, 21*4(k1) 84 | 85 | mfc0 t0, CP0_CONFIG, 7 86 | sw t0, 22*4(k1) 87 | 88 | mfc0 t0, CP0_LLADDR, 0 89 | sw t0, 23*4(k1) 90 | 91 | mfc0 t0, PMON_CSR 92 | sw t0, 24*4(k1) 93 | 94 | mfc0 t0, PMON_HIGH 95 | sw t0, 25*4(k1) 96 | 97 | mfc0 t0, PMON_LC 98 | sw t0, 26*4(k1) 99 | 100 | mfc0 t0, PMON_RC 101 | sw t0, 27*4(k1) 102 | 103 | mfc0 t0, CP0_WATCHLO, 0 104 | sw t0, 28*4(k1) 105 | 106 | mfc0 t0, CP0_WATCHHI, 0 107 | sw t0, 29*4(k1) 108 | 109 | mfc0 t0, CP0_ECC, 0 110 | sw t0, 30*4(k1) 111 | 112 | jr a0 113 | nop 114 | 115 | .set at 116 | .set reorder 117 | .set pop 118 | 119 | .global restore_context_goto 120 | .align 2 121 | restore_context_goto: 122 | .set push 123 | .set noreorder 124 | .set noat 125 | 126 | la k1, context 127 | lw k1, 0(k1) 128 | 129 | lw t0, 12*4(k1) 130 | mtc0 t0, CP0_PAGEMASK, 0 131 | 132 | lw t0, 13*4(k1) 133 | mtc0 t0, CP0_PAGEMASK, 4 134 | 135 | lw t0, 14*4(k1) 136 | mtc0 t0, CP0_STATUS, 0 137 | 138 | lw t0, 15*4(k1) 139 | mtc0 t0, CP0_STATUS, 1 140 | 141 | lw t0, 16*4(k1) 142 | mtc0 t0, CP0_CAUSE, 0 143 | 144 | lw t0, 17*4(k1) 145 | mtc0 t0, CP0_EBASE, 1 146 | 147 | lw t0, 18*4(k1) 148 | mtc0 t0, CP0_CONFIG, 0 149 | 150 | lw t0, 19*4(k1) 151 | mtc0 t0, CP0_CONFIG, 1 152 | 153 | lw t0, 20*4(k1) 154 | mtc0 t0, CP0_CONFIG, 2 155 | 156 | lw t0, 21*4(k1) 157 | mtc0 t0, CP0_CONFIG, 3 158 | 159 | lw t0, 22*4(k1) 160 | mtc0 t0, CP0_CONFIG, 7 161 | 162 | lw t0, 23*4(k1) 163 | mtc0 t0, CP0_LLADDR, 0 164 | 165 | lw t0, 24*4(k1) 166 | mtc0 t0, PMON_CSR 167 | 168 | lw t0, 25*4(k1) 169 | mtc0 t0, PMON_HIGH 170 | 171 | lw t0, 26*4(k1) 172 | mtc0 t0, PMON_LC 173 | 174 | lw t0, 27*4(k1) 175 | mtc0 t0, PMON_RC 176 | 177 | lw t0, 28*4(k1) 178 | mtc0 t0, CP0_WATCHLO, 0 179 | 180 | lw t0, 29*4(k1) 181 | mtc0 t0, CP0_WATCHHI, 0 182 | 183 | lw t0, 30*4(k1) 184 | mtc0 t0, CP0_ECC, 0 185 | 186 | /* restore regs */ 187 | lw s0, 0*4(k1) 188 | lw s1, 1*4(k1) 189 | lw s2, 2*4(k1) 190 | lw s3, 3*4(k1) 191 | lw s4, 4*4(k1) 192 | lw s5, 5*4(k1) 193 | lw s6, 6*4(k1) 194 | lw s7, 7*4(k1) 195 | 196 | lw gp, 8*4(k1) 197 | lw sp, 9*4(k1) 198 | lw fp, 10*4(k1) 199 | lw ra, 11*4(k1) 200 | 201 | jr ra 202 | nop 203 | 204 | .set at 205 | .set reorder 206 | .set pop 207 | -------------------------------------------------------------------------------- /sleep-lib/sleep_lib_uart.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor 3 | * 4 | * SunWenZhong(Fighter) 5 | * 6 | * For project-5 7 | * 8 | * Release under GPLv2 9 | * 10 | */ 11 | 12 | #include 13 | 14 | static struct jz_uart *uart = 15 | (struct jz_uart *)(UART0_BASE + CONFIG_CONSOLE_INDEX * 0x1000); 16 | 17 | void uart_putc(const char c) 18 | { 19 | if (c == '\n') 20 | uart_putc('\r'); 21 | 22 | writeb((uint8_t)c, &uart->rbr_thr_dllr); 23 | 24 | /* Wait for fifo to shift out some bytes */ 25 | while (!((readb(&uart->lsr) & 26 | (UART_LSR_TDRQ | UART_LSR_TEMT)) == 0x60)) 27 | continue; 28 | } 29 | 30 | void uart_puts(const char *s) 31 | { 32 | while (*s) 33 | uart_putc(*s++); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /start.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Startup Code for MIPS32 XBURST X1000 CPU-core 3 | * 4 | * Copyright (c) 2013 Ingenic Semiconductor Co.,Ltd 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 19 | * MA 02111-1307 USA 20 | */ 21 | 22 | #include 23 | 24 | #define RESERVED_FOR_SC(x) .space 1536, x 25 | 26 | .set noreorder 27 | .global __start 28 | __start: 29 | 30 | #ifdef CONFIG_BOOT_MMC 31 | /* 32 | * magic value ("MSPL") 33 | */ 34 | .word 0x4d53504c 35 | .space 508, 0 36 | RESERVED_FOR_SC(0) 37 | #endif 38 | 39 | #ifdef CONFIG_BOOT_SFC 40 | .word 0x03040506 41 | .word 0x55aa5502 42 | 43 | #ifdef CONFIG_BOOT_SPI_NOR 44 | .word 0xffff00aa 45 | 46 | #elif (defined CONFIG_BOOT_SPI_NAND) 47 | .word (0x00000000 | ((CONFIG_NAND_PPB / 32) << 16) | ((CONFIG_NAND_BPP / 1024) << 24)) 48 | #endif 49 | 50 | .word 0x00000000 51 | 52 | #ifdef CONFIG_SPL_VERSION 53 | .word (0x00000000 | CONFIG_SPL_VERSION) 54 | .space (512-20),0 55 | #else 56 | .space (512-16),0 57 | #endif 58 | 59 | RESERVED_FOR_SC(0) 60 | #endif 61 | 62 | /* Invalidate BTB */ 63 | mfc0 v0, CP0_CONFIG, 7 64 | nop 65 | ori v0, v0, 2 66 | mtc0 v0, CP0_CONFIG, 7 67 | nop 68 | 69 | /* 70 | * CU0=UM=EXL=IE=0, BEV=ERL=1, IP2~7=1 71 | */ 72 | li t0, 0x0040FC04 73 | mtc0 t0, CP0_STATUS 74 | 75 | /* CAUSE register */ 76 | /* IV=1, use the specical interrupt vector (0x200) */ 77 | li t1, 0x00800000 78 | mtc0 t1, CP0_CAUSE 79 | 80 | /* enable bridge radical mode */ 81 | la t0, CPM_BASE 82 | lw t1, 0x24(t0) 83 | ori t1, t1, 0x22 84 | sw t1, 0x24(t0) 85 | 86 | .set mips32 87 | init_caches: 88 | li t0, CONF_CM_CACHABLE_NONCOHERENT 89 | mtc0 t0, CP0_CONFIG 90 | nop 91 | 92 | /* enable idx-store-data cache insn */ 93 | li t0, 0x20000000 94 | mtc0 t0, CP0_ECC 95 | 96 | li t1, KSEG0 /* Start address */ 97 | ori t2, t1, CONFIG_SYS_DCACHE_SIZE /* End address */ 98 | mtc0 zero, CP0_TAGLO, 0 99 | mtc0 zero, CP0_TAGLO, 1 100 | cache_clear_a_line: 101 | cache INDEX_STORE_TAG_I, 0(t1) 102 | cache INDEX_STORE_TAG_D, 0(t1) 103 | addiu t1, t1, CONFIG_SYS_CACHELINE_SIZE 104 | bne t1, t2, cache_clear_a_line 105 | nop 106 | 107 | li t1, KSEG0 /* Start address */ 108 | ori t2, t1, CONFIG_SYS_DCACHE_SIZE /* End address */ 109 | la t3, 0x1ffff000 /* Physical address and 4KB page mask */ 110 | 111 | /* Clear BSS */ 112 | la t1, __bss_start 113 | la t2, __bss_end 114 | 1: 115 | sw zero, 0(t1) 116 | blt t1, t2, 1b 117 | add t1, 4 118 | 119 | j x_loader_main 120 | nop 121 | -------------------------------------------------------------------------------- /tools/efuse_params_creator.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Wang Qiuwei 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #ifdef printf 24 | #undef printf 25 | #endif 26 | #include 27 | 28 | 29 | struct efuse_cfg { 30 | uint32_t rd_adj; 31 | uint32_t wr_adj; 32 | uint32_t rd_strobe; 33 | uint32_t wr_strobe; 34 | }; 35 | 36 | static int efuse_adjust_cfg(struct efuse_cfg *cfg) { 37 | int i; 38 | uint32_t val, ns; 39 | uint32_t h2clk; 40 | uint32_t pll_rate = CONFIG_DDR_SEL_PLL == APLL ? CONFIG_APLL_FREQ : CONFIG_MPLL_FREQ; 41 | 42 | h2clk = pll_rate / CONFIG_AHB_CLK_DIV * 1000000; 43 | ns = 1000000000 / h2clk; 44 | 45 | for(i = 0; i < 0x4; i++) 46 | if(((i + 1) * ns) > 2) 47 | break; 48 | 49 | assert((i < 0x4)); 50 | cfg->rd_adj = cfg->wr_adj = i; 51 | 52 | for(i = 0; i < 0x8; i++) 53 | if(((cfg->rd_adj + i + 3) * ns) > 15) 54 | break; 55 | 56 | assert((i < 0x8)); 57 | cfg->rd_strobe = i; 58 | 59 | /* 60 | * X-loader efuse driver not support to write efuse, 61 | * so, don't need to calculate wr_adj and wr_strobe. 62 | */ 63 | #if 0 64 | cfg->wr_adj = cfg->rd_adj; 65 | 66 | for(i = 0; i < 0x1f; i += 100) { 67 | val = (cfg->wr_adj + i + 916) * ns; 68 | if( val > 4 * 1000 && val < 6 *1000) 69 | break; 70 | } 71 | 72 | assert((i < 0x1f)); 73 | cfg->wr_strobe = i; 74 | #endif 75 | return 0; 76 | } 77 | 78 | static void params_print(struct efuse_cfg *cfg) { 79 | printf("/*\n"); 80 | printf(" * DO NOT MODIFY.\n"); 81 | printf(" *\n"); 82 | printf(" * This file was generated by efuse_params_creator\n"); 83 | printf(" *\n"); 84 | printf(" */\n"); 85 | printf("\n"); 86 | 87 | printf("#ifndef EFUSE_REG_VALUES_H\n"); 88 | printf("#define EFUSE_REG_VALUES_H\n\n"); 89 | 90 | printf("\n"); 91 | printf("#define EFUCFG_RD_ADJ 0x%x\n", cfg->rd_adj); 92 | printf("#define EFUCFG_WR_ADJ 0x%x\n", cfg->wr_adj); 93 | printf("#define EFUCFG_RD_STROBE 0x%x\n", cfg->rd_strobe); 94 | printf("#define EFUCFG_WR_STROBE 0x%x\n", cfg->wr_strobe); 95 | printf("\n"); 96 | printf("#endif /* EFUSE_REG_VALUES_H */\n"); 97 | } 98 | 99 | int main(void) { 100 | int ret = 0; 101 | struct efuse_cfg cfg; 102 | 103 | memset(&cfg, 0, sizeof(struct efuse_cfg)); 104 | 105 | ret = efuse_adjust_cfg(&cfg); 106 | if(ret < 0) 107 | return -1; 108 | 109 | params_print(&cfg); 110 | 111 | return 0; 112 | } 113 | -------------------------------------------------------------------------------- /tools/gpt_creator: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JaminCheung/x-loader/3b060572a06b74e5dd83cc1c30f60423d93031c2/tools/gpt_creator -------------------------------------------------------------------------------- /tools/mbr_creator.c: -------------------------------------------------------------------------------- 1 | /* 2 | * MBR Creator. 3 | * 4 | * Copyright (C) 2013 Ingenic Semiconductor Co.,Ltd 5 | * Author: Justin 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License as 9 | * published by the Free Software Foundation; either version 2 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 20 | * MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #define KBYTE (1024LL) 32 | #define MBYTE ((KBYTE)*(KBYTE)) 33 | 34 | #define LINUX_FS 0x83 35 | #define FAT_FS 0x0b 36 | 37 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 38 | 39 | struct mbr_tab_item 40 | { 41 | unsigned long offset; 42 | unsigned long size; 43 | unsigned char type; 44 | }; 45 | 46 | struct mbr_tab_item tab_item[4]; 47 | 48 | static int parse_mbr_string(const char *str) { 49 | int i1 = -1, i2 = -1, i3 = -1; 50 | int items = -1; 51 | unsigned long long offset = 0, end = 0; 52 | char type_str[100] = { 0 }; 53 | 54 | /* 55 | * format:p1off=xmb,p1end=ymb,p1type=fat 56 | */ 57 | printf("str =%s\n", str); 58 | if ((items = sscanf(str, "p%doff=%lldmb,p%dend=%lldmb,p%dtype=%s", &i1, 59 | &offset, &i2, &end, &i3, type_str)) != 6) { 60 | printf("itmes = %d\n", items); 61 | printf("i1 = %d\n", i1); 62 | printf("offset_str = %lld\n", offset); 63 | printf("i2 = %d\n", i2); 64 | printf("end_str = %lld\n", end); 65 | printf("i3 = %d\n", i3); 66 | printf("type_str = %s\n", type_str); 67 | printf("Error:%s is error format\n", str); 68 | printf( 69 | "right format:pxoff=\"xmb\",pxend=\"ymb\",pxtype=\"fat\", x=1,2,3,4\n"); 70 | return -1; 71 | } 72 | printf("itmes = %d\n", items); 73 | printf("i1 = %d\n", i1); 74 | printf("offset_str = %lld\n", offset); 75 | printf("i2 = %d\n", i2); 76 | printf("end_str = %lld\n", end); 77 | printf("i3 = %d\n", i3); 78 | printf("type_str = %s\n", type_str); 79 | 80 | tab_item[i1].offset = offset * MBYTE / 512; 81 | tab_item[i1].size = (end - offset) * MBYTE / 512; 82 | if (strcmp(type_str, "fat") == 0) { 83 | tab_item[i1].type = FAT_FS; 84 | } else if (strcmp(type_str, "linux") == 0) { 85 | tab_item[i1].type = LINUX_FS; 86 | } else { 87 | printf("no compatible filesystem type\n"); 88 | return -1; 89 | } 90 | printf("tab_item[%d].offset = %lu\n", i1, tab_item[i1].offset); 91 | printf("tab_item[%d].size = %lu\n", i1, tab_item[i1].size); 92 | printf("tab_item[%d].type = %u\n", i1, tab_item[i1].type); 93 | 94 | return 0; 95 | } 96 | int main(int argc, char *argv[]) { 97 | int i = 0; 98 | int fd = -1; 99 | unsigned char block[512]; 100 | char mbr_name[512] = { 0 }; 101 | 102 | memset(tab_item, 0, ARRAY_SIZE(tab_item)); 103 | memset(block, 0, ARRAY_SIZE(block)); 104 | printf("argc = %d\n", argc); 105 | 106 | if (argc > 2) { 107 | if (strcmp("-o", argv[argc - 2]) == 0) { 108 | strcpy(mbr_name, argv[argc - 1]); 109 | argc -= 2; 110 | } else { 111 | strcpy(mbr_name, "mbr.bin"); 112 | } 113 | } else { 114 | strcpy(mbr_name, "mbr.bin"); 115 | } 116 | 117 | printf("argc = %d\n", argc); 118 | printf("mbr_name = %s\n", mbr_name); 119 | 120 | for (i = 1; i < argc; i++) { 121 | printf("argv[%d] = %s\n", i, argv[i]); 122 | /* 123 | * format:p1off="xmb",p1end="ymb",p1type="fat" 124 | */ 125 | if (parse_mbr_string(argv[i]) < 0) { 126 | printf("Error:%s is error format\n", argv[i]); 127 | printf( 128 | "right format:pxoff=\"xmb\",pxend=\"ymb\",pxtype=\"fat\", x=1,2,3,4\n"); 129 | return -1; 130 | } 131 | } 132 | 133 | block[0x1fe] = 0x55; 134 | block[0x1ff] = 0xaa; 135 | memcpy(block + 0x1c6, &tab_item[0].offset, sizeof(unsigned int)); 136 | memcpy(block + 0x1d6, &tab_item[1].offset, sizeof(unsigned int)); 137 | memcpy(block + 0x1e6, &tab_item[2].offset, sizeof(unsigned int)); 138 | memcpy(block + 0x1f6, &tab_item[3].offset, sizeof(unsigned int)); 139 | 140 | memcpy(block + 0x1ca, &tab_item[0].size, sizeof(unsigned int)); 141 | memcpy(block + 0x1da, &tab_item[1].size, sizeof(unsigned int)); 142 | memcpy(block + 0x1ea, &tab_item[2].size, sizeof(unsigned int)); 143 | memcpy(block + 0x1fa, &tab_item[3].size, sizeof(unsigned int)); 144 | 145 | memcpy(block + 0x1c2, &tab_item[0].type, sizeof(unsigned char)); 146 | memcpy(block + 0x1d2, &tab_item[1].type, sizeof(unsigned char)); 147 | memcpy(block + 0x1e2, &tab_item[2].type, sizeof(unsigned char)); 148 | memcpy(block + 0x1f2, &tab_item[3].type, sizeof(unsigned char)); 149 | 150 | fd = open(mbr_name, O_RDWR | O_TRUNC | O_CREAT, 0666); 151 | if (fd < 0) { 152 | printf("open %s failed.\n", mbr_name); 153 | exit(1); 154 | } 155 | 156 | if (write(fd, block, 512) != 512) 157 | printf("write %s failed.\n", mbr_name); 158 | 159 | close(fd); 160 | 161 | return 0; 162 | } 163 | -------------------------------------------------------------------------------- /tools/sfc_boot_checksum.c: -------------------------------------------------------------------------------- 1 | /* 2 | * SPI SPL check tool. 3 | * 4 | * Copyright (C) 2013 Ingenic Semiconductor Co.,Ltd 5 | * Based on: u-boot-1.1.6/tools/spi_checksum/spi_checksum.c 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License as 9 | * published by the Free Software Foundation; either version 2 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 20 | * MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #define SKIP_SIZE 2048 29 | #define BUFFER_SIZE 4 30 | #define CRC_POSITION 9 /* 9th bytes */ 31 | #define SPL_LENGTH_POSITION 12 /* 11th */ 32 | 33 | typedef unsigned char u8; 34 | const u8 crc7_syndrome_table[256] = { 35 | 0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f, 36 | 0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77, 37 | 0x19, 0x10, 0x0b, 0x02, 0x3d, 0x34, 0x2f, 0x26, 38 | 0x51, 0x58, 0x43, 0x4a, 0x75, 0x7c, 0x67, 0x6e, 39 | 0x32, 0x3b, 0x20, 0x29, 0x16, 0x1f, 0x04, 0x0d, 40 | 0x7a, 0x73, 0x68, 0x61, 0x5e, 0x57, 0x4c, 0x45, 41 | 0x2b, 0x22, 0x39, 0x30, 0x0f, 0x06, 0x1d, 0x14, 42 | 0x63, 0x6a, 0x71, 0x78, 0x47, 0x4e, 0x55, 0x5c, 43 | 0x64, 0x6d, 0x76, 0x7f, 0x40, 0x49, 0x52, 0x5b, 44 | 0x2c, 0x25, 0x3e, 0x37, 0x08, 0x01, 0x1a, 0x13, 45 | 0x7d, 0x74, 0x6f, 0x66, 0x59, 0x50, 0x4b, 0x42, 46 | 0x35, 0x3c, 0x27, 0x2e, 0x11, 0x18, 0x03, 0x0a, 47 | 0x56, 0x5f, 0x44, 0x4d, 0x72, 0x7b, 0x60, 0x69, 48 | 0x1e, 0x17, 0x0c, 0x05, 0x3a, 0x33, 0x28, 0x21, 49 | 0x4f, 0x46, 0x5d, 0x54, 0x6b, 0x62, 0x79, 0x70, 50 | 0x07, 0x0e, 0x15, 0x1c, 0x23, 0x2a, 0x31, 0x38, 51 | 0x41, 0x48, 0x53, 0x5a, 0x65, 0x6c, 0x77, 0x7e, 52 | 0x09, 0x00, 0x1b, 0x12, 0x2d, 0x24, 0x3f, 0x36, 53 | 0x58, 0x51, 0x4a, 0x43, 0x7c, 0x75, 0x6e, 0x67, 54 | 0x10, 0x19, 0x02, 0x0b, 0x34, 0x3d, 0x26, 0x2f, 55 | 0x73, 0x7a, 0x61, 0x68, 0x57, 0x5e, 0x45, 0x4c, 56 | 0x3b, 0x32, 0x29, 0x20, 0x1f, 0x16, 0x0d, 0x04, 57 | 0x6a, 0x63, 0x78, 0x71, 0x4e, 0x47, 0x5c, 0x55, 58 | 0x22, 0x2b, 0x30, 0x39, 0x06, 0x0f, 0x14, 0x1d, 59 | 0x25, 0x2c, 0x37, 0x3e, 0x01, 0x08, 0x13, 0x1a, 60 | 0x6d, 0x64, 0x7f, 0x76, 0x49, 0x40, 0x5b, 0x52, 61 | 0x3c, 0x35, 0x2e, 0x27, 0x18, 0x11, 0x0a, 0x03, 62 | 0x74, 0x7d, 0x66, 0x6f, 0x50, 0x59, 0x42, 0x4b, 63 | 0x17, 0x1e, 0x05, 0x0c, 0x33, 0x3a, 0x21, 0x28, 64 | 0x5f, 0x56, 0x4d, 0x44, 0x7b, 0x72, 0x69, 0x60, 65 | 0x0e, 0x07, 0x1c, 0x15, 0x2a, 0x23, 0x38, 0x31, 66 | 0x46, 0x4f, 0x54, 0x5d, 0x62, 0x6b, 0x70, 0x79 67 | }; 68 | 69 | static inline u8 crc7_byte(u8 crc, u8 data) { 70 | return crc7_syndrome_table[(crc << 1) ^ data]; 71 | } 72 | 73 | u8 crc7(u8 crc, u8 *buffer, int len) { 74 | while (len--) 75 | crc = crc7_byte(crc, *buffer++); 76 | return crc; 77 | } 78 | 79 | int main(int argc, char *argv[]) { 80 | int fd, count; 81 | int bytes_read; 82 | char buffer[BUFFER_SIZE]; 83 | unsigned int check = 0; 84 | volatile int t = 0; 85 | u8 crc = 0; 86 | 87 | if (argc != 2) { 88 | printf("Usage: %s fromfile tofile\n\a", argv[0]); 89 | return 1; 90 | } 91 | 92 | fd = open(argv[1], O_RDWR); 93 | if (fd < 0) { 94 | printf("Open %s Error\n", argv[1]); 95 | return 1; 96 | } 97 | 98 | count = 0; 99 | 100 | while ((bytes_read = read(fd, buffer, BUFFER_SIZE)) > 0) { 101 | if (t >= SKIP_SIZE) { 102 | crc = crc7(crc, buffer, bytes_read); 103 | } else { 104 | t += BUFFER_SIZE; 105 | } 106 | count += bytes_read; 107 | } 108 | 109 | printf("spi spl count = %08x \n", count); 110 | printf("spi spl crc7 = %x \n", crc); 111 | 112 | /*set crc*/ 113 | lseek(fd, CRC_POSITION, SEEK_SET); 114 | 115 | if ((t = write(fd, &crc, 1)) != 1) { 116 | printf("Write %s Error\n", argv[1]); 117 | return 1; 118 | } 119 | 120 | /*set spl len*/ 121 | lseek(fd, SPL_LENGTH_POSITION, SEEK_SET); 122 | if ((t = write(fd, &count, 4)) != 4) { 123 | printf("Check: Write %s Error\n", argv[1]); 124 | return 1; 125 | } 126 | 127 | close(fd); 128 | 129 | return 0; 130 | } 131 | -------------------------------------------------------------------------------- /tools/sfc_timing_params_creator.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #ifdef printf 6 | #undef printf 7 | #endif 8 | #include 9 | 10 | static void file_head_print(void) 11 | { 12 | printf("/*\n"); 13 | printf(" * DO NOT MODIFY.\n"); 14 | printf(" *\n"); 15 | printf(" * This file was generated by sfc_timing_params_creator\n"); 16 | printf(" *\n"); 17 | printf(" */\n"); 18 | printf("\n"); 19 | 20 | printf("#ifndef __SFC_TIMING_VAL_H__\n"); 21 | printf("#define __SFC_TIMING_VAL_H__\n\n"); 22 | } 23 | 24 | static void file_end_print(void) 25 | { 26 | printf("\n#endif /* __SFC_TIMING_VAL_H__ */\n"); 27 | } 28 | 29 | int main(int argc, char* argv[]) { 30 | unsigned int c_hold; 31 | unsigned int c_setup; 32 | unsigned int t_in, c_in, val = 0; 33 | unsigned long cycle; 34 | unsigned int tmp = 0x7; 35 | unsigned int rate = CONFIG_SFC_FREQ; 36 | 37 | cycle = 1000 / rate; 38 | 39 | c_hold = DEF_TCHSH / cycle; 40 | if(c_hold > 0) 41 | val = c_hold - 1; 42 | tmp &= ~THOLD_MSK; 43 | tmp |= val << THOLD_OFFSET; 44 | 45 | c_setup = DEF_TSLCH / cycle; 46 | if(c_setup > 0) 47 | val = c_setup - 1; 48 | tmp &= ~TSETUP_MSK; 49 | tmp |= val << TSETUP_OFFSET; 50 | 51 | if (DEF_TSHSL_R >= DEF_TSHSL_W) 52 | t_in = DEF_TSHSL_R; 53 | else 54 | t_in = DEF_TSHSL_W; 55 | c_in = t_in / cycle; 56 | if(c_in > 0) 57 | val = c_in - 1; 58 | tmp &= ~TSH_MSK; 59 | tmp |= val << TSH_OFFSET; 60 | 61 | if(rate >= 100){ 62 | val = 1; 63 | tmp &= ~SMP_DELAY_MSK; 64 | tmp |= val << SMP_DELAY_OFFSET; 65 | } 66 | 67 | file_head_print(); 68 | printf("#define DEF_TIM_VAL 0x%08x\n", tmp); 69 | file_end_print(); 70 | 71 | return 0; 72 | } 73 | -------------------------------------------------------------------------------- /tools/uart_baudrate_lut.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | #ifdef printf 23 | #undef printf 24 | #endif 25 | #include 26 | 27 | static unsigned short quot1[3] = {0}; /* quot[0]:baud_div, quot[1]:umr, quot[2]:uacr */ 28 | 29 | static struct baudtoregs_t 30 | { 31 | unsigned int baud; 32 | unsigned short div; 33 | unsigned int umr:5; 34 | unsigned int uacr:12; 35 | } baudtoregs[] = { 36 | /* 37 | The data is generated by a python, 38 | the script is tools/tty/get_divisor.py 39 | */ 40 | #if (CONFIG_EXTAL_FREQ == 24) 41 | {50,0x7530,0x10,0x0}, 42 | {75,0x4e20,0x10,0x0}, 43 | {110,0x3521,0x10,0x0}, 44 | {134,0x2b9d,0x10,0x0}, 45 | {150,0x2710,0x10,0x0}, 46 | {200,0x1d4c,0x10,0x0}, 47 | {300,0x1388,0x10,0x0}, 48 | {600,0x9c4,0x10,0x0}, 49 | {1200,0x4e2,0x10,0x0}, 50 | {1800,0x340,0x10,0x0}, 51 | {2400,0x271,0x10,0x0}, 52 | {4800,0x138,0x10,0x0}, 53 | {9600,0x9c,0x10,0x0}, 54 | {19200,0x4e,0x10,0x0}, 55 | {38400,0x27,0x10,0x0}, 56 | {57600,0x1a,0x10,0x0}, 57 | {115200,0xd,0x10,0x0}, 58 | {230400,0x6,0x11,0x550}, 59 | {460800,0x3,0x11,0x550}, 60 | {500000,0x3,0x10,0x0}, 61 | {576000,0x3,0xd,0x0}, 62 | {921600,0x2,0xd,0x0}, 63 | {1000000,0x2,0xc,0x0}, 64 | {1152000,0x1,0x14,0x400}, 65 | {1500000,0x1,0x10,0x0}, 66 | {2000000,0x1,0xc,0x0}, 67 | {2500000,0x1,0x9,0x780}, 68 | {3000000,0x1,0x8,0x0}, 69 | {3500000,0x1,0x6,0x400}, 70 | {4000000,0x1,0x6,0x0}, 71 | #elif (CONFIG_EXTAL_FREQ == 26) 72 | {50,0x7ef4,0x10,0x0}, 73 | {75,0x546b,0x10,0x0}, 74 | {110,0x398f,0x10,0x0}, 75 | {134,0x2f40,0x10,0x0}, 76 | {150,0x2a36,0x10,0x0}, 77 | {200,0x1fbd,0x10,0x0}, 78 | {300,0x151b,0x10,0x0}, 79 | {600,0xa8e,0x10,0x0}, 80 | {1200,0x547,0x10,0x0}, 81 | {1800,0x385,0x10,0x0}, 82 | {2400,0x2a4,0x10,0x0}, 83 | {4800,0x152,0x10,0x0}, 84 | {9600,0xa9,0x10,0x0}, 85 | {19200,0x54,0x10,0x2}, 86 | {38400,0x2a,0x10,0x2}, 87 | {57600,0x1c,0x10,0x2}, 88 | {115200,0xe,0x10,0x2}, 89 | {230400,0x7,0x10,0x2}, 90 | {460800,0x4,0xe,0x2}, 91 | {500000,0x3,0x11,0x550}, 92 | {576000,0x3,0xf,0x2}, 93 | {921600,0x2,0xe,0x2}, 94 | {1000000,0x2,0xd,0x0}, 95 | {1152000,0x2,0xb,0x248}, 96 | {1500000,0x1,0x11,0x550}, 97 | {2000000,0x1,0xd,0x0}, 98 | {2500000,0x1,0xa,0x2a0}, 99 | {3000000,0x1,0x8,0x700}, 100 | {3500000,0x1,0x7,0x2a0}, 101 | {4000000,0x1,0x6,0x7c0}, 102 | #endif 103 | }; 104 | 105 | void *bsearch(const void *key, const void *base, size_t num, size_t size, 106 | int (*cmp)(const void *key, const void *elt)) 107 | { 108 | size_t start = 0, end = num; 109 | int result; 110 | 111 | while (start < end) { 112 | size_t mid = start + (end - start) / 2; 113 | 114 | result = cmp(key, base + mid * size); 115 | if (result < 0) 116 | end = mid; 117 | else if (result > 0) 118 | start = mid + 1; 119 | else 120 | return (void *)base + mid * size; 121 | } 122 | 123 | return NULL; 124 | } 125 | 126 | static int uart_setting_baud(const void *key,const void *elt) 127 | { 128 | unsigned int *d = (unsigned int*)key; 129 | struct baudtoregs_t *b = (struct baudtoregs_t *)elt; 130 | if(*d > b->baud) 131 | return 1; 132 | else if(*d < b->baud) 133 | return -1; 134 | return 0; 135 | } 136 | 137 | int main(void) { 138 | struct baudtoregs_t *b; 139 | unsigned int baudrate = CONFIG_CONSOLE_BAUDRATE; 140 | 141 | if(baudrate <= baudtoregs[ARRAY_SIZE(baudtoregs) - 1].baud) 142 | b = (struct baudtoregs_t *) bsearch((const void*)&baudrate, (const void*)baudtoregs,ARRAY_SIZE(baudtoregs), 143 | sizeof(struct baudtoregs_t), uart_setting_baud); 144 | 145 | quot1[0] = b->div; 146 | quot1[1] = b->umr; 147 | quot1[2] = b->uacr; 148 | 149 | printf("/*\n"); 150 | printf(" * DO NOT MODIFY.\n"); 151 | printf(" *\n"); 152 | printf(" * This file was generated by uart_baudrate_lut\n"); 153 | printf(" *\n"); 154 | printf(" */\n"); 155 | printf("\n"); 156 | 157 | printf("#ifndef UART_BAUDRATE_LUT_H\n"); 158 | printf("#define UART_BAUDRATE_LUT_H\n"); 159 | printf("\n"); 160 | printf("#define UART_BAUDRATE_DIV_BEST 0x%x\n", quot1[0]); 161 | printf("#define UART_UMR_BEST 0x%x\n", quot1[1]); 162 | printf("#define UART_UACR_BEST 0x%x\n", quot1[2]); 163 | printf("\n"); 164 | printf("#endif /* UART_BAUDRATE_LUT_H */\n"); 165 | 166 | return 0; 167 | } 168 | -------------------------------------------------------------------------------- /tools/wdt_params_creator.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Ingenic Semiconductor Co.,Ltd 3 | * 4 | * X1000 series bootloader for u-boot/rtos/linux 5 | * 6 | * Zhang YanMing 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the 10 | * Free Software Foundation; either version 2 of the License, or (at your 11 | * option) any later version. 12 | * 13 | * You should have received a copy of the GNU General Public License along 14 | * with this program; if not, write to the Free Software Foundation, Inc., 15 | * 675 Mass Ave, Cambridge, MA 02139, USA. 16 | * 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #ifdef printf 24 | #undef printf 25 | #endif 26 | #include 27 | 28 | #define RTC_FREQ 32768 29 | 30 | struct wdt_cfg { 31 | uint32_t tdr; 32 | uint32_t tcsr; 33 | }; 34 | 35 | struct { 36 | int div; 37 | uint32_t value; 38 | } wdt_div_table[] = { 39 | {1 , TCSR_PRESCALE_1 }, 40 | {4 , TCSR_PRESCALE_4 }, 41 | {16 , TCSR_PRESCALE_16 }, 42 | {64 , TCSR_PRESCALE_64 }, 43 | {256 , TCSR_PRESCALE_256 }, 44 | {1024, TCSR_PRESCALE_1024}, 45 | }; 46 | 47 | int main(int argc, char* argv[]) { 48 | struct wdt_cfg wdt_cfg; 49 | 50 | uint32_t timeout = CONFIG_WDT_TIMEOUT_MS; 51 | uint32_t timeout_min, timeout_max; 52 | uint32_t src_freq; 53 | uint32_t src_clk; 54 | int wdt_div = -1; 55 | int i = 0; 56 | 57 | assert(timeout > 0); 58 | 59 | #ifdef CONFIG_WDT_CLK_SRC_RTC 60 | 61 | #ifdef CONFIG_RTCCLK_SRC_EXT 62 | src_freq = CONFIG_EXTAL_FREQ * 1000 * 1000 / 512; 63 | #else 64 | src_freq = RTC_FREQ; 65 | #endif 66 | src_clk = TCSR_RTC_EN; 67 | 68 | #else 69 | src_freq = CONFIG_EXTAL_FREQ * 1000 * 1000; 70 | src_clk = TCSR_EXT_EN; 71 | #endif 72 | 73 | memset(&wdt_cfg, 0, sizeof(struct wdt_cfg)); 74 | 75 | for (i = 0; i < sizeof(wdt_div_table); i++) { 76 | timeout_min = wdt_div_table[i].div * 0x2 * 1000 / src_freq; //WDT_TDR set should bigger than 0x1 77 | timeout_max = wdt_div_table[i].div * 0xffff * 1000 / src_freq; 78 | if (timeout >= timeout_min && timeout <= timeout_max 79 | && (src_freq * 2 / wdt_div_table[i].div < CONFIG_EXTAL_FREQ * 1000 * 1000)) { 80 | wdt_div = wdt_div_table[i].value; 81 | wdt_cfg.tdr = timeout * src_freq / wdt_div_table[i].div / 1000 + 1; 82 | break; 83 | } 84 | } 85 | 86 | assert(wdt_div != -1); 87 | 88 | wdt_cfg.tcsr = src_clk | wdt_div; 89 | 90 | printf("/*\n"); 91 | printf(" * DO NOT MODIFY.\n"); 92 | printf(" *\n"); 93 | printf(" * This file was generated by wdt_params_creator\n"); 94 | printf(" *\n"); 95 | printf(" */\n"); 96 | printf("\n"); 97 | 98 | printf("#ifndef WDT_CFG_H\n"); 99 | printf("#define WDT_CFG_H\n"); 100 | printf("\n"); 101 | printf("#define WDT_CFG_TCSR 0x%x\n", wdt_cfg.tcsr); 102 | printf("#define WDT_CFG_TDR 0x%x\n", wdt_cfg.tdr); 103 | printf("\n"); 104 | printf("#endif /* WDT_CFG_H */\n"); 105 | 106 | return 0; 107 | } 108 | --------------------------------------------------------------------------------