Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
[pandora-kernel.git] / arch / mips / lantiq / xway / prom-xway.c
1 /*
2  *  This program is free software; you can redistribute it and/or modify it
3  *  under the terms of the GNU General Public License version 2 as published
4  *  by the Free Software Foundation.
5  *
6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
7  */
8
9 #include <linux/module.h>
10 #include <linux/clk.h>
11 #include <asm/bootinfo.h>
12 #include <asm/time.h>
13
14 #include <lantiq_soc.h>
15
16 #include "../prom.h"
17
18 #define SOC_DANUBE      "Danube"
19 #define SOC_TWINPASS    "Twinpass"
20 #define SOC_AR9         "AR9"
21
22 #define PART_SHIFT      12
23 #define PART_MASK       0x0FFFFFFF
24 #define REV_SHIFT       28
25 #define REV_MASK        0xF0000000
26
27 void __init ltq_soc_detect(struct ltq_soc_info *i)
28 {
29         i->partnum = (ltq_r32(LTQ_MPS_CHIPID) & PART_MASK) >> PART_SHIFT;
30         i->rev = (ltq_r32(LTQ_MPS_CHIPID) & REV_MASK) >> REV_SHIFT;
31         switch (i->partnum) {
32         case SOC_ID_DANUBE1:
33         case SOC_ID_DANUBE2:
34                 i->name = SOC_DANUBE;
35                 i->type = SOC_TYPE_DANUBE;
36                 break;
37
38         case SOC_ID_TWINPASS:
39                 i->name = SOC_TWINPASS;
40                 i->type = SOC_TYPE_DANUBE;
41                 break;
42
43         case SOC_ID_ARX188:
44         case SOC_ID_ARX168:
45         case SOC_ID_ARX182:
46                 i->name = SOC_AR9;
47                 i->type = SOC_TYPE_AR9;
48                 break;
49
50         default:
51                 unreachable();
52                 break;
53         }
54 }