Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson SA 2010 |
| 3 | * |
| 4 | * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson |
| 5 | * License terms: GNU General Public License (GPL) version 2 |
| 6 | */ |
| 7 | |
| 8 | #include <linux/kernel.h> |
| 9 | #include <linux/init.h> |
| 10 | #include <linux/io.h> |
| 11 | |
| 12 | #include <asm/cputype.h> |
| 13 | #include <asm/tlbflush.h> |
| 14 | #include <asm/cacheflush.h> |
| 15 | #include <asm/mach/map.h> |
| 16 | |
| 17 | #include <mach/hardware.h> |
| 18 | #include <mach/setup.h> |
| 19 | |
| 20 | struct dbx500_asic_id dbx500_id; |
| 21 | |
| 22 | static unsigned int ux500_read_asicid(phys_addr_t addr) |
| 23 | { |
| 24 | phys_addr_t base = addr & ~0xfff; |
| 25 | struct map_desc desc = { |
Linus Walleij | bc71c09 | 2012-01-23 11:54:44 +0100 | [diff] [blame] | 26 | .virtual = UX500_VIRT_ROM, |
Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 27 | .pfn = __phys_to_pfn(base), |
| 28 | .length = SZ_16K, |
| 29 | .type = MT_DEVICE, |
| 30 | }; |
| 31 | |
| 32 | iotable_init(&desc, 1); |
| 33 | |
| 34 | /* As in devicemaps_init() */ |
| 35 | local_flush_tlb_all(); |
| 36 | flush_cache_all(); |
| 37 | |
Linus Walleij | bc71c09 | 2012-01-23 11:54:44 +0100 | [diff] [blame] | 38 | return readl(IOMEM(UX500_VIRT_ROM + (addr & 0xfff))); |
Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | static void ux500_print_soc_info(unsigned int asicid) |
| 42 | { |
| 43 | unsigned int rev = dbx500_revision(); |
| 44 | |
| 45 | pr_info("DB%4x ", dbx500_partnumber()); |
| 46 | |
| 47 | if (rev == 0x01) |
| 48 | pr_cont("Early Drop"); |
| 49 | else if (rev >= 0xA0) |
| 50 | pr_cont("v%d.%d" , (rev >> 4) - 0xA + 1, rev & 0xf); |
| 51 | else |
| 52 | pr_cont("Unknown"); |
| 53 | |
| 54 | pr_cont(" [%#010x]\n", asicid); |
| 55 | } |
| 56 | |
| 57 | static unsigned int partnumber(unsigned int asicid) |
| 58 | { |
| 59 | return (asicid >> 8) & 0xffff; |
| 60 | } |
| 61 | |
| 62 | /* |
| 63 | * SOC MIDR ASICID ADDRESS ASICID VALUE |
| 64 | * DB8500ed 0x410fc090 0x9001FFF4 0x00850001 |
| 65 | * DB8500v1 0x411fc091 0x9001FFF4 0x008500A0 |
| 66 | * DB8500v1.1 0x411fc091 0x9001FFF4 0x008500A1 |
| 67 | * DB8500v2 0x412fc091 0x9001DBF4 0x008500B0 |
Rabin Vincent | 41c34ae | 2011-12-15 11:08:22 +0100 | [diff] [blame] | 68 | * DB8520v2.2 0x412fc091 0x9001DBF4 0x008500B2 |
Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 69 | * DB5500v1 0x412fc091 0x9001FFF4 0x005500A0 |
Linus Walleij | bc71c09 | 2012-01-23 11:54:44 +0100 | [diff] [blame] | 70 | * DB9540 0x413fc090 0xFFFFDBF4 0x009540xx |
Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 71 | */ |
| 72 | |
| 73 | void __init ux500_map_io(void) |
| 74 | { |
| 75 | unsigned int cpuid = read_cpuid_id(); |
| 76 | unsigned int asicid = 0; |
| 77 | phys_addr_t addr = 0; |
| 78 | |
| 79 | switch (cpuid) { |
| 80 | case 0x410fc090: /* DB8500ed */ |
| 81 | case 0x411fc091: /* DB8500v1 */ |
| 82 | addr = 0x9001FFF4; |
| 83 | break; |
| 84 | |
Rabin Vincent | 41c34ae | 2011-12-15 11:08:22 +0100 | [diff] [blame] | 85 | case 0x412fc091: /* DB8520 / DB8500v2 / DB5500v1 */ |
Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 86 | asicid = ux500_read_asicid(0x9001DBF4); |
Rabin Vincent | 41c34ae | 2011-12-15 11:08:22 +0100 | [diff] [blame] | 87 | if (partnumber(asicid) == 0x8500 || |
| 88 | partnumber(asicid) == 0x8520) |
Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 89 | /* DB8500v2 */ |
| 90 | break; |
| 91 | |
| 92 | /* DB5500v1 */ |
| 93 | addr = 0x9001FFF4; |
| 94 | break; |
Linus Walleij | bc71c09 | 2012-01-23 11:54:44 +0100 | [diff] [blame] | 95 | |
| 96 | case 0x413fc090: /* DB9540 */ |
| 97 | addr = 0xFFFFDBF4; |
| 98 | break; |
Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | if (addr) |
| 102 | asicid = ux500_read_asicid(addr); |
| 103 | |
| 104 | if (!asicid) { |
| 105 | pr_err("Unable to identify SoC\n"); |
| 106 | ux500_unknown_soc(); |
| 107 | } |
| 108 | |
| 109 | dbx500_id.process = asicid >> 24; |
| 110 | dbx500_id.partnumber = partnumber(asicid); |
| 111 | dbx500_id.revision = asicid & 0xff; |
| 112 | |
| 113 | ux500_print_soc_info(asicid); |
| 114 | } |