Skip to contentSkip to conversation

tegra: Add fdt definitions and USB driver

PATCH Superseded Simon Glass 7 participants 23 messages Dec 7, 2011 – Feb 27, 2012 1 message not in the archive

Subsystems (6)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover tegra: Add fdt definitions and USB driver

This series brings in the kernel fdt file and provides a working USB driver for Tegra2 Seaboard.

(I have done this in one series since otherwise most of the fdt additions will just look like dead code.)

The driver requires CONFIG_OF_CONTROL and a device tree to operate.

Some enhancements to fdtdec are required to make this easier, and these are included in the series also. I have had to bring in basic GPIO support due to the request to put the USB VBUS into the fdt.

Since the kernel recently got a very minimal USB binding, I have started with that and extended it where appropriate.

Tegra likes to have cache-aligned buffers. I have dropped the patch which implements this since we will solve this problem by making callers align their buffers (as we did with MMC).

Changes in v2:
- Use "okay" instead of "ok" for fdt node status
- Remove 0x from fdt aliases
- Rename params to timing
- Store entire fdt config in port list, not just register pointer
- Remove non-fdt operation of USB, since it is not needed
- Decode USB VBUS GPIO from the fdt
- Decode phy type differently (to match new kernel fdt)
- Rename tegra20-usb to tegra20-ehcui (to match new kernel fdt)
- Improve debug() printouts in case of failure to init USB
- Add setting of pinmux for USB VBUS GPIO
- Remove unneeded CONFIG_TEGRA_USBx defines

Changes in v3:
- Remove "okay" from nodes since this is the default anyway
- Fix device tree indenting with tabs instead of spaces
- Disable USB2 which is not used on Seaboard
- Remove usbparams properties from fdt and moved them to C code
- Drop Tegra USB alignment patch as we will deal with this another way

Simon Glass (16):
fdt: Tidy up a few fdtdec problems
fdt: Add functions to access phandles, arrays and bools Add gpio_request() to asm-generic header
fdt: Add basic support for decoding GPIO definitions
arm: fdt: Ensure that an embedded fdt is word-aligned
arm: fdt: Add skeleton device tree file from kernel
tegra: fdt: Add Tegra2x device tree file from kernel
tegra: fdt: Add device tree file for Tegra2 Seaboard from kernel
tegra: usb: fdt: Add additional device tree definitions for USB ports
tegra: usb: fdt: Add USB definitions for Tegra2 Seaboard
usb: Add support for txfifo threshold
tegra: usb: Add support for Tegra USB peripheral
tegra: usb: Add USB support to nvidia boards
tegra: usb: Add common USB defines for tegra2 boards
tegra: usb: Enable USB on Seaboard
tegra: fdt: Enable FDT support for Seaboard

 README                                    |    3 +
 arch/arm/cpu/armv7/tegra2/Makefile        |    4 +-
 arch/arm/cpu/armv7/tegra2/config.mk       |    2 +
 arch/arm/cpu/armv7/tegra2/usb.c           |  430 +++++++++++++++++++++++++++++
 arch/arm/cpu/armv7/u-boot.lds             |    5 +
 arch/arm/dts/skeleton.dtsi                |   13 +
 arch/arm/dts/tegra20.dtsi                 |  172 ++++++++++++
 arch/arm/include/asm/arch-tegra2/tegra2.h |    2 +
 arch/arm/include/asm/arch-tegra2/usb.h    |  255 +++++++++++++++++
 board/nvidia/common/board.c               |    8 +
 board/nvidia/dts/tegra2-seaboard.dts      |   47 ++++
 drivers/usb/host/Makefile                 |    1 +
 drivers/usb/host/ehci-hcd.c               |    7 +
 drivers/usb/host/ehci-tegra.c             |   63 +++++
 drivers/usb/host/ehci.h                   |    6 +-
 dts/Makefile                              |    2 +-
 include/asm-generic/gpio.h                |   10 +
 include/configs/seaboard.h                |   12 +
 include/configs/tegra2-common.h           |   14 +
 include/fdtdec.h                          |  109 +++++++-
 lib/fdtdec.c                              |  168 +++++++++++-
 21 files changed, 1320 insertions(+), 13 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/tegra2/usb.c
 create mode 100644 arch/arm/dts/skeleton.dtsi
 create mode 100644 arch/arm/dts/tegra20.dtsi
 create mode 100644 arch/arm/include/asm/arch-tegra2/usb.h
 create mode 100644 board/nvidia/dts/tegra2-seaboard.dts
 create mode 100644 drivers/usb/host/ehci-tegra.c
Signature · 1 line
1.7.3.1

A message that is not in the archive (sent off-list or not yet received): 1323221055-20113-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

#2 lore raw

PATCH v3 1/16 fdt: Tidy up a few fdtdec problems

This fixes five trivial issues in fdtdec.c:
1. fdtdec_get_is_enabled() doesn't really need a default value
2. The fdt must be word-aligned, since otherwise it will fail on ARM
3. The compat_names[] array is missing its first element. This is needed only because the first fdt_compat_id is defined to be invalid.
4. Added a header prototype for fdtdec_next_compatible()
5. Change fdtdec_next_alias() to only increment its 'upto' parameter on success, to make the display error messages in the caller easier.

---

 include/fdtdec.h |   23 +++++++++++++++++++----
 lib/fdtdec.c     |   22 ++++++++++++++++------
 2 files changed, 35 insertions(+), 10 deletions(-)
include/fdtdec.h +19 -4
index d871cdd..49dbac4 100644
@@ -82,6 +82,21 @@ int fdtdec_next_alias(const void *blob, const char *name,
 		enum fdt_compat_id id, int *upto);
 
 /**
+ * Find the next compatible node for a peripheral.
+ *
+ * Do the first call with node = 0. This function will return a pointer to
+ * the next compatible node. Next time you call this function, pass the
+ * value returned, and the next node will be provided.
+ *
+ * @param blob		FDT blob to use
+ * @param node		Start node for search
+ * @param id		Compatible ID to look for (enum fdt_compat_id)
+ * @return offset of next compatible node, or -FDT_ERR_NOTFOUND if no more
+ */
+int fdtdec_next_compatible(const void *blob, int node,
+		enum fdt_compat_id id);
+
+/**
  * Look up an address property in a node and return it as an address.
  * The property must hold either one address with no trailing data or
  * one address with a length. This is only tested on 32-bit machines.
@@ -112,14 +127,14 @@ s32 fdtdec_get_int(const void *blob, int node, const char *prop_name,
  * Checks whether a node is enabled.
  * This looks for a 'status' property. If this exists, then returns 1 if
  * the status is 'ok' and 0 otherwise. If there is no status property,
- * it returns the default value.
+ * it returns 1 on the assumption that anything mentioned should be enabled
+ * by default.
  *
  * @param blob	FDT blob
  * @param node	node to examine
- * @param default_val	default value to return if no 'status' property exists
- * @return integer value 0/1, if found, or default_val if not
+ * @return integer value 0 (not enabled) or 1 (enabled)
  */
