diff mbox

[U-Boot,v2] Tegra: T30: Beaver board support.

Message ID 1365806020-2869-1-git-send-email-twarren@nvidia.com
State Superseded
Delegated to: Tom Warren
Headers show

Commit Message

Tom Warren April 12, 2013, 10:33 p.m. UTC
Beaver is a Tegra30 board that is nearly 100% compatible w/Cardhu.
Add a Beaver build so it can begin to be differentiated, if need be.

Signed-off-by: Tom Warren <twarren@nvidia.com>
---
v2: Add MAINTAINERS and beaver.h config file

 MAINTAINERS                         |  1 +
 board/nvidia/beaver/Makefile        | 38 +++++++++++++++++++
 board/nvidia/dts/tegra30-beaver.dts | 66 ++++++++++++++++++++++++++++++++
 boards.cfg                          |  1 +
 include/configs/beaver.h            | 76 +++++++++++++++++++++++++++++++++++++
 5 files changed, 182 insertions(+)
 create mode 100644 board/nvidia/beaver/Makefile
 create mode 100644 board/nvidia/dts/tegra30-beaver.dts
 create mode 100644 include/configs/beaver.h

Comments

Stephen Warren April 15, 2013, 6:48 p.m. UTC | #1
On 04/12/2013 04:33 PM, Tom Warren wrote:
> Beaver is a Tegra30 board that is nearly 100% compatible w/Cardhu.
> Add a Beaver build so it can begin to be differentiated, if need be.

> diff --git a/board/nvidia/dts/tegra30-beaver.dts b/board/nvidia/dts/tegra30-beaver.dts

