Skip to contentSkip to conversation

tegra: usb: Add USB support to Tamonten boards

PATCH New Thierry Reding 2 participants 10 messages May 24, 2012 – May 25, 2012 Tegra architecture support

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 tegra: usb: Add USB support to Tamonten boards

This adds basic USB support for port 0. Device tree support is needed to initialize the USB EHCI and will be added in a subsequent patch.

---
 board/avionic-design/common/tamonten.c |   11 +++++++++++
 board/avionic-design/common/tamonten.h |    2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
board/avionic-design/common/tamonten.c +11 -0
index f23b657..794d90a 100644
@@ -68,6 +68,12 @@ static void pin_mux_mmc(void)
 }
 #endif
 
+static void pin_mux_usb_default(void)
+{
+}
+
+void pin_mux_usb(void) __attribute__((weak, alias("pin_mux_usb_default")));
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
@@ -80,6 +86,11 @@ int board_init(void)
 	/* boot param addr */
 	gd->bd->bi_boot_params = (NV_PA_SDRAM_BASE + 0x100);
 
+#ifdef CONFIG_USB_EHCI_TEGRA
+	pin_mux_usb();
+	board_usb_init(gd->fdt_blob);
+#endif
+
 	return 0;
 }
 
board/avionic-design/common/tamonten.h +1 -1
index 0e60b0f..ee101b7 100644
@@ -26,7 +26,7 @@
 #ifndef _TAMONTEN_H_
 #define _TAMONTEN_H_
 
-void tegra2_start(void);
 void gpio_config_mmc(void);
+void pin_mux_usb(void);
 
 #endif /* TAMONTEN_H */
Signature · 1 line
1.7.10.2
#1 lore raw

PATCH 2/3 tegra: medcom: Add device tree support

Device tree support is required for working USB host support, which in turn enables ethernet support.

---
 board/avionic-design/dts/tegra2-medcom.dts |   67 ++++++++++++++++++++++++++++
 include/configs/medcom.h                   |   22 ++++++++-
 2 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 board/avionic-design/dts/tegra2-medcom.dts
board/avionic-design/dts/tegra2-medcom.dts new file +67 -0
new file mode 100644
index 0000000..f766078
@@ -0,0 +1,67 @@
+/dts-v1/;
+
+/include/ ARCH_CPU_DTS
+
+/ {
+	model = "Avionic Design Medcom-Wide";
+	compatible = "avionic-design,medcom", "nvidia,tegra20";
+
+	aliases {
+		usb0 = "/usb at c5008000";
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8";
+	};
+
+	memory {
+		reg = <0x00000000 0x20000000>;
+	};
+
+	clocks {
+		clk_32k: clk_32k {
+			clock-frequency = <32000>;
+		};
+
+		osc {
+			clock-frequency = <12000000>;
+		};
+	};
+
+	clock at 60006000 {
+		clocks = <&clk_32k &osc>;
+	};
+
+	serial at 70006300 {
+		clock-frequency = <216000000>;
+	};
+
+	i2c at 7000c000 {
+		status = "disabled";
+	};
+
+	i2c at 7000c400 {
+		status = "disabled";
+	};
+
+	i2c at 7000c500 {
+		status = "disabled";
+	};
+
+	i2c at 7000d000 {
+		status = "disabled";
+	};
+
+	usb at c5000000 {
+		status = "disabled";
+	};
+
+	usb at c5004000 {
+		status = "disabled";
+	};
+
+	sdhci at c8000600 {
+		cd-gpios = <&gpio 58 0>; /* gpio PH2 */
+		wp-gpios = <&gpio 59 0>; /* gpio PH3 */
+	};
+};
include/configs/medcom.h +21 -1
index 2dc3507..072e15a 100644
@@ -1,7 +1,7 @@
 /*
  *  (C) Copyright 2010,2011
  *  NVIDIA Corporation <www.nvidia.com>
- *  (C) Copyright 2011
+ *  (C) Copyright 2011-2012
  *  Avionic Design GmbH <www.avionic-design.de>
  *
  * See file CREDITS for list of people who contributed to this
@@ -28,6 +28,11 @@
 
 #include "tegra2-common.h"
 
+/* Enable fdt support for Medcom. Flash the image in u-boot-dtb.bin */
+#define CONFIG_DEFAULT_DEVICE_TREE	tegra2-medcom
+#define CONFIG_OF_CONTROL
+#define CONFIG_OF_SEPARATE
+
 /* High-level configuration options */
 #define TEGRA2_SYSMEM			"mem=384M at 0M nvmem=128M at 384M"
 #define V_PROMPT			"Tegra2 (Medcom) # "
