| gpio-upd1.patch | | Files affected: | arch/arm/mach-s3c2410/gpio.c | 29 28 + 1 - 0 ! | include/asm-arm/arch-s3c2410/hardware.h | 5 5 + 0 - 0 ! | 2 files changed, 33 insertions(+), 1 deletion(-) | | Ben Dooks, Thu, 07 Oct 2004 15:43:58 +0100 --- linux-2.6.9-rc1-bk18/arch/arm/mach-s3c2410/gpio.c 2004-09-12 17:18:05.000000000 +0100 +++ linux-2.6.9-rc1-bk18-usb1/arch/arm/mach-s3c2410/gpio.c 2004-09-12 16:59:08.000000000 +0100 @@ -19,6 +19,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * Changelog + * 13-Sep-2004 BJD Implemented change of MISCCR + * 14-Sep-2004 BJD Added getpin call + * 14-Sep-2004 BJD Fixed bug in setpin() call */ @@ -90,9 +94,32 @@ local_irq_save(flags); dat = __raw_readl(base + 0x04); - dat &= 1 << offs; + dat &= ~(1 << offs); dat |= to << offs; __raw_writel(dat, base + 0x04); local_irq_restore(flags); } + +unsigned int s3c2410_gpio_getpin(unsigned int pin) +{ + unsigned long base = S3C2410_GPIO_BASE(pin); + unsigned long offs = S3C2410_GPIO_OFFSET(pin); + + return __raw_readl(base + 0x04) & (1<< offs); +} + +unsigned int s3c2410_modify_misccr(unsigned int clear, unsigned int change) +{ + unsigned long flags; + unsigned long misccr; + + local_irq_save(flags); + misccr = __raw_readl(S3C2410_MISCCR); + misccr &= ~clear; + misccr ^= change; + __raw_writel(misccr, S3C2410_MISCCR); + local_irq_restore(flags); + + return misccr; +} --- linux-2.6.9-rc1-bk18/include/asm-arm/arch-s3c2410/hardware.h 2004-09-12 17:18:06.000000000 +0100 +++ linux-2.6.9-rc1-bk18-usb1/include/asm-arm/arch-s3c2410/hardware.h 2004-09-12 17:15:18.000000000 +0100 @@ -14,6 +14,7 @@ * 06-Jun-2003 BJD Added CPU frequency settings * 03-Sep-2003 BJD Linux v2.6 support * 12-Mar-2004 BJD Fixed include protection, fixed type of clock vars + * 14-Sep-2004 BJD Added misccr and getpin to gpio */ #ifndef __ASM_ARCH_HARDWARE_H @@ -61,6 +62,10 @@ extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to); +extern unsigned int s3c2410_gpio_getpin(unsigned int pin); + +extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg); + #endif /* __ASSEMBLY__ */ #include