diff mbox

[6/6] board: bcm28155_ap: Add board files

Message ID 1390848810-7227-7-git-send-email-drambo@broadcom.com
State New
Headers show

Commit Message

Darwin Rambo Jan. 27, 2014, 6:53 p.m. UTC
Add support for the bcm28155_ap reference board.

Signed-off-by: Darwin Rambo <drambo@broadcom.com>
Reviewed-by: Steve Rae <srae@broadcom.com>
Reviewed-by: Tim Kryger <tkryger@linaro.org>
---
 board/broadcom/bcm28155_ap/Makefile      |    7 ++
 board/broadcom/bcm28155_ap/bcm28155_ap.c |   99 ++++++++++++++++++++
 boards.cfg                               |    1 +
 include/configs/bcm28155_ap.h            |  148 ++++++++++++++++++++++++++++++
 4 files changed, 255 insertions(+)
 create mode 100644 board/broadcom/bcm28155_ap/Makefile
 create mode 100644 board/broadcom/bcm28155_ap/bcm28155_ap.c
 create mode 100644 include/configs/bcm28155_ap.h

Comments

Darwin Rambo Jan. 30, 2014, 11:05 p.m. UTC | #1
On 14-01-29 02:33 PM, Tom Rini wrote:
> On Mon, Jan 27, 2014 at 10:53:30AM -0800, Darwin Rambo wrote:
> 
>> Add support for the bcm28155_ap reference board.
>>
>> Signed-off-by: Darwin Rambo <drambo@broadcom.com>
>> Reviewed-by: Steve Rae <srae@broadcom.com>
>> Reviewed-by: Tim Kryger <tkryger@linaro.org>
> [snip]
>> +	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
> 
> Please use get_ram_size(...);
We tried using this on our reference board and it hangs accessing memory
regions that are not populated. Our memory controller doesn't appear to
properly support accessing regions that are not backed by physical
sdram. So I think it's best to keep this code as is and consider this
approach for future designs.

> 
>> +/* Memory testing range */
>> +#define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
>> +#define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + SZ_1M)
> 
> Please see doc/README.memory-test
OK. I think I'll disable CONFIG_CMD_MEMORY and remove this stuff.
> 
>> +#define CONFIG_SYS_BAUDRATE_TABLE	{9600, 19200, 38400, 57600, \
>> +					115200, 230400, 460800, 921600}
> 
> Unless you really use those higher values in U-Boot, please use the
> default table.
OK
> 
>> +#define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
> 
> Unneeded now.
OK
>
Tim Kryger Jan. 31, 2014, 5:05 p.m. UTC | #2
On Fri, Jan 31, 2014 at 6:17 AM, Tom Rini <trini@ti.com> wrote:
> On 01/30/2014 06:05 PM, Darwin Rambo wrote:
> > We tried using this on our reference board and it hangs accessing
> > memory regions that are not populated. Our memory controller
> > doesn't appear to properly support accessing regions that are not
> > backed by physical sdram. So I think it's best to keep this code as
> > is and consider this approach for future designs.
>
> Wait, what did you do?  get_ram_size(base, max) must work and return
> CONFIG_SYS_SDRAM_SIZE, or you haven't properly configured your
> controller (as get_ram_size just pokes parts of the specified range).

Tom,

In my experience, there are three general ways memory controllers
behave when an access is made to an address that could be backed by
RAM but isn't on a particular board.

1. All reads return a fixed pattern and writes are ignored
2. A bus error is triggered that the CPU sees as a data abort
3. No response to the transaction so the bus and CPU lock up

I believe the Broadcom memory controller can only behave in the third,
least desirable way.

