Skip to contentSkip to conversation

BeagleBoard: turn off clocks in ehci_stop

PATCH New Joel A Fernandes 5 participants 14 messages Aug 16, 2011 – Sep 11, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 BeagleBoard: turn off clocks in ehci_stop

From: Koen Kooi <[email protected]>

This fixes display problems in linux

---
 board/ti/beagle/beagle.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
board/ti/beagle/beagle.c +6 -0
index 7768901..a958545 100644
@@ -356,6 +356,12 @@ int ehci_hcd_stop(void)
 	pr_debug("Resetting OMAP3 EHCI\n");
 	omap_set_gpio_dataout(GPIO_PHY_RESET, 0);
 	writel(OMAP_UHH_SYSCONFIG_SOFTRESET, OMAP3_UHH_BASE + OMAP_UHH_SYSCONFIG);
+	/* disable USB clocks */
+	struct prcm *prcm_base = (struct prcm *)PRCM_BASE;
+	sr32(&prcm_base->iclken_usbhost, 0, 1, 0);
+	sr32(&prcm_base->fclken_usbhost, 0, 2, 0);
+	sr32(&prcm_base->iclken3_core, 2, 1, 0);
+	sr32(&prcm_base->fclken3_core, 2, 1, 0);
 	return 0;
 }
 
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/3 BeagleBoard: Added userbutton command

From: Jason Kridner <[email protected]>

Based on commit f1099c7c43caf5bac3bf6a65aa266fade4747072
Author: Greg Turner <[email protected]>
Date: Tue May 25 09:19:06 2010 -0500

New u-boot command for status of USER button on BeagleBoard-xM

Modified bootcmd to check the staus at boot time and set filename of the boot script.

* Moved to a BeagleBoard specific file.
* Removed changes to default boot command from adding userbutton command.
* Made to handle pre-xM boards.
* Flipped polarity of the return value to avoid confusion. Success (0) is when the button is pressed. Failure (1) is when the button is NOT pressed.
* Used latest revision getting function.
* Used latest macros for board revision.
* Added xM-C revision definition (optional, since it was default)
* updated default configuration with UserButton functionality
* Added a separate bootenv variable to load a user defined .txt file
* Added an example, showing how a different environment file can be loaded with the user button pressed

---
 board/ti/beagle/beagle.c       |   56 ++++++++++++++++++++++++++++++++++++++++
 include/configs/omap3_beagle.h |    7 ++++-
 2 files changed, 62 insertions(+), 1 deletions(-)
board/ti/beagle/beagle.c +56 -0
index a958545..8dc8dfa 100644
@@ -50,6 +50,7 @@ extern struct ehci_hccr *hccr;
 extern volatile struct ehci_hcor *hcor;
 #endif
 #include "beagle.h"
+#include <command.h>
 
 #define pr_debug(fmt, args...) debug(fmt, ##args)
 
@@ -446,3 +447,58 @@ int ehci_hcd_init(void)
 }
 
 #endif /* CONFIG_USB_EHCI */
+
+/*
+ * This command returns the status of the user button on beagle xM
+ * Input - none
+ * Returns - 	1 if button is held down
+ *		0 if button is not held down
+ */
+int do_userbutton (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	int     button = 0;
+	int	gpio;
+
+	/*
+	 * pass address parameter as argv[0] (aka command name),
+	 * and all remaining args
+	 */
+	switch (get_board_revision()) {
+	case REVISION_AXBX:
+	case REVISION_CX:
+	case REVISION_C4:
+		gpio = 7;
+		break;
+	case REVISION_XM_A:
+	case REVISION_XM_B:
+	case REVISION_XM_C:
+	default:
+		gpio = 4;
+		break;
+	}
+	omap_request_gpio(gpio);
+	omap_set_gpio_direction(gpio, 1);
+	printf("The user button is currently ");
+	if(omap_get_gpio_datain(gpio))
+	{
+		button = 1;
+		printf("PRESSED.\n");
+	}
+	else
+	{
+		button = 0;
+		printf("NOT pressed.\n");
+	}
+
+	omap_free_gpio(gpio);
+
+	return !button;
+}
+
+/* -------------------------------------------------------------------- */
+
+U_BOOT_CMD(
+	userbutton, CONFIG_SYS_MAXARGS, 1,	do_userbutton,
+	"Return the status of the BeagleBoard USER button",
+	""
+);
include/configs/omap3_beagle.h +6 -1
index c41d48e..a494f99 100644
@@ -227,7 +227,8 @@
 		"omapdss.def_disp=${defaultdisplay} " \
 		"root=${nandroot} " \
 		"rootfstype=${nandrootfstype}\0" \
-	"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} uEnv.txt\0" \
+	"bootenv=uEnv.txt\0" \
+	"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
 	"importbootenv=echo Importing environment from mmc ...; " \
 		"env import -t $loadaddr $filesize\0" \
 	"loaduimage=fatload mmc ${mmcdev} ${loadaddr} uImage\0" \
