]> git.openpandora.org Git - pandora-x-loader.git/commitdiff
OMAP3: Move secure_unlock() function to not duplicate code
authorEnric Balletbo i Serra <eballetbo@gmail.com>
Wed, 25 May 2011 11:57:46 +0000 (13:57 +0200)
committerAnand Gadiyar <gadiyar@ti.com>
Thu, 14 Jul 2011 12:10:48 +0000 (17:40 +0530)
The secure_unlock() function is implemented by various boards, this
patch moves this function to a common place to not duplicate code.

 board/omap3530beagle/omap3530beagle.c :527:void secure_unlock(void)
 board/igep00x0/igep00x0.c             :271:void secure_unlock(void)
 board/omap3430sdp/omap3430sdp.c       :314:void secure_unlock(void)
 board/omap3evm/omap3evm.c             :359:void secure_unlock(void)
 board/omap3430labrador/omap3430sdp.c  :316:void secure_unlock(void)
 board/overo/overo.c                   :478:void secure_unlock(void)

Signed-off-by: Enric Balletbo i Serra <eballetbo@gmail.com>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
board/igep00x0/igep00x0.c
board/omap3430labrador/omap3430sdp.c
board/omap3430sdp/omap3430sdp.c
board/omap3530beagle/omap3530beagle.c
board/omap3evm/omap3evm.c
board/overo/overo.c
cpu/omap3/sys_info.c
include/asm/arch-omap3/sys_proto.h

index a9c02dd5954b4dc1a9f842d0121c15c845059358..8c99923916e29e27adc8dec3e8c9769fd3141eb1 100644 (file)
@@ -263,40 +263,6 @@ void prcm_init(void)
        delay(5000);
 }
 
