Skip to content

Commit

Permalink
ODROID-C2: UMS: activate UMS when switch is detected as on
Browse files Browse the repository at this point in the history
This patch helps ODROID-C2 to run as USB Mass Storage when UMS switch is on.
Currently boot media (mmc0) will be recognized as Mass Storage.

Change-Id: Ibc190e562ecc914a7770b59bb52259ebe0ac9116
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
  • Loading branch information
tobetter committed Nov 25, 2015
1 parent 7841223 commit 9e3aa5e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions board/hardkernel/odroidc2/odroidc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;

extern int board_get_recovery_message(void);

#define GPIO_SW_UMS 28 /* GPIOY_5 */
#define GPIO_BLUELED 132
#define GPIO_USB_PWREN 123
#define GPIO_OTG_PWREN 124
Expand Down Expand Up @@ -271,6 +272,12 @@ int board_late_init(void)
{
int reboot_reason;

/*
* If UMS SW is 'on', the device will run as USB Mass Storage
*/
if (1 == gpio_get_value(GPIO_SW_UMS))
run_command("ums 0 mmc 0", 0);

board_partition_init();

reboot_reason = board_reboot_reason();
Expand Down Expand Up @@ -343,6 +350,14 @@ int board_init(void)
gpio_request(GPIO_OTG_PWREN, "otg_pwren");
gpio_direction_output(GPIO_OTG_PWREN, 0);

/*
* GPIO: USB MassStorage
* Low - Normal boot
* High - Act as USB Mass Storage Device
*/
gpio_request(GPIO_SW_UMS, "sw_ums");
gpio_direction_input(GPIO_SW_UMS);

#if defined(CONFIG_USB_DWC_OTG_HCD)
amlogic_usb_init(&usb_config0, BOARD_USB_MODE_SLAVE);
amlogic_usb_init(&usb_config1, BOARD_USB_MODE_HOST);
Expand Down

0 comments on commit 9e3aa5e

Please sign in to comment.