Thanks,
Tim Kryger
Darwin Rambo Jan. 31, 2014, 6:18 p.m. UTC | #3
On 14-01-31 09:15 AM, Tom Rini wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 01/31/2014 12:05 PM, Tim Kryger wrote:
>> On Fri, Jan 31, 2014 at 6:17 AM, Tom Rini <trini@ti.com> wrote:
>>> On 01/30/2014 06:05 PM, Darwin Rambo wrote:
>>>> We tried using this on our reference board and it hangs accessing
>>>> memory regions that are not populated. Our memory controller
>>>> doesn't appear to properly support accessing regions that are not
>>>> backed by physical sdram. So I think it's best to keep this code as
>>>> is and consider this approach for future designs.
>>>
>>> Wait, what did you do?  get_ram_size(base, max) must work and return
>>> CONFIG_SYS_SDRAM_SIZE, or you haven't properly configured your
>>> controller (as get_ram_size just pokes parts of the specified range).
>>
>> Tom,
>>
>> In my experience, there are three general ways memory controllers
>> behave when an access is made to an address that could be backed by
>> RAM but isn't on a particular board.
>>
>> 1. All reads return a fixed pattern and writes are ignored
>> 2. A bus error is triggered that the CPU sees as a data abort
>> 3. No response to the transaction so the bus and CPU lock up
>>
>> I believe the Broadcom memory controller can only behave in the third,
>> least desirable way.
> 
> That's fine.  You should still use get_ram_size(base,
> CONFIG_SYS_SDRAM_SIZE) like other platforms use as this go above the max
> size it's given.  If this hangs, you have a problem with your
> configuration of the memory controller.  Make sense?
Yes. We have tested that this works and will implement this way. Thanks.
> 
> - -- 
> Tom
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
> 
> iQIcBAEBAgAGBQJS69oUAAoJENk4IS6UOR1Wf/AP/2ApLwjAffxJ7LmEFFEK7hlr
> +dq1FW9ZRppfLRbfUrZz8Q/muyrx1ZuF9pIjjrFxLkNSLS3t8LZrJmfeswePqGC+
> dq6qLl+ovk0VNYsxEhS77j1QQ/LLri67QCiGEZuS8vDB7qxiyuuCXkzyyW8hRFZ7
> yfKpbfdRYpzWTJhAYnB0b1OaBi1jamsnjhXNU5XNa/H3PfDDofNA2fFQQfKbleOH
> BVOka1LP/+28gqKksEziM9cbcjPYJdE/FfY75nkbqKl9PWl+qIUZli90QO3Qdbgy
> uJJB1d3v6amfHZYbJymR3r8FoRjjCKxnCza5rCLpwFLxAKCUIIGHBFUGpvdcFoVa
> YctuEu2Dx2SgQ9dEGbLT1d2bsbfxOATEr5CyCpD7vD/9e/Ze7XaXALVKocfQmDbs
> 77s0YvHuXLGQPudPzYrEqPvgxf/NlNjeLj5IWqF++AE3j5U1sE26x95qk8jobMSn
> KjYGwzsxnd/gErqiYBawkrHxS2f4beAucsoprCh0WmSXiqSh6Wzc/+XlAIVSV7vm
> UE969gAzP1F2j37QfWR2/B0ILP27Pk3Ano8Dj2MIVKCAVkkpSQ5SCqAA7wvMzHej
> 801O52kArhG3/G/WrAbeLoQxKsdUyNI92+T0UaquTI4hRZk5GSvHQNCaZAcx6fCa
> hZ1o6zG9nMsp/yzVe7VZ
> =0yIj
> -----END PGP SIGNATURE-----
>
diff mbox

Patch

