1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-pxa/pxa2xx.c
5 * code specific to pxa2xx
7 * Copyright (C) 2008 Dmitry Baryshkov
10 #include <linux/module.h>
11 #include <linux/kernel.h>
12 #include <linux/device.h>
15 #include "pxa2xx-regs.h"
16 #include "mfp-pxa25x.h"
20 #include <linux/soc/pxa/smemc.h>
21 #include <linux/platform_data/irda-pxaficp.h>
23 void pxa2xx_clear_reset_status(unsigned int mask)
25 /* RESET_STATUS_* has a 1:1 mapping with RCSR */
29 static unsigned long pxa2xx_mfp_fir[] = {
34 static unsigned long pxa2xx_mfp_sir[] = {
39 static unsigned long pxa2xx_mfp_off[] = {
40 GPIO46_GPIO | MFP_LPM_DRIVE_LOW,
41 GPIO47_GPIO | MFP_LPM_DRIVE_LOW,
44 void pxa2xx_transceiver_mode(struct device *dev, int mode)
47 pxa2xx_mfp_config(pxa2xx_mfp_off, ARRAY_SIZE(pxa2xx_mfp_off));
48 } else if (mode & IR_SIRMODE) {
49 pxa2xx_mfp_config(pxa2xx_mfp_sir, ARRAY_SIZE(pxa2xx_mfp_sir));
50 } else if (mode & IR_FIRMODE) {
51 pxa2xx_mfp_config(pxa2xx_mfp_fir, ARRAY_SIZE(pxa2xx_mfp_fir));
55 EXPORT_SYMBOL_GPL(pxa2xx_transceiver_mode);
57 #define MDCNFG_DRAC2(mdcnfg) (((mdcnfg) >> 21) & 0x3)
58 #define MDCNFG_DRAC0(mdcnfg) (((mdcnfg) >> 5) & 0x3)
60 int pxa2xx_smemc_get_sdram_rows(void)
62 static int sdram_rows;
63 unsigned int drac2 = 0, drac0 = 0;
69 mdcnfg = readl_relaxed(MDCNFG);
71 if (mdcnfg & (MDCNFG_DE2 | MDCNFG_DE3))
72 drac2 = MDCNFG_DRAC2(mdcnfg);
74 if (mdcnfg & (MDCNFG_DE0 | MDCNFG_DE1))
75 drac0 = MDCNFG_DRAC0(mdcnfg);
77 sdram_rows = 1 << (11 + max(drac0, drac2));