mirror of
https://github.com/apache/nuttx.git
synced 2026-09-21 05:14:27 +08:00
Merged in ebsong/nuttx (pull request #712)
Pull request for cortex-r4 codes
* arm/armv7-r: Add general interrupt controller.
This is based on armv7-a gic controller code.
Signed-off-by: EunBong Song <eunb.song@samsung.com>
* arm/armv7-r: add invalidate dcache in arm_head.S
Adding invalidate dcache as a comment in arm_head.S.
Signed-off-by: EunBong Song <eunb.song@samsung.com>
* arm/armv7-r: Fix some wrong configuration of program status register.
PSR_E_BIT bit should be set for big endian system.
PSR_A_BIT bis is set automatically as arm cortex-r4 reference manual 3.7.4.
So we don't need to set this bit.
Signed-off-by: EunBong Song <eunb.song@samsung.com>
* arm/armv7-r: Fix some wrong MPU register definition.
Change MPU_RBAR_ADDR_MASK and MPU_RACR_TEX_SHIFT mask as
arm cortex-r4 reference manual.
Region Base Address Register 0-4 bits are reserved.
MPU Region Access control register type 3-5 bits.
Signed-off-by: EunBong Song <eunb.song@samsung.com>
* driver/mtd: fix compilation error.
This commit fixes below compilation errors.
CC: mtd/smart.c
mtd/smart.c:182:22: error: 'gWearBitToLevelMap4' defined but not used [-Werror=unused-const-variable=]
static const uint8_t gWearBitToLevelMap4[] =
^~~~~~~~~~~~~~~~~~~
mtd/smart.c:170:22: error: 'gWearLevelToBitMap4' defined but not used [-Werror=unused-const-variable=]
static const uint8_t gWearLevelToBitMap4[] =
^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [smart.o] Error 1
Signed-off-by: Junyeon LEE <junyeon2.lee@samsung.com>
Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
@@ -5,6 +5,13 @@
|
||||
|
||||
comment "ARMv7-R Configuration Options"
|
||||
|
||||
config ARMV7R_HAVE_GICv2
|
||||
bool "ARMV7R_GICv2 support"
|
||||
default y
|
||||
---help---
|
||||
Selected by the configuration tool if the architecture supports the
|
||||
Generic Interrupt Controller (GIC)
|
||||
|
||||
config ARMV7R_MEMINIT
|
||||
bool
|
||||
default y if BOOT_SDRAM_DATA
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -190,6 +190,7 @@ __start:
|
||||
mov r0, #0
|
||||
mcr CP15_BPIALL(r0) /* Invalidate entire branch prediction array */
|
||||
mcr CP15_ICIALLU(r0) /* Invalidate I-cache */
|
||||
mcr CP15_DCIALLU(r0) /* Invalidate D-cache */
|
||||
|
||||
/* Configure the system control register (see sctrl.h) */
|
||||
|
||||
|
||||
@@ -131,9 +131,15 @@ void up_initial_state(struct tcb_s *tcb)
|
||||
|
||||
#ifndef CONFIG_ARMV7R_DECODEFIQ
|
||||
|
||||
cpsr |= (PSR_F_BIT | PSR_A_BIT | PSR_E_BIT);
|
||||
cpsr |= PSR_F_BIT;
|
||||
|
||||
#endif /* !CONFIG_ARMV7R_DECODEFIQ */
|
||||
|
||||
#ifdef CONFIG_ENDIAN_BIG
|
||||
|
||||
cpsr |= PSR_E_BIT;
|
||||
|
||||
#endif /* CONFIG_ENDIAN_BIG */
|
||||
#endif /* CONFIG_SUPPRESS_INTERRUPTS */
|
||||
|
||||
xcp->regs[REG_CPSR] = cpsr;
|
||||
|
||||
@@ -151,7 +151,11 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
||||
*/
|
||||
|
||||
CURRENT_REGS[REG_PC] = (uint32_t)up_sigdeliver;
|
||||
CURRENT_REGS[REG_CPSR] = (PSR_MODE_SVC | PSR_I_BIT | PSR_F_BIT | PSR_A_BIT | PSR_E_BIT);
|
||||
CURRENT_REGS[REG_CPSR] = (PSR_MODE_SVC | PSR_I_BIT | PSR_F_BIT);
|
||||
|
||||
#ifdef CONFIG_ENDIAN_BIG
|
||||
CURRENT_REGS[REG_CPSR] |= PSR_E_BIT;
|
||||
#endif
|
||||
|
||||
/* And make sure that the saved context in the TCB is the same
|
||||
* as the interrupt return context.
|
||||
@@ -182,7 +186,11 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
||||
*/
|
||||
|
||||
tcb->xcp.regs[REG_PC] = (uint32_t)up_sigdeliver;
|
||||
tcb->xcp.regs[REG_CPSR] = (PSR_MODE_SVC | PSR_I_BIT | PSR_F_BIT | PSR_A_BIT | PSR_E_BIT);
|
||||
tcb->xcp.regs[REG_CPSR] = (PSR_MODE_SVC | PSR_I_BIT | PSR_F_BIT);
|
||||
|
||||
#ifdef CONFIG_ENDIAN_BIG
|
||||
tcb->xcp.regs[REG_CPSR] |= PSR_E_BIT;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,5 +165,6 @@
|
||||
#define CP15_CNTVCT(r,n) _CP15(1, r, c14, c14, n) /* Virtual Count register */
|
||||
#define CP15_CNTP_CVAL(r,n) _CP15(2, r, c14, c14, n) /* PL1 Physical Timer CompareValue register */
|
||||
#define CP15_CNTV_CVAL(r,n) _CP15(3, r, c14, c14, n) /* Virtual Timer CompareValue register */
|
||||
#define CP15_DCIALLU(r) _CP15(0, r, c15, c5, 0) /* Invalidate data cache */
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_ARMV7_R_CP15_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,78 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/armv7-r/mpcore.h
|
||||
* Generic Interrupt Controller Definitions
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Reference:
|
||||
* Cortex™-A9 MPCore, Revision: r4p1, Technical Reference Manual, ARM DDI
|
||||
* 0407I (ID091612).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_SRC_ARMV7_R_MPCORE_H
|
||||
#define __ARCH_ARM_SRC_ARMV7_R_MPCORE_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "chip.h" /* For CHIP_MPCORE_VBASE */
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* MPCore registers are memory mapped and accessed through a processor
|
||||
* specific private address space via the SCU. The Cortex-A9 MCU chip.h
|
||||
* header file must provide the definition CHIP_MPCORE_VBASE to access this
|
||||
* the registers in this memory region.
|
||||
*/
|
||||
|
||||
/* Peripheral Base Offsets **************************************************/
|
||||
|
||||
#define MPCORE_SCU_OFFSET 0x0000 /* 0x0000-0x00fc SCU registers */
|
||||
#define MPCORE_ICC_OFFSET 0x2000 /* 0x0000-0x00FC Interrupt conroller interface */
|
||||
#define MPCORE_GTM_OFFSET 0x0200 /* 0x0200-0x02ff Global timer */
|
||||
/* 0x0300-0x05ff Reserved */
|
||||
#define MPCORE_PTM_OFFSET 0x0600 /* 0x0600-0x06ff Private timers and watchdogs */
|
||||
/* 0x0700-0x07ff Reserved */
|
||||
#define MPCORE_ICD_OFFSET 0x1000 /* 0x1000-0x1fff Interrupt Distributor */
|
||||
|
||||
/* Peripheral Base Addresses ************************************************/
|
||||
|
||||
#define MPCORE_SCU_VBASE (CHIP_MPCORE_VBASE+MPCORE_SCU_OFFSET)
|
||||
#define MPCORE_ICC_VBASE (CHIP_MPCORE_VBASE+MPCORE_ICC_OFFSET)
|
||||
#define MPCORE_GTM_VBASE (CHIP_MPCORE_VBASE+MPCORE_GTM_OFFSET)
|
||||
#define MPCORE_PTM_VBASE (CHIP_MPCORE_VBASE+MPCORE_PTM_OFFSET)
|
||||
#define MPCORE_ICD_VBASE (CHIP_MPCORE_VBASE+MPCORE_ICD_OFFSET)
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_ARMV7_R_MPCORE_H */
|
||||
@@ -66,9 +66,10 @@
|
||||
#define MPUIR_IREGION_SHIFT (16) /* Bits 16-23: Number MPU instruction regions */
|
||||
#define MPUIR_IREGION_MASK (0xff << MPUIR_IREGION_SHIFT)
|
||||
|
||||
/* Region Base Address Register Definitions */
|
||||
|
||||
#define MPU_RBAR_ADDR_MASK 0xfffffffc
|
||||
/* Region Base Address Register Definitions
|
||||
* [31:5] Physical base address. Defines the base address of a region.
|
||||
*/
|
||||
#define MPU_RBAR_ADDR_MASK 0xffffffe0
|
||||
|
||||
/* Region Size and Enable Register */
|
||||
|
||||
@@ -93,7 +94,7 @@
|
||||
#define MPU_RACR_B (1 << 0) /* Bit 0: Bufferable */
|
||||
#define MPU_RACR_C (1 << 1) /* Bit 1: Cacheable */
|
||||
#define MPU_RACR_S (1 << 2) /* Bit 2: Shareable */
|
||||
#define MPU_RACR_TEX_SHIFT (8) /* Bits 0-2: Memory attributes (with C and B) */
|
||||
#define MPU_RACR_TEX_SHIFT (3) /* Bits 3-5: Type extension */
|
||||
#define MPU_RACR_TEX_MASK (7 << MPU_RACR_TEX_SHIFT)
|
||||
# define MPU_RACR_TEX(n) ((uint32_t)(n) << MPU_RACR_TEX_SHIFT)
|
||||
#define MPU_RACR_AP_SHIFT (8) /* Bits 8-10: Access permission */
|
||||
@@ -486,6 +487,52 @@ static inline void mpu_user_flash(uintptr_t base, size_t size)
|
||||
mpu_set_drsr(regval);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mpu_priv_noncache
|
||||
*
|
||||
* Description:
|
||||
* Configure a non-cacheable region as privileged internal memory
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void mpu_priv_noncache(uintptr_t base, size_t size)
|
||||
{
|
||||
unsigned int region = mpu_allocregion();
|
||||
uint32_t regval;
|
||||
uint8_t l2size;
|
||||
uint8_t subregions;
|
||||
|
||||
/* Select the region */
|
||||
|
||||
mpu_set_rgnr(region);
|
||||
|
||||
/* Select the region base address */
|
||||
|
||||
mpu_set_drbar(base & MPU_RBAR_ADDR_MASK);
|
||||
|
||||
/* Select the region size and the sub-region map */
|
||||
|
||||
l2size = mpu_log2regionceil(size);
|
||||
subregions = mpu_subregion(base, size, l2size);
|
||||
|
||||
/* The configure the region
|
||||
* inner/outer non-cache : TEX(4), C(0), B(0), S(1)
|
||||
*/
|
||||
|
||||
regval = /* Not Cacheable */
|
||||
/* Not Bufferable */
|
||||
MPU_RACR_S | /* Shareable */
|
||||
MPU_RACR_TEX(4) | /* TEX */
|
||||
MPU_RACR_AP_RWRW | /* P:RO U:None */
|
||||
MPU_RACR_XN; /* Instruction access disable */
|
||||
mpu_set_dracr(regval);
|
||||
|
||||
regval = MPU_RASR_ENABLE | /* Enable region */
|
||||
MPU_RASR_RSIZE_LOG2((uint32_t)l2size) | /* Region size */
|
||||
((uint32_t)subregions << MPU_RASR_SRD_SHIFT); /* Sub-regions */
|
||||
mpu_set_drsr(regval);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mpu_priv_flash
|
||||
*
|
||||
@@ -734,6 +781,51 @@ static inline void mpu_peripheral(uintptr_t base, size_t size)
|
||||
mpu_set_drsr(regval);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mpu_user_intsram_wb
|
||||
*
|
||||
* Description:
|
||||
* Configure a region as user internal SRAM
|
||||
* Unlike a mpu_user_intsram, this regions includes WB/WA cache policy
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void mpu_user_intsram_wb(uintptr_t base, size_t size)
|
||||
{
|
||||
unsigned int region = mpu_allocregion();
|
||||
uint32_t regval;
|
||||
uint8_t l2size;
|
||||
uint8_t subregions;
|
||||
|
||||
/* Select the region */
|
||||
|
||||
mpu_set_rgnr(region);
|
||||
|
||||
/* Select the region base address */
|
||||
|
||||
mpu_set_drbar(base & MPU_RBAR_ADDR_MASK);
|
||||
|
||||
/* Select the region size and the sub-region map */
|
||||
|
||||
l2size = mpu_log2regionceil(size);
|
||||
subregions = mpu_subregion(base, size, l2size);
|
||||
|
||||
/* The configure the region
|
||||
* WB/Write Allocate: TEX(5), C(0), B(1), S(1)
|
||||
*/
|
||||
|
||||
regval = /* Not Cacheable */
|
||||
MPU_RACR_B | /* Not Bufferable */
|
||||
MPU_RACR_TEX(5) | /* TEX */
|
||||
MPU_RACR_AP_RWRW; /* P:RW U:RW */
|
||||
mpu_set_dracr(regval);
|
||||
|
||||
regval = MPU_RASR_ENABLE | /* Enable region */
|
||||
MPU_RASR_RSIZE_LOG2((uint32_t)l2size) | /* Region size */
|
||||
((uint32_t)subregions << MPU_RASR_SRD_SHIFT); /* Sub-regions */
|
||||
mpu_set_drsr(regval);
|
||||
}
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
@@ -152,6 +152,8 @@
|
||||
#define SMART_WEAR_ZERO_MASK 0x0f
|
||||
#define SMART_WEAR_BLOCK_MASK 0x01
|
||||
|
||||
#ifdef CONFIG_MTD_SMART_WEAR_LEVEL
|
||||
|
||||
/* Bit mapping for wear level bits */
|
||||
/* These are defined to allow updating the wear leveling with the minimum
|
||||
* number of sector relocations / maximum use of 1 --> 0 transitions when
|
||||
@@ -184,6 +186,7 @@ static const uint8_t gWearBitToLevelMap4[] =
|
||||
7, 13, 10, 14, 6, 15, 5, 4,
|
||||
3, 12, 9, 8, 2, 11, 1, 0
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
|
||||
Reference in New Issue
Block a user