diff --git a/board/broadcom/bcm28155_ap/Makefile b/board/broadcom/bcm28155_ap/Makefile
new file mode 100644
index 0000000..b6159dc
--- /dev/null
+++ b/board/broadcom/bcm28155_ap/Makefile
@@ -0,0 +1,7 @@ 
+#
+# Copyright 2013 Broadcom Corporation.	All rights reserved.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	+= $(BOARD).o
diff --git a/board/broadcom/bcm28155_ap/bcm28155_ap.c b/board/broadcom/bcm28155_ap/bcm28155_ap.c
new file mode 100644
index 0000000..b86dbda
--- /dev/null
+++ b/board/broadcom/bcm28155_ap/bcm28155_ap.c
@@ -0,0 +1,99 @@ 
+/*****************************************************************************
+*
+* Copyright 2013 Broadcom Corporation.  All rights reserved.
+*
+* SPDX-License-Identifier:      GPL-2.0+
+*
+*****************************************************************************/
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/mach-types.h>
+#include <mmc.h>
+#include <asm/kona-common/misc.h>
+#include <asm/kona-common/clk.h>
+#include <asm/arch/sysmap.h>
+
+#define SECWATCHDOG_SDOGCR_OFFSET	0x00000000
+#define SECWATCHDOG_SDOGCR_EN_SHIFT	27
+#define SECWATCHDOG_SDOGCR_SRSTEN_SHIFT	26
+#define SECWATCHDOG_SDOGCR_CLKS_SHIFT	20
+#define SECWATCHDOG_SDOGCR_LD_SHIFT	0
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*****************************************
+ * board_init - early hardware init
+ *****************************************/
+int board_init(void)
+{
+	printf("Relocation Offset is: %08lx\n", gd->reloc_off);
+
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+
+	clk_init();
+
+	return 0;
+}
+
+/*****************************************************************
+ * misc_init_r - miscellaneous platform dependent initializations
+ ******************************************************************/
+int misc_init_r(void)
+{
+	/* Disable watchdog reset - watchdog unused */
+	writel((0 << SECWATCHDOG_SDOGCR_EN_SHIFT) |
+	       (0 << SECWATCHDOG_SDOGCR_SRSTEN_SHIFT) |
+	       (4 << SECWATCHDOG_SDOGCR_CLKS_SHIFT) |
+	       (0x5a0 << SECWATCHDOG_SDOGCR_LD_SHIFT),
+	       (SECWD_BASE_ADDR + SECWATCHDOG_SDOGCR_OFFSET));
+
+	return 0;
+}
+
+/**********************************************
+ * dram_init - sets uboots idea of sdram size
+ **********************************************/
+int dram_init(void)
+{
+	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+
+	return 0;
+}
+
+void dram_init_banksize(void)
+{
+	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+	gd->bd->bi_dram[0].size = CONFIG_SYS_SDRAM_SIZE;
+}
+
+#ifdef CONFIG_KONA_SDHCI
+/*******************************************
+ * mmc_init - Initializes mmc
+ *********************************************/
+int board_mmc_init(bd_t *bis)
+{
+	int ret = 0;
+
+	/* Register eMMC - SDIO2 */
+	ret = kona_sdhci_init(1, 400000, 0);
+	if (ret)
+		return ret;
+
+	/* Register SD Card - SDIO4 kona_mmc_init assumes 0 based index */
+	ret = kona_sdhci_init(3, 400000, 0);
+	return ret;
+}
+#endif
+
+/*
+ * The timer functionality is now in u-boot/lib/time.c, enabled with
+ * CONFIG_SYS_TIMER_COUNTER and CONFIG_SYS_TIMER_RATE
+ */
+
+/* Replace by __weak timer_init() framework function later */
+int timer_init(void)
+{
+	return 0;
+}
diff --git a/boards.cfg b/boards.cfg
index a8336cc..2105ecc 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -271,6 +271,7 @@  Active  arm         armv7          am33xx      ti              ti816x
 Active  arm         armv7          at91        atmel           sama5d3xek          sama5d3xek_mmc                       sama5d3xek:SAMA5D3,SYS_USE_MMC                                                                                                    Bo Shen <voice.shen@atmel.com>
 Active  arm         armv7          at91        atmel           sama5d3xek          sama5d3xek_nandflash                 sama5d3xek:SAMA5D3,SYS_USE_NANDFLASH                                                                                              Bo Shen <voice.shen@atmel.com>
 Active  arm         armv7          at91        atmel           sama5d3xek          sama5d3xek_spiflash                  sama5d3xek:SAMA5D3,SYS_USE_SERIALFLASH                                                                                            Bo Shen <voice.shen@atmel.com>
+Active  arm         armv7          bcm281xx    broadcom        bcm28155_ap         bcm28155_ap                          bcm28155_ap                                                                                                                       Tim Kryger <tim.kryger@linaro.org>
 Active  arm         armv7          exynos      samsung         arndale             arndale                              -                                                                                                                                 Inderpal Singh <inderpal.singh@linaro.org>
 Active  arm         armv7          exynos      samsung         origen              origen                               -                                                                                                                                 Chander Kashyap <k.chander@samsung.com>
 Active  arm         armv7          exynos      samsung         smdk5250            smdk5250                             -                                                                                                                                 Chander Kashyap <k.chander@samsung.com>
