Skip to content

Commit

Permalink
ADD : USB Host Switch via Holding Back Button At Boot
Browse files Browse the repository at this point in the history
  • Loading branch information
BuzzBumbleBee committed Mar 9, 2011
1 parent 873701d commit c9d5984
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 17 deletions.
45 changes: 39 additions & 6 deletions arch/arm/mach-tegra/odm_kit/query/harmony/nvodm_query.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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);
Expand Down
20 changes: 13 additions & 7 deletions drivers/i2c/chips/shuttle.c
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions init/Kconfig
Expand Up @@ -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

Expand Down

0 comments on commit c9d5984

Please sign in to comment.