[PATCH] PCI: clean up msi.c a bit
[linux-2.6/sactl.git] / arch / arm / mach-s3c2410 / s3c2440-dsc.c
blob16fa2a3b38fa02de47a5d24e96bed959352d9143
1 /* linux/arch/arm/mach-s3c2410/s3c2440-dsc.c
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * Samsung S3C2440 Drive Strength Control support
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.
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
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>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/map.h>
26 #include <asm/mach/irq.h>
28 #include <asm/hardware.h>
29 #include <asm/io.h>
30 #include <asm/irq.h>
32 #include <asm/arch/regs-gpio.h>
33 #include <asm/arch/regs-dsc.h>
35 #include "cpu.h"
36 #include "s3c2440.h"
38 int s3c2440_set_dsc(unsigned int pin, unsigned int value)
40 void __iomem *base;
41 unsigned long val;
42 unsigned long flags;
43 unsigned long mask;
45 base = (pin & S3C2440_SELECT_DSC1) ? S3C2440_DSC1 : S3C2440_DSC0;
46 mask = 3 << S3C2440_DSC_GETSHIFT(pin);
48 local_irq_save(flags);
50 val = __raw_readl(base);
51 val &= ~mask;
52 val |= value & mask;
53 __raw_writel(val, base);
55 local_irq_restore(flags);
56 return 0;
59 EXPORT_SYMBOL(s3c2440_set_dsc);