aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/common.c
diff options
context:
space:
mode:
authorCyril Chemparathy <cyril@ti.com>2010-05-07 17:06:34 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-05-13 13:05:24 -0400
commit3347db8392486a1b52aab980cc445cf505c36d45 (patch)
treed0ee14d2c658b48a355d3e845dd791b5f3736f33 /arch/arm/mach-davinci/common.c
parentdb6db5d8474b16811566e0e919d060e2856d5ad9 (diff)
Davinci: jtag_id - use ioremap()
This patch replaces the jtag id base info in davinci_soc_info with a physical address which is then ioremap()ed within common code. This patch (in combination with a similar change for PSC) will allow us to eliminate the SYSCFG nastiness in DA8xx code. Signed-off-by: Cyril Chemparathy <cyril@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/common.c')
-rw-r--r--arch/arm/mach-davinci/common.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c
index f8221c5ee380..65e073df5bc9 100644
--- a/arch/arm/mach-davinci/common.c
+++ b/arch/arm/mach-davinci/common.c
@@ -37,26 +37,43 @@ void davinci_get_mac_addr(struct memory_accessor *mem_acc, void *context)
37 pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr); 37 pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr);
38} 38}
39 39
40static struct davinci_id * __init davinci_get_id(u32 jtag_id) 40static int __init davinci_init_id(struct davinci_soc_info *soc_info)
41{ 41{
42 int i; 42 int i;
43 struct davinci_id *dip; 43 struct davinci_id *dip;
44 u8 variant = (jtag_id & 0xf0000000) >> 28; 44 u8 variant;
45 u16 part_no = (jtag_id & 0x0ffff000) >> 12; 45 u16 part_no;
46 void __iomem *base;
47
48 base = ioremap(soc_info->jtag_id_reg, SZ_4K);
49 if (!base) {
50 pr_err("Unable to map JTAG ID register\n");
51 return -ENOMEM;
52 }
53
54 soc_info->jtag_id = __raw_readl(base);
55 iounmap(base);
46 56
47 for (i = 0, dip = davinci_soc_info.ids; i < davinci_soc_info.ids_num; 57 variant = (soc_info->jtag_id & 0xf0000000) >> 28;
58 part_no = (soc_info->jtag_id & 0x0ffff000) >> 12;
59
60 for (i = 0, dip = soc_info->ids; i < soc_info->ids_num;
48 i++, dip++) 61 i++, dip++)
49 /* Don't care about the manufacturer right now */ 62 /* Don't care about the manufacturer right now */
50 if ((dip->part_no == part_no) && (dip->variant == variant)) 63 if ((dip->part_no == part_no) && (dip->variant == variant)) {
51 return dip; 64 soc_info->cpu_id = dip->cpu_id;
52 65 pr_info("DaVinci %s variant 0x%x\n", dip->name,
53 return NULL; 66 dip->variant);
67 return 0;
68 }
69
70 pr_err("Unknown DaVinci JTAG ID 0x%x\n", soc_info->jtag_id);
71 return -EINVAL;
54} 72}
55 73
56void __init davinci_common_init(struct davinci_soc_info *soc_info) 74void __init davinci_common_init(struct davinci_soc_info *soc_info)
57{ 75{
58 int ret; 76 int ret;
59 struct davinci_id *dip;
60 77
61 if (!soc_info) { 78 if (!soc_info) {
62 ret = -EINVAL; 79 ret = -EINVAL;
@@ -84,18 +101,9 @@ void __init davinci_common_init(struct davinci_soc_info *soc_info)
84 * We want to check CPU revision early for cpu_is_xxxx() macros. 101 * We want to check CPU revision early for cpu_is_xxxx() macros.
85 * IO space mapping must be initialized before we can do that. 102 * IO space mapping must be initialized before we can do that.
86 */ 103 */
87 davinci_soc_info.jtag_id = __raw_readl(davinci_soc_info.jtag_id_base); 104 ret = davinci_init_id(&davinci_soc_info);
88 105 if (ret < 0)
89 dip = davinci_get_id(davinci_soc_info.jtag_id);
90 if (!dip) {
91 ret = -EINVAL;
92 pr_err("Unknown DaVinci JTAG ID 0x%x\n",
93 davinci_soc_info.jtag_id);
94 goto err; 106 goto err;
95 }
96
97 davinci_soc_info.cpu_id = dip->cpu_id;
98 pr_info("DaVinci %s variant 0x%x\n", dip->name, dip->variant);
99 107
100 if (davinci_soc_info.cpu_clks) { 108 if (davinci_soc_info.cpu_clks) {
101 ret = davinci_clk_init(davinci_soc_info.cpu_clks); 109 ret = davinci_clk_init(davinci_soc_info.cpu_clks);