@@ -49,6 +54,21 @@
 #define CONFIG_TEGRA2_MMC
 #define CONFIG_CMD_MMC
 
+/* USB host support */
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_TEGRA
+#define CONFIG_USB_STORAGE
+#define CONFIG_CMD_USB
+
+/* USB networking support */
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_SMSC95XX
+#define CONFIG_USB_ETHER_ASIX
+
+/* General networking support */
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_DHCP
+
 #define CONFIG_DOS_PARTITION
 #define CONFIG_EFI_PARTITION
 #define CONFIG_CMD_EXT2
Signature · 1 line
1.7.10.2
#2 lore raw

PATCH 2/3 tegra: medcom: Add device tree support

board/avionic-design/dts/tegra2-medcom.dts line 15

Quoted 8 lines · Thierry Reding

Device tree support is required for working USB host support, which in turn enables ethernet support.

board/avionic-design/dts/tegra2-medcom.dts +3 -0
 
+	chosen {
+		bootargs = "console=ttyS0,115200n8";
+	};

I don't think you need that in the U-Boot .dts file, since it's specific to the kernel. Admittedly, U-Boot's tegra2-seaboard.dts has it, but none of the other Tegra .dts files do.

board/avionic-design/dts/tegra2-medcom.dts line 66

Quoted 4 lines
board/avionic-design/dts/tegra2-medcom.dts +4 -0
+	sdhci at c8000600 {
+		cd-gpios = <&gpio 58 0>; /* gpio PH2 */
+		wp-gpios = <&gpio 59 0>; /* gpio PH3 */
+	};

I'd prefer not to include SDHCI nodes in the U-Boot .dts files, since U-Boot doesn't support configuring the SDHCI controllers from device tree (yet?). Having these nodes exist before then would be misleading. Yes again, the seaboard .dts file has it, but it should probably be removed from there too.

include/configs/medcom.h line 66

Quoted 6 lines
include/configs/medcom.h +4 -0
 
+/* USB networking support */
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_SMSC95XX
+#define CONFIG_USB_ETHER_ASIX

Is there an SMSC95XX on the board? Since standalone dongles with that chipset are rare, we've removed that one config option from all the other Tegra boards since it likely isn't useful (except Harmony which has that chip on board).

Aside from those comments, this looks fine.

#3 lore raw

PATCH 2/3 tegra: medcom: Add device tree support

Quoted 6 lines · Stephen Warren
Quoted 4 lines · Thierry Reding

Device tree support is required for working USB host support, which in turn enables ethernet support.

board/avionic-design/dts/tegra2-medcom.dts +0 -0
Quoted 7 lines

board/avionic-design/dts/tegra2-medcom.dts line 15

Quoted 3 lines
board/avionic-design/dts/tegra2-medcom.dts +3 -0
+	chosen {
+		bootargs = "console=ttyS0,115200n8";
+	};

I don't think you need that in the U-Boot .dts file, since it's specific to the kernel. Admittedly, U-Boot's tegra2-seaboard.dts has it, but none of the other Tegra .dts files do.

Okay, I'll drop it.

Quoted 10 lines

board/avionic-design/dts/tegra2-medcom.dts line 66

Quoted 4 lines
board/avionic-design/dts/tegra2-medcom.dts +4 -0
+	sdhci at c8000600 {
+		cd-gpios = <&gpio 58 0>; /* gpio PH2 */
+		wp-gpios = <&gpio 59 0>; /* gpio PH3 */
+	};

I'd prefer not to include SDHCI nodes in the U-Boot .dts files, since U-Boot doesn't support configuring the SDHCI controllers from device tree (yet?). Having these nodes exist before then would be misleading. Yes again, the seaboard .dts file has it, but it should probably be removed from there too.