-/*****************************************
- * Routine: secure_unlock
- * Description: Setup security registers for access
- * (GP Device only)
- *****************************************/
-void secure_unlock(void)
-{
-       /* Permission values for registers -Full fledged permissions to all */
-#define UNLOCK_1 0xFFFFFFFF
-#define UNLOCK_2 0x00000000
-#define UNLOCK_3 0x0000FFFF
-       /* Protection Module Register Target APE (PM_RT) */
-       __raw_writel(UNLOCK_1, RT_REQ_INFO_PERMISSION_1);
-       __raw_writel(UNLOCK_1, RT_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_1, RT_WRITE_PERMISSION_0);
-       __raw_writel(UNLOCK_2, RT_ADDR_MATCH_1);
-
-       __raw_writel(UNLOCK_3, GPMC_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, GPMC_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, GPMC_WRITE_PERMISSION_0);
-
-       __raw_writel(UNLOCK_3, OCM_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, OCM_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, OCM_WRITE_PERMISSION_0);
-       __raw_writel(UNLOCK_2, OCM_ADDR_MATCH_2);
-
-       /* IVA Changes */
-       __raw_writel(UNLOCK_3, IVA2_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, IVA2_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, IVA2_WRITE_PERMISSION_0);
-
-       __raw_writel(UNLOCK_1, SMS_RG_ATT0);    /* SDRC region 0 public */
-}
-
 /**********************************************************
  * Routine: try_unlock_sram()
  * Description: If chip is GP type, unlock the SRAM for
index 991a34f5225872cf9351d5d80ed279533a87ac48..2c421686de30e0d2fec6b8a01a9e9cb37743f61a 100644 (file)
@@ -308,40 +308,6 @@ void prcm_init(void)
        delay(5000);
 }
 
-/*****************************************
- * Routine: secure_unlock
- * Description: Setup security registers for access
- * (GP Device only)
- *****************************************/
-void secure_unlock(void)
-{
-       /* Permission values for registers -Full fledged permissions to all */
-       #define UNLOCK_1 0xFFFFFFFF
-       #define UNLOCK_2 0x00000000
-       #define UNLOCK_3 0x0000FFFF
-       /* Protection Module Register Target APE (PM_RT)*/
-       __raw_writel(UNLOCK_1, RT_REQ_INFO_PERMISSION_1);
-       __raw_writel(UNLOCK_1, RT_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_1, RT_WRITE_PERMISSION_0);
-       __raw_writel(UNLOCK_2, RT_ADDR_MATCH_1);
-
-       __raw_writel(UNLOCK_3, GPMC_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, GPMC_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, GPMC_WRITE_PERMISSION_0);
-
-       __raw_writel(UNLOCK_3, OCM_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, OCM_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, OCM_WRITE_PERMISSION_0);
-       __raw_writel(UNLOCK_2, OCM_ADDR_MATCH_2);
-
-       /* IVA Changes */
-       __raw_writel(UNLOCK_3, IVA2_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, IVA2_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, IVA2_WRITE_PERMISSION_0);
-
-       __raw_writel(UNLOCK_1, SMS_RG_ATT0); /* SDRC region 0 public */
-}
-
 /**********************************************************
  * Routine: try_unlock_sram()
  * Description: If chip is GP type, unlock the SRAM for
index 859ce1ef3c019e5aaca2989d4dd665e472b8dac1..fe3f8e18f0e50f0b9b25092863f54ebd14078c73 100644 (file)
@@ -306,40 +306,6 @@ void prcm_init(void)
        delay(5000);
 }
 
-/*****************************************
- * Routine: secure_unlock
- * Description: Setup security registers for access
- * (GP Device only)
- *****************************************/
-void secure_unlock(void)
-{
-       /* Permission values for registers -Full fledged permissions to all */
-       #define UNLOCK_1 0xFFFFFFFF
-       #define UNLOCK_2 0x00000000
-       #define UNLOCK_3 0x0000FFFF
-       /* Protection Module Register Target APE (PM_RT)*/
-       __raw_writel(UNLOCK_1, RT_REQ_INFO_PERMISSION_1);
-       __raw_writel(UNLOCK_1, RT_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_1, RT_WRITE_PERMISSION_0);
-       __raw_writel(UNLOCK_2, RT_ADDR_MATCH_1);
-
-       __raw_writel(UNLOCK_3, GPMC_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, GPMC_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, GPMC_WRITE_PERMISSION_0);
-
-       __raw_writel(UNLOCK_3, OCM_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, OCM_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, OCM_WRITE_PERMISSION_0);
-       __raw_writel(UNLOCK_2, OCM_ADDR_MATCH_2);
-
-       /* IVA Changes */
-       __raw_writel(UNLOCK_3, IVA2_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, IVA2_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, IVA2_WRITE_PERMISSION_0);
-
-       __raw_writel(UNLOCK_1, SMS_RG_ATT0); /* SDRC region 0 public */
-}
-
 /**********************************************************
  * Routine: try_unlock_sram()
  * Description: If chip is GP type, unlock the SRAM for
index e3105bdc508adfcac5debb496d1a0c77ce86e6b9..c861b211815eb6a2d0708fa85b48bed147be6447 100644 (file)
@@ -519,40 +519,6 @@ void prcm_init(void)
        delay(5000);
 }
 
-/*****************************************
- * Routine: secure_unlock
- * Description: Setup security registers for access
- * (GP Device only)
- *****************************************/
-void secure_unlock(void)
-{
-       /* Permission values for registers -Full fledged permissions to all */
-#define UNLOCK_1 0xFFFFFFFF
-#define UNLOCK_2 0x00000000
-#define UNLOCK_3 0x0000FFFF
-       /* Protection Module Register Target APE (PM_RT) */
-       __raw_writel(UNLOCK_1, RT_REQ_INFO_PERMISSION_1);
-       __raw_writel(UNLOCK_1, RT_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_1, RT_WRITE_PERMISSION_0);
-       __raw_writel(UNLOCK_2, RT_ADDR_MATCH_1);
-
-       __raw_writel(UNLOCK_3, GPMC_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, GPMC_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, GPMC_WRITE_PERMISSION_0);
-
-       __raw_writel(UNLOCK_3, OCM_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, OCM_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, OCM_WRITE_PERMISSION_0);
-       __raw_writel(UNLOCK_2, OCM_ADDR_MATCH_2);
-
-       /* IVA Changes */
-       __raw_writel(UNLOCK_3, IVA2_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, IVA2_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, IVA2_WRITE_PERMISSION_0);
-
-       __raw_writel(UNLOCK_1, SMS_RG_ATT0);    /* SDRC region 0 public */
-}
-
 /**********************************************************
  * Routine: try_unlock_sram()
  * Description: If chip is GP type, unlock the SRAM for
index 2180594f623e0954ed7122ae903e32af70c978f0..164c21107f9988791a817e4d9e574a55cfc6dfa8 100644 (file)
@@ -351,40 +351,6 @@ void prcm_init(void)
        delay(5000);
 }
 
-/*****************************************
- * Routine: secure_unlock
- * Description: Setup security registers for access
- * (GP Device only)
- *****************************************/
-void secure_unlock(void)
-{
-       /* Permission values for registers -Full fledged permissions to all */
-       #define UNLOCK_1 0xFFFFFFFF
-       #define UNLOCK_2 0x00000000
-       #define UNLOCK_3 0x0000FFFF
-       /* Protection Module Register Target APE (PM_RT)*/
-       __raw_writel(UNLOCK_1, RT_REQ_INFO_PERMISSION_1);
-       __raw_writel(UNLOCK_1, RT_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_1, RT_WRITE_PERMISSION_0);
-       __raw_writel(UNLOCK_2, RT_ADDR_MATCH_1);
-
-       __raw_writel(UNLOCK_3, GPMC_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, GPMC_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, GPMC_WRITE_PERMISSION_0);
-
-       __raw_writel(UNLOCK_3, OCM_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, OCM_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, OCM_WRITE_PERMISSION_0);
-       __raw_writel(UNLOCK_2, OCM_ADDR_MATCH_2);
-
-       /* IVA Changes */
-       __raw_writel(UNLOCK_3, IVA2_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, IVA2_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, IVA2_WRITE_PERMISSION_0);
-
-       __raw_writel(UNLOCK_1, SMS_RG_ATT0); /* SDRC region 0 public */
-}
-
 /**********************************************************
  * Routine: try_unlock_sram()
  * Description: If chip is GP type, unlock the SRAM for
index d852986b99f95d1a7e726602ce53a4dd75c9bc2a..1c8102b0b334dadf9d1a27fce560a140929a4dfc 100644 (file)
@@ -470,40 +470,6 @@ void prcm_init(void)
        delay(5000);
 }
 
-/*****************************************
- * Routine: secure_unlock
- * Description: Setup security registers for access
- * (GP Device only)
- *****************************************/
-void secure_unlock(void)
-{
-       /* Permission values for registers -Full fledged permissions to all */
-       #define UNLOCK_1 0xFFFFFFFF
-       #define UNLOCK_2 0x00000000
-       #define UNLOCK_3 0x0000FFFF
-       /* Protection Module Register Target APE (PM_RT)*/
-       __raw_writel(UNLOCK_1, RT_REQ_INFO_PERMISSION_1);
-       __raw_writel(UNLOCK_1, RT_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_1, RT_WRITE_PERMISSION_0);
-       __raw_writel(UNLOCK_2, RT_ADDR_MATCH_1);
-
-       __raw_writel(UNLOCK_3, GPMC_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, GPMC_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, GPMC_WRITE_PERMISSION_0);
-
-       __raw_writel(UNLOCK_3, OCM_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, OCM_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, OCM_WRITE_PERMISSION_0);
-       __raw_writel(UNLOCK_2, OCM_ADDR_MATCH_2);
-
-       /* IVA Changes */
-       __raw_writel(UNLOCK_3, IVA2_REQ_INFO_PERMISSION_0);
-       __raw_writel(UNLOCK_3, IVA2_READ_PERMISSION_0);
-       __raw_writel(UNLOCK_3, IVA2_WRITE_PERMISSION_0);
-
-       __raw_writel(UNLOCK_1, SMS_RG_ATT0); /* SDRC region 0 public */
-}
-
 /**********************************************************
  * Routine: try_unlock_sram()
  * Description: If chip is GP type, unlock the SRAM for
index 77b25a5f08734f01ddca3a42298801fd0b04ee35..09bd823252ce7213ba2a2d59d538e84f28650882 100644 (file)
@@ -257,3 +257,36 @@ void get_sys_clkin_sel(u32 osc_clk, u32 *sys_clkin_sel)
        else if (osc_clk == S12M)
                *sys_clkin_sel = 0;
 }
+
+/*
+ * secure_unlock(void): setup security registers for access
+ * (GP Device only)
+ */
+void secure_unlock(void)
+{
+       /* Permission values for registers -Full fledged permissions to all */
+       #define UNLOCK_1 0xFFFFFFFF
+       #define UNLOCK_2 0x00000000
+       #define UNLOCK_3 0x0000FFFF
+       /* Protection Module Register Target APE (PM_RT)*/
+       __raw_writel(UNLOCK_1, RT_REQ_INFO_PERMISSION_1);
+       __raw_writel(UNLOCK_1, RT_READ_PERMISSION_0);
+       __raw_writel(UNLOCK_1, RT_WRITE_PERMISSION_0);
+       __raw_writel(UNLOCK_2, RT_ADDR_MATCH_1);
+
+       __raw_writel(UNLOCK_3, GPMC_REQ_INFO_PERMISSION_0);
+       __raw_writel(UNLOCK_3, GPMC_READ_PERMISSION_0);
+       __raw_writel(UNLOCK_3, GPMC_WRITE_PERMISSION_0);
+
+       __raw_writel(UNLOCK_3, OCM_REQ_INFO_PERMISSION_0);
+       __raw_writel(UNLOCK_3, OCM_READ_PERMISSION_0);
+       __raw_writel(UNLOCK_3, OCM_WRITE_PERMISSION_0);
+       __raw_writel(UNLOCK_2, OCM_ADDR_MATCH_2);
+
+       /* IVA Changes */
+       __raw_writel(UNLOCK_3, IVA2_REQ_INFO_PERMISSION_0);
+       __raw_writel(UNLOCK_3, IVA2_READ_PERMISSION_0);
+       __raw_writel(UNLOCK_3, IVA2_WRITE_PERMISSION_0);
+
+       __raw_writel(UNLOCK_1, SMS_RG_ATT0); /* SDRC region 0 public */
+}
index 8b408224a85ed3a653fcb62f8f7ab50cb775de3b..7e768fa99d3def44b9759eefe4d64ce303de7e0a 100644 (file)
@@ -54,6 +54,8 @@ u32 get_device_type(void);
 
 void get_sys_clkin_sel(u32 osc_clk, u32 *sys_clkin_sel);
 
+void secure_unlock(void);
+
 void sr32(u32 addr, u32 start_bit, u32 num_bits, u32 value);
 u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound);
 void sdelay(unsigned long loops);