forked from canmv-k230/u-boot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
900f23a
commit 0773af5
Showing
8 changed files
with
254 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* Copyright (c) 2023, Canaan Bright Sight Co., Ltd | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
/dts-v1/; | ||
|
||
#include <dt-bindings/pinctrl/k230-pinctrl.h> | ||
|
||
#define BANK_VOLTAGE_IO0_IO1 K230_MSC_1V8 // FIXED | ||
#define BANK_VOLTAGE_IO2_IO13 K230_MSC_3V3 | ||
#define BANK_VOLTAGE_IO14_IO25 K230_MSC_3V3 | ||
#define BANK_VOLTAGE_IO26_IO37 K230_MSC_3V3 | ||
#define BANK_VOLTAGE_IO38_IO49 K230_MSC_3V3 | ||
#define BANK_VOLTAGE_IO50_IO61 K230_MSC_3V3 | ||
#define BANK_VOLTAGE_IO62_IO63 K230_MSC_3V3 | ||
|
||
#include "k230.dtsi" | ||
|
||
/ { | ||
model = "kendryte k230 burntool"; | ||
compatible = "kendryte,k230_burntool"; | ||
|
||
memory@0x80200000 { | ||
device_type = "memory"; | ||
reg = <0x00000000 0x80200000 0x0 0x160000>; | ||
}; | ||
}; | ||
|
||
&mmc0 { | ||
status = "okay"; | ||
}; | ||
|
||
&mmc1 { | ||
status = "okay"; | ||
}; | ||
|
||
&usbotg0 { | ||
status = "okay"; | ||
}; | ||
|
||
&iomux { | ||
pinctrl-names = "default"; | ||
pinctrl-0 = <&pins>; | ||
|
||
// Please pay attention to the bank voltage! will damage the chip. | ||
pins: iomux_pins { | ||
u-boot,dm-pre-reloc; | ||
pinctrl-single,pins = < | ||
|
||
// boot | ||
(IO0 ) ( 1<<SEL | 0<<SL | BANK_VOLTAGE_IO0_IO1 <<MSC | 0<<IE | 1<<OE | 1<<PU | 0<<PD | 2<<DS | 0<<ST ) | ||
// boot1 | ||
(IO1 ) ( 1<<SEL | 0<<SL | BANK_VOLTAGE_IO0_IO1 <<MSC | 0<<IE | 1<<OE | 1<<PU | 0<<PD | 2<<DS | 0<<ST ) | ||
|
||
// UART0_TXD | ||
(IO38) ( 1<<SEL | 0<<SL | BANK_VOLTAGE_IO38_IO49<<MSC | 0<<IE | 1<<OE | 0<<PU | 0<<PD | 7<<DS | 1<<ST ) | ||
// UART0_RXD | ||
(IO39) ( 1<<SEL | 0<<SL | BANK_VOLTAGE_IO38_IO49<<MSC | 1<<IE | 0<<OE | 0<<PU | 0<<PD | 7<<DS | 1<<ST ) | ||
>; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
if TARGET_K230_BURNTOOL | ||
|
||
config SYS_CPU | ||
default "k230" | ||
|
||
config SYS_VENDOR | ||
default "kendryte" | ||
|
||
config SYS_BOARD | ||
default "k230_burntool" | ||
|
||
config SYS_CONFIG_NAME | ||
default "k230_common" | ||
|
||
config BOARD_SPECIFIC_OPTIONS | ||
def_bool y | ||
select KENDRYTE_K230 | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# /* Copyright (c) 2023, Canaan Bright Sight Co., Ltd | ||
# * | ||
# * Redistribution and use in source and binary forms, with or without | ||
# * modification, are permitted provided that the following conditions are met: | ||
# * 1. Redistributions of source code must retain the above copyright | ||
# * notice, this list of conditions and the following disclaimer. | ||
# * 2. Redistributions in binary form must reproduce the above copyright | ||
# * notice, this list of conditions and the following disclaimer in the | ||
# * documentation and/or other materials provided with the distribution. | ||
# * | ||
# * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
# * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
# * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
# * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
# * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
# * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
# * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
# * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
# * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
# * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
# * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
# * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
# */ | ||
|
||
BOARD_COMMON_DIR = $(srctree)/board/$(VENDOR)/common | ||
EXTRA_CFLAGS += -I$(BOARD_COMMON_DIR) | ||
|
||
obj-y += board.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <asm/asm.h> | ||
#include <asm/io.h> | ||
#include <asm/spl.h> | ||
#include <asm/types.h> | ||
#include <command.h> | ||
#include <common.h> | ||
#include <cpu_func.h> | ||
#include <dm.h> | ||
#include <env_internal.h> | ||
#include <image.h> | ||
#include <linux/delay.h> | ||
#include <linux/kernel.h> | ||
#include <lmb.h> | ||
#include <stdio.h> | ||
|
||
#include <kendryte/k230_platform.h> | ||
|
||
#include "board_common.h" | ||
|
||
int board_early_init_f(void) { | ||
return 0; | ||
} | ||
|
||
#ifdef CONFIG_BOARD_LATE_INIT | ||
int board_late_init(void) { | ||
#define USB_IDPULLUP0 (1 << 4) | ||
#define USB_DMPULLDOWN0 (1 << 8) | ||
#define USB_DPPULLDOWN0 (1 << 9) | ||
|
||
u32 usb0_test_ctl3 = readl((void *)USB0_TEST_CTL3); | ||
usb0_test_ctl3 |= USB_IDPULLUP0; | ||
writel(usb0_test_ctl3, (void *)USB0_TEST_CTL3); | ||
|
||
return 0; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
CONFIG_RISCV=y | ||
CONFIG_SYS_TEXT_BASE=0x80360000 | ||
CONFIG_SYS_MALLOC_LEN=0x80000 | ||
CONFIG_NR_DRAM_BANKS=3 | ||
CONFIG_ENV_SIZE=0x10000 | ||
CONFIG_DEFAULT_DEVICE_TREE="k230_burntool" | ||
CONFIG_SYS_PROMPT="K230# " | ||
CONFIG_SYS_LOAD_ADDR=0x00000000 | ||
CONFIG_BUILD_TARGET="u-boot.bin" | ||
CONFIG_TARGET_K230_BURNTOOL=y | ||
CONFIG_ARCH_RV64I=y | ||
CONFIG_SHOW_REGS=y | ||
CONFIG_CC_OPTIMIZE_FOR_DEBUG=y | ||
CONFIG_DISTRO_DEFAULTS=y | ||
CONFIG_FIT=y | ||
CONFIG_TIMESTAMP=y | ||
CONFIG_FIT_SIGNATURE=y | ||
CONFIG_LEGACY_IMAGE_FORMAT=y | ||
CONFIG_BOOTDELAY=0 | ||
CONFIG_BOOTCOMMAND="kburn 0" | ||
CONFIG_LOGLEVEL=7 | ||
CONFIG_SYS_STDIO_DEREGISTER=y | ||
# CONFIG_SYS_DEVICE_NULLDEV is not set | ||
CONFIG_DISPLAY_CPUINFO=y | ||
CONFIG_DISPLAY_BOARDINFO=y | ||
CONFIG_BOARD_EARLY_INIT_F=y | ||
CONFIG_BOARD_LATE_INIT=y | ||
CONFIG_CMD_GPT=y | ||
CONFIG_CMD_MMC=y | ||
CONFIG_CMD_MTD=y | ||
# CONFIG_CMD_PINMUX is not set | ||
CONFIG_CMD_SF_TEST=y | ||
CONFIG_CMD_USB=y | ||
CONFIG_CMD_KBURN=y | ||
CONFIG_PARTITION_TYPE_GUID=y | ||
CONFIG_OF_EMBED=y | ||
CONFIG_SYS_RELOC_GD_ENV_ADDR=y | ||
# CONFIG_NET is not set | ||
# CONFIG_INPUT is not set | ||
CONFIG_KBURN_MMC=y | ||
CONFIG_MMC=y | ||
CONFIG_MMC_HS200_SUPPORT=y | ||
CONFIG_MMC_DW=y | ||
CONFIG_MMC_SDHCI=y | ||
CONFIG_MMC_SDHCI_SDMA=y | ||
CONFIG_MMC_SDHCI_SNPS=y | ||
CONFIG_DM_MTD=y | ||
CONFIG_MTD_SPI_NAND=y | ||
CONFIG_SPI_FLASH_SFDP_SUPPORT=y | ||
CONFIG_SPI_FLASH_SOFT_RESET=y | ||
CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y | ||
CONFIG_SPI_FLASH_GIGADEVICE=y | ||
CONFIG_SPI_FLASH_WINBOND=y | ||
# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set | ||
CONFIG_SPI_FLASH_MTD=y | ||
CONFIG_PINCTRL=y | ||
CONFIG_PINCTRL_SINGLE=y | ||
CONFIG_SYS_NS16550=y | ||
CONFIG_SPI=y | ||
CONFIG_DESIGNWARE_SPI=y | ||
CONFIG_USB=y | ||
CONFIG_DM_USB_GADGET=y | ||
CONFIG_USB_DWC2=y | ||
CONFIG_USB_HOST_ETHER=y | ||
CONFIG_USB_ETHER_ASIX=y | ||
CONFIG_USB_ETHER_ASIX88179=y | ||
CONFIG_USB_ETHER_MCS7830=y | ||
CONFIG_USB_ETHER_RTL8152=y | ||
CONFIG_USB_ETHER_SMSC95XX=y | ||
CONFIG_USB_GADGET=y | ||
CONFIG_USB_GADGET_MANUFACTURER="Kendryte" | ||
CONFIG_USB_GADGET_VENDOR_NUM=0x29f1 | ||
CONFIG_USB_GADGET_PRODUCT_NUM=0x0230 | ||
CONFIG_USB_GADGET_DWC2_OTG=y | ||
CONFIG_USB_GADGET_VBUS_DRAW=500 | ||
CONFIG_USB_GADGET_DOWNLOAD=y | ||
CONFIG_FAT_WRITE=y | ||
CONFIG_REGEX=y | ||
CONFIG_SPL_GZIP=y | ||
# CONFIG_EFI_LOADER is not set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters