Skip to contentSkip to conversation

tegra: usb: convert USB_PORTS_MAX to be a define

PATCH New Lucas Stach 5 participants 40 messages Oct 30, 2012 – Nov 2, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/8 tegra: usb: convert USB_PORTS_MAX to be a define

No point in having this as an enum. Also while at it set it to the real hardware maximum for both Tegra 2 and Tegra 3. If new Tegra hardware includes more USB controllers we can always bump the limit then.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 4 +---

1 Datei ge?ndert, 1 Zeile hinzugef?gt(+), 3 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +1 -3
index 1bccf2b..9fd1edc 100644
@@ -43,9 +43,7 @@
 	#endif
 #endif
 
-enum {
-	USB_PORTS_MAX	= 4,			/* Maximum ports we allow */
-};
+#define USB_PORTS_MAX	3		/* Maximum ports we allow */
 
 /* Parameters we need for USB */
 enum {
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 2/8 tegra: usb: make controller init functions more self contained

There is no need to pass around all those parameters. The init functions are able to easily extract all the needed setup info on their own.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 24 ++++++++++++------------

1 Datei ge?ndert, 12 Zeilen hinzugef?gt(+), 12 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +12 -12
index 9fd1edc..1725cd1 100644
@@ -196,11 +196,12 @@ void usbf_reset_controller(struct fdt_usb *config, struct usb_ctlr *usbctlr)
 }
 
 /* set up the UTMI USB controller with the parameters provided */
-static int init_utmi_usb_controller(struct fdt_usb *config,
-				struct usb_ctlr *usbctlr, const u32 timing[])
+static int init_utmi_usb_controller(struct fdt_usb *config)
 {
 	u32 val;
 	int loop_count;
+	u32 *timing;
+	struct usb_ctlr *usbctlr = config->reg;
 
 	clock_enable(config->periph_id);
 
@@ -227,6 +228,8 @@ static int init_utmi_usb_controller(struct fdt_usb *config,
 	 * PLL Delay CONFIGURATION settings. The following parameters control
 	 * the bring up of the plls.
 	 */
+	timing = usb_pll[clock_get_osc_freq()];
+
 	val = readl(&usbctlr->utmip_misc_cfg1);
 	clrsetbits_le32(&val, UTMIP_PLLU_STABLE_COUNT_MASK,
 		timing[PARAM_STABLE_COUNT] << UTMIP_PLLU_STABLE_COUNT_SHIFT);
@@ -329,12 +332,12 @@ static int init_utmi_usb_controller(struct fdt_usb *config,
 #endif
 
 /* set up the ULPI USB controller with the parameters provided */
-static int init_ulpi_usb_controller(struct fdt_usb *config,
-				struct usb_ctlr *usbctlr)
+static int init_ulpi_usb_controller(struct fdt_usb *config)
 {
 	u32 val;
 	int loop_count;
 	struct ulpi_viewport ulpi_vp;
+	struct usb_ctlr *usbctlr = config->reg;
 
 	/* set up ULPI reference clock on pllp_out4 */
 	clock_enable(PERIPH_ID_DEV2_OUT);
@@ -406,8 +409,7 @@ static int init_ulpi_usb_controller(struct fdt_usb *config,
 	return 0;
 }
 #else
-static int init_ulpi_usb_controller(struct fdt_usb *config,
-				struct usb_ctlr *usbctlr)
+static int init_ulpi_usb_controller(struct fdt_usb *config)
 {
 	printf("No code to set up ULPI controller, please enable"
 			"CONFIG_USB_ULPI and CONFIG_USB_ULPI_VIEWPORT");
@@ -428,22 +430,20 @@ static void config_clock(const u32 timing[])
  * @param config	USB port configuration
  * @return 0 if ok, -1 if error (too many ports)
  */
-static int add_port(struct fdt_usb *config, const u32 timing[])
+static int add_port(struct fdt_usb *config)
 {
-	struct usb_ctlr *usbctlr = config->reg;
-
 	if (port_count == USB_PORTS_MAX) {
 		printf("tegrausb: Cannot register more than %d ports\n",
 		      USB_PORTS_MAX);
 		return -1;
 	}
 
-	if (config->utmi && init_utmi_usb_controller(config, usbctlr, timing)) {
+	if (config->utmi && init_utmi_usb_controller(config)) {
 		printf("tegrausb: Cannot init port\n");
 		return -1;
 	}
 
-	if (config->ulpi && init_ulpi_usb_controller(config, usbctlr)) {
+	if (config->ulpi && init_ulpi_usb_controller(config)) {
 		printf("tegrausb: Cannot init port\n");
 		return -1;
 	}
@@ -556,7 +556,7 @@ int board_usb_init(const void *blob)
 			return -1;
 		}
 
-		if (add_port(&config, usb_pll[freq]))
+		if (add_port(&config))
 			return -1;
 		set_host_mode(&config);
 	}
Signature · 1 line
1.7.11.7
#2 lore raw

PATCH 2/8 tegra: usb: make controller init functions more self contained

Hi Lucas,

Quoted 7 lines · Lucas Stach

There is no need to pass around all those parameters. The init functions are able to easily extract all the needed setup info on their own.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 24 ++++++++++++------------

1 Datei ge?ndert, 12 Zeilen hinzugef?gt(+), 12 Zeilen entfernt(-)

I'm not sure I agree with the premise of this patch.

At the top level it calls clock_get_osc_freq() to get the frequency. That is then passed to the two places that need it.

It doesn't seem right to me to call clock_get_osc_freq() again in the lower level function just to avoid a parameter. On ARM at least a few parameters are a cheap way of passing data around.

It also allows the lower-level functions to deal with what they need to, rather than all functions having to reference the global state independently, each one digging down to what it actually needs.

Regards,
Simon

#3 lore raw

PATCH 2/8 tegra: usb: make controller init functions more self contained

Hello Simon,

Am Dienstag, den 30.10.2012, 06:03 -0700 schrieb Simon Glass:

Quoted 11 lines

Hi Lucas,

Quoted 7 lines · Lucas Stach

There is no need to pass around all those parameters. The init functions are able to easily extract all the needed setup info on their own.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 24 ++++++++++++------------

1 Datei ge?ndert, 12 Zeilen hinzugef?gt(+), 12 Zeilen entfernt(-)

Quoted 9 lines

I'm not sure I agree with the premise of this patch.

At the top level it calls clock_get_osc_freq() to get the frequency. That is then passed to the two places that need it.

It doesn't seem right to me to call clock_get_osc_freq() again in the lower level function just to avoid a parameter. On ARM at least a few parameters are a cheap way of passing data around.

The intent of this patch is not really to save up on parameters passed, but to make it possible to later move out the controller initialization into the ehci_hcd_init function without having to save away this global state for later use.

We have to init at most 2 controllers where timing matters, so I think it's the right thing to get the SoC global clock state at those two occasions to avoid inflating the file global state.

Quoted 4 lines

It also allows the lower-level functions to deal with what they need to, rather than all functions having to reference the global state independently, each one digging down to what it actually needs.

The controller init functions get passed the state only of the one port they have to initialize. There is no point in extracting things at an upper level and passing it into the functions, if it's exactly the same thing that is stored in the port state.

Regards,
Lucas

#4 lore raw

PATCH 2/8 tegra: usb: make controller init functions more self contained

Hi Lucas,

Quoted 23 lines · Lucas Stach

Hello Simon,

Am Dienstag, den 30.10.2012, 06:03 -0700 schrieb Simon Glass:

Quoted 11 lines

Hi Lucas,

Quoted 7 lines · Lucas Stach

There is no need to pass around all those parameters. The init functions are able to easily extract all the needed setup info on their own.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 24 ++++++++++++------------

1 Datei ge?ndert, 12 Zeilen hinzugef?gt(+), 12 Zeilen entfernt(-)

Quoted 9 lines

I'm not sure I agree with the premise of this patch.

At the top level it calls clock_get_osc_freq() to get the frequency. That is then passed to the two places that need it.

It doesn't seem right to me to call clock_get_osc_freq() again in the lower level function just to avoid a parameter. On ARM at least a few parameters are a cheap way of passing data around.

Quoted 8 lines

The intent of this patch is not really to save up on parameters passed, but to make it possible to later move out the controller initialization into the ehci_hcd_init function without having to save away this global state for later use.

We have to init at most 2 controllers where timing matters, so I think it's the right thing to get the SoC global clock state at those two occasions to avoid inflating the file global state.

OK fair enough, I see that you want to do these two types of init at different times.

Quoted 9 lines
Quoted 5 lines

It also allows the lower-level functions to deal with what they need to, rather than all functions having to reference the global state independently, each one digging down to what it actually needs.

The controller init functions get passed the state only of the one port they have to initialize. There is no point in extracting things at an upper level and passing it into the functions, if it's exactly the same thing that is stored in the port state.

Well if the upper level is extracting it anyway, it often saves code space to pass the extracted value. I would like to avoid this sort of thing:

void do_something(struct level1 *level1)
{
struct level2 *level2 = level1->level2;
struct level3 *level3 = level2->level3;

level3->...
level3->...
}

void do_something_else(struct level1 *level1)
{
struct level2 *level2 = level1->level2;
struct level3 *level3 = level2->level3;

level3->...
level3->...
}

main()
{
do_something(level1)
do_something_else(level1)
}

I generally prefer:

void do_something(struct level3 *level3)
{
level3->...
level3->...
}

void do_something_else(struct level3 *level3)
{
level3->...
level3->...
}

main()
{
struct level2 *level2 = level1->level2;
struct level3 *level3 = level2->level3;

do_something(level3)
do_something_else(level3)
}

I hope that example makes sense.

Quoted 5 lines

Regards,
Lucas

Regards,
Simon

#5 lore raw

PATCH 3/8 tegra: usb: fold initial pll setup into board_usb_init

In reply to Lucas Stach

The setup is trivial, no need to split this out into a separate function.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 15 +++++----------

1 Datei ge?ndert, 5 Zeilen hinzugef?gt(+), 10 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +5 -10
index 1725cd1..e61bd69 100644
@@ -417,13 +417,6 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
 }
 #endif
 
-static void config_clock(const u32 timing[])
-{
-	clock_start_pll(CLOCK_ID_USB,
-		timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP],
-		timing[PARAM_CPCON], timing[PARAM_LFCON]);
-}
-
 /**
  * Add a new USB port to the list of available ports.
  *
@@ -534,13 +527,15 @@ int board_usb_init(const void *blob)
 {
 	struct fdt_usb config;
 	unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC);
-	enum clock_osc_freq freq;
 	int node_list[USB_PORTS_MAX];
 	int node, count, i;
+	u32 *timing;
 
 	/* Set up the USB clocks correctly based on our oscillator frequency */
-	freq = clock_get_osc_freq();
-	config_clock(usb_pll[freq]);
+	timing = usb_pll[clock_get_osc_freq()];
+	clock_start_pll(CLOCK_ID_USB,
+		timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP],
+		timing[PARAM_CPCON], timing[PARAM_LFCON]);
 
 	/* count may return <0 on error */
 	count = fdtdec_find_aliases_for_id(blob, "usb",
Signature · 1 line
1.7.11.7
#6 lore raw

PATCH 3/8 tegra: usb: fold initial pll setup into board_usb_init

Hi Lucas,

Quoted 31 lines · Lucas Stach

The setup is trivial, no need to split this out into a separate function.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 15 +++++----------

1 Datei ge?ndert, 5 Zeilen hinzugef?gt(+), 10 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +0 -8
index 1725cd1..e61bd69 100644
@@ -417,13 +417,6 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
 }
 #endif
 
-static void config_clock(const u32 timing[])
-{
-       clock_start_pll(CLOCK_ID_USB,
-               timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP],
-               timing[PARAM_CPCON], timing[PARAM_LFCON]);
-}
-
 /**
  * Add a new USB port to the list of available ports.
  *
@@ -534,13 +527,15 @@ int board_usb_init(const void *blob)
 {
        struct fdt_usb config;
        unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC);
-       enum clock_osc_freq freq;
        int node_list[USB_PORTS_MAX];

arch/arm/cpu/armv7/tegra20/usb.c int board_usb_init(const void *blob) · line 538

Quoted 10 lines
arch/arm/cpu/armv7/tegra20/usb.c +5 -2
        int node, count, i;
+       u32 *timing;
 
        /* Set up the USB clocks correctly based on our oscillator frequency */
-       freq = clock_get_osc_freq();
-       config_clock(usb_pll[freq]);
+       timing = usb_pll[clock_get_osc_freq()];
+       clock_start_pll(CLOCK_ID_USB,
+               timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP],
+               timing[PARAM_CPCON], timing[PARAM_LFCON]);

Sorry I don't see the benefit of this change. The function is there to handle a clearly-defined task, hiding the detail of clock config elsewhere. It has no effect on code generated.

Quoted 6 lines
arch/arm/cpu/armv7/tegra20/usb.c +0 -1
        /* count may return <0 on error */
        count = fdtdec_find_aliases_for_id(blob, "usb",
--

1.7.11.7

Regards,
Simon

#7 lore raw

PATCH 3/8 tegra: usb: fold initial pll setup into board_usb_init

Am Dienstag, den 30.10.2012, 06:23 -0700 schrieb Simon Glass:

Quoted 37 lines

Hi Lucas,

Quoted 34 lines · Lucas Stach

The setup is trivial, no need to split this out into a separate function.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 15 +++++----------

1 Datei ge?ndert, 5 Zeilen hinzugef?gt(+), 10 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +1 -8
index 1725cd1..e61bd69 100644
@@ -417,13 +417,6 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
 }
 #endif
 
-static void config_clock(const u32 timing[])
-{
-       clock_start_pll(CLOCK_ID_USB,
-               timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP],
-               timing[PARAM_CPCON], timing[PARAM_LFCON]);
-}
-
 /**
  * Add a new USB port to the list of available ports.
  *
@@ -534,13 +527,15 @@ int board_usb_init(const void *blob)
 {
        struct fdt_usb config;
        unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC);
-       enum clock_osc_freq freq;
        int node_list[USB_PORTS_MAX];
        int node, count, i;
+       u32 *timing;
 
Quoted 12 lines

arch/arm/cpu/armv7/tegra20/usb.c int board_usb_init(const void *blob) · line 538

Quoted 7 lines
arch/arm/cpu/armv7/tegra20/usb.c +4 -2
        /* Set up the USB clocks correctly based on our oscillator frequency */
