diff mbox

[U-Boot,2/2] tegra: seaboard: Enable USB keyboard

Message ID 1350941971-10282-2-git-send-email-amartin@nvidia.com
State Superseded
Delegated to: Tom Warren
Headers show

Commit Message

Allen Martin Oct. 22, 2012, 9:39 p.m. UTC
Enable USB keyboard for the springbank variant of seaboard

Signed-off-by: Allen Martin <amartin@nvidia.com>
---
 include/configs/seaboard.h       |    5 ++++-
 include/configs/tegra20-common.h |    5 +++++
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Stephen Warren Oct. 22, 2012, 9:56 p.m. UTC | #1
On 10/22/2012 03:39 PM, Allen Martin wrote:
> Enable USB keyboard for the springbank variant of seaboard

This sounds nice!

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

>  #undef TEGRA_DEVICE_SETTINGS
> -#define TEGRA_DEVICE_SETTINGS	"stdin=serial,tegra-kbc\0" \
> +#define TEGRA_DEVICE_SETTINGS	"stdin=serial,tegra-kbc,usbkbd\0" \
>  				"stdout=serial\0" \
>  				"stderr=serial\0"

Rather than duplicating this everywhere (and I imagine now that this
support works, most Tegra boards will want to turn on USB keyboard),
can't we do something automatic in tegra-common-post.h, like:

#ifdef CONFIG_TEGRA_KEYBOARD
#define STDIN_KBD_KBC ",tegra-kbc"
#else
#define STDIN_KBD_KBC ""
#endif

#ifdef CONFIG_USB_KEYBOARD
#define STDIN_KBD_USB ",usbkbd"
#else
#define STDIN_KBD_USB ""
#endif

#define TEGRA_DEVICE_SETTINGS \
	"stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\" \
	...

By the way, does tegra-kbc work now/yet? The last time I tried it, I
don't think it did.

> diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h

> +#ifdef CONFIG_USB_KEYBOARD
> +#define CONFIG_SYS_USB_EVENT_POLL
> +#define CONFIG_PREBOOT			"usb start"
> +#endif /* CONFIG_USB_KEYBOARD */

Similarly, we could also e.g. turn on CONFIG_KEYBOARD whenever
CONFIG_TEGRA_KEYBOARD is turned on, and perhaps a bunch of other similar
things, like moving much of the partition/filesystem/command/... support
into the Tegra common files. That would be something for another patch
though.
Allen Martin Oct. 22, 2012, 10:58 p.m. UTC | #2
On Mon, Oct 22, 2012 at 02:56:44PM -0700, Stephen Warren wrote:
> On 10/22/2012 03:39 PM, Allen Martin wrote:
> > Enable USB keyboard for the springbank variant of seaboard
> 
> This sounds nice!
> 
> > diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
> 
> >  #undef TEGRA_DEVICE_SETTINGS
> > -#define TEGRA_DEVICE_SETTINGS	"stdin=serial,tegra-kbc\0" \
> > +#define TEGRA_DEVICE_SETTINGS	"stdin=serial,tegra-kbc,usbkbd\0" \
> >  				"stdout=serial\0" \
> >  				"stderr=serial\0"
> 
> Rather than duplicating this everywhere (and I imagine now that this
> support works, most Tegra boards will want to turn on USB keyboard),
> can't we do something automatic in tegra-common-post.h, like:
> 
> #ifdef CONFIG_TEGRA_KEYBOARD
> #define STDIN_KBD_KBC ",tegra-kbc"
> #else
> #define STDIN_KBD_KBC ""
> #endif
> 
> #ifdef CONFIG_USB_KEYBOARD
> #define STDIN_KBD_USB ",usbkbd"
> #else
> #define STDIN_KBD_USB ""
> #endif
> 
> #define TEGRA_DEVICE_SETTINGS \
> 	"stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\" \
> 	...

The only issue I see with that is TEGRA_DEVICE_SETTINGS can be used by
boards today to add additional environment as well as override
stdin/stdout/stderr.  I don't think any boards actually do though, so
we could just make a TEGRA_EXTRA_DEVICE_SETTINGS if that need comes
up. 

We might as well just put this directly in CONFIG_EXTRA_ENV_SETTINGS
because if TEGRA_DEVICE_SETTINGS is private to tegra-common-post.h
there's really no reason for it to exist.

> 
> By the way, does tegra-kbc work now/yet? The last time I tried it, I
> don't think it did.

It was working at one point, but I haven't tried it recently.

