Skip to contentSkip to conversation

ddr: altera: Replace float multiplication with integer one

PATCH New Marek Vasut 2 participants 6 messages Aug 10, 2015 – Aug 18, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ddr: altera: Replace float multiplication with integer one

This gem is really really rare, there was an actual float used in the Altera DDR init code, which pulled in floating point ops from the libgcc, just wow.

Since we don't support floating point operations the same way Linux does not support them, replace this with an integer multiplication and division combo. This removes some 2kiB of size from the SPL as the floating point ops are no longer pulled in from libgcc.

This was detected by enabling CONFIG_USE_PRIVATE_LIBGCC=y , which does not contain the floating point bits.

---
 drivers/ddr/altera/sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sequencer.c +1 -1
index 2bd0109..f3621cf 100644
@@ -3247,7 +3247,7 @@ static void mem_skip_calibrate(void)
 			 *    (1.25 * iocfg->dll_chain_length - 2)
 			 */
 			scc_mgr_set_dqdqs_output_phase(i,
-				       1.25 * iocfg->dll_chain_length - 2);
+				       ((125 * iocfg->dll_chain_length) / 100) - 2);
 		}
 		writel(0xff, &sdr_scc_mgr->dqs_ena);
 		writel(0xff, &sdr_scc_mgr->dqs_io_ena);
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 ddr: altera: Repair uninited variable

Fix the following problem:
drivers/ddr/altera/sequencer.c: In function 'sdram_calibration_full':
drivers/ddr/altera/sequencer.c:1943:25: warning: 'found_failing_read' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (found_passing_read && found_failing_read)

                         ^
drivers/ddr/altera/sequencer.c:1803:26: note: 'found_failing_read' was declared here
  u32 found_passing_read, found_failing_read, initial_failing_dtap;
                          ^
---
 drivers/ddr/altera/sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sequencer.c +1 -1
index f3621cf..79c265f 100644
@@ -1800,7 +1800,7 @@ static int rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(const u32 grp)
 	u32 d, p, i;
 	u32 dtaps_per_ptap;
 	u32 work_bgn, work_end;
-	u32 found_passing_read, found_failing_read, initial_failing_dtap;
+	u32 found_passing_read, found_failing_read = 0, initial_failing_dtap;
 	int ret;
 
 	debug("%s:%d %u\n", __func__, __LINE__, grp);
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/2 ddr: altera: Repair uninited variable

Quoted 9 lines · Marek Vasut

Fix the following problem:
drivers/ddr/altera/sequencer.c: In function 'sdram_calibration_full':
drivers/ddr/altera/sequencer.c:1943:25: warning: 'found_failing_read' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (found_passing_read && found_failing_read)

                         ^
drivers/ddr/altera/sequencer.c:1803:26: note: 'found_failing_read' was declared here
  u32 found_passing_read, found_failing_read, initial_failing_dtap;
                          ^
Quoted 5 lines
---
 drivers/ddr/altera/sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks,
Dinh

#3 lore raw

PATCH 2/2 ddr: altera: Repair uninited variable

Quoted 17 lines · Dinh Nguyen
Quoted 16 lines · Marek Vasut

Fix the following problem:
drivers/ddr/altera/sequencer.c: In function 'sdram_calibration_full':
drivers/ddr/altera/sequencer.c:1943:25: warning: 'found_failing_read' may be used uninitialized in this function [-Wmaybe-uninitialized]

  if (found_passing_read && found_failing_read)
                         ^

drivers/ddr/altera/sequencer.c:1803:26: note: 'found_failing_read' was declared here

u32 found_passing_read, found_failing_read, initial_failing_dtap;

                          ^
Quoted 7 lines
Quoted 5 lines

---

 drivers/ddr/altera/sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-socfpga/master, thanks!

Best regards,
Marek Vasut

#4 lore raw

PATCH 1/2 ddr: altera: Replace float multiplication with integer one

In reply to Marek Vasut

drivers/ddr/altera/sequencer.c

Quoted 19 lines · Marek Vasut

This gem is really really rare, there was an actual float used in the Altera DDR init code, which pulled in floating point ops from the libgcc, just wow.

Since we don't support floating point operations the same way Linux does not support them, replace this with an integer multiplication and division combo. This removes some 2kiB of size from the SPL as the floating point ops are no longer pulled in from libgcc.

This was detected by enabling CONFIG_USE_PRIVATE_LIBGCC=y , which does not contain the floating point bits.

---
 drivers/ddr/altera/sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/altera/sequencer.c +0 -0
index 2bd0109..f3621cf 100644

Thanks,
Dinh

#5 lore raw

PATCH 1/2 ddr: altera: Replace float multiplication with integer one

Quoted 5 lines · Dinh Nguyen
Quoted 4 lines · Marek Vasut

This gem is really really rare, there was an actual float used in the Altera DDR init code, which pulled in floating point ops from the libgcc, just wow.

Quoted 7 lines
Quoted 7 lines

Since we don't support floating point operations the same way Linux does not support them, replace this with an integer multiplication and division combo. This removes some 2kiB of size from the SPL as the floating point ops are no longer pulled in from libgcc.

This was detected by enabling CONFIG_USE_PRIVATE_LIBGCC=y , which does not contain the floating point bits.

Private libgcc is indeed helpful! :-)

Quoted 10 lines
Quoted 8 lines

---

 drivers/ddr/altera/sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/ddr/altera/sequencer.c index 2bd0109..f3621cf 100644

Applied to u-boot-socfpga/master, thanks!

Best regards,
Marek Vasut