0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <linux/module.h>
0011 #include <linux/kernel.h>
0012 #include <linux/device.h>
0013 #include <linux/io.h>
0014
0015 #include "pxa2xx-regs.h"
0016 #include "mfp-pxa25x.h"
0017 #include "generic.h"
0018 #include "reset.h"
0019 #include "smemc.h"
0020 #include <linux/soc/pxa/smemc.h>
0021 #include <linux/platform_data/irda-pxaficp.h>
0022
0023 void pxa2xx_clear_reset_status(unsigned int mask)
0024 {
0025
0026 RCSR = mask;
0027 }
0028
0029 static unsigned long pxa2xx_mfp_fir[] = {
0030 GPIO46_FICP_RXD,
0031 GPIO47_FICP_TXD,
0032 };
0033
0034 static unsigned long pxa2xx_mfp_sir[] = {
0035 GPIO46_STUART_RXD,
0036 GPIO47_STUART_TXD,
0037 };
0038
0039 static unsigned long pxa2xx_mfp_off[] = {
0040 GPIO46_GPIO | MFP_LPM_DRIVE_LOW,
0041 GPIO47_GPIO | MFP_LPM_DRIVE_LOW,
0042 };
0043
0044 void pxa2xx_transceiver_mode(struct device *dev, int mode)
0045 {
0046 if (mode & IR_OFF) {
0047 pxa2xx_mfp_config(pxa2xx_mfp_off, ARRAY_SIZE(pxa2xx_mfp_off));
0048 } else if (mode & IR_SIRMODE) {
0049 pxa2xx_mfp_config(pxa2xx_mfp_sir, ARRAY_SIZE(pxa2xx_mfp_sir));
0050 } else if (mode & IR_FIRMODE) {
0051 pxa2xx_mfp_config(pxa2xx_mfp_fir, ARRAY_SIZE(pxa2xx_mfp_fir));
0052 } else
0053 BUG();
0054 }
0055 EXPORT_SYMBOL_GPL(pxa2xx_transceiver_mode);
0056
0057 #define MDCNFG_DRAC2(mdcnfg) (((mdcnfg) >> 21) & 0x3)
0058 #define MDCNFG_DRAC0(mdcnfg) (((mdcnfg) >> 5) & 0x3)
0059
0060 int pxa2xx_smemc_get_sdram_rows(void)
0061 {
0062 static int sdram_rows;
0063 unsigned int drac2 = 0, drac0 = 0;
0064 u32 mdcnfg;
0065
0066 if (sdram_rows)
0067 return sdram_rows;
0068
0069 mdcnfg = readl_relaxed(MDCNFG);
0070
0071 if (mdcnfg & (MDCNFG_DE2 | MDCNFG_DE3))
0072 drac2 = MDCNFG_DRAC2(mdcnfg);
0073
0074 if (mdcnfg & (MDCNFG_DE0 | MDCNFG_DE1))
0075 drac0 = MDCNFG_DRAC0(mdcnfg);
0076
0077 sdram_rows = 1 << (11 + max(drac0, drac2));
0078 return sdram_rows;
0079 }