pxa2xx.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * linux/arch/arm/mach-pxa/pxa2xx.c
  4. *
  5. * code specific to pxa2xx
  6. *
  7. * Copyright (C) 2008 Dmitry Baryshkov
  8. */
  9. #include <linux/module.h>
  10. #include <linux/kernel.h>
  11. #include <linux/device.h>
  12. #include <linux/io.h>
  13. #include "pxa2xx-regs.h"
  14. #include "mfp-pxa25x.h"
  15. #include "generic.h"
  16. #include "reset.h"
  17. #include "smemc.h"
  18. #include <linux/soc/pxa/smemc.h>
  19. void pxa2xx_clear_reset_status(unsigned int mask)
  20. {
  21. /* RESET_STATUS_* has a 1:1 mapping with RCSR */
  22. RCSR = mask;
  23. }
  24. #define MDCNFG_DRAC2(mdcnfg) (((mdcnfg) >> 21) & 0x3)
  25. #define MDCNFG_DRAC0(mdcnfg) (((mdcnfg) >> 5) & 0x3)
  26. int pxa2xx_smemc_get_sdram_rows(void)
  27. {
  28. static int sdram_rows;
  29. unsigned int drac2 = 0, drac0 = 0;
  30. u32 mdcnfg;
  31. if (sdram_rows)
  32. return sdram_rows;
  33. mdcnfg = readl_relaxed(MDCNFG);
  34. if (mdcnfg & (MDCNFG_DE2 | MDCNFG_DE3))
  35. drac2 = MDCNFG_DRAC2(mdcnfg);
  36. if (mdcnfg & (MDCNFG_DE0 | MDCNFG_DE1))
  37. drac0 = MDCNFG_DRAC0(mdcnfg);
  38. sdram_rows = 1 << (11 + max(drac0, drac2));
  39. return sdram_rows;
  40. }