I'll drop that as well, then. Do you want me to prepare a patch to remove those nodes from the Seaboard DTS?

Quoted 11 lines

include/configs/medcom.h line 66

Quoted 6 lines
include/configs/medcom.h +4 -0
 
+/* USB networking support */
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_SMSC95XX
+#define CONFIG_USB_ETHER_ASIX

Is there an SMSC95XX on the board? Since standalone dongles with that chipset are rare, we've removed that one config option from all the other Tegra boards since it likely isn't useful (except Harmony which has that chip on board).

Yes, the Tamonten has an SMSC95XX.

Quoted 1 line

Aside from those comments, this looks fine.

Thanks for reviewing.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120524/64b993bd/attachment.pgp>

#4 lore raw

PATCH 3/3 tegra: plutux: Add device tree support

In reply to Thierry Reding

Device tree support is required for working USB host support, which in turn enables ethernet support.

---
 board/avionic-design/dts/tegra2-plutux.dts |   67 ++++++++++++++++++++++++++++
 include/configs/plutux.h                   |   22 ++++++++-
 2 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 board/avionic-design/dts/tegra2-plutux.dts
board/avionic-design/dts/tegra2-plutux.dts new file +67 -0
new file mode 100644
index 0000000..b8d815c
@@ -0,0 +1,67 @@
+/dts-v1/;
+
+/include/ ARCH_CPU_DTS
+
+/ {
+	model = "Avionic Design Plutux";
+	compatible = "avionic-design,plutux", "nvidia,tegra20";
+
+	aliases {
+		usb0 = "/usb at c5008000";
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8";
+	};
+
+	memory {
+		reg = <0x00000000 0x20000000>;
+	};
+
+	clocks {
+		clk_32k: clk_32k {
+			clock-frequency = <32000>;
+		};
+
+		osc {
+			clock-frequency = <12000000>;
+		};
+	};
+
+	clock at 60006000 {
+		clocks = <&clk_32k &osc>;
+	};
+
+	serial at 70006300 {
+		clock-frequency = <216000000>;
+	};
+
+	i2c at 7000c000 {
+		status = "disabled";
+	};
+
+	i2c at 7000c400 {
+		status = "disabled";
+	};
+
+	i2c at 7000c500 {
+		status = "disabled";
+	};
+
+	i2c at 7000d000 {
+		status = "disabled";
+	};
+
+	usb at c5000000 {
+		status = "disabled";
+	};
+
+	usb at c5004000 {
+		status = "disabled";
+	};
+
+	sdhci at c8000600 {
+		cd-gpios = <&gpio 58 0>; /* gpio PH2 */
+		wp-gpios = <&gpio 59 0>; /* gpio PH3 */
+	};
+};
include/configs/plutux.h +21 -1
index f869191..73f4292 100644
@@ -1,7 +1,7 @@
 /*
  *  (C) Copyright 2010,2011
  *  NVIDIA Corporation <www.nvidia.com>
- *  (C) Copyright 2011
+ *  (C) Copyright 2011-2012
  *  Avionic Design GmbH <www.avionic-design.de>
  *
  * See file CREDITS for list of people who contributed to this
@@ -28,6 +28,11 @@
 
 #include "tegra2-common.h"
 
+/* Enable fdt support for Plutux. Flash the image in u-boot-dtb.bin */
+#define CONFIG_DEFAULT_DEVICE_TREE	tegra2-plutux
+#define CONFIG_OF_CONTROL
+#define CONFIG_OF_SEPARATE
+
 /* High-level configuration options */
 #define TEGRA2_SYSMEM			"mem=384M at 0M nvmem=128M at 384M"
 #define V_PROMPT			"Tegra2 (Plutux) # "
@@ -49,6 +54,21 @@
 #define CONFIG_TEGRA2_MMC
 #define CONFIG_CMD_MMC
 
+/* USB host support */
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_TEGRA
+#define CONFIG_USB_STORAGE
+#define CONFIG_CMD_USB
+
+/* USB networking support */
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_SMSC95XX
+#define CONFIG_USB_ETHER_ASIX
+
+/* General networking support */
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_DHCP
+
 #define CONFIG_DOS_PARTITION
 #define CONFIG_EFI_PARTITION
 #define CONFIG_CMD_EXT2
