omapimage: Add QSPI CH support for DRA7xx

Introduce the usage of QSPI CH for DRA7xx instead of the default and
dummy CHSETTINGS. This CH is only valid for DRA7xx based devices and
is intended to speed up the boot for QSPI_1 device.

Change-Id: I9ab902f0597a758a48732b4dac18adc2e840f7ab
Signed-off-by: Carlos Leija <cileija@ti.com>
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
This commit is contained in:
Carlos Leija 2013-11-14 12:48:58 +05:30 committed by Tom Rini
parent e9f6b8958f
commit c3a7f32060
4 changed files with 45 additions and 8 deletions

View File

@ -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

View File

@ -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 \

View File

@ -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;

View File

@ -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_ */