arm/davinci: fix DDR2/mDDR memory controller initialization for Omap L138
Subsystems (4)
PATCH 1/6 arm/davinci: fix DDR2/mDDR memory controller initialization for Omap L138
follow section 15.2.13.1 (Initializing Following Device Power Up or Reset) of OMAP-L138 DSP+ARM Processor Technical Reference Manual
--- arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c | 26 +++++++++++++++++------ arch/arm/include/asm/arch-davinci/hardware.h | 1 + 2 files changed, 20 insertions(+), 7 deletions(-)
arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c +19 -7
@@ -190,13 +190,21 @@ int da850_ddr_setup(void)setbits_le32 (&davinci_syscfg1_regs->vtpio_ctl,VTP_LOCK );setbits_le32 (&davinci_syscfg1_regs->vtpio_ctl,VTP_POWERDWN ); - -setbits_le32 (&davinci_syscfg1_regs->vtpio_ctl,VTP_IOPWRDWN ); } - +setbits_le32 (&davinci_syscfg1_regs->vtpio_ctl,VTP_IOPWRDWN );writel (CONFIG_SYS_DA850_DDR2_DDRPHYCR , &dv_ddr2_regs_ctrl->ddrphycr); -clrbits_le32 (&davinci_syscfg1_regs->ddr_slew, - (1 <<DDR_SLEW_CMOSEN_BIT )); + +if (CONFIG_SYS_DA850_DDR2_SDBCR & (1 <<DV_DDR_SDCR_DDR2EN_SHIFT )) { +/* DDR2 */ +clrbits_le32 (&davinci_syscfg1_regs->ddr_slew, + (1 <<DDR_SLEW_DDR_PDENA_BIT ) | + (1 <<DDR_SLEW_CMOSEN_BIT )); + }else { +/* MOBILE DDR */ +setbits_le32 (&davinci_syscfg1_regs->ddr_slew, + (1 <<DDR_SLEW_DDR_PDENA_BIT ) | + (1 <<DDR_SLEW_CMOSEN_BIT )); + }/* * SDRAM Configuration Register (SDCR):
@@ -216,7 +224,11 @@ int da850_ddr_setup(void)writel (tmp, &dv_ddr2_regs_ctrl->sdbcr);/* write memory configuration and timing */ -writel (CONFIG_SYS_DA850_DDR2_SDBCR2 , &dv_ddr2_regs_ctrl->sdbcr2); +if (!(CONFIG_SYS_DA850_DDR2_SDBCR & (1 <<DV_DDR_SDCR_DDR2EN_SHIFT ))) { +/* MOBILE DDR only*/ +writel (CONFIG_SYS_DA850_DDR2_SDBCR2 , + &dv_ddr2_regs_ctrl->sdbcr2); + }writel (CONFIG_SYS_DA850_DDR2_SDTIMR , &dv_ddr2_regs_ctrl->sdtimr);writel (CONFIG_SYS_DA850_DDR2_SDTIMR2 , &dv_ddr2_regs_ctrl->sdtimr2);
@@ -240,7 +252,7 @@ int da850_ddr_setup(void)/* disable self refresh */ clrbits_le32 (&dv_ddr2_regs_ctrl->sdrcr, -DV_DDR_SDRCR_LPMODEN |DV_DDR_SDRCR_LPMODEN ); +DV_DDR_SDRCR_LPMODEN |DV_DDR_SDRCR_MCLKSTOPEN );writel (CONFIG_SYS_DA850_DDR2_PBBPR , &dv_ddr2_regs_ctrl->pbbpr);return 0 ;
arch/arm/include/asm/arch-davinci/hardware.h +1 -0
@@ -505,6 +505,7 @@ struct davinci_syscfg1_regs { ((struct davinci_syscfg1_regs *)DAVINCI_SYSCFG1_BASE)#define DDR_SLEW_CMOSEN_BIT 4 +#define DDR_SLEW_DDR_PDENA_BIT 5#define VTP_POWERDWN (1 << 6)#define VTP_LOCK (1 << 7)
Signature · 1 line
1.7.10
PATCH 2/6 arm/davinci/da850: add uart0 pinmux
--- arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c | 5 +++++ arch/arm/include/asm/arch-davinci/hardware.h | 1 + arch/arm/include/asm/arch-davinci/pinmux_defs.h | 1 + 3 files changed, 7 insertions(+)
arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c +5 -0
@@ -35,6 +35,11 @@ const struct pinmux_config spi1_pins_scs0[] = { };/* UART pin muxer settings */ +const struct pinmux_config uart0_pins_txrx[] = { + {pinmux (3 ),2 ,4 },/* UART0_RXD */ + {pinmux (3 ),2 ,5 },/* UART0_TXD */ +}; +const struct pinmux_config uart1_pins_txrx[] = { {pinmux (4 ),2 ,6 },/* UART1_RXD */ {pinmux (4 ),2 ,7 },/* UART1_TXD */
arch/arm/include/asm/arch-davinci/hardware.h +1 -0
@@ -447,6 +447,7 @@ struct davinci_pllc_regs {/* Clock IDs */ enum davinci_clk_ids {DAVINCI_SPI0_CLKID =2 , +DAVINCI_UART0_CLKID =2 ,DAVINCI_UART2_CLKID =2 ,DAVINCI_MMC_CLKID =2 ,DAVINCI_MDIO_CLKID =4 ,
arch/arm/include/asm/arch-davinci/pinmux_defs.h +1 -0
@@ -28,6 +28,7 @@ extern const struct pinmux_config spi1_pins_base[3];extern const struct pinmux_config spi1_pins_scs0[1 ];/* UART pin muxer settings */ +extern const struct pinmux_config uart0_pins_txrx[2 ];extern const struct pinmux_config uart1_pins_txrx[2 ];extern const struct pinmux_config uart2_pins_txrx[2 ];extern const struct pinmux_config uart2_pins_rtscts[2 ];
Signature · 1 line
1.7.10
PATCH 3/6 serial/ns16550: ns16550 has a different register layout on SOC_DA8XX
In reply to Mikhail Kshevetskiyalso fix NS16550_init() as we need 16x divider
--- drivers/serial/ns16550.c | 2 +- include/ns16550.h | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/serial/ns16550.c +1 -1
@@ -52,7 +52,7 @@ void NS16550_init(NS16550_t com_port, int baud_divisor)serial_out ((baud_divisor >>8 ) &0xff , &com_port->dlm);serial_out (UART_LCRVAL , &com_port->lcr);#if (defined(CONFIG_OMAP ) && !defined(CONFIG_OMAP3_ZOOM2 )) || \ - defined(CONFIG_AM33XX ) + defined(CONFIG_AM33XX ) || defined(CONFIG_SOC_DA8XX )#if defined(CONFIG_APTIX )/* /13 mode so Aptix 6MHz can hit 115200 */
include/ns16550.h +9 -0
@@ -46,6 +46,14 @@ struct NS16550 {UART_REG (lsr);/* 5 */ UART_REG (msr);/* 6 */ UART_REG (spr);/* 7 */ +#ifdef CONFIG_SOC_DA8XX +UART_REG (reg8);/* 8 */ +UART_REG (reg9);/* 9 */ +UART_REG (revid1);/* A */ +UART_REG (revid2);/* B */ +UART_REG (pwr_mgmt);/* C */ +UART_REG (mdr1);/* D */ +#else UART_REG (mdr1);/* 8 */ UART_REG (reg9);/* 9 */ UART_REG (regA);/* A */
@@ -58,6 +66,7 @@ struct NS16550 {UART_REG (ssr);/* 11*/ UART_REG (reg12);/* 12*/ UART_REG (osc_12m_sel);/* 13*/ +#endif };#define thr rbr
Signature · 1 line
1.7.10
PATCH 4/6 mtd/spi/spi_flash: support CMD_READ_ID=0x90 case
In reply to Mikhail Kshevetskiycurrent code does not support spi flashes that have 0x90 read_id command, so fix this
--- drivers/mtd/spi/spi_flash.c | 66 +++++++++++++++++++++++----------- drivers/mtd/spi/spi_flash_internal.h | 1 + 2 files changed, 47 insertions(+), 20 deletions(-)
drivers/mtd/spi/spi_flash.c +46 -20
@@ -306,13 +306,44 @@ static const struct { };#define IDCODE_LEN (IDCODE_CONT_LEN + IDCODE_PART_LEN) +struct spi_flash *spi_analize_flash_probe (struct spi_slave *spi, +u8 *idcode,size_t idcode_len,u8 *id) +{ +struct spi_flash *flash =NULL ; +int i, shift; +u8 *idp; + +#ifdef DEBUG +printf ("SF: Got idcodes\n" ); +print_buffer (0 , idcode,1 , idcode_len,0 ); +#endif + +/* count the number of continuation bytes */ +for (shift =0 , idp = idcode; + shift < idcode_len && *idp ==0x7f ; + ++shift, ++idp) +continue ; + + *id = *idp; +/* search the table for matches in shift and id */ +for (i =0 ; i <ARRAY_SIZE (flashes); ++i) +if (flashes[i].shift == shift && flashes[i].idcode == *idp) { +/* we have a match, call probe */ + flash = flashes[i].probe (spi, idp); +if (flash) +break ; + } + +return flash; +} +struct spi_flash *spi_flash_probe (unsigned int bus,unsigned int cs,unsigned int max_hz,unsigned int spi_mode) {struct spi_slave *spi;struct spi_flash *flash =NULL ; -int ret, i, shift; -u8 idcode[IDCODE_LEN ], *idp; +u8 cmd[4 ], idcode[IDCODE_LEN ], id; +int ret; spi =spi_setup_slave (bus, cs, max_hz, spi_mode);if (!spi) {
@@ -331,28 +362,23 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,if (ret) goto err_read_id; -#ifdef DEBUG -printf ("SF: Got idcodes\n" ); -print_buffer (0 , idcode,1 ,sizeof (idcode),0 ); -#endif + flash =spi_analize_flash_probe (spi, idcode,sizeof (idcode), &id); +if (id ==0xff ) { +/* try CMD_READ_ID_NEW command */ + cmd[0 ] =CMD_READ_ID_NEW ; +spi_flash_addr (0x000000 , cmd); -/* count the number of continuation bytes */ -for (shift =0 , idp = idcode; - shift <IDCODE_CONT_LEN && *idp ==0x7f ; - ++shift, ++idp) -continue ; + ret =spi_flash_cmd_read (spi, cmd,sizeof (cmd), + idcode,sizeof (idcode)); +if (ret) + goto err_read_id; -/* search the table for matches in shift and id */ -for (i =0 ; i <ARRAY_SIZE (flashes); ++i) -if (flashes[i].shift == shift && flashes[i].idcode == *idp) { -/* we have a match, call probe */ - flash = flashes[i].probe (spi, idp); -if (flash) -break ; - } + flash =spi_analize_flash_probe (spi, + idcode,sizeof (idcode), &id); + }if (!flash) { -printf ("SF: Unsupported manufacturer %02x\n" , *idp); +printf ("SF: Unsupported manufacturer %02x\n" , id); goto err_manufacturer_probe; }
drivers/mtd/spi/spi_flash_internal.h +1 -0
@@ -14,6 +14,7 @@/* Common commands */ #define CMD_READ_ID 0x9f +#define CMD_READ_ID_NEW 0x90#define CMD_READ_ARRAY_SLOW 0x03#define CMD_READ_ARRAY_FAST 0x0b
Signature · 1 line
1.7.10
PATCH 5/6 mtd/spi: add sst25l driver
In reply to Mikhail Kshevetskiycurrent SST driver does not support well this types of flash, so use linux-3.3 code as a base.
--- drivers/mtd/spi/Makefile | 3 +- drivers/mtd/spi/spi_flash.c | 3 + drivers/mtd/spi/spi_flash_internal.h | 1 + drivers/mtd/spi/sst25l.c | 372 ++++++++++++++++++++++++++++++++++ 4 files changed, 378 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/spi/sst25l.c
drivers/mtd/spi/Makefile +2 -1
@@ -34,7 +34,8 @@ COBJS-$(CONFIG_SPI_FLASH_ATMEL) += atmel.o COBJS-$(CONFIG_SPI_FLASH_EON) += eon.o COBJS-$(CONFIG_SPI_FLASH_MACRONIX) += macronix.o COBJS-$(CONFIG_SPI_FLASH_SPANSION) += spansion.o -COBJS-$(CONFIG_SPI_FLASH_SST) += sst.o +COBJS-$(CONFIG_SPI_FLASH_SST) += sst.o +COBJS-$(CONFIG_SPI_FLASH_SST25L) += sst25l.o COBJS-$(CONFIG_SPI_FLASH_STMICRO) += stmicro.o COBJS-$(CONFIG_SPI_FLASH_WINBOND) += winbond.o COBJS-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.o
drivers/mtd/spi/spi_flash.c +3 -0
@@ -285,6 +285,9 @@ static const struct { #ifdef CONFIG_SPI_FLASH_SST { 0, 0xbf, spi_flash_probe_sst, }, #endif +#ifdef CONFIG_SPI_FLASH_SST25L + { 0, 0xbf, spi_flash_probe_sst25l, }, +#endif #ifdef CONFIG_SPI_FLASH_STMICRO { 0, 0x20, spi_flash_probe_stmicro, }, #endif
drivers/mtd/spi/spi_flash_internal.h +1 -0
@@ -98,6 +98,7 @@ struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode);struct spi_flash *spi_flash_probe_eon (struct spi_slave *spi,u8 *idcode);struct spi_flash *spi_flash_probe_macronix (struct spi_slave *spi,u8 *idcode);struct spi_flash *spi_flash_probe_sst (struct spi_slave *spi,u8 *idcode); +struct spi_flash *spi_flash_probe_sst25l (struct spi_slave *spi,u8 *idcode);struct spi_flash *spi_flash_probe_stmicro (struct spi_slave *spi,u8 *idcode);struct spi_flash *spi_flash_probe_winbond (struct spi_slave *spi,u8 *idcode);struct spi_flash *spi_fram_probe_ramtron (struct spi_slave *spi,u8 *idcode);
drivers/mtd/spi/sst25l.c new file +372 -0
372 lines not on this page · raw message
Signature · 1 line
1.7.10
PATCH 5/6 mtd/spi: add sst25l driver
Quoted 4 lines · Mikhail Kshevetskiy
current SST driver does not support well this types of flash, so use linux-3.3 code as a base.
Signed-off-by Mikhail Kshevetskiy <[email protected]>
The correct form here is to say:
Backport from Linux commit ....
If this is from the 3.3 release please say that clearly. Thanks!
Signature · 1 line
Tom
PATCH 6/6 MMC: u-boot-spl may be compiled without partition support
In reply to Mikhail Kshevetskiy--- drivers/mmc/mmc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mmc/mmc.c +2 -0
@@ -1253,7 +1253,9 @@ int mmc_startup(struct mmc *mmc) (mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff);sprintf (mmc->block_dev.revision,"%d.%d" , mmc->cid[2 ] >>28 , (mmc->cid[2 ] >>24 ) &0xf ); +#if !defined(CONFIG_SPL_BUILD ) || defined(CONFIG_SPL_LIBDISK_SUPPORT )init_part (&mmc->block_dev); +#endif return 0 ; }
Signature · 1 line
1.7.10