diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h index 2de876cbdd..157d3dbbc7 100644 --- a/include/configs/dra7xx_evm.h +++ b/include/configs/dra7xx_evm.h @@ -56,6 +56,7 @@ #define CONFIG_CMD_SPI #define CONFIG_SPI_FLASH_BAR #define CONFIG_TI_SPI_MMAP +#define CONFIG_CH_QSPI #define CONFIG_SF_DEFAULT_SPEED 48000000 #define CONFIG_DEFAULT_SPI_MODE SPI_MODE_3 diff --git a/spl/Makefile b/spl/Makefile index b366ac2bb7..e3b5d850ad 100644 --- a/spl/Makefile +++ b/spl/Makefile @@ -165,8 +165,13 @@ LDPPFLAGS += \ sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p') $(OBJTREE)/MLO: $(obj)u-boot-spl.bin +ifdef CONFIG_CH_QSPI + $(OBJTREE)/tools/mkimage -T omapimage -n ch_qspi\ + -a $(CONFIG_SPL_TEXT_BASE) -d $< $@ +else $(OBJTREE)/tools/mkimage -T omapimage \ -a $(CONFIG_SPL_TEXT_BASE) -d $< $@ +endif $(OBJTREE)/MLO.byteswap: $(obj)u-boot-spl.bin $(OBJTREE)/tools/mkimage -T omapimage -n byteswap \ diff --git a/tools/omapimage.c b/tools/omapimage.c index a7a9be4417..5f19436a2b 100644 --- a/tools/omapimage.c +++ b/tools/omapimage.c @@ -23,6 +23,12 @@ #define OMAP_GP_HDR_SIZE (sizeof(struct gp_header)) #define OMAP_FILE_HDR_SIZE (OMAP_CH_HDR_SIZE+OMAP_GP_HDR_SIZE) +static const struct ch_qspi ch_qspi_48mhz_quad = { + 0x13, 0x6B, 0x03, 0x02, 0x1, 0xFF, + {0x05, 0x35, 0x00, 0x00}, + 0x11, 0x01, 0x06, 0x01 +}; + static const struct ch_settings ch_settings_dummy = {0, {0, 0, 0, 0, 0} }; static int do_swap32 = 0; @@ -50,9 +56,9 @@ static int omapimage_check_image_types(uint8_t type) /* * Only the simplest image type is currently supported: - * TOC pointing to CHSETTINGS + * TOC pointing to CHSETTINGS|CHQSPI * TOC terminator - * CHSETTINGS + * CHSETTINGS|CHQSPI * * padding to OMAP_CH_HDR_SIZE bytes * @@ -116,6 +122,8 @@ static void omapimage_print_section(struct ch_entry *entry) if (entry->hdr.section_key == KEY_CHSETTINGS) section_name = "CHSETTINGS"; + else if (entry->hdr.section_key == KEY_CHQSPI) + section_name = "CHQSPI"; else section_name = "UNKNOWNKEY"; @@ -199,12 +207,20 @@ static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd, uint32_t ch_data_size; toc->section_offset = toc_offset(ptr, entry); - strcpy((char *)toc->section_name, "CHSETTINGS"); - entry->hdr.section_key = KEY_CHSETTINGS; - entry->hdr.valid = 0; - ch_src = (void *)&ch_settings_dummy; - ch_data_size = sizeof(struct ch_settings); + if (strncmp(params->imagename, "ch_qspi", 7) == 0) { + strcpy((char *)toc->section_name, "CHQSPI"); + entry->hdr.section_key = KEY_CHQSPI; + entry->hdr.valid = 1; + ch_src = (void *)&ch_qspi_48mhz_quad; + ch_data_size = sizeof(struct ch_qspi); + } else { + strcpy((char *)toc->section_name, "CHSETTINGS"); + entry->hdr.section_key = KEY_CHSETTINGS; + entry->hdr.valid = 0; + ch_src = (void *)&ch_settings_dummy; + ch_data_size = sizeof(struct ch_settings); + } memcpy(&entry->ch_data[0], ch_src, ch_data_size); entry->hdr.version = 1; diff --git a/tools/omapimage.h b/tools/omapimage.h index 1fca692929..e98c1f61bc 100644 --- a/tools/omapimage.h +++ b/tools/omapimage.h @@ -25,6 +25,20 @@ struct ch_settings { uint8_t reserved[5]; }; +struct ch_qspi { + uint8_t clock; + uint8_t read_cmd; + uint8_t read_type; + uint8_t num_addr_bytes; + uint8_t num_dummy_bytes; + uint8_t qe_num_reg; + uint8_t qe_read_reg_cmd[4]; + uint8_t qe_position; + uint8_t qe_enable; + uint8_t qe_write_enable_cmd; + uint8_t qe_write_reg_cmd; +}; + struct ch_hdr { uint32_t section_key; uint8_t valid; @@ -42,5 +56,6 @@ struct gp_header { uint32_t load_addr; }; -#define KEY_CHSETTINGS 0xC0C0C0C1 +#define KEY_CHSETTINGS 0xC0C0C0C1 +#define KEY_CHQSPI 0xC0C0C0C6 #endif /* _OMAPIMAGE_H_ */