dsc.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* linux/arch/arm/mach-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. #include <linux/kernel.h>
  13. #include <linux/types.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/init.h>
  16. #include <linux/module.h>
  17. #include <asm/mach/arch.h>
  18. #include <asm/mach/map.h>
  19. #include <asm/mach/irq.h>
  20. #include <asm/hardware.h>
  21. #include <asm/io.h>
  22. #include <asm/irq.h>
  23. #include <asm/arch/regs-gpio.h>
  24. #include <asm/arch/regs-dsc.h>
  25. #include <asm/plat-s3c24xx/cpu.h>
  26. #include <asm/plat-s3c24xx/s3c2440.h>
  27. int s3c2440_set_dsc(unsigned int pin, unsigned int value)
  28. {
  29. void __iomem *base;
  30. unsigned long val;
  31. unsigned long flags;
  32. unsigned long mask;
  33. base = (pin & S3C2440_SELECT_DSC1) ? S3C2440_DSC1 : S3C2440_DSC0;
  34. mask = 3 << S3C2440_DSC_GETSHIFT(pin);
  35. local_irq_save(flags);
  36. val = __raw_readl(base);
  37. val &= ~mask;
  38. val |= value & mask;
  39. __raw_writel(val, base);
  40. local_irq_restore(flags);
  41. return 0;
  42. }
  43. EXPORT_SYMBOL(s3c2440_set_dsc);