aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSakethram Bommisetti <sakethram.bommisetti@stericsson.com>2011-07-14 17:30:24 +0530
committerPhilippe LANGLAIS <philippe.langlais@stericsson.com>2011-07-19 08:32:59 +0200
commitad105d6f230148e545bcd6cb6944b3ca071ab44f (patch)
treeb142cc8942ef6fecb829368a3c69db7ca469f1f1 /arch
parenta27025197db3c31af57114dc59672001a2a802f9 (diff)
downloadlinux-2.6.38-lt-ux500-ad105d6f230148e545bcd6cb6944b3ca071ab44f.tar.gz
USB:Enable GPIO configuration at connectlinaro-11.07-2.6.38
GPIO alternate configuration is set when the USB is connected and reset at USB disconnect. Change-Id: I07d9c2ed5028879ecff309aa9e4ac25deac148f5 Signed-off-by: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/27203 Reviewed-by: QATOOLS Reviewed-by: Praveena NADAHALLY <praveen.nadahally@stericsson.com> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-ux500/board-mop500-usb.h13
-rw-r--r--arch/arm/mach-ux500/board-mop500.c2
-rw-r--r--arch/arm/mach-ux500/include/mach/usb.h8
-rw-r--r--arch/arm/mach-ux500/usb.c35
4 files changed, 58 insertions, 0 deletions
diff --git a/arch/arm/mach-ux500/board-mop500-usb.h b/arch/arm/mach-ux500/board-mop500-usb.h
new file mode 100644
index 00000000000..85288463a73
--- /dev/null
+++ b/arch/arm/mach-ux500/board-mop500-usb.h
@@ -0,0 +1,13 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2011
+ *
+ * Author: Saketh Ram Bommisetti <sakethram.bommisetti@stericsson.com>
+ * License terms: GNU General Public License (GPL) version 2
+ */
+
+#ifndef __BOARD_MOP500_USB_H
+#define __BOARD_MOP500_USB_H
+
+extern struct ab8500_usbgpio_platform_data ab8500_usbgpio_plat_data;
+
+#endif
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index be1730bd765..62418a4c444 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -60,6 +60,7 @@
#include "board-mop500-regulators.h"
#include "board-mop500-bm.h"
#include "board-mop500-wlan.h"
+#include "board-mop500-usb.h"
#include "pins.h"
#ifdef CONFIG_AB8500_DENC
@@ -258,6 +259,7 @@ static struct ab8500_platform_data ab8500_platdata = {
.fg = &ab8500_fg_plat_data,
.chargalg = &ab8500_chargalg_plat_data,
.gpio = &ab8500_gpio_pdata,
+ .usb = &ab8500_usbgpio_plat_data,
#ifdef CONFIG_INPUT_AB8500_ACCDET
.accdet = &ab8500_accdet_pdata,
#endif
diff --git a/arch/arm/mach-ux500/include/mach/usb.h b/arch/arm/mach-ux500/include/mach/usb.h
index d3739d41881..5c27a72c10d 100644
--- a/arch/arm/mach-ux500/include/mach/usb.h
+++ b/arch/arm/mach-ux500/include/mach/usb.h
@@ -22,4 +22,12 @@ struct ux500_musb_board_data {
void ux500_add_usb(resource_size_t base, int irq, int *dma_rx_cfg,
int *dma_tx_cfg);
+
+struct ab8500_usbgpio_platform_data {
+ int (*get)(struct device *device);
+ void (*enable)(void);
+ void (*disable)(void);
+ void (*put)(void);
+};
+
#endif
diff --git a/arch/arm/mach-ux500/usb.c b/arch/arm/mach-ux500/usb.c
index 82e535953fd..dc6a6970c35 100644
--- a/arch/arm/mach-ux500/usb.c
+++ b/arch/arm/mach-ux500/usb.c
@@ -9,6 +9,9 @@
#include <plat/ste_dma40.h>
#include <mach/hardware.h>
#include <mach/usb.h>
+#include <plat/pincfg.h>
+#include "pins.h"
+#include "board-mop500-usb.h"
#define MUSB_DMA40_RX_CH { \
.mode = STEDMA40_MODE_LOGICAL, \
@@ -85,6 +88,7 @@ static struct ux500_musb_board_data musb_board_data = {
};
static u64 ux500_musb_dmamask = DMA_BIT_MASK(32);
+static struct ux500_pins *usb_gpio_pins;
static struct musb_hdrc_config musb_hdrc_config = {
.multipoint = true,
@@ -129,6 +133,37 @@ struct platform_device ux500_musb_device = {
.resource = usb_resources,
};
+static void enable_gpio(void)
+{
+ ux500_pins_enable(usb_gpio_pins);
+}
+static void disable_gpio(void)
+{
+ ux500_pins_disable(usb_gpio_pins);
+}
+static int get_gpio(struct device *device)
+{
+ usb_gpio_pins = ux500_pins_get(dev_name(device));
+
+ if (usb_gpio_pins == NULL) {
+ dev_err(device, "Could not get %s:usb_gpio_pins structure\n",
+ dev_name(device));
+
+ return PTR_ERR(usb_gpio_pins);
+ }
+ return 0;
+}
+static void put_gpio(void)
+{
+ ux500_pins_put(usb_gpio_pins);
+}
+struct ab8500_usbgpio_platform_data ab8500_usbgpio_plat_data = {
+ .get = &get_gpio,
+ .enable = &enable_gpio,
+ .disable = &disable_gpio,
+ .put = &put_gpio,
+};
+
static inline void ux500_usb_dma_update_rx_ch_config(int *src_dev_type)
{
u32 idx;