-int fdtdec_get_is_enabled(const void *blob, int node, int default_val);
+int fdtdec_get_is_enabled(const void *blob, int node);
 
 /**
  * Checks whether we have a valid fdt available to control U-Boot, and panic
lib/fdtdec.c +16 -6
index 0f87163..55bbfc8 100644
@@ -33,6 +33,7 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 #define COMPAT(id, name) name
 static const char * const compat_names[COMPAT_COUNT] = {
+	COMPAT(UNKNOWN, "<none>"),
 };
 
 /**
@@ -84,14 +85,21 @@ s32 fdtdec_get_int(const void *blob, int node, const char *prop_name,
 	return default_val;
 }
 
-int fdtdec_get_is_enabled(const void *blob, int node, int default_val)
+int fdtdec_get_is_enabled(const void *blob, int node)
 {
 	const char *cell;
 
+	/*
+	 * It should say "okay", so only allow that. Some fdts use "ok" but
+	 * this is a bug. Please fix your device tree source file. See here
+	 * for discussion:
+	 *
+	 * http://www.mail-archive.com/[email protected]/msg71598.html
+	 */
 	cell = fdt_getprop(blob, node, "status", NULL);
 	if (cell)
-		return 0 == strcmp(cell, "ok");
-	return default_val;
+		return 0 == strcmp(cell, "okay");
+	return 1;
 }
 
 enum fdt_compat_id fd_dec_lookup(const void *blob, int node)
@@ -122,14 +130,16 @@ int fdtdec_next_alias(const void *blob, const char *name,
 	/* snprintf() is not available */
 	assert(strlen(name) < MAX_STR_LEN);
 	sprintf(str, "%.*s%d", MAX_STR_LEN, name, *upto);
-	(*upto)++;
 	node = find_alias_node(blob, str);
 	if (node < 0)
 		return node;
 	err = fdt_node_check_compatible(blob, node, compat_names[id]);
 	if (err < 0)
 		return err;
-	return err ? -FDT_ERR_NOTFOUND : node;
+	if (err)
+		return -FDT_ERR_NOTFOUND;
+	(*upto)++;
+	return node;
 }
 
 /*
@@ -140,7 +150,7 @@ int fdtdec_next_alias(const void *blob, const char *name,
 int fdtdec_check_fdt(void)
 {
 	/* We must have an fdt */
-	if (fdt_check_header(gd->fdt_blob))
+	if (((uintptr_t)gd->fdt_blob & 3) || fdt_check_header(gd->fdt_blob))
 		panic("No valid fdt found - please append one to U-Boot\n"
 			"binary or define CONFIG_OF_EMBED\n");
 	return 0;
Signature · 1 line
1.7.3.1
#3 lore raw

PATCH v3 2/16 fdt: Add functions to access phandles, arrays and bools

In reply to a message not in the archive

Add a function to look up a property which is a phandle in a node, and another to read a fixed-length integer array from an fdt property. Also add a function to read boolean properties, although there is no actual boolean type in U-Boot.

---

 include/fdtdec.h |   40 ++++++++++++++++++++++++++++++++
 lib/fdtdec.c     |   67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 107 insertions(+), 0 deletions(-)
include/fdtdec.h +40 -0
index 49dbac4..c414131 100644
@@ -141,3 +141,43 @@ int fdtdec_get_is_enabled(const void *blob, int node);
  * if not.
  */
 int fdtdec_check_fdt(void);
+
+/**
+ * Look up a phandle and follow it to its node. Then return the offset
+ * of that node.
+ *
+ * @param blob		FDT blob
+ * @param node		node to examine
+ * @param prop_name	name of property to find
+ * @return node offset if found, -ve error code on error
+ */
+int fdtdec_lookup_phandle(const void *blob, int node, const char *prop_name);
+
+/**
+ * Look up a property in a node and return its contents in an integer
+ * array of given length. The property must have at least enough data for
+ * the array (4*count bytes). It may have more, but this will be ignored.
+ *
+ * @param blob		FDT blob
+ * @param node		node to examine
+ * @param prop_name	name of property to find
+ * @param array		array to fill with data
+ * @param count		number of array elements
+ * @return 0 if ok, or -FDT_ERR_NOTFOUND if the property is not found,
+ *		or -FDT_ERR_BADLAYOUT if not enough data
+ */
+int fdtdec_get_int_array(const void *blob, int node, const char *prop_name,
+		u32 *array, int count);
+
+/**
+ * Look up a boolean property in a node and return it.
+ *
+ * A boolean properly is true if present in the device tree and false if not
+ * present, regardless of its value.
+ *
+ * @param blob	FDT blob
+ * @param node	node to examine
+ * @param prop_name	name of property to find
+ * @return 1 if the properly is present; 0 if it isn't present
+ */
+int fdtdec_get_bool(const void *blob, int node, const char *prop_name);
lib/fdtdec.c +67 -0

70 lines not on this page · raw message

Signature · 1 line
1.7.3.1
#4 lore raw

PATCH v3 4/16 fdt: Add basic support for decoding GPIO definitions

In reply to a message not in the archive

This adds some support into fdtdec for reading GPIO definitions from the fdt. We permit up to FDT_GPIO_MAX GPIOs in the system. Each GPIO is of the form:

gpio-function-name = <phandle gpio_num flags>;

where:

phandle is a pointer to the GPIO node
gpio_num is the number of the GPIO (0 to 223)
flags is a flag, as follows:

bit meaning
0 0=polarity normal, 1=active low (inverted)

An example is:

gpio-enable-propounder = <&gpio 43 0>;

which means that GPIO 43 is used to enable the propounder (setting the GPIO high), or that you can detect that the propounder is enabled by checking if the GPIO is high (the fdt does not indicate input/output).

Two main functions are provided:

fdtdec_decode_gpio() reads a GPIO property from an fdt node and decodes it into a structure.

fdtdec_setup_gpio() sets up the GPIO by calling gpio_request for you.

Both functions can cope with the property being missing, which is taken to mean that that GPIO function is not available or is not needed.

---

 include/fdtdec.h |   45 +++++++++++++++++++++++++++++++
 lib/fdtdec.c     |   78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 123 insertions(+), 0 deletions(-)
include/fdtdec.h +45 -0
index c414131..a640db1 100644
@@ -61,6 +61,23 @@ enum fdt_compat_id {
 	COMPAT_COUNT,
 };
 
