Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422740AbWLUP3q (ORCPT ); Thu, 21 Dec 2006 10:29:46 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1422861AbWLUP3q (ORCPT ); Thu, 21 Dec 2006 10:29:46 -0500 Received: from an-out-0708.google.com ([209.85.132.247]:49448 "EHLO an-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422740AbWLUP3p (ORCPT ); Thu, 21 Dec 2006 10:29:45 -0500 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=eb12bPI1ZDg8yXui+r8jtifScUWBfx5C9iuz5sfvTrZrJatN1cRbm0d5vtyv82lpNoF5KusRugGSmyFOnFz1RL3vS1HZIodU1qd/s1YveJlYmMMv21LE3r/3MMKoA4wvEgdhirdIWH3DNCJye8kNT2tu38bLd9FzjAVj/6JYYn8= Message-ID: <74d0deb30612210729g65dd6b3cr7594ae6cd0f8055e@mail.gmail.com> Date: Thu, 21 Dec 2006 16:29:44 +0100 From: "pHilipp Zabel" To: "Arnaud Patard" Subject: Re: [patch 2.6.20-rc1 6/6] S3C2410 GPIO wrappers Cc: "David Brownell" , "Linux Kernel list" , "Andrew Morton" , "Andrew Victor" , "Bill Gatliff" , "Haavard Skinnemoen" , jamey.hicks@hp.com, "Kevin Hilman" , "Nicolas Pitre" , "Russell King" , "Tony Lindgren" , "Ben Dooks" In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_34249_9091914.1166714984301" References: <200611111541.34699.david-b@pacbell.net> <200612201304.03912.david-b@pacbell.net> <200612201314.19905.david-b@pacbell.net> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 9497 Lines: 260 ------=_Part_34249_9091914.1166714984301 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 12/21/06, Arnaud Patard wrote: > (adding Ben Dooks as he's taking care of s3c24xx stuff) > > David Brownell writes: > > > Note that I neither tested it nor build tested it. It's only remarks I > have when I read the code. Thanks for looking through this. I originally just sent this (admittedly rushed) patch to kernel-discuss@handhelds.org to get some eyes on it. Sorry about that. I have no S3C24xx machine, so I'd like very much somebody and with some insight to S3C24xx who can test to try and correct this. > > Arch-neutral GPIO calls for S3C24xx. > > > > From: Philipp Zabel > > > > Index: at91/include/asm-arm/arch-s3c2410/gpio.h > > =================================================================== > > --- /dev/null 1970-01-01 00:00:00.000000000 +0000 > > +++ at91/include/asm-arm/arch-s3c2410/gpio.h 2006-12-19 02:05:52.000000000 -0800 > > @@ -0,0 +1,65 @@ > > +/* > > + * linux/include/asm-arm/arch-pxa/gpio.h > > arch-pxa ? forgot to change it ? :) Exactly. > > + * > > + * S3C2400 GPIO wrappers for arch-neutral GPIO calls > > you meant S3C2410 ? I got a little confused with s3c2410 being the name for all s3c24xx architectures. > > + * > > + * Written by Philipp Zabel > > + * > > + * This program is free software; you can redistribute it and/or modify > > + * it under the terms of the GNU General Public License as published by > > + * the Free Software Foundation; either version 2 of the License, or > > + * (at your option) any later version. > > + * > > + * This program is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > + * GNU General Public License for more details. > > + * > > + * You should have received a copy of the GNU General Public License > > + * along with this program; if not, write to the Free Software > > + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > > + * > > + */ > > + > > +#ifndef __ASM_ARCH_PXA_GPIO_H > > +#define __ASM_ARCH_PXA_GPIO_H > > pxa again :( Not anymore. > > + > > +#include > > That's annoying. include/asm-arm/arch-s3c2410/pxa-regs.h doesn't > exist. Lack of build testing ? Yes, see above. > > +#include > > imho, this is not needed. The user who will use irq will add it in his > code anyway. Ok. > > +#include > > + > > +#include > > Is it really needed ? No. I copied this from David's example, but with gpio_request and gpio_free not implemented and missing error handling in s3c2410_gpio_cfgpin, no error codes are needed. > > + > > +static inline int gpio_request(unsigned gpio, const char *label) > > +{ > > + return 0; > > +} > > + > > +static inline void gpio_free(unsigned gpio) > > +{ > > + return; > > +} > > + > > +static inline int gpio_direction_input(unsigned gpio) > > +{ > > + s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_INPUT); > > + return 0; > > +} > > + > > +static inline int gpio_direction_output(unsigned gpio) > > +{ > > + s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_OUTPUT); > > + return 0; > > +} > > + > > +#define gpio_get_value(gpio) s3c2410_gpio_getpin(gpio) > > +#define gpio_set_value(gpio,value) s3c2410_gpio_setpin(gpio, value) > > + > > +#include /* cansleep wrappers */ > > + > > +/* FIXME or maybe s3c2400_gpio_getirq() ... */ > > +#define gpio_to_irq(gpio) s3c2410_gpio_getirq(gpio) > > imho, this should be fixed even if the s3c2400 is not 100% supported in > mainline. Ok. Could anybody knowledgeable provide an irq_to_gpio function? regards Philipp Index: linux-2.6/include/asm-arm/arch-s3c2410/gpio.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ linux-2.6/include/asm-arm/arch-s3c2410/gpio.h 2006-12-21 13:25:44.000000000 +0100 @@ -0,0 +1,65 @@ +/* + * linux/include/asm-arm/arch-pxa/gpio.h + * + * S3C2410 GPIO wrappers for arch-neutral GPIO calls + * + * Written by Philipp Zabel + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __ASM_ARCH_S3C2410_GPIO_H +#define __ASM_ARCH_S3C2410_GPIO_H + +#include +#include + +static inline int gpio_request(unsigned gpio, const char *label) +{ + return 0; +} + +static inline void gpio_free(unsigned gpio) +{ + return; +} + +static inline int gpio_direction_input(unsigned gpio) +{ + s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_INPUT); + return 0; +} + +static inline int gpio_direction_output(unsigned gpio) +{ + s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_OUTPUT); + return 0; +} + +#define gpio_get_value(gpio) s3c2410_gpio_getpin(gpio) +#define gpio_set_value(gpio,value) s3c2410_gpio_setpin(gpio, value) + +#include /* cansleep wrappers */ + +#ifdef CONFIG_CPU_S3C2400 +#define gpio_to_irq(gpio) s3c2400_gpio_getirq(gpio) +#else +#define gpio_to_irq(gpio) s3c2410_gpio_getirq(gpio) +#endif /* CONFIG_CPU_S3C2400 */ + +/* FIXME implement irq_to_gpio() */ + +#endif ------=_Part_34249_9091914.1166714984301 Content-Type: text/x-patch; name=gpio-calls-s3c24xx.patch; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: base64 X-Attachment-Id: f_evzbsw5t Content-Disposition: attachment; filename="gpio-calls-s3c24xx.patch" SW5kZXg6IGxpbnV4LTIuNi9pbmNsdWRlL2FzbS1hcm0vYXJjaC1zM2MyNDEwL2dwaW8uaAo9PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09Ci0tLSAvZGV2L251bGwJMTk3MC0wMS0wMSAwMDowMDowMC4wMDAwMDAwMDAgKzAwMDAK KysrIGxpbnV4LTIuNi9pbmNsdWRlL2FzbS1hcm0vYXJjaC1zM2MyNDEwL2dwaW8uaAkyMDA2LTEy LTIxIDEzOjI1OjQ0LjAwMDAwMDAwMCArMDEwMApAQCAtMCwwICsxLDY1IEBACisvKgorICogbGlu dXgvaW5jbHVkZS9hc20tYXJtL2FyY2gtcHhhL2dwaW8uaAorICo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wMAorI2RlZmluZSBncGlvX3Rv X2lycShncGlvKQkJczNjMjQwMF9ncGlvX2dldGlycShncGlvKQorI2Vsc2UKKyNkZWZpbmUgZ3Bp b190b19pcnEoZ3BpbykJCXMzYzI0MTBfZ3Bpb19nZXRpcnEoZ3BpbykKKyNlbmRpZiAvKiBDT05G SUdfQ1BVX1MzQzI0MDAgKi8KKworLyogRklYTUUgaW1wbGVtZW50IGlycV90b19ncGlvKCkgKi8K KworI2VuZGlmCg== ------=_Part_34249_9091914.1166714984301-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/