Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4567
-gerrit
commit 2c36767596dee7786b8415734dc0455ae43594cb
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Sun Dec 22 23:14:27 2013 +0200
AMD K8 (rev F): Move MEM_TRAIN_SEQ check to northbridge
Do it just to remove MEM_TRAIN_SEQ test under mainboard/ to see all
K8 rev F boards do the same things here.
Change-Id: If75035a4ef8882c2618d434d83ba59c408593d86
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/mainboard/amd/serengeti_cheetah/romstage.c | 2 --
src/mainboard/asus/m2n-e/romstage.c | 2 --
src/mainboard/gigabyte/ga_2761gxdk/romstage.c | 2 --
src/mainboard/gigabyte/m57sli/romstage.c | 2 --
src/mainboard/hp/dl145_g3/romstage.c | 2 --
src/mainboard/msi/ms7260/romstage.c | 2 --
src/mainboard/nvidia/l1_2pvv/romstage.c | 2 --
src/mainboard/supermicro/h8dme/romstage.c | 2 --
src/mainboard/supermicro/h8dmr/romstage.c | 2 --
src/mainboard/tyan/s2912/romstage.c | 2 --
src/northbridge/amd/amdk8/raminit_f_dqs.c | 5 +++--
11 files changed, 3 insertions(+), 22 deletions(-)
diff --git a/src/mainboard/amd/serengeti_cheetah/romstage.c b/src/mainboard/amd/serengeti_cheetah/romstage.c
index 8d985b7..20fe0f3 100644
--- a/src/mainboard/amd/serengeti_cheetah/romstage.c
+++ b/src/mainboard/amd/serengeti_cheetah/romstage.c
@@ -137,9 +137,7 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
print_debug("bsp_apicid="); print_debug_hex8(bsp_apicid); print_debug("\n");
-#if CONFIG_MEM_TRAIN_SEQ == 1
set_sysinfo_in_ram(0); // in BSP so could hold all ap until sysinfo is in ram
-#endif
setup_coherent_ht_domain(); // routing table and start other core0
wait_all_core0_started();
diff --git a/src/mainboard/asus/m2n-e/romstage.c b/src/mainboard/asus/m2n-e/romstage.c
index b6d7625..62891ff 100644
--- a/src/mainboard/asus/m2n-e/romstage.c
+++ b/src/mainboard/asus/m2n-e/romstage.c
@@ -123,10 +123,8 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
printk(BIOS_DEBUG, "*sysinfo range: [%p,%p]\n",sysinfo, sysinfo + 1);
printk(BIOS_DEBUG, "bsp_apicid=0x%02x\n", bsp_apicid);
-#if CONFIG_MEM_TRAIN_SEQ == 1
/* In BSP so could hold all AP until sysinfo is in RAM. */
set_sysinfo_in_ram(0);
-#endif
setup_coherent_ht_domain(); /* Routing table and start other core0. */
wait_all_core0_started();
diff --git a/src/mainboard/gigabyte/ga_2761gxdk/romstage.c b/src/mainboard/gigabyte/ga_2761gxdk/romstage.c
index e06cb5b..09e9857 100644
--- a/src/mainboard/gigabyte/ga_2761gxdk/romstage.c
+++ b/src/mainboard/gigabyte/ga_2761gxdk/romstage.c
@@ -147,9 +147,7 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
print_debug("bsp_apicid="); print_debug_hex8(bsp_apicid); print_debug("\n");
-#if CONFIG_MEM_TRAIN_SEQ == 1
set_sysinfo_in_ram(0); // in BSP so could hold all ap until sysinfo is in ram
-#endif
setup_coherent_ht_domain(); // routing table and start other core0
wait_all_core0_started();
diff --git a/src/mainboard/gigabyte/m57sli/romstage.c b/src/mainboard/gigabyte/m57sli/romstage.c
index 469e195..3004f7f 100644
--- a/src/mainboard/gigabyte/m57sli/romstage.c
+++ b/src/mainboard/gigabyte/m57sli/romstage.c
@@ -150,9 +150,7 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
print_debug("bsp_apicid="); print_debug_hex8(bsp_apicid); print_debug("\n");
-#if CONFIG_MEM_TRAIN_SEQ == 1
set_sysinfo_in_ram(0); // in BSP so could hold all ap until sysinfo is in ram
-#endif
setup_coherent_ht_domain(); // routing table and start other core0
wait_all_core0_started();
diff --git a/src/mainboard/hp/dl145_g3/romstage.c b/src/mainboard/hp/dl145_g3/romstage.c
index 3d2d3cd..4b31bb7 100644
--- a/src/mainboard/hp/dl145_g3/romstage.c
+++ b/src/mainboard/hp/dl145_g3/romstage.c
@@ -160,9 +160,7 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
printk(BIOS_DEBUG, "*sysinfo range: [%p,%p]\n",sysinfo,sysinfo+1);
printk(BIOS_DEBUG, "bsp_apicid=%02x\n", bsp_apicid);
-#if CONFIG_MEM_TRAIN_SEQ == 1
set_sysinfo_in_ram(0); // in BSP so could hold all ap until sysinfo is in ram
-#endif
setup_coherent_ht_domain();
wait_all_core0_started();
diff --git a/src/mainboard/msi/ms7260/romstage.c b/src/mainboard/msi/ms7260/romstage.c
index 96a0c1b..0252402 100644
--- a/src/mainboard/msi/ms7260/romstage.c
+++ b/src/mainboard/msi/ms7260/romstage.c
@@ -141,10 +141,8 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
print_debug_hex8(bsp_apicid);
print_debug("\n");
-#if CONFIG_MEM_TRAIN_SEQ == 1
/* In BSP so could hold all AP until sysinfo is in RAM. */
set_sysinfo_in_ram(0);
-#endif
setup_coherent_ht_domain(); /* Routing table and start other core0. */
wait_all_core0_started();
diff --git a/src/mainboard/nvidia/l1_2pvv/romstage.c b/src/mainboard/nvidia/l1_2pvv/romstage.c
index 4497a37..5530579 100644
--- a/src/mainboard/nvidia/l1_2pvv/romstage.c
+++ b/src/mainboard/nvidia/l1_2pvv/romstage.c
@@ -139,9 +139,7 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
print_debug("bsp_apicid="); print_debug_hex8(bsp_apicid); print_debug("\n");
-#if CONFIG_MEM_TRAIN_SEQ == 1
set_sysinfo_in_ram(0); // in BSP so could hold all ap until sysinfo is in ram
-#endif
setup_coherent_ht_domain(); // routing table and start other core0
wait_all_core0_started();
diff --git a/src/mainboard/supermicro/h8dme/romstage.c b/src/mainboard/supermicro/h8dme/romstage.c
index 9363c63..d92c348 100644
--- a/src/mainboard/supermicro/h8dme/romstage.c
+++ b/src/mainboard/supermicro/h8dme/romstage.c
@@ -207,9 +207,7 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
print_debug_hex8(bsp_apicid);
print_debug("\n");
-#if CONFIG_MEM_TRAIN_SEQ == 1
set_sysinfo_in_ram(0); // in BSP so could hold all ap until sysinfo is in ram
-#endif
/* dump_smbus_registers(); */
setup_coherent_ht_domain(); // routing table and start other core0
diff --git a/src/mainboard/supermicro/h8dmr/romstage.c b/src/mainboard/supermicro/h8dmr/romstage.c
index daae389..268f120 100644
--- a/src/mainboard/supermicro/h8dmr/romstage.c
+++ b/src/mainboard/supermicro/h8dmr/romstage.c
@@ -134,9 +134,7 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
print_debug("bsp_apicid="); print_debug_hex8(bsp_apicid); print_debug("\n");
-#if CONFIG_MEM_TRAIN_SEQ == 1
set_sysinfo_in_ram(0); // in BSP so could hold all ap until sysinfo is in ram
-#endif
setup_coherent_ht_domain(); // routing table and start other core0
wait_all_core0_started();
diff --git a/src/mainboard/tyan/s2912/romstage.c b/src/mainboard/tyan/s2912/romstage.c
index 511f902..2345a84 100644
--- a/src/mainboard/tyan/s2912/romstage.c
+++ b/src/mainboard/tyan/s2912/romstage.c
@@ -137,9 +137,7 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
print_debug("bsp_apicid="); print_debug_hex8(bsp_apicid); print_debug("\n");
-#if CONFIG_MEM_TRAIN_SEQ == 1
set_sysinfo_in_ram(0); // in BSP so could hold all ap until sysinfo is in ram
-#endif
setup_coherent_ht_domain(); // routing table and start other core0
wait_all_core0_started();
diff --git a/src/northbridge/amd/amdk8/raminit_f_dqs.c b/src/northbridge/amd/amdk8/raminit_f_dqs.c
index 4438340..95987b2 100644
--- a/src/northbridge/amd/amdk8/raminit_f_dqs.c
+++ b/src/northbridge/amd/amdk8/raminit_f_dqs.c
@@ -1793,6 +1793,7 @@ static void clear_mtrr_dqs(unsigned tom2_k)
}
}
+#if CONFIG_MEM_TRAIN_SEQ == 1
static void set_htic_bit(unsigned i, unsigned val, unsigned bit)
{
uint32_t dword;
@@ -1802,8 +1803,6 @@ static void set_htic_bit(unsigned i, unsigned val, unsigned bit)
pci_write_config32(PCI_DEV(0, 0x18+i, 0), HT_INIT_CONTROL, dword);
}
-
-#if CONFIG_MEM_TRAIN_SEQ == 1
static unsigned get_htic_bit(unsigned i, unsigned bit)
{
uint32_t dword;
@@ -1822,7 +1821,9 @@ static void wait_till_sysinfo_in_ram(void)
static void set_sysinfo_in_ram(unsigned val)
{
+#if CONFIG_MEM_TRAIN_SEQ == 1
set_htic_bit(0, val, 9);
+#endif
}
#if CONFIG_HAVE_ACPI_RESUME
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4565
-gerrit
commit 666d998edf841a458c04fd6ab2daeffdf04d4f36
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Sun Dec 22 21:30:21 2013 -0500
cpu/allwinner/a10: Refactor and document pinmux API
Include a function to multiplex more than one pin at a time. This
is useful for peripherals that have the same function number for
all their pins.
Since we now have two functions for muxing pins, also document
them.
Change-Id: I53997cc3a2586e3cf749cd672f69fb427659c67f
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/cpu/allwinner/a10/gpio.h | 3 +-
src/cpu/allwinner/a10/pinmux.c | 51 +++++++++++++++++++++++++-
src/mainboard/cubietech/cubieboard/bootblock.c | 7 ++--
3 files changed, 55 insertions(+), 6 deletions(-)
diff --git a/src/cpu/allwinner/a10/gpio.h b/src/cpu/allwinner/a10/gpio.h
index f285451..709f74b 100644
--- a/src/cpu/allwinner/a10/gpio.h
+++ b/src/cpu/allwinner/a10/gpio.h
@@ -46,6 +46,7 @@ struct a10_gpio {
u32 sdr_pad_pul;
} __attribute__ ((packed));
-void gpio_set_func(u8 port, u8 pin, u8 pad_func);
+void gpio_set_pin_func(u8 port, u8 pin, u8 pad_func);
+void gpio_set_multipin_func(u8 port, u32 pin_mask, u8 pad_func);
#endif /* __CPU_ALLWINNER_A10_PINMUX_H */
diff --git a/src/cpu/allwinner/a10/pinmux.c b/src/cpu/allwinner/a10/pinmux.c
index 083f7ec..ae73009 100644
--- a/src/cpu/allwinner/a10/pinmux.c
+++ b/src/cpu/allwinner/a10/pinmux.c
@@ -11,7 +11,14 @@
static struct a10_gpio *gpio = (void *)GPIO_BASE;
-void gpio_set_func(u8 port, u8 pin, u8 pad_func)
+/**
+ * \brief Set the pad function of a single pin
+ *
+ * @param [in] port GPIO port of the pin (GPA -> GPS)
+ * @param [in] pin the pin number in the given port (1 -> 31)
+ * @param [in] pad_func The peripheral function to which to connect this pin
+ */
+void gpio_set_pin_func(u8 port, u8 pin, u8 pad_func)
{
u8 reg, bit;
u32 reg32;
@@ -28,3 +35,45 @@ void gpio_set_func(u8 port, u8 pin, u8 pad_func)
reg32 |= (pad_func & 0xf) << bit;
write32(reg32, &gpio->port[port].cfg[reg]);
}
+
+/**
+ * \brief Set the pad function of a group of pins
+ *
+ * Multiplex a group of pins to the same pad function. This is useful for
+ * peripherals that use the same function number for several pins. This function
+ * allows those pins to be set with a single call.
+ *
+ * Example:
+ * gpio_set_multipin_func(GPB, (1 << 23) | (1 << 22), 2);
+ *
+ * @param [in] port GPIO port of the pin (GPA -> GPS)
+ * @param [in] pin_mask 32-bit mask indicating which pins to re-multiplex. For
+ * each set bit, the corresponding pin will be multiplexed.
+ * @param [in] pad_func The peripheral function to which to connect the pins
+ */
+void gpio_set_multipin_func(u8 port, u32 pin_mask, u8 pad_func)
+{
+ int j;
+ u8 reg, bit;
+ u32 reg32, mask_offset;
+
+ if ((port > GPS))
+ return;
+
+ for (reg = 0; reg < 4; reg++) {
+ mask_offset = 8 * reg;
+ /* Don't run the inner loop if we're not touching any pins */
+ if (!(pin_mask & (0xff << mask_offset)))
+ continue;
+
+ reg32 = read32(&gpio->port[port].cfg[reg]);
+ for (j = 0; j < 8; j++) {
+ if (!(pin_mask & (1 << (j + mask_offset))))
+ continue;
+ bit = j * 4;
+ reg32 &= ~(0xf << bit);
+ reg32 |= (pad_func & 0xf) << bit;
+ }
+ write32(reg32, &gpio->port[port].cfg[reg]);
+ }
+}
diff --git a/src/mainboard/cubietech/cubieboard/bootblock.c b/src/mainboard/cubietech/cubieboard/bootblock.c
index 6e8b751..a91391c 100644
--- a/src/mainboard/cubietech/cubieboard/bootblock.c
+++ b/src/mainboard/cubietech/cubieboard/bootblock.c
@@ -18,8 +18,8 @@
| AHB_DIV_1 \
| AXI_DIV_1
-#define GPB22_UART0_TX_FUNC 2
-#define GPB23_UART0_RX_FUNC 2
+#define GPB_UART0_FUNC 2
+#define GPB_UART0_PINS ((1 << 22) | (1 << 23))
static void cubieboard_set_sys_clock(void)
{
@@ -57,8 +57,7 @@ static void cubieboard_setup_clocks(void)
static void cubieboard_setup_gpios(void)
{
/* Mux UART pins */
- gpio_set_func(GPB, 22, GPB22_UART0_TX_FUNC);
- gpio_set_func(GPB, 23, GPB23_UART0_RX_FUNC);
+ gpio_set_multipin_func(GPB, GPB_UART0_PINS, GPB_UART0_FUNC);
}
static void cubieboard_enable_uart(void)
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4565
-gerrit
commit 6d6baf1f1ca9e741d72050eb305f2b6bbff731a6
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Sun Dec 22 21:30:21 2013 -0500
cpu/allwinner/a10: Refactor and document pinmux API
Include a function to multiplex more than one pin at a time. This
is useful for peripherals that have the same function number for
all their pins.
Since we now have two functions for muxing pins, also document
them.
Change-Id: I53997cc3a2586e3cf749cd672f69fb427659c67f
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/cpu/allwinner/a10/gpio.h | 3 ++-
src/cpu/allwinner/a10/pinmux.c | 51 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/src/cpu/allwinner/a10/gpio.h b/src/cpu/allwinner/a10/gpio.h
index f285451..709f74b 100644
--- a/src/cpu/allwinner/a10/gpio.h
+++ b/src/cpu/allwinner/a10/gpio.h
@@ -46,6 +46,7 @@ struct a10_gpio {
u32 sdr_pad_pul;
} __attribute__ ((packed));
-void gpio_set_func(u8 port, u8 pin, u8 pad_func);
+void gpio_set_pin_func(u8 port, u8 pin, u8 pad_func);
+void gpio_set_multipin_func(u8 port, u32 pin_mask, u8 pad_func);
#endif /* __CPU_ALLWINNER_A10_PINMUX_H */
diff --git a/src/cpu/allwinner/a10/pinmux.c b/src/cpu/allwinner/a10/pinmux.c
index 083f7ec..ae73009 100644
--- a/src/cpu/allwinner/a10/pinmux.c
+++ b/src/cpu/allwinner/a10/pinmux.c
@@ -11,7 +11,14 @@
static struct a10_gpio *gpio = (void *)GPIO_BASE;
-void gpio_set_func(u8 port, u8 pin, u8 pad_func)
+/**
+ * \brief Set the pad function of a single pin
+ *
+ * @param [in] port GPIO port of the pin (GPA -> GPS)
+ * @param [in] pin the pin number in the given port (1 -> 31)
+ * @param [in] pad_func The peripheral function to which to connect this pin
+ */
+void gpio_set_pin_func(u8 port, u8 pin, u8 pad_func)
{
u8 reg, bit;
u32 reg32;
@@ -28,3 +35,45 @@ void gpio_set_func(u8 port, u8 pin, u8 pad_func)
reg32 |= (pad_func & 0xf) << bit;
write32(reg32, &gpio->port[port].cfg[reg]);
}
+
+/**
+ * \brief Set the pad function of a group of pins
+ *
+ * Multiplex a group of pins to the same pad function. This is useful for
+ * peripherals that use the same function number for several pins. This function
+ * allows those pins to be set with a single call.
+ *
+ * Example:
+ * gpio_set_multipin_func(GPB, (1 << 23) | (1 << 22), 2);
+ *
+ * @param [in] port GPIO port of the pin (GPA -> GPS)
+ * @param [in] pin_mask 32-bit mask indicating which pins to re-multiplex. For
+ * each set bit, the corresponding pin will be multiplexed.
+ * @param [in] pad_func The peripheral function to which to connect the pins
+ */
+void gpio_set_multipin_func(u8 port, u32 pin_mask, u8 pad_func)
+{
+ int j;
+ u8 reg, bit;
+ u32 reg32, mask_offset;
+
+ if ((port > GPS))
+ return;
+
+ for (reg = 0; reg < 4; reg++) {
+ mask_offset = 8 * reg;
+ /* Don't run the inner loop if we're not touching any pins */
+ if (!(pin_mask & (0xff << mask_offset)))
+ continue;
+
+ reg32 = read32(&gpio->port[port].cfg[reg]);
+ for (j = 0; j < 8; j++) {
+ if (!(pin_mask & (1 << (j + mask_offset))))
+ continue;
+ bit = j * 4;
+ reg32 &= ~(0xf << bit);
+ reg32 |= (pad_func & 0xf) << bit;
+ }
+ write32(reg32, &gpio->port[port].cfg[reg]);
+ }
+}
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4563
-gerrit
commit fbd198b619cab4d08a18b7000e823e5e10882533
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Sun Dec 22 18:51:29 2013 -0500
cpu/allwinner/a10: Clear the usage of SRAM during the bootblock
We have 32KiB of usable SRAM right when we boot. The first 24KiB can
be loaded with our bootblock, while the other 8KiB can be used as
stack during the bootblock stage.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Change-Id: I48d3a37869031c3c1dbc1fab71204d473d64deeb
---
src/cpu/allwinner/a10/Kconfig | 10 +++++++---
src/cpu/allwinner/a10/Makefile.inc | 15 ++++++++-------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/cpu/allwinner/a10/Kconfig b/src/cpu/allwinner/a10/Kconfig
index 646fe80..f40fa26 100644
--- a/src/cpu/allwinner/a10/Kconfig
+++ b/src/cpu/allwinner/a10/Kconfig
@@ -30,18 +30,22 @@ config ROMSTAGE_BASE
hex
default SYS_SDRAM_BASE
-# Keep the stack in SRAM
+# Keep the stack in SRAM block A2.
+# SRAM blocks A1 (0-16KiB) and A2 (16KiB-32KiB) are always accessible to the
+# CPU. This gives us 32KiB of SRAM to boot with. The BROM bootloader will use up
+# to 24KiB to load our bootblock, which leaves us the area from 24KiB to 32 KiB
+# to use however we see fit.
config STACK_TOP
hex
default 0x00008000
config STACK_BOTTOM
hex
- default 0x00004000
+ default 0x00006000
config STACK_SIZE
hex
- default 0x00004000
+ default 0x00002000
## TODO Change this to some better address not overlapping bootblock when
## cbfstool supports creating header in arbitrary location.
diff --git a/src/cpu/allwinner/a10/Makefile.inc b/src/cpu/allwinner/a10/Makefile.inc
index 48f3110..9f7208a 100644
--- a/src/cpu/allwinner/a10/Makefile.inc
+++ b/src/cpu/allwinner/a10/Makefile.inc
@@ -21,15 +21,16 @@ get_bootblock_size= \
sed 's/[^0-9 ]//g')) \
$(shell echo $$(($(word 2, $(strip $(bb_s))))))
-# The boot ROM in the SoC will start loading code if a special boot0 header is
+# The boot ROM in the SoC will start loading code if a special BOOT0 header is
# found (at an offset of 8KiB in either NAND or SD), and the checksum is
-# correct. this header is normally added by the 'mxsunxiboot' tool. The file
-# passed to mksunxiboot should only include the bootblock due to size
-# limitations.
-# FIXME: Figure out how to safely integrate in coreboot.rom. For now, only copy
-# the first 15 KiB of coreboot.rom (This will not collide with stack)
+# correct. This header is normally added by the 'mxsunxiboot' tool. The boot ROM
+# will load at most 24KiB of data to SRAM, so limit the file size accordingly.
+# The BOOT0 header takes 32 bytes, so limit our file to 24KiB - 32 bytes.
+# FIXME: Figure out how to safely integrate in coreboot.rom.
+# FIXME: The file passed to mksunxiboot should only include the bootblock due
+# to size limitations.
$(obj)/BOOT0: $(obj)/coreboot.rom
@printf " BOOT0 $(subst $(obj)/,,$(^))\n"
touch $@
- dd if=$^ of=$^.tmp bs=1024 count=15
+ dd if=$^ of=$^.tmp bs=24544 count=1
-mksunxiboot $^.tmp $@