This commit was generated by cvs2svn to compensate for changes in r517,
[linux-2.6.git] / arch / arm / mach-s3c2410 / s3c2440-dsc.c
1 /* linux/arch/arm/mach-s3c2410/s3c2440-dsc.c
2  *
3  * Copyright (c) 2004 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.
11  *
12  * Modifications:
13  *     29-Aug-2004 BJD  Start of drive-strength control
14  *     09-Nov-2004 BJD  Added symbol export
15 */
16
17 #include <linux/kernel.h>
18 #include <linux/types.h>
19 #include <linux/interrupt.h>
20 #include <linux/init.h>
21 #include <linux/module.h>
22
23 #include <asm/mach/arch.h>
24 #include <asm/mach/map.h>
25 #include <asm/mach/irq.h>
26
27 #include <asm/hardware.h>
28 #include <asm/io.h>
29 #include <asm/irq.h>
30
31 #include <asm/arch/regs-gpio.h>
32 #include <asm/arch/regs-dsc.h>
33
34 #include "s3c2440.h"
35 #include "cpu.h"
36
37 int s3c2440_set_dsc(unsigned int pin, unsigned int value)
38 {
39         unsigned long base;
40         unsigned long val;
41         unsigned long flags;
42         unsigned long mask;
43
44         base = (pin & S3C2440_SELECT_DSC1) ? S3C2440_DSC1 : S3C2440_DSC0;
45         mask = 3 << S3C2440_DSC_GETSHIFT(pin);
46
47         local_irq_save(flags);
48
49         val = __raw_readl(base);
50         val &= ~mask;
51         val |= value & mask;
52         __raw_writel(val, base);
53
54         local_irq_restore(flags);
55         return 0;
56 }
57
58 EXPORT_SYMBOL(s3c2440_set_dsc);