Permalink
Browse files

ADD : USB Host Switch via Holding Back Button At Boot

  • Loading branch information...
1 parent 873701d commit c9d5984e11755997dd3f825ee2ffc997e04d331a @BuzzBumbleBee committed Mar 9, 2011
Showing with 52 additions and 17 deletions.
  1. +39 −6 arch/arm/mach-tegra/odm_kit/query/harmony/nvodm_query.c
  2. +13 −7 drivers/i2c/chips/shuttle.c
  3. +0 −4 init/Kconfig
@@ -49,6 +49,7 @@
#include "nvodm_keylist_reserved.h"
#include "nvrm_drf.h"
#include <linux/kernel.h>
+#include <linux/gpio.h>
#if !defined(NV_OAL)
#define NV_OAL (0)
@@ -718,22 +719,34 @@ const NvOdmUsbProperty*
NvOdmQueryGetUsbProperty(NvOdmIoModule OdmIoModule,
NvU32 Instance)
{
- static const NvOdmUsbProperty Usb1Property =
+ int HostMode = 0;
+ static const NvOdmUsbProperty Usb1PropertySlave =
{
NvOdmUsbInterfaceType_Utmi,
(NvOdmUsbChargerType_SE0 | NvOdmUsbChargerType_SE1 | NvOdmUsbChargerType_SK),
20,
NV_TRUE,
-#ifndef CONFIG_USB_HOST_MODE
NvOdmUsbModeType_Device,
-#else
+
+ NvOdmUsbIdPinType_CableId,
+ NvOdmUsbConnectorsMuxType_None,
+ NV_TRUE
+ };
+
+ static const NvOdmUsbProperty Usb1PropertyHost =
+ {
+ NvOdmUsbInterfaceType_Utmi,
+ (NvOdmUsbChargerType_SE0 | NvOdmUsbChargerType_SE1 | NvOdmUsbChargerType_SK),
+ 20,
+ NV_TRUE,
NvOdmUsbModeType_Host,
-#endif
+
NvOdmUsbIdPinType_CableId,
NvOdmUsbConnectorsMuxType_None,
NV_TRUE
};
+
static const NvOdmUsbProperty Usb2Property =
{
NvOdmUsbInterfaceType_UlpiExternalPhy,
@@ -758,8 +771,28 @@ NvOdmQueryGetUsbProperty(NvOdmIoModule OdmIoModule,
NV_TRUE
};
- if (OdmIoModule == NvOdmIoModule_Usb && Instance == 0)
- return &(Usb1Property);
+ gpio_request(56, "PWR") ;
+ gpio_direction_input(56) ;
+ if ((gpio_get_value(56)) == 0)
+ {
+ HostMode = 1;
+ }
+ else
+ {
+ HostMode = 0;
+ }
+
+ if (OdmIoModule == NvOdmIoModule_Usb && Instance == 0 && HostMode == 1)
+ {
+ printk(KERN_INFO "BUZZ: Booting Host Mode Stage 1 of 2\n") ;
+ return &(Usb1PropertyHost);
+ }
+
+ if (OdmIoModule == NvOdmIoModule_Usb && Instance == 0 && HostMode == 0)
+ {
+ printk(KERN_INFO "BUZZ: Booting Slave Mode Stage 1 of 2\n") ;
+ return &(Usb1PropertySlave);
+ }
if (OdmIoModule == NvOdmIoModule_Usb && Instance == 1)
return &(Usb2Property);
@@ -670,13 +670,19 @@ static void init_gpio_status(void)
printk(KERN_INFO "Ant shuttle module init set GPIO 28 to low\n") ;
//high is (host mode) --- TV_ON(GPIO_PB0 8)
-
-#ifndef CONFIG_USB_HOST_MODE
- gpio_request(8, "USB0") ;
- gpio_direction_output( 8, 0);
- printk(KERN_INFO "Ant shuttle module init set GPIO 8 to high (host mode)\n") ;
-#endif
-
+ gpio_request(56, "PWR") ;
+ gpio_direction_input(56) ;
+
+ if (gpio_get_value(56) == 1)
+ {
+ gpio_request(8, "USB0") ;
+ gpio_direction_output( 8, 0);
+ printk(KERN_INFO "Ant shuttle module init set GPIO 8 to low (slave mode)\n") ;
+ }
+ else
+ {
+ printk(KERN_INFO "Ant shuttle module init set GPIO 8 to high (host mode)\n") ;
+ }
}
// GPIO_PB1 -- Volup -- 9
View
@@ -106,10 +106,6 @@ config LOCALVERSION_AUTO
which is done within the script "scripts/setlocalversion".)
-config USB_HOST_MODE
- bool "Enable USB host mode at build time"
- default n
-
config HAVE_KERNEL_GZIP
bool

0 comments on commit c9d5984

Please sign in to comment.