From 97a67b7f86ba9cc7759d3e4ee6e39050b96af6b1 Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 17 Jul 2012 11:35:35 -0400 Subject: [PATCH 114/123] 511-MIPS-ath79-add-ath79_set_usb_power_gpio Import of the above patch from openwrt trunk, as of this commit: ---------- commit c1d79f64eed0a7ac36b5b9bca52275b397bec424 Author: nbd Date: Mon Jul 16 16:26:51 2012 +0000 uboot-ar71xx: fix compile on recent mac os x versions git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32750 3c298f89-4303-0410-b956-a3cf2f4a3e73 ---------- Path to patch in the repo is: target/linux/ar71xx/patches-3.3 Repo is: git://nbd.name/openwrt.git Signed-off-by: Paul Gortmaker --- arch/mips/ath79/dev-usb.c | 22 ++++++++++++++++++++++ arch/mips/ath79/dev-usb.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/arch/mips/ath79/dev-usb.c b/arch/mips/ath79/dev-usb.c index 87fe48e..a32712d 100644 --- a/arch/mips/ath79/dev-usb.c +++ b/arch/mips/ath79/dev-usb.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -208,3 +209,24 @@ void __init ath79_register_usb(void) else BUG(); } + +void __init ath79_set_usb_power_gpio(unsigned int gpio, unsigned long flags, + const char *label) +{ + int err; + + err = gpio_request_one(gpio, flags, label); + if (err) { + pr_err("ath79: can't setup GPIO%u (%s), err=%d\n", + gpio, label, err); + return; + } + + err = gpio_export(gpio, false); + if (err) { + pr_err("ath79: can't export GPIO%u (%s), err=%d\n", + gpio, label, err); + } + + return; +} diff --git a/arch/mips/ath79/dev-usb.h b/arch/mips/ath79/dev-usb.h index 4b86a69..2cc309c 100644 --- a/arch/mips/ath79/dev-usb.h +++ b/arch/mips/ath79/dev-usb.h @@ -13,5 +13,7 @@ #define _ATH79_DEV_USB_H void ath79_register_usb(void); +void ath79_set_usb_power_gpio(unsigned int gpio, unsigned long flags, + const char *label); #endif /* _ATH79_DEV_USB_H */ -- 1.7.9.7