diff --git a/include/configs/bcm28155_ap.h b/include/configs/bcm28155_ap.h
new file mode 100644
index 0000000..2df9390
--- /dev/null
+++ b/include/configs/bcm28155_ap.h
@@ -0,0 +1,148 @@ 
+/*****************************************************************************
+*
+* Copyright 2013 Broadcom Corporation.  All rights reserved.
+*
+* SPDX-License-Identifier:      GPL-2.0+
+*
+*****************************************************************************/
+
+#ifndef __BCM28155_AP_H
+#define __BCM28155_AP_H
+
+#include <asm/sizes.h>
+#include <asm/arch/sysmap.h>
+
+/* Architecture, CPU, chip, mach, etc */
+#define CONFIG_ARMV7
+#define CONFIG_KONA
+
+/*
+ * Memory configuration
+ */
+#define CONFIG_SYS_TEXT_BASE		0xae000000
+
+#define CONFIG_SYS_SDRAM_BASE		0x80000000
+#define CONFIG_SYS_SDRAM_SIZE		0x80000000
+#define CONFIG_NR_DRAM_BANKS		1
+
+#define CONFIG_SYS_MALLOC_LEN		SZ_4M	/* see armv7/start.S. */
+#define CONFIG_STACKSIZE		SZ_256K
+
+/* GPIO Driver */
+#define CONFIG_KONA_GPIO
+
+/* MMC/SD Driver */
+#define CONFIG_SDHCI
+#define CONFIG_MMC_SDMA
+#define CONFIG_KONA_SDHCI
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+
+#define CONFIG_SYS_SDIO_BASE0 SDIO1_BASE_ADDR
+#define CONFIG_SYS_SDIO_BASE1 SDIO2_BASE_ADDR
+#define CONFIG_SYS_SDIO_BASE2 SDIO3_BASE_ADDR
+#define CONFIG_SYS_SDIO_BASE3 SDIO4_BASE_ADDR
+#define CONFIG_SYS_SDIO0_MAX_CLK 48000000
+#define CONFIG_SYS_SDIO1_MAX_CLK 48000000
+#define CONFIG_SYS_SDIO2_MAX_CLK 48000000
+#define CONFIG_SYS_SDIO3_MAX_CLK 48000000
+#define CONFIG_SYS_SDIO0 "sdio1"
+#define CONFIG_SYS_SDIO1 "sdio2"
+#define CONFIG_SYS_SDIO2 "sdio3"
+#define CONFIG_SYS_SDIO3 "sdio4"
+
+/* I2C Driver */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_KONA
+#define CONFIG_SYS_SPD_BUS_NUM	3	/* Start with PMU bus */
+#define CONFIG_SYS_MAX_I2C_BUS	4
+#define CONFIG_SYS_I2C_BASE0	BSC1_BASE_ADDR
+#define CONFIG_SYS_I2C_BASE1	BSC2_BASE_ADDR
+#define CONFIG_SYS_I2C_BASE2	BSC3_BASE_ADDR
+#define CONFIG_SYS_I2C_BASE3	PMU_BSC_BASE_ADDR
+
+/* Timer Driver */
+#define CONFIG_SYS_TIMER_RATE		32000
+#define CONFIG_SYS_TIMER_COUNTER	(TIMER_BASE_ADDR + 4) /* STCLO offset */
+
+/* Init functions */
+#define CONFIG_MISC_INIT_R	/* board's misc_init_r function */
+
+/* Some commands use this as the default load address */
+#define CONFIG_SYS_LOAD_ADDR		CONFIG_SYS_SDRAM_BASE
+
+/* Memory testing range */
+#define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
+#define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + SZ_1M)
+
+/*
+ * This is the initial SP which is used only briefly for relocating the u-boot
+ * image to the top of SDRAM. After relocation u-boot moves the stack to the
+ * proper place.
+ */
+#define CONFIG_SYS_INIT_SP_ADDR		CONFIG_SYS_TEXT_BASE
+
+/* Serial Info */
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+/* Post pad 3 bytes after each reg addr */
+#define CONFIG_SYS_NS16550_REG_SIZE	(-4)
+#define CONFIG_SYS_NS16550_CLK		13000000
+#define CONFIG_CONS_INDEX		1
+#define CONFIG_SYS_NS16550_COM1		0x3e000000
+
+#define CONFIG_BAUDRATE			115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{9600, 19200, 38400, 57600, \
+					115200, 230400, 460800, 921600}
+
+#define CONFIG_ENV_SIZE			0x10000
+#define CONFIG_ENV_IS_NOWHERE
+
+#define CONFIG_SYS_NO_FLASH	/* Not using NAND/NOR unmanaged flash */
+
+/* console configuration */
+#define CONFIG_SYS_CBSIZE		1024	/* Console buffer size */
+#define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + \
+			sizeof(CONFIG_SYS_PROMPT) + 16)	/* Printbuffer size */
+#define CONFIG_SYS_MAXARGS		64
+#define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
+
+/*
+ * One partition type must be defined for part.c
+ * This is necessary for the fatls command to work on an SD card
+ * for example.
+ */
+#define CONFIG_DOS_PARTITION
+
+/* version string, parser, etc */
+#define CONFIG_VERSION_VARIABLE
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_SYS_LONGHELP
+
+#define CONFIG_CRC32_VERIFY
+#define CONFIG_MX_CYCLIC
+
+/* Initial upstream - boot to cmd prompt only */
+#define CONFIG_BOOTCOMMAND		""
+
+#define CONFIG_SYS_PROMPT		"bcm28155_ap> "
+
+/* Commands */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_ASKENV
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_GPIO
+#define CONFIG_CMD_I2C
+#define CONFIG_CMD_MEMTEST
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_BOOTZ
+#define CONFIG_FAT_WRITE
+
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_NFS
+
+#endif /* __BCM28155_AP_H */