Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / arch / arm / mach-pxa / pxa2xx.c
blob35c23a5d73a330fe4ce411a90b26c2f55bd4f8be
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * linux/arch/arm/mach-pxa/pxa2xx.c
5 * code specific to pxa2xx
7 * Copyright (C) 2008 Dmitry Baryshkov
8 */
10 #include <linux/module.h>
11 #include <linux/kernel.h>
12 #include <linux/device.h>
13 #include <linux/io.h>
15 #include "pxa2xx-regs.h"
16 #include "mfp-pxa25x.h"
17 #include "generic.h"
18 #include "reset.h"
19 #include "smemc.h"
20 #include <linux/soc/pxa/smemc.h>
22 void pxa2xx_clear_reset_status(unsigned int mask)
24 /* RESET_STATUS_* has a 1:1 mapping with RCSR */
25 RCSR = mask;
28 #define MDCNFG_DRAC2(mdcnfg) (((mdcnfg) >> 21) & 0x3)
29 #define MDCNFG_DRAC0(mdcnfg) (((mdcnfg) >> 5) & 0x3)
31 int pxa2xx_smemc_get_sdram_rows(void)
33 static int sdram_rows;
34 unsigned int drac2 = 0, drac0 = 0;
35 u32 mdcnfg;
37 if (sdram_rows)
38 return sdram_rows;
40 mdcnfg = readl_relaxed(MDCNFG);
42 if (mdcnfg & (MDCNFG_DE2 | MDCNFG_DE3))
43 drac2 = MDCNFG_DRAC2(mdcnfg);
45 if (mdcnfg & (MDCNFG_DE0 | MDCNFG_DE1))
46 drac0 = MDCNFG_DRAC0(mdcnfg);
48 sdram_rows = 1 << (11 + max(drac0, drac2));
49 return sdram_rows;