aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-davinci/common.c52
-rw-r--r--arch/arm/mach-davinci/da830.c3
-rw-r--r--arch/arm/mach-davinci/da850.c3
-rw-r--r--arch/arm/mach-davinci/dm355.c2
-rw-r--r--arch/arm/mach-davinci/dm365.c2
-rw-r--r--arch/arm/mach-davinci/dm644x.c2
-rw-r--r--arch/arm/mach-davinci/dm646x.c2
-rw-r--r--arch/arm/mach-davinci/include/mach/common.h2
8 files changed, 37 insertions, 31 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);
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index 4f5727f0dd11..c5600b89f628 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -1188,6 +1188,7 @@ static struct davinci_timer_info da830_timer_info = {
1188static struct davinci_soc_info davinci_soc_info_da830 = { 1188static struct davinci_soc_info davinci_soc_info_da830 = {
1189 .io_desc = da830_io_desc, 1189 .io_desc = da830_io_desc,
1190 .io_desc_num = ARRAY_SIZE(da830_io_desc), 1190 .io_desc_num = ARRAY_SIZE(da830_io_desc),
1191 .jtag_id_reg = DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG,
1191 .ids = da830_ids, 1192 .ids = da830_ids,
1192 .ids_num = ARRAY_SIZE(da830_ids), 1193 .ids_num = ARRAY_SIZE(da830_ids),
1193 .cpu_clks = da830_clks, 1194 .cpu_clks = da830_clks,
@@ -1215,8 +1216,6 @@ void __init da830_init(void)
1215 if (WARN(!da8xx_syscfg0_base, "Unable to map syscfg0 module")) 1216 if (WARN(!da8xx_syscfg0_base, "Unable to map syscfg0 module"))
1216 return; 1217 return;
1217 1218
1218 davinci_soc_info_da830.jtag_id_base =
1219 DA8XX_SYSCFG0_VIRT(DA8XX_JTAG_ID_REG);
1220 davinci_soc_info_da830.pinmux_base = DA8XX_SYSCFG0_VIRT(0x120); 1219 davinci_soc_info_da830.pinmux_base = DA8XX_SYSCFG0_VIRT(0x120);
1221 1220
1222 davinci_common_init(&davinci_soc_info_da830); 1221 davinci_common_init(&davinci_soc_info_da830);
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index cb7f66300525..fcf701628590 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -1073,6 +1073,7 @@ no_ddrpll_mem:
1073static struct davinci_soc_info davinci_soc_info_da850 = { 1073static struct davinci_soc_info davinci_soc_info_da850 = {
1074 .io_desc = da850_io_desc, 1074 .io_desc = da850_io_desc,
1075 .io_desc_num = ARRAY_SIZE(da850_io_desc), 1075 .io_desc_num = ARRAY_SIZE(da850_io_desc),
1076 .jtag_id_reg = DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG,
1076 .ids = da850_ids, 1077 .ids = da850_ids,
1077 .ids_num = ARRAY_SIZE(da850_ids), 1078 .ids_num = ARRAY_SIZE(da850_ids),
1078 .cpu_clks = da850_clks, 1079 .cpu_clks = da850_clks,
@@ -1108,8 +1109,6 @@ void __init da850_init(void)
1108 if (WARN(!da8xx_syscfg1_base, "Unable to map syscfg1 module")) 1109 if (WARN(!da8xx_syscfg1_base, "Unable to map syscfg1 module"))
1109 return; 1110 return;
1110 1111
1111 davinci_soc_info_da850.jtag_id_base =
1112 DA8XX_SYSCFG0_VIRT(DA8XX_JTAG_ID_REG);
1113 davinci_soc_info_da850.pinmux_base = DA8XX_SYSCFG0_VIRT(0x120); 1112 davinci_soc_info_da850.pinmux_base = DA8XX_SYSCFG0_VIRT(0x120);
1114 1113
1115 davinci_common_init(&davinci_soc_info_da850); 1114 davinci_common_init(&davinci_soc_info_da850);
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 277041dcd9a1..228b6d1460e5 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -840,7 +840,7 @@ static struct platform_device dm355_serial_device = {
840static struct davinci_soc_info davinci_soc_info_dm355 = { 840static struct davinci_soc_info davinci_soc_info_dm355 = {
841 .io_desc = dm355_io_desc, 841 .io_desc = dm355_io_desc,
842 .io_desc_num = ARRAY_SIZE(dm355_io_desc), 842 .io_desc_num = ARRAY_SIZE(dm355_io_desc),
843 .jtag_id_base = IO_ADDRESS(0x01c40028), 843 .jtag_id_reg = 0x01c40028,
844 .ids = dm355_ids, 844 .ids = dm355_ids,
845 .ids_num = ARRAY_SIZE(dm355_ids), 845 .ids_num = ARRAY_SIZE(dm355_ids),
846 .cpu_clks = dm355_clks, 846 .cpu_clks = dm355_clks,
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index ecdbc676b4dd..b396d58f130a 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -1045,7 +1045,7 @@ static struct platform_device dm365_serial_device = {
1045static struct davinci_soc_info davinci_soc_info_dm365 = { 1045static struct davinci_soc_info davinci_soc_info_dm365 = {
1046 .io_desc = dm365_io_desc, 1046 .io_desc = dm365_io_desc,
1047 .io_desc_num = ARRAY_SIZE(dm365_io_desc), 1047 .io_desc_num = ARRAY_SIZE(dm365_io_desc),
1048 .jtag_id_base = IO_ADDRESS(0x01c40028), 1048 .jtag_id_reg = 0x01c40028,
1049 .ids = dm365_ids, 1049 .ids = dm365_ids,
1050 .ids_num = ARRAY_SIZE(dm365_ids), 1050 .ids_num = ARRAY_SIZE(dm365_ids),
1051 .cpu_clks = dm365_clks, 1051 .cpu_clks = dm365_clks,
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index beb315c04b75..9859567788c9 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -731,7 +731,7 @@ static struct platform_device dm644x_serial_device = {
731static struct davinci_soc_info davinci_soc_info_dm644x = { 731static struct davinci_soc_info davinci_soc_info_dm644x = {
732 .io_desc = dm644x_io_desc, 732 .io_desc = dm644x_io_desc,
733 .io_desc_num = ARRAY_SIZE(dm644x_io_desc), 733 .io_desc_num = ARRAY_SIZE(dm644x_io_desc),
734 .jtag_id_base = IO_ADDRESS(0x01c40028), 734 .jtag_id_reg = 0x01c40028,
735 .ids = dm644x_ids, 735 .ids = dm644x_ids,
736 .ids_num = ARRAY_SIZE(dm644x_ids), 736 .ids_num = ARRAY_SIZE(dm644x_ids),
737 .cpu_clks = dm644x_clks, 737 .cpu_clks = dm644x_clks,
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 95fc981e45af..f9a8cc46eafd 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -815,7 +815,7 @@ static struct platform_device dm646x_serial_device = {
815static struct davinci_soc_info davinci_soc_info_dm646x = { 815static struct davinci_soc_info davinci_soc_info_dm646x = {
816 .io_desc = dm646x_io_desc, 816 .io_desc = dm646x_io_desc,
817 .io_desc_num = ARRAY_SIZE(dm646x_io_desc), 817 .io_desc_num = ARRAY_SIZE(dm646x_io_desc),
818 .jtag_id_base = IO_ADDRESS(0x01c40028), 818 .jtag_id_reg = 0x01c40028,
819 .ids = dm646x_ids, 819 .ids = dm646x_ids,
820 .ids_num = ARRAY_SIZE(dm646x_ids), 820 .ids_num = ARRAY_SIZE(dm646x_ids),
821 .cpu_clks = dm646x_clks, 821 .cpu_clks = dm646x_clks,
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index 2dd2226507a7..1078458bdd54 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -45,7 +45,7 @@ struct davinci_soc_info {
45 unsigned long io_desc_num; 45 unsigned long io_desc_num;
46 u32 cpu_id; 46 u32 cpu_id;
47 u32 jtag_id; 47 u32 jtag_id;
48 void __iomem *jtag_id_base; 48 u32 jtag_id_reg;
49 struct davinci_id *ids; 49 struct davinci_id *ids;
50 unsigned long ids_num; 50 unsigned long ids_num;
51 struct clk_lookup *cpu_clks; 51 struct clk_lookup *cpu_clks;