2 * External Memory Interface
4 * Copyright (C) 2011 Texas Instruments Incorporated
5 * Author: Mark Salter <msalter@redhat.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/of_address.h>
17 #define NUM_EMIFA_CHIP_ENABLES 4
25 u32 cecfg[NUM_EMIFA_CHIP_ENABLES];
35 static struct of_device_id emifa_match[] __initdata = {
36 { .compatible = "ti,c64x+emifa" },
41 * Parse device tree for existence of an EMIF (External Memory Interface)
42 * and initialize it if found.
44 static int __init c6x_emifa_init(void)
46 struct emifa_regs __iomem *regs;
47 struct device_node *node;
52 node = of_find_matching_node(NULL, emifa_match);
56 regs = of_iomap(node, 0);
60 /* look for a dscr-based enable for emifa pin buffers */
61 err = of_property_read_u32_array(node, "ti,dscr-dev-enable", &val, 1);
63 dscr_set_devstate(val, DSCR_DEVSTATE_ENABLED);
65 /* set up the chip enables */
66 p = of_get_property(node, "ti,emifa-ce-config", &len);
69 if (len > NUM_EMIFA_CHIP_ENABLES)
70 len = NUM_EMIFA_CHIP_ENABLES;
71 for (i = 0; i <= len; i++)
72 soc_writel(be32_to_cpup(&p[i]), ®s->cecfg[i]);
75 err = of_property_read_u32_array(node, "ti,emifa-burst-priority", &val, 1);
77 soc_writel(val, ®s->bprio);
79 err = of_property_read_u32_array(node, "ti,emifa-async-wait-control", &val, 1);
81 soc_writel(val, ®s->awcc);
87 pure_initcall(c6x_emifa_init);