| Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s3c2440/dsc.c | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 |  * | 
 | 3 |  * Copyright (c) 2004-2005 Simtec Electronics | 
 | 4 |  *   Ben Dooks <ben@simtec.co.uk> | 
 | 5 |  * | 
 | 6 |  * Samsung S3C2440 Drive Strength Control support | 
 | 7 |  * | 
 | 8 |  * This program is free software; you can redistribute it and/or modify | 
 | 9 |  * it under the terms of the GNU General Public License version 2 as | 
 | 10 |  * published by the Free Software Foundation. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | */ | 
 | 12 |  | 
 | 13 | #include <linux/kernel.h> | 
 | 14 | #include <linux/types.h> | 
 | 15 | #include <linux/interrupt.h> | 
 | 16 | #include <linux/init.h> | 
 | 17 | #include <linux/module.h> | 
| Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 18 | #include <linux/io.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 |  | 
 | 20 | #include <asm/mach/arch.h> | 
 | 21 | #include <asm/mach/map.h> | 
 | 22 | #include <asm/mach/irq.h> | 
 | 23 |  | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 24 | #include <mach/hardware.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #include <asm/irq.h> | 
 | 26 |  | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 27 | #include <mach/regs-gpio.h> | 
 | 28 | #include <mach/regs-dsc.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 |  | 
| Ben Dooks | a2b7ba9 | 2008-10-07 22:26:09 +0100 | [diff] [blame] | 30 | #include <plat/cpu.h> | 
| Ben Dooks | 84c9b72 | 2010-01-26 16:54:21 +0900 | [diff] [blame] | 31 | #include <plat/s3c244x.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 |  | 
 | 33 | int s3c2440_set_dsc(unsigned int pin, unsigned int value) | 
 | 34 | { | 
 | 35 | 	void __iomem *base; | 
 | 36 | 	unsigned long val; | 
 | 37 | 	unsigned long flags; | 
 | 38 | 	unsigned long mask; | 
 | 39 |  | 
 | 40 | 	base = (pin & S3C2440_SELECT_DSC1) ? S3C2440_DSC1 : S3C2440_DSC0; | 
 | 41 | 	mask = 3 << S3C2440_DSC_GETSHIFT(pin); | 
 | 42 |  | 
 | 43 | 	local_irq_save(flags); | 
 | 44 |  | 
 | 45 | 	val = __raw_readl(base); | 
 | 46 | 	val &= ~mask; | 
 | 47 | 	val |= value & mask; | 
 | 48 | 	__raw_writel(val, base); | 
 | 49 |  | 
 | 50 | 	local_irq_restore(flags); | 
 | 51 | 	return 0; | 
 | 52 | } | 
 | 53 |  | 
 | 54 | EXPORT_SYMBOL(s3c2440_set_dsc); |