Root/target/linux/lantiq/files/arch/mips/lantiq/svip/prom.c

1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
8 */
9
10#include <linux/module.h>
11#include <linux/clk.h>
12#include <linux/time.h>
13#include <asm/bootinfo.h>
14
15#include <lantiq_soc.h>
16
17#include "../prom.h"
18#include "../clk.h"
19#include "../machtypes.h"
20
21#include <base_reg.h>
22#include <ebu_reg.h>
23
24#define SOC_SVIP "SVIP"
25
26#define PART_SHIFT 12
27#define PART_MASK 0x0FFFF000
28#define REV_SHIFT 28
29#define REV_MASK 0xF0000000
30
31static struct svip_reg_ebu *const ebu = (struct svip_reg_ebu *)LTQ_EBU_BASE;
32
33void __init ltq_soc_init(void)
34{
35    clkdev_add_static(ltq_svip_cpu_hz(), ltq_svip_fpi_hz(),
36        ltq_svip_io_region_clock());
37}
38
39void __init
40ltq_soc_setup(void)
41{
42    if (mips_machtype == LANTIQ_MACH_EASY33016 ||
43        mips_machtype == LANTIQ_MACH_EASY336) {
44        ebu_w32(0x120000f1, addr_sel_2);
45        ebu_w32(LTQ_EBU_CON_0_ADSWP |
46            LTQ_EBU_CON_0_SETUP |
47            LTQ_EBU_CON_0_BCGEN_VAL(0x02) |
48            LTQ_EBU_CON_0_WAITWRC_VAL(7) |
49            LTQ_EBU_CON_0_WAITRDC_VAL(3) |
50            LTQ_EBU_CON_0_HOLDC_VAL(3) |
51            LTQ_EBU_CON_0_RECOVC_VAL(3) |
52            LTQ_EBU_CON_0_CMULT_VAL(3), con_2);
53    }
54}
55
56void __init
57ltq_soc_detect(struct ltq_soc_info *i)
58{
59    i->partnum = (ltq_r32(LTQ_STATUS_CHIPID) & PART_MASK) >> PART_SHIFT;
60    i->rev = (ltq_r32(LTQ_STATUS_CHIPID) & REV_MASK) >> REV_SHIFT;
61    sprintf(i->rev_type, "1.%d", i->rev);
62    switch (i->partnum) {
63    case SOC_ID_SVIP:
64        i->name = SOC_SVIP;
65        i->type = SOC_TYPE_SVIP;
66        break;
67
68    default:
69        printk(KERN_ERR "unknown partnum : 0x%08X\n", i->partnum);
70        while (1);
71        break;
72    }
73}
74

Archive Download this file



interactive