Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4435
-gerrit
commit c79a913d967f136a4db1b9d35e54b5cb5844c0ff
Author: Gabe Black <gabeblack(a)google.com>
Date: Tue Aug 6 04:30:13 2013 -0700
ARM: Remove (NOLOAD) from the .car section
On ARM, if the .car section is marked as NOLOAD, there's nothing that sets it
to zero. Some code in the cbmem console depends on a global variable being
zero initially, and if that's not true bad things happen.
Change-Id: Ic72a9fb0ee0c5a608190be6f24d0d7de7c34fc1f
Signed-off-by: Gabe Black <gabeblack(a)google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/64769
Reviewed-by: Stefan Reinauer <reinauer(a)google.com>
Commit-Queue: Gabe Black <gabeblack(a)chromium.org>
Tested-by: Gabe Black <gabeblack(a)chromium.org>
---
src/arch/armv7/romstage.ld | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/arch/armv7/romstage.ld b/src/arch/armv7/romstage.ld
index 11a91cf..459f714 100644
--- a/src/arch/armv7/romstage.ld
+++ b/src/arch/armv7/romstage.ld
@@ -74,7 +74,7 @@ SECTIONS
_ebss = .;
- .car.data . (NOLOAD) : {
+ .car.data . : {
. = ALIGN(8);
_car_data_start = .;
*(.car.global_data);
Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4434
-gerrit
commit bf3fe26e1f400fa2f37076e7a25ae552d14787ca
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Mon Aug 5 18:53:15 2013 -0700
exynos5420: minor correction to CPU frequency print
This divides the CPU frequency by 1,000,000 instead of 2^20.
serial console shows "CPU: S5P5420 @ 800MHz" instead of
claiming 762MHz.
Change-Id: I70cc5b62f689c5553b57c82be61233fb9f733f6e
Reviewed-on: https://gerrit.chromium.org/gerrit/64743
Reviewed-by: Gabe Black <gabeblack(a)chromium.org>
Reviewed-by: Ronald G. Minnich <rminnich(a)chromium.org>
Commit-Queue: David Hendricks <dhendrix(a)chromium.org>
Tested-by: David Hendricks <dhendrix(a)chromium.org>
---
src/cpu/samsung/exynos5420/cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cpu/samsung/exynos5420/cpu.c b/src/cpu/samsung/exynos5420/cpu.c
index 729e6b3..1940b88 100644
--- a/src/cpu/samsung/exynos5420/cpu.c
+++ b/src/cpu/samsung/exynos5420/cpu.c
@@ -159,7 +159,7 @@ static void cpu_enable(device_t dev)
static void cpu_init(device_t dev)
{
printk(BIOS_INFO, "CPU: S5P%X @ %ldMHz\n",
- cpu_id, get_arm_clk() / (1024*1024));
+ cpu_id, get_arm_clk() / 1000000);
usb_init(dev);
}
Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4436
-gerrit
commit 1e3a861eaad2d44a45e5389c5723055e14a7c22e
Author: Gabe Black <gabeblack(a)google.com>
Date: Tue Aug 6 15:36:44 2013 -0700
ARM: Don't inject nobits since we actually want to load these bits
Change-Id: I128e3ecc3773fe7c28616e93ef60b48c5862f302
Signed-off-by: Gabe Black <gabeblack(a)google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/64839
Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
Reviewed-by: Stefan Reinauer <reinauer(a)chromium.org>
Tested-by: Gabe Black <gabeblack(a)chromium.org>
---
src/arch/armv7/include/arch/early_variables.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/arch/armv7/include/arch/early_variables.h b/src/arch/armv7/include/arch/early_variables.h
index 90ead9d..cec0a46 100644
--- a/src/arch/armv7/include/arch/early_variables.h
+++ b/src/arch/armv7/include/arch/early_variables.h
@@ -21,8 +21,8 @@
#define ARCH_EARLY_VARIABLES_H
#ifdef __PRE_RAM__
-#define CAR_GLOBAL __attribute__((section(".car.global_data,\"w\",%nobits@")))
-#define CAR_CBMEM __attribute__((section(".car.cbmem_console,\"w\",%nobits@")))
+#define CAR_GLOBAL __attribute__((section(".car.global_data")))
+#define CAR_CBMEM __attribute__((section(".car.cbmem_console")))
#else
#define CAR_GLOBAL
#define CAR_CBMEM
Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4438
-gerrit
commit db8a2952d8f68c9f32fb37f30e3e3033dabb38f2
Author: Gabe Black <gabeblack(a)google.com>
Date: Mon Aug 5 22:15:21 2013 -0700
exynos5250: Add a pinmux function to set up i2s bus 0
This bus is hooked up on snow and, as it's the only bus hooked up on some
other boards, having it available in firmware to test is handy.
Change-Id: Icb48b9af4a67d382bd6fbce1e4c6a320d811d365
Signed-off-by: Gabe Black <gabeblack(a)google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/64877
Reviewed-by: Ronald G. Minnich <rminnich(a)chromium.org>
Commit-Queue: Stefan Reinauer <reinauer(a)google.com>
Tested-by: Stefan Reinauer <reinauer(a)google.com>
---
src/cpu/samsung/exynos5250/pinmux.c | 10 ++++++++++
src/cpu/samsung/exynos5250/pinmux.h | 1 +
2 files changed, 11 insertions(+)
diff --git a/src/cpu/samsung/exynos5250/pinmux.c b/src/cpu/samsung/exynos5250/pinmux.c
index ab1b25e..b5406af 100644
--- a/src/cpu/samsung/exynos5250/pinmux.c
+++ b/src/cpu/samsung/exynos5250/pinmux.c
@@ -244,6 +244,16 @@ void exynos_pinmux_dphpd(void)
gpio_set_pull(GPIO_X07, GPIO_PULL_NONE);
}
+void exynos_pinmux_i2s0(void)
+{
+ int i;
+
+ for (i = 0; i < 5; i++) {
+ gpio_cfg_pin(GPIO_Z0 + i, GPIO_FUNC(0x02));
+ gpio_set_pull(GPIO_Z0 + i, GPIO_PULL_NONE);
+ }
+}
+
void exynos_pinmux_i2s1(void)
{
int i;
diff --git a/src/cpu/samsung/exynos5250/pinmux.h b/src/cpu/samsung/exynos5250/pinmux.h
index e5cf699..227a280 100644
--- a/src/cpu/samsung/exynos5250/pinmux.h
+++ b/src/cpu/samsung/exynos5250/pinmux.h
@@ -52,6 +52,7 @@ void exynos_pinmux_i2c7(void);
void exynos_pinmux_dphpd(void);
+void exynos_pinmux_i2s0(void);
void exynos_pinmux_i2s1(void);
#endif
Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4456
-gerrit
commit 7674536f0c5b5028d42b2812670a5bb3ea543a66
Author: Julius Werner <jwerner(a)chromium.org>
Date: Tue Aug 6 16:00:37 2013 -0700
exynos5250: Implement support to boot with USB A-A firmware upload
This patch implements the basic infrastructure required to use the USB
A-A firmware upload feature on Exynos5 processors with Coreboot. It will
require a corresponding host-side script that activates the feature and
uploads the correct image parts in the correct order to harcoded target
addresses, as described in the comments of alternate_cbfs.c.
Also fixes a bug in the Google Snow mainboard where it would not
correctly initialize the pinmux configuration for the SPI flash bus.
During a normal SPI boot the IROM would already do that for you, but
when booting from USB you have to do it yourself.
Change-Id: I40a39f8f5d1d70b58dbf258015c1653a27097d67
Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64875
Reviewed-by: Stefan Reinauer <reinauer(a)chromium.org>
Reviewed-by: Hung-Te Lin <hungte(a)chromium.org>
Commit-Queue: Gabe Black <gabeblack(a)chromium.org>
---
src/arch/armv7/bootblock_simple.c | 3 -
src/cpu/samsung/exynos5250/Makefile.inc | 6 +-
src/cpu/samsung/exynos5250/alternate_cbfs.c | 110 ++++++++++++++++++++++++++++
src/cpu/samsung/exynos5250/alternate_cbfs.h | 44 +++++++++++
src/cpu/samsung/exynos5250/cpu.h | 16 ----
src/cpu/samsung/exynos5250/pinmux.c | 5 +-
src/cpu/samsung/exynos5250/spi.c | 7 --
src/mainboard/google/snow/romstage.c | 3 +-
8 files changed, 163 insertions(+), 31 deletions(-)
diff --git a/src/arch/armv7/bootblock_simple.c b/src/arch/armv7/bootblock_simple.c
index 541175c..6ed63ce 100644
--- a/src/arch/armv7/bootblock_simple.c
+++ b/src/arch/armv7/bootblock_simple.c
@@ -55,9 +55,6 @@ void main(void)
/*
* Re-enable icache and branch prediction. MMU and dcache will be
* set up later.
- *
- * Note: If booting from USB, we need to disable branch prediction
- * before copying from USB into RAM (FIXME: why?)
*/
sctlr = read_sctlr();
sctlr |= SCTLR_Z | SCTLR_I;
diff --git a/src/cpu/samsung/exynos5250/Makefile.inc b/src/cpu/samsung/exynos5250/Makefile.inc
index e029c67..6d7ae16 100644
--- a/src/cpu/samsung/exynos5250/Makefile.inc
+++ b/src/cpu/samsung/exynos5250/Makefile.inc
@@ -3,7 +3,7 @@
# image outside of CBFS
INTERMEDIATE += exynos5250_add_bl1
-bootblock-y += spi.c
+bootblock-y += spi.c alternate_cbfs.c
bootblock-y += pinmux.c mct.c power.c
# Clock is required for UART
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += clock_init.c
@@ -16,7 +16,7 @@ bootblock-y += wakeup.c
bootblock-y += gpio.c
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += timer.c
-romstage-y += spi.c
+romstage-y += spi.c alternate_cbfs.c
romstage-y += clock.c
romstage-y += clock_init.c
romstage-y += pinmux.c # required by s3c24x0_i2c and uart.
@@ -35,7 +35,7 @@ romstage-y += i2c.c
#romstage-y += wdt.c
romstage-y += cbmem.c
-ramstage-y += spi.c
+ramstage-y += spi.c alternate_cbfs.c
ramstage-y += clock.c
ramstage-y += clock_init.c
ramstage-y += pinmux.c
diff --git a/src/cpu/samsung/exynos5250/alternate_cbfs.c b/src/cpu/samsung/exynos5250/alternate_cbfs.c
new file mode 100644
index 0000000..1549486
--- /dev/null
+++ b/src/cpu/samsung/exynos5250/alternate_cbfs.c
@@ -0,0 +1,110 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2013 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include <assert.h>
+#include <cbfs.h> /* This driver serves as a CBFS media source. */
+#include <stdlib.h>
+#include <string.h>
+#include <console/console.h>
+#include "alternate_cbfs.h"
+#include "spi.h"
+
+/* This allows USB A-A firmware upload from a compatible host in four parts:
+ * The first two are the bare BL1 and the Coreboot boot block, which are just
+ * written to their respective loading addresses. These transfers are initiated
+ * by the IROM / BL1, so this code has nothing to do with them.
+ *
+ * The third transfer is a valid CBFS image that contains only the romstage,
+ * and must be small enough to fit into alternate_cbfs_size[__BOOT_BLOCK__] in
+ * IRAM. It is loaded when this function gets called in the boot block, and
+ * the normal CBFS code extracts the romstage from it.
+ *
+ * The fourth transfer is also a CBFS image, but can be of arbitrary size and
+ * should contain all available stages/payloads/etc. It is loaded when this
+ * function is called a second time at the end of the romstage, and copied to
+ * alternate_cbfs_buffer[!__BOOT_BLOCK__] in DRAM. It will reside there for the
+ * rest of the firmware's lifetime and all subsequent stages (which will not
+ * have __PRE_RAM__ defined) can just directly reference it there.
+ */
+static int usb_cbfs_open(struct cbfs_media *media) {
+#ifdef __PRE_RAM__
+ static int first_run = 1;
+ int (*irom_load_usb)(void) = *irom_load_image_from_usb_ptr;
+
+ if (!first_run)
+ return 0;
+
+ if (!irom_load_usb()) {
+ printk(BIOS_ERR, "Unable to load CBFS image via USB!\n");
+ return -1;
+ }
+
+ /*
+ * We need to trust the host/irom to copy the image to our
+ * alternate_cbfs_buffer address... there is no way to control or even
+ * check the transfer size or target address from our side.
+ */
+
+ printk(BIOS_DEBUG, "USB A-A transfer successful, CBFS image should now"
+ " be at %p\n", alternate_cbfs_buffer);
+ first_run = 0;
+#endif
+ return 0;
+}
+
+static int alternate_cbfs_close(struct cbfs_media *media) { return 0; }
+
+static size_t alternate_cbfs_read(struct cbfs_media *media, void *dest,
+ size_t offset, size_t count) {
+ ASSERT(offset + count < alternate_cbfs_size);
+ memcpy(dest, alternate_cbfs_buffer + offset, count);
+ return count;
+}
+
+static void *alternate_cbfs_map(struct cbfs_media *media, size_t offset,
+ size_t count) {
+ ASSERT(offset + count < alternate_cbfs_size);
+ return alternate_cbfs_buffer + offset;
+}
+
+static void *alternate_cbfs_unmap(struct cbfs_media *media,
+ const void *buffer) { return 0; }
+
+static int initialize_exynos_usb_cbfs_media(struct cbfs_media *media) {
+ printk(BIOS_DEBUG, "Using Exynos alternate boot mode USB A-A\n");
+
+ media->open = usb_cbfs_open;
+ media->close = alternate_cbfs_close;
+ media->read = alternate_cbfs_read;
+ media->map = alternate_cbfs_map;
+ media->unmap = alternate_cbfs_unmap;
+
+ return 0;
+}
+
+int init_default_cbfs_media(struct cbfs_media *media) {
+ if (*iram_secondary_base == SECONDARY_BASE_BOOT_USB)
+ return initialize_exynos_usb_cbfs_media(media);
+
+ /* TODO: implement SDMMC (and possibly other) boot mode */
+
+ return initialize_exynos_spi_cbfs_media(media,
+ (void*)CONFIG_CBFS_CACHE_ADDRESS, CONFIG_CBFS_CACHE_SIZE);
+}
diff --git a/src/cpu/samsung/exynos5250/alternate_cbfs.h b/src/cpu/samsung/exynos5250/alternate_cbfs.h
new file mode 100644
index 0000000..a26fe61
--- /dev/null
+++ b/src/cpu/samsung/exynos5250/alternate_cbfs.h
@@ -0,0 +1,44 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2013 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef CPU_SAMSUNG_EXYNOS5250_ALTERNATE_CBFS_H
+#define CPU_SAMSUNG_EXYNOS5250_ALTERNATE_CBFS_H
+
+/* These are pointers to function pointers. Double indirection! */
+void * * const irom_sdmmc_read_blocks_ptr = (void * *)0x02020030;
+void * * const irom_msh_read_from_fifo_emmc_ptr = (void * *)0x02020044;
+void * * const irom_msh_end_boot_op_emmc_ptr = (void * *)0x02020048;
+void * * const irom_spi_sf_read_ptr = (void * *)0x02020058;
+void * * const irom_load_image_from_usb_ptr = (void * *)0x02020070;
+
+#define SECONDARY_BASE_BOOT_USB 0xfeed0002
+u32 * const iram_secondary_base = (u32 *)0x02020018;
+
+#if defined(__BOOT_BLOCK__)
+ /* A small space in IRAM to hold the romstage-only image */
+ void * const alternate_cbfs_buffer = (void *)CONFIG_CBFS_CACHE_ADDRESS;
+ size_t const alternate_cbfs_size = CONFIG_CBFS_CACHE_SIZE;
+#else
+ /* Just put this anywhere in RAM that's far enough from anything else */
+ /* TODO: Find a better way to "reserve" this region? */
+ void * const alternate_cbfs_buffer = (void *)0x77400000;
+ size_t const alternate_cbfs_size = 0xc00000;
+#endif
+
+#endif
diff --git a/src/cpu/samsung/exynos5250/cpu.h b/src/cpu/samsung/exynos5250/cpu.h
index 149de6a..f4ab3ed 100644
--- a/src/cpu/samsung/exynos5250/cpu.h
+++ b/src/cpu/samsung/exynos5250/cpu.h
@@ -26,22 +26,6 @@
#define EXYNOS_PRO_ID 0x10000000
-/* Address of address of function that copys data from SD or MMC */
-#define EXYNOS_COPY_MMC_FNPTR_ADDR 0x02020030
-
-/* Address of address of function that copys data from SPI */
-#define EXYNOS_COPY_SPI_FNPTR_ADDR 0x02020058
-
-/* Address of address of function that copys data through USB */
-#define EXYNOS_COPY_USB_FNPTR_ADDR 0x02020070
-
-/* Boot mode values */
-#define EXYNOS_USB_SECONDARY_BOOT 0xfeed0002
-
-#define EXYNOS_IRAM_SECONDARY_BASE 0x02020018
-
-#define EXYNOS_I2C_SPACING 0x10000
-
/* EXYNOS5 */
#define EXYNOS5_GPIO_PART6_BASE 0x03860000 /* Z<6:0> */
#define EXYNOS5_PRO_ID 0x10000000
diff --git a/src/cpu/samsung/exynos5250/pinmux.c b/src/cpu/samsung/exynos5250/pinmux.c
index b5406af..89ce23e 100644
--- a/src/cpu/samsung/exynos5250/pinmux.c
+++ b/src/cpu/samsung/exynos5250/pinmux.c
@@ -134,8 +134,11 @@ static void exynos_pinmux_spi(int start, int cfg)
{
int i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++) {
gpio_cfg_pin(start + i, GPIO_FUNC(cfg));
+ gpio_set_pull(start + i, GPIO_PULL_NONE);
+ gpio_set_drv(start + i, GPIO_DRV_3X);
+ }
}
void exynos_pinmux_spi0(void)
diff --git a/src/cpu/samsung/exynos5250/spi.c b/src/cpu/samsung/exynos5250/spi.c
index 1c365dc..e8b68b4 100644
--- a/src/cpu/samsung/exynos5250/spi.c
+++ b/src/cpu/samsung/exynos5250/spi.c
@@ -214,10 +214,3 @@ int initialize_exynos_spi_cbfs_media(struct cbfs_media *media,
return 0;
}
-
-int init_default_cbfs_media(struct cbfs_media *media) {
- return initialize_exynos_spi_cbfs_media(
- media,
- (void*)CONFIG_CBFS_CACHE_ADDRESS,
- CONFIG_CBFS_CACHE_SIZE);
-}
diff --git a/src/mainboard/google/snow/romstage.c b/src/mainboard/google/snow/romstage.c
index 92fa21e..d45b861 100644
--- a/src/mainboard/google/snow/romstage.c
+++ b/src/mainboard/google/snow/romstage.c
@@ -180,7 +180,8 @@ void main(void)
setup_gpio();
setup_graphics();
- /* Set SPI (primary CBFS media) clock to 50MHz. */
+ /* Set SPI (primary CBFS media) clock to 50MHz and configure pinmux. */
+ exynos_pinmux_spi1();
clock_set_rate(PERIPH_ID_SPI1, 50000000);
cbmem_initialize_empty();
Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4457
-gerrit
commit 0f76bda638538c2ca932d3b8ca752cf41f72c1a1
Author: Gabe Black <gabeblack(a)google.com>
Date: Fri Aug 9 00:31:09 2013 -0700
exynos5420: Configure the UART pins unconditionally
Configure the pins for the UART unconditionally in the mainboard code (when we
know which UART to configure) instead of in the UART driver. This also means
the UART will work if later software wants to use it without setting up the
pins.
Built and booted on pit with the serial turned off and some serial init
in the kernel decompression stub fixed.
Change-Id: Icab5755e4f935f52d44b9cb3b43d1cb62acce08f
Signed-off-by: Gabe Black <gabeblack(a)google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/65299
Reviewed-by: Hung-Te Lin <hungte(a)chromium.org>
Commit-Queue: Gabe Black <gabeblack(a)chromium.org>
Tested-by: Gabe Black <gabeblack(a)chromium.org>
---
src/cpu/samsung/exynos5420/uart.c | 3 ---
src/mainboard/google/pit/romstage.c | 1 +
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/cpu/samsung/exynos5420/uart.c b/src/cpu/samsung/exynos5420/uart.c
index de71b80..c5c8a8c 100644
--- a/src/cpu/samsung/exynos5420/uart.c
+++ b/src/cpu/samsung/exynos5420/uart.c
@@ -93,9 +93,6 @@ static void exynos5_init_dev(void)
{
struct s5p_uart *uart = (struct s5p_uart *)base_port;
- // TODO initialize with correct peripheral id by base_port.
- exynos_pinmux_uart3();
-
/* enable FIFOs */
writel(0x1, &uart->ufcon);
writel(0, &uart->umcon);
diff --git a/src/mainboard/google/pit/romstage.c b/src/mainboard/google/pit/romstage.c
index 853e24d..b74c27f 100644
--- a/src/mainboard/google/pit/romstage.c
+++ b/src/mainboard/google/pit/romstage.c
@@ -250,6 +250,7 @@ void main(void)
* to re-initialize serial console drivers again. */
system_clock_init();
+ exynos_pinmux_uart3();
console_init();
setup_power(is_resume);