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