mpc85xx: fix upmconfig
PATCH 1/1 mpc85xx: fix upmconfig
This actually shouldn't work. Imagina 0xf0000000 base address that gets translated into 0x1e000 and causes my box to hang. Writing to 0xf0000000 seems the better way.
Also don't compare against the UPM mask but agaist the MSEL mask.
--- cpu/mpc85xx/cpu.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
cpu/mpc85xx/cpu.c +3 -4
@@ -71,8 +71,7 @@ struct cpu_type *identify_cpu(u32 ver)static void set_lcb_clock (uint clkdiv) { -volatile immap_t *immap = (immap_t *)CFG_IMMR ; -volatile ccsr_lbc_t *lbc= &immap->im_lbc; +volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);uint lcrr; lcrr = lbc->lcrr;
@@ -352,8 +351,8 @@ void upmconfig (uint upm, uint * table, uint size) i++, brp += 2, orp += 2) {/* Look for a valid BR with selected UPM */ -if ((in_be32 (brp) & (BR_V | upmmask)) == (BR_V | upmmask)) { - dummy = (volatile u8 *)(in_be32 (brp) >>BR_BA_SHIFT ); +if ((in_be32 (brp) & (BR_V |BR_MSEL )) == (BR_V | upmmask)) { + dummy = (volatile u8 *)(in_be32 (brp) &BR_BA );break ; } }
Signature · 1 line
1.5.5.2
PATCH 1/1 mpc85xx: fix upmconfig
Quoted 27 lines · Sebastian Siewior
This actually shouldn't work. Imagina
0xf0000000base address that gets translated into0x1e000and causes my box to hang. Writing to0xf0000000seems the better way.
Also don't compare against the UPM mask but agaist the MSEL mask.Cc Sergei Poselenov <[email protected]>Cc Andy Fleming <[email protected]>Signed-off-by Sebastian Siewior <[email protected]>--- cpu/mpc85xx/cpu.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)cpu/mpc85xx/cpu.c +1
-2@@ -71,8 +71,7 @@ struct cpu_type *identify_cpu(u32 ver)static void set_lcb_clock (uint clkdiv) { -volatile immap_t *immap = (immap_t *)CFG_IMMR ; -volatile ccsr_lbc_t *lbc= &immap->im_lbc; +volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);uint lcrr; lcrr = lbc->lcrr;
cpu/mpc85xx/cpu.c void upmconfig (uint upm, uint * table, uint size) · line 355
Quoted 7 lines
cpu/mpc85xx/cpu.c +2
-2@@ -352,8 +351,8 @@ void upmconfig (uint upm, uint * table, uint size) i++, brp += 2, orp += 2) {/* Look for a valid BR with selected UPM */ -if ((in_be32 (brp) & (BR_V | upmmask)) == (BR_V | upmmask)) { - dummy = (volatile u8 *)(in_be32 (brp) >>BR_BA_SHIFT ); +if ((in_be32 (brp) & (BR_V |BR_MSEL )) == (BR_V | upmmask)) { + dummy = (volatile u8 *)(in_be32 (brp) &BR_BA );
This looks pretty good to me, but I'm not very familiar with this code. Could you explain a little more deeply what is wrong with the old way, and why the new way is better? I think I understand the problem with the BA_SHIFT (actually, it alarms me, a bit), but I'm not so sure about using MSEL on one side of the ==, and not the other.
Andy
PATCH 1/1 mpc85xx: fix upmconfig
Quoted 15 lines · * Andy Fleming | 2008-07-14 19:32:56 [-0500]:
Quoted 15 lines
cpu/mpc85xx/cpu.c +1
-2@@ -71,8 +71,7 @@ struct cpu_type *identify_cpu(u32 ver)static void set_lcb_clock (uint clkdiv) { -volatile immap_t *immap = (immap_t *)CFG_IMMR ; -volatile ccsr_lbc_t *lbc= &immap->im_lbc; +volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);uint lcrr; lcrr = lbc->lcrr;@@ -352,8 +351,8 @@ void upmconfig (uint upm, uint * table, uint size) i++, brp += 2, orp += 2) {
Quoted 10 lines
cpu/mpc85xx/cpu.c void upmconfig (uint upm, uint * table, uint size) · line 355
Quoted 5 lines
cpu/mpc85xx/cpu.c +2
-2/* Look for a valid BR with selected UPM */ -if ((in_be32 (brp) & (BR_V | upmmask)) == (BR_V | upmmask)) { - dummy = (volatile u8 *)(in_be32 (brp) >>BR_BA_SHIFT ); +if ((in_be32 (brp) & (BR_V |BR_MSEL )) == (BR_V | upmmask)) { + dummy = (volatile u8 *)(in_be32 (brp) &BR_BA );This looks pretty good to me, but I'm not very familiar with this code. Could you explain a little more deeply what is wrong with the old way, and why the new way is better? I think I understand the problem with the
BA_SHIFT(actually, it alarms me, a bit), but I'm not
the first part, changes the computation of the dummy address. The spec
[1] chap 14.4.4.2 referes to the dummy address as "...by a (dummy) write transaction to the relevant UPM assigned bank." The address is assigned in the relevant BRx[BA] register (bits 0-16 if not used extened addresses) and therefore shift is wrong, logical and is correct.
Quoted 1 line
so sure about using MSEL on one side of the ==, and not the other.
BRx[MSEL] specifies the machines used (table 14-4, pdf page 631 in my document). MSEL is the mask while upmmask (UPMC, UPMB, or UPMB) is the content of the register. For instance, if your BR[MSEL] register would have all bits set (what is reserved / not legal) than the old compare method would match UPMA, UPMB & UPMC where is the new method would skip it.
Quoted 1 line
Andy
Sebastian
[1] MPC8544ERM.pdf Rev1
PATCH 1/1 mpc85xx: fix upmconfig
Hi Andy,
Quoted 1 line · in message <[email protected]> Sebastian Siewior wrote:
* Andy Fleming | 2008-07-14 19:32:56 [-0500]:
...
Quoted 10 lines
Quoted 4 lines
This looks pretty good to me, but I'm not very familiar with this code. Could you explain a little more deeply what is wrong with the old way, and why the new way is better? I think I understand the problem with the
BA_SHIFT(actually, it alarms me, a bit), but I'm notthe first part, changes the computation of the dummy address. The spec
[1] chap 14.4.4.2 referes to the dummy address as "...by a (dummy) write transaction to the relevant UPM assigned bank." The address is assigned in the relevant BRx[BA] register (bits 0-16 if not used extened addresses) and therefore shift is wrong, logical and is correct.
Quoted 7 lines
Quoted 1 line
so sure about using MSEL on one side of the ==, and not the other.
BRx[MSEL] specifies the machines used (table 14-4, pdf page 631 in my document). MSEL is the mask while upmmask (UPMC, UPMB, or UPMB) is the content of the register. For instance, if your BR[MSEL] register would have all bits set (what is reserved / not legal) than the old compare method would match UPMA, UPMB & UPMC where is the new method would skip it.
Any comment about the state of this patch? Thanks in advance.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Many aligators will be slain, but the swamp will remain.
PATCH 1/1 mpc85xx: fix upmconfig
In reply to Sebastian SiewiorHi,
Quoted 17 lines
This actually shouldn't work. Imagina
0xf0000000base address that gets translated into0x1e000and causes my box to hang. Writing to0xf0000000seems the better way.
Also don't compare against the UPM mask but agaist the MSEL mask.Cc Sergei Poselenov <[email protected]>Cc Andy Fleming <[email protected]>Signed-off-by Sebastian Siewior <[email protected]>--- cpu/mpc85xx/cpu.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)cpu/mpc85xx/cpu.c +0
-0
cpu/mpc85xx/cpu.c struct cpu_type *identify_cpu(u32 ver) · line 77
Quoted 9 lines
cpu/mpc85xx/cpu.c +1
-2@@ -71,8 +71,7 @@ struct cpu_type *identify_cpu(u32 ver)static void set_lcb_clock (uint clkdiv) { -volatile immap_t *immap = (immap_t *)CFG_IMMR ; -volatile ccsr_lbc_t *lbc= &immap->im_lbc; +volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);uint lcrr; lcrr = lbc->lcrr;
This hunk does not apply for me, but the next one unbreaks the socrates board, so
cpu/mpc85xx/cpu.c void upmconfig (uint upm, uint * table, uint size) · line 358
Quoted 11 lines
cpu/mpc85xx/cpu.c +2
-2@@ -352,8 +351,8 @@ void upmconfig (uint upm, uint * table, uint size) i++, brp += 2, orp += 2) {/* Look for a valid BR with selected UPM */ -if ((in_be32 (brp) & (BR_V | upmmask)) == (BR_V | upmmask)) { - dummy = (volatile u8 *)(in_be32 (brp) >>BR_BA_SHIFT ); +if ((in_be32 (brp) & (BR_V |BR_MSEL )) == (BR_V | upmmask)) { + dummy = (volatile u8 *)(in_be32 (brp) &BR_BA );break ; } }
Cheers
Detlev
Signature · 5 lines
error compiling committee.c: too many arguments to function -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de