__FUNCTION__ and __PRETTY_FUNCTION__ are gcc extensions that predate
the C99 __func__ identifier. scripts/checkpatch.pl emits a warning
for any new use of __FUNCTION__ and recommends __func__ instead. In
C (unlike C++) __PRETTY_FUNCTION__ is identical to __func__ because
C function names do not carry signature information, so the
distinction has no behavioural effect here. The majority of the tree
already uses __func__, but a handful of older files in arch/, board/,
boot/, drivers/, examples/ and include/ still carry the gcc spellings
(55 occurrences of __FUNCTION__ across 19 files plus one
__PRETTY_FUNCTION__ in drivers/usb/musb-new/omap2430.c). Convert
them all to the C99 form so the tree is consistent and new patches
in these areas do not have to follow an outdated local style.
Ten "Unnecessary ftrace-like logging - prefer using ftrace" warnings
remain on the printf("%s\n", __func__) and dbg("%s\n", __func__)
function-entry traces in drivers/net/rtl8169.c (behind DEBUG_RTL8169*
preprocessor guards) and drivers/usb/host/ohci-hcd.c. checkpatch
matches the literal "%s\n", __func__ shape regardless of the wrapper,
so silencing those warnings would require changing the debug message
text or removing the traces entirely.
Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
88 lines
2.1 KiB
C
88 lines
2.1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright 2008 Freescale Semiconductor, Inc.
|
|
*/
|
|
|
|
#include <config.h>
|
|
#include <log.h>
|
|
#include <asm/io.h>
|
|
#include <fsl_ddr_sdram.h>
|
|
#include <linux/delay.h>
|
|
|
|
#if (CONFIG_CHIP_SELECTS_PER_CTRL > 4)
|
|
#error Invalid setting for CONFIG_CHIP_SELECTS_PER_CTRL
|
|
#endif
|
|
|
|
void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
|
|
unsigned int ctrl_num, int step)
|
|
{
|
|
unsigned int i;
|
|
struct ccsr_ddr __iomem *ddr =
|
|
(struct ccsr_ddr __iomem *)CFG_SYS_FSL_DDR_ADDR;
|
|
|
|
if (ctrl_num != 0) {
|
|
printf("%s unexpected ctrl_num = %u\n", __func__, ctrl_num);
|
|
return;
|
|
}
|
|
|
|
for (i = 0; i < CONFIG_CHIP_SELECTS_PER_CTRL; i++) {
|
|
if (i == 0) {
|
|
out_be32(&ddr->cs0_bnds, regs->cs[i].bnds);
|
|
out_be32(&ddr->cs0_config, regs->cs[i].config);
|
|
|
|
} else if (i == 1) {
|
|
out_be32(&ddr->cs1_bnds, regs->cs[i].bnds);
|
|
out_be32(&ddr->cs1_config, regs->cs[i].config);
|
|
|
|
} else if (i == 2) {
|
|
out_be32(&ddr->cs2_bnds, regs->cs[i].bnds);
|
|
out_be32(&ddr->cs2_config, regs->cs[i].config);
|
|
|
|
} else if (i == 3) {
|
|
out_be32(&ddr->cs3_bnds, regs->cs[i].bnds);
|
|
out_be32(&ddr->cs3_config, regs->cs[i].config);
|
|
}
|
|
}
|
|
|
|
out_be32(&ddr->timing_cfg_1, regs->timing_cfg_1);
|
|
out_be32(&ddr->timing_cfg_2, regs->timing_cfg_2);
|
|
out_be32(&ddr->sdram_mode, regs->ddr_sdram_mode);
|
|
out_be32(&ddr->sdram_interval, regs->ddr_sdram_interval);
|
|
|
|
/*
|
|
* 200 painful micro-seconds must elapse between
|
|
* the DDR clock setup and the DDR config enable.
|
|
*/
|
|
udelay(200);
|
|
asm volatile("sync;isync");
|
|
|
|
out_be32(&ddr->sdram_cfg, regs->ddr_sdram_cfg);
|
|
|
|
asm("sync;isync;msync");
|
|
udelay(500);
|
|
}
|
|
|
|
#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
|
|
/*
|
|
* Initialize all of memory for ECC, then enable errors.
|
|
*/
|
|
|
|
void
|
|
ddr_enable_ecc(unsigned int dram_size)
|
|
{
|
|
struct ccsr_ddr __iomem *ddr =
|
|
(struct ccsr_ddr __iomem *)(CFG_SYS_FSL_DDR_ADDR);
|
|
|
|
dma_meminit(dram_size);
|
|
|
|
/*
|
|
* Enable errors for ECC.
|
|
*/
|
|
debug("DMA DDR: err_disable = 0x%08x\n", ddr->err_disable);
|
|
ddr->err_disable = 0x00000000;
|
|
asm("sync;isync;msync");
|
|
debug("DMA DDR: err_disable = 0x%08x\n", ddr->err_disable);
|
|
}
|
|
|
|
#endif /* CONFIG_DDR_ECC && ! CONFIG_ECC_INIT_VIA_DDRCONTROLLER */
|