From dbaryshkov@gmail.com Fri Dec 7 00:05:32 2007 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on 3080.s.tld.pl X-Spam-Level: X-Spam-Status: No, score=1.0 required=5.0 tests=BAYES_40,SPF_FAIL autolearn=disabled version=3.1.7 Delivered-To: haerwu.biz-marcin@haerwu.biz Received: (qmail 3062 invoked by uid 813007); 6 Dec 2007 23:44:39 -0000 Delivered-To: haerwu.biz-openembedded@haerwu.biz Received: (qmail 3048 invoked by uid 813007); 6 Dec 2007 23:44:39 -0000 X-clamdmail: clamdmail 0.18a Received: from zeniv.linux.org.uk (195.92.253.2) by smtp.host4.kei.pl with SMTP; 6 Dec 2007 23:44:38 -0000 Received: from [2002:4e20:1eda:1:201:3dff:fe00:156] (helo=lists.arm.linux.org.uk) by ZenIV.linux.org.uk with esmtpsa (Exim 4.63 #1 (Red Hat Linux)) id 1J0Pts-0004dN-KF; Thu, 06 Dec 2007 23:13:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.arm.linux.org.uk) by lists.arm.linux.org.uk with esmtp (Exim 4.50) id 1J0Pr7-0000cF-OJ; Thu, 06 Dec 2007 23:10:10 +0000 Received: from mu-out-0910.google.com ([209.85.134.185]) by lists.arm.linux.org.uk with esmtp (Exim 4.50) id 1J0Pn3-0000bt-0E for linux-arm-kernel@lists.arm.linux.org.uk; Thu, 06 Dec 2007 23:06:40 +0000 Received: by mu-out-0910.google.com with SMTP id i2so13552mue for ; Thu, 06 Dec 2007 15:05:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:to:subject:message-id:mime-version:content-type:content-disposition:user-agent:from; bh=cfa4MUFsOjAsSKDax5Yk97Hu762FByFSAfUQi5KP2cc=; b=aA5uLmMsFBL6uxIQjxwtR4vD/2zBfGHiN/xepdZSggrNmYu0DJ75Q8JsSqzU/z7Vh9hALIiHjCR3WeqlJqZKCBMSrANzpFN4KVunUajamxn85btZMYysQ3YuZI+DUTYPovoZhuPjmT+SUT7RFpOhwKXbs7z9J8DCgodOVS+YwEY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:to:subject:message-id:mime-version:content-type:content-disposition:user-agent:from; b=oWC1DMK+88t4jXf/5sY2gvSAjKuYypZhUflAHvCNbKYn2iFzpEFoFfjcUgV+lArS06OuT/R4v4Cp87JGK1NLA/uei3fhFZwNsoHcqWkgdsOqp5dSWMZFWCCrO4ODJahoFlnsxoS6OiceJM6EKX8u3RTELEVZEnVl3H2HWM4JJh4= Received: by 10.82.107.15 with SMTP id f15mr9802870buc.1196982339522; Thu, 06 Dec 2007 15:05:39 -0800 (PST) Received: from doriath.ww600.siemens.net ( [91.122.9.34]) by mx.google.com with ESMTPS id 5sm15474nfv.2007.12.06.15.05.37 (version=SSLv3 cipher=OTHER); Thu, 06 Dec 2007 15:05:38 -0800 (PST) Date: Fri, 7 Dec 2007 02:05:32 +0300 To: linux-arm-kernel@lists.arm.linux.org.uk Message-ID: <20071206230532.GA13332@doriath.ww600.siemens.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.17 (2007-11-01) From: Dmitry Baryshkov Subject: [PATCH 1/2] pxa2xx_udc_support_inverse_vbus.patch X-BeenThere: linux-arm-kernel@lists.arm.linux.org.uk X-Mailman-Version: 2.1.5 Precedence: list List-Id: ARM Linux kernel discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.arm.linux.org.uk Errors-To: linux-arm-kernel-bounces+openembedded=haerwu.biz+openembedded=haerwu.biz@lists.arm.linux.org.uk X-Length: 5827 Status: R X-Status: NC X-KMail-EncryptionState: X-KMail-SignatureState: X-KMail-MDN-Sent: Some pxa-based boards (like e.g. tosa) have the VBUS-detection gpio pin inverted. I.e. it's low when VBUS is connected and high when disconnected. Allow specifiing whether gpio_vbus value is inverted. Signed-off-by: Dmitry Baryshkov Index: linux-test/drivers/usb/gadget/pxa2xx_udc.c =================================================================== --- linux-test.orig/drivers/usb/gadget/pxa2xx_udc.c 2007-12-06 12:41:25.784337009 +0300 +++ linux-test/drivers/usb/gadget/pxa2xx_udc.c 2007-12-06 13:39:33.504345084 +0300 @@ -125,8 +125,12 @@ static int is_vbus_present(void) { struct pxa2xx_udc_mach_info *mach = the_controller->mach; - if (mach->gpio_vbus) - return gpio_get_value(mach->gpio_vbus); + if (mach->gpio_vbus) { + int value = gpio_get_value(mach->gpio_vbus); + return mach->gpio_vbus_inverted ? + !value : + value; + } if (mach->udc_is_connected) return mach->udc_is_connected(); return 1; @@ -1396,6 +1400,9 @@ static irqreturn_t udc_vbus_irq(int irq, struct pxa2xx_udc *dev = _dev; int vbus = gpio_get_value(dev->mach->gpio_vbus); + if (dev->mach->gpio_vbus_inverted) + vbus = !vbus; + pxa2xx_udc_vbus_session(&dev->gadget, vbus); return IRQ_HANDLED; } Index: linux-test/include/asm-arm/mach/udc_pxa2xx.h =================================================================== --- linux-test.orig/include/asm-arm/mach/udc_pxa2xx.h 2007-12-06 12:38:49.872349393 +0300 +++ linux-test/include/asm-arm/mach/udc_pxa2xx.h 2007-12-06 12:41:03.594903549 +0300 @@ -22,5 +22,6 @@ struct pxa2xx_udc_mach_info { */ u16 gpio_vbus; /* high == vbus present */ u16 gpio_pullup; /* high == pullup activated */ + unsigned char gpio_vbus_inverted:1; }; ------------------------------------------------------------------- List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php