>From c03bfb5dc571ee2cfe99c75edcda889160f255a1 Mon Sep 17 00:00:00 2001
From: Jiebing Li <[email protected]>
Date: Fri, 22 Oct 2010 15:54:50 +0800
Subject: [PATCH] usb gadget: add support for medfield in Nokia gadget.

This patch for Nokia gadget adds support for medfield. In medfield,
eem/ecm gadget function will not support.

Signed-off-by: Jiebing Li <[email protected]>
---
 drivers/usb/gadget/langwell_udc.c |   15 +++++++++++++++
 drivers/usb/gadget/nokia.c        |   12 ++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/gadget/langwell_udc.c 
b/drivers/usb/gadget/langwell_udc.c
index 00ceded..0e81ed0 100644
--- a/drivers/usb/gadget/langwell_udc.c
+++ b/drivers/usb/gadget/langwell_udc.c
@@ -63,6 +63,14 @@ static const char driver_desc[] = DRIVER_DESC;
 /* controller device global variable */
 static struct langwell_udc     *the_controller;
 
+enum platform {
+       MOORESTOWN = 0,
+       MEDFIELD,
+};
+
+static enum platform platform_data;
+
+
 /* for endpoint 0 operations */
 static const struct usb_endpoint_descriptor
 langwell_ep0_desc = {
@@ -3324,6 +3332,13 @@ static int langwell_udc_probe(struct pci_dev *pdev,
        dev->gadget.dev.release = gadget_release;
        dev->gadget.name = driver_name;         /* gadget name */
 
+       if (pdev->device == 0x0811)
+               platform_data = MOORESTOWN;
+       else if (pdev->device == 0x0829)
+               platform_data = MEDFIELD;
+
+       dev->gadget.dev.platform_data = &platform_data;
+
        /* controller endpoints reinit */
        eps_reinit(dev);
 
diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c
index f1c2647..f040e92 100644
--- a/drivers/usb/gadget/nokia.c
+++ b/drivers/usb/gadget/nokia.c
@@ -115,9 +115,12 @@ MODULE_LICENSE("GPL");
 
 static u8 hostaddr[ETH_ALEN];
 
+static struct usb_gadget *nokia_gadget = NULL;
+
 static int __init nokia_bind_config(struct usb_configuration *c)
 {
        int status = 0;
+       int *platform = NULL;
 
        status = phonet_bind_config(c);
        if (status)
@@ -135,6 +138,13 @@ static int __init nokia_bind_config(struct 
usb_configuration *c)
        if (status)
                printk(KERN_DEBUG "could not bind acm config\n");
 
+       if (nokia_gadget != NULL)
+               platform = nokia_gadget->dev.platform_data;
+
+       if (platform)
+               if (*platform == 1)
+                       return status;
+
        if (use_eem) {
                status = eem_bind_config(c);
                if (status)
@@ -172,6 +182,8 @@ static int __init nokia_bind(struct usb_composite_dev *cdev)
        struct usb_gadget       *gadget = cdev->gadget;
        int                     status;
 
+        nokia_gadget = cdev->gadget;
+
        status = gphonet_setup(cdev->gadget);
        if (status < 0)
                goto err_phonet;
-- 
1.6.0.6

Attachment: 0002-usb-gadget-add-support-for-medfield-in-Nokia-gadget.patch
Description: 0002-usb-gadget-add-support-for-medfield-in-Nokia-gadget.patch

_______________________________________________
Meego-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to