+/* GPIOs are numbered from 0 */
+enum {
+	FDT_GPIO_NONE = -1U,	/* an invalid GPIO used to end our list */
+
+	FDT_GPIO_ACTIVE_LOW = 1 << 0,	/* input is active low (else high) */
+};
+
+/* This is the state of a GPIO pin as defined by the fdt */
+struct fdt_gpio_state {
+	const char *name;	/* name of the fdt property defining this */
+	uint gpio;		/* GPIO number, or FDT_GPIO_NONE if none */
+	u8 flags;		/* FDT_GPIO_... flags */
+};
+
+/* This tells us whether a fdt_gpio_state record is valid or not */
+#define fdt_gpio_isvalid(x) ((x)->gpio != FDT_GPIO_NONE)
+
 /**
  * Find the next numbered alias for a peripheral. This is used to enumerate
  * all the peripherals of a certain type.
@@ -181,3 +198,31 @@ int fdtdec_get_int_array(const void *blob, int node, const char *prop_name,
  * @return 1 if the properly is present; 0 if it isn't present
  */
 int fdtdec_get_bool(const void *blob, int node, const char *prop_name);
+
+/**
+ * Decode a single GPIOs from an FDT.
+ *
+ * If the property is not found, then the GPIO structure will still be
+ * initialised, with gpio set to FDT_GPIO_NONE. This makes it easy to
+ * provide optional GPIOs.
+ *
+ * @param blob		FDT blob to use
+ * @param node		Node to look at
+ * @param prop_name	Node property name
+ * @param gpio		gpio elements to fill from FDT
+ * @return 0 if ok, -FDT_ERR_NOTFOUND if the property is missing.
+ */
+int fdtdec_decode_gpio(const void *blob, int node, const char *prop_name,
+		struct fdt_gpio_state *gpio);
+
+/**
+ * Set up a GPIO pin according to the provided gpio information. At present this
+ * just requests the GPIO.
+ *
+ * If the gpio is FDT_GPIO_NONE, no action is taken. This makes it easy to
+ * deal with optional GPIOs.
+ *
+ * @param gpio		GPIO info to use for set up
+ * @return 0 if all ok or gpio was FDT_GPIO_NONE; -1 on error
+ */
+int fdtdec_setup_gpio(struct fdt_gpio_state *gpio);
lib/fdtdec.c +78 -0

87 lines not on this page · raw message

Signature · 1 line
1.7.3.1
#5 lore raw

PATCH v3 5/16 arm: fdt: Ensure that an embedded fdt is word-aligned

In reply to a message not in the archive

By putting the fdt blob into a distinctive area we can ensure that it appears at the start of the data section and is word-aligned.

Note: It does not seem to be possible to get objcopy to honour its --section-alignment flag, which would otherwise provide an easier fix for this problem.

---

 arch/arm/cpu/armv7/u-boot.lds |    5 +++++
 dts/Makefile                  |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/u-boot.lds +5 -0
index 40ecf78..793e51b 100644
@@ -43,6 +43,11 @@ SECTIONS
 
 	. = ALIGN(4);
 	.data : {
+		/*
+		 * Sadly objcopy seems to ignore --section-alignment.
+		 * Put any embedded device tree first so it is aligned.
+		 */
+		*(.dts.data)
 		*(.data)
 	}
 
dts/Makefile +1 -1
index 5792afd..83547d4 100644
@@ -79,7 +79,7 @@ $(obj)dt.o: $(DT_BIN)
 	\
 	cd $(dir ${DT_BIN}) && \
 	$(OBJCOPY) -I binary -O $${oformat} -B $${oarch} \
-		$(notdir ${DT_BIN}) $@
+		--prefix-sections=.dts $(notdir ${DT_BIN}) $@
 	rm $(DT_BIN)
 
 OBJS-$(CONFIG_OF_EMBED)	:= dt.o
Signature · 1 line
1.7.3.1
#6 lore raw

PATCH v3 6/16 arm: fdt: Add skeleton device tree file from kernel

In reply to a message not in the archive

This was taken from commit b48c54e2 at:
git://git.kernel.org/pub/scm/linux/kernel/git/olof/tegra.git

---

 arch/arm/dts/skeleton.dtsi |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/dts/skeleton.dtsi
arch/arm/dts/skeleton.dtsi new file +13 -0
new file mode 100644
index 0000000..b41d241
@@ -0,0 +1,13 @@
+/*
+ * Skeleton device tree; the bare minimum needed to boot; just include and
+ * add a compatible value.  The bootloader will typically populate the memory
+ * node.
+ */
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	chosen { };
+	aliases { };
+	memory { device_type = "memory"; reg = <0 0>; };
+};
Signature · 1 line
1.7.3.1
#7 lore raw

PATCH v3 7/16 tegra: fdt: Add Tegra2x device tree file from kernel

In reply to a message not in the archive

This was taken from commit b48c54e2 at:
git://git.kernel.org/pub/scm/linux/kernel/git/olof/tegra.git

config.mk is updated to provide this file to boards through the built-in mechanism:

/include/ ARCH_CPU_DTS

---

 arch/arm/cpu/armv7/tegra2/config.mk |    2 +
 arch/arm/dts/tegra20.dtsi           |  169 +++++++++++++++++++++++++++++++++++
 2 files changed, 171 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/dts/tegra20.dtsi
arch/arm/cpu/armv7/tegra2/config.mk +2 -0
index 2303dba..fe9ef5b 100644
@@ -31,3 +31,5 @@ CFLAGS_arch/arm/lib/board.o += -march=armv4t
 endif
 
 USE_PRIVATE_LIBGCC = yes
+
+CONFIG_ARCH_DEVICE_TREE := tegra20
arch/arm/dts/tegra20.dtsi new file +169 -0

169 lines not on this page · raw message

Signature · 1 line
1.7.3.1
#8 lore raw

PATCH v3 8/16 tegra: fdt: Add device tree file for Tegra2 Seaboard from kernel

In reply to a message not in the archive

This was taken from commit b48c54e2 at:
git://git.kernel.org/pub/scm/linux/kernel/git/olof/tegra.git

---

 board/nvidia/dts/tegra2-seaboard.dts |   36 ++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 board/nvidia/dts/tegra2-seaboard.dts