> +	memory {
> +		device_type = "memory";
> +		reg = <0x80000000 0x80000000>;

That should probably be 0x7ff00000, since the boot ROM(?) prevents use
of the last 1MiB. This is also a bug in the kernel DT I think.

> +	spi@7000da00 {
> +		status = "okay";
> +		spi-max-frequency = <25000000>;
> +	};

Shouldn't the SPI flash be listed there too?

> diff --git a/include/configs/beaver.h b/include/configs/beaver.h

> +/* Environment in eMMC, at the end of 2nd "boot sector" */
> +#define CONFIG_ENV_IS_IN_MMC
> +#define CONFIG_ENV_OFFSET		((512 * 1024) - CONFIG_ENV_SIZE)

The eMMC boot partitions on Beaver appear to be 1MiB not 512KiB. Hence,
I think that should be:

#define CONFIG_ENV_OFFSET	((1024 * 1024) - CONFIG_ENV_SIZE)

I should really get around to writing a patch to allow negative values
for the offset, which would be interpreted as relative to the end of the
partition, to make this automatic. It'd also help e.g. Ventana where
some boards apparently have different size boot sectors. I'll file
myself a bug for that.

BTW, did you find out if boards.cfg would allow any of this patch to be
shared with the existing Cardhu support? Ignoring that, with the above
issues fixed (assuming the SPI is DT is made to match the kernel), then
this patch,

Reviewed-by: Stephen Warren <swarren@nvidia.com>
Tom Warren April 15, 2013, 7:49 p.m. UTC | #2
Stephen,


On Mon, Apr 15, 2013 at 11:48 AM, Stephen Warren <swarren@wwwdotorg.org>wrote:

> On 04/12/2013 04:33 PM, Tom Warren wrote:
> > Beaver is a Tegra30 board that is nearly 100% compatible w/Cardhu.
> > Add a Beaver build so it can begin to be differentiated, if need be.
>
> > diff --git a/board/nvidia/dts/tegra30-beaver.dts
> b/board/nvidia/dts/tegra30-beaver.dts
>
> > +     memory {
> > +             device_type = "memory";
> > +             reg = <0x80000000 0x80000000>;
>
> That should probably be 0x7ff00000, since the boot ROM(?) prevents use
> of the last 1MiB. This is also a bug in the kernel DT I think.
>

I'll change it. Thanks.


> > +     spi@7000da00 {
> > +             status = "okay";
> > +             spi-max-frequency = <25000000>;
> > +     };
>
> Shouldn't the SPI flash be listed there too?
>
Yeah, missed that. I'll add it, too.


>
> > diff --git a/include/configs/beaver.h b/include/configs/beaver.h
>
> > +/* Environment in eMMC, at the end of 2nd "boot sector" */
> > +#define CONFIG_ENV_IS_IN_MMC
> > +#define CONFIG_ENV_OFFSET            ((512 * 1024) - CONFIG_ENV_SIZE)
>
> The eMMC boot partitions on Beaver appear to be 1MiB not 512KiB. Hence,
> I think that should be:
>
> #define CONFIG_ENV_OFFSET       ((1024 * 1024) - CONFIG_ENV_SIZE)
>

OK, I'll make that change, too, for V2.


>
> I should really get around to writing a patch to allow negative values
> for the offset, which would be interpreted as relative to the end of the
> partition, to make this automatic. It'd also help e.g. Ventana where
> some boards apparently have different size boot sectors. I'll file
> myself a bug for that.
>
> BTW, did you find out if boards.cfg would allow any of this patch to be
> shared with the existing Cardhu support? Ignoring that, with the above
> issues fixed (assuming the SPI is DT is made to match the kernel), then
> this patch,
>

Haven't looked at modifying boards.cfg yet. I'll take a look before I post
v2.

Thanks.

>
> Reviewed-by: Stephen Warren <swarren@nvidia.com>
>
diff mbox

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index e131f80..a47ec97 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -994,6 +994,7 @@  Stephen Warren <swarren@nvidia.com>
 	paz00		Tegra20 (ARM7 & A9 Dual Core)
 	trimslice	Tegra20 (ARM7 & A9 Dual Core)
 	whistler	Tegra20 (ARM7 & A9 Dual Core)
+	beaver		Tegra30 (ARM7 & A9 Quad Core)
 
 Stephen Warren <swarren@wwwdotorg.org>
 
diff --git a/board/nvidia/beaver/Makefile b/board/nvidia/beaver/Makefile
new file mode 100644
index 0000000..9510f60
--- /dev/null
+++ b/board/nvidia/beaver/Makefile
@@ -0,0 +1,38 @@ 
+#
+# Copyright (c) 2010-2013, NVIDIA CORPORATION.  All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms and conditions of the GNU General Public License,
+# version 2, as published by the Free Software Foundation.
+#
+# This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>.
+#
+
+include $(TOPDIR)/config.mk
+
+$(shell mkdir -p $(obj)../cardhu)
+
+LIB	= $(obj)lib$(BOARD).o
+
+COBJS	= ../cardhu/cardhu.o
+
+SRCS	:= $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/nvidia/dts/tegra30-beaver.dts b/board/nvidia/dts/tegra30-beaver.dts
new file mode 100644
index 0000000..84aff51
--- /dev/null
+++ b/board/nvidia/dts/tegra30-beaver.dts
@@ -0,0 +1,66 @@ 
+/dts-v1/;
+
+#include "tegra30.dtsi"
+
+/ {
+	model = "NVIDIA Beaver";
+	compatible = "nvidia,beaver", "nvidia,tegra30";
+
+	aliases {
+		i2c0 = "/i2c@7000d000";
+		i2c1 = "/i2c@7000c000";
+		i2c2 = "/i2c@7000c400";
+		i2c3 = "/i2c@7000c500";
+		i2c4 = "/i2c@7000c700";
+		sdhci0 = "/sdhci@78000600";
+		sdhci1 = "/sdhci@78000000";
+	};
+
+	memory {
+		device_type = "memory";
+		reg = <0x80000000 0x80000000>;
+	};
+
+	i2c@7000c000 {
+		status = "okay";
+		clock-frequency = <100000>;
+	};
+
+	i2c@7000c400 {
+		status = "okay";
+		clock-frequency = <100000>;
+	};
+
+	i2c@7000c500 {
+		status = "okay";
+		clock-frequency = <100000>;
+	};
+
+	i2c@7000c700 {
+		status = "okay";
+		clock-frequency = <100000>;
+	};
+
+	i2c@7000d000 {
+		status = "okay";
+		clock-frequency = <100000>;
+	};
+
+	spi@7000da00 {
+		status = "okay";
+		spi-max-frequency = <25000000>;
+	};
+
+	sdhci@78000000 {
+		status = "okay";
+		cd-gpios = <&gpio 69 1>; /* gpio PI5 */
+		wp-gpios = <&gpio 155 0>; /* gpio PT3 */
+		power-gpios = <&gpio 31 0>; /* gpio PD7 */
+		bus-width = <4>;
+	};
+
+	sdhci@78000600 {
+		status = "okay";
+		bus-width = <8>;
+	};
+};
diff --git a/boards.cfg b/boards.cfg
index 1acf56a..676f25c 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -310,6 +310,7 @@  seaboard                     arm         armv7:arm720t seaboard          nvidia
 ventana                      arm         armv7:arm720t ventana           nvidia         tegra20
 whistler                     arm         armv7:arm720t whistler          nvidia         tegra20
 cardhu                       arm         armv7:arm720t cardhu            nvidia         tegra30
+beaver                       arm         armv7:arm720t beaver            nvidia         tegra30
 dalmore                      arm         armv7:arm720t dalmore           nvidia         tegra114
 colibri_t20_iris             arm         armv7:arm720t colibri_t20_iris  toradex        tegra20
 u8500_href                   arm         armv7       u8500               st-ericsson    u8500
diff --git a/include/configs/beaver.h b/include/configs/beaver.h
new file mode 100644
index 0000000..0dc1ce1
--- /dev/null
+++ b/include/configs/beaver.h
@@ -0,0 +1,76 @@ 
+/*
+ * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <asm/sizes.h>
+
+#include "tegra30-common.h"
+
+/* Enable fdt support for Beaver. Flash the image in u-boot-dtb.bin */
+#define CONFIG_DEFAULT_DEVICE_TREE	tegra30-beaver
+#define CONFIG_OF_CONTROL
+#define CONFIG_OF_SEPARATE
+
+/* High-level configuration options */
+#define V_PROMPT		"Tegra30 (Beaver) # "
+#define CONFIG_TEGRA_BOARD_STRING	"NVIDIA Beaver"
+
+/* Board-specific serial config */
+#define CONFIG_SERIAL_MULTI
+#define CONFIG_TEGRA_ENABLE_UARTA
+#define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTA_BASE
+
+#define MACH_TYPE_BEAVER		4597	/* not yet in mach-types.h */
+#define CONFIG_MACH_TYPE		MACH_TYPE_BEAVER
+
+#define CONFIG_BOARD_EARLY_INIT_F
+
+/* I2C */
+#define CONFIG_TEGRA_I2C
+#define CONFIG_SYS_I2C_INIT_BOARD
+#define CONFIG_I2C_MULTI_BUS
+#define CONFIG_SYS_MAX_I2C_BUS		TEGRA_I2C_NUM_CONTROLLERS
+#define CONFIG_SYS_I2C_SPEED		100000
+#define CONFIG_CMD_I2C
+
+/* SD/MMC */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_TEGRA_MMC
+#define CONFIG_CMD_MMC
+
+/* Environment in eMMC, at the end of 2nd "boot sector" */
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_ENV_OFFSET		((512 * 1024) - CONFIG_ENV_SIZE)
+#define CONFIG_SYS_MMC_ENV_DEV		0
+#define CONFIG_SYS_MMC_ENV_PART		2
+
+/* SPI */
+#define CONFIG_TEGRA20_SLINK
+#define CONFIG_TEGRA_SLINK_CTRLS       6
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI_FLASH_WINBOND
+#define CONFIG_SF_DEFAULT_MODE         SPI_MODE_0
+#define CONFIG_SF_DEFAULT_SPEED        24000000
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SPI_FLASH_SIZE          (4 << 20)
+
+#include "tegra-common-post.h"
+
+#endif /* __CONFIG_H */