@@ -241,8 +242,12 @@
 
 #define CONFIG_BOOTCOMMAND \
 	"if mmc rescan ${mmcdev}; then " \
+		"if userbutton; then " \
+			"setenv bootenv user.txt;" \
+		"fi;" \
 		"echo SD/MMC found on device ${mmcdev};" \
 		"if run loadbootenv; then " \
+			"echo Loaded environment from ${bootenv};" \
 			"run importbootenv;" \
 		"fi;" \
 		"if test -n $uenvcmd; then " \
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/3 BeagleBoard: Added userbutton command

Le 16/08/2011 04:36, Joel A Fernandes a ?crit :

Quoted 3 lines

From: Jason Kridner<[email protected]>

Based on commit f1099c7c43caf5bac3bf6a65aa266fade4747072

Can(t find this one in my tree.

Quoted 7 lines

Author: Greg Turner<[email protected]>
Date: Tue May 25 09:19:06 2010 -0500

New u-boot command for status of USER button on BeagleBoard-xM

Modified bootcmd to check the staus at boot time and set
filename of the boot script.

Generally speaking, is a 'userbutton' command' really needed when a gpio command exists? The notion of 'user button' isn't really something fundamentally meaningful to a bootloader -- We don't have a concept of 'user', even.

Amicalement,

Signature · 1 line
Albert.
#3 lore raw

PATCH 2/3 BeagleBoard: Added userbutton command

In reply to Joel A Fernandes

Dear Joel A Fernandes,

Quoted 11 lines · In message <[email protected]> you wrote:

From: Jason Kridner <[email protected]>

Based on commit f1099c7c43caf5bac3bf6a65aa266fade4747072
Author: Greg Turner <[email protected]>
Date: Tue May 25 09:19:06 2010 -0500

New u-boot command for status of USER button on BeagleBoard-xM

Modified bootcmd to check the staus at boot time and set filename of the boot script.

Quoted 14 lines

* Moved to a BeagleBoard specific file.
* Removed changes to default boot command from adding userbutton command.
* Made to handle pre-xM boards.
* Flipped polarity of the return value to avoid confusion. Success (0) is when the button is pressed. Failure (1) is when the button is NOT pressed.
* Used latest revision getting function.
* Used latest macros for board revision.
* Added xM-C revision definition (optional, since it was default)
* updated default configuration with UserButton functionality
* Added a separate bootenv variable to load a user defined .txt file
* Added an example, showing how a different environment file can be loaded with the user button pressed

Your patch has a large number of cding style issues; please always run checkpatch before submitting patches.

Also, I agree with Albert: there should be no need for a separate userbutton command.

Please fix and resubmit.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The average woman would rather have beauty than brains,  because  the
average man can see better than he can think.
#4 lore raw

PATCH 2/3 BeagleBoard: Added userbutton command

Quoted 11 lines · Wolfgang Denk

Dear Joel A Fernandes,

Quoted 8 lines · In message <[email protected]> you wrote:

From: Jason Kridner <[email protected]>

Based on commit f1099c7c43caf5bac3bf6a65aa266fade4747072 ? ? Author: Greg Turner <[email protected]>
? ? Date: ? Tue May 25 09:19:06 2010 -0500

? ? New u-boot command for status of USER button on BeagleBoard-xM

..

Quoted 6 lines

Also, I agree with Albert: there should be no need for a separate userbutton command.

Please fix and resubmit.

If this patch is to be dropped, then I'm not sure why the need to resubmit?

Thanks,
Joel

#5 lore raw

PATCH 2/3 BeagleBoard: Added userbutton command

Hi Joel,

Le 08/09/2011 16:56, Joel A Fernandes a ?crit :

Quoted 6 lines
Quoted 4 lines

Also, I agree with Albert: there should be no need for a separate userbutton command.

Please fix and resubmit.

If this patch is to be dropped, then I'm not sure why the need to resubmit?

I gather the "resubmit" means "resubmit the patch set minus this patch and renumbered accordingly".

Quoted 2 lines

Thanks,
Joel

Amicalement,

Signature · 1 line
Albert.
#6 lore raw

PATCH 2/3 BeagleBoard: Added userbutton command

Quoted 4 lines · Albert ARIBAUD

Hi Joel,

Le 08/09/2011 16:56, Joel A Fernandes a ?crit :

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Also, I agree with Albert: there should be no need for a separate userbutton command.

Please fix and resubmit.

If this patch is to be dropped, then I'm not sure why the need to resubmit?

I gather the "resubmit" means "resubmit the patch set minus this patch and renumbered accordingly".

One thing that would be necessary is to replace the default bootcmd with one that uses the gpio command and to enable the gpio command.

Quoted 7 lines
Quoted 3 lines

Thanks,
Joel

Amicalement,

Signature · 1 line
Albert.
#7 lore raw

PATCH 2/3 BeagleBoard: Added userbutton command

Quoted 11 lines · Jason
Quoted 7 lines · Albert ARIBAUD

Hi Joel,

Le 08/09/2011 16:56, Joel A Fernandes a ?crit :

Quoted 3 lines
Quoted 3 lines

Also, I agree with Albert: there should be no need for a separate userbutton command.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Please fix and resubmit.

If this patch is to be dropped, then I'm not sure why the need to resubmit?

I gather the "resubmit" means "resubmit the patch set minus this patch and renumbered accordingly".

One thing that would be necessary is to replace the default bootcmd with one that uses the gpio command and to enable the gpio command.

Sounds like a good idea, I will work on this and submit a patch soon.

Thanks,
Joel

#8 lore raw

PATCH 2/3 BeagleBoard: Added userbutton command

In reply to Kridner
Quoted 11 lines · Jason
Quoted 7 lines · Albert ARIBAUD

Hi Joel,

Le 08/09/2011 16:56, Joel A Fernandes a ?crit :

Quoted 3 lines
Quoted 3 lines

Also, I agree with Albert: there should be no need for a separate userbutton command.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Please fix and resubmit.

If this patch is to be dropped, then I'm not sure why the need to resubmit?

I gather the "resubmit" means "resubmit the patch set minus this patch and renumbered accordingly".

One thing that would be necessary is to replace the default bootcmd with one that uses the gpio command and to enable the gpio command.

Actually the functions in arch/arm/cpu/armv7/omap-common/gpio.c are not compatible with the ones used by common/cmd_led.c

What would be the right place to implement the required functions for the gpio command?

1. In the (beagle)board file as wrappers to the omap gpio functions
2. In the gpio.c file in omap-common
3. Any other option?

Thanks,
Joel

#9 lore raw

PATCH 2/3 BeagleBoard: Added userbutton command

Quoted 16 lines · Joel A Fernandes
Quoted 15 lines · Jason
Quoted 11 lines · Albert ARIBAUD

Hi Joel,

Le 08/09/2011 16:56, Joel A Fernandes a ?crit :

Quoted 6 lines
Quoted 4 lines

Also, I agree with Albert: there should be no need for a separate userbutton command.

Please fix and resubmit.

If this patch is to be dropped, then I'm not sure why the need to resubmit?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I gather the "resubmit" means "resubmit the patch set minus this patch and renumbered accordingly".

One thing that would be necessary is to replace the default bootcmd with one that uses the gpio command and to enable the gpio command.

Actually the functions in arch/arm/cpu/armv7/omap-common/gpio.c are not compatible with the ones used by common/cmd_led.c

The patches from Sanjeev Premi seemed to me to handle the deltas. Are you applying those? They are working for me for use with the led command.

Quoted 7 lines

What would be the right place to implement the required functions for the gpio command?

1. In the (beagle)board file as wrappers to the omap gpio functions
2. In the gpio.c file in omap-common
3. Any other option?

Do you mean to replace userbutton? As long as the gpio command returns a status, then you should be able to remove userbutton from the board.c file and add usage of gpio to replace userbutton in the omap3_beagle.h config header file. (Of course, the patches should apply those changes in opposite order to make sure git bisect doesn't show breakage.)

If you are saying that gpio.c is missing functionality, please describe the missing functionality.

Quoted 8 lines

Thanks,
Joel
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#10 lore raw

PATCH 2/3 BeagleBoard: Added userbutton command

Quoted 22 lines · Jason Kridner
Quoted 21 lines · Joel A Fernandes
Quoted 19 lines · Jason
Quoted 4 lines · Albert ARIBAUD

Hi Joel,

Le 08/09/2011 16:56, Joel A Fernandes a ?crit :

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Also, I agree with Albert: there should be no need for a separate userbutton command.

Please fix and resubmit.

If this patch is to be dropped, then I'm not sure why the need to resubmit?

I gather the "resubmit" means "resubmit the patch set minus this patch and renumbered accordingly".

One thing that would be necessary is to replace the default bootcmd with one that uses the gpio command and to enable the gpio command.

Quoted 7 lines
Quoted 2 lines

Actually the functions in arch/arm/cpu/armv7/omap-common/gpio.c are not compatible with the ones used by common/cmd_led.c

The patches from Sanjeev Premi seemed to me to handle the deltas. ?Are you applying those? ?They are working for me for use with the led command.

I missed those patches! I have updated my tree and can see them now, thanks.

Regards,
Joel

#11 lore raw

PATCH 2/3 BeagleBoard: Added userbutton command

In reply to Kridner
Quoted 11 lines · Jason
Quoted 7 lines · Albert ARIBAUD

Hi Joel,

Le 08/09/2011 16:56, Joel A Fernandes a ?crit :

Quoted 3 lines
Quoted 3 lines

Also, I agree with Albert: there should be no need for a separate userbutton command.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Please fix and resubmit.

If this patch is to be dropped, then I'm not sure why the need to resubmit?

I gather the "resubmit" means "resubmit the patch set minus this patch and renumbered accordingly".

One thing that would be necessary is to replace the default bootcmd with one that uses the gpio command and to enable the gpio command.

One of the difficulties with this is the GPIO value for userbutton depends on the board rev which is what your patch does. Hardcoding gpio values for one will break support for other boards

Without adding any additional commands, the only way I see this can be done is:
1. Use the gpio and test commands to get the board rev in omap3_beagle.h
2. Based on this, use the right gpio value to pass to another gpio command to check userbutton state

This is quite messy IMO and is redundant because the revision detection logic is already in the board/ file.

Another way is to add a command to the board/ file like "get_userbutton_gpio" and use the value it returns to pass to the gpio command but this seems to defeat the purpose of the cleanup itself.

If you think one of the above methods is acceptable, please ACK them and I will start developing the patch.

Thanks,
Joel

#12 lore raw

PATCH 2/3 BeagleBoard: Added userbutton command

In reply to Wolfgang Denk
Quoted 29 lines · Wolfgang Denk

Dear Joel A Fernandes,

Quoted 11 lines · In message <[email protected]> you wrote:

From: Jason Kridner <[email protected]>

Based on commit f1099c7c43caf5bac3bf6a65aa266fade4747072 ? ? Author: Greg Turner <[email protected]>
? ? Date: ? Tue May 25 09:19:06 2010 -0500

? ? New u-boot command for status of USER button on BeagleBoard-xM

? ? ? ? ?Modified bootcmd to check the staus at boot time and set ? ? ? ?filename of the boot script.

Quoted 14 lines

* Moved to a BeagleBoard specific file.
* Removed changes to default boot command from adding userbutton
? command.
* Made to handle pre-xM boards.
* Flipped polarity of the return value to avoid confusion. ?Success (0) ? is when the button is pressed. ?Failure (1) is when the button is NOT ? pressed.
* Used latest revision getting function.
* Used latest macros for board revision.
* Added xM-C revision definition (optional, since it was default)
* updated default configuration with UserButton functionality
? * Added a separate bootenv variable to load a user defined .txt file ? * Added an example, showing how a different environment file can be loaded with ? ? the user button pressed

Quoted 2 lines

Your patch has a large number of cding style issues; please always run checkpatch before submitting patches.

Very sorry, I might have missed running it on this patch. I will correct it and resubmit it

Quoted 5 lines

Also, I agree with Albert: there should be no need for a separate userbutton command.

Please fix and resubmit.

Sure. Thanks,
Joel

#13 lore raw

PATCH 3/3 BeagleBoard: Configure DVI/S-video

In reply to Joel A Fernandes

From: Jason Kridner <[email protected]>

Based on patches from Syed Mohammed Khasim (khasim at ti.com).

Configures the output of the BeagleBoard DVI to be orange. Configures the output of the BeagleBoard S-Video to be a colorbar.

Changed display_init to beagle_display_init as suggested by Igor Grinberg:
http://www.mail-archive.com/u-boot at lists.denx.de/msg51446.html

---
 board/ti/beagle/beagle.c |   24 +++++++++++++
 board/ti/beagle/beagle.h |   86 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 110 insertions(+), 0 deletions(-)
board/ti/beagle/beagle.c +24 -0
index 8dc8dfa..13fe39b 100644
@@ -165,6 +165,28 @@ unsigned int get_expansion_id(void)
 }
 
 /*
+ * Configure DSS to display background color on DVID
+ * Configure VENC to display color bar on S-Video
+ */
+void beagle_display_init(void)
+{
+	omap3_dss_venc_config(&venc_config_std_tv, VENC_HEIGHT, VENC_WIDTH);
+	switch (get_board_revision()) {
+	case REVISION_AXBX:
+	case REVISION_CX:
+	case REVISION_C4:
+		omap3_dss_panel_config(&dvid_cfg);
+		break;
+	case REVISION_XM_A:
+	case REVISION_XM_B:
+	case REVISION_XM_C:
+	default:
+		omap3_dss_panel_config(&dvid_cfg_xm);
+		break;
+	}
+}
+
+/*
  * Routine: misc_init_r
  * Description: Configure board specific parts
  */
@@ -324,6 +346,8 @@ int misc_init_r(void)
 		GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe);
 
 	dieid_num_r();
+	beagle_display_init();
+	omap3_dss_enable();
 
 	return 0;
 }
board/ti/beagle/beagle.h +86 -0

96 lines not on this page · raw message

Signature · 1 line
1.7.1