> 
> > diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h
> 
> > +#ifdef CONFIG_USB_KEYBOARD
> > +#define CONFIG_SYS_USB_EVENT_POLL
> > +#define CONFIG_PREBOOT			"usb start"
> > +#endif /* CONFIG_USB_KEYBOARD */
> 
> Similarly, we could also e.g. turn on CONFIG_KEYBOARD whenever
> CONFIG_TEGRA_KEYBOARD is turned on, and perhaps a bunch of other similar
> things, like moving much of the partition/filesystem/command/... support
> into the Tegra common files. That would be something for another patch
> though.

Sure, looks like there's pleny of room for commonizing more stuff from
the board confgs and triggering off tegra feature defines like
CONFIG_TEGRA_I2C, CONFIG_TEGRA_MMC, CONFIG_USB_EHCI_TEGRA,
CONFIG_TEGRA_KEYBOARD. 

I'll look at making a separate patch for that.

-Allen
Stephen Warren Oct. 22, 2012, 11:13 p.m. UTC | #3
On 10/22/2012 04:58 PM, Allen Martin wrote:
> On Mon, Oct 22, 2012 at 02:56:44PM -0700, Stephen Warren wrote:
>> On 10/22/2012 03:39 PM, Allen Martin wrote:
>>> Enable USB keyboard for the springbank variant of seaboard
>>
>> This sounds nice!
>>
>>> diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
>>
>>>  #undef TEGRA_DEVICE_SETTINGS
>>> -#define TEGRA_DEVICE_SETTINGS	"stdin=serial,tegra-kbc\0" \
>>> +#define TEGRA_DEVICE_SETTINGS	"stdin=serial,tegra-kbc,usbkbd\0" \
>>>  				"stdout=serial\0" \
>>>  				"stderr=serial\0"
>>
>> Rather than duplicating this everywhere (and I imagine now that this
>> support works, most Tegra boards will want to turn on USB keyboard),
>> can't we do something automatic in tegra-common-post.h, like:
>>
>> #ifdef CONFIG_TEGRA_KEYBOARD
>> #define STDIN_KBD_KBC ",tegra-kbc"
>> #else
>> #define STDIN_KBD_KBC ""
>> #endif
>>
>> #ifdef CONFIG_USB_KEYBOARD
>> #define STDIN_KBD_USB ",usbkbd"
>> #else
>> #define STDIN_KBD_USB ""
>> #endif
>>
>> #define TEGRA_DEVICE_SETTINGS \
>> 	"stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\" \
>> 	...
> 
> The only issue I see with that is TEGRA_DEVICE_SETTINGS can be used by
> boards today to add additional environment as well as override
> stdin/stdout/stderr.  I don't think any boards actually do though, so
> we could just make a TEGRA_EXTRA_DEVICE_SETTINGS if that need comes
> up. 

The common file could always only #define TEGRA_DEVICE_SETTINGS if the
board didn't already define a custom version.

> We might as well just put this directly in CONFIG_EXTRA_ENV_SETTINGS
> because if TEGRA_DEVICE_SETTINGS is private to tegra-common-post.h
> there's really no reason for it to exist.

It may be useful to keep it; I separated out MEM_LAYOUT_ENV_SETTINGS and
BOOTCMDS_COMMON for example just so that EXTRA_ENV_SETTINGS could be
built out of a few smaller and hence more manageable pieces.
diff mbox

Patch

diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
index 0727a4c..9e27050 100644
--- a/include/configs/seaboard.h
+++ b/include/configs/seaboard.h
@@ -33,6 +33,9 @@ 
 #define CONFIG_TPS6586X_POWER
 #define CONFIG_TEGRA_CLOCK_SCALING
 
+/* Enable USB keyboard */
+#define CONFIG_USB_KEYBOARD
+
 #include "tegra20-common.h"
 
 /* Enable fdt support for Seaboard. Flash the image in u-boot-dtb.bin */
@@ -99,7 +102,7 @@ 
 #define CONFIG_KEYBOARD
 
 #undef TEGRA_DEVICE_SETTINGS
-#define TEGRA_DEVICE_SETTINGS	"stdin=serial,tegra-kbc\0" \
+#define TEGRA_DEVICE_SETTINGS	"stdin=serial,tegra-kbc,usbkbd\0" \
 				"stdout=serial\0" \
 				"stderr=serial\0"
 
diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h
index d7d6dc3..1448888 100644
--- a/include/configs/tegra20-common.h
+++ b/include/configs/tegra20-common.h
@@ -102,6 +102,11 @@ 
 #define CONFIG_EHCI_IS_TDI
 #define CONFIG_EHCI_DCACHE
 
+#ifdef CONFIG_USB_KEYBOARD
+#define CONFIG_SYS_USB_EVENT_POLL
+#define CONFIG_PREBOOT			"usb start"
+#endif /* CONFIG_USB_KEYBOARD */
+
 /* Total I2C ports on Tegra20 */
 #define TEGRA_I2C_NUM_CONTROLLERS	4