Signature · 1 line
1.7.10.2
#5 lore raw

PATCH 3/3 tegra: plutux: Add device tree support

Quoted 2 lines · Thierry Reding

Device tree support is required for working USB host support, which in turn enables ethernet support.

Same comment here as the previous patch obviously:-)

#6 lore raw

PATCH 1/3 tegra: usb: Add USB support to Tamonten boards

In reply to Thierry Reding
Quoted 2 lines · Thierry Reding

This adds basic USB support for port 0. Device tree support is needed to initialize the USB EHCI and will be added in a subsequent patch.

I don't think this is anything in particular to do with USB support "for port 0"; it's general USB support.

The code here duplicates changes made to board/nvidia/common/board.c. Shouldn't all Tegra boards be using that common board code so we don't have to duplicate all this early setup for every board vendor using Tegra? Otherwise, every time we add I2C, SPI, LP0, ... to board/nvidia/common/board.c, you'll just have to make the same change to tamonten.c too.

#7 lore raw

PATCH 1/3 tegra: usb: Add USB support to Tamonten boards

Quoted 6 lines · Stephen Warren
Quoted 2 lines · Thierry Reding

This adds basic USB support for port 0. Device tree support is needed to initialize the USB EHCI and will be added in a subsequent patch.

I don't think this is anything in particular to do with USB support "for port 0"; it's general USB support.

Okay, I did copy this from Simon's earlier commits. I can just drop "for port 0". It isn't really relevant anyway.

Quoted 6 lines

The code here duplicates changes made to board/nvidia/common/board.c. Shouldn't all Tegra boards be using that common board code so we don't have to duplicate all this early setup for every board vendor using Tegra? Otherwise, every time we add I2C, SPI, LP0, ... to board/nvidia/common/board.c, you'll just have to make the same change to tamonten.c too.

I think the problem is U-Boot's build system, which doesn't allow sharing code between different subdirectories of board/.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120524/d5e2f235/attachment.pgp>

#8 lore raw

PATCH 1/3 tegra: usb: Add USB support to Tamonten boards

Quoted 5 lines · Thierry Reding
Quoted 4 lines · Stephen Warren
Quoted 3 lines · Thierry Reding

This adds basic USB support for port 0. Device tree support is needed to initialize the USB EHCI and will be added in a subsequent patch.

...

Quoted 9 lines
Quoted 6 lines

The code here duplicates changes made to board/nvidia/common/board.c. Shouldn't all Tegra boards be using that common board code so we don't have to duplicate all this early setup for every board vendor using Tegra? Otherwise, every time we add I2C, SPI, LP0, ... to board/nvidia/common/board.c, you'll just have to make the same change to tamonten.c too.

I think the problem is U-Boot's build system, which doesn't allow sharing code between different subdirectories of board/.

I have both board/compulab/trimslice and board/compal/paz00 sharing the board/nvidia/common code; take a look at their Makefiles.

#9 lore raw

PATCH 1/3 tegra: usb: Add USB support to Tamonten boards

Quoted 14 lines · Stephen Warren
Quoted 5 lines · Thierry Reding
Quoted 4 lines · Stephen Warren
Quoted 3 lines · Thierry Reding

This adds basic USB support for port 0. Device tree support is needed to initialize the USB EHCI and will be added in a subsequent patch.

...

Quoted 7 lines
Quoted 6 lines

The code here duplicates changes made to board/nvidia/common/board.c. Shouldn't all Tegra boards be using that common board code so we don't have to duplicate all this early setup for every board vendor using Tegra? Otherwise, every time we add I2C, SPI, LP0, ... to board/nvidia/common/board.c, you'll just have to make the same change to tamonten.c too.

Quoted 5 lines
Quoted 2 lines

I think the problem is U-Boot's build system, which doesn't allow sharing code between different subdirectories of board/.

I have both board/compulab/trimslice and board/compal/paz00 sharing the board/nvidia/common code; take a look at their Makefiles.

Okay, will do.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120525/7f85ee19/attachment.pgp>