Commit 878040ef authored by Arnd Bergmann's avatar Arnd Bergmann

ARM: bcmring: use proper MMIO accessors

A lot of code in bcmring just dereferences pointers to MMIO
locations, which is not safe. This annotates the pointers
correctly using __iomem and uses readl/write to access them.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 8a3fb860
This diff is collapsed.
...@@ -73,9 +73,9 @@ void chipcHw_pll2Enable(uint32_t vcoFreqHz) ...@@ -73,9 +73,9 @@ void chipcHw_pll2Enable(uint32_t vcoFreqHz)
{ {
REG_LOCAL_IRQ_SAVE; REG_LOCAL_IRQ_SAVE;
pChipcHw->PLLConfig2 = writel(chipcHw_REG_PLL_CONFIG_D_RESET |
chipcHw_REG_PLL_CONFIG_D_RESET | chipcHw_REG_PLL_CONFIG_A_RESET,
chipcHw_REG_PLL_CONFIG_A_RESET; &pChipcHw->PLLConfig2);
pllPreDivider2 = chipcHw_REG_PLL_PREDIVIDER_POWER_DOWN | pllPreDivider2 = chipcHw_REG_PLL_PREDIVIDER_POWER_DOWN |
chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_INTEGER | chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_INTEGER |
...@@ -87,28 +87,30 @@ void chipcHw_pll2Enable(uint32_t vcoFreqHz) ...@@ -87,28 +87,30 @@ void chipcHw_pll2Enable(uint32_t vcoFreqHz)
chipcHw_REG_PLL_PREDIVIDER_P2_SHIFT); chipcHw_REG_PLL_PREDIVIDER_P2_SHIFT);
/* Enable CHIPC registers to control the PLL */ /* Enable CHIPC registers to control the PLL */
pChipcHw->PLLStatus |= chipcHw_REG_PLL_STATUS_CONTROL_ENABLE; writel(readl(&pChipcHw->PLLStatus) | chipcHw_REG_PLL_STATUS_CONTROL_ENABLE, &pChipcHw->PLLStatus);
/* Set pre divider to get desired VCO frequency */ /* Set pre divider to get desired VCO frequency */
pChipcHw->PLLPreDivider2 = pllPreDivider2; writel(pllPreDivider2, &pChipcHw->PLLPreDivider2);
/* Set NDIV Frac */ /* Set NDIV Frac */
pChipcHw->PLLDivider2 = chipcHw_REG_PLL_DIVIDER_NDIV_f; writel(chipcHw_REG_PLL_DIVIDER_NDIV_f, &pChipcHw->PLLDivider2);
/* This has to be removed once the default values are fixed for PLL2. */ /* This has to be removed once the default values are fixed for PLL2. */
pChipcHw->PLLControl12 = 0x38000700; writel(0x38000700, &pChipcHw->PLLControl12);
pChipcHw->PLLControl22 = 0x00000015; writel(0x00000015, &pChipcHw->PLLControl22);
/* Reset PLL2 */ /* Reset PLL2 */
if (vcoFreqHz > chipcHw_REG_PLL_CONFIG_VCO_SPLIT_FREQ) { if (vcoFreqHz > chipcHw_REG_PLL_CONFIG_VCO_SPLIT_FREQ) {
pChipcHw->PLLConfig2 = chipcHw_REG_PLL_CONFIG_D_RESET | writel(chipcHw_REG_PLL_CONFIG_D_RESET |
chipcHw_REG_PLL_CONFIG_A_RESET | chipcHw_REG_PLL_CONFIG_A_RESET |
chipcHw_REG_PLL_CONFIG_VCO_1601_3200 | chipcHw_REG_PLL_CONFIG_VCO_1601_3200 |
chipcHw_REG_PLL_CONFIG_POWER_DOWN; chipcHw_REG_PLL_CONFIG_POWER_DOWN,
&pChipcHw->PLLConfig2);
} else { } else {
pChipcHw->PLLConfig2 = chipcHw_REG_PLL_CONFIG_D_RESET | writel(chipcHw_REG_PLL_CONFIG_D_RESET |
chipcHw_REG_PLL_CONFIG_A_RESET | chipcHw_REG_PLL_CONFIG_A_RESET |
chipcHw_REG_PLL_CONFIG_VCO_800_1600 | chipcHw_REG_PLL_CONFIG_VCO_800_1600 |
chipcHw_REG_PLL_CONFIG_POWER_DOWN; chipcHw_REG_PLL_CONFIG_POWER_DOWN,
&pChipcHw->PLLConfig2);
} }
REG_LOCAL_IRQ_RESTORE; REG_LOCAL_IRQ_RESTORE;
} }
...@@ -119,22 +121,25 @@ void chipcHw_pll2Enable(uint32_t vcoFreqHz) ...@@ -119,22 +121,25 @@ void chipcHw_pll2Enable(uint32_t vcoFreqHz)
{ {
REG_LOCAL_IRQ_SAVE; REG_LOCAL_IRQ_SAVE;
/* Remove analog reset and Power on the PLL */ /* Remove analog reset and Power on the PLL */
pChipcHw->PLLConfig2 &= writel(readl(&pChipcHw->PLLConfig2) &
~(chipcHw_REG_PLL_CONFIG_A_RESET | ~(chipcHw_REG_PLL_CONFIG_A_RESET |
chipcHw_REG_PLL_CONFIG_POWER_DOWN); chipcHw_REG_PLL_CONFIG_POWER_DOWN),
&pChipcHw->PLLConfig2);
REG_LOCAL_IRQ_RESTORE; REG_LOCAL_IRQ_RESTORE;
} }
/* Wait until PLL is locked */ /* Wait until PLL is locked */
while (!(pChipcHw->PLLStatus2 & chipcHw_REG_PLL_STATUS_LOCKED)) while (!(readl(&pChipcHw->PLLStatus2) & chipcHw_REG_PLL_STATUS_LOCKED))
; ;
{ {
REG_LOCAL_IRQ_SAVE; REG_LOCAL_IRQ_SAVE;
/* Remove digital reset */ /* Remove digital reset */
pChipcHw->PLLConfig2 &= ~chipcHw_REG_PLL_CONFIG_D_RESET; writel(readl(&pChipcHw->PLLConfig2) &
~chipcHw_REG_PLL_CONFIG_D_RESET,
&pChipcHw->PLLConfig2);
REG_LOCAL_IRQ_RESTORE; REG_LOCAL_IRQ_RESTORE;
} }
...@@ -157,9 +162,9 @@ void chipcHw_pll1Enable(uint32_t vcoFreqHz, chipcHw_SPREAD_SPECTRUM_e ssSupport) ...@@ -157,9 +162,9 @@ void chipcHw_pll1Enable(uint32_t vcoFreqHz, chipcHw_SPREAD_SPECTRUM_e ssSupport)
{ {
REG_LOCAL_IRQ_SAVE; REG_LOCAL_IRQ_SAVE;
pChipcHw->PLLConfig = writel(chipcHw_REG_PLL_CONFIG_D_RESET |
chipcHw_REG_PLL_CONFIG_D_RESET | chipcHw_REG_PLL_CONFIG_A_RESET,
chipcHw_REG_PLL_CONFIG_A_RESET; &pChipcHw->PLLConfig);
/* Setting VCO frequency */ /* Setting VCO frequency */
if (ssSupport == chipcHw_SPREAD_SPECTRUM_ALLOW) { if (ssSupport == chipcHw_SPREAD_SPECTRUM_ALLOW) {
pllPreDivider = pllPreDivider =
...@@ -182,30 +187,22 @@ void chipcHw_pll1Enable(uint32_t vcoFreqHz, chipcHw_SPREAD_SPECTRUM_e ssSupport) ...@@ -182,30 +187,22 @@ void chipcHw_pll1Enable(uint32_t vcoFreqHz, chipcHw_SPREAD_SPECTRUM_e ssSupport)
} }
/* Enable CHIPC registers to control the PLL */ /* Enable CHIPC registers to control the PLL */
pChipcHw->PLLStatus |= chipcHw_REG_PLL_STATUS_CONTROL_ENABLE; writel(readl(&pChipcHw->PLLStatus) | chipcHw_REG_PLL_STATUS_CONTROL_ENABLE, &pChipcHw->PLLStatus);
/* Set pre divider to get desired VCO frequency */ /* Set pre divider to get desired VCO frequency */
pChipcHw->PLLPreDivider = pllPreDivider; writel(pllPreDivider, &pChipcHw->PLLPreDivider);
/* Set NDIV Frac */ /* Set NDIV Frac */
if (ssSupport == chipcHw_SPREAD_SPECTRUM_ALLOW) { if (ssSupport == chipcHw_SPREAD_SPECTRUM_ALLOW) {
pChipcHw->PLLDivider = chipcHw_REG_PLL_DIVIDER_M1DIV | writel(chipcHw_REG_PLL_DIVIDER_M1DIV | chipcHw_REG_PLL_DIVIDER_NDIV_f_SS, &pChipcHw->PLLDivider);
chipcHw_REG_PLL_DIVIDER_NDIV_f_SS;
} else { } else {
pChipcHw->PLLDivider = chipcHw_REG_PLL_DIVIDER_M1DIV | writel(chipcHw_REG_PLL_DIVIDER_M1DIV | chipcHw_REG_PLL_DIVIDER_NDIV_f, &pChipcHw->PLLDivider);
chipcHw_REG_PLL_DIVIDER_NDIV_f;
} }
/* Reset PLL1 */ /* Reset PLL1 */
if (vcoFreqHz > chipcHw_REG_PLL_CONFIG_VCO_SPLIT_FREQ) { if (vcoFreqHz > chipcHw_REG_PLL_CONFIG_VCO_SPLIT_FREQ) {
pChipcHw->PLLConfig = chipcHw_REG_PLL_CONFIG_D_RESET | writel(chipcHw_REG_PLL_CONFIG_D_RESET | chipcHw_REG_PLL_CONFIG_A_RESET | chipcHw_REG_PLL_CONFIG_VCO_1601_3200 | chipcHw_REG_PLL_CONFIG_POWER_DOWN, &pChipcHw->PLLConfig);
chipcHw_REG_PLL_CONFIG_A_RESET |
chipcHw_REG_PLL_CONFIG_VCO_1601_3200 |
chipcHw_REG_PLL_CONFIG_POWER_DOWN;
} else { } else {
pChipcHw->PLLConfig = chipcHw_REG_PLL_CONFIG_D_RESET | writel(chipcHw_REG_PLL_CONFIG_D_RESET | chipcHw_REG_PLL_CONFIG_A_RESET | chipcHw_REG_PLL_CONFIG_VCO_800_1600 | chipcHw_REG_PLL_CONFIG_POWER_DOWN, &pChipcHw->PLLConfig);
chipcHw_REG_PLL_CONFIG_A_RESET |
chipcHw_REG_PLL_CONFIG_VCO_800_1600 |
chipcHw_REG_PLL_CONFIG_POWER_DOWN;
} }
REG_LOCAL_IRQ_RESTORE; REG_LOCAL_IRQ_RESTORE;
...@@ -216,22 +213,19 @@ void chipcHw_pll1Enable(uint32_t vcoFreqHz, chipcHw_SPREAD_SPECTRUM_e ssSupport) ...@@ -216,22 +213,19 @@ void chipcHw_pll1Enable(uint32_t vcoFreqHz, chipcHw_SPREAD_SPECTRUM_e ssSupport)
{ {
REG_LOCAL_IRQ_SAVE; REG_LOCAL_IRQ_SAVE;
/* Remove analog reset and Power on the PLL */ /* Remove analog reset and Power on the PLL */
pChipcHw->PLLConfig &= writel(readl(&pChipcHw->PLLConfig) & ~(chipcHw_REG_PLL_CONFIG_A_RESET | chipcHw_REG_PLL_CONFIG_POWER_DOWN), &pChipcHw->PLLConfig);
~(chipcHw_REG_PLL_CONFIG_A_RESET |
chipcHw_REG_PLL_CONFIG_POWER_DOWN);
REG_LOCAL_IRQ_RESTORE; REG_LOCAL_IRQ_RESTORE;
} }
/* Wait until PLL is locked */ /* Wait until PLL is locked */
while (!(pChipcHw->PLLStatus & chipcHw_REG_PLL_STATUS_LOCKED) while (!(readl(&pChipcHw->PLLStatus) & chipcHw_REG_PLL_STATUS_LOCKED)
|| !(pChipcHw-> || !(readl(&pChipcHw->PLLStatus2) & chipcHw_REG_PLL_STATUS_LOCKED))
PLLStatus2 & chipcHw_REG_PLL_STATUS_LOCKED))
; ;
/* Remove digital reset */ /* Remove digital reset */
{ {
REG_LOCAL_IRQ_SAVE; REG_LOCAL_IRQ_SAVE;
pChipcHw->PLLConfig &= ~chipcHw_REG_PLL_CONFIG_D_RESET; writel(readl(&pChipcHw->PLLConfig) & ~chipcHw_REG_PLL_CONFIG_D_RESET, &pChipcHw->PLLConfig);
REG_LOCAL_IRQ_RESTORE; REG_LOCAL_IRQ_RESTORE;
} }
} }
...@@ -267,11 +261,7 @@ void chipcHw_Init(chipcHw_INIT_PARAM_t *initParam /* [ IN ] Misc chip initializ ...@@ -267,11 +261,7 @@ void chipcHw_Init(chipcHw_INIT_PARAM_t *initParam /* [ IN ] Misc chip initializ
chipcHw_clearStickyBits(chipcHw_REG_STICKY_CHIP_SOFT_RESET); chipcHw_clearStickyBits(chipcHw_REG_STICKY_CHIP_SOFT_RESET);
/* Before configuring the ARM clock, atleast we need to make sure BUS clock maintains the proper ratio with ARM clock */ /* Before configuring the ARM clock, atleast we need to make sure BUS clock maintains the proper ratio with ARM clock */
pChipcHw->ACLKClock = writel((readl(&pChipcHw->ACLKClock) & ~chipcHw_REG_ACLKClock_CLK_DIV_MASK) | (initParam-> armBusRatio & chipcHw_REG_ACLKClock_CLK_DIV_MASK), &pChipcHw->ACLKClock);
(pChipcHw->
ACLKClock & ~chipcHw_REG_ACLKClock_CLK_DIV_MASK) | (initParam->
armBusRatio &
chipcHw_REG_ACLKClock_CLK_DIV_MASK);
/* Set various core component frequencies. The order in which this is done is important for some. */ /* Set various core component frequencies. The order in which this is done is important for some. */
/* The RTBUS (DDR PHY) is derived from the BUS, and the BUS from the ARM, and VPM needs to know BUS */ /* The RTBUS (DDR PHY) is derived from the BUS, and the BUS from the ARM, and VPM needs to know BUS */
......
...@@ -50,15 +50,16 @@ void chipcHw_reset(uint32_t mask) ...@@ -50,15 +50,16 @@ void chipcHw_reset(uint32_t mask)
chipcHw_softReset(chipcHw_REG_SOFT_RESET_CHIP_SOFT); chipcHw_softReset(chipcHw_REG_SOFT_RESET_CHIP_SOFT);
} }
/* Bypass the PLL clocks before reboot */ /* Bypass the PLL clocks before reboot */
pChipcHw->UARTClock |= chipcHw_REG_PLL_CLOCK_BYPASS_SELECT; writel(readl(&pChipcHw->UARTClock) | chipcHw_REG_PLL_CLOCK_BYPASS_SELECT,
pChipcHw->SPIClock |= chipcHw_REG_PLL_CLOCK_BYPASS_SELECT; &pChipcHw->UARTClock);
writel(readl(&pChipcHw->SPIClock) | chipcHw_REG_PLL_CLOCK_BYPASS_SELECT,
&pChipcHw->SPIClock);
/* Copy the chipcHw_warmReset_run_from_aram function into ARAM */ /* Copy the chipcHw_warmReset_run_from_aram function into ARAM */
do { do {
((uint32_t *) MM_IO_BASE_ARAM)[i] = writel(((uint32_t *) &chipcHw_reset_run_from_aram)[i], ((uint32_t __iomem *) MM_IO_BASE_ARAM) + i);
((uint32_t *) &chipcHw_reset_run_from_aram)[i];
i++; i++;
} while (((uint32_t *) MM_IO_BASE_ARAM)[i - 1] != 0xe1a0f00f); /* 0xe1a0f00f == asm ("mov r15, r15"); */ } while (readl(((uint32_t __iomem*) MM_IO_BASE_ARAM) + i - 1) != 0xe1a0f00f); /* 0xe1a0f00f == asm ("mov r15, r15"); */
flush_cache_all(); flush_cache_all();
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
/* ---- Include Files ---------------------------------------------------- */ /* ---- Include Files ---------------------------------------------------- */
#include <linux/types.h> #include <linux/types.h>
#include <linux/string.h> #include <linux/string.h>
#include <stddef.h> #include <linux/stddef.h>
#include <mach/csp/dmacHw.h> #include <mach/csp/dmacHw.h>
#include <mach/csp/dmacHw_reg.h> #include <mach/csp/dmacHw_reg.h>
...@@ -55,33 +55,32 @@ static uint32_t GetFifoSize(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handl ...@@ -55,33 +55,32 @@ static uint32_t GetFifoSize(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handl
) { ) {
uint32_t val = 0; uint32_t val = 0;
dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle);
dmacHw_MISC_t *pMiscReg = dmacHw_MISC_t __iomem *pMiscReg = (void __iomem *)dmacHw_REG_MISC_BASE(pCblk->module);
(dmacHw_MISC_t *) dmacHw_REG_MISC_BASE(pCblk->module);
switch (pCblk->channel) { switch (pCblk->channel) {
case 0: case 0:
val = (pMiscReg->CompParm2.lo & 0x70000000) >> 28; val = (readl(&pMiscReg->CompParm2.lo) & 0x70000000) >> 28;
break; break;
case 1: case 1:
val = (pMiscReg->CompParm3.hi & 0x70000000) >> 28; val = (readl(&pMiscReg->CompParm3.hi) & 0x70000000) >> 28;
break; break;
case 2: case 2:
val = (pMiscReg->CompParm3.lo & 0x70000000) >> 28; val = (readl(&pMiscReg->CompParm3.lo) & 0x70000000) >> 28;
break; break;
case 3: case 3:
val = (pMiscReg->CompParm4.hi & 0x70000000) >> 28; val = (readl(&pMiscReg->CompParm4.hi) & 0x70000000) >> 28;
break; break;
case 4: case 4:
val = (pMiscReg->CompParm4.lo & 0x70000000) >> 28; val = (readl(&pMiscReg->CompParm4.lo) & 0x70000000) >> 28;
break; break;
case 5: case 5:
val = (pMiscReg->CompParm5.hi & 0x70000000) >> 28; val = (readl(&pMiscReg->CompParm5.hi) & 0x70000000) >> 28;
break; break;
case 6: case 6:
val = (pMiscReg->CompParm5.lo & 0x70000000) >> 28; val = (readl(&pMiscReg->CompParm5.lo) & 0x70000000) >> 28;
break; break;
case 7: case 7:
val = (pMiscReg->CompParm6.hi & 0x70000000) >> 28; val = (readl(&pMiscReg->CompParm6.hi) & 0x70000000) >> 28;
break; break;
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
/* ---- Include Files ---------------------------------------------------- */ /* ---- Include Files ---------------------------------------------------- */
#include <linux/types.h> #include <linux/types.h>
#include <stddef.h> #include <linux/stddef.h>
#include <mach/csp/dmacHw.h> #include <mach/csp/dmacHw.h>
#include <mach/csp/dmacHw_reg.h> #include <mach/csp/dmacHw_reg.h>
......
...@@ -131,8 +131,8 @@ typedef struct { ...@@ -131,8 +131,8 @@ typedef struct {
uint32_t MiscInput_0_15; /* Input type for MISC 0 - 16 */ uint32_t MiscInput_0_15; /* Input type for MISC 0 - 16 */
} chipcHw_REG_t; } chipcHw_REG_t;
#define pChipcHw ((volatile chipcHw_REG_t *) chipcHw_BASE_ADDRESS) #define pChipcHw ((chipcHw_REG_t __iomem *) chipcHw_BASE_ADDRESS)
#define pChipcPhysical ((volatile chipcHw_REG_t *) MM_ADDR_IO_CHIPC) #define pChipcPhysical (MM_ADDR_IO_CHIPC)
#define chipcHw_REG_CHIPID_BASE_MASK 0xFFFFF000 #define chipcHw_REG_CHIPID_BASE_MASK 0xFFFFF000
#define chipcHw_REG_CHIPID_BASE_SHIFT 12 #define chipcHw_REG_CHIPID_BASE_SHIFT 12
......
...@@ -416,7 +416,7 @@ extern "C" { ...@@ -416,7 +416,7 @@ extern "C" {
} ddrcReg_PHY_ADDR_CTL_REG_t; } ddrcReg_PHY_ADDR_CTL_REG_t;
#define ddrcReg_PHY_ADDR_CTL_REG_OFFSET 0x0400 #define ddrcReg_PHY_ADDR_CTL_REG_OFFSET 0x0400
#define ddrcReg_PHY_ADDR_CTL_REGP ((volatile ddrcReg_PHY_ADDR_CTL_REG_t *) (MM_IO_BASE_DDRC + ddrcReg_PHY_ADDR_CTL_REG_OFFSET)) #define ddrcReg_PHY_ADDR_CTL_REGP ((volatile ddrcReg_PHY_ADDR_CTL_REG_t __iomem*) (MM_IO_BASE_DDRC + ddrcReg_PHY_ADDR_CTL_REG_OFFSET))
/* @todo These SS definitions are duplicates of ones below */ /* @todo These SS definitions are duplicates of ones below */
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#ifndef _DMACHW_H #ifndef _DMACHW_H
#define _DMACHW_H #define _DMACHW_H
#include <stddef.h> #include <linux/stddef.h>
#include <linux/types.h> #include <linux/types.h>
#include <mach/csp/dmacHw_reg.h> #include <mach/csp/dmacHw_reg.h>
......
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
#define INTCHW_NUM_INTC 3 #define INTCHW_NUM_INTC 3
/* Defines for interrupt controllers. This simplifies and cleans up the function calls. */ /* Defines for interrupt controllers. This simplifies and cleans up the function calls. */
#define INTCHW_INTC0 ((void *)MM_IO_BASE_INTC0) #define INTCHW_INTC0 (MM_IO_BASE_INTC0)
#define INTCHW_INTC1 ((void *)MM_IO_BASE_INTC1) #define INTCHW_INTC1 (MM_IO_BASE_INTC1)
#define INTCHW_SINTC ((void *)MM_IO_BASE_SINTC) #define INTCHW_SINTC (MM_IO_BASE_SINTC)
/* INTC0 - interrupt controller 0 */ /* INTC0 - interrupt controller 0 */
#define INTCHW_INTC0_PIF_BITNUM 31 /* Peripheral interface interrupt */ #define INTCHW_INTC0_PIF_BITNUM 31 /* Peripheral interface interrupt */
...@@ -232,15 +232,15 @@ ...@@ -232,15 +232,15 @@
/* ---- Public Variable Externs ------------------------------------------ */ /* ---- Public Variable Externs ------------------------------------------ */
/* ---- Public Function Prototypes --------------------------------------- */ /* ---- Public Function Prototypes --------------------------------------- */
/* Clear one or more IRQ interrupts. */ /* Clear one or more IRQ interrupts. */
static inline void intcHw_irq_disable(void *basep, uint32_t mask) static inline void intcHw_irq_disable(void __iomem *basep, uint32_t mask)
{ {
__REG32(basep + INTCHW_INTENCLEAR) = mask; writel(mask, basep + INTCHW_INTENCLEAR);
} }
/* Enables one or more IRQ interrupts. */ /* Enables one or more IRQ interrupts. */
static inline void intcHw_irq_enable(void *basep, uint32_t mask) static inline void intcHw_irq_enable(void __iomem *basep, uint32_t mask)
{ {
__REG32(basep + INTCHW_INTENABLE) = mask; writel(mask, basep + INTCHW_INTENABLE);
} }
#endif /* _INTCHW_REG_H */ #endif /* _INTCHW_REG_H */
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#ifdef __ASSEMBLY__ #ifdef __ASSEMBLY__
#define MM_IO_PHYS_TO_VIRT(phys) (0xF0000000 | (((phys) >> 4) & 0x0F000000) | ((phys) & 0xFFFFFF)) #define MM_IO_PHYS_TO_VIRT(phys) (0xF0000000 | (((phys) >> 4) & 0x0F000000) | ((phys) & 0xFFFFFF))
#else #else
#define MM_IO_PHYS_TO_VIRT(phys) (((phys) == MM_ADDR_IO_VPM_EXTMEM_RSVD) ? 0xF0000000 : \ #define MM_IO_PHYS_TO_VIRT(phys) (void __iomem *)(((phys) == MM_ADDR_IO_VPM_EXTMEM_RSVD) ? 0xF0000000 : \
(0xF0000000 | (((phys) >> 4) & 0x0F000000) | ((phys) & 0xFFFFFF))) (0xF0000000 | (((phys) >> 4) & 0x0F000000) | ((phys) & 0xFFFFFF)))
#endif #endif
#endif #endif
...@@ -60,8 +60,8 @@ ...@@ -60,8 +60,8 @@
#ifdef __ASSEMBLY__ #ifdef __ASSEMBLY__
#define MM_IO_VIRT_TO_PHYS(virt) ((((virt) & 0x0F000000) << 4) | ((virt) & 0xFFFFFF)) #define MM_IO_VIRT_TO_PHYS(virt) ((((virt) & 0x0F000000) << 4) | ((virt) & 0xFFFFFF))
#else #else
#define MM_IO_VIRT_TO_PHYS(virt) (((virt) == 0xF0000000) ? MM_ADDR_IO_VPM_EXTMEM_RSVD : \ #define MM_IO_VIRT_TO_PHYS(virt) (((unsigned long)(virt) == 0xF0000000) ? MM_ADDR_IO_VPM_EXTMEM_RSVD : \
((((virt) & 0x0F000000) << 4) | ((virt) & 0xFFFFFF))) ((((unsigned long)(virt) & 0x0F000000) << 4) | ((unsigned long)(virt) & 0xFFFFFF)))
#endif #endif
#endif #endif
......
...@@ -26,12 +26,13 @@ ...@@ -26,12 +26,13 @@
/* ---- Include Files ---------------------------------------------------- */ /* ---- Include Files ---------------------------------------------------- */
#include <linux/types.h> #include <linux/types.h>
#include <linux/io.h>
/* ---- Public Constants and Types --------------------------------------- */ /* ---- Public Constants and Types --------------------------------------- */
#define __REG32(x) (*((volatile uint32_t *)(x))) #define __REG32(x) (*((volatile uint32_t __iomem *)(x)))
#define __REG16(x) (*((volatile uint16_t *)(x))) #define __REG16(x) (*((volatile uint16_t __iomem *)(x)))
#define __REG8(x) (*((volatile uint8_t *) (x))) #define __REG8(x) (*((volatile uint8_t __iomem *) (x)))
/* Macros used to define a sequence of reserved registers. The start / end */ /* Macros used to define a sequence of reserved registers. The start / end */
/* are byte offsets in the particular register definition, with the "end" */ /* are byte offsets in the particular register definition, with the "end" */
...@@ -84,31 +85,31 @@ ...@@ -84,31 +85,31 @@
#endif #endif
static inline void reg32_modify_and(volatile uint32_t *reg, uint32_t value) static inline void reg32_modify_and(volatile uint32_t __iomem *reg, uint32_t value)
{ {
REG_LOCAL_IRQ_SAVE; REG_LOCAL_IRQ_SAVE;
*reg &= value; __raw_writel(__raw_readl(reg) & value, reg);
REG_LOCAL_IRQ_RESTORE; REG_LOCAL_IRQ_RESTORE;
} }
static inline void reg32_modify_or(volatile uint32_t *reg, uint32_t value) static inline void reg32_modify_or(volatile uint32_t __iomem *reg, uint32_t value)
{ {
REG_LOCAL_IRQ_SAVE; REG_LOCAL_IRQ_SAVE;
*reg |= value; __raw_writel(__raw_readl(reg) | value, reg);
REG_LOCAL_IRQ_RESTORE; REG_LOCAL_IRQ_RESTORE;
} }
static inline void reg32_modify_mask(volatile uint32_t *reg, uint32_t mask, static inline void reg32_modify_mask(volatile uint32_t __iomem *reg, uint32_t mask,
uint32_t value) uint32_t value)
{ {
REG_LOCAL_IRQ_SAVE; REG_LOCAL_IRQ_SAVE;
*reg = (*reg & mask) | value; __raw_writel((__raw_readl(reg) & mask) | value, reg);
REG_LOCAL_IRQ_RESTORE; REG_LOCAL_IRQ_RESTORE;
} }
static inline void reg32_write(volatile uint32_t *reg, uint32_t value) static inline void reg32_write(volatile uint32_t __iomem *reg, uint32_t value)
{ {
*reg = value; __raw_writel(value, reg);
} }
#endif /* CSP_REG_H */ #endif /* CSP_REG_H */
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
/****************************************************************************/ /****************************************************************************/
static inline void secHw_setSecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */ static inline void secHw_setSecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */
) { ) {
secHw_REGS_t *regp = (secHw_REGS_t *) MM_IO_BASE_TZPC; secHw_REGS_t __iomem *regp = MM_IO_BASE_TZPC;
if (mask & 0x0000FFFF) { if (mask & 0x0000FFFF) {
regp->reg[secHw_IDX_LS].setSecure = mask & 0x0000FFFF; regp->reg[secHw_IDX_LS].setSecure = mask & 0x0000FFFF;
...@@ -53,13 +53,13 @@ static inline void secHw_setSecure(uint32_t mask /* mask of type secHw_BLK_MASK ...@@ -53,13 +53,13 @@ static inline void secHw_setSecure(uint32_t mask /* mask of type secHw_BLK_MASK
/****************************************************************************/ /****************************************************************************/
static inline void secHw_setUnsecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */ static inline void secHw_setUnsecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */
) { ) {
secHw_REGS_t *regp = (secHw_REGS_t *) MM_IO_BASE_TZPC; secHw_REGS_t __iomem *regp = MM_IO_BASE_TZPC;
if (mask & 0x0000FFFF) { if (mask & 0x0000FFFF) {
regp->reg[secHw_IDX_LS].setUnsecure = mask & 0x0000FFFF; writel(mask & 0x0000FFFF, &regp->reg[secHw_IDX_LS].setUnsecure);
} }
if (mask & 0xFFFF0000) { if (mask & 0xFFFF0000) {
regp->reg[secHw_IDX_MS].setUnsecure = mask >> 16; writel(mask >> 16, &regp->reg[secHw_IDX_MS].setUnsecure);
} }
} }
...@@ -71,7 +71,7 @@ static inline void secHw_setUnsecure(uint32_t mask /* mask of type secHw_BLK_MA ...@@ -71,7 +71,7 @@ static inline void secHw_setUnsecure(uint32_t mask /* mask of type secHw_BLK_MA
/****************************************************************************/ /****************************************************************************/
static inline uint32_t secHw_getStatus(void) static inline uint32_t secHw_getStatus(void)
{ {
secHw_REGS_t *regp = (secHw_REGS_t *) MM_IO_BASE_TZPC; secHw_REGS_t __iomem *regp = MM_IO_BASE_TZPC;
return (regp->reg[1].status << 16) + regp->reg[0].status; return (regp->reg[1].status << 16) + regp->reg[0].status;
} }
......
...@@ -233,5 +233,5 @@ ...@@ -233,5 +233,5 @@
#define REG_UMI_BCH_ERR_LOC_WORD 0x00000018 #define REG_UMI_BCH_ERR_LOC_WORD 0x00000018
/* location within a page (512 byte) */ /* location within a page (512 byte) */
#define REG_UMI_BCH_ERR_LOC_PAGE 0x00001FE0 #define REG_UMI_BCH_ERR_LOC_PAGE 0x00001FE0
#define REG_UMI_BCH_ERR_LOC_ADDR(index) (__REG32(HW_UMI_BASE + 0x64 + (index / 2)*4) >> ((index % 2) * 16)) #define REG_UMI_BCH_ERR_LOC_ADDR(index) (readl(HW_UMI_BASE + 0x64 + (index / 2)*4) >> ((index % 2) * 16))
#endif #endif
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/csp/mm_io.h> #include <mach/csp/mm_io.h>
#define IO_DESC(va, sz) { .virtual = va, \ #define IO_DESC(va, sz) { .virtual = (unsigned long)va, \
.pfn = __phys_to_pfn(HW_IO_VIRT_TO_PHYS(va)), \ .pfn = __phys_to_pfn(HW_IO_VIRT_TO_PHYS(va)), \
.length = sz, \ .length = sz, \
.type = MT_DEVICE } .type = MT_DEVICE }
#define MEM_DESC(va, sz) { .virtual = va, \ #define MEM_DESC(va, sz) { .virtual = (unsigned long)va, \
.pfn = __phys_to_pfn(HW_IO_VIRT_TO_PHYS(va)), \ .pfn = __phys_to_pfn(HW_IO_VIRT_TO_PHYS(va)), \
.length = sz, \ .length = sz, \
.type = MT_MEMORY } .type = MT_MEMORY }
......
...@@ -249,20 +249,20 @@ static int nand_dev_ready(struct mtd_info *mtd) ...@@ -249,20 +249,20 @@ static int nand_dev_ready(struct mtd_info *mtd)
int bcm_umi_nand_inithw(void) int bcm_umi_nand_inithw(void)
{ {
/* Configure nand timing parameters */ /* Configure nand timing parameters */
REG_UMI_NAND_TCR &= ~0x7ffff; writel(readl(&REG_UMI_NAND_TCR) & ~0x7ffff, &REG_UMI_NAND_TCR);
REG_UMI_NAND_TCR |= HW_CFG_NAND_TCR; writel(readl(&REG_UMI_NAND_TCR) | HW_CFG_NAND_TCR, &REG_UMI_NAND_TCR);
#if !defined(CONFIG_MTD_NAND_BCM_UMI_HWCS) #if !defined(CONFIG_MTD_NAND_BCM_UMI_HWCS)
/* enable software control of CS */ /* enable software control of CS */
REG_UMI_NAND_TCR |= REG_UMI_NAND_TCR_CS_SWCTRL; writel(readl(&REG_UMI_NAND_TCR) | REG_UMI_NAND_TCR_CS_SWCTRL, &REG_UMI_NAND_TCR);
#endif #endif
/* keep NAND chip select asserted */ /* keep NAND chip select asserted */
REG_UMI_NAND_RCSR |= REG_UMI_NAND_RCSR_CS_ASSERTED; writel(readl(&REG_UMI_NAND_RCSR) | REG_UMI_NAND_RCSR_CS_ASSERTED, &REG_UMI_NAND_RCSR);
REG_UMI_NAND_TCR &= ~REG_UMI_NAND_TCR_WORD16; writel(readl(&REG_UMI_NAND_TCR) & ~REG_UMI_NAND_TCR_WORD16, &REG_UMI_NAND_TCR);
/* enable writes to flash */ /* enable writes to flash */
REG_UMI_MMD_ICR |= REG_UMI_MMD_ICR_FLASH_WP; writel(readl(&REG_UMI_MMD_ICR) | REG_UMI_MMD_ICR_FLASH_WP, &REG_UMI_MMD_ICR);
writel(NAND_CMD_RESET, bcm_umi_io_base + REG_NAND_CMD_OFFSET); writel(NAND_CMD_RESET, bcm_umi_io_base + REG_NAND_CMD_OFFSET);
nand_bcm_umi_wait_till_ready(); nand_bcm_umi_wait_till_ready();
......
...@@ -48,7 +48,7 @@ int nand_bcm_umi_bch_correct_page(uint8_t *datap, uint8_t *readEccData, ...@@ -48,7 +48,7 @@ int nand_bcm_umi_bch_correct_page(uint8_t *datap, uint8_t *readEccData,
/* Check in device is ready */ /* Check in device is ready */
static inline int nand_bcm_umi_dev_ready(void) static inline int nand_bcm_umi_dev_ready(void)
{ {
return REG_UMI_NAND_RCSR & REG_UMI_NAND_RCSR_RDY; return readl(&REG_UMI_NAND_RCSR) & REG_UMI_NAND_RCSR_RDY;
} }
/* Wait until device is ready */ /* Wait until device is ready */
...@@ -62,10 +62,11 @@ static inline void nand_bcm_umi_wait_till_ready(void) ...@@ -62,10 +62,11 @@ static inline void nand_bcm_umi_wait_till_ready(void)
static inline void nand_bcm_umi_hamming_enable_hwecc(void) static inline void nand_bcm_umi_hamming_enable_hwecc(void)
{ {
/* disable and reset ECC, 512 byte page */ /* disable and reset ECC, 512 byte page */
REG_UMI_NAND_ECC_CSR &= ~(REG_UMI_NAND_ECC_CSR_ECC_ENABLE | writel(readl(&REG_UMI_NAND_ECC_CSR) & ~(REG_UMI_NAND_ECC_CSR_ECC_ENABLE |
REG_UMI_NAND_ECC_CSR_256BYTE); REG_UMI_NAND_ECC_CSR_256BYTE), &REG_UMI_NAND_ECC_CSR);
/* enable ECC */ /* enable ECC */
REG_UMI_NAND_ECC_CSR |= REG_UMI_NAND_ECC_CSR_ECC_ENABLE; writel(readl(&REG_UMI_NAND_ECC_CSR) | REG_UMI_NAND_ECC_CSR_ECC_ENABLE,
&REG_UMI_NAND_ECC_CSR);
} }
#if NAND_ECC_BCH #if NAND_ECC_BCH
...@@ -76,18 +77,18 @@ static inline void nand_bcm_umi_hamming_enable_hwecc(void) ...@@ -76,18 +77,18 @@ static inline void nand_bcm_umi_hamming_enable_hwecc(void)
static inline void nand_bcm_umi_bch_enable_read_hwecc(void) static inline void nand_bcm_umi_bch_enable_read_hwecc(void)
{ {
/* disable and reset ECC */ /* disable and reset ECC */
REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID; writel(REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID, &REG_UMI_BCH_CTRL_STATUS);
/* Turn on ECC */ /* Turn on ECC */
REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN; writel(REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN, &REG_UMI_BCH_CTRL_STATUS);
} }
/* Enable BCH Write ECC */ /* Enable BCH Write ECC */
static inline void nand_bcm_umi_bch_enable_write_hwecc(void) static inline void nand_bcm_umi_bch_enable_write_hwecc(void)
{ {
/* disable and reset ECC */ /* disable and reset ECC */
REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID; writel(REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID, &REG_UMI_BCH_CTRL_STATUS);
/* Turn on ECC */ /* Turn on ECC */
REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_ECC_WR_EN; writel(REG_UMI_BCH_CTRL_STATUS_ECC_WR_EN, &REG_UMI_BCH_CTRL_STATUS);
} }
/* Config number of BCH ECC bytes */ /* Config number of BCH ECC bytes */
...@@ -99,9 +100,9 @@ static inline void nand_bcm_umi_bch_config_ecc(uint8_t numEccBytes) ...@@ -99,9 +100,9 @@ static inline void nand_bcm_umi_bch_config_ecc(uint8_t numEccBytes)
uint32_t numBits = numEccBytes * 8; uint32_t numBits = numEccBytes * 8;
/* disable and reset ECC */ /* disable and reset ECC */
REG_UMI_BCH_CTRL_STATUS = writel(REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID |
REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID | REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID,
REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID; &REG_UMI_BCH_CTRL_STATUS);
/* Every correctible bit requires 13 ECC bits */ /* Every correctible bit requires 13 ECC bits */
tValue = (uint32_t) (numBits / ECC_BITS_PER_CORRECTABLE_BIT); tValue = (uint32_t) (numBits / ECC_BITS_PER_CORRECTABLE_BIT);
...@@ -113,23 +114,21 @@ static inline void nand_bcm_umi_bch_config_ecc(uint8_t numEccBytes) ...@@ -113,23 +114,21 @@ static inline void nand_bcm_umi_bch_config_ecc(uint8_t numEccBytes)
kValue = nValue - (tValue * ECC_BITS_PER_CORRECTABLE_BIT); kValue = nValue - (tValue * ECC_BITS_PER_CORRECTABLE_BIT);
/* Write the settings */ /* Write the settings */
REG_UMI_BCH_N = nValue; writel(nValue, &REG_UMI_BCH_N);
REG_UMI_BCH_T = tValue; writel(tValue, &REG_UMI_BCH_T);
REG_UMI_BCH_K = kValue; writel(kValue, &REG_UMI_BCH_K);
} }
/* Pause during ECC read calculation to skip bytes in OOB */ /* Pause during ECC read calculation to skip bytes in OOB */
static inline void nand_bcm_umi_bch_pause_read_ecc_calc(void) static inline void nand_bcm_umi_bch_pause_read_ecc_calc(void)
{ {
REG_UMI_BCH_CTRL_STATUS = writel(REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN | REG_UMI_BCH_CTRL_STATUS_PAUSE_ECC_DEC, &REG_UMI_BCH_CTRL_STATUS);
REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN |
REG_UMI_BCH_CTRL_STATUS_PAUSE_ECC_DEC;
} }
/* Resume during ECC read calculation after skipping bytes in OOB */ /* Resume during ECC read calculation after skipping bytes in OOB */
static inline void nand_bcm_umi_bch_resume_read_ecc_calc(void) static inline void nand_bcm_umi_bch_resume_read_ecc_calc(void)
{ {
REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN; writel(REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN, &REG_UMI_BCH_CTRL_STATUS);
} }
/* Poll read ECC calc to check when hardware completes */ /* Poll read ECC calc to check when hardware completes */
...@@ -139,7 +138,7 @@ static inline uint32_t nand_bcm_umi_bch_poll_read_ecc_calc(void) ...@@ -139,7 +138,7 @@ static inline uint32_t nand_bcm_umi_bch_poll_read_ecc_calc(void)
do { do {
/* wait for ECC to be valid */ /* wait for ECC to be valid */
regVal = REG_UMI_BCH_CTRL_STATUS; regVal = readl(&REG_UMI_BCH_CTRL_STATUS);
} while ((regVal & REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID) == 0); } while ((regVal & REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID) == 0);
return regVal; return regVal;
...@@ -149,7 +148,7 @@ static inline uint32_t nand_bcm_umi_bch_poll_read_ecc_calc(void) ...@@ -149,7 +148,7 @@ static inline uint32_t nand_bcm_umi_bch_poll_read_ecc_calc(void)
static inline void nand_bcm_umi_bch_poll_write_ecc_calc(void) static inline void nand_bcm_umi_bch_poll_write_ecc_calc(void)
{ {
/* wait for ECC to be valid */ /* wait for ECC to be valid */
while ((REG_UMI_BCH_CTRL_STATUS & REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID) while ((readl(&REG_UMI_BCH_CTRL_STATUS) & REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID)
== 0) == 0)
; ;
} }
...@@ -170,9 +169,9 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize, ...@@ -170,9 +169,9 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize,
if (pageSize != NAND_DATA_ACCESS_SIZE) { if (pageSize != NAND_DATA_ACCESS_SIZE) {
/* skip BI */ /* skip BI */
#if defined(__KERNEL__) && !defined(STANDALONE) #if defined(__KERNEL__) && !defined(STANDALONE)
*oobp++ = REG_NAND_DATA8; *oobp++ = readb(&REG_NAND_DATA8);
#else #else
REG_NAND_DATA8; readb(&REG_NAND_DATA8);
#endif #endif
numToRead--; numToRead--;
} }
...@@ -180,9 +179,9 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize, ...@@ -180,9 +179,9 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize,
while (numToRead > numEccBytes) { while (numToRead > numEccBytes) {
/* skip free oob region */ /* skip free oob region */
#if defined(__KERNEL__) && !defined(STANDALONE) #if defined(__KERNEL__) && !defined(STANDALONE)
*oobp++ = REG_NAND_DATA8; *oobp++ = readb(&REG_NAND_DATA8);
#else #else
REG_NAND_DATA8; readb(&REG_NAND_DATA8);
#endif #endif
numToRead--; numToRead--;
} }
...@@ -193,11 +192,11 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize, ...@@ -193,11 +192,11 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize,
while (numToRead > 11) { while (numToRead > 11) {
#if defined(__KERNEL__) && !defined(STANDALONE) #if defined(__KERNEL__) && !defined(STANDALONE)
*oobp = REG_NAND_DATA8; *oobp = readb(&REG_NAND_DATA8);
eccCalc[eccPos++] = *oobp; eccCalc[eccPos++] = *oobp;
oobp++; oobp++;
#else #else
eccCalc[eccPos++] = REG_NAND_DATA8; eccCalc[eccPos++] = readb(&REG_NAND_DATA8);
#endif #endif
numToRead--; numToRead--;
} }
...@@ -207,9 +206,9 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize, ...@@ -207,9 +206,9 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize,
if (numToRead == 11) { if (numToRead == 11) {
/* read BI */ /* read BI */
#if defined(__KERNEL__) && !defined(STANDALONE) #if defined(__KERNEL__) && !defined(STANDALONE)
*oobp++ = REG_NAND_DATA8; *oobp++ = readb(&REG_NAND_DATA8);
#else #else
REG_NAND_DATA8; readb(&REG_NAND_DATA8);
#endif #endif
numToRead--; numToRead--;
} }
...@@ -219,11 +218,11 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize, ...@@ -219,11 +218,11 @@ static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize,
nand_bcm_umi_bch_resume_read_ecc_calc(); nand_bcm_umi_bch_resume_read_ecc_calc();
while (numToRead) { while (numToRead) {
#if defined(__KERNEL__) && !defined(STANDALONE) #if defined(__KERNEL__) && !defined(STANDALONE)
*oobp = REG_NAND_DATA8; *oobp = readb(&REG_NAND_DATA8);
eccCalc[eccPos++] = *oobp; eccCalc[eccPos++] = *oobp;
oobp++; oobp++;
#else #else
eccCalc[eccPos++] = REG_NAND_DATA8; eccCalc[eccPos++] = readb(&REG_NAND_DATA8);
#endif #endif
numToRead--; numToRead--;
} }
...@@ -255,7 +254,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize, ...@@ -255,7 +254,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize,
if (pageSize == NAND_DATA_ACCESS_SIZE) { if (pageSize == NAND_DATA_ACCESS_SIZE) {
/* Now fill in the ECC bytes */ /* Now fill in the ECC bytes */
if (numEccBytes >= 13) if (numEccBytes >= 13)
eccVal = REG_UMI_BCH_WR_ECC_3; eccVal = readl(&REG_UMI_BCH_WR_ECC_3);
/* Usually we skip CM in oob[0,1] */ /* Usually we skip CM in oob[0,1] */
NAND_BCM_UMI_ECC_WRITE(numEccBytes, 15, &oobp[0], NAND_BCM_UMI_ECC_WRITE(numEccBytes, 15, &oobp[0],
...@@ -268,7 +267,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize, ...@@ -268,7 +267,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize,
eccVal & 0xff); /* ECC 12 */ eccVal & 0xff); /* ECC 12 */
if (numEccBytes >= 9) if (numEccBytes >= 9)
eccVal = REG_UMI_BCH_WR_ECC_2; eccVal = readl(&REG_UMI_BCH_WR_ECC_2);
NAND_BCM_UMI_ECC_WRITE(numEccBytes, 12, &oobp[3], NAND_BCM_UMI_ECC_WRITE(numEccBytes, 12, &oobp[3],
(eccVal >> 24) & 0xff); /* ECC11 */ (eccVal >> 24) & 0xff); /* ECC11 */
...@@ -281,7 +280,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize, ...@@ -281,7 +280,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize,
/* Now fill in the ECC bytes */ /* Now fill in the ECC bytes */
if (numEccBytes >= 13) if (numEccBytes >= 13)
eccVal = REG_UMI_BCH_WR_ECC_3; eccVal = readl(&REG_UMI_BCH_WR_ECC_3);
/* Usually skip CM in oob[1,2] */ /* Usually skip CM in oob[1,2] */
NAND_BCM_UMI_ECC_WRITE(numEccBytes, 15, &oobp[1], NAND_BCM_UMI_ECC_WRITE(numEccBytes, 15, &oobp[1],
...@@ -294,7 +293,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize, ...@@ -294,7 +293,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize,
eccVal & 0xff); /* ECC12 */ eccVal & 0xff); /* ECC12 */
if (numEccBytes >= 9) if (numEccBytes >= 9)
eccVal = REG_UMI_BCH_WR_ECC_2; eccVal = readl(&REG_UMI_BCH_WR_ECC_2);
NAND_BCM_UMI_ECC_WRITE(numEccBytes, 12, &oobp[4], NAND_BCM_UMI_ECC_WRITE(numEccBytes, 12, &oobp[4],
(eccVal >> 24) & 0xff); /* ECC11 */ (eccVal >> 24) & 0xff); /* ECC11 */
...@@ -309,7 +308,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize, ...@@ -309,7 +308,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize,
eccVal & 0xff); /* ECC8 */ eccVal & 0xff); /* ECC8 */
if (numEccBytes >= 5) if (numEccBytes >= 5)
eccVal = REG_UMI_BCH_WR_ECC_1; eccVal = readl(&REG_UMI_BCH_WR_ECC_1);
NAND_BCM_UMI_ECC_WRITE(numEccBytes, 8, &oobp[8], NAND_BCM_UMI_ECC_WRITE(numEccBytes, 8, &oobp[8],
(eccVal >> 24) & 0xff); /* ECC7 */ (eccVal >> 24) & 0xff); /* ECC7 */
...@@ -321,7 +320,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize, ...@@ -321,7 +320,7 @@ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize,
eccVal & 0xff); /* ECC4 */ eccVal & 0xff); /* ECC4 */
if (numEccBytes >= 1) if (numEccBytes >= 1)
eccVal = REG_UMI_BCH_WR_ECC_0; eccVal = readl(&REG_UMI_BCH_WR_ECC_0);
NAND_BCM_UMI_ECC_WRITE(numEccBytes, 4, &oobp[12], NAND_BCM_UMI_ECC_WRITE(numEccBytes, 4, &oobp[12],
(eccVal >> 24) & 0xff); /* ECC3 */ (eccVal >> 24) & 0xff); /* ECC3 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment