Path: blob/master/arch/mips/txx9/generic/setup_tx3927.c
10818 views
/*1* TX3927 setup routines2* Based on linux/arch/mips/txx9/jmr3927/setup.c3*4* Copyright 2001 MontaVista Software Inc.5* Copyright (C) 2000-2001 Toshiba Corporation6* Copyright (C) 2007 Ralf Baechle ([email protected])7*8* This file is subject to the terms and conditions of the GNU General Public9* License. See the file "COPYING" in the main directory of this archive10* for more details.11*/12#include <linux/init.h>13#include <linux/ioport.h>14#include <linux/delay.h>15#include <linux/param.h>16#include <linux/io.h>17#include <linux/mtd/physmap.h>18#include <asm/mipsregs.h>19#include <asm/txx9irq.h>20#include <asm/txx9tmr.h>21#include <asm/txx9pio.h>22#include <asm/txx9/generic.h>23#include <asm/txx9/tx3927.h>2425void __init tx3927_wdt_init(void)26{27txx9_wdt_init(TX3927_TMR_REG(2));28}2930void __init tx3927_setup(void)31{32int i;33unsigned int conf;3435txx9_reg_res_init(TX3927_REV_PCODE(), TX3927_REG_BASE,36TX3927_REG_SIZE);3738/* SDRAMC,ROMC are configured by PROM */39for (i = 0; i < 8; i++) {40if (!(tx3927_romcptr->cr[i] & 0x8))41continue; /* disabled */42txx9_ce_res[i].start = (unsigned long)TX3927_ROMC_BA(i);43txx9_ce_res[i].end =44txx9_ce_res[i].start + TX3927_ROMC_SIZE(i) - 1;45request_resource(&iomem_resource, &txx9_ce_res[i]);46}4748/* clocks */49txx9_gbus_clock = txx9_cpu_clock / 2;50/* change default value to udelay/mdelay take reasonable time */51loops_per_jiffy = txx9_cpu_clock / HZ / 2;5253/* CCFG */54/* enable Timeout BusError */55if (txx9_ccfg_toeon)56tx3927_ccfgptr->ccfg |= TX3927_CCFG_TOE;5758/* clear BusErrorOnWrite flag */59tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_BEOW;60if (read_c0_conf() & TX39_CONF_WBON)61/* Disable PCI snoop */62tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_PSNP;63else64/* Enable PCI SNOOP - with write through only */65tx3927_ccfgptr->ccfg |= TX3927_CCFG_PSNP;66/* do reset on watchdog */67tx3927_ccfgptr->ccfg |= TX3927_CCFG_WR;6869printk(KERN_INFO "TX3927 -- CRIR:%08lx CCFG:%08lx PCFG:%08lx\n",70tx3927_ccfgptr->crir,71tx3927_ccfgptr->ccfg, tx3927_ccfgptr->pcfg);7273/* TMR */74for (i = 0; i < TX3927_NR_TMR; i++)75txx9_tmr_init(TX3927_TMR_REG(i));7677/* DMA */78tx3927_dmaptr->mcr = 0;79for (i = 0; i < ARRAY_SIZE(tx3927_dmaptr->ch); i++) {80/* reset channel */81tx3927_dmaptr->ch[i].ccr = TX3927_DMA_CCR_CHRST;82tx3927_dmaptr->ch[i].ccr = 0;83}84/* enable DMA */85#ifdef __BIG_ENDIAN86tx3927_dmaptr->mcr = TX3927_DMA_MCR_MSTEN;87#else88tx3927_dmaptr->mcr = TX3927_DMA_MCR_MSTEN | TX3927_DMA_MCR_LE;89#endif9091/* PIO */92__raw_writel(0, &tx3927_pioptr->maskcpu);93__raw_writel(0, &tx3927_pioptr->maskext);94txx9_gpio_init(TX3927_PIO_REG, 0, 16);9596conf = read_c0_conf();97if (conf & TX39_CONF_DCE) {98if (!(conf & TX39_CONF_WBON))99pr_info("TX3927 D-Cache WriteThrough.\n");100else if (!(conf & TX39_CONF_CWFON))101pr_info("TX3927 D-Cache WriteBack.\n");102else103pr_info("TX3927 D-Cache WriteBack (CWF) .\n");104}105}106107void __init tx3927_time_init(unsigned int evt_tmrnr, unsigned int src_tmrnr)108{109txx9_clockevent_init(TX3927_TMR_REG(evt_tmrnr),110TXX9_IRQ_BASE + TX3927_IR_TMR(evt_tmrnr),111TXX9_IMCLK);112txx9_clocksource_init(TX3927_TMR_REG(src_tmrnr), TXX9_IMCLK);113}114115void __init tx3927_sio_init(unsigned int sclk, unsigned int cts_mask)116{117int i;118119for (i = 0; i < 2; i++)120txx9_sio_init(TX3927_SIO_REG(i),121TXX9_IRQ_BASE + TX3927_IR_SIO(i),122i, sclk, (1 << i) & cts_mask);123}124125void __init tx3927_mtd_init(int ch)126{127struct physmap_flash_data pdata = {128.width = TX3927_ROMC_WIDTH(ch) / 8,129};130unsigned long start = txx9_ce_res[ch].start;131unsigned long size = txx9_ce_res[ch].end - start + 1;132133if (!(tx3927_romcptr->cr[ch] & 0x8))134return; /* disabled */135txx9_physmap_flash_init(ch, start, size, &pdata);136}137138139