board/nvidia/dts/tegra2-seaboard.dts new file +36 -0
new file mode 100644
index 0000000..dde5d03
@@ -0,0 +1,36 @@
+/dts-v1/;
+
+/memreserve/ 0x1c000000 0x04000000;
+/include/ ARCH_CPU_DTS
+
+/ {
+	model = "NVIDIA Seaboard";
+	compatible = "nvidia,seaboard", "nvidia,tegra20";
+
+	chosen {
+		bootargs = "vmalloc=192M video=tegrafb console=ttyS0,115200n8 root=/dev/mmcblk1p3 rw rootwait";
+	};
+
+	memory {
+		device_type = "memory";
+		reg = < 0x00000000 0x40000000 >;
+	};
+
+	serial@70006300 {
+		clock-frequency = < 216000000 >;
+	};
+
+	sdhci@c8000400 {
+		cd-gpios = <&gpio 69 0>; /* gpio PI5 */
+		wp-gpios = <&gpio 57 0>; /* gpio PH1 */
+		power-gpios = <&gpio 70 0>; /* gpio PI6 */
+	};
+
+	sdhci@c8000600 {
+		support-8bit;
+	};
+
+	usb@c5000000 {
+		nvidia,vbus-gpio = <&gpio 24 0>; /* PD0 */
+	};
+};
Signature · 1 line
1.7.3.1
#9 lore raw

PATCH v3 9/16 tegra: usb: fdt: Add additional device tree definitions for USB ports

In reply to a message not in the archive

This adds peripheral IDs to the USB part of the device tree for U-Boot.

The peripheral IDs provide easy access to clock registers. We will likely remove this in favor of a full clock tree when it is available in the kernel (but probably still retain the peripheral ID, just move it into a clock node).

The USB timing information may vary between boards sometimes, but for now we hard-code it in C. This is because all current T2x boards use the same values, we will deal with T3x later and we first need to agree on the format for this timing information in the fdt and may in fact decide that it has no place there.

---

 arch/arm/dts/tegra20.dtsi |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/dts/tegra20.dtsi +3 -0
index 6146d24..27e3127 100644
@@ -149,6 +149,7 @@
 		reg = <0xc5000000 0x4000>;
 		interrupts = < 52 >;
 		phy_type = "utmi";
+		u-boot,periph-id = <22>;	// PERIPH_ID_USBD
 	};
 
 	usb@c5004000 {
@@ -156,6 +157,7 @@
 		reg = <0xc5004000 0x4000>;
 		interrupts = < 53 >;
 		phy_type = "ulpi";
+		u-boot,periph-id = <58>;	// PERIPH_ID_USB2
 	};
 
 	usb@c5008000 {
@@ -163,6 +165,7 @@
 		reg = <0xc5008000 0x4000>;
 		interrupts = < 129 >;
 		phy_type = "utmi";
+		u-boot,periph-id = <59>;	// PERIPH_ID_USB3
 	};
 
 };
Signature · 1 line
1.7.3.1
#10 lore raw

PATCH v3 10/16 tegra: usb: fdt: Add USB definitions for Tegra2 Seaboard

In reply to a message not in the archive

We set up two USB ports, one of which can be host or device. For some reason the kernel version does enable both ports.

---
Changes in v2:
- Use "okay" instead of "ok" for fdt node status
- Remove 0x from fdt aliases

Changes in v3:
- Remove "okay" from nodes since this is the default anyway
- Fix device tree indenting with tabs instead of spaces
- Disable USB2 which is not used on Seaboard

 board/nvidia/dts/tegra2-seaboard.dts |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
board/nvidia/dts/tegra2-seaboard.dts +12 -1
index dde5d03..839e761 100644
@@ -11,6 +11,12 @@
 		bootargs = "vmalloc=192M video=tegrafb console=ttyS0,115200n8 root=/dev/mmcblk1p3 rw rootwait";
 	};
 
+	aliases {
+		/* This defines the order of our USB ports */
+		usb0 = "/usb@c5008000";
+		usb1 = "/usb@c5000000";
+	};
+
 	memory {
 		device_type = "memory";
 		reg = < 0x00000000 0x40000000 >;
@@ -31,6 +37,11 @@
 	};
 
 	usb@c5000000 {
-		nvidia,vbus-gpio = <&gpio 24 0>; /* PD0 */
+		nvidia,vbus-gpio = <&gpio 24 0>; /* PD0 high to enable vbus */
+		support-host-mode;
+	};
+
+	usb@c5004000 {
+		status = "disabled";
 	};
 };
Signature · 1 line
1.7.3.1
#11 lore raw

PATCH v3 16/16 tegra: fdt: Enable FDT support for Seaboard

In reply to a message not in the archive

This switches Seaboard over to use FDT for run-time config instead of CONFIG options. USB is the only user at present.

---
Changes in v3:
- Drop Tegra USB alignment patch as we will deal with this another way

 include/configs/seaboard.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
include/configs/seaboard.h +5 -0
index b6d9f7a..1dc775a 100644
@@ -27,6 +27,11 @@
 #include <asm/sizes.h>
 #include "tegra2-common.h"
 
+/* Enable fdt support for Seaboard. Flash the image in u-boot-dtb.bin */
+#define CONFIG_DEFAULT_DEVICE_TREE	tegra2-seaboard
+#define CONFIG_OF_CONTROL
+#define CONFIG_OF_SEPARATE
+
 /* High-level configuration options */
 #define TEGRA2_SYSMEM		"mem=384M@0M nvmem=128M@384M mem=512M@512M"
 #define V_PROMPT		"Tegra2 (SeaBoard) # "
Signature · 1 line
1.7.3.1
#12 lore raw

PATCH v3 3/16 Add gpio_request() to asm-generic header

In reply to Simon Glass

This function should also be part of the GPIO API, so add it.

---

 include/asm-generic/gpio.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
include/asm-generic/gpio.h +10 -0
index a1ebb28..c1d697f 100644
@@ -72,3 +72,13 @@ int gpio_get_value(int gp);
  * @return 0 if ok, -1 on error
  */
 int gpio_set_value(int gp, int value);
+
+/**
+ * Request a gpio. This should be called before any of the other functions
+ * are used on this gpio.
+ *
+ * @param gp	GPIO number
+ * @param label	User label for this GPIO
+ * @return 0 if ok, -1 on error
+ */
+int gpio_request(unsigned gpio, const char *label);
Signature · 1 line
1.7.3.1
#13 lore raw

PATCH v3 3/16 Add gpio_request() to asm-generic header

Quoted 1 line · On Tuesday 06 December 2011 20:24:02 Simon Glass wrote:

+int gpio_request(unsigned gpio, const char *label);

should add gpio_free too
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120108/9adc3aaf/attachment.pgp>

#14 lore raw

PATCH v3 3/16 Add gpio_request() to asm-generic header

Quoted 4 lines · On Sun, 8 Jan 2012 03:44:19 -0500 Mike Frysinger <[email protected]> wrote:
Quoted 1 line · On Tuesday 06 December 2011 20:24:02 Simon Glass wrote:

+int gpio_request(unsigned gpio, const char *label);

should add gpio_free too

fyi, I just sent Wolfgang a pull request for this:

commit 3608b70fec881ccd4e41180c22662293a7e37b66

Author: Joe Hershberger <[email protected]>
Date:   Fri Nov 11 15:55:35 2011 -0600

gpio: Modify common gpio.h to more closely match Linux

Change "int gp" to "unsigned gpio"
Add request and free entry-points

Kim

#15 lore raw

PATCH v3 11/16 usb: Add support for txfifo threshold

In reply to Simon Glass

CONFIG_USB_EHCI_TXFIFO_THRESH enables setting of the txfilltuning field in the EHCI controller on reset.

---

 README                      |    3 +++
 drivers/usb/host/ehci-hcd.c |    7 +++++++
 drivers/usb/host/ehci.h     |    6 +++++-
 3 files changed, 15 insertions(+), 1 deletions(-)
README +3 -0
index fda0190..4dbb70c 100644
@@ -1096,6 +1096,9 @@ The following options need to be configured:
 				May be defined to allow interrupt polling
 				instead of using asynchronous interrupts
 
+		CONFIG_USB_EHCI_TXFIFO_THRESH enables setting of the
+		txfilltuning field in the EHCI controller on reset.
+
 - USB Device:
 		Define the below if you wish to use the USB console.
 		Once firmware is rebuilt from a serial console issue the
drivers/usb/host/ehci-hcd.c +7 -0
index 2197119..16deebc 100644
@@ -247,6 +247,13 @@ static int ehci_reset(void)
 #endif
 		ehci_writel(reg_ptr, tmp);
 	}
+
+#ifdef CONFIG_USB_EHCI_TXFIFO_THRESH
+	cmd = ehci_readl(&hcor->or_txfilltuning);
+	cmd &= ~TXFIFO_THRESH(0x3f);
+	cmd |= TXFIFO_THRESH(CONFIG_USB_EHCI_TXFIFO_THRESH);
+	ehci_writel(&hcor->or_txfilltuning, cmd);
+#endif
 out:
 	return ret;
 }
drivers/usb/host/ehci.h +5 -1
index 3d0ad0c..cc00ce4 100644
@@ -80,7 +80,11 @@ struct ehci_hcor {
 	uint32_t or_ctrldssegment;
 	uint32_t or_periodiclistbase;
 	uint32_t or_asynclistaddr;
-	uint32_t _reserved_[9];
+	uint32_t _reserved_0_;
+	uint32_t or_burstsize;
+	uint32_t or_txfilltuning;
+#define TXFIFO_THRESH(p)		((p & 0x3f) << 16)
+	uint32_t _reserved_1_[6];
 	uint32_t or_configflag;
 #define FLAG_CF		(1 << 0)	/* true:  we'll support "high speed" */
 	uint32_t or_portsc[CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS];
Signature · 1 line
1.7.3.1
#16 lore raw

PATCH v3 11/16 usb: Add support for txfifo threshold

Hi,

2011/12/7 Simon Glass <[email protected]>:

Quoted 10 lines

CONFIG_USB_EHCI_TXFIFO_THRESH enables setting of the txfilltuning field in the EHCI controller on reset.

---

?README ? ? ? ? ? ? ? ? ? ? ?| ? ?3 +++
?drivers/usb/host/ehci-hcd.c | ? ?7 +++++++
?drivers/usb/host/ehci.h ? ? | ? ?6 +++++-

?3 files changed, 15 insertions(+), 1 deletions(-)

Since it is part of a bigger series:

Kind regards,

Remy

#17 lore raw

PATCH v3 12/16 tegra: usb: Add support for Tegra USB peripheral

In reply to Simon Glass

This adds basic support for the Tegra2 USB controller. Board files should call board_usb_init() to set things up.

Configuration is performed through the FDT, with aliases used to set the order of the ports, like this fragment:

        aliases {
		/* This defines the order of our USB ports */
                usb0 = "/usb at 0xc5008000";
                usb1 = "/usb at 0xc5000000";
        };

drivers/usb/host files ONLY: Acked-by: Remy Bohmer <[email protected]>

---
Changes in v2:
- Rename params to timing
- Store entire fdt config in port list, not just register pointer
- Remove non-fdt operation of USB, since it is not needed
- Decode USB VBUS GPIO from the fdt
- Decode phy type differently (to match new kernel fdt)
- Rename tegra20-usb to tegra20-ehcui (to match new kernel fdt)
- Improve debug() printouts in case of failure to init USB

Changes in v3:
- Remove usbparams properties from fdt and moved them to C code

 arch/arm/cpu/armv7/tegra2/Makefile        |    4 +-
 arch/arm/cpu/armv7/tegra2/usb.c           |  430 +++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-tegra2/tegra2.h |    2 +
 arch/arm/include/asm/arch-tegra2/usb.h    |  255 +++++++++++++++++
 drivers/usb/host/Makefile                 |    1 +
 drivers/usb/host/ehci-tegra.c             |   63 +++++
 include/fdtdec.h                          |    1 +
 lib/fdtdec.c                              |    1 +
 8 files changed, 756 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/tegra2/usb.c
 create mode 100644 arch/arm/include/asm/arch-tegra2/usb.h
 create mode 100644 drivers/usb/host/ehci-tegra.c
arch/arm/cpu/armv7/tegra2/Makefile +3 -1
index 955c3b6..70e7abd 100644
@@ -33,8 +33,10 @@ include $(TOPDIR)/config.mk
 LIB	=  $(obj)lib$(SOC).o
 
 SOBJS	:= lowlevel_init.o
-COBJS	:= ap20.o board.o clock.o pinmux.o sys_info.o timer.o
+COBJS-y	:= ap20.o board.o clock.o pinmux.o sys_info.o timer.o
+COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o
 
+COBJS	:= $(COBJS-y)
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
 
arch/arm/cpu/armv7/tegra2/usb.c new file +430 -0

430 lines not on this page · raw message

arch/arm/include/asm/arch-tegra2/tegra2.h +2 -0
index 8941443..baae2eb 100644
@@ -41,6 +41,8 @@
 #define TEGRA2_SPI_BASE		(NV_PA_APB_MISC_BASE + 0xC380)
 #define NV_PA_PMC_BASE		0x7000E400
 #define NV_PA_CSITE_BASE	0x70040000
+#define TEGRA_USB1_BASE		0xC5000000
+#define TEGRA_USB3_BASE		0xC5008000
 
 #define TEGRA2_SDRC_CS0		NV_PA_SDRAM_BASE
 #define LOW_LEVEL_SRAM_STACK	0x4000FFFC
arch/arm/include/asm/arch-tegra2/usb.h new file +255 -0

255 lines not on this page · raw message

drivers/usb/host/Makefile +1 -0
index 09abb75..39134ff 100644
@@ -46,6 +46,7 @@ COBJS-$(CONFIG_USB_EHCI_PPC4XX) += ehci-ppc4xx.o
 COBJS-$(CONFIG_USB_EHCI_IXP4XX) += ehci-ixp.o
 COBJS-$(CONFIG_USB_EHCI_KIRKWOOD) += ehci-kirkwood.o
 COBJS-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
+COBJS-$(CONFIG_USB_EHCI_TEGRA) += ehci-tegra.o
 COBJS-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o
 
 COBJS	:= $(COBJS-y)
drivers/usb/host/ehci-tegra.c new file +63 -0

63 lines not on this page · raw message

include/fdtdec.h +1 -0
index a640db1..a8911b5 100644
@@ -57,6 +57,7 @@ struct fdt_memory {
  */
 enum fdt_compat_id {
 	COMPAT_UNKNOWN,
+	COMPAT_NVIDIA_TEGRA20_USB,	/* Tegra2 USB port */
 
 	COMPAT_COUNT,
 };
lib/fdtdec.c +1 -0
index 69f8b66..931b4ce 100644
@@ -37,6 +37,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define COMPAT(id, name) name
 static const char * const compat_names[COMPAT_COUNT] = {
 	COMPAT(UNKNOWN, "<none>"),
+	COMPAT(NVIDIA_TEGRA20_USB, "nvidia,tegra20-ehci"),
 };
 
 /**
Signature · 1 line
1.7.3.1
#18 lore raw

PATCH v3 13/16 tegra: usb: Add USB support to nvidia boards

In reply to Simon Glass

This adds basic USB support for port 0. The other port is not supported yet.

Tegra2 (SeaBoard) # usb start
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 5 USB Device(s) found
scanning bus for storage devices... 1 Storage Device(s) found
Tegra2 (SeaBoard) # ext2load usb 0:3 10000000 /boot/vmlinuz Loading file "/boot/vmlinuz" from usb device 0:3 (ROOT-A) 2932976 bytes read

---
Changes in v2:
- Add setting of pinmux for USB VBUS GPIO

 board/nvidia/common/board.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
board/nvidia/common/board.c +8 -0
index f39fb24..c7a33c3 100644
@@ -32,6 +32,7 @@
 #include <asm/arch/pinmux.h>
 #include <asm/arch/uart.h>
 #include <spi.h>
+#include <asm/arch/usb.h>
 #include "board.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -125,6 +126,13 @@ int board_init(void)
 	/* boot param addr */
 	gd->bd->bi_boot_params = (NV_PA_SDRAM_BASE + 0x100);
 
+#ifdef CONFIG_USB_EHCI_TEGRA
+	/* For USB GPIO PD0. for now, since we have no pinmux in fdt */
+	pinmux_tristate_disable(PINGRP_SLXK);
+
+	board_usb_init(gd->fdt_blob);
+#endif
+
 	return 0;
 }
 
Signature · 1 line
1.7.3.1
#19 lore raw

PATCH v3 14/16 tegra: usb: Add common USB defines for tegra2 boards

In reply to Simon Glass

All Tegra2 boards should include tegra2-common. This adds the required USB config to that file.

---

 include/configs/tegra2-common.h |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
include/configs/tegra2-common.h +14 -0
index e6f385f..6549d00 100644
@@ -84,6 +84,20 @@
 #define CONFIG_SYS_BAUDRATE_TABLE	{4800, 9600, 19200, 38400, 57600,\
 					115200}
 
+/*
+ * USB Host. Tegra2 requires USB buffers to be aligned to a word boundary
+ */
+#define CONFIG_USB_EHCI_DATA_ALIGN	4
+
+/*
+ * This parameter affects a TXFILLTUNING field that controls how much data is
+ * sent to the latency fifo before it is sent to the wire. Without this
+ * parameter, the default (2) causes occasional Data Buffer Errors in OUT
+ * packets depending on the buffer address and size.
+ */
+#define CONFIG_USB_EHCI_TXFIFO_THRESH	10
+
+#define CONFIG_EHCI_IS_TDI
 /* include default commands */
 #include <config_cmd_default.h>
 
Signature · 1 line
1.7.3.1
#20 lore raw

PATCH v3 15/16 tegra: usb: Enable USB on Seaboard

In reply to Simon Glass

Seaboard has a top port which is USB host or device, and a side port which is host only.

---
Changes in v2:
- Remove unneeded CONFIG_TEGRA_USBx defines

 include/configs/seaboard.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
include/configs/seaboard.h +7 -0
index 261f952..b6d9f7a 100644
@@ -72,4 +72,11 @@
 
 #define CONFIG_ENV_SECT_SIZE    CONFIG_ENV_SIZE
 #define CONFIG_ENV_OFFSET       (CONFIG_SPI_FLASH_SIZE - CONFIG_ENV_SECT_SIZE)
+
+/* USB Host support */
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_TEGRA
+#define CONFIG_USB_STORAGE
+#define CONFIG_CMD_USB
+
 #endif /* __CONFIG_H */
Signature · 1 line
1.7.3.1
#21 lore raw

v3 cover tegra: Add fdt definitions and USB driver

In reply to Simon Glass
Quoted 78 lines

This series brings in the kernel fdt file and provides a working USB driver for Tegra2 Seaboard.

(I have done this in one series since otherwise most of the fdt additions will just look like dead code.)

The driver requires CONFIG_OF_CONTROL and a device tree to operate.

Some enhancements to fdtdec are required to make this easier, and these are included in the series also. I have had to bring in basic GPIO support due to the request to put the USB VBUS into the fdt.

Since the kernel recently got a very minimal USB binding, I have started with that and extended it where appropriate.

Tegra likes to have cache-aligned buffers. I have dropped the patch which implements this since we will solve this problem by making callers align their buffers (as we did with MMC).

Changes in v2:
- Use "okay" instead of "ok" for fdt node status
- Remove 0x from fdt aliases
- Rename params to timing
- Store entire fdt config in port list, not just register pointer
- Remove non-fdt operation of USB, since it is not needed
- Decode USB VBUS GPIO from the fdt
- Decode phy type differently (to match new kernel fdt)
- Rename tegra20-usb to tegra20-ehcui (to match new kernel fdt)
- Improve debug() printouts in case of failure to init USB
- Add setting of pinmux for USB VBUS GPIO
- Remove unneeded CONFIG_TEGRA_USBx defines

Changes in v3:
- Remove "okay" from nodes since this is the default anyway
- Fix device tree indenting with tabs instead of spaces
- Disable USB2 which is not used on Seaboard
- Remove usbparams properties from fdt and moved them to C code
- Drop Tegra USB alignment patch as we will deal with this another way

Simon Glass (16):
fdt: Tidy up a few fdtdec problems
fdt: Add functions to access phandles, arrays and bools Add gpio_request() to asm-generic header
fdt: Add basic support for decoding GPIO definitions
arm: fdt: Ensure that an embedded fdt is word-aligned
arm: fdt: Add skeleton device tree file from kernel
tegra: fdt: Add Tegra2x device tree file from kernel
tegra: fdt: Add device tree file for Tegra2 Seaboard from kernel
tegra: usb: fdt: Add additional device tree definitions for USB ports
tegra: usb: fdt: Add USB definitions for Tegra2 Seaboard
usb: Add support for txfifo threshold
tegra: usb: Add support for Tegra USB peripheral
tegra: usb: Add USB support to nvidia boards
tegra: usb: Add common USB defines for tegra2 boards
tegra: usb: Enable USB on Seaboard
tegra: fdt: Enable FDT support for Seaboard

 README                                    |    3 +
 arch/arm/cpu/armv7/tegra2/Makefile        |    4 +-
 arch/arm/cpu/armv7/tegra2/config.mk       |    2 +
 arch/arm/cpu/armv7/tegra2/usb.c           |  430
+++++++++++++++++++++++++++++ arch/arm/cpu/armv7/u-boot.lds             | 
  5 +
 arch/arm/dts/skeleton.dtsi                |   13 +
 arch/arm/dts/tegra20.dtsi                 |  172 ++++++++++++
 arch/arm/include/asm/arch-tegra2/tegra2.h |    2 +
 arch/arm/include/asm/arch-tegra2/usb.h    |  255 +++++++++++++++++
 board/nvidia/common/board.c               |    8 +
 board/nvidia/dts/tegra2-seaboard.dts      |   47 ++++
 drivers/usb/host/Makefile                 |    1 +
 drivers/usb/host/ehci-hcd.c               |    7 +
 drivers/usb/host/ehci-tegra.c             |   63 +++++
 drivers/usb/host/ehci.h                   |    6 +-
 dts/Makefile                              |    2 +-
 include/asm-generic/gpio.h                |   10 +
 include/configs/seaboard.h                |   12 +
 include/configs/tegra2-common.h           |   14 +
 include/fdtdec.h                          |  109 +++++++-
Quoted 8 lines
 lib/fdtdec.c                              |  168 +++++++++++-
 21 files changed, 1320 insertions(+), 13 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/tegra2/usb.c
 create mode 100644 arch/arm/dts/skeleton.dtsi
 create mode 100644 arch/arm/dts/tegra20.dtsi
 create mode 100644 arch/arm/include/asm/arch-tegra2/usb.h
 create mode 100644 board/nvidia/dts/tegra2-seaboard.dts
 create mode 100644 drivers/usb/host/ehci-tegra.c

Hi,

what's the status of this patch/patchset?

Thanks
M

#22 lore raw

v3 cover tegra: Add fdt definitions and USB driver

Hi Marek,

Quoted 87 lines · Marek Vasut
Quoted 79 lines

This series brings in the kernel fdt file and provides a working USB driver for Tegra2 Seaboard.

(I have done this in one series since otherwise most of the fdt additions will just look like dead code.)

The driver requires CONFIG_OF_CONTROL and a device tree to operate.

Some enhancements to fdtdec are required to make this easier, and these are included in the series also. I have had to bring in basic GPIO support due to the request to put the USB VBUS into the fdt.

Since the kernel recently got a very minimal USB binding, I have started with that and extended it where appropriate.

Tegra likes to have cache-aligned buffers. I have dropped the patch which implements this since we will solve this problem by making callers align their buffers (as we did with MMC).

Changes in v2:
- Use "okay" instead of "ok" for fdt node status
- Remove 0x from fdt aliases
- Rename params to timing
- Store entire fdt config in port list, not just register pointer
- Remove non-fdt operation of USB, since it is not needed
- Decode USB VBUS GPIO from the fdt
- Decode phy type differently (to match new kernel fdt)
- Rename tegra20-usb to tegra20-ehcui (to match new kernel fdt)
- Improve debug() printouts in case of failure to init USB
- Add setting of pinmux for USB VBUS GPIO
- Remove unneeded CONFIG_TEGRA_USBx defines

Changes in v3:
- Remove "okay" from nodes since this is the default anyway
- Fix device tree indenting with tabs instead of spaces
- Disable USB2 which is not used on Seaboard
- Remove usbparams properties from fdt and moved them to C code
- Drop Tegra USB alignment patch as we will deal with this another way

Simon Glass (16):
? fdt: Tidy up a few fdtdec problems
? fdt: Add functions to access phandles, arrays and bools
? Add gpio_request() to asm-generic header
? fdt: Add basic support for decoding GPIO definitions
? arm: fdt: Ensure that an embedded fdt is word-aligned
? arm: fdt: Add skeleton device tree file from kernel
? tegra: fdt: Add Tegra2x device tree file from kernel
? tegra: fdt: Add device tree file for Tegra2 Seaboard from kernel ? tegra: usb: fdt: Add additional device tree definitions for USB ports ? tegra: usb: fdt: Add USB definitions for Tegra2 Seaboard
? usb: Add support for txfifo threshold
? tegra: usb: Add support for Tegra USB peripheral
? tegra: usb: Add USB support to nvidia boards
? tegra: usb: Add common USB defines for tegra2 boards
? tegra: usb: Enable USB on Seaboard
? tegra: fdt: Enable FDT support for Seaboard

?README ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?3 +
?arch/arm/cpu/armv7/tegra2/Makefile ? ? ? ?| ? ?4 +-
?arch/arm/cpu/armv7/tegra2/config.mk ? ? ? | ? ?2 +
?arch/arm/cpu/armv7/tegra2/usb.c ? ? ? ? ? | ?430
+++++++++++++++++++++++++++++ arch/arm/cpu/armv7/u-boot.lds ? ? ? ? ? ? |
? 5 +
?arch/arm/dts/skeleton.dtsi ? ? ? ? ? ? ? ?| ? 13 +
?arch/arm/dts/tegra20.dtsi ? ? ? ? ? ? ? ? | ?172 ++++++++++++
?arch/arm/include/asm/arch-tegra2/tegra2.h | ? ?2 +
?arch/arm/include/asm/arch-tegra2/usb.h ? ?| ?255 +++++++++++++++++
?board/nvidia/common/board.c ? ? ? ? ? ? ? | ? ?8 +
?board/nvidia/dts/tegra2-seaboard.dts ? ? ?| ? 47 ++++
?drivers/usb/host/Makefile ? ? ? ? ? ? ? ? | ? ?1 +
?drivers/usb/host/ehci-hcd.c ? ? ? ? ? ? ? | ? ?7 +
?drivers/usb/host/ehci-tegra.c ? ? ? ? ? ? | ? 63 +++++
?drivers/usb/host/ehci.h ? ? ? ? ? ? ? ? ? | ? ?6 +-
?dts/Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
?include/asm-generic/gpio.h ? ? ? ? ? ? ? ?| ? 10 +
?include/configs/seaboard.h ? ? ? ? ? ? ? ?| ? 12 +
?include/configs/tegra2-common.h ? ? ? ? ? | ? 14 +
?include/fdtdec.h ? ? ? ? ? ? ? ? ? ? ? ? ?| ?109 +++++++-
?lib/fdtdec.c ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ?168 +++++++++++-
Quoted 7 lines

?21 files changed, 1320 insertions(+), 13 deletions(-) ?create mode 100644 arch/arm/cpu/armv7/tegra2/usb.c ?create mode 100644 arch/arm/dts/skeleton.dtsi ?create mode 100644 arch/arm/dts/tegra20.dtsi ?create mode 100644 arch/arm/include/asm/arch-tegra2/usb.h ?create mode 100644 board/nvidia/dts/tegra2-seaboard.dts ?create mode 100644 drivers/usb/host/ehci-tegra.c

Quoted 3 lines

Hi,

what's the status of this patch/patchset?

It needs a small update to the Tegra device tree files (2 of the patches) and another change to deal with peripheral IDs (another 2 of the patches). I expect to get this done in the next few days. After that I am hoping we are done, but let's see.

Regards,
Simon

Quoted 3 lines

Thanks
M

#23 lore raw

v3 cover tegra: Add fdt definitions and USB driver

Quoted 94 lines

Hi Marek,

Quoted 87 lines · Marek Vasut
Quoted 78 lines

This series brings in the kernel fdt file and provides a working USB driver for Tegra2 Seaboard.

(I have done this in one series since otherwise most of the fdt additions will just look like dead code.)

The driver requires CONFIG_OF_CONTROL and a device tree to operate.

Some enhancements to fdtdec are required to make this easier, and these are included in the series also. I have had to bring in basic GPIO support due to the request to put the USB VBUS into the fdt.

Since the kernel recently got a very minimal USB binding, I have started with that and extended it where appropriate.

Tegra likes to have cache-aligned buffers. I have dropped the patch which implements this since we will solve this problem by making callers align their buffers (as we did with MMC).

Changes in v2:
- Use "okay" instead of "ok" for fdt node status
- Remove 0x from fdt aliases
- Rename params to timing
- Store entire fdt config in port list, not just register pointer
- Remove non-fdt operation of USB, since it is not needed
- Decode USB VBUS GPIO from the fdt
- Decode phy type differently (to match new kernel fdt)
- Rename tegra20-usb to tegra20-ehcui (to match new kernel fdt)
- Improve debug() printouts in case of failure to init USB
- Add setting of pinmux for USB VBUS GPIO
- Remove unneeded CONFIG_TEGRA_USBx defines

Changes in v3:
- Remove "okay" from nodes since this is the default anyway
- Fix device tree indenting with tabs instead of spaces
- Disable USB2 which is not used on Seaboard
- Remove usbparams properties from fdt and moved them to C code
- Drop Tegra USB alignment patch as we will deal with this another way

Simon Glass (16):
fdt: Tidy up a few fdtdec problems
fdt: Add functions to access phandles, arrays and bools Add gpio_request() to asm-generic header
fdt: Add basic support for decoding GPIO definitions
arm: fdt: Ensure that an embedded fdt is word-aligned
arm: fdt: Add skeleton device tree file from kernel
tegra: fdt: Add Tegra2x device tree file from kernel
tegra: fdt: Add device tree file for Tegra2 Seaboard from kernel
tegra: usb: fdt: Add additional device tree definitions for USB ports
tegra: usb: fdt: Add USB definitions for Tegra2 Seaboard
usb: Add support for txfifo threshold
tegra: usb: Add support for Tegra USB peripheral
tegra: usb: Add USB support to nvidia boards
tegra: usb: Add common USB defines for tegra2 boards
tegra: usb: Enable USB on Seaboard
tegra: fdt: Enable FDT support for Seaboard

 README                                    |    3 +
 arch/arm/cpu/armv7/tegra2/Makefile        |    4 +-
 arch/arm/cpu/armv7/tegra2/config.mk       |    2 +
 arch/arm/cpu/armv7/tegra2/usb.c           |  430
+++++++++++++++++++++++++++++ arch/arm/cpu/armv7/u-boot.lds            
| 5 +
 arch/arm/dts/skeleton.dtsi                |   13 +
 arch/arm/dts/tegra20.dtsi                 |  172 ++++++++++++
 arch/arm/include/asm/arch-tegra2/tegra2.h |    2 +
 arch/arm/include/asm/arch-tegra2/usb.h    |  255 +++++++++++++++++
 board/nvidia/common/board.c               |    8 +
 board/nvidia/dts/tegra2-seaboard.dts      |   47 ++++
 drivers/usb/host/Makefile                 |    1 +
 drivers/usb/host/ehci-hcd.c               |    7 +
 drivers/usb/host/ehci-tegra.c             |   63 +++++
 drivers/usb/host/ehci.h                   |    6 +-
 dts/Makefile                              |    2 +-
 include/asm-generic/gpio.h                |   10 +
 include/configs/seaboard.h                |   12 +
 include/configs/tegra2-common.h           |   14 +
 include/fdtdec.h                          |  109 +++++++-
Quoted 8 lines
 lib/fdtdec.c                              |  168 +++++++++++-
 21 files changed, 1320 insertions(+), 13 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/tegra2/usb.c
 create mode 100644 arch/arm/dts/skeleton.dtsi
 create mode 100644 arch/arm/dts/tegra20.dtsi
 create mode 100644 arch/arm/include/asm/arch-tegra2/usb.h
 create mode 100644 board/nvidia/dts/tegra2-seaboard.dts
 create mode 100644 drivers/usb/host/ehci-tegra.c
Quoted 3 lines

Hi,

what's the status of this patch/patchset?

Quoted 8 lines

It needs a small update to the Tegra device tree files (2 of the patches) and another change to deal with peripheral IDs (another 2 of the patches). I expect to get this done in the next few days. After that I am hoping we are done, but let's see.

Regards,
Simon

Ok, please CC me when you resubmit so I can check and apply the USB stuff. Thanks!

M