diff options
author | Adam Hampson <ahampson@sta.samsung.com> | 2011-07-20 15:17:43 -0700 |
---|---|---|
committer | Benoit Goby <benoit@android.com> | 2011-07-26 13:18:11 -0700 |
commit | f3899bc510fd879059691bac463f877530298cfb (patch) | |
tree | 2164a165fea98e8b5497c1c3de3dcfef3a5f25e2 /arch/arm/mach-omap2 | |
parent | cc321de2860fa885d0c110abcd33ce99bf8c9074 (diff) | |
download | kernel_samsung_tuna-f3899bc510fd879059691bac463f877530298cfb.zip kernel_samsung_tuna-f3899bc510fd879059691bac463f877530298cfb.tar.gz kernel_samsung_tuna-f3899bc510fd879059691bac463f877530298cfb.tar.bz2 |
ARM: omap4: tuna: 4th Sample USB Mux Support
4th sample hardware uses a pair of FSA3200 switches
instead of a single FUSB63UMX 3-way switch.
Change-Id: Ief12ff5449511b600240408b4c745fbfcfc686eb
Signed-off-by: Adam Hampson <ahampson@sta.samsung.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/board-tuna-connector.c | 119 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-tuna.h | 2 |
2 files changed, 95 insertions, 26 deletions
diff --git a/arch/arm/mach-omap2/board-tuna-connector.c b/arch/arm/mach-omap2/board-tuna-connector.c index 5d70db1..e5f0d30 100644 --- a/arch/arm/mach-omap2/board-tuna-connector.c +++ b/arch/arm/mach-omap2/board-tuna-connector.c @@ -31,8 +31,11 @@ #include <plat/usb.h> #include "mux.h" +#include "board-tuna.h" #define GPIO_JACK_INT_N 4 +#define GPIO_MHL_SEL 96 +#define GPIO_AP_SEL 97 #define GPIO_MUX3_SEL0 139 #define GPIO_MUX3_SEL1 140 #define GPIO_USB_ID_SEL 191 @@ -45,6 +48,13 @@ #define MUX3_SEL0_FSA 0 #define MUX3_SEL1_FSA 1 +#define FSA3200_AP_SEL_AP 0 +#define FSA3200_MHL_SEL_AP 0 +#define FSA3200_AP_SEL_FSA 1 +#define FSA3200_MHL_SEL_FSA 0 +#define FSA3200_AP_SEL_MHL 1 +#define FSA3200_MHL_SEL_MHL 1 + #define USB_ID_SEL_FSA 0 #define USB_ID_SEL_MHL 1 @@ -80,6 +90,15 @@ static struct { [TUNA_USB_MUX_AP] = { MUX3_SEL0_AP, MUX3_SEL1_AP }, }; +static struct { + int ap_sel; + int mhl_sel; +} tuna_fsa3200_mux_pair_states[] = { + [TUNA_USB_MUX_FSA] = { FSA3200_AP_SEL_FSA, FSA3200_MHL_SEL_FSA }, + [TUNA_USB_MUX_MHL] = { FSA3200_AP_SEL_MHL, FSA3200_MHL_SEL_MHL }, + [TUNA_USB_MUX_AP] = { FSA3200_AP_SEL_AP, FSA3200_MHL_SEL_AP }, +}; + static int tuna_usb_id_mux_states[] = { [TUNA_USB_MUX_FSA] = USB_ID_SEL_FSA, [TUNA_USB_MUX_MHL] = USB_ID_SEL_MHL, @@ -105,21 +124,43 @@ static void tuna_mux_usb_id(int state) gpio_direction_output(GPIO_USB_ID_SEL, tuna_usb_id_mux_states[state]); } -static void tuna_mux_usb_to_fsa(bool enable) +static void tuna_fsa3200_mux_pair(int state) { - tuna_mux_usb(enable ? TUNA_USB_MUX_FSA : TUNA_USB_MUX_DEFAULT); + BUG_ON(state >= NUM_TUNA_USB_MUX); - /* when switching ID away from FSA, we want to ensure we switch it off - * FSA, and force it to MHL. Ideally, we'd just say mux to default, - * but FSA is likely the default mux position and there's no way - * to force the ID pin to float to the FSA. */ - tuna_mux_usb_id(enable ? TUNA_USB_MUX_FSA : TUNA_USB_MUX_MHL); + pr_debug("mux to %d\n", state); + gpio_direction_output(GPIO_AP_SEL, + tuna_fsa3200_mux_pair_states[state].ap_sel); + gpio_direction_output(GPIO_MHL_SEL, + tuna_fsa3200_mux_pair_states[state].mhl_sel); +} + +static void tuna_mux_usb_to_fsa(bool enable) +{ + if (omap4_tuna_get_revision() >= 3) { + tuna_fsa3200_mux_pair(enable ? TUNA_USB_MUX_FSA : + TUNA_USB_MUX_DEFAULT); + } else { + tuna_mux_usb(enable ? TUNA_USB_MUX_FSA : TUNA_USB_MUX_DEFAULT); + + /* When switching ID away from FSA, we want to ensure we switch + * it off FSA, and force it to MHL. Ideally, we'd just say mux + * to default, but FSA is likely the default mux position and + * there's no way to force the ID pin to float to the FSA. + */ + tuna_mux_usb_id(enable ? TUNA_USB_MUX_FSA : TUNA_USB_MUX_MHL); + } } static void tuna_mux_usb_to_mhl(bool enable) { - tuna_mux_usb(enable ? TUNA_USB_MUX_MHL : TUNA_USB_MUX_DEFAULT); - tuna_mux_usb_id(enable ? TUNA_USB_MUX_MHL : TUNA_USB_MUX_DEFAULT); + if (omap4_tuna_get_revision() >= 3) { + tuna_fsa3200_mux_pair(enable ? TUNA_USB_MUX_MHL : + TUNA_USB_MUX_DEFAULT); + } else { + tuna_mux_usb(enable ? TUNA_USB_MUX_MHL : TUNA_USB_MUX_DEFAULT); + tuna_mux_usb_id(enable ? TUNA_USB_MUX_MHL : TUNA_USB_MUX_DEFAULT); + } } static void tuna_vusb_enable(struct tuna_otg *tuna_otg, bool enable) @@ -151,8 +192,12 @@ static void tuna_fsa_usb_detected(int device) case FSA9480_DETECT_USB: tuna_vusb_enable(tuna_otg, true); - tuna_mux_usb(TUNA_USB_MUX_AP); - tuna_mux_usb_id(TUNA_USB_MUX_FSA); + if (omap4_tuna_get_revision() >= 3) { + tuna_fsa3200_mux_pair(TUNA_USB_MUX_AP); + } else { + tuna_mux_usb(TUNA_USB_MUX_AP); + tuna_mux_usb_id(TUNA_USB_MUX_FSA); + } tuna_otg->otg.state = OTG_STATE_B_IDLE; tuna_otg->otg.default_a = false; @@ -162,8 +207,12 @@ static void tuna_fsa_usb_detected(int device) tuna_otg->otg.gadget); break; case FSA9480_DETECT_CHARGER: - tuna_mux_usb(TUNA_USB_MUX_FSA); - tuna_mux_usb_id(TUNA_USB_MUX_FSA); + if (omap4_tuna_get_revision() >= 3) { + tuna_fsa3200_mux_pair(TUNA_USB_MUX_FSA); + } else { + tuna_mux_usb(TUNA_USB_MUX_FSA); + tuna_mux_usb_id(TUNA_USB_MUX_FSA); + } tuna_otg->otg.state = OTG_STATE_B_IDLE; tuna_otg->otg.default_a = false; @@ -175,8 +224,12 @@ static void tuna_fsa_usb_detected(int device) case FSA9480_DETECT_USB_HOST: tuna_vusb_enable(tuna_otg, true); - tuna_mux_usb(TUNA_USB_MUX_AP); - tuna_mux_usb_id(TUNA_USB_MUX_FSA); + if (omap4_tuna_get_revision() >= 3) { + tuna_fsa3200_mux_pair(TUNA_USB_MUX_AP); + } else { + tuna_mux_usb(TUNA_USB_MUX_AP); + tuna_mux_usb_id(TUNA_USB_MUX_FSA); + } tuna_otg->otg.state = OTG_STATE_A_IDLE; tuna_otg->otg.default_a = true; @@ -186,8 +239,13 @@ static void tuna_fsa_usb_detected(int device) tuna_otg->otg.gadget); break; case FSA9480_DETECT_NONE: - tuna_mux_usb(TUNA_USB_MUX_FSA); - tuna_mux_usb_id(TUNA_USB_MUX_FSA); + + if (omap4_tuna_get_revision() >= 3) { + tuna_fsa3200_mux_pair(TUNA_USB_MUX_FSA); + } else { + tuna_mux_usb(TUNA_USB_MUX_FSA); + tuna_mux_usb_id(TUNA_USB_MUX_FSA); + } tuna_vusb_enable(tuna_otg, false); @@ -277,16 +335,27 @@ int __init omap4_tuna_connector_init(void) struct tuna_otg *tuna_otg = &tuna_otg_xceiv; int ret; - gpio_request(GPIO_MUX3_SEL0, "usb_mux3_sel0"); - gpio_request(GPIO_MUX3_SEL1, "usb_mux3_sel1"); - gpio_request(GPIO_USB_ID_SEL, "usb_id_sel"); + if (omap4_tuna_get_revision() >= 3) { + gpio_request(GPIO_MHL_SEL, "fsa3200_mhl_sel"); + gpio_request(GPIO_AP_SEL, "fsa3200_ap_sel"); + + tuna_fsa3200_mux_pair(TUNA_USB_MUX_DEFAULT); + + omap_mux_init_gpio(GPIO_MHL_SEL, OMAP_PIN_OUTPUT); + omap_mux_init_gpio(GPIO_AP_SEL, OMAP_PIN_OUTPUT); + } else { + gpio_request(GPIO_MUX3_SEL0, "usb_mux3_sel0"); + gpio_request(GPIO_MUX3_SEL1, "usb_mux3_sel1"); + gpio_request(GPIO_USB_ID_SEL, "usb_id_sel"); - tuna_mux_usb(TUNA_USB_MUX_DEFAULT); - tuna_mux_usb_id(TUNA_USB_MUX_DEFAULT); + tuna_mux_usb(TUNA_USB_MUX_DEFAULT); + tuna_mux_usb_id(TUNA_USB_MUX_DEFAULT); + + omap_mux_init_gpio(GPIO_MUX3_SEL0, OMAP_PIN_OUTPUT); + omap_mux_init_gpio(GPIO_MUX3_SEL1, OMAP_PIN_OUTPUT); + omap_mux_init_gpio(GPIO_USB_ID_SEL, OMAP_PIN_OUTPUT); + } - omap_mux_init_gpio(GPIO_MUX3_SEL0, OMAP_PIN_OUTPUT); - omap_mux_init_gpio(GPIO_MUX3_SEL1, OMAP_PIN_OUTPUT); - omap_mux_init_gpio(GPIO_USB_ID_SEL, OMAP_PIN_OUTPUT); omap_mux_init_gpio(GPIO_JACK_INT_N, OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_INPUT_PULLUP); diff --git a/arch/arm/mach-omap2/board-tuna.h b/arch/arm/mach-omap2/board-tuna.h index c056f01..3052a63 100644 --- a/arch/arm/mach-omap2/board-tuna.h +++ b/arch/arm/mach-omap2/board-tuna.h @@ -32,7 +32,7 @@ void omap4_tuna_jack_init(void); void omap4_tuna_nfc_init(void); void omap4_tuna_power_init(void); void omap4_tuna_sensors_init(void); -void omap4_tuna_connector_init(void); +int omap4_tuna_connector_init(void); int tuna_wlan_init(void); int omap_hsi_init(void); void omap4_tuna_emif_init(void); |