Re: [U-Boot-Users] [PATCH] fdt_support: add crypto node handling for MPC8{3, 5}xxE processors

2008-06-10 Thread Kumar Gala


 void ft_cpu_setup(void *blob, bd_t *bd)
 {
 + /* delete crypto node if not on an E-processor */
 + if (!IS_E_PROCESSOR(get_svr()))
 + fdt_fixup_crypto_node(blob, 0);
 +

This is wrong or you need to fix the IS_E_PROCESSOR() macro.

IS_E_PROCESSOR(svr) should be defined:

svr  0x8

or you want:

IS_E_PROCESSOR(SVR_SOC_VER(get_svr()))

- k


 #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\
 defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
   fdt_fixup_ethernet(blob, bd);
 diff --git a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h
 index 8bdfb9d..14d3d70 100644
 --- a/include/asm-ppc/processor.h
 +++ b/include/asm-ppc/processor.h
 @@ -883,6 +883,15 @@
 /* Some parts define SVR[0:23] as the SOC version */
 #define SVR_SOC_VER(svr) (((svr)  8)  0xFF)/* SOC Version  
 fields */

 +/* whether MPC8xxxE (i.e. has SEC) */
 +#if defined(CONFIG_MPC85xx)
 +#define IS_E_PROCESSOR(svr)  (svr  0x800)
 +#else
 +#if defined(CONFIG_MPC83XX)
 +#define IS_E_PROCESSOR(spridr)   (!(spridr  0x0001))
 +#endif
 +#endif
 +
 /*
  * SVR_SOC_VER() Version Values
  */

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


[U-Boot-Users] [PATCH] fdt_support: add crypto node handling for MPC8{3, 5}xxE processors

2008-06-09 Thread Kim Phillips
crypto node if not on an E-processor.  If on 8360 or 834x family,
check rev and up-rev crypto node (to SEC rev. 2.4) property values
if on an 'EA' processor, e.g. MPC8349EA.

Signed-off-by: Kim Phillips [EMAIL PROTECTED]
---
 common/fdt_support.c|   87 +++
 cpu/mpc83xx/fdt.c   |   18 +
 cpu/mpc85xx/fdt.c   |6 +++
 include/asm-ppc/processor.h |9 
 include/fdt_support.h   |6 +++
 include/mpc83xx.h   |7 +++-
 6 files changed, 132 insertions(+), 1 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 7507744..c5b4650 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -447,3 +447,90 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
   prop, compat, fdt_strerror(err));
 }
 #endif /* CONFIG_HAS_FSL_DR_USB */
+
+#if defined(CONFIG_MPC83XX) || defined(CONFIG_MPC85xx)
+/*
+ * update crypto node properties to a specified revision of the SEC
+ * called with sec_rev == 0 if not on an mpc8xxxE processor
+ */
+void fdt_fixup_crypto_node(void *blob, int sec_rev)
+{
+   const struct sec_rev_prop {
+   u32 sec_rev;
+   u32 num_channels;
+   u32 channel_fifo_len;
+   u32 exec_units_mask;
+   u32 descriptor_types_mask;
+   } sec_rev_prop_list [] = {
+   { 0x0200, 4, 24, 0x07e, 0x01010ebf }, /* SEC 2.0 */
+   { 0x0201, 4, 24, 0x0fe, 0x012b0ebf }, /* SEC 2.1 */
+   { 0x0202, 1, 24, 0x04c, 0x0122003f }, /* SEC 2.2 */
+   { 0x0204, 4, 24, 0x07e, 0x012b0ebf }, /* SEC 2.4 */
+   { 0x0300, 4, 24, 0x9fe, 0x03ab0ebf }, /* SEC 3.0 */
+   { 0x0303, 4, 24, 0x97c, 0x03ab0abf }, /* SEC 3.3 */
+   };
+   char compat_strlist[ARRAY_SIZE(sec_rev_prop_list) *
+   sizeof(fsl,secX.Y)];
+   int crypto_node, sec_idx, err;
+   char *p;
+   u32 val;
+
+   /* locate crypto node based on lowest common compatible */
+   crypto_node = fdt_node_offset_by_compatible(blob, -1, fsl,sec2.0);
+   if (crypto_node == -FDT_ERR_NOTFOUND)
+   return;
+
+   /* delete it if not on an E-processor */
+   if (crypto_node  0  !sec_rev) {
+   fdt_del_node(blob, crypto_node);
+   return;
+   }
+
+   /* else we got called for possible uprev */
+   for (sec_idx = 0; sec_idx  ARRAY_SIZE(sec_rev_prop_list); sec_idx++)
+   if (sec_rev_prop_list[sec_idx].sec_rev == sec_rev)
+   break;
+
+   if (sec_idx == ARRAY_SIZE(sec_rev_prop_list)) {
+   puts(warning: unknown SEC revision number\n);
+   return;
+   }
+
+   val = cpu_to_fdt32(sec_rev_prop_list[sec_idx].num_channels);
+   err = fdt_setprop(blob, crypto_node, fsl,num-channels, val, 4);
+   if (err  0)
+   printf(WARNING: could not set crypto property: %s\n,
+  fdt_strerror(err));
+
+   val = cpu_to_fdt32(sec_rev_prop_list[sec_idx].descriptor_types_mask);
+   err = fdt_setprop(blob, crypto_node, fsl,descriptor-types-mask, val, 
4);
+   if (err  0)
+   printf(WARNING: could not set crypto property: %s\n,
+  fdt_strerror(err));
+
+   val = cpu_to_fdt32(sec_rev_prop_list[sec_idx].exec_units_mask);
+   err = fdt_setprop(blob, crypto_node, fsl,exec-units-mask, val, 4);
+   if (err  0)
+   printf(WARNING: could not set crypto property: %s\n,
+  fdt_strerror(err));
+
+   val = cpu_to_fdt32(sec_rev_prop_list[sec_idx].channel_fifo_len);
+   err = fdt_setprop(blob, crypto_node, fsl,channel-fifo-len, val, 4);
+   if (err  0)
+   printf(WARNING: could not set crypto property: %s\n,
+  fdt_strerror(err));
+
+   val = 0;
+   while (sec_idx = 0) {
+   p = compat_strlist + val;
+   val += sprintf(p, fsl,sec%d.%d,
+   (sec_rev_prop_list[sec_idx].sec_rev  0xff00)  8,
+   sec_rev_prop_list[sec_idx].sec_rev  0x00ff);
+   sec_idx--;
+   }
+   err = fdt_setprop(blob, crypto_node, compatible, compat_strlist, 
val);
+   if (err  0)
+   printf(WARNING: could not set crypto property: %s\n,
+  fdt_strerror(err));
+}
+#endif /* defined(CONFIG_MPC83XX) || defined(CONFIG_MPC85xx) */
diff --git a/cpu/mpc83xx/fdt.c b/cpu/mpc83xx/fdt.c
index 02c4d05..267ae6a 100644
--- a/cpu/mpc83xx/fdt.c
+++ b/cpu/mpc83xx/fdt.c
@@ -26,6 +26,7 @@
 #include common.h
 #include libfdt.h
 #include fdt_support.h
+#include asm/processor.h
 
 extern void ft_qe_setup(void *blob);
 
@@ -33,6 +34,23 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void ft_cpu_setup(void *blob, bd_t *bd)
 {
+   immap_t *immr = (immap_t *)CFG_IMMR;
+   int spridr = immr-sysconf.spridr;
+
+   /*
+* delete crypto node if not on an E-processor