From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH v2 11/18] ddr: socfpga: gen5: read handoff information from devicetree
Date: Tue, 15 Oct 2019 22:10:24 +0200 [thread overview]
Message-ID: <20191015201032.20156-12-simon.k.r.goldschmidt@gmail.com> (raw)
In-Reply-To: <20191015201032.20156-1-simon.k.r.goldschmidt@gmail.com>
Instead of reading SDRAM handoff data from 'qts' files, read it from
devicetree.
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
---
Changes in v2: None
drivers/ddr/altera/sdram_gen5.c | 61 ++++++++++++++++++++++++++++-----
1 file changed, 53 insertions(+), 8 deletions(-)
diff --git a/drivers/ddr/altera/sdram_gen5.c b/drivers/ddr/altera/sdram_gen5.c
index 91d9f6c0fc..09ee45026c 100644
--- a/drivers/ddr/altera/sdram_gen5.c
+++ b/drivers/ddr/altera/sdram_gen5.c
@@ -572,20 +572,65 @@ static unsigned long sdram_calculate_size(
static int altera_gen5_sdram_ofdata_to_platdata(struct udevice *dev)
{
struct altera_gen5_sdram_platdata *plat = dev->platdata;
+ int sz;
plat->sdr = (struct socfpga_sdr *)devfdt_get_addr_index(dev, 0);
if (!plat->sdr)
return -ENODEV;
/* Get handoff config */
- plat->cfg = socfpga_get_sdram_config();
- plat->rwcfg = socfpga_get_sdram_rwmgr_config();
- plat->iocfg = socfpga_get_sdram_io_config();
- plat->misccf = socfpga_get_sdram_misc_config();
-
- socfpga_get_seq_inst_init(&plat->inst_rom_init,
- &plat->inst_rom_init_len);
- socfpga_get_seq_ac_init(&plat->ac_rom_init, &plat->ac_rom_init_len);
+ plat->cfg = (const struct socfpga_sdram_config *)
+ dev_read_u8_array_ptr(dev, "altr,sdr-cfg", sizeof(*plat->cfg));
+ if (!plat->cfg) {
+ debug("Failed to parse altr,sdr-cfg\n");
+ return -EINVAL;
+ }
+ plat->rwcfg = (const struct socfpga_sdram_rw_mgr_config *)
+ dev_read_u8_array_ptr(dev, "altr,sdr-rw-mgr-cfg",
+ sizeof(*plat->rwcfg));
+ if (!plat->rwcfg) {
+ debug("Failed to parse altr,sdr-rw-mgr-cfg\n");
+ return -EINVAL;
+ }
+ plat->iocfg = (const struct socfpga_sdram_io_config *)
+ dev_read_u8_array_ptr(dev, "altr,sdr-io-cfg",
+ sizeof(*plat->iocfg));
+ if (!plat->iocfg) {
+ debug("Failed to parse altr,sdr-io-cfg\n");
+ return -EINVAL;
+ }
+ plat->misccf = (const struct socfpga_sdram_misc_config *)
+ dev_read_u8_array_ptr(dev, "altr,sdr-misc-cfg",
+ sizeof(*plat->misccf));
+ if (!plat->misccf) {
+ debug("Failed to parse altr,sdr-misc-cfg\n");
+ return -EINVAL;
+ }
+
+ sz = dev_read_size(dev, "altr,sdr-inst-rom-init");
+ if (sz <= 0) {
+ debug("Failed to read altr,sdr-inst-rom-init size\n");
+ return sz;
+ }
+ plat->inst_rom_init_len = sz / sizeof(u32);
+ plat->inst_rom_init = (const u32*)dev_read_u8_array_ptr(dev,
+ "altr,sdr-inst-rom-init", sz);
+ if (!plat->inst_rom_init) {
+ debug("Failed to parse altr,sdr-inst-rom-init\n");
+ return -EINVAL;
+ }
+ sz = dev_read_size(dev, "altr,sdr-ac-rom-init");
+ if (sz <= 0) {
+ debug("Failed to read altr,sdr-ac-rom-init size\n");
+ return sz;
+ }
+ plat->ac_rom_init_len = sz / sizeof(u32);
+ plat->ac_rom_init = (const u32*)dev_read_u8_array_ptr(dev,
+ "altr,sdr-ac-rom-init", sz);
+ if (!plat->ac_rom_init) {
+ debug("Failed to parse altr,sdr-ac-rom-init\n");
+ return -EINVAL;
+ }
return 0;
}
--
2.20.1
next prev parent reply other threads:[~2019-10-15 20:10 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-15 20:10 [U-Boot] [RFC PATCH v2 00/18] arm: socfpga: gen5: move to DM Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 01/18] ddr: socfpga: gen5: constify altera_gen5_sdram_ops Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 02/18] dts: arm: socfpga: add label for clkmgr Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 03/18] arm: socfpga: gen5: increase SPL_SYS_MALLOC_F_LEN Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 04/18] timer: dw-apb: add reset handling Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 05/18] arm: socfpga: gen5: move initial reset handling to reset driver Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 06/18] arm: dts: socfpga: add settings for gen5 clk driver Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 07/18] arm: dts: socfpga: make clock nodes available in SPL Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 08/18] socfpga: gen5: add new tool to create handoff dtsi files Simon Goldschmidt
2019-10-22 17:10 ` Dalon L Westergreen
2019-10-22 17:13 ` Simon Goldschmidt
2019-10-23 16:03 ` Dalon L Westergreen
2019-10-23 19:22 ` Simon Goldschmidt
2019-10-24 14:25 ` Dalon L Westergreen
2019-10-24 14:29 ` Simon Goldschmidt
2019-10-24 17:29 ` Dalon L Westergreen
2019-10-24 18:00 ` Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 09/18] sdram: socfpga: gen5: make config structs dts compatible Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 10/18] ddr: socfpga: gen5: fetch handoff information from 'of_to_platdata' Simon Goldschmidt
2019-10-15 20:10 ` Simon Goldschmidt [this message]
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 12/18] arm: socfpga: gen5: add readonly clk driver Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 13/18] arm: socfpga: gen5: enable DM CLK Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 14/18] arm: socfpga: gen5: move clock initialization to CLK driver Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 15/18] arm: socfpga: gen5: load CLK config from devicetree Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 16/18] spi: cadence_qspi: support DM_CLK Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 17/18] arm: socfpga: gen5: parse qspi clock from devictree Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 18/18] socfpga: gen5: move CLK and SDRAM to DM Simon Goldschmidt
2019-10-23 20:36 ` [U-Boot] [RFC PATCH v2 00/18] arm: socfpga: gen5: move " Simon Goldschmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191015201032.20156-12-simon.k.r.goldschmidt@gmail.com \
--to=simon.k.r.goldschmidt@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.