sam9_smc.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * linux/arch/arm/mach-at91/sam9_smc.c
  3. *
  4. * Copyright (C) 2008 Andrew Victor
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/module.h>
  11. #include <linux/io.h>
  12. #include <mach/at91sam9_smc.h>
  13. #include "sam9_smc.h"
  14. void __init sam9_smc_configure(int cs, struct sam9_smc_config* config)
  15. {
  16. /* Setup register */
  17. at91_sys_write(AT91_SMC_SETUP(cs),
  18. AT91_SMC_NWESETUP_(config->nwe_setup)
  19. | AT91_SMC_NCS_WRSETUP_(config->ncs_write_setup)
  20. | AT91_SMC_NRDSETUP_(config->nrd_setup)
  21. | AT91_SMC_NCS_RDSETUP_(config->ncs_read_setup)
  22. );
  23. /* Pulse register */
  24. at91_sys_write(AT91_SMC_PULSE(cs),
  25. AT91_SMC_NWEPULSE_(config->nwe_pulse)
  26. | AT91_SMC_NCS_WRPULSE_(config->ncs_write_pulse)
  27. | AT91_SMC_NRDPULSE_(config->nrd_pulse)
  28. | AT91_SMC_NCS_RDPULSE_(config->ncs_read_pulse)
  29. );
  30. /* Cycle register */
  31. at91_sys_write(AT91_SMC_CYCLE(cs),
  32. AT91_SMC_NWECYCLE_(config->write_cycle)
  33. | AT91_SMC_NRDCYCLE_(config->read_cycle)
  34. );
  35. /* Mode register */
  36. at91_sys_write(AT91_SMC_MODE(cs),
  37. config->mode
  38. | AT91_SMC_TDF_(config->tdf_cycles)
  39. );
  40. }