1*b8b572e1SStephen Rothwell /* Freescale Local Bus Controller 2*b8b572e1SStephen Rothwell * 3*b8b572e1SStephen Rothwell * Copyright (c) 2006-2007 Freescale Semiconductor 4*b8b572e1SStephen Rothwell * 5*b8b572e1SStephen Rothwell * Authors: Nick Spence <nick.spence@freescale.com>, 6*b8b572e1SStephen Rothwell * Scott Wood <scottwood@freescale.com> 7*b8b572e1SStephen Rothwell * 8*b8b572e1SStephen Rothwell * This program is free software; you can redistribute it and/or modify 9*b8b572e1SStephen Rothwell * it under the terms of the GNU General Public License as published by 10*b8b572e1SStephen Rothwell * the Free Software Foundation; either version 2 of the License, or 11*b8b572e1SStephen Rothwell * (at your option) any later version. 12*b8b572e1SStephen Rothwell * 13*b8b572e1SStephen Rothwell * This program is distributed in the hope that it will be useful, 14*b8b572e1SStephen Rothwell * but WITHOUT ANY WARRANTY; without even the implied warranty of 15*b8b572e1SStephen Rothwell * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16*b8b572e1SStephen Rothwell * GNU General Public License for more details. 17*b8b572e1SStephen Rothwell * 18*b8b572e1SStephen Rothwell * You should have received a copy of the GNU General Public License 19*b8b572e1SStephen Rothwell * along with this program; if not, write to the Free Software 20*b8b572e1SStephen Rothwell * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21*b8b572e1SStephen Rothwell */ 22*b8b572e1SStephen Rothwell 23*b8b572e1SStephen Rothwell #ifndef __ASM_FSL_LBC_H 24*b8b572e1SStephen Rothwell #define __ASM_FSL_LBC_H 25*b8b572e1SStephen Rothwell 26*b8b572e1SStephen Rothwell #include <linux/types.h> 27*b8b572e1SStephen Rothwell #include <linux/spinlock.h> 28*b8b572e1SStephen Rothwell #include <asm/io.h> 29*b8b572e1SStephen Rothwell 30*b8b572e1SStephen Rothwell struct fsl_lbc_bank { 31*b8b572e1SStephen Rothwell __be32 br; /**< Base Register */ 32*b8b572e1SStephen Rothwell #define BR_BA 0xFFFF8000 33*b8b572e1SStephen Rothwell #define BR_BA_SHIFT 15 34*b8b572e1SStephen Rothwell #define BR_PS 0x00001800 35*b8b572e1SStephen Rothwell #define BR_PS_SHIFT 11 36*b8b572e1SStephen Rothwell #define BR_PS_8 0x00000800 /* Port Size 8 bit */ 37*b8b572e1SStephen Rothwell #define BR_PS_16 0x00001000 /* Port Size 16 bit */ 38*b8b572e1SStephen Rothwell #define BR_PS_32 0x00001800 /* Port Size 32 bit */ 39*b8b572e1SStephen Rothwell #define BR_DECC 0x00000600 40*b8b572e1SStephen Rothwell #define BR_DECC_SHIFT 9 41*b8b572e1SStephen Rothwell #define BR_DECC_OFF 0x00000000 /* HW ECC checking and generation off */ 42*b8b572e1SStephen Rothwell #define BR_DECC_CHK 0x00000200 /* HW ECC checking on, generation off */ 43*b8b572e1SStephen Rothwell #define BR_DECC_CHK_GEN 0x00000400 /* HW ECC checking and generation on */ 44*b8b572e1SStephen Rothwell #define BR_WP 0x00000100 45*b8b572e1SStephen Rothwell #define BR_WP_SHIFT 8 46*b8b572e1SStephen Rothwell #define BR_MSEL 0x000000E0 47*b8b572e1SStephen Rothwell #define BR_MSEL_SHIFT 5 48*b8b572e1SStephen Rothwell #define BR_MS_GPCM 0x00000000 /* GPCM */ 49*b8b572e1SStephen Rothwell #define BR_MS_FCM 0x00000020 /* FCM */ 50*b8b572e1SStephen Rothwell #define BR_MS_SDRAM 0x00000060 /* SDRAM */ 51*b8b572e1SStephen Rothwell #define BR_MS_UPMA 0x00000080 /* UPMA */ 52*b8b572e1SStephen Rothwell #define BR_MS_UPMB 0x000000A0 /* UPMB */ 53*b8b572e1SStephen Rothwell #define BR_MS_UPMC 0x000000C0 /* UPMC */ 54*b8b572e1SStephen Rothwell #define BR_V 0x00000001 55*b8b572e1SStephen Rothwell #define BR_V_SHIFT 0 56*b8b572e1SStephen Rothwell #define BR_RES ~(BR_BA|BR_PS|BR_DECC|BR_WP|BR_MSEL|BR_V) 57*b8b572e1SStephen Rothwell 58*b8b572e1SStephen Rothwell __be32 or; /**< Base Register */ 59*b8b572e1SStephen Rothwell #define OR0 0x5004 60*b8b572e1SStephen Rothwell #define OR1 0x500C 61*b8b572e1SStephen Rothwell #define OR2 0x5014 62*b8b572e1SStephen Rothwell #define OR3 0x501C 63*b8b572e1SStephen Rothwell #define OR4 0x5024 64*b8b572e1SStephen Rothwell #define OR5 0x502C 65*b8b572e1SStephen Rothwell #define OR6 0x5034 66*b8b572e1SStephen Rothwell #define OR7 0x503C 67*b8b572e1SStephen Rothwell 68*b8b572e1SStephen Rothwell #define OR_FCM_AM 0xFFFF8000 69*b8b572e1SStephen Rothwell #define OR_FCM_AM_SHIFT 15 70*b8b572e1SStephen Rothwell #define OR_FCM_BCTLD 0x00001000 71*b8b572e1SStephen Rothwell #define OR_FCM_BCTLD_SHIFT 12 72*b8b572e1SStephen Rothwell #define OR_FCM_PGS 0x00000400 73*b8b572e1SStephen Rothwell #define OR_FCM_PGS_SHIFT 10 74*b8b572e1SStephen Rothwell #define OR_FCM_CSCT 0x00000200 75*b8b572e1SStephen Rothwell #define OR_FCM_CSCT_SHIFT 9 76*b8b572e1SStephen Rothwell #define OR_FCM_CST 0x00000100 77*b8b572e1SStephen Rothwell #define OR_FCM_CST_SHIFT 8 78*b8b572e1SStephen Rothwell #define OR_FCM_CHT 0x00000080 79*b8b572e1SStephen Rothwell #define OR_FCM_CHT_SHIFT 7 80*b8b572e1SStephen Rothwell #define OR_FCM_SCY 0x00000070 81*b8b572e1SStephen Rothwell #define OR_FCM_SCY_SHIFT 4 82*b8b572e1SStephen Rothwell #define OR_FCM_SCY_1 0x00000010 83*b8b572e1SStephen Rothwell #define OR_FCM_SCY_2 0x00000020 84*b8b572e1SStephen Rothwell #define OR_FCM_SCY_3 0x00000030 85*b8b572e1SStephen Rothwell #define OR_FCM_SCY_4 0x00000040 86*b8b572e1SStephen Rothwell #define OR_FCM_SCY_5 0x00000050 87*b8b572e1SStephen Rothwell #define OR_FCM_SCY_6 0x00000060 88*b8b572e1SStephen Rothwell #define OR_FCM_SCY_7 0x00000070 89*b8b572e1SStephen Rothwell #define OR_FCM_RST 0x00000008 90*b8b572e1SStephen Rothwell #define OR_FCM_RST_SHIFT 3 91*b8b572e1SStephen Rothwell #define OR_FCM_TRLX 0x00000004 92*b8b572e1SStephen Rothwell #define OR_FCM_TRLX_SHIFT 2 93*b8b572e1SStephen Rothwell #define OR_FCM_EHTR 0x00000002 94*b8b572e1SStephen Rothwell #define OR_FCM_EHTR_SHIFT 1 95*b8b572e1SStephen Rothwell }; 96*b8b572e1SStephen Rothwell 97*b8b572e1SStephen Rothwell struct fsl_lbc_regs { 98*b8b572e1SStephen Rothwell struct fsl_lbc_bank bank[8]; 99*b8b572e1SStephen Rothwell u8 res0[0x28]; 100*b8b572e1SStephen Rothwell __be32 mar; /**< UPM Address Register */ 101*b8b572e1SStephen Rothwell u8 res1[0x4]; 102*b8b572e1SStephen Rothwell __be32 mamr; /**< UPMA Mode Register */ 103*b8b572e1SStephen Rothwell #define MxMR_OP_NO (0 << 28) /**< normal operation */ 104*b8b572e1SStephen Rothwell #define MxMR_OP_WA (1 << 28) /**< write array */ 105*b8b572e1SStephen Rothwell #define MxMR_OP_RA (2 << 28) /**< read array */ 106*b8b572e1SStephen Rothwell #define MxMR_OP_RP (3 << 28) /**< run pattern */ 107*b8b572e1SStephen Rothwell #define MxMR_MAD 0x3f /**< machine address */ 108*b8b572e1SStephen Rothwell __be32 mbmr; /**< UPMB Mode Register */ 109*b8b572e1SStephen Rothwell __be32 mcmr; /**< UPMC Mode Register */ 110*b8b572e1SStephen Rothwell u8 res2[0x8]; 111*b8b572e1SStephen Rothwell __be32 mrtpr; /**< Memory Refresh Timer Prescaler Register */ 112*b8b572e1SStephen Rothwell __be32 mdr; /**< UPM Data Register */ 113*b8b572e1SStephen Rothwell u8 res3[0x4]; 114*b8b572e1SStephen Rothwell __be32 lsor; /**< Special Operation Initiation Register */ 115*b8b572e1SStephen Rothwell __be32 lsdmr; /**< SDRAM Mode Register */ 116*b8b572e1SStephen Rothwell u8 res4[0x8]; 117*b8b572e1SStephen Rothwell __be32 lurt; /**< UPM Refresh Timer */ 118*b8b572e1SStephen Rothwell __be32 lsrt; /**< SDRAM Refresh Timer */ 119*b8b572e1SStephen Rothwell u8 res5[0x8]; 120*b8b572e1SStephen Rothwell __be32 ltesr; /**< Transfer Error Status Register */ 121*b8b572e1SStephen Rothwell #define LTESR_BM 0x80000000 122*b8b572e1SStephen Rothwell #define LTESR_FCT 0x40000000 123*b8b572e1SStephen Rothwell #define LTESR_PAR 0x20000000 124*b8b572e1SStephen Rothwell #define LTESR_WP 0x04000000 125*b8b572e1SStephen Rothwell #define LTESR_ATMW 0x00800000 126*b8b572e1SStephen Rothwell #define LTESR_ATMR 0x00400000 127*b8b572e1SStephen Rothwell #define LTESR_CS 0x00080000 128*b8b572e1SStephen Rothwell #define LTESR_CC 0x00000001 129*b8b572e1SStephen Rothwell #define LTESR_NAND_MASK (LTESR_FCT | LTESR_PAR | LTESR_CC) 130*b8b572e1SStephen Rothwell __be32 ltedr; /**< Transfer Error Disable Register */ 131*b8b572e1SStephen Rothwell __be32 lteir; /**< Transfer Error Interrupt Register */ 132*b8b572e1SStephen Rothwell __be32 lteatr; /**< Transfer Error Attributes Register */ 133*b8b572e1SStephen Rothwell __be32 ltear; /**< Transfer Error Address Register */ 134*b8b572e1SStephen Rothwell u8 res6[0xC]; 135*b8b572e1SStephen Rothwell __be32 lbcr; /**< Configuration Register */ 136*b8b572e1SStephen Rothwell #define LBCR_LDIS 0x80000000 137*b8b572e1SStephen Rothwell #define LBCR_LDIS_SHIFT 31 138*b8b572e1SStephen Rothwell #define LBCR_BCTLC 0x00C00000 139*b8b572e1SStephen Rothwell #define LBCR_BCTLC_SHIFT 22 140*b8b572e1SStephen Rothwell #define LBCR_AHD 0x00200000 141*b8b572e1SStephen Rothwell #define LBCR_LPBSE 0x00020000 142*b8b572e1SStephen Rothwell #define LBCR_LPBSE_SHIFT 17 143*b8b572e1SStephen Rothwell #define LBCR_EPAR 0x00010000 144*b8b572e1SStephen Rothwell #define LBCR_EPAR_SHIFT 16 145*b8b572e1SStephen Rothwell #define LBCR_BMT 0x0000FF00 146*b8b572e1SStephen Rothwell #define LBCR_BMT_SHIFT 8 147*b8b572e1SStephen Rothwell #define LBCR_INIT 0x00040000 148*b8b572e1SStephen Rothwell __be32 lcrr; /**< Clock Ratio Register */ 149*b8b572e1SStephen Rothwell #define LCRR_DBYP 0x80000000 150*b8b572e1SStephen Rothwell #define LCRR_DBYP_SHIFT 31 151*b8b572e1SStephen Rothwell #define LCRR_BUFCMDC 0x30000000 152*b8b572e1SStephen Rothwell #define LCRR_BUFCMDC_SHIFT 28 153*b8b572e1SStephen Rothwell #define LCRR_ECL 0x03000000 154*b8b572e1SStephen Rothwell #define LCRR_ECL_SHIFT 24 155*b8b572e1SStephen Rothwell #define LCRR_EADC 0x00030000 156*b8b572e1SStephen Rothwell #define LCRR_EADC_SHIFT 16 157*b8b572e1SStephen Rothwell #define LCRR_CLKDIV 0x0000000F 158*b8b572e1SStephen Rothwell #define LCRR_CLKDIV_SHIFT 0 159*b8b572e1SStephen Rothwell u8 res7[0x8]; 160*b8b572e1SStephen Rothwell __be32 fmr; /**< Flash Mode Register */ 161*b8b572e1SStephen Rothwell #define FMR_CWTO 0x0000F000 162*b8b572e1SStephen Rothwell #define FMR_CWTO_SHIFT 12 163*b8b572e1SStephen Rothwell #define FMR_BOOT 0x00000800 164*b8b572e1SStephen Rothwell #define FMR_ECCM 0x00000100 165*b8b572e1SStephen Rothwell #define FMR_AL 0x00000030 166*b8b572e1SStephen Rothwell #define FMR_AL_SHIFT 4 167*b8b572e1SStephen Rothwell #define FMR_OP 0x00000003 168*b8b572e1SStephen Rothwell #define FMR_OP_SHIFT 0 169*b8b572e1SStephen Rothwell __be32 fir; /**< Flash Instruction Register */ 170*b8b572e1SStephen Rothwell #define FIR_OP0 0xF0000000 171*b8b572e1SStephen Rothwell #define FIR_OP0_SHIFT 28 172*b8b572e1SStephen Rothwell #define FIR_OP1 0x0F000000 173*b8b572e1SStephen Rothwell #define FIR_OP1_SHIFT 24 174*b8b572e1SStephen Rothwell #define FIR_OP2 0x00F00000 175*b8b572e1SStephen Rothwell #define FIR_OP2_SHIFT 20 176*b8b572e1SStephen Rothwell #define FIR_OP3 0x000F0000 177*b8b572e1SStephen Rothwell #define FIR_OP3_SHIFT 16 178*b8b572e1SStephen Rothwell #define FIR_OP4 0x0000F000 179*b8b572e1SStephen Rothwell #define FIR_OP4_SHIFT 12 180*b8b572e1SStephen Rothwell #define FIR_OP5 0x00000F00 181*b8b572e1SStephen Rothwell #define FIR_OP5_SHIFT 8 182*b8b572e1SStephen Rothwell #define FIR_OP6 0x000000F0 183*b8b572e1SStephen Rothwell #define FIR_OP6_SHIFT 4 184*b8b572e1SStephen Rothwell #define FIR_OP7 0x0000000F 185*b8b572e1SStephen Rothwell #define FIR_OP7_SHIFT 0 186*b8b572e1SStephen Rothwell #define FIR_OP_NOP 0x0 /* No operation and end of sequence */ 187*b8b572e1SStephen Rothwell #define FIR_OP_CA 0x1 /* Issue current column address */ 188*b8b572e1SStephen Rothwell #define FIR_OP_PA 0x2 /* Issue current block+page address */ 189*b8b572e1SStephen Rothwell #define FIR_OP_UA 0x3 /* Issue user defined address */ 190*b8b572e1SStephen Rothwell #define FIR_OP_CM0 0x4 /* Issue command from FCR[CMD0] */ 191*b8b572e1SStephen Rothwell #define FIR_OP_CM1 0x5 /* Issue command from FCR[CMD1] */ 192*b8b572e1SStephen Rothwell #define FIR_OP_CM2 0x6 /* Issue command from FCR[CMD2] */ 193*b8b572e1SStephen Rothwell #define FIR_OP_CM3 0x7 /* Issue command from FCR[CMD3] */ 194*b8b572e1SStephen Rothwell #define FIR_OP_WB 0x8 /* Write FBCR bytes from FCM buffer */ 195*b8b572e1SStephen Rothwell #define FIR_OP_WS 0x9 /* Write 1 or 2 bytes from MDR[AS] */ 196*b8b572e1SStephen Rothwell #define FIR_OP_RB 0xA /* Read FBCR bytes to FCM buffer */ 197*b8b572e1SStephen Rothwell #define FIR_OP_RS 0xB /* Read 1 or 2 bytes to MDR[AS] */ 198*b8b572e1SStephen Rothwell #define FIR_OP_CW0 0xC /* Wait then issue FCR[CMD0] */ 199*b8b572e1SStephen Rothwell #define FIR_OP_CW1 0xD /* Wait then issue FCR[CMD1] */ 200*b8b572e1SStephen Rothwell #define FIR_OP_RBW 0xE /* Wait then read FBCR bytes */ 201*b8b572e1SStephen Rothwell #define FIR_OP_RSW 0xE /* Wait then read 1 or 2 bytes */ 202*b8b572e1SStephen Rothwell __be32 fcr; /**< Flash Command Register */ 203*b8b572e1SStephen Rothwell #define FCR_CMD0 0xFF000000 204*b8b572e1SStephen Rothwell #define FCR_CMD0_SHIFT 24 205*b8b572e1SStephen Rothwell #define FCR_CMD1 0x00FF0000 206*b8b572e1SStephen Rothwell #define FCR_CMD1_SHIFT 16 207*b8b572e1SStephen Rothwell #define FCR_CMD2 0x0000FF00 208*b8b572e1SStephen Rothwell #define FCR_CMD2_SHIFT 8 209*b8b572e1SStephen Rothwell #define FCR_CMD3 0x000000FF 210*b8b572e1SStephen Rothwell #define FCR_CMD3_SHIFT 0 211*b8b572e1SStephen Rothwell __be32 fbar; /**< Flash Block Address Register */ 212*b8b572e1SStephen Rothwell #define FBAR_BLK 0x00FFFFFF 213*b8b572e1SStephen Rothwell __be32 fpar; /**< Flash Page Address Register */ 214*b8b572e1SStephen Rothwell #define FPAR_SP_PI 0x00007C00 215*b8b572e1SStephen Rothwell #define FPAR_SP_PI_SHIFT 10 216*b8b572e1SStephen Rothwell #define FPAR_SP_MS 0x00000200 217*b8b572e1SStephen Rothwell #define FPAR_SP_CI 0x000001FF 218*b8b572e1SStephen Rothwell #define FPAR_SP_CI_SHIFT 0 219*b8b572e1SStephen Rothwell #define FPAR_LP_PI 0x0003F000 220*b8b572e1SStephen Rothwell #define FPAR_LP_PI_SHIFT 12 221*b8b572e1SStephen Rothwell #define FPAR_LP_MS 0x00000800 222*b8b572e1SStephen Rothwell #define FPAR_LP_CI 0x000007FF 223*b8b572e1SStephen Rothwell #define FPAR_LP_CI_SHIFT 0 224*b8b572e1SStephen Rothwell __be32 fbcr; /**< Flash Byte Count Register */ 225*b8b572e1SStephen Rothwell #define FBCR_BC 0x00000FFF 226*b8b572e1SStephen Rothwell u8 res11[0x8]; 227*b8b572e1SStephen Rothwell u8 res8[0xF00]; 228*b8b572e1SStephen Rothwell }; 229*b8b572e1SStephen Rothwell 230*b8b572e1SStephen Rothwell extern struct fsl_lbc_regs __iomem *fsl_lbc_regs; 231*b8b572e1SStephen Rothwell extern spinlock_t fsl_lbc_lock; 232*b8b572e1SStephen Rothwell 233*b8b572e1SStephen Rothwell /* 234*b8b572e1SStephen Rothwell * FSL UPM routines 235*b8b572e1SStephen Rothwell */ 236*b8b572e1SStephen Rothwell struct fsl_upm { 237*b8b572e1SStephen Rothwell __be32 __iomem *mxmr; 238*b8b572e1SStephen Rothwell int width; 239*b8b572e1SStephen Rothwell }; 240*b8b572e1SStephen Rothwell 241*b8b572e1SStephen Rothwell extern int fsl_lbc_find(phys_addr_t addr_base); 242*b8b572e1SStephen Rothwell extern int fsl_upm_find(phys_addr_t addr_base, struct fsl_upm *upm); 243*b8b572e1SStephen Rothwell 244*b8b572e1SStephen Rothwell /** 245*b8b572e1SStephen Rothwell * fsl_upm_start_pattern - start UPM patterns execution 246*b8b572e1SStephen Rothwell * @upm: pointer to the fsl_upm structure obtained via fsl_upm_find 247*b8b572e1SStephen Rothwell * @pat_offset: UPM pattern offset for the command to be executed 248*b8b572e1SStephen Rothwell * 249*b8b572e1SStephen Rothwell * This routine programmes UPM so the next memory access that hits an UPM 250*b8b572e1SStephen Rothwell * will trigger pattern execution, starting at pat_offset. 251*b8b572e1SStephen Rothwell */ 252*b8b572e1SStephen Rothwell static inline void fsl_upm_start_pattern(struct fsl_upm *upm, u8 pat_offset) 253*b8b572e1SStephen Rothwell { 254*b8b572e1SStephen Rothwell clrsetbits_be32(upm->mxmr, MxMR_MAD, MxMR_OP_RP | pat_offset); 255*b8b572e1SStephen Rothwell } 256*b8b572e1SStephen Rothwell 257*b8b572e1SStephen Rothwell /** 258*b8b572e1SStephen Rothwell * fsl_upm_end_pattern - end UPM patterns execution 259*b8b572e1SStephen Rothwell * @upm: pointer to the fsl_upm structure obtained via fsl_upm_find 260*b8b572e1SStephen Rothwell * 261*b8b572e1SStephen Rothwell * This routine reverts UPM to normal operation mode. 262*b8b572e1SStephen Rothwell */ 263*b8b572e1SStephen Rothwell static inline void fsl_upm_end_pattern(struct fsl_upm *upm) 264*b8b572e1SStephen Rothwell { 265*b8b572e1SStephen Rothwell clrbits32(upm->mxmr, MxMR_OP_RP); 266*b8b572e1SStephen Rothwell 267*b8b572e1SStephen Rothwell while (in_be32(upm->mxmr) & MxMR_OP_RP) 268*b8b572e1SStephen Rothwell cpu_relax(); 269*b8b572e1SStephen Rothwell } 270*b8b572e1SStephen Rothwell 271*b8b572e1SStephen Rothwell /** 272*b8b572e1SStephen Rothwell * fsl_upm_run_pattern - actually run an UPM pattern 273*b8b572e1SStephen Rothwell * @upm: pointer to the fsl_upm structure obtained via fsl_upm_find 274*b8b572e1SStephen Rothwell * @io_base: remapped pointer to where memory access should happen 275*b8b572e1SStephen Rothwell * @mar: MAR register content during pattern execution 276*b8b572e1SStephen Rothwell * 277*b8b572e1SStephen Rothwell * This function triggers dummy write to the memory specified by the io_base, 278*b8b572e1SStephen Rothwell * thus UPM pattern actually executed. Note that mar usage depends on the 279*b8b572e1SStephen Rothwell * pre-programmed AMX bits in the UPM RAM. 280*b8b572e1SStephen Rothwell */ 281*b8b572e1SStephen Rothwell static inline int fsl_upm_run_pattern(struct fsl_upm *upm, 282*b8b572e1SStephen Rothwell void __iomem *io_base, u32 mar) 283*b8b572e1SStephen Rothwell { 284*b8b572e1SStephen Rothwell int ret = 0; 285*b8b572e1SStephen Rothwell unsigned long flags; 286*b8b572e1SStephen Rothwell 287*b8b572e1SStephen Rothwell spin_lock_irqsave(&fsl_lbc_lock, flags); 288*b8b572e1SStephen Rothwell 289*b8b572e1SStephen Rothwell out_be32(&fsl_lbc_regs->mar, mar << (32 - upm->width)); 290*b8b572e1SStephen Rothwell 291*b8b572e1SStephen Rothwell switch (upm->width) { 292*b8b572e1SStephen Rothwell case 8: 293*b8b572e1SStephen Rothwell out_8(io_base, 0x0); 294*b8b572e1SStephen Rothwell break; 295*b8b572e1SStephen Rothwell case 16: 296*b8b572e1SStephen Rothwell out_be16(io_base, 0x0); 297*b8b572e1SStephen Rothwell break; 298*b8b572e1SStephen Rothwell case 32: 299*b8b572e1SStephen Rothwell out_be32(io_base, 0x0); 300*b8b572e1SStephen Rothwell break; 301*b8b572e1SStephen Rothwell default: 302*b8b572e1SStephen Rothwell ret = -EINVAL; 303*b8b572e1SStephen Rothwell break; 304*b8b572e1SStephen Rothwell } 305*b8b572e1SStephen Rothwell 306*b8b572e1SStephen Rothwell spin_unlock_irqrestore(&fsl_lbc_lock, flags); 307*b8b572e1SStephen Rothwell 308*b8b572e1SStephen Rothwell return ret; 309*b8b572e1SStephen Rothwell } 310*b8b572e1SStephen Rothwell 311*b8b572e1SStephen Rothwell #endif /* __ASM_FSL_LBC_H */ 312