Skip to contentSkip to conversation

arm: ep9315: Return back Cirrus Logic EDB9315A board support

PATCH Superseded Sergey Kostanbev 2 participants 3 messages Apr 17, 2014 – Jun 22, 2014

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 arm: ep9315: Return back Cirrus Logic EDB9315A board support

This patch returns back support for old ep93xx processors family

Cc albert.u.boot at aribaud.net

---
Changes for v6:
- Update patch to cleanly apply

Changes for v5:
- Fix license that dropped during merge
- Better formatting
- Update loader script

Changes for v4:
- Update patch to cleanly apply

Changes for v3:
- Update makefiles to the new style

Changes for v2:
- Replace constants in lowlevel_init.S to defines
- Add more coments in non-trivial places in lowlevel_init.S
- Get rid of ep93xx_sdram_find_bank in lowlevel_init.S and move it to dram_fill_bank_addr in edb93xx.c. This procedure may be executed later at any time, so no need to be in lowlevel

 arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S | 465 ++++++++++++++++++++++++++--
 arch/arm/include/asm/arch-ep93xx/ep93xx.h   |  86 +++++
 board/cirrus/edb93xx/Makefile               |  37 +++
 board/cirrus/edb93xx/edb93xx.c              | 382 +++++++++++++++++++++++
 board/cirrus/edb93xx/u-boot.lds             | 106 +++++++
 boards.cfg                                  |   1 +
 drivers/spi/Makefile                        |   1 +
 drivers/spi/ep93xx_spi.c                    | 274 ++++++++++++++++
 drivers/usb/host/Makefile                   |   1 +
 drivers/usb/host/ohci-ep93xx.c              |  38 +++
 include/configs/edb93xx.h                   | 292 +++++++++++++++++
 11 files changed, 1654 insertions(+), 29 deletions(-)
 create mode 100644 board/cirrus/edb93xx/Makefile
 create mode 100644 board/cirrus/edb93xx/edb93xx.c
 create mode 100644 board/cirrus/edb93xx/u-boot.lds
 create mode 100644 drivers/spi/ep93xx_spi.c
 create mode 100644 drivers/usb/host/ohci-ep93xx.c
 create mode 100644 include/configs/edb93xx.h
arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S +436 -27
index bf2fa2a..3ac0f88 100644
@@ -1,49 +1,458 @@
 /*
  * Low-level initialization for EP93xx
  *
  * Copyright (C) 2009 Matthias Kaehlcke <[email protected]>
+ * Copyright (C) 2013
+ * Sergey Kostanabev <sergey.kostanbaev <at> fairwaves.ru>
  *
  * Copyright (C) 2006 Dominic Rath <[email protected]>
+ * Copyright (C) 2006 Cirrus Logic Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-#include <version.h>
-#include <asm/arch/ep93xx.h>
+#include <config.h>
+#include <asm/arch-ep93xx/ep93xx.h>
+
+/*
+/* Configure the SDRAM based on the supplied settings.
+ *
+ * Input:	r0 - SDRAM DEVCFG register
+ *		r2 - configuration for SDRAM chips
+ * Output:	none
+ * Modifies:	r3, r4
+ */
+ep93xx_sdram_config:
+	/* Program the SDRAM device configuration register. */
+	ldr	r3, =SDRAM_BASE
+#ifdef CONFIG_EDB93XX_SDCS0
+	str	r0, [r3, #SDRAM_OFF_DEVCFG0]
+#endif
+#ifdef CONFIG_EDB93XX_SDCS1
+	str	r0, [r3, #SDRAM_OFF_DEVCFG1]
+#endif
+#ifdef CONFIG_EDB93XX_SDCS2
+	str	r0, [r3, #SDRAM_OFF_DEVCFG2]
+#endif
+#ifdef CONFIG_EDB93XX_SDCS3
+	str	r0, [r3, #SDRAM_OFF_DEVCFG3]
+#endif
+
+	/* Set the Initialize and MRS bits (issue continuous NOP commands
+	 * (INIT & MRS set))
+	 */
+	ldr	r4, =(EP93XX_SDRAMCTRL_GLOBALCFG_INIT | \
+			EP93XX_SDRAMCTRL_GLOBALCFG_MRS | \
+			EP93XX_SDRAMCTRL_GLOBALCFG_CKE)
+	str	r4, [r3, #SDRAM_OFF_GLCONFIG]
+
+	/* Delay for 200us. */
+	mov	r4, #0x3000
+delay1:
+	subs	r4, r4, #1
+	bne	delay1
+
+	/* Clear the MRS bit to issue a precharge all. */
+	ldr	r4, =(EP93XX_SDRAMCTRL_GLOBALCFG_INIT | \
+			EP93XX_SDRAMCTRL_GLOBALCFG_CKE)
+	str	r4, [r3, #SDRAM_OFF_GLCONFIG]
+
+	/* Temporarily set the refresh timer to 0x10. Make it really low so
+	 * that refresh cycles are generated.
+	 */
+	ldr	r4, =0x10
+	str	r4, [r3, #SDRAM_OFF_REFRSHTIMR]
+
+	/* Delay for at least 80 SDRAM clock cycles. */
+	mov	r4, #80
+delay2:
+	subs	r4, r4, #1
+	bne	delay2
+
+	/* Set the refresh timer to the fastest required for any device
+	 * that might be used. Set 9.6 ms refresh time.
+	 */
+	ldr	r4, =0x01e0
+	str	r4, [r3, #SDRAM_OFF_REFRSHTIMR]
+
+	/* Select mode register update mode. */
+	ldr	r4, =(EP93XX_SDRAMCTRL_GLOBALCFG_CKE | \
+			EP93XX_SDRAMCTRL_GLOBALCFG_MRS)
+	str	r4, [r3, #SDRAM_OFF_GLCONFIG]
+
+	/* Program the mode register on the SDRAM by performing fake read */
+	ldr	r4, [r2]
+
+	/* Select normal operating mode. */
+	ldr	r4, =EP93XX_SDRAMCTRL_GLOBALCFG_CKE
+	str	r4, [r3, #SDRAM_OFF_GLCONFIG]
+
+	/* Return to the caller. */
+	mov	pc, lr
+
+/*
+ * Test to see if the SDRAM has been configured in a usable mode.
+ *
+ * Input:	r0 - Test address of SDRAM
+ * Output:	r0 - 0 -- Test OK, -1 -- Failed
+ * Modifies:	r0-r5
+ */
+ep93xx_sdram_test:
+	/* Load the test patterns to be written to SDRAM. */
+	ldr	r1, =0xf00dface
+	ldr	r2, =0xdeadbeef
+	ldr	r3, =0x08675309
+	ldr	r4, =0xdeafc0ed
+
+	/* Store the test patterns to SDRAM. */
+	stmia	r0, {r1-r4}
+
+	/* Load the test patterns from SDRAM one at a time and compare them
+	 * to the actual pattern.
+	 */
+	ldr	r5, [r0]
+	cmp	r5, r1
+	ldreq	r5, [r0, #0x0004]
+	cmpeq	r5, r2
+	ldreq	r5, [r0, #0x0008]
+	cmpeq	r5, r3
+	ldreq	r5, [r0, #0x000c]
+	cmpeq	r5, r4
+
+	/* Return -1 if a mismatch was encountered, 0 otherwise. */
+	mvnne	r0, #0xffffffff
+	moveq	r0, #0x00000000
+
+	/* Return to the caller. */
+	mov	pc, lr
+
+/*
+ * Determine the size of the SDRAM. Use data=address for the scan.
+ *
+ * Input:	r0 - Start SDRAM address
+ * Return:	r0 - Single block size
+ *		r1 - Valid block mask
+ *		r2 - Total block count
+ * Modifies:	r0-r5
+ */
+ep93xx_sdram_size:
+	/* Store zero at offset zero. */
+	str	r0, [r0]
+
+	/* Start checking for an alias at 1MB into SDRAM. */
+	ldr	r1, =0x00100000
+
+	/* Store the offset at the current offset. */
+check_block_size:
+	str	r1, [r0, r1]
+
+	/* Read back from zero. */
+	ldr	r2, [r0]
+
+	/* Stop searching of an alias was found. */
+	cmp	r1, r2
+	beq	found_block_size
+
+	/* Advance to the next power of two boundary. */
+	mov	r1, r1, lsl #1
+
+	/* Loop back if the size has not reached 256MB. */
+	cmp	r1, #0x10000000
+	bne	check_block_size
+
+	/* A full 256MB of memory was found, so return it now. */
+	ldr	r0, =0x10000000
+	ldr	r1, =0x00000000
+	ldr	r2, =0x00000001
+	mov	pc, lr
+
+	/* An alias was found. See if the first block is 128MB in size. */
+found_block_size:
+	cmp	r1, #0x08000000
+
+	/* The first block is 128MB, so there is no further memory. Return it
+	 * now.
+	 */
+	ldreq	r0, =0x08000000
+	ldreq	r1, =0x00000000
+	ldreq	r2, =0x00000001
+	moveq	pc, lr
+
+	/* Save the block size, set the block address bits to zero, and
+	 * initialize the block count to one.
+	 */
+	mov	r3, r1
+	ldr	r4, =0x00000000
+	ldr	r5, =0x00000001
+
+	/* Look for additional blocks of memory by searching for non-aliases. */
+find_blocks:
+	/* Store zero back to address zero. It may be overwritten. */
+	str	r0, [r0]
+
+	/* Advance to the next power of two boundary. */
+	mov	r1, r1, lsl #1
+
+	/* Store the offset at the current offset. */
+	str	r1, [r0, r1]
+
+	/* Read back from zero. */
+	ldr	r2, [r0]
+
+	/* See if a non-alias was found. */
+	cmp	r1, r2
+
+	/* If a non-alias was found, then or in the block address bit and
+	 * multiply the block count by two (since there are two unique
+	 * blocks, one with this bit zero and one with it one).
+	 */
+	orrne	r4, r4, r1
+	movne	r5, r5, lsl #1
+
+	/* Continue searching if there are more address bits to check. */
+	cmp	r1, #0x08000000
+	bne	find_blocks
+
+	/* Return the block size, address mask, and count. */
+	mov	r0, r3
+	mov	r1, r4
+	mov	r2, r5
+
+	/* Return to the caller. */
+	mov	pc, lr
+
 
 .globl lowlevel_init
 lowlevel_init:
-	/* backup return address */
-	ldr r1, =SYSCON_SCRATCH0
-	str lr, [r1]
 
-	/* Turn on both LEDs */
-	bl red_led_on
-	bl green_led_on
+	mov	r6, lr
+
+	/* Make sure caches are off and invalidated. */
+	ldr	r0, =0x00000000
+	mcr	p15, 0, r0, c1, c0, 0
+	nop
+	nop
+	nop
+	nop
+	nop
+
+	/* Turn off the green LED and turn on the red LED. If the red LED
+	 * is left on for too long, the external reset circuit described
+	 * by application note AN258 will cause the system to reset.
+	 */
+	ldr	r1, =EP93XX_LED_DATA
+	ldr	r0, [r1]
+	bic	r0, r0, #EP93XX_LED_GREEN_ON
+	orr	r0, r0, #EP93XX_LED_RED_ON
+	str	r0, [r1]
+
+	/* Undo the silly static memory controller programming performed
+	 * by the boot rom.
+	 */
+	ldr	r0, =SMC_BASE
+
+	/* Set WST1 and WST2 to 31 HCLK cycles (slowest access) */
+	ldr	r1, =0x0000fbe0
+
+	/* Reset EP93XX_OFF_SMCBCR0 */
+	ldr	r2, [r0]
+	orr	r2, r2, r1
+	str	r2, [r0]
+
+	ldr	r2, [r0, #EP93XX_OFF_SMCBCR1]
+	orr	r2, r2, r1
+	str	r2, [r0, #EP93XX_OFF_SMCBCR1]
+
+	ldr	r2, [r0, #EP93XX_OFF_SMCBCR2]
+	orr	r2, r2, r1
+	str	r2, [r0, #EP93XX_OFF_SMCBCR2]
+
+	ldr	r2, [r0, #EP93XX_OFF_SMCBCR3]
+	orr	r2, r2, r1
+	str	r2, [r0, #EP93XX_OFF_SMCBCR3]
+
+	ldr	r2, [r0, #EP93XX_OFF_SMCBCR6]
+	orr	r2, r2, r1
+	str	r2, [r0, #EP93XX_OFF_SMCBCR6]
+
+	ldr	r2, [r0, #EP93XX_OFF_SMCBCR7]
+	orr	r2, r2, r1
+	str	r2, [r0, #EP93XX_OFF_SMCBCR7]
+
+	/* Set the PLL1 and processor clock. */
+	ldr	r0, =SYSCON_BASE
+#ifdef CONFIG_EDB9301
+	/* 332MHz, giving a 166MHz processor clock. */
+	ldr	r1, = 0x02b49907
+#else
+
+#ifdef CONFIG_EDB93XX_INDUSTRIAL
+	/* 384MHz, giving a 196MHz processor clock. */
+	ldr	r1, =0x02a4bb38
+#else
+	/* 400MHz, giving a 200MHz processor clock. */
+	ldr	r1, =0x02a4e39e
+#endif
+#endif
+	str	r1, [r0, #SYSCON_OFF_CLKSET1]
+
+	nop
+	nop
+	nop
+	nop
+	nop
+
+	/* Need to make sure that SDRAM is configured correctly before
+	 * coping the code into it.
+	 */
+
+#ifdef CONFIG_EDB93XX_SDCS0
+	mov	r11, #SDRAM_DEVCFG0_BASE
+#endif
+#ifdef CONFIG_EDB93XX_SDCS1
+	mov	r11, #SDRAM_DEVCFG1_BASE
+#endif
+#ifdef CONFIG_EDB93XX_SDCS2
+	mov	r11, #SDRAM_DEVCFG2_BASE
+#endif
+#ifdef CONFIG_EDB93XX_SDCS3
+	ldr	r0, =SYSCON_BASE
+	ldr	r0, [r0, #SYSCON_OFF_SYSCFG]
+	ands	r0, r0, #SYSCON_SYSCFG_LASDO
+	moveq	r11, #SDRAM_DEVCFG3_ASD0_BASE
+	movne	r11, #SDRAM_DEVCFG3_ASD1_BASE
+#endif
+	/* See Table 13-5 in EP93xx datasheet for more info about DRAM
+	 * register mapping */
+
+	/* Try a 32-bit wide configuration of SDRAM. */
+	ldr	r0, =(EP93XX_SDRAMCTRL_DEVCFG_BANKCOUNT | \
+			EP93XX_SDRAMCTRL_DEVCFG_SROMLL | \
+			EP93XX_SDRAMCTRL_DEVCFG_CASLAT_2 | \
+			EP93XX_SDRAMCTRL_DEVCFG_RASTOCAS_2)
+
+	/* Set burst count: 4 and CAS: 2
+	 * Burst mode [A11:A10]; CAS [A16:A14]
+	 */
+	orr	r2, r11, #0x00008800
+	bl	ep93xx_sdram_config
+
+	/* Test the SDRAM. */
+	mov	r0, r11
+	bl	ep93xx_sdram_test
+	cmp	r0, #0x00000000
+	beq	ep93xx_sdram_done
+
+	/* Try a 16-bit wide configuration of SDRAM. */
+	ldr	r0, =(EP93XX_SDRAMCTRL_DEVCFG_BANKCOUNT | \
+			EP93XX_SDRAMCTRL_DEVCFG_SROMLL | \
+			EP93XX_SDRAMCTRL_DEVCFG_CASLAT_2 | \
+			EP93XX_SDRAMCTRL_DEVCFG_RASTOCAS_2 | \
+			EP93XX_SDRAMCTRL_DEVCFG_EXTBUSWIDTH)
+
+	/* Set burst count: 8, CAS: 2, sequential burst
+	 * Accoring to Table 13-3 for 16bit operations mapping must be shifted.
+	 * Burst mode [A10:A9]; CAS [A15:A13]
+	 */
+	orr	r2, r11, #0x00004600
+	bl	ep93xx_sdram_config
+
+	/* Test the SDRAM. */
+	mov	r0, r11
+	bl	ep93xx_sdram_test
+	cmp	r0, #0x00000000
+	beq	ep93xx_sdram_done
+
+	/* Turn off the red LED. */
+	ldr	r0, =EP93XX_LED_DATA
+	ldr	r1, [r0]
+	bic	r1, r1, #EP93XX_LED_RED_ON
+	str	r1, [r0]
+
+	/* There is no SDRAM so flash the green LED. */
+flash_green:
+	orr	r1, r1, #EP93XX_LED_GREEN_ON
+	str	r1, [r0]
+	ldr	r2, =0x00010000
+flash_green_delay_1:
+	subs	r2, r2, #1
+	bne	flash_green_delay_1
+	bic	r1, r1, #EP93XX_LED_GREEN_ON
+	str	r1, [r0]
+	ldr	r2, =0x00010000
+flash_green_delay_2:
+	subs	r2, r2, #1
+	bne	flash_green_delay_2
+	orr	r1, r1, #EP93XX_LED_GREEN_ON
+	str	r1, [r0]
+	ldr	r2, =0x00010000
+flash_green_delay_3:
+	subs	r2, r2, #1
+	bne	flash_green_delay_3
+	bic	r1, r1, #EP93XX_LED_GREEN_ON
+	str	r1, [r0]
+	ldr	r2, =0x00050000
+flash_green_delay_4:
+	subs	r2, r2, #1
+	bne	flash_green_delay_4
+	b	flash_green
+
 
-	/* Configure flash wait states before we switch to the PLL */
-	bl flash_cfg
+ep93xx_sdram_done:
+	ldr	r1, =EP93XX_LED_DATA
+	ldr	r0, [r1]
+	bic	r0, r0, #EP93XX_LED_RED_ON
+	str	r0, [r1]
 
-	/* Set up PLL */
-	bl pll_cfg
+	/* Determine the size of the SDRAM. */
+	mov	r0, r11
+	bl	ep93xx_sdram_size
 
-	/* Turn off the Green LED and leave the Red LED on */
-	bl green_led_off
+	/* Save the SDRAM characteristics. */
+	mov	r8, r0
+	mov	r9, r1
+	mov	r10, r2
 
-	/* Setup SDRAM */
-	bl sdram_cfg
+	/* Compute total memory size into r1 */
+	mul	r1, r8, r10
+#ifdef CONFIG_EDB93XX_SDCS0
+	ldr	r2, [r0, #SDRAM_OFF_DEVCFG0]
+#endif
+#ifdef CONFIG_EDB93XX_SDCS1
+	ldr	r2, [r0, #SDRAM_OFF_DEVCFG1]
+#endif
+#ifdef CONFIG_EDB93XX_SDCS2
+	ldr	r2, [r0, #SDRAM_OFF_DEVCFG2]
+#endif
+#ifdef CONFIG_EDB93XX_SDCS3
+	ldr	r2, [r0, #SDRAM_OFF_DEVCFG3]
+#endif
 
-	/* Turn on Green LED, Turn off the Red LED */
-	bl green_led_on
-	bl red_led_off
+	/* Consider small DRAM size as:
+	 * < 32Mb for 32bit bus
+	 * < 64Mb for 16bit bus
+	 */
+	tst	r2, #EP93XX_SDRAMCTRL_DEVCFG_EXTBUSWIDTH
+	moveq	r1, r1, lsr #1
+	cmp	r1, #0x02000000
 
-	/* FIXME: we use async mode for now */
-	mrc p15, 0, r0, c1, c0, 0
-	orr r0, r0, #0xc0000000
-	mcr p15, 0, r0, c1, c0, 0
+#if defined(CONFIG_EDB9301)
+	/* Set refresh counter to 20ms for small DRAM size, otherwise 9.6ms */
+	movlt	r1, #0x03f0
+	movge	r1, #0x01e0
+#else
+	/* Set refresh counter to 30.7ms for small DRAM size, otherwise 15ms */
+	movlt	r1, #0x0600
+	movge	r1, #0x2f0
+#endif
+	str	r1, [r0, #SDRAM_OFF_REFRSHTIMR]
 
-	/* restore return address */
-	ldr r1, =SYSCON_SCRATCH0
-	ldr lr, [r1]
+	/* Save the memory configuration information. */
+	orr	r0, r11, #UBOOT_MEMORYCNF_BANK_SIZE
+	stmia	r0, {r8-r11}
 
-	mov pc, lr
+	mov	lr, r6
+	mov	pc, lr
arch/arm/include/asm/arch-ep93xx/ep93xx.h +85 -0

137 lines not on this page · raw message

board/cirrus/edb93xx/Makefile new file +11 -0
new file mode 100644
index 0000000..d03c498
@@ -0,0 +1,11 @@
+#
+# (C) Copyright 2013
+# Sergey Kostanbaev <sergey.kostanbaev <at> fairwaves.ru>
+#
+# (C) Copyright 2003-2006
+# Wolfgang Denk, DENX Software Engineering, wd <at> denx.de.
+#
+# * SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= edb93xx.o
board/cirrus/edb93xx/edb93xx.c new file +382 -0

382 lines not on this page · raw message

board/cirrus/edb93xx/u-boot.lds new file +115 -0

115 lines not on this page · raw message

boards.cfg +1 -0
index 2128996..4c5f1b8 100644
@@ -74,6 +74,7 @@ Active  arm         arm920t        ks8695      -               -
 Active  arm         arm920t        ks8695      -               -                   cm41xx                                -                                                                                                                                 -
 Active  arm         arm920t        s3c24x0     mpl             vcma9               VCMA9                                 -                                                                                                                                 David M?ller <[email protected]>
 Active  arm         arm920t        s3c24x0     samsung         -                   smdk2410                              -                                                                                                                                 David M?ller <[email protected]>
+Active  arm         arm920t        ep93xx      cirrus          edb93xx             edb9315a                              edb93xx:MK_edb9315a                                                                                                               Sergey Kostanbaev <[email protected]>
 Active  arm         arm926ejs      -           armltd          integrator          integratorap_cm926ejs                 integratorap:CM926EJ_S                                                                                                            Linus Walleij <[email protected]>
 Active  arm         arm926ejs      -           armltd          integrator          integratorcp_cm926ejs                 integratorcp:CM924EJ_S                                                                                                            Linus Walleij <[email protected]>
 Active  arm         arm926ejs      armada100   Marvell         -                   aspenite                              -                                                                                                                                 Prafulla Wadaskar <[email protected]>
drivers/spi/Makefile +1 -0
index ed4ecd7..c5d6c6a 100644
@@ -8,6 +8,7 @@
 # There are many options which enable SPI, so make this library available
 obj-y += spi.o
 
+obj-$(CONFIG_EP93XX_SPI) += ep93xx_spi.o
 obj-$(CONFIG_ALTERA_SPI) += altera_spi.o
 obj-$(CONFIG_ANDES_SPI) += andes_spi.o
 obj-$(CONFIG_ARMADA100_SPI) += armada100_spi.o
drivers/spi/ep93xx_spi.c new file +274 -0

274 lines not on this page · raw message

drivers/usb/host/Makefile +1 -0
index 1417028..5cab359 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
 obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
 obj-$(CONFIG_USB_SL811HS) += sl811-hcd.o
 obj-$(CONFIG_USB_OHCI_S3C24XX) += ohci-s3c24xx.o
+obj-$(CONFIG_USB_OHCI_EP93XX) += ohci-ep93xx.o
 
 # echi
 obj-$(CONFIG_USB_EHCI) += ehci-hcd.o
drivers/usb/host/ohci-ep93xx.c new file +38 -0
new file mode 100644
index 0000000..8fb4aba
@@ -0,0 +1,38 @@
+/*
+ * (C) Copyright 2013
+ * Sergey Kostanbaev < sergey.kostanbaev <at> fairwaves.ru >
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <config.h>
+#include <common.h>
+
+#if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT)
+#include <asm/io.h>
+#include <asm/arch/ep93xx.h>
+
+int usb_cpu_init(void)
+{
+	struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE;
+	unsigned long pwr = readl(&syscon->pwrcnt);
+	writel(pwr | SYSCON_PWRCNT_USH_EN, &syscon->pwrcnt);
+
+	return 0;
+}
+
+int usb_cpu_stop(void)
+{
+	struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE;
+	unsigned long pwr = readl(&syscon->pwrcnt);
+	writel(pwr &  ~SYSCON_PWRCNT_USH_EN, &syscon->pwrcnt);
+
+	return 0;
+}
+
+int usb_cpu_init_fail(void)
+{
+	return usb_cpu_stop();
+}
+
+#endif /* defined(CONFIG_USB_OHCI) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT) */
include/configs/edb93xx.h new file +292 -0

292 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v4 1/1 arm: ep9315: Return back Cirrus Logic EDB9315A board support

Hi Sergey,

Quoted 5 lines · Sergey Kostanbaev
arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S +0 -0
index bf2fa2a..3ac0f88 100644

arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S line 7

Quoted 9 lines
arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S +3 -2
@@ -1,49 +1,456 @@
 /*
  * Low-level initialization for EP93xx
  *
- * Copyright (C) 2009 Matthias Kaehlcke <[email protected]>
+ * Copyright (C) 2013
+ * Sergey Kostanabev <sergey.kostanbaev <at> fairwaves.ru>
  *
- * Copyright (C) 2006 Dominic Rath <[email protected]>
+ * Copyright (C) 2006 Cirrus Logic Inc.

Why do you remove existing copyright attributions?

arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S line 141

Quoted 11 lines

[...]

+ * Determine the size of the SDRAM. Use data=address for the scan.

arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S +8 -0
+
+ * Input:	r0 - Start SDRAM address
+ * Return:	r0 - Single block size
+ *		r1 - Valid block mask
+ *		r2 - Total block count
+ * Modifies:	r0-r5
+ */
+ep93xx_sdram_size:

Is this needed? Can't the general get_ram_size() function be used?

Quoted 7 lines
arch/arm/include/asm/arch-ep93xx/ep93xx.h +0 -0
index 9e7f2f3..71aa601 100644
@@ -580,3 +658,11 @@ struct syscon_regs {
 /*

arch/arm/include/asm/arch-ep93xx/ep93xx.h struct syscon_regs { · line 668

Quoted 10 lines
arch/arm/include/asm/arch-ep93xx/ep93xx.h +8 -0
  * 0x80950000 - 0x9000FFFF: Reserved
  */
+
+/*
+ * During low_level init we store memory layout in memory at specific location
+ */
+#define UBOOT_MEMORYCNF_BANK_SIZE		0x2000
+#define UBOOT_MEMORYCNF_BANK_MASK		0x2004
+#define UBOOT_MEMORYCNF_BANK_COUNT		0x2008
+

Remove blank line at EOF.

board/cirrus/edb93xx/u-boot.lds

Quoted 1 line
board/cirrus/edb93xx/u-boot.lds +0 -0

Does this board need a specific .lds file?

board/cirrus/edb93xx/u-boot.lds

Quoted 8 lines

[...]

board/cirrus/edb93xx/u-boot.lds +6 -0
+	/DISCARD/ : { *(.dynsym) }
+	/DISCARD/ : { *(.dynstr*) }
+	/DISCARD/ : { *(.dynamic*) }
+	/DISCARD/ : { *(.plt*) }
+	/DISCARD/ : { *(.interp*) }
+	/DISCARD/ : { *(.gnu*) }

We don't /DISCARD/ these sections any more. If for some reason the generic .lds fils cannot be used, then adapt this one to current practice.

Amicalement,

Signature · 1 line
Albert.
#2 lore raw

PATCH v4 1/1 arm: ep9315: Return back Cirrus Logic EDB9315A board support

Hi Albert,
See answers below

Quoted 7 lines · Albert ARIBAUD

Hi Sergey,

Review

Quoted 1 line · Sergey Kostanbaev
(quoted diff) +0 -0

b/arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S

Quoted 16 lines

arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S line 7

Quoted 13 lines

index bf2fa2a..3ac0f88 100644

arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S +3 -2
@@ -1,49 +1,456 @@
 /*
  * Low-level initialization for EP93xx
  *
- * Copyright (C) 2009 Matthias Kaehlcke <[email protected]>
+ * Copyright (C) 2013
+ * Sergey Kostanabev <sergey.kostanbaev <at> fairwaves.ru>
  *
- * Copyright (C) 2006 Dominic Rath <[email protected]>
+ * Copyright (C) 2006 Cirrus Logic Inc.

Why do you remove existing copyright attributions?

Actually I used a completely different solution. I can add old ones.

Quoted 15 lines

arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S line 141

Quoted 12 lines

[...]

+ * Determine the size of the SDRAM. Use data=address for the scan.

arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S +8 -0
+
+ * Input:    r0 - Start SDRAM address
+ * Return:   r0 - Single block size
+ *           r1 - Valid block mask
+ *           r2 - Total block count
+ * Modifies: r0-r5
+ */
+ep93xx_sdram_size:

Is this needed? Can't the general get_ram_size() function be used?

This is REALLY needed. It's a key feature it calculates RAM size at runtime otherwise you have to put constant of data-bus width, actual memory installed. And this procedure does it and you don't have to recompile it for the very specific board with similar processor family.

Quoted 15 lines

Review

Quoted 2 lines
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-ep93xx/ep93xx.h

arch/arm/include/asm/arch-ep93xx/ep93xx.h struct syscon_regs { · line 663

Quoted 11 lines

index 9e7f2f3..71aa601 100644

arch/arm/include/asm/arch-ep93xx/ep93xx.h +3 -0
@@ -580,3 +658,11 @@ struct syscon_regs {
 /*
  * 0x80950000 - 0x9000FFFF: Reserved
  */
+
+/*
+ * During low_level init we store memory layout in memory at specific

location

Quoted 8 lines

arch/arm/include/asm/arch-ep93xx/ep93xx.h struct syscon_regs {

Quoted 5 lines
arch/arm/include/asm/arch-ep93xx/ep93xx.h +5 -0
+ */
+#define UBOOT_MEMORYCNF_BANK_SIZE            0x2000
+#define UBOOT_MEMORYCNF_BANK_MASK            0x2004
+#define UBOOT_MEMORYCNF_BANK_COUNT           0x2008
+

Remove blank line at EOF.

Ok

Quoted 6 lines

Review

Quoted 2 lines
(quoted diff) +0 -0

b/board/cirrus/edb93xx/u-boot.lds

Does this board need a specific .lds file?

Yes. It must have special magic header to start booting otherwise it will be considered as invalid image and internal boot ROOM ignore it.

Quoted 10 lines

arch/arm/include/asm/arch-ep93xx/ep93xx.h

Quoted 9 lines

[...]

arch/arm/include/asm/arch-ep93xx/ep93xx.h +6 -0
+     /DISCARD/ : { *(.dynsym) }
+     /DISCARD/ : { *(.dynstr*) }
+     /DISCARD/ : { *(.dynamic*) }
+     /DISCARD/ : { *(.plt*) }
+     /DISCARD/ : { *(.interp*) }
+     /DISCARD/ : { *(.gnu*) }
Quoted 4 lines

We don't /DISCARD/ these sections any more. If for some reason the generic .lds fils cannot be used, then adapt this one to current practice.

Ok I can remove these DISCARD.

Quoted 5 lines

Amicalement,
--
Albert.