-       freq = clock_get_osc_freq();
-       config_clock(usb_pll[freq]);
+       timing = usb_pll[clock_get_osc_freq()];
+       clock_start_pll(CLOCK_ID_USB,
+               timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP],
+               timing[PARAM_CPCON], timing[PARAM_LFCON]);

Sorry I don't see the benefit of this change. The function is there to handle a clearly-defined task, hiding the detail of clock config elsewhere. It has no effect on code generated.

It's more of a personal thing, that every time there is a function call it breaks the flow when reading the code. And IMHO it's not worth the break if the called function does nothing other than just calling another function.

If other people also dislike the change I may just drop it, but I would like to hear some more opinions about this first.

Regards,
Lucas

#8 lore raw

PATCH 4/8 tegra: usb: remove unneeded function parameter

In reply to Lucas Stach

Just a dead parameter, never actually used.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 6 ++----

1 Datei ge?ndert, 2 Zeilen hinzugef?gt(+), 4 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +2 -4
index e61bd69..cf800b1 100644
@@ -477,8 +477,7 @@ int tegrausb_stop_port(int portnum)
 	return 0;
 }
 
-int fdt_decode_usb(const void *blob, int node, unsigned osc_frequency_mhz,
-		   struct fdt_usb *config)
+int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config)
 {
 	const char *phy, *mode;
 
@@ -526,7 +525,6 @@ int fdt_decode_usb(const void *blob, int node, unsigned osc_frequency_mhz,
 int board_usb_init(const void *blob)
 {
 	struct fdt_usb config;
-	unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC);
 	int node_list[USB_PORTS_MAX];
 	int node, count, i;
 	u32 *timing;
@@ -545,7 +543,7 @@ int board_usb_init(const void *blob)
 		node = node_list[i];
 		if (!node)
 			continue;
-		if (fdt_decode_usb(blob, node, osc_freq, &config)) {
+		if (fdt_decode_usb(blob, node, &config)) {
 			debug("Cannot decode USB node %s\n",
 			      fdt_get_name(blob, node, NULL));
 			return -1;
Signature · 1 line
1.7.11.7
#9 lore raw

PATCH 4/8 tegra: usb: remove unneeded function parameter

Hi Lucas,

Quoted 3 lines · Lucas Stach

Just a dead parameter, never actually used.

Quoted 27 lines
---
 arch/arm/cpu/armv7/tegra20/usb.c | 6 ++----

1 Datei ge?ndert, 2 Zeilen hinzugef?gt(+), 4 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +1 -3
index e61bd69..cf800b1 100644
@@ -477,8 +477,7 @@ int tegrausb_stop_port(int portnum)
        return 0;
 }
 
-int fdt_decode_usb(const void *blob, int node, unsigned osc_frequency_mhz,
-                  struct fdt_usb *config)
+int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config)
 {
        const char *phy, *mode;
 
@@ -526,7 +525,6 @@ int fdt_decode_usb(const void *blob, int node, unsigned osc_frequency_mhz,
 int board_usb_init(const void *blob)
 {
        struct fdt_usb config;
-       unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC);
        int node_list[USB_PORTS_MAX];
        int node, count, i;
        u32 *timing;

arch/arm/cpu/armv7/tegra20/usb.c int board_usb_init(const void *blob) · line 546

Quoted 5 lines
arch/arm/cpu/armv7/tegra20/usb.c +1 -1
@@ -545,7 +543,7 @@ int board_usb_init(const void *blob)
                node = node_list[i];
                if (!node)
                        continue;
-               if (fdt_decode_usb(blob, node, osc_freq, &config)) {
+               if (fdt_decode_usb(blob, node, &config)) {

I believe there was originally some intent to put the timing data in the fdt, so that this could be different for each board. Then the fdt (most likely some common include file) might want to specify different options for the different oscillator frequencies. However we have never had to use such a construct. Even if we did then I suspect that just adding a single timing set to each port would be good enough.

Quoted 6 lines
arch/arm/cpu/armv7/tegra20/usb.c +0 -1
                        debug("Cannot decode USB node %s\n",
                              fdt_get_name(blob, node, NULL));
                        return -1;
--

1.7.11.7

Regards,
Simon

#10 lore raw

PATCH 5/8 tegra: usb: move controller init into start_port

In reply to Lucas Stach

There is no need to init a USB controller before the upper layers indicate that they are actually going to use it.

board_usb_init now only parses the device tree and sets up the common pll.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 47 +++++++++++++++-------------------------

1 Datei ge?ndert, 18 Zeilen hinzugef?gt(+), 29 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +18 -29
index cf800b1..e372b8b 100644
@@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
 }
 #endif
 
-/**
- * Add a new USB port to the list of available ports.
- *
- * @param config	USB port configuration
- * @return 0 if ok, -1 if error (too many ports)
- */
-static int add_port(struct fdt_usb *config)
+int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
 {
-	if (port_count == USB_PORTS_MAX) {
-		printf("tegrausb: Cannot register more than %d ports\n",
-		      USB_PORTS_MAX);
+	struct fdt_usb *config;
+	struct usb_ctlr *usbctlr;
+
+	if (portnum >= port_count)
 		return -1;
-	}
+
+	config = &port[portnum];
 
 	if (config->utmi && init_utmi_usb_controller(config)) {
-		printf("tegrausb: Cannot init port\n");
+		printf("tegrausb: Cannot init port %d\n", portnum);
 		return -1;
 	}
 
 	if (config->ulpi && init_ulpi_usb_controller(config)) {
-		printf("tegrausb: Cannot init port\n");
+		printf("tegrausb: Cannot init port %d\n", portnum);
 		return -1;
 	}
 
-	port[port_count++] = *config;
-
-	return 0;
-}
+	set_host_mode(config);
 
-int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
-{
-	struct usb_ctlr *usbctlr;
-
-	if (portnum >= port_count)
-		return -1;
-	set_host_mode(&port[portnum]);
-
-	usbctlr = port[portnum].reg;
+	usbctlr = config->reg;
 	*hccr = (u32)&usbctlr->cap_length;
 	*hcor = (u32)&usbctlr->usb_cmd;
 	return 0;
@@ -539,6 +524,12 @@ int board_usb_init(const void *blob)
 	count = fdtdec_find_aliases_for_id(blob, "usb",
 			COMPAT_NVIDIA_TEGRA20_USB, node_list, USB_PORTS_MAX);
 	for (i = 0; i < count; i++) {
+		if (port_count == USB_PORTS_MAX) {
+			printf("tegrausb: Cannot register more than %d ports\n",
+				USB_PORTS_MAX);
+			return -1;
+		}
+
 		debug("USB %d: ", i);
 		node = node_list[i];
 		if (!node)
@@ -549,9 +540,7 @@ int board_usb_init(const void *blob)
 			return -1;
 		}
 
-		if (add_port(&config))
-			return -1;
-		set_host_mode(&config);
+		port[port_count++] = config;
 	}
 
 	return 0;
Signature · 1 line
1.7.11.7
#11 lore raw

PATCH 5/8 tegra: usb: move controller init into start_port

Dear Lucas Stach,

Quoted 16 lines

There is no need to init a USB controller before the upper layers indicate that they are actually going to use it.

board_usb_init now only parses the device tree and sets up the common pll.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 47

+++++++++++++++------------------------- 1 Datei ge?ndert, 18 Zeilen hinzugef?gt(+), 29 Zeilen entfernt(-)

(quoted diff) +0 -0

b/arch/arm/cpu/armv7/tegra20/usb.c index cf800b1..e372b8b 100644

arch/arm/cpu/armv7/tegra20/usb.c static int init_ulpi_usb_controller(struct fdt_usb · line 426

Quoted 10 lines
arch/arm/cpu/armv7/tegra20/usb.c +0 -7
@@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb
 *config) }
 #endif
 
-/**
- * Add a new USB port to the list of available ports.
- *
- * @param config	USB port configuration
- * @return 0 if ok, -1 if error (too many ports)
- */
-static int add_port(struct fdt_usb *config)

Fix the comment instead of removing it?

[...]

Best regards,
Marek Vasut

#12 lore raw

PATCH 5/8 tegra: usb: move controller init into start_port

Hello Marek,

Am Dienstag, den 30.10.2012, 11:59 +0100 schrieb Marek Vasut:

Quoted 21 lines

Dear Lucas Stach,

Quoted 19 lines

There is no need to init a USB controller before the upper layers indicate that they are actually going to use it.

board_usb_init now only parses the device tree and sets up the common pll.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 47

+++++++++++++++------------------------- 1 Datei ge?ndert, 18 Zeilen hinzugef?gt(+), 29 Zeilen entfernt(-)

(quoted diff) +0 -0

b/arch/arm/cpu/armv7/tegra20/usb.c index cf800b1..e372b8b 100644

arch/arm/cpu/armv7/tegra20/usb.c +0 -0
@@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb
 *config) }
 #endif
 
Quoted 10 lines

arch/arm/cpu/armv7/tegra20/usb.c static int init_ulpi_usb_controller(struct fdt_usb *config) · line 426

Quoted 7 lines
arch/arm/cpu/armv7/tegra20/usb.c +0 -7
-/**
- * Add a new USB port to the list of available ports.
- *
- * @param config	USB port configuration
- * @return 0 if ok, -1 if error (too many ports)
- */
-static int add_port(struct fdt_usb *config)

Fix the comment instead of removing it?

I don't think that this comment adds any real value. The whole function which this comment refers to is removed and it's content split between board_usb_init and ehci_hcd_init, which are self explanatory.

Regards,
Lucas

#13 lore raw

PATCH 5/8 tegra: usb: move controller init into start_port

Dear Lucas Stach,

[...]

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

-static int add_port(struct fdt_usb *config)

Fix the comment instead of removing it?

I don't think that this comment adds any real value. The whole function which this comment refers to is removed and it's content split between board_usb_init and ehci_hcd_init, which are self explanatory.

Then add a proper comment please. Call me a docu-nazi, but I'd really love u- boot nicely and properly documented, please.

[1] http://www.denx.de/wiki/U-Boot/CodingStyle

Best regards,
Marek Vasut

#14 lore raw

PATCH 5/8 tegra: usb: move controller init into start_port

Hi Marek,

Am Dienstag, den 30.10.2012, 13:33 +0100 schrieb Marek Vasut:

Quoted 6 lines

Dear Lucas Stach,

[...]

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

-static int add_port(struct fdt_usb *config)

Quoted 9 lines
Quoted 5 lines
Quoted 1 line

Fix the comment instead of removing it?

I don't think that this comment adds any real value. The whole function which this comment refers to is removed and it's content split between board_usb_init and ehci_hcd_init, which are self explanatory.

Then add a proper comment please. Call me a docu-nazi, but I'd really love u- boot nicely and properly documented, please.

I'm all in favour of adding proper documentation, but I'm opposed to add it in the middle of this cleanup/movement series.

I'll send a patch on top of this series to add doc, so it doesn't interfere with the review of this series.

Regards,
Lucas

#15 lore raw

PATCH 5/8 tegra: usb: move controller init into start_port

Quoted 15 lines · Lucas Stach

Hi Marek,

Am Dienstag, den 30.10.2012, 13:33 +0100 schrieb Marek Vasut:

Quoted 12 lines

Dear Lucas Stach,

[...]

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

-static int add_port(struct fdt_usb *config)

Fix the comment instead of removing it?

I don't think that this comment adds any real value. The whole function which this comment refers to is removed and it's content split between board_usb_init and ehci_hcd_init, which are self explanatory.

Quoted 8 lines
Quoted 3 lines

Then add a proper comment please. Call me a docu-nazi, but I'd really love u- boot nicely and properly documented, please.

I'm all in favour of adding proper documentation, but I'm opposed to add it in the middle of this cleanup/movement series.

I'll send a patch on top of this series to add doc, so it doesn't interfere with the review of this series.

If the docs already exist and the function is simply changing its exact semantics, the docs should remain and simply be updated.

#16 lore raw

PATCH 5/8 tegra: usb: move controller init into start_port

In reply to Lucas Stach

Hi Lucas,

Quoted 46 lines · Lucas Stach

There is no need to init a USB controller before the upper layers indicate that they are actually going to use it.

board_usb_init now only parses the device tree and sets up the common pll.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 47 +++++++++++++++-------------------------

1 Datei ge?ndert, 18 Zeilen hinzugef?gt(+), 29 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +8 -12
index cf800b1..e372b8b 100644
@@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
 }
 #endif
 
-/**
- * Add a new USB port to the list of available ports.
- *
- * @param config       USB port configuration
- * @return 0 if ok, -1 if error (too many ports)
- */
-static int add_port(struct fdt_usb *config)
+int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
 {
-       if (port_count == USB_PORTS_MAX) {
-               printf("tegrausb: Cannot register more than %d ports\n",
-                     USB_PORTS_MAX);
+       struct fdt_usb *config;
+       struct usb_ctlr *usbctlr;
+
+       if (portnum >= port_count)
                return -1;
-       }
+
+       config = &port[portnum];
 
        if (config->utmi && init_utmi_usb_controller(config)) {
-               printf("tegrausb: Cannot init port\n");
+               printf("tegrausb: Cannot init port %d\n", portnum);
                return -1;
        }
 
        if (config->ulpi && init_ulpi_usb_controller(config)) {

arch/arm/cpu/armv7/tegra20/usb.c static int init_ulpi_usb_controller(struct fdt_usb *config) · line 440

Quoted 10 lines
arch/arm/cpu/armv7/tegra20/usb.c +2 -5
-               printf("tegrausb: Cannot init port\n");
+               printf("tegrausb: Cannot init port %d\n", portnum);
                return -1;
        }
 
-       port[port_count++] = *config;
-
-       return 0;
-}
+       set_host_mode(config);

This is good, but now I think you will re-init the USB peripheral at every 'usb start'. Perhaps you should remember whether it has been inited and only do it the first time?

Regards,
Simon

Quoted 41 lines
arch/arm/cpu/armv7/tegra20/usb.c +8 -13
-int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
-{
-       struct usb_ctlr *usbctlr;
-
-       if (portnum >= port_count)
-               return -1;
-       set_host_mode(&port[portnum]);
-
-       usbctlr = port[portnum].reg;
+       usbctlr = config->reg;
        *hccr = (u32)&usbctlr->cap_length;
        *hcor = (u32)&usbctlr->usb_cmd;
        return 0;
@@ -539,6 +524,12 @@ int board_usb_init(const void *blob)
        count = fdtdec_find_aliases_for_id(blob, "usb",
                        COMPAT_NVIDIA_TEGRA20_USB, node_list, USB_PORTS_MAX);
        for (i = 0; i < count; i++) {
+               if (port_count == USB_PORTS_MAX) {
+                       printf("tegrausb: Cannot register more than %d ports\n",
+                               USB_PORTS_MAX);
+                       return -1;
+               }
+
                debug("USB %d: ", i);
                node = node_list[i];
                if (!node)
@@ -549,9 +540,7 @@ int board_usb_init(const void *blob)
                        return -1;
                }
 
-               if (add_port(&config))
-                       return -1;
-               set_host_mode(&config);
+               port[port_count++] = config;
        }
 
        return 0;
--

1.7.11.7

#17 lore raw

PATCH 5/8 tegra: usb: move controller init into start_port

Am Dienstag, den 30.10.2012, 06:27 -0700 schrieb Simon Glass:

Quoted 54 lines

Hi Lucas,

Quoted 51 lines · Lucas Stach

There is no need to init a USB controller before the upper layers indicate that they are actually going to use it.

board_usb_init now only parses the device tree and sets up the common pll.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 47 +++++++++++++++-------------------------

1 Datei ge?ndert, 18 Zeilen hinzugef?gt(+), 29 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +9 -13
index cf800b1..e372b8b 100644
@@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
 }
 #endif
 
