s3c2440-dsc.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #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. #include <asm/mach/arch.h>
  23. #include <asm/mach/map.h>
  24. #include <asm/mach/irq.h>
  25. #include <asm/hardware.h>
  26. #include <asm/io.h>
  27. #include <asm/irq.h>
  28. #include <asm/arch/regs-gpio.h>
  29. #include <asm/arch/regs-dsc.h>
  30. #include "cpu.h"
  31. #include "s3c2440.h"
  32. int s3c2440_set_dsc(unsigned int pin, unsigned int value)
  33. {
  34. void __iomem *base;
  35. unsigned long val;
  36. unsigned long flags;
  37. unsigned long mask;
  38. base = (pin & S3C2440_SELECT_DSC1) ? S3C2440_DSC1 : S3C2440_DSC0;
  39. mask = 3 << S3C2440_DSC_GETSHIFT(pin);
  40. local_irq_save(flags);
  41. val = __raw_readl(base);
  42. val &= ~mask;
  43. val |= value & mask;
  44. __raw_writel(val, base);
  45. local_irq_restore(flags);
  46. return 0;
  47. }
  48. EXPORT_SYMBOL(s3c2440_set_dsc);