<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body>
Hi<br>
<br>
I know it is better to work with LE, but the we want to be able to check
our MV64460 LE capabilities,<br>
In 750GX PPC the LE/BE configuration is set in the MSR and isn't sampled
at reset, so we have to<br>
set it to LE in the first asm commands of the U-Boot.<br>
I got a recommendation on how to do it:<br>
<pre wrap="">&gt;Little endian is selected by settin the LE bit in the MSR. It's done first
<span class="moz-txt-citetags">&gt; </span>thing in the code using the following:
<span class="moz-txt-citetags">&gt;</span>
<span class="moz-txt-citetags">&gt;</span>
<span class="moz-txt-citetags">&gt; </span>start:
<span class="moz-txt-citetags">&gt; </span>#if defined(LENDIAN)
<span class="moz-txt-citetags">&gt; </span>/*
<span class="moz-txt-citetags">&gt; </span> * If target is little endian, switch CPU to LE mode.
<span class="moz-txt-citetags">&gt; </span> * Pair each instruction with a nop so bus swapping
<span class="moz-txt-citetags">&gt; </span> * does not kill us wrt instruction order.
<span class="moz-txt-citetags">&gt; </span> */
<span class="moz-txt-citetags">&gt; </span>        isync
<span class="moz-txt-citetags">&gt; </span>        nop
<span class="moz-txt-citetags">&gt; </span>        li      r1, LO(PSL_ILE|PSL_LE)
<span class="moz-txt-citetags">&gt; </span>        nop
<span class="moz-txt-citetags">&gt; </span>        mtspr   srr1, r1
<span class="moz-txt-citetags">&gt; </span>        nop
<span class="moz-txt-citetags">&gt; </span>        lis     r1, HI(0xfff00000)
<span class="moz-txt-citetags">&gt; </span>        nop
<span class="moz-txt-citetags">&gt; </span>        ori     r1, r1, LO(_in_le)
<span class="moz-txt-citetags">&gt; </span>        nop
<span class="moz-txt-citetags">&gt; </span>        mtspr   srr0, r1
<span class="moz-txt-citetags">&gt; </span>        nop
<span class="moz-txt-citetags">&gt; </span>        sync
<span class="moz-txt-citetags">&gt; </span>        nop
<span class="moz-txt-citetags">&gt; </span>        rfi
<span class="moz-txt-citetags">&gt; </span>        nop
<span class="moz-txt-citetags">&gt; </span>_in_le:
<span class="moz-txt-citetags">&gt; </span>#else
<span class="moz-txt-citetags">&gt;</span>
<span class="moz-txt-citetags">&gt; </span>/* Clear MSR to disable interrupts and checks */
<span class="moz-txt-citetags">&gt;</span>
<span class="moz-txt-citetags">&gt; </span>        isync
<span class="moz-txt-citetags">&gt; </span>        li      r1, 0x0
<span class="moz-txt-citetags">&gt; </span>        sync
<span class="moz-txt-citetags">&gt; </span><!---->        mtmsr   r1              /* Clear MSR, turns off any translation etc */<span
 class="moz-txt-citetags">
&gt; </span>        isync
<span class="moz-txt-citetags">&gt; </span>#endif
<span class="moz-txt-citetags">&gt;</span>
<span class="moz-txt-citetags">&gt; </span><!---->Using a rfi to set the MSR may be a little overkill but it does not give you<span
 class="moz-txt-citetags">
&gt; </span><!---->any pipeline suprises! Little endian mode in PowerPC is not a "clean" little<span
 class="moz-txt-citetags">
&gt; </span>endian. Instructions are still stored in big endian mode. The NOPS in the
<span class="moz-txt-citetags">&gt; </span>code assures that the instruction order is correct since the CPU reads 64
<span class="moz-txt-citetags">&gt; </span>bits at a time and the address bits are "munged".</pre>
I tried it but it didn't work, any way I'll work on this issue later on,
and I'll update you in case it will work for me.<br>
<br>
Thanks Ronen<br>
<br>
<br>
Wolfgang Denk wrote:<br>
<blockquote type="cite"
 cite="mid20040211125516.1E173C1215@atlas.denx.de">
  <pre wrap="">In message <a class="moz-txt-link-rfc2396E" href="mailto:402A133A.8030701@il.marvell.com">&lt;402A133A.8030701@il.marvell.com&gt;</a> you wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">I'm working on Marvell boards DB64460 with 750GX, Big Endian.
We are trying to check whether we can work with the 750FX in Little 
Endian mode.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Don't.

  </pre>
  <blockquote type="cite">
    <pre wrap="">How can I change it?? if I'll will try to change it in the code , the 
code should be in BE, but I want to run in LE??
    </pre>
  </blockquote>
  <pre wrap=""><!---->
What do you mean - code in BE, running in LE???

Which specific problem are you trying to  solve?  In  general  it  is
considered  to  be  easier to stichk with the "native" byteorder (BE)
and fix any existing software (drivers) where needed.


Best regards,

Wolfgang Denk

  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="$mailwrapcol">-- 
Ronen Shitrit

M.S.I.L
D.N. Misgav  20184
Tel:   +972-4-9951000
Fax:   +972-4-9951001
Email: mailto: <a class="moz-txt-link-abbreviated" href="mailto:ronen.shitrit@il.marvell.com">ronen.shitrit@il.marvell.com</a>
_____________________________________________________________
This message may contain confidential, proprietary or legally privileged 
information. The information is intended only for the use of the individual 
or entity named above. If the reader of this message is not the intended 
recipient, you are hereby notified that any dissemination, distribution 
or copying of this communication is strictly prohibited. If you have 
received this communication in error, please notify us immediately by 
telephone, or by e-mail and delete the message from your computer.
</pre>
<br>
</body>
</html>