-/**
- * Add a new USB port to the list of available ports.
- *
- * @param config       USB port configuration
- * @return 0 if ok, -1 if error (too many ports)
- */
-static int add_port(struct fdt_usb *config)
+int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
 {
-       if (port_count == USB_PORTS_MAX) {
-               printf("tegrausb: Cannot register more than %d ports\n",
-                     USB_PORTS_MAX);
+       struct fdt_usb *config;
+       struct usb_ctlr *usbctlr;
+
+       if (portnum >= port_count)
                return -1;
-       }
+
+       config = &port[portnum];
 
        if (config->utmi && init_utmi_usb_controller(config)) {
-               printf("tegrausb: Cannot init port\n");
+               printf("tegrausb: Cannot init port %d\n", portnum);
                return -1;
        }
 
        if (config->ulpi && init_ulpi_usb_controller(config)) {
-               printf("tegrausb: Cannot init port\n");
+               printf("tegrausb: Cannot init port %d\n", portnum);
                return -1;
        }
 
Quoted 9 lines

arch/arm/cpu/armv7/tegra20/usb.c static int init_ulpi_usb_controller(struct fdt_usb *config) · line 440

Quoted 5 lines
arch/arm/cpu/armv7/tegra20/usb.c +1 -4
-       port[port_count++] = *config;
-
-       return 0;
-}
+       set_host_mode(config);

This is good, but now I think you will re-init the USB peripheral at every 'usb start'. Perhaps you should remember whether it has been inited and only do it the first time?

I have to look this up, but the upper USB layers should not call those lowlevel init functions repeatedly unless explicitly asked for it through a "usb reset" or the like. If it actually does so it's a bug in the upper layer and should not be fixed up in the lowlevel functions.

Regards,
Lucas

#18 lore raw

PATCH 5/8 tegra: usb: move controller init into start_port

Hi Lucas,

Quoted 65 lines · Lucas Stach

Am Dienstag, den 30.10.2012, 06:27 -0700 schrieb Simon Glass:

Quoted 54 lines

Hi Lucas,

Quoted 51 lines · Lucas Stach

There is no need to init a USB controller before the upper layers indicate that they are actually going to use it.

board_usb_init now only parses the device tree and sets up the common pll.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 47 +++++++++++++++-------------------------

1 Datei ge?ndert, 18 Zeilen hinzugef?gt(+), 29 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +9 -13
index cf800b1..e372b8b 100644
@@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
 }
 #endif
 
-/**
- * Add a new USB port to the list of available ports.
- *
- * @param config       USB port configuration
- * @return 0 if ok, -1 if error (too many ports)
- */
-static int add_port(struct fdt_usb *config)
+int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
 {
-       if (port_count == USB_PORTS_MAX) {
-               printf("tegrausb: Cannot register more than %d ports\n",
-                     USB_PORTS_MAX);
+       struct fdt_usb *config;
+       struct usb_ctlr *usbctlr;
+
+       if (portnum >= port_count)
                return -1;
-       }
+
+       config = &port[portnum];
 
        if (config->utmi && init_utmi_usb_controller(config)) {
-               printf("tegrausb: Cannot init port\n");
+               printf("tegrausb: Cannot init port %d\n", portnum);
                return -1;
        }
 
        if (config->ulpi && init_ulpi_usb_controller(config)) {
-               printf("tegrausb: Cannot init port\n");
+               printf("tegrausb: Cannot init port %d\n", portnum);
                return -1;
        }
 
Quoted 9 lines

arch/arm/cpu/armv7/tegra20/usb.c static int init_ulpi_usb_controller(struct fdt_usb *config) · line 440

Quoted 5 lines
arch/arm/cpu/armv7/tegra20/usb.c +1 -4
-       port[port_count++] = *config;
-
-       return 0;
-}
+       set_host_mode(config);

This is good, but now I think you will re-init the USB peripheral at every 'usb start'. Perhaps you should remember whether it has been inited and only do it the first time?

Quoted 4 lines

I have to look this up, but the upper USB layers should not call those lowlevel init functions repeatedly unless explicitly asked for it through a "usb reset" or the like. If it actually does so it's a bug in the upper layer and should not be fixed up in the lowlevel functions.

Perhaps, but you have to write your code in the environment that exists. At present usb_lowlevel_init() is called on every 'usb start' (and ehci_hcd_init() from that).

Regards,
Simon

Quoted 5 lines

Regards,
Lucas

#19 lore raw

PATCH 5/8 tegra: usb: move controller init into start_port

Am Dienstag, den 30.10.2012, 06:48 -0700 schrieb Simon Glass:

Quoted 68 lines

Hi Lucas,

Quoted 65 lines · Lucas Stach

Am Dienstag, den 30.10.2012, 06:27 -0700 schrieb Simon Glass:

Quoted 63 lines

Hi Lucas,

Quoted 46 lines · Lucas Stach

There is no need to init a USB controller before the upper layers indicate that they are actually going to use it.

board_usb_init now only parses the device tree and sets up the common pll.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 47 +++++++++++++++-------------------------

1 Datei ge?ndert, 18 Zeilen hinzugef?gt(+), 29 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +8 -12
index cf800b1..e372b8b 100644
@@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
 }
 #endif
 
-/**
- * Add a new USB port to the list of available ports.
- *
- * @param config       USB port configuration
- * @return 0 if ok, -1 if error (too many ports)
- */
-static int add_port(struct fdt_usb *config)
+int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
 {
-       if (port_count == USB_PORTS_MAX) {
-               printf("tegrausb: Cannot register more than %d ports\n",
-                     USB_PORTS_MAX);
+       struct fdt_usb *config;
+       struct usb_ctlr *usbctlr;
+
+       if (portnum >= port_count)
                return -1;
-       }
+
+       config = &port[portnum];
 
        if (config->utmi && init_utmi_usb_controller(config)) {
-               printf("tegrausb: Cannot init port\n");
+               printf("tegrausb: Cannot init port %d\n", portnum);
                return -1;
        }
 
        if (config->ulpi && init_ulpi_usb_controller(config)) {

arch/arm/cpu/armv7/tegra20/usb.c static int init_ulpi_usb_controller(struct fdt_usb *config) · line 440

Quoted 10 lines
arch/arm/cpu/armv7/tegra20/usb.c +2 -5
-               printf("tegrausb: Cannot init port\n");
+               printf("tegrausb: Cannot init port %d\n", portnum);
                return -1;
        }
 
-       port[port_count++] = *config;
-
-       return 0;
-}
+       set_host_mode(config);

This is good, but now I think you will re-init the USB peripheral at every 'usb start'. Perhaps you should remember whether it has been inited and only do it the first time?

Quoted 9 lines
Quoted 4 lines

I have to look this up, but the upper USB layers should not call those lowlevel init functions repeatedly unless explicitly asked for it through a "usb reset" or the like. If it actually does so it's a bug in the upper layer and should not be fixed up in the lowlevel functions.

Perhaps, but you have to write your code in the environment that exists. At present usb_lowlevel_init() is called on every 'usb start' (and ehci_hcd_init() from that).

After all this is open source and I would rather spin a patch to fix this at the right spot if we do the wrong thing, than having to cope with the bug at a lower level. Even with bug present we are not failing in any severe way, we are just wasting time bringing up a controller which is already up.

Regards,
Lucas

#20 lore raw

PATCH 5/8 tegra: usb: move controller init into start_port

Hi Lucas,

Quoted 78 lines · Lucas Stach

Am Dienstag, den 30.10.2012, 06:48 -0700 schrieb Simon Glass:

Quoted 68 lines

Hi Lucas,

Quoted 65 lines · Lucas Stach

Am Dienstag, den 30.10.2012, 06:27 -0700 schrieb Simon Glass:

Quoted 63 lines

Hi Lucas,

Quoted 46 lines · Lucas Stach

There is no need to init a USB controller before the upper layers indicate that they are actually going to use it.

board_usb_init now only parses the device tree and sets up the common pll.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 47 +++++++++++++++-------------------------

1 Datei ge?ndert, 18 Zeilen hinzugef?gt(+), 29 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +8 -12
index cf800b1..e372b8b 100644
@@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
 }
 #endif
 
-/**
- * Add a new USB port to the list of available ports.
- *
- * @param config       USB port configuration
- * @return 0 if ok, -1 if error (too many ports)
- */
-static int add_port(struct fdt_usb *config)
+int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
 {
-       if (port_count == USB_PORTS_MAX) {
-               printf("tegrausb: Cannot register more than %d ports\n",
-                     USB_PORTS_MAX);
+       struct fdt_usb *config;
+       struct usb_ctlr *usbctlr;
+
+       if (portnum >= port_count)
                return -1;
-       }
+
+       config = &port[portnum];
 
        if (config->utmi && init_utmi_usb_controller(config)) {
-               printf("tegrausb: Cannot init port\n");
+               printf("tegrausb: Cannot init port %d\n", portnum);
                return -1;
        }
 
        if (config->ulpi && init_ulpi_usb_controller(config)) {

arch/arm/cpu/armv7/tegra20/usb.c static int init_ulpi_usb_controller(struct fdt_usb *config) · line 440

Quoted 10 lines
arch/arm/cpu/armv7/tegra20/usb.c +2 -5
-               printf("tegrausb: Cannot init port\n");
+               printf("tegrausb: Cannot init port %d\n", portnum);
                return -1;
        }
 
-       port[port_count++] = *config;
-
-       return 0;
-}
+       set_host_mode(config);

This is good, but now I think you will re-init the USB peripheral at every 'usb start'. Perhaps you should remember whether it has been inited and only do it the first time?

Quoted 9 lines
Quoted 4 lines

I have to look this up, but the upper USB layers should not call those lowlevel init functions repeatedly unless explicitly asked for it through a "usb reset" or the like. If it actually does so it's a bug in the upper layer and should not be fixed up in the lowlevel functions.

Perhaps, but you have to write your code in the environment that exists. At present usb_lowlevel_init() is called on every 'usb start' (and ehci_hcd_init() from that).

Quoted 6 lines

After all this is open source and I would rather spin a patch to fix this at the right spot if we do the wrong thing, than having to cope with the bug at a lower level. Even with bug present we are not failing in any severe way, we are just wasting time bringing up a controller which is already up.

OK, but perhaps my broader point is that this may in fact be the intended behaviour of U-Boot. Until you bring this up and submit a patch to change it, you may not know. I would suggest you change the patch order here - first send a patch making usb_lowlevel_init() work the way you want, then a patch to change Tegra to init each time usb_lowlevel_init() is called.

I'm not sure about the time penalty - I suspect it is small - but why have any such penalty? Boot time is a key concern (at least for me!). Plus re-init of already-inited hardware can be problematic.

Or you could fix this for now by remembering what is inited and not doing it again - just another flag in struct fdt_usb. It is good that you don't init USB until needed, and that would solve the problem in the interim, until you get usb_lowlevel_init() changed. Ultimately with the device model we may be able to go further and not even do the fdt decode until needed.

Regards,
Simon

Quoted 3 lines

Regards,
Lucas

#21 lore raw

PATCH 6/8 tegra: usb: various small cleanups

In reply to Lucas Stach

Remove unneeded headers, function prototype and stale comment.

---
 arch/arm/cpu/armv7/tegra20/usb.c        | 13 +------------
 arch/arm/include/asm/arch-tegra20/usb.h |  3 ---

2 Dateien ge?ndert, 1 Zeile hinzugef?gt(+), 15 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +1 -12
index e372b8b..2cc95d2 100644
@@ -25,21 +25,15 @@
 #include <asm/io.h>
 #include <asm-generic/gpio.h>
 #include <asm/arch/clock.h>
-#include <asm/arch/gpio.h>
-#include <asm/arch/pinmux.h>
-#include <asm/arch/tegra.h>
 #include <asm/arch/usb.h>
 #include <usb/ulpi.h>
-#include <asm/arch-tegra/clk_rst.h>
-#include <asm/arch-tegra/sys_proto.h>
-#include <asm/arch-tegra/uart.h>
 #include <libfdt.h>
 #include <fdtdec.h>
 
 #ifdef CONFIG_USB_ULPI
 	#ifndef CONFIG_USB_ULPI_VIEWPORT
 	#error	"To use CONFIG_USB_ULPI on Tegra Boards you have to also \
-			define CONFIG_USB_ULPI_VIEWPORT"
+		define CONFIG_USB_ULPI_VIEWPORT"
 	#endif
 #endif
 
@@ -188,11 +182,6 @@ void usbf_reset_controller(struct fdt_usb *config, struct usb_ctlr *usbctlr)
 	/* Enable the UTMIP PHY */
 	if (config->utmi)
 		setbits_le32(&usbctlr->susp_ctrl, UTMIP_PHY_ENB);
-
-	/*
-	 * TODO: where do we take the USB1 out of reset? The old code would
-	 * take USB3 out of reset, but not USB1. This code doesn't do either.
-	 */
 }
 
 /* set up the UTMI USB controller with the parameters provided */
arch/arm/include/asm/arch-tegra20/usb.h +0 -3
index fdbd127..b18c850 100644
@@ -243,9 +243,6 @@ struct usb_ctlr {
 #define VBUS_VLD_STS			(1 << 26)
 
 
-/* Change the USB host port into host mode */
-void usb_set_host_mode(void);
-
 /* Setup USB on the board */
 int board_usb_init(const void *blob);
 
Signature · 1 line
1.7.11.7
#22 lore raw

PATCH 6/8 tegra: usb: various small cleanups

Hi Lucas,

Quoted 36 lines · Lucas Stach

Remove unneeded headers, function prototype and stale comment.

---
 arch/arm/cpu/armv7/tegra20/usb.c        | 13 +------------
 arch/arm/include/asm/arch-tegra20/usb.h |  3 ---

2 Dateien ge?ndert, 1 Zeile hinzugef?gt(+), 15 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +1 -7
index e372b8b..2cc95d2 100644
@@ -25,21 +25,15 @@
 #include <asm/io.h>
 #include <asm-generic/gpio.h>
 #include <asm/arch/clock.h>
-#include <asm/arch/gpio.h>
-#include <asm/arch/pinmux.h>
-#include <asm/arch/tegra.h>
 #include <asm/arch/usb.h>
 #include <usb/ulpi.h>
-#include <asm/arch-tegra/clk_rst.h>
-#include <asm/arch-tegra/sys_proto.h>
-#include <asm/arch-tegra/uart.h>
 #include <libfdt.h>
 #include <fdtdec.h>
 
 #ifdef CONFIG_USB_ULPI
        #ifndef CONFIG_USB_ULPI_VIEWPORT
        #error  "To use CONFIG_USB_ULPI on Tegra Boards you have to also \
-                       define CONFIG_USB_ULPI_VIEWPORT"
+               define CONFIG_USB_ULPI_VIEWPORT"
        #endif
 #endif
 

arch/arm/cpu/armv7/tegra20/usb.c void usbf_reset_controller(struct fdt_usb *config, struct usb_ctlr *usbctlr) · line 195

Quoted 8 lines
arch/arm/cpu/armv7/tegra20/usb.c +0 -5
@@ -188,11 +182,6 @@ void usbf_reset_controller(struct fdt_usb *config, struct usb_ctlr *usbctlr)
        /* Enable the UTMIP PHY */
        if (config->utmi)
                setbits_le32(&usbctlr->susp_ctrl, UTMIP_PHY_ENB);
-
-       /*
-        * TODO: where do we take the USB1 out of reset? The old code would
-        * take USB3 out of reset, but not USB1. This code doesn't do either.
-        */

How did this get resolved?

Quoted 8 lines
arch/arm/cpu/armv7/tegra20/usb.c +0 -0
 }
 
 /* set up the UTMI USB controller with the parameters provided */
arch/arm/include/asm/arch-tegra20/usb.h +0 -0
index fdbd127..b18c850 100644

arch/arm/include/asm/arch-tegra20/usb.h struct usb_ctlr { · line 248

Quoted 6 lines
arch/arm/include/asm/arch-tegra20/usb.h +0 -3
@@ -243,9 +243,6 @@ struct usb_ctlr {
 #define VBUS_VLD_STS                   (1 << 26)
 
 
-/* Change the USB host port into host mode */
-void usb_set_host_mode(void);
-

Everything else looks good.

Quoted 6 lines
arch/arm/include/asm/arch-tegra20/usb.h +0 -1
 /* Setup USB on the board */
 int board_usb_init(const void *blob);
 
--

1.7.11.7

Regards,
Simon

#23 lore raw

PATCH 7/8 tegra: usb: move implementation into right directory

In reply to Lucas Stach

This moves the Tegra USB implementation into the drivers/usb/host directory.

---
 arch/arm/cpu/armv7/tegra20/Makefile                |  2 -
 .../tegra20/usb.c => drivers/usb/host/ehci-tegra.c | 60 ++++++++++++++++++++--
 2 Dateien ge?ndert, 55 Zeilen hinzugef?gt(+), 7 Zeilen entfernt(-)
 rename arch/arm/cpu/armv7/tegra20/usb.c => drivers/usb/host/ehci-tegra.c (92%)
arch/arm/cpu/armv7/tegra20/Makefile +0 -2
index 09a0314..2c4d5c9 100644
@@ -27,8 +27,6 @@ include $(TOPDIR)/config.mk
 
 LIB	=  $(obj)lib$(SOC).o
 
-COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o
-
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
drivers/usb/host/ehci-tegra.c renamed from arch/arm/cpu/armv7/tegra20/usb.c +55 -5

84 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#24 lore raw

PATCH 7/8 tegra: usb: move implementation into right directory

Hi Lucas,

Quoted 9 lines · Lucas Stach

This moves the Tegra USB implementation into the drivers/usb/host directory.

---
 arch/arm/cpu/armv7/tegra20/Makefile                |  2 -
 .../tegra20/usb.c => drivers/usb/host/ehci-tegra.c | 60 ++++++++++++++++++++--
 2 Dateien ge?ndert, 55 Zeilen hinzugef?gt(+), 7 Zeilen entfernt(-)
 rename arch/arm/cpu/armv7/tegra20/usb.c => drivers/usb/host/ehci-tegra.c (92%)

For me this patch did not apply:

Applying: tegra: usb: move implementation into right directory
error: drivers/usb/host/ehci-tegra.c: already exists in index Patch failed at 0007 tegra: usb: move implementation into right directory When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".

I tried master and tegra/master.

Regards,
Simon

#25 lore raw

PATCH 7/8 tegra: usb: move implementation into right directory

Am Dienstag, den 30.10.2012, 06:33 -0700 schrieb Simon Glass:

Quoted 15 lines

Hi Lucas,

Quoted 9 lines · Lucas Stach

This moves the Tegra USB implementation into the drivers/usb/host directory.

---
 arch/arm/cpu/armv7/tegra20/Makefile                |  2 -
 .../tegra20/usb.c => drivers/usb/host/ehci-tegra.c | 60 ++++++++++++++++++++--
 2 Dateien ge?ndert, 55 Zeilen hinzugef?gt(+), 7 Zeilen entfernt(-)
 rename arch/arm/cpu/armv7/tegra20/usb.c => drivers/usb/host/ehci-tegra.c (92%)

For me this patch did not apply:

Quoted 8 lines

Applying: tegra: usb: move implementation into right directory
error: drivers/usb/host/ehci-tegra.c: already exists in index Patch failed at 0007 tegra: usb: move implementation into right directory When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".

I tried master and tegra/master.

The series based on u-boot-usb/master, as it's supposed to go in through this tree.

Regards,
Lucas

#26 lore raw

PATCH 7/8 tegra: usb: move implementation into right directory

Hi Lucas,

Quoted 23 lines · Lucas Stach

Am Dienstag, den 30.10.2012, 06:33 -0700 schrieb Simon Glass:

Quoted 22 lines

Hi Lucas,

Quoted 9 lines · Lucas Stach

This moves the Tegra USB implementation into the drivers/usb/host directory.

---
 arch/arm/cpu/armv7/tegra20/Makefile                |  2 -
 .../tegra20/usb.c => drivers/usb/host/ehci-tegra.c | 60 ++++++++++++++++++++--
 2 Dateien ge?ndert, 55 Zeilen hinzugef?gt(+), 7 Zeilen entfernt(-)
 rename arch/arm/cpu/armv7/tegra20/usb.c => drivers/usb/host/ehci-tegra.c (92%)

For me this patch did not apply:

Applying: tegra: usb: move implementation into right directory
error: drivers/usb/host/ehci-tegra.c: already exists in index Patch failed at 0007 tegra: usb: move implementation into right directory When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".

Quoted 4 lines
Quoted 1 line

I tried master and tegra/master.

The series based on u-boot-usb/master, as it's supposed to go in through this tree.

OK thanks, I assumed that because tegra: was the first tag it would go through tegra.

But it doesn't seem to help:

git remote -v |grep upstream-usb
upstream-usb http://git.denx.de/u-boot-usb.git (fetch)
upstream-usb http://git.denx.de/u-boot-usb.git (push)
git fetch upstream-usb

#27 lore raw

PATCH 7/8 tegra: usb: move implementation into right directory

Am Dienstag, den 30.10.2012, 06:53 -0700 schrieb Simon Glass:

Quoted 66 lines

Hi Lucas,

Quoted 23 lines · Lucas Stach

Am Dienstag, den 30.10.2012, 06:33 -0700 schrieb Simon Glass:

Quoted 22 lines

Hi Lucas,

Quoted 9 lines · Lucas Stach

This moves the Tegra USB implementation into the drivers/usb/host directory.

---
 arch/arm/cpu/armv7/tegra20/Makefile                |  2 -
 .../tegra20/usb.c => drivers/usb/host/ehci-tegra.c | 60 ++++++++++++++++++++--
 2 Dateien ge?ndert, 55 Zeilen hinzugef?gt(+), 7 Zeilen entfernt(-)
 rename arch/arm/cpu/armv7/tegra20/usb.c => drivers/usb/host/ehci-tegra.c (92%)

For me this patch did not apply:

Applying: tegra: usb: move implementation into right directory
error: drivers/usb/host/ehci-tegra.c: already exists in index Patch failed at 0007 tegra: usb: move implementation into right directory When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".

Quoted 4 lines
Quoted 1 line

I tried master and tegra/master.

The series based on u-boot-usb/master, as it's supposed to go in through this tree.

OK thanks, I assumed that because tegra: was the first tag it would go through tegra.

But it doesn't seem to help:

git remote -v |grep upstream-usb
upstream-usb http://git.denx.de/u-boot-usb.git (fetch)
upstream-usb http://git.denx.de/u-boot-usb.git (push)
git fetch upstream-usb

Quoted 1 line

From http://git.denx.de/u-boot-usb

* [new branch] at91sam9x35-ek -> upstream-usb/at91sam9x35-ek
+ 5b2e031...0b92a45 cdc-at91 -> upstream-usb/cdc-at91 (forced update)
+ 6722fd5...76454b2 master -> upstream-usb/master (forced update)
* [new branch] merge_pending -> upstream-usb/merge_pending
+ 2c8b43b...01afc4f next -> upstream-usb/next (forced update)
* [new branch] uboot -> upstream-usb/uboot
(try-usb=5cf309: include/ lq out/ tools/ x/) ~/u> co -b try-usb2 upstream-usb/master
Branch try-usb2 set up to track remote branch master from upstream-usb. Switched to a new branch 'try-usb2'
(try-usb2=76454b: include/ lq out/ tools/ x/) ~/u> git am ~/Downloads/bundle-3480.mbox
Applying: tegra: usb: convert USB_PORTS_MAX to be a define
Applying: tegra: usb: make controller init functions more self contained
Applying: tegra: usb: fold initial pll setup into board_usb_init
Applying: tegra: usb: remove unneeded function parameter
Applying: tegra: usb: move controller init into start_port
Applying: tegra: usb: various small cleanups
Applying: tegra: usb: move implementation into right directory
error: drivers/usb/host/ehci-tegra.c: already exists in index Patch failed at 0007 tegra: usb: move implementation into right directory When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".

Quoted 2 lines

Where was the patch that removed drivers/usb/host/ehci-tegra.c?

Hm I'm no expert here, but I didn't actually remove the file. I just copied over the contents of the old implementation file and both git commit and git format-patch recognized this as a rename. Also the cherry-pick from my devel to the usb branch worked flawlessly. If git am can't cope with the rename to an already existing file I may post the patch with the rename forcibly removed, but this will yield a much bigger patch. I'll investigate this.

Thanks for the heads up.

Regards,
Lucas

#28 lore raw

PATCH 7/8 tegra: usb: move implementation into right directory

In reply to Simon Glass

Simon, et al,

Quoted 25 lines

-----Original Message-----
From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
Sent: Tuesday, October 30, 2012 6:34 AM
To: Lucas Stach
Cc: Marek Vasut; u-boot at lists.denx.de; Stephen Warren; Tom Warren
Subject: Re: [PATCH 7/8] tegra: usb: move implementation into right directory

Hi Lucas,

Quoted 11 lines · Lucas Stach

This moves the Tegra USB implementation into the drivers/usb/host directory.

---
 arch/arm/cpu/armv7/tegra20/Makefile                |  2 -
 .../tegra20/usb.c => drivers/usb/host/ehci-tegra.c | 60

++++++++++++++++++++--
2 Dateien ge?ndert, 55 Zeilen hinzugef?gt(+), 7 Zeilen entfernt(-)
rename arch/arm/cpu/armv7/tegra20/usb.c => drivers/usb/host/ehci-tegra.c (92%)

For me this patch did not apply:

Quoted 8 lines

Applying: tegra: usb: move implementation into right directory
error: drivers/usb/host/ehci-tegra.c: already exists in index Patch failed at 0007 tegra: usb: move implementation into right directory When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".

I tried master and tegra/master.

Please apply/develop all Tegra patches on tegra/next. That's where I'll be applying new patches as they come in. /master is usually behind /next until a pull request occurs (which just happens to be what the state is now, so master == next, but that's not the norm).

Thanks,

Tom

Quoted 3 lines

Regards,
Simon

Signature · 1 line
nvpublic
#29 lore raw

PATCH 7/8 tegra: usb: move implementation into right directory

Hi Tom,

Quoted 1 line · Tom Warren

Simon, et al,

[snip]

Quoted 1 line

Please apply/develop all Tegra patches on tegra/next. That's where I'll be applying new patches as they come in. /master is usually behind /next until a pull request occurs (which just happens to be what the state is now, so master == next, but that's not the norm).

OK thanks for the clarification. I was tending towards that, but had sometimes found next was old, if that makes any sense. Will do from now on.

The LCD series applied on top of tegra/next for me without trouble.

Regards,
Simon

Quoted 10 lines

Thanks,

Tom

Quoted 3 lines

Regards,
Simon

--
nvpublic

#30 lore raw

PATCH 7/8 tegra: usb: move implementation into right directory

In reply to Lucas Stach

drivers/usb/host/ehci-tegra.c line 3

Quoted 8 lines · Lucas Stach

This moves the Tegra USB implementation into the drivers/usb/host directory.

drivers/usb/host/ehci-tegra.c renamed from arch/arm/cpu/armv7/tegra20/usb.c +1 -1
 
+ * Copyright (c) 2009-2012 NVIDIA Corporation
  * Copyright (c) 2011 The Chromium OS Authors.
- * (C) Copyright 2010,2011 NVIDIA Corporation <www.nvidia.com>

Why does NVIDIA's (c) notice change?

#31 lore raw

PATCH 7/8 tegra: usb: move implementation into right directory

Am Dienstag, den 30.10.2012, 12:38 -0600 schrieb Stephen Warren:

Quoted 12 lines · Lucas Stach

drivers/usb/host/ehci-tegra.c line 3

Quoted 8 lines

This moves the Tegra USB implementation into the drivers/usb/host directory.

drivers/usb/host/ehci-tegra.c renamed from arch/arm/cpu/armv7/tegra20/usb.c +1 -1
 
+ * Copyright (c) 2009-2012 NVIDIA Corporation
  * Copyright (c) 2011 The Chromium OS Authors.
- * (C) Copyright 2010,2011 NVIDIA Corporation <www.nvidia.com>

Why does NVIDIA's (c) notice change?

Just because I took most of the licence header from the ehci_tegra.c file, but as the patch shows the the diff modulo the copied part it looks like a change. I choose this one as it actually spans the longer copyright timeframe of the both licence headers. Is this a problem? Should I also include the web address?

Regards,
Lucas

#32 lore raw

PATCH 7/8 tegra: usb: move implementation into right directory

Quoted 11 lines · Lucas Stach

Am Dienstag, den 30.10.2012, 12:38 -0600 schrieb Stephen Warren:

Quoted 10 lines · Lucas Stach
Quoted 8 lines

This moves the Tegra USB implementation into the drivers/usb/host directory.

drivers/usb/host/ehci-tegra.c renamed from arch/arm/cpu/armv7/tegra20/usb.c +1 -1
 
+ * Copyright (c) 2009-2012 NVIDIA Corporation
  * Copyright (c) 2011 The Chromium OS Authors.
- * (C) Copyright 2010,2011 NVIDIA Corporation <www.nvidia.com>
Quoted 7 lines
Quoted 2 lines

Why does NVIDIA's (c) notice change?

Just because I took most of the licence header from the ehci_tegra.c file, but as the patch shows the the diff modulo the copied part it looks like a change. I choose this one as it actually spans the longer copyright timeframe of the both licence headers. Is this a problem? Should I also include the web address?

Hmm. So this patch merges two files together into one? The diff looks like it's creating a new file. If the new content in this patch came from some other file, shouldn't the patch also remove it from the old file? That would make the (c) header change more obvious.

#33 lore raw

PATCH 7/8 tegra: usb: move implementation into right directory

Am Dienstag, den 30.10.2012, 12:51 -0600 schrieb Stephen Warren:

Quoted 20 lines · Lucas Stach
Quoted 11 lines

Am Dienstag, den 30.10.2012, 12:38 -0600 schrieb Stephen Warren:

Quoted 10 lines · Lucas Stach
Quoted 8 lines

This moves the Tegra USB implementation into the drivers/usb/host directory.

drivers/usb/host/ehci-tegra.c renamed from arch/arm/cpu/armv7/tegra20/usb.c +1 -1
 
+ * Copyright (c) 2009-2012 NVIDIA Corporation
  * Copyright (c) 2011 The Chromium OS Authors.
- * (C) Copyright 2010,2011 NVIDIA Corporation <www.nvidia.com>
Quoted 7 lines
Quoted 2 lines

Why does NVIDIA's (c) notice change?

Just because I took most of the licence header from the ehci_tegra.c file, but as the patch shows the the diff modulo the copied part it looks like a change. I choose this one as it actually spans the longer copyright timeframe of the both licence headers. Is this a problem? Should I also include the web address?

Quoted 5 lines

Hmm. So this patch merges two files together into one? The diff looks like it's creating a new file. If the new content in this patch came from some other file, shouldn't the patch also remove it from the old file? That would make the (c) header change more obvious.

Hm, the rename presentation of this patch seems to cause major confusion. Yes, this patch merges the Tegra usb implementation into the pre-existing ehci_tegra.c file, which before this change did not much more than to call into the Tegra SoC usb implementation. As the Tegra usb implementation is not really SoC specific, but rather controller specific this should really move over.

I will send this patch in the usual remove-add presentation for a V2 of the series, as it even seems to confuse git right now.

Regards,
Lucas

#34 lore raw

PATCH 8/8 tegra: usb: move [start|stop]_port into ehci_hcd_[init|stop]

In reply to Lucas Stach

The ehci_hcd entry points were just calling into the Tegra USB functions. Now that they are in the same file we can just move over the implementation.

---
 arch/arm/include/asm/arch-tegra20/usb.h | 19 -------
 drivers/usb/host/ehci-tegra.c           | 93 +++++++++++++--------------------

2 Dateien ge?ndert, 35 Zeilen hinzugef?gt(+), 77 Zeilen entfernt(-)

arch/arm/include/asm/arch-tegra20/usb.h +0 -19
index b18c850..ef6c089 100644
@@ -246,23 +246,4 @@ struct usb_ctlr {
 /* Setup USB on the board */
 int board_usb_init(const void *blob);
 
-/**
- * Start up the given port number (ports are numbered from 0 on each board).
- * This returns values for the appropriate hccr and hcor addresses to use for
- * USB EHCI operations.
- *
- * @param portnum	port number to start
- * @param hccr		returns start address of EHCI HCCR registers
- * @param hcor		returns start address of EHCI HCOR registers
- * @return 0 if ok, -1 on error (generally invalid port number)
- */
-int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor);
-
-/**
- * Stop the current port
- *
- * @return 0 if ok, -1 if no port was active
- */
-int tegrausb_stop_port(int portnum);
-
 #endif	/* _TEGRA_USB_H_ */
drivers/usb/host/ehci-tegra.c +35 -58

117 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#35 lore raw

PATCH 8/8 tegra: usb: move [start|stop]_port into ehci_hcd_[init|stop]

Hi,

Quoted 3 lines · Lucas Stach

The ehci_hcd entry points were just calling into the Tegra USB functions. Now that they are in the same file we can just move over the implementation.

Seems reasonable - the original approach was to put SOC-specific code into arch/arm/cpu/armv7/tegra.., but I don't see any particular benefit to that, and it could in fact get quite unwieldy. Since Tegra2 and Tegra3 both use the same USB it doesn't really matter anwyay.

Quoted 14 lines
---
 arch/arm/include/asm/arch-tegra20/usb.h | 19 -------
 drivers/usb/host/ehci-tegra.c           | 93 +++++++++++++--------------------

2 Dateien ge?ndert, 35 Zeilen hinzugef?gt(+), 77 Zeilen entfernt(-)

arch/arm/include/asm/arch-tegra20/usb.h +0 -0
index b18c850..ef6c089 100644
@@ -246,23 +246,4 @@ struct usb_ctlr {
 /* Setup USB on the board */
 int board_usb_init(const void *blob);
 

arch/arm/include/asm/arch-tegra20/usb.h struct usb_ctlr { · line 258

Quoted 10 lines
arch/arm/include/asm/arch-tegra20/usb.h +0 -10
-/**
- * Start up the given port number (ports are numbered from 0 on each board).
- * This returns values for the appropriate hccr and hcor addresses to use for
- * USB EHCI operations.
- *
- * @param portnum      port number to start
- * @param hccr         returns start address of EHCI HCCR registers
- * @param hcor         returns start address of EHCI HCOR registers
- * @return 0 if ok, -1 on error (generally invalid port number)
- */

But please can we keep this nice comment? I really don't like uncommented functions.

[snip]

Regards,
Simon

#36 lore raw

PATCH 1/8 tegra: usb: convert USB_PORTS_MAX to be a define

In reply to Lucas Stach

Hi Lucas,

Quoted 14 lines · Lucas Stach

No point in having this as an enum. Also while at it set it to the real hardware maximum for both Tegra 2 and Tegra 3. If new Tegra hardware includes more USB controllers we can always bump the limit then.

---
 arch/arm/cpu/armv7/tegra20/usb.c | 4 +---

1 Datei ge?ndert, 1 Zeile hinzugef?gt(+), 3 Zeilen entfernt(-)

arch/arm/cpu/armv7/tegra20/usb.c +0 -0
index 1bccf2b..9fd1edc 100644

arch/arm/cpu/armv7/tegra20/usb.c line 46

Quoted 7 lines
arch/arm/cpu/armv7/tegra20/usb.c +1 -3
@@ -43,9 +43,7 @@
        #endif
 #endif
 
-enum {
-       USB_PORTS_MAX   = 4,                    /* Maximum ports we allow */
-};
+#define USB_PORTS_MAX  3               /* Maximum ports we allow */

That's fine with me if you wan to change it.

I tend to use enums most of the time. It shows up as a symbol in the debugger, avoids bracketed expressions, side-effects and the like, and works well when numbering multiple things (automatic increment). It's also a welcome language feature IMO - use it or lose it :-) But in this case the benefit is small.

Quoted 6 lines
arch/arm/cpu/armv7/tegra20/usb.c +0 -1
 /* Parameters we need for USB */
 enum {
--

1.7.11.7

Regards,
Simon

#37 lore raw

PATCH 1/8 tegra: usb: convert USB_PORTS_MAX to be a define

Dear Simon Glass,

Quoted 30 lines

Hi Lucas,

Quoted 15 lines · Lucas Stach

No point in having this as an enum. Also while at it set it to the real hardware maximum for both Tegra 2 and Tegra 3. If new Tegra hardware includes more USB controllers we can always bump the limit then.

---

 arch/arm/cpu/armv7/tegra20/usb.c | 4 +---

1 Datei ge?ndert, 1 Zeile hinzugef?gt(+), 3 Zeilen entfernt(-)

(quoted diff) +0 -0

b/arch/arm/cpu/armv7/tegra20/usb.c index 1bccf2b..9fd1edc 100644

arch/arm/cpu/armv7/tegra20/usb.c line 49

Quoted 9 lines
arch/arm/cpu/armv7/tegra20/usb.c +1 -2
@@ -43,9 +43,7 @@
 
        #endif
 
 #endif
 
-enum {
-       USB_PORTS_MAX   = 4,                    /* Maximum ports we allow
 */ -};
+#define USB_PORTS_MAX  3               /* Maximum ports we allow */

That's fine with me if you wan to change it.

Quoted 5 lines

I tend to use enums most of the time. It shows up as a symbol in the debugger, avoids bracketed expressions, side-effects and the like, and works well when numbering multiple things (automatic increment). It's also a welcome language feature IMO - use it or lose it :-) But in this case the benefit is small.

What about using static const int ?

Quoted 8 lines
Quoted 5 lines

/* Parameters we need for USB */
enum {

--
1.7.11.7

Regards,
Simon

Best regards,
Marek Vasut

#38 lore raw

PATCH 1/8 tegra: usb: convert USB_PORTS_MAX to be a define

Hi Marek,

Quoted 32 lines · Marek Vasut

Dear Simon Glass,

Quoted 30 lines

Hi Lucas,

Quoted 15 lines · Lucas Stach

No point in having this as an enum. Also while at it set it to the real hardware maximum for both Tegra 2 and Tegra 3. If new Tegra hardware includes more USB controllers we can always bump the limit then.

---

 arch/arm/cpu/armv7/tegra20/usb.c | 4 +---

1 Datei ge?ndert, 1 Zeile hinzugef?gt(+), 3 Zeilen entfernt(-)

(quoted diff) +0 -0

b/arch/arm/cpu/armv7/tegra20/usb.c index 1bccf2b..9fd1edc 100644

arch/arm/cpu/armv7/tegra20/usb.c line 49

Quoted 9 lines
arch/arm/cpu/armv7/tegra20/usb.c +1 -2
@@ -43,9 +43,7 @@
 
        #endif
 
 #endif
 
-enum {
-       USB_PORTS_MAX   = 4,                    /* Maximum ports we allow
 */ -};
+#define USB_PORTS_MAX  3               /* Maximum ports we allow */

That's fine with me if you wan to change it.

Quoted 7 lines
Quoted 5 lines

I tend to use enums most of the time. It shows up as a symbol in the debugger, avoids bracketed expressions, side-effects and the like, and works well when numbering multiple things (automatic increment). It's also a welcome language feature IMO - use it or lose it :-) But in this case the benefit is small.

What about using static const int ?

That's fine too.

[snip]

Quoted 3 lines

Best regards,
Marek Vasut

Regards,
Simon

#39 lore raw

PATCH 1/8 tegra: usb: convert USB_PORTS_MAX to be a define

In reply to Lucas Stach

Dear Lucas Stach,

[...]

Seeing Simon's comments, I expect new version of this series, right?

Best regards,
Marek Vasut