···322 This enables support for the MIPS Technologies Malta evaluation323 board.324000000000000000000000000000000325config NEC_MARKEINS326 bool "NEC EMMA2RH Mark-eins board"327 select SOC_EMMA2RH···1762menu "Kernel type"17631764choice1765-1766 prompt "Kernel code model"1767 help1768 You should only select this option if you have a workload that···19661967config SYS_SUPPORTS_SCHED_SMT1968 bool1969-19701971config SYS_SUPPORTS_MULTITHREADING1972 bool
···322 This enables support for the MIPS Technologies Malta evaluation323 board.324325+config MIPS_SEAD3326+ bool "MIPS SEAD3 board"327+ select BOOT_ELF32328+ select BOOT_RAW329+ select CEVT_R4K330+ select CSRC_R4K331+ select CPU_MIPSR2_IRQ_VI332+ select CPU_MIPSR2_IRQ_EI333+ select DMA_NONCOHERENT334+ select IRQ_CPU335+ select IRQ_GIC336+ select MIPS_BOARDS_GEN337+ select MIPS_CPU_SCACHE338+ select MIPS_MSC339+ select SYS_HAS_CPU_MIPS32_R1340+ select SYS_HAS_CPU_MIPS32_R2341+ select SYS_HAS_CPU_MIPS64_R1342+ select SYS_HAS_EARLY_PRINTK343+ select SYS_SUPPORTS_32BIT_KERNEL344+ select SYS_SUPPORTS_64BIT_KERNEL345+ select SYS_SUPPORTS_BIG_ENDIAN346+ select SYS_SUPPORTS_LITTLE_ENDIAN347+ select SYS_SUPPORTS_SMARTMIPS348+ select USB_ARCH_HAS_EHCI349+ select USB_EHCI_BIG_ENDIAN_DESC350+ select USB_EHCI_BIG_ENDIAN_MMIO351+ help352+ This enables support for the MIPS Technologies SEAD3 evaluation353+ board.354+355config NEC_MARKEINS356 bool "NEC EMMA2RH Mark-eins board"357 select SOC_EMMA2RH···1732menu "Kernel type"17331734choice01735 prompt "Kernel code model"1736 help1737 You should only select this option if you have a workload that···19371938config SYS_SUPPORTS_SCHED_SMT1939 bool019401941config SYS_SUPPORTS_MULTITHREADING1942 bool
···1+CONFIG_MIPS_SEAD3=y2+CONFIG_CPU_LITTLE_ENDIAN=y3+CONFIG_CPU_MIPS32_R2=y4+CONFIG_HZ_100=y5+CONFIG_EXPERIMENTAL=y6+CONFIG_SYSVIPC=y7+CONFIG_POSIX_MQUEUE=y8+CONFIG_NO_HZ=y9+CONFIG_HIGH_RES_TIMERS=y10+CONFIG_IKCONFIG=y11+CONFIG_IKCONFIG_PROC=y12+CONFIG_LOG_BUF_SHIFT=1513+CONFIG_EMBEDDED=y14+CONFIG_SLAB=y15+CONFIG_PROFILING=y16+CONFIG_OPROFILE=y17+CONFIG_MODULES=y18+# CONFIG_BLK_DEV_BSG is not set19+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set20+CONFIG_NET=y21+CONFIG_PACKET=y22+CONFIG_UNIX=y23+CONFIG_INET=y24+CONFIG_IP_PNP=y25+CONFIG_IP_PNP_DHCP=y26+CONFIG_IP_PNP_BOOTP=y27+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set28+# CONFIG_INET_XFRM_MODE_TUNNEL is not set29+# CONFIG_INET_XFRM_MODE_BEET is not set30+# CONFIG_INET_LRO is not set31+# CONFIG_INET_DIAG is not set32+# CONFIG_IPV6 is not set33+# CONFIG_WIRELESS is not set34+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"35+CONFIG_MTD=y36+CONFIG_MTD_CHAR=y37+CONFIG_MTD_BLOCK=y38+CONFIG_MTD_CFI=y39+CONFIG_MTD_CFI_INTELEXT=y40+CONFIG_MTD_PHYSMAP=y41+CONFIG_MTD_UBI=y42+CONFIG_MTD_UBI_GLUEBI=y43+CONFIG_BLK_DEV_LOOP=y44+CONFIG_BLK_DEV_CRYPTOLOOP=m45+CONFIG_SCSI=y46+# CONFIG_SCSI_PROC_FS is not set47+CONFIG_BLK_DEV_SD=y48+CONFIG_CHR_DEV_SG=y49+# CONFIG_SCSI_LOWLEVEL is not set50+CONFIG_NETDEVICES=y51+CONFIG_SMSC911X=y52+# CONFIG_NET_VENDOR_WIZNET is not set53+CONFIG_MARVELL_PHY=y54+CONFIG_DAVICOM_PHY=y55+CONFIG_QSEMI_PHY=y56+CONFIG_LXT_PHY=y57+CONFIG_CICADA_PHY=y58+CONFIG_VITESSE_PHY=y59+CONFIG_SMSC_PHY=y60+CONFIG_BROADCOM_PHY=y61+CONFIG_ICPLUS_PHY=y62+# CONFIG_WLAN is not set63+# CONFIG_INPUT_MOUSEDEV is not set64+# CONFIG_INPUT_KEYBOARD is not set65+# CONFIG_INPUT_MOUSE is not set66+# CONFIG_SERIO is not set67+# CONFIG_CONSOLE_TRANSLATIONS is not set68+CONFIG_VT_HW_CONSOLE_BINDING=y69+CONFIG_LEGACY_PTY_COUNT=3270+CONFIG_SERIAL_8250=y71+CONFIG_SERIAL_8250_CONSOLE=y72+CONFIG_SERIAL_8250_NR_UARTS=273+CONFIG_SERIAL_8250_RUNTIME_UARTS=274+# CONFIG_HW_RANDOM is not set75+CONFIG_I2C=y76+# CONFIG_I2C_COMPAT is not set77+CONFIG_I2C_CHARDEV=y78+# CONFIG_I2C_HELPER_AUTO is not set79+CONFIG_SPI=y80+CONFIG_SENSORS_ADT7475=y81+CONFIG_BACKLIGHT_LCD_SUPPORT=y82+CONFIG_LCD_CLASS_DEVICE=y83+CONFIG_BACKLIGHT_CLASS_DEVICE=y84+# CONFIG_VGA_CONSOLE is not set85+CONFIG_USB=y86+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y87+CONFIG_USB_EHCI_HCD=y88+CONFIG_USB_EHCI_ROOT_HUB_TT=y89+CONFIG_USB_STORAGE=y90+CONFIG_MMC=y91+CONFIG_MMC_DEBUG=y92+CONFIG_MMC_SPI=y93+CONFIG_NEW_LEDS=y94+CONFIG_LEDS_CLASS=y95+CONFIG_LEDS_TRIGGERS=y96+CONFIG_LEDS_TRIGGER_HEARTBEAT=y97+CONFIG_RTC_CLASS=y98+CONFIG_RTC_DRV_M41T80=y99+CONFIG_EXT3_FS=y100+# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set101+CONFIG_XFS_FS=y102+CONFIG_XFS_QUOTA=y103+CONFIG_XFS_POSIX_ACL=y104+CONFIG_QUOTA=y105+# CONFIG_PRINT_QUOTA_WARNING is not set106+CONFIG_MSDOS_FS=m107+CONFIG_VFAT_FS=m108+CONFIG_TMPFS=y109+CONFIG_JFFS2_FS=y110+CONFIG_NFS_FS=y111+CONFIG_ROOT_NFS=y112+CONFIG_NLS_CODEPAGE_437=y113+CONFIG_NLS_ASCII=y114+CONFIG_NLS_ISO8859_1=y115+CONFIG_NLS_ISO8859_15=y116+CONFIG_NLS_UTF8=y117+# CONFIG_FTRACE is not set118+CONFIG_CRYPTO=y119+CONFIG_CRYPTO_CBC=y120+CONFIG_CRYPTO_ECB=y121+CONFIG_CRYPTO_AES=y122+CONFIG_CRYPTO_ARC4=y123+# CONFIG_CRYPTO_ANSI_CPRNG is not set124+# CONFIG_CRYPTO_HW is not set
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Chris Dearman (chris@mips.com)7+ * Copyright (C) 2007 Mips Technologies, Inc.8+ */9+#ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H10+#define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H11+12+ .macro kernel_entry_setup13+#ifdef CONFIG_MIPS_MT_SMTC14+ mfc0 t0, CP0_CONFIG15+ bgez t0, 9f16+ mfc0 t0, CP0_CONFIG, 117+ bgez t0, 9f18+ mfc0 t0, CP0_CONFIG, 219+ bgez t0, 9f20+ mfc0 t0, CP0_CONFIG, 321+ and t0, 1<<222+ bnez t0, 0f23+9 :24+ /* Assume we came from YAMON... */25+ PTR_LA v0, 0x9fc00534 /* YAMON print */26+ lw v0, (v0)27+ move a0, zero28+ PTR_LA a1, nonmt_processor29+ jal v030+31+ PTR_LA v0, 0x9fc00520 /* YAMON exit */32+ lw v0, (v0)33+ li a0, 134+ jal v035+36+1 : b 1b37+38+ __INITDATA39+nonmt_processor :40+ .asciz "SMTC kernel requires the MT ASE to run\n"41+ __FINIT42+0 :43+#endif44+ .endm45+46+/*47+ * Do SMP slave processor setup necessary before we can safely execute C code.48+ */49+ .macro smp_slave_setup50+ .endm51+52+#endif /* __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H */
+25
arch/mips/include/asm/mach-sead3/war.h
···0000000000000000000000000
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>7+ */8+#ifndef __ASM_MIPS_MACH_MIPS_WAR_H9+#define __ASM_MIPS_MACH_MIPS_WAR_H10+11+#define R4600_V1_INDEX_ICACHEOP_WAR 012+#define R4600_V1_HIT_CACHEOP_WAR 013+#define R4600_V2_HIT_CACHEOP_WAR 014+#define R5432_CP0_INTERRUPT_WAR 015+#define BCM1250_M3_WAR 016+#define SIBYTE_1956_WAR 017+#define MIPS4K_ICACHE_REFILL_WAR 118+#define MIPS_CACHE_SYNC_WAR 119+#define TX49XX_ICACHE_INDEX_INV_WAR 020+#define RM9000_CDEX_SMP_WAR 021+#define ICACHE_REFILLS_WORKAROUND_WAR 122+#define R10000_LLSC_WAR 023+#define MIPS34K_MISSED_ITLB_WAR 024+25+#endif /* __ASM_MIPS_MACH_MIPS_WAR_H */
+7-48
arch/mips/include/asm/mips-boards/maltaint.h
···1/*2- * Carsten Langgaard, carstenl@mips.com3- * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.04 *5- * ########################################################################6- *7- * This program is free software; you can distribute it and/or modify it8- * under the terms of the GNU General Public License (Version 2) as9- * published by the Free Software Foundation.10- *11- * This program is distributed in the hope it will be useful, but WITHOUT12- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or13- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License14- * for more details.15- *16- * You should have received a copy of the GNU General Public License along17- * with this program; if not, write to the Free Software Foundation, Inc.,18- * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.19- *20- * ########################################################################21- *22- * Defines for the Malta interrupt controller.23- *24 */25#ifndef _MIPS_MALTAINT_H26#define _MIPS_MALTAINT_H2728-#include <irq.h>2930/*31 * Interrupts 0..15 are used for Malta ISA compatible interrupts···63#define MSC01E_INT_PERFCTR 1064#define MSC01E_INT_CPUCTR 116566-/* GIC's Nomenclature for Core Interrupt Pins on the Malta */67-#define GIC_CPU_INT0 0 /* Core Interrupt 2 */68-#define GIC_CPU_INT1 1 /* . */69-#define GIC_CPU_INT2 2 /* . */70-#define GIC_CPU_INT3 3 /* . */71-#define GIC_CPU_INT4 4 /* . */72-#define GIC_CPU_INT5 5 /* Core Interrupt 5 */73-74-/* MALTA GIC local interrupts */75-#define GIC_INT_TMR (GIC_CPU_INT5)76-#define GIC_INT_PERFCTR (GIC_CPU_INT5)77-78-/* GIC constants */79-/* Add 2 to convert non-eic hw int # to eic vector # */80-#define GIC_CPU_TO_VEC_OFFSET (2)81-/* If we map an intr to pin X, GIC will actually generate vector X+1 */82-#define GIC_PIN_TO_VEC_OFFSET (1)83-84-#define GIC_EXT_INTR(x) x85-86/* External Interrupts used for IPI */87#define GIC_IPI_EXT_INTR_RESCHED_VPE0 1688#define GIC_IPI_EXT_INTR_CALLFNC_VPE0 17···72#define GIC_IPI_EXT_INTR_CALLFNC_VPE2 2173#define GIC_IPI_EXT_INTR_RESCHED_VPE3 2274#define GIC_IPI_EXT_INTR_CALLFNC_VPE3 2375-76-#define MIPS_GIC_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8)77-78-#ifndef __ASSEMBLY__79-extern void maltaint_init(void);80-#endif8182#endif /* !(_MIPS_MALTAINT_H) */
···1/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5 *6+ * Copyright (C) 2000,2012 MIPS Technologies, Inc. All rights reserved.7+ * Carsten Langgaard <carstenl@mips.com>8+ * Steven J. Hill <sjhill@mips.com>00000000000000009 */10#ifndef _MIPS_MALTAINT_H11#define _MIPS_MALTAINT_H1213+#define MIPS_GIC_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8)1415/*16 * Interrupts 0..15 are used for Malta ISA compatible interrupts···78#define MSC01E_INT_PERFCTR 1079#define MSC01E_INT_CPUCTR 11800000000000000000000081/* External Interrupts used for IPI */82#define GIC_IPI_EXT_INTR_RESCHED_VPE0 1683#define GIC_IPI_EXT_INTR_CALLFNC_VPE0 17···107#define GIC_IPI_EXT_INTR_CALLFNC_VPE2 21108#define GIC_IPI_EXT_INTR_RESCHED_VPE3 22109#define GIC_IPI_EXT_INTR_CALLFNC_VPE3 23000000110111#endif /* !(_MIPS_MALTAINT_H) */
+19
arch/mips/include/asm/mips-boards/sead3int.h
···0000000000000000000
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2000,2012 MIPS Technologies, Inc. All rights reserved.7+ * Douglas Leung <douglas@mips.com>8+ * Steven J. Hill <sjhill@mips.com>9+ */10+#ifndef _MIPS_SEAD3INT_H11+#define _MIPS_SEAD3INT_H12+13+/* SEAD-3 GIC address space definitions. */14+#define GIC_BASE_ADDR 0x1b1c000015+#define GIC_ADDRSPACE_SZ (128 * 1024)16+17+#define MIPS_GIC_IRQ_BASE (MIPS_CPU_IRQ_BASE + 0)18+19+#endif /* !(_MIPS_SEAD3INT_H) */
···1-#undef DEBUG2-0000003#include <linux/bitmap.h>4#include <linux/init.h>5#include <linux/smp.h>···1314#include <asm/io.h>15#include <asm/gic.h>0016#include <asm/gcmpregs.h>17#include <linux/hardirq.h>18#include <asm-generic/bitops/find.h>190002021-static unsigned long _gic_base;22-static unsigned int _irqbase;23-static unsigned int gic_irq_flags[GIC_NUM_INTRS];24-#define GIC_IRQ_FLAG_EDGE 0x00012526-struct gic_pcpu_mask pcpu_masks[NR_CPUS];27static struct gic_pending_regs pending_regs[NR_CPUS];28static struct gic_intrmask_regs intrmask_regs[NR_CPUS];2900000000000000000030void gic_send_ipi(unsigned int intr)31{32- pr_debug("CPU%d: %s status %08x\n", smp_processor_id(), __func__,33- read_c0_status());34 GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), 0x80000000 | intr);35}3637-/* This is Malta specific and needs to be exported */0000000000000038static void __init vpe_local_setup(unsigned int numvpes)39{40- int i;41- unsigned long timer_interrupt = 5, perf_interrupt = 5;42 unsigned int vpe_ctl;000000000000004344 /*45 * Setup the default performance counter timer interrupts···99 GICREAD(GIC_REG(VPE_OTHER, GIC_VPE_CTL), vpe_ctl);100 if (vpe_ctl & GIC_VPE_CTL_TIMER_RTBL_MSK)101 GICWRITE(GIC_REG(VPE_OTHER, GIC_VPE_TIMER_MAP),102- GIC_MAP_TO_PIN_MSK | timer_interrupt);00000103104 if (vpe_ctl & GIC_VPE_CTL_PERFCNT_RTBL_MSK)105 GICWRITE(GIC_REG(VPE_OTHER, GIC_VPE_PERFCTR_MAP),106- GIC_MAP_TO_PIN_MSK | perf_interrupt);0000107 }108}109···142 bitmap_and(pending, pending, intrmask, GIC_NUM_INTRS);143 bitmap_and(pending, pending, pcpu_mask, GIC_NUM_INTRS);144145- i = find_first_bit(pending, GIC_NUM_INTRS);146-147- pr_debug("CPU%d: %s pend=%d\n", smp_processor_id(), __func__, i);148-149- return i;150-}151-152-static void gic_irq_ack(struct irq_data *d)153-{154- unsigned int irq = d->irq - _irqbase;155-156- pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq);157- GIC_CLR_INTR_MASK(irq);158-159- if (gic_irq_flags[irq] & GIC_IRQ_FLAG_EDGE)160- GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), irq);161}162163static void gic_mask_irq(struct irq_data *d)164{165- unsigned int irq = d->irq - _irqbase;166- pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq);167- GIC_CLR_INTR_MASK(irq);168}169170static void gic_unmask_irq(struct irq_data *d)171{172- unsigned int irq = d->irq - _irqbase;173- pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq);174- GIC_SET_INTR_MASK(irq);175}176177#ifdef CONFIG_SMP178-179static DEFINE_SPINLOCK(gic_lock);180181static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask,182 bool force)183{184- unsigned int irq = d->irq - _irqbase;185 cpumask_t tmp = CPU_MASK_NONE;186 unsigned long flags;187 int i;188189- pr_debug("%s(%d) called\n", __func__, irq);190 cpumask_and(&tmp, cpumask, cpu_online_mask);191 if (cpus_empty(tmp))192 return -1;···195 .irq_mask = gic_mask_irq,196 .irq_mask_ack = gic_mask_irq,197 .irq_unmask = gic_unmask_irq,198- .irq_eoi = gic_unmask_irq,199#ifdef CONFIG_SMP200 .irq_set_affinity = gic_set_affinity,201#endif···205 unsigned int pin, unsigned int polarity, unsigned int trigtype,206 unsigned int flags)207{00208 /* Setup Intr to Pin mapping */209 if (pin & GIC_MAP_TO_NMI_MSK) {210 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_MAP_TO_PIN(intr)), pin);···221 GIC_MAP_TO_PIN_MSK | pin);222 /* Setup Intr to CPU mapping */223 GIC_SH_MAP_TO_VPE_SMASK(intr, cpu);00000000224 }225226 /* Setup Intr Polarity */···242 /* Initialise per-cpu Interrupt software masks */243 if (flags & GIC_FLAG_IPI)244 set_bit(intr, pcpu_masks[cpu].pcpu_mask);245- if (flags & GIC_FLAG_TRANSPARENT)246 GIC_SET_INTR_MASK(intr);247 if (trigtype == GIC_TRIG_EDGE)248- gic_irq_flags[intr] |= GIC_IRQ_FLAG_EDGE;249}250251static void __init gic_basic_init(int numintrs, int numvpes,252 struct gic_intr_map *intrmap, int mapsize)253{254 unsigned int i, cpu;000255256 /* Setup defaults */257 for (i = 0; i < numintrs; i++) {258 GIC_SET_POLARITY(i, GIC_POL_POS);259 GIC_SET_TRIGGER(i, GIC_TRIG_LEVEL);260 GIC_CLR_INTR_MASK(i);261- if (i < GIC_NUM_INTRS)262 gic_irq_flags[i] = 0;000263 }0000000264265 /* Setup specifics */266 for (i = 0; i < mapsize; i++) {···284 continue;285 gic_setup_intr(i,286 intrmap[i].cpunum,287- intrmap[i].pin,288 intrmap[i].polarity,289 intrmap[i].trigtype,290 intrmap[i].flags);291 }292293 vpe_local_setup(numvpes);294-295- for (i = _irqbase; i < (_irqbase + numintrs); i++)296- irq_set_chip(i, &gic_irq_controller);297}298299void __init gic_init(unsigned long gic_base_addr,···303304 _gic_base = (unsigned long) ioremap_nocache(gic_base_addr,305 gic_addrspace_size);306- _irqbase = irqbase;307308 GICREAD(GIC_REG(SHARED, GIC_SH_CONFIG), gicconfig);309 numintrs = (gicconfig & GIC_SH_CONFIG_NUMINTRS_MSK) >>···312313 numvpes = (gicconfig & GIC_SH_CONFIG_NUMVPES_MSK) >>314 GIC_SH_CONFIG_NUMVPES_SHF;315-316- pr_debug("%s called\n", __func__);317318 gic_basic_init(numintrs, numvpes, intr_map, intr_map_size);00319}
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2008 Ralf Baechle (ralf@linux-mips.org)7+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.8+ */9#include <linux/bitmap.h>10#include <linux/init.h>11#include <linux/smp.h>···78#include <asm/io.h>9#include <asm/gic.h>10+#include <asm/setup.h>11+#include <asm/traps.h>12#include <asm/gcmpregs.h>13#include <linux/hardirq.h>14#include <asm-generic/bitops/find.h>1516+unsigned long _gic_base;17+unsigned int gic_irq_base;18+unsigned int gic_irq_flags[GIC_NUM_INTRS];1920+/* The index into this array is the vector # of the interrupt. */21+struct gic_shared_intr_map gic_shared_intr_map[GIC_NUM_INTRS];002223+static struct gic_pcpu_mask pcpu_masks[NR_CPUS];24static struct gic_pending_regs pending_regs[NR_CPUS];25static struct gic_intrmask_regs intrmask_regs[NR_CPUS];2627+unsigned int gic_get_timer_pending(void)28+{29+ unsigned int vpe_pending;30+31+ GICWRITE(GIC_REG(VPE_LOCAL, GIC_VPE_OTHER_ADDR), 0);32+ GICREAD(GIC_REG(VPE_OTHER, GIC_VPE_PEND), vpe_pending);33+ return (vpe_pending & GIC_VPE_PEND_TIMER_MSK);34+}35+36+void gic_bind_eic_interrupt(int irq, int set)37+{38+ /* Convert irq vector # to hw int # */39+ irq -= GIC_PIN_TO_VEC_OFFSET;40+41+ /* Set irq to use shadow set */42+ GICWRITE(GIC_REG_ADDR(VPE_LOCAL, GIC_VPE_EIC_SS(irq)), set);43+}44+45void gic_send_ipi(unsigned int intr)46{0047 GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), 0x80000000 | intr);48}4950+static void gic_eic_irq_dispatch(void)51+{52+ unsigned int cause = read_c0_cause();53+ int irq;54+55+ irq = (cause & ST0_IM) >> STATUSB_IP2;56+ if (irq == 0)57+ irq = -1;58+59+ if (irq >= 0)60+ do_IRQ(gic_irq_base + irq);61+ else62+ spurious_interrupt();63+}64+65static void __init vpe_local_setup(unsigned int numvpes)66{67+ unsigned long timer_intr = GIC_INT_TMR;68+ unsigned long perf_intr = GIC_INT_PERFCTR;69 unsigned int vpe_ctl;70+ int i;71+72+ if (cpu_has_veic) {73+ /*74+ * GIC timer interrupt -> CPU HW Int X (vector X+2) ->75+ * map to pin X+2-1 (since GIC adds 1)76+ */77+ timer_intr += (GIC_CPU_TO_VEC_OFFSET - GIC_PIN_TO_VEC_OFFSET);78+ /*79+ * GIC perfcnt interrupt -> CPU HW Int X (vector X+2) ->80+ * map to pin X+2-1 (since GIC adds 1)81+ */82+ perf_intr += (GIC_CPU_TO_VEC_OFFSET - GIC_PIN_TO_VEC_OFFSET);83+ }8485 /*86 * Setup the default performance counter timer interrupts···46 GICREAD(GIC_REG(VPE_OTHER, GIC_VPE_CTL), vpe_ctl);47 if (vpe_ctl & GIC_VPE_CTL_TIMER_RTBL_MSK)48 GICWRITE(GIC_REG(VPE_OTHER, GIC_VPE_TIMER_MAP),49+ GIC_MAP_TO_PIN_MSK | timer_intr);50+ if (cpu_has_veic) {51+ set_vi_handler(timer_intr + GIC_PIN_TO_VEC_OFFSET,52+ gic_eic_irq_dispatch);53+ gic_shared_intr_map[timer_intr + GIC_PIN_TO_VEC_OFFSET].local_intr_mask |= GIC_VPE_RMASK_TIMER_MSK;54+ }5556 if (vpe_ctl & GIC_VPE_CTL_PERFCNT_RTBL_MSK)57 GICWRITE(GIC_REG(VPE_OTHER, GIC_VPE_PERFCTR_MAP),58+ GIC_MAP_TO_PIN_MSK | perf_intr);59+ if (cpu_has_veic) {60+ set_vi_handler(perf_intr + GIC_PIN_TO_VEC_OFFSET, gic_eic_irq_dispatch);61+ gic_shared_intr_map[perf_intr + GIC_PIN_TO_VEC_OFFSET].local_intr_mask |= GIC_VPE_RMASK_PERFCNT_MSK;62+ }63 }64}65···80 bitmap_and(pending, pending, intrmask, GIC_NUM_INTRS);81 bitmap_and(pending, pending, pcpu_mask, GIC_NUM_INTRS);8283+ return find_first_bit(pending, GIC_NUM_INTRS);00000000000000084}8586static void gic_mask_irq(struct irq_data *d)87{88+ GIC_CLR_INTR_MASK(d->irq - gic_irq_base);0089}9091static void gic_unmask_irq(struct irq_data *d)92{93+ GIC_SET_INTR_MASK(d->irq - gic_irq_base);0094}9596#ifdef CONFIG_SMP097static DEFINE_SPINLOCK(gic_lock);9899static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask,100 bool force)101{102+ unsigned int irq = (d->irq - gic_irq_base);103 cpumask_t tmp = CPU_MASK_NONE;104 unsigned long flags;105 int i;1060107 cpumask_and(&tmp, cpumask, cpu_online_mask);108 if (cpus_empty(tmp))109 return -1;···154 .irq_mask = gic_mask_irq,155 .irq_mask_ack = gic_mask_irq,156 .irq_unmask = gic_unmask_irq,157+ .irq_eoi = gic_finish_irq,158#ifdef CONFIG_SMP159 .irq_set_affinity = gic_set_affinity,160#endif···164 unsigned int pin, unsigned int polarity, unsigned int trigtype,165 unsigned int flags)166{167+ struct gic_shared_intr_map *map_ptr;168+169 /* Setup Intr to Pin mapping */170 if (pin & GIC_MAP_TO_NMI_MSK) {171 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_MAP_TO_PIN(intr)), pin);···178 GIC_MAP_TO_PIN_MSK | pin);179 /* Setup Intr to CPU mapping */180 GIC_SH_MAP_TO_VPE_SMASK(intr, cpu);181+ if (cpu_has_veic) {182+ set_vi_handler(pin + GIC_PIN_TO_VEC_OFFSET,183+ gic_eic_irq_dispatch);184+ map_ptr = &gic_shared_intr_map[pin + GIC_PIN_TO_VEC_OFFSET];185+ if (map_ptr->num_shared_intr >= GIC_MAX_SHARED_INTR)186+ BUG();187+ map_ptr->intr_list[map_ptr->num_shared_intr++] = intr;188+ }189 }190191 /* Setup Intr Polarity */···191 /* Initialise per-cpu Interrupt software masks */192 if (flags & GIC_FLAG_IPI)193 set_bit(intr, pcpu_masks[cpu].pcpu_mask);194+ if ((flags & GIC_FLAG_TRANSPARENT) && (cpu_has_veic == 0))195 GIC_SET_INTR_MASK(intr);196 if (trigtype == GIC_TRIG_EDGE)197+ gic_irq_flags[intr] |= GIC_TRIG_EDGE;198}199200static void __init gic_basic_init(int numintrs, int numvpes,201 struct gic_intr_map *intrmap, int mapsize)202{203 unsigned int i, cpu;204+ unsigned int pin_offset = 0;205+206+ board_bind_eic_interrupt = &gic_bind_eic_interrupt;207208 /* Setup defaults */209 for (i = 0; i < numintrs; i++) {210 GIC_SET_POLARITY(i, GIC_POL_POS);211 GIC_SET_TRIGGER(i, GIC_TRIG_LEVEL);212 GIC_CLR_INTR_MASK(i);213+ if (i < GIC_NUM_INTRS) {214 gic_irq_flags[i] = 0;215+ gic_shared_intr_map[i].num_shared_intr = 0;216+ gic_shared_intr_map[i].local_intr_mask = 0;217+ }218 }219+220+ /*221+ * In EIC mode, the HW_INT# is offset by (2-1). Need to subtract222+ * one because the GIC will add one (since 0=no intr).223+ */224+ if (cpu_has_veic)225+ pin_offset = (GIC_CPU_TO_VEC_OFFSET - GIC_PIN_TO_VEC_OFFSET);226227 /* Setup specifics */228 for (i = 0; i < mapsize; i++) {···220 continue;221 gic_setup_intr(i,222 intrmap[i].cpunum,223+ intrmap[i].pin + pin_offset,224 intrmap[i].polarity,225 intrmap[i].trigtype,226 intrmap[i].flags);227 }228229 vpe_local_setup(numvpes);000230}231232void __init gic_init(unsigned long gic_base_addr,···242243 _gic_base = (unsigned long) ioremap_nocache(gic_base_addr,244 gic_addrspace_size);245+ gic_irq_base = irqbase;246247 GICREAD(GIC_REG(SHARED, GIC_SH_CONFIG), gicconfig);248 numintrs = (gicconfig & GIC_SH_CONFIG_NUMINTRS_MSK) >>···251252 numvpes = (gicconfig & GIC_SH_CONFIG_NUMVPES_MSK) >>253 GIC_SH_CONFIG_NUMVPES_SHF;254+ numvpes = numvpes + 1;0255256 gic_basic_init(numintrs, numvpes, intr_map, intr_map_size);257+258+ gic_platform_init(numintrs, &gic_irq_controller);259}
+21
arch/mips/mm/c-r4k.c
···786 }787}7880000000000000000000789static char *way_string[] __cpuinitdata = { NULL, "direct mapped", "2-way",790 "3-way", "4-way", "5-way", "6-way", "7-way", "8-way"791};···1075 case CPU_34K:1076 case CPU_74K:1077 case CPU_1004K:001078 if ((read_c0_config7() & (1 << 16))) {1079 /* effectively physically indexed dcache,1080 thus no virtual aliases. */
···786 }787}788789+static inline void alias_74k_erratum(struct cpuinfo_mips *c)790+{791+ /*792+ * Early versions of the 74K do not update the cache tags on a793+ * vtag miss/ptag hit which can occur in the case of KSEG0/KUSEG794+ * aliases. In this case it is better to treat the cache as always795+ * having aliases.796+ */797+ if ((c->processor_id & 0xff) <= PRID_REV_ENCODE_332(2, 4, 0))798+ c->dcache.flags |= MIPS_CACHE_VTAG;799+ if ((c->processor_id & 0xff) == PRID_REV_ENCODE_332(2, 4, 0))800+ write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND);801+ if (((c->processor_id & 0xff00) == PRID_IMP_1074K) &&802+ ((c->processor_id & 0xff) <= PRID_REV_ENCODE_332(1, 1, 0))) {803+ c->dcache.flags |= MIPS_CACHE_VTAG;804+ write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND);805+ }806+}807+808static char *way_string[] __cpuinitdata = { NULL, "direct mapped", "2-way",809 "3-way", "4-way", "5-way", "6-way", "7-way", "8-way"810};···1056 case CPU_34K:1057 case CPU_74K:1058 case CPU_1004K:1059+ if (c->cputype == CPU_74K)1060+ alias_74k_erratum(c);1061 if ((read_c0_config7() & (1 << 16))) {1062 /* effectively physically indexed dcache,1063 thus no virtual aliases. */
+29-1
arch/mips/mm/tlbex.c
···449 }450451 if (cpu_has_mips_r2) {452- if (cpu_has_mips_r2_exec_hazard)0000000000453 uasm_i_ehb(p);00454 tlbw(p);455 return;456 }···933#endif934 uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */935 uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr);0000000936 uasm_i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */937 uasm_i_sll(p, tmp, tmp, PGD_T_LOG2);938 uasm_i_addu(p, ptr, ptr, tmp); /* add in pgd offset */···975976static void __cpuinit build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr)977{000000000978 /*979 * Bug workaround for the Nevada. It seems as if under certain980 * circumstances the move from cp0_context might produce a
···449 }450451 if (cpu_has_mips_r2) {452+ /*453+ * The architecture spec says an ehb is required here,454+ * but a number of cores do not have the hazard and455+ * using an ehb causes an expensive pipeline stall.456+ */457+ switch (current_cpu_type()) {458+ case CPU_M14KC:459+ case CPU_74K:460+ break;461+462+ default:463 uasm_i_ehb(p);464+ break;465+ }466 tlbw(p);467 return;468 }···921#endif922 uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */923 uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr);924+925+ if (cpu_has_mips_r2) {926+ uasm_i_ext(p, tmp, tmp, PGDIR_SHIFT, (32 - PGDIR_SHIFT));927+ uasm_i_ins(p, ptr, tmp, PGD_T_LOG2, (32 - PGDIR_SHIFT));928+ return;929+ }930+931 uasm_i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */932 uasm_i_sll(p, tmp, tmp, PGD_T_LOG2);933 uasm_i_addu(p, ptr, ptr, tmp); /* add in pgd offset */···956957static void __cpuinit build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr)958{959+ if (cpu_has_mips_r2) {960+ /* PTE ptr offset is obtained from BadVAddr */961+ UASM_i_MFC0(p, tmp, C0_BADVADDR);962+ UASM_i_LW(p, ptr, 0, ptr);963+ uasm_i_ext(p, tmp, tmp, PAGE_SHIFT+1, PGDIR_SHIFT-PAGE_SHIFT-1);964+ uasm_i_ins(p, ptr, tmp, PTE_T_LOG2+1, PGDIR_SHIFT-PAGE_SHIFT-1);965+ return;966+ }967+968 /*969 * Bug workaround for the Nevada. It seems as if under certain970 * circumstances the move from cp0_context might produce a
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/kernel.h>9+#include <linux/module.h>10+#include <linux/init.h>11+#include <linux/platform_device.h>12+#include <linux/leds.h>13+#include <linux/err.h>14+#include <linux/io.h>15+16+#define DRVNAME "sead3-led"17+18+static struct platform_device *pdev;19+20+static void sead3_pled_set(struct led_classdev *led_cdev,21+ enum led_brightness value)22+{23+ pr_debug("sead3_pled_set\n");24+ writel(value, (void __iomem *)0xBF000210); /* FIXME */25+}26+27+static void sead3_fled_set(struct led_classdev *led_cdev,28+ enum led_brightness value)29+{30+ pr_debug("sead3_fled_set\n");31+ writel(value, (void __iomem *)0xBF000218); /* FIXME */32+}33+34+static struct led_classdev sead3_pled = {35+ .name = "sead3::pled",36+ .brightness_set = sead3_pled_set,37+};38+39+static struct led_classdev sead3_fled = {40+ .name = "sead3::fled",41+ .brightness_set = sead3_fled_set,42+};43+44+#ifdef CONFIG_PM45+static int sead3_led_suspend(struct platform_device *dev,46+ pm_message_t state)47+{48+ led_classdev_suspend(&sead3_pled);49+ led_classdev_suspend(&sead3_fled);50+ return 0;51+}52+53+static int sead3_led_resume(struct platform_device *dev)54+{55+ led_classdev_resume(&sead3_pled);56+ led_classdev_resume(&sead3_fled);57+ return 0;58+}59+#else60+#define sead3_led_suspend NULL61+#define sead3_led_resume NULL62+#endif63+64+static int sead3_led_probe(struct platform_device *pdev)65+{66+ int ret;67+68+ ret = led_classdev_register(&pdev->dev, &sead3_pled);69+ if (ret < 0)70+ return ret;71+72+ ret = led_classdev_register(&pdev->dev, &sead3_fled);73+ if (ret < 0)74+ led_classdev_unregister(&sead3_pled);75+76+ return ret;77+}78+79+static int sead3_led_remove(struct platform_device *pdev)80+{81+ led_classdev_unregister(&sead3_pled);82+ led_classdev_unregister(&sead3_fled);83+ return 0;84+}85+86+static struct platform_driver sead3_led_driver = {87+ .probe = sead3_led_probe,88+ .remove = sead3_led_remove,89+ .suspend = sead3_led_suspend,90+ .resume = sead3_led_resume,91+ .driver = {92+ .name = DRVNAME,93+ .owner = THIS_MODULE,94+ },95+};96+97+static int __init sead3_led_init(void)98+{99+ int ret;100+101+ ret = platform_driver_register(&sead3_led_driver);102+ if (ret < 0)103+ goto out;104+105+ pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);106+ if (IS_ERR(pdev)) {107+ ret = PTR_ERR(pdev);108+ platform_driver_unregister(&sead3_led_driver);109+ goto out;110+ }111+112+out:113+ return ret;114+}115+116+static void __exit sead3_led_exit(void)117+{118+ platform_device_unregister(pdev);119+ platform_driver_unregister(&sead3_led_driver);120+}121+122+module_init(sead3_led_init);123+module_exit(sead3_led_exit);124+125+MODULE_AUTHOR("Kristian Kielhofner <kris@krisk.org>");126+MODULE_DESCRIPTION("SEAD3 LED driver");127+MODULE_LICENSE("GPL");128+
+46
arch/mips/mti-sead3/sead3-cmdline.c
···0000000000000000000000000000000000000000000000
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/init.h>9+#include <linux/string.h>10+11+#include <asm/bootinfo.h>12+13+extern int prom_argc;14+extern int *_prom_argv;15+16+/*17+ * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.18+ * This macro take care of sign extension.19+ */20+#define prom_argv(index) ((char *)(long)_prom_argv[(index)])21+22+char * __init prom_getcmdline(void)23+{24+ return &(arcs_cmdline[0]);25+}26+27+void __init prom_init_cmdline(void)28+{29+ char *cp;30+ int actr;31+32+ actr = 1; /* Always ignore argv[0] */33+34+ cp = &(arcs_cmdline[0]);35+ while (actr < prom_argc) {36+ strcpy(cp, prom_argv(actr));37+ cp += strlen(prom_argv(actr));38+ *cp++ = ' ';39+ actr++;40+ }41+ if (cp != &(arcs_cmdline[0])) {42+ /* get rid of trailing space */43+ --cp;44+ *cp = '\0';45+ }46+}
+46
arch/mips/mti-sead3/sead3-console.c
···0000000000000000000000000000000000000000000000
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/init.h>9+#include <linux/console.h>10+#include <linux/serial_reg.h>11+#include <linux/io.h>12+13+#define SEAD_UART1_REGS_BASE 0xbf000800 /* ttyS1 = DB9 port */14+#define SEAD_UART0_REGS_BASE 0xbf000900 /* ttyS0 = USB port */15+#define PORT(base_addr, offset) ((unsigned int __iomem *)(base_addr+(offset)*4))16+17+static char console_port = 1;18+19+static inline unsigned int serial_in(int offset, unsigned int base_addr)20+{21+ return __raw_readl(PORT(base_addr, offset)) & 0xff;22+}23+24+static inline void serial_out(int offset, int value, unsigned int base_addr)25+{26+ __raw_writel(value, PORT(base_addr, offset));27+}28+29+void __init prom_init_early_console(char port)30+{31+ console_port = port;32+}33+34+int prom_putchar(char c)35+{36+ unsigned int base_addr;37+38+ base_addr = console_port ? SEAD_UART1_REGS_BASE : SEAD_UART0_REGS_BASE;39+40+ while ((serial_in(UART_LSR, base_addr) & UART_LSR_THRE) == 0)41+ ;42+43+ serial_out(UART_TX, c, base_addr);44+45+ return 1;46+}
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/timer.h>9+#include <linux/io.h>10+#include <asm/mips-boards/generic.h>11+#include <asm/mips-boards/prom.h>12+13+static unsigned int display_count;14+static unsigned int max_display_count;15+16+#define LCD_DISPLAY_POS_BASE 0x1f00040017+#define DISPLAY_LCDINSTRUCTION (0*2)18+#define DISPLAY_LCDDATA (1*2)19+#define DISPLAY_CPLDSTATUS (2*2)20+#define DISPLAY_CPLDDATA (3*2)21+#define LCD_SETDDRAM 0x8022+#define LCD_IR_BF 0x8023+24+const char display_string[] = " LINUX ON SEAD3 ";25+26+static void scroll_display_message(unsigned long data);27+static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);28+29+static void lcd_wait(unsigned int __iomem *display)30+{31+ /* Wait for CPLD state machine to become idle. */32+ do { } while (__raw_readl(display + DISPLAY_CPLDSTATUS) & 1);33+34+ do {35+ __raw_readl(display + DISPLAY_LCDINSTRUCTION);36+37+ /* Wait for CPLD state machine to become idle. */38+ do { } while (__raw_readl(display + DISPLAY_CPLDSTATUS) & 1);39+ } while (__raw_readl(display + DISPLAY_CPLDDATA) & LCD_IR_BF);40+}41+42+void mips_display_message(const char *str)43+{44+ static unsigned int __iomem *display;45+ char ch;46+ int i;47+48+ if (unlikely(display == NULL))49+ display = ioremap_nocache(LCD_DISPLAY_POS_BASE,50+ (8 * sizeof(int)));51+52+ for (i = 0; i < 16; i++) {53+ if (*str)54+ ch = *str++;55+ else56+ ch = ' ';57+ lcd_wait(display);58+ __raw_writel((LCD_SETDDRAM | i),59+ (display + DISPLAY_LCDINSTRUCTION));60+ lcd_wait(display);61+ __raw_writel(ch, display + DISPLAY_LCDDATA);62+ }63+}64+65+static void scroll_display_message(unsigned long data)66+{67+ mips_display_message(&display_string[display_count++]);68+ if (display_count == max_display_count)69+ display_count = 0;70+ mod_timer(&mips_scroll_timer, jiffies + HZ);71+}72+73+void mips_scroll_message(void)74+{75+ del_timer_sync(&mips_scroll_timer);76+ max_display_count = strlen(display_string) + 1 - 16;77+ mod_timer(&mips_scroll_timer, jiffies + 1);78+}
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/module.h>9+#include <linux/irq.h>10+#include <linux/dma-mapping.h>11+#include <linux/platform_device.h>12+13+struct resource ehci_resources[] = {14+ {15+ .start = 0x1b200000,16+ .end = 0x1b200fff,17+ .flags = IORESOURCE_MEM18+ },19+ {20+ .start = MIPS_CPU_IRQ_BASE + 2,21+ .flags = IORESOURCE_IRQ22+ }23+};24+25+u64 sead3_usbdev_dma_mask = DMA_BIT_MASK(32);26+27+static struct platform_device ehci_device = {28+ .name = "sead3-ehci",29+ .id = 0,30+ .dev = {31+ .dma_mask = &sead3_usbdev_dma_mask,32+ .coherent_dma_mask = DMA_BIT_MASK(32)33+ },34+ .num_resources = ARRAY_SIZE(ehci_resources),35+ .resource = ehci_resources36+};37+38+static int __init ehci_init(void)39+{40+ return platform_device_register(&ehci_device);41+}42+43+module_init(ehci_init);44+45+MODULE_AUTHOR("Chris Dearman <chris@mips.com>");46+MODULE_LICENSE("GPL");47+MODULE_DESCRIPTION("EHCI probe driver for SEAD3");
+33
arch/mips/mti-sead3/sead3-i2c-dev.c
···000000000000000000000000000000000
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/init.h>9+#include <linux/i2c.h>10+11+static struct i2c_board_info __initdata sead3_i2c_devices[] = {12+ {13+ I2C_BOARD_INFO("adt7476", 0x2c),14+ .irq = 0,15+ },16+ {17+ I2C_BOARD_INFO("m41t80", 0x68),18+ .irq = 0,19+ },20+};21+22+static int __init sead3_i2c_init(void)23+{24+ int err;25+26+ err = i2c_register_board_info(0, sead3_i2c_devices,27+ ARRAY_SIZE(sead3_i2c_devices));28+ if (err < 0)29+ pr_err("sead3-i2c-dev: cannot register board I2C devices\n");30+ return err;31+}32+33+arch_initcall(sead3_i2c_init);
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/init.h>9+#include <linux/module.h>10+#include <linux/slab.h>11+#include <linux/delay.h>12+#include <linux/i2c.h>13+#include <linux/platform_device.h>14+15+#define PIC32_I2CxCON 0x000016+#define PIC32_I2CCON_ON (1<<15)17+#define PIC32_I2CCON_ACKDT (1<<5)18+#define PIC32_I2CCON_ACKEN (1<<4)19+#define PIC32_I2CCON_RCEN (1<<3)20+#define PIC32_I2CCON_PEN (1<<2)21+#define PIC32_I2CCON_RSEN (1<<1)22+#define PIC32_I2CCON_SEN (1<<0)23+#define PIC32_I2CxCONCLR 0x000424+#define PIC32_I2CxCONSET 0x000825+#define PIC32_I2CxSTAT 0x001026+#define PIC32_I2CxSTATCLR 0x001427+#define PIC32_I2CSTAT_ACKSTAT (1<<15)28+#define PIC32_I2CSTAT_TRSTAT (1<<14)29+#define PIC32_I2CSTAT_BCL (1<<10)30+#define PIC32_I2CSTAT_IWCOL (1<<7)31+#define PIC32_I2CSTAT_I2COV (1<<6)32+#define PIC32_I2CxBRG 0x004033+#define PIC32_I2CxTRN 0x005034+#define PIC32_I2CxRCV 0x006035+36+static DEFINE_SPINLOCK(pic32_bus_lock);37+38+static void __iomem *bus_xfer = (void __iomem *)0xbf000600;39+static void __iomem *bus_status = (void __iomem *)0xbf000060;40+41+#define DELAY() udelay(100)42+43+static inline unsigned int ioready(void)44+{45+ return readl(bus_status) & 1;46+}47+48+static inline void wait_ioready(void)49+{50+ do { } while (!ioready());51+}52+53+static inline void wait_ioclear(void)54+{55+ do { } while (ioready());56+}57+58+static inline void check_ioclear(void)59+{60+ if (ioready()) {61+ do {62+ (void) readl(bus_xfer);63+ DELAY();64+ } while (ioready());65+ }66+}67+68+static u32 pic32_bus_readl(u32 reg)69+{70+ unsigned long flags;71+ u32 status, val;72+73+ spin_lock_irqsave(&pic32_bus_lock, flags);74+75+ check_ioclear();76+ writel((0x01 << 24) | (reg & 0x00ffffff), bus_xfer);77+ DELAY();78+ wait_ioready();79+ status = readl(bus_xfer);80+ DELAY();81+ val = readl(bus_xfer);82+ wait_ioclear();83+84+ spin_unlock_irqrestore(&pic32_bus_lock, flags);85+86+ return val;87+}88+89+static void pic32_bus_writel(u32 val, u32 reg)90+{91+ unsigned long flags;92+ u32 status;93+94+ spin_lock_irqsave(&pic32_bus_lock, flags);95+96+ check_ioclear();97+ writel((0x10 << 24) | (reg & 0x00ffffff), bus_xfer);98+ DELAY();99+ writel(val, bus_xfer);100+ DELAY();101+ wait_ioready();102+ status = readl(bus_xfer);103+ wait_ioclear();104+105+ spin_unlock_irqrestore(&pic32_bus_lock, flags);106+}107+108+struct pic32_i2c_platform_data {109+ u32 base;110+ struct i2c_adapter adap;111+ u32 xfer_timeout;112+ u32 ack_timeout;113+ u32 ctl_timeout;114+};115+116+static inline void pic32_i2c_start(struct pic32_i2c_platform_data *adap)117+{118+ pic32_bus_writel(PIC32_I2CCON_SEN, adap->base + PIC32_I2CxCONSET);119+}120+121+static inline void pic32_i2c_stop(struct pic32_i2c_platform_data *adap)122+{123+ pic32_bus_writel(PIC32_I2CCON_PEN, adap->base + PIC32_I2CxCONSET);124+}125+126+static inline void pic32_i2c_ack(struct pic32_i2c_platform_data *adap)127+{128+ pic32_bus_writel(PIC32_I2CCON_ACKDT, adap->base + PIC32_I2CxCONCLR);129+ pic32_bus_writel(PIC32_I2CCON_ACKEN, adap->base + PIC32_I2CxCONSET);130+}131+132+static inline void pic32_i2c_nack(struct pic32_i2c_platform_data *adap)133+{134+ pic32_bus_writel(PIC32_I2CCON_ACKDT, adap->base + PIC32_I2CxCONSET);135+ pic32_bus_writel(PIC32_I2CCON_ACKEN, adap->base + PIC32_I2CxCONSET);136+}137+138+static inline int pic32_i2c_idle(struct pic32_i2c_platform_data *adap)139+{140+ int i;141+142+ for (i = 0; i < adap->ctl_timeout; i++) {143+ if (((pic32_bus_readl(adap->base + PIC32_I2CxCON) &144+ (PIC32_I2CCON_ACKEN | PIC32_I2CCON_RCEN |145+ PIC32_I2CCON_PEN | PIC32_I2CCON_RSEN |146+ PIC32_I2CCON_SEN)) == 0) &&147+ ((pic32_bus_readl(adap->base + PIC32_I2CxSTAT) &148+ (PIC32_I2CSTAT_TRSTAT)) == 0))149+ return 0;150+ udelay(1);151+ }152+ return -ETIMEDOUT;153+}154+155+static inline u32 pic32_i2c_master_write(struct pic32_i2c_platform_data *adap,156+ u32 byte)157+{158+ pic32_bus_writel(byte, adap->base + PIC32_I2CxTRN);159+ return pic32_bus_readl(adap->base + PIC32_I2CxSTAT) &160+ PIC32_I2CSTAT_IWCOL;161+}162+163+static inline u32 pic32_i2c_master_read(struct pic32_i2c_platform_data *adap)164+{165+ pic32_bus_writel(PIC32_I2CCON_RCEN, adap->base + PIC32_I2CxCONSET);166+ while (pic32_bus_readl(adap->base + PIC32_I2CxCON) & PIC32_I2CCON_RCEN)167+ ;168+ pic32_bus_writel(PIC32_I2CSTAT_I2COV, adap->base + PIC32_I2CxSTATCLR);169+ return pic32_bus_readl(adap->base + PIC32_I2CxRCV);170+}171+172+static int pic32_i2c_address(struct pic32_i2c_platform_data *adap,173+ unsigned int addr, int rd)174+{175+ pic32_i2c_idle(adap);176+ pic32_i2c_start(adap);177+ pic32_i2c_idle(adap);178+179+ addr <<= 1;180+ if (rd)181+ addr |= 1;182+183+ if (pic32_i2c_master_write(adap, addr))184+ return -EIO;185+ pic32_i2c_idle(adap);186+ if (pic32_bus_readl(adap->base + PIC32_I2CxSTAT) &187+ PIC32_I2CSTAT_ACKSTAT)188+ return -EIO;189+ return 0;190+}191+192+static int sead3_i2c_read(struct pic32_i2c_platform_data *adap,193+ unsigned char *buf, unsigned int len)194+{195+ u32 data;196+ int i;197+198+ i = 0;199+ while (i < len) {200+ data = pic32_i2c_master_read(adap);201+ buf[i++] = data;202+ if (i < len)203+ pic32_i2c_ack(adap);204+ else205+ pic32_i2c_nack(adap);206+ }207+208+ pic32_i2c_stop(adap);209+ pic32_i2c_idle(adap);210+ return 0;211+}212+213+static int sead3_i2c_write(struct pic32_i2c_platform_data *adap,214+ unsigned char *buf, unsigned int len)215+{216+ int i;217+ u32 data;218+219+ i = 0;220+ while (i < len) {221+ data = buf[i];222+ if (pic32_i2c_master_write(adap, data))223+ return -EIO;224+ pic32_i2c_idle(adap);225+ if (pic32_bus_readl(adap->base + PIC32_I2CxSTAT) &226+ PIC32_I2CSTAT_ACKSTAT)227+ return -EIO;228+ i++;229+ }230+231+ pic32_i2c_stop(adap);232+ pic32_i2c_idle(adap);233+ return 0;234+}235+236+static int sead3_pic32_platform_xfer(struct i2c_adapter *i2c_adap,237+ struct i2c_msg *msgs, int num)238+{239+ struct pic32_i2c_platform_data *adap = i2c_adap->algo_data;240+ struct i2c_msg *p;241+ int i, err = 0;242+243+ for (i = 0; i < num; i++) {244+#define __BUFSIZE 80245+ int ii;246+ static char buf[__BUFSIZE];247+ char *b = buf;248+249+ p = &msgs[i];250+ b += sprintf(buf, " [%d bytes]", p->len);251+ if ((p->flags & I2C_M_RD) == 0) {252+ for (ii = 0; ii < p->len; ii++) {253+ if (b < &buf[__BUFSIZE-4]) {254+ b += sprintf(b, " %02x", p->buf[ii]);255+ } else {256+ strcat(b, "...");257+ break;258+ }259+ }260+ }261+ }262+263+ for (i = 0; !err && i < num; i++) {264+ p = &msgs[i];265+ err = pic32_i2c_address(adap, p->addr, p->flags & I2C_M_RD);266+ if (err || !p->len)267+ continue;268+ if (p->flags & I2C_M_RD)269+ err = sead3_i2c_read(adap, p->buf, p->len);270+ else271+ err = sead3_i2c_write(adap, p->buf, p->len);272+ }273+274+ /* Return the number of messages processed, or the error code. */275+ if (err == 0)276+ err = num;277+278+ return err;279+}280+281+static u32 sead3_pic32_platform_func(struct i2c_adapter *adap)282+{283+ return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;284+}285+286+static const struct i2c_algorithm sead3_platform_algo = {287+ .master_xfer = sead3_pic32_platform_xfer,288+ .functionality = sead3_pic32_platform_func,289+};290+291+static void sead3_i2c_platform_setup(struct pic32_i2c_platform_data *priv)292+{293+ pic32_bus_writel(500, priv->base + PIC32_I2CxBRG);294+ pic32_bus_writel(PIC32_I2CCON_ON, priv->base + PIC32_I2CxCONCLR);295+ pic32_bus_writel(PIC32_I2CCON_ON, priv->base + PIC32_I2CxCONSET);296+ pic32_bus_writel(PIC32_I2CSTAT_BCL | PIC32_I2CSTAT_IWCOL,297+ priv->base + PIC32_I2CxSTATCLR);298+}299+300+static int __devinit sead3_i2c_platform_probe(struct platform_device *pdev)301+{302+ struct pic32_i2c_platform_data *priv;303+ struct resource *r;304+ int ret;305+306+ r = platform_get_resource(pdev, IORESOURCE_MEM, 0);307+ if (!r) {308+ ret = -ENODEV;309+ goto out;310+ }311+312+ priv = kzalloc(sizeof(struct pic32_i2c_platform_data), GFP_KERNEL);313+ if (!priv) {314+ ret = -ENOMEM;315+ goto out;316+ }317+318+ priv->base = r->start;319+ if (!priv->base) {320+ ret = -EBUSY;321+ goto out_mem;322+ }323+324+ priv->xfer_timeout = 200;325+ priv->ack_timeout = 200;326+ priv->ctl_timeout = 200;327+328+ priv->adap.nr = pdev->id;329+ priv->adap.algo = &sead3_platform_algo;330+ priv->adap.algo_data = priv;331+ priv->adap.dev.parent = &pdev->dev;332+ strlcpy(priv->adap.name, "SEAD3 PIC32", sizeof(priv->adap.name));333+334+ sead3_i2c_platform_setup(priv);335+336+ ret = i2c_add_numbered_adapter(&priv->adap);337+ if (ret == 0) {338+ platform_set_drvdata(pdev, priv);339+ return 0;340+ }341+342+out_mem:343+ kfree(priv);344+out:345+ return ret;346+}347+348+static int __devexit sead3_i2c_platform_remove(struct platform_device *pdev)349+{350+ struct pic32_i2c_platform_data *priv = platform_get_drvdata(pdev);351+352+ platform_set_drvdata(pdev, NULL);353+ i2c_del_adapter(&priv->adap);354+ kfree(priv);355+ return 0;356+}357+358+#ifdef CONFIG_PM359+static int sead3_i2c_platform_suspend(struct platform_device *pdev,360+ pm_message_t state)361+{362+ dev_dbg(&pdev->dev, "i2c_platform_disable\n");363+ return 0;364+}365+366+static int sead3_i2c_platform_resume(struct platform_device *pdev)367+{368+ struct pic32_i2c_platform_data *priv = platform_get_drvdata(pdev);369+370+ dev_dbg(&pdev->dev, "sead3_i2c_platform_setup\n");371+ sead3_i2c_platform_setup(priv);372+373+ return 0;374+}375+#else376+#define sead3_i2c_platform_suspend NULL377+#define sead3_i2c_platform_resume NULL378+#endif379+380+static struct platform_driver sead3_i2c_platform_driver = {381+ .driver = {382+ .name = "sead3-i2c",383+ .owner = THIS_MODULE,384+ },385+ .probe = sead3_i2c_platform_probe,386+ .remove = __devexit_p(sead3_i2c_platform_remove),387+ .suspend = sead3_i2c_platform_suspend,388+ .resume = sead3_i2c_platform_resume,389+};390+391+static int __init sead3_i2c_platform_init(void)392+{393+ return platform_driver_register(&sead3_i2c_platform_driver);394+}395+module_init(sead3_i2c_platform_init);396+397+static void __exit sead3_i2c_platform_exit(void)398+{399+ platform_driver_unregister(&sead3_i2c_platform_driver);400+}401+module_exit(sead3_i2c_platform_exit);402+403+MODULE_AUTHOR("Chris Dearman, MIPS Technologies INC.");404+MODULE_DESCRIPTION("SEAD3 PIC32 I2C driver");405+MODULE_LICENSE("GPL");
+37
arch/mips/mti-sead3/sead3-i2c.c
···0000000000000000000000000000000000000
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/module.h>9+#include <linux/init.h>10+#include <linux/platform_device.h>11+#include <irq.h>12+13+struct resource sead3_i2c_resources[] = {14+ {15+ .start = 0x805200,16+ .end = 0x8053ff,17+ .flags = IORESOURCE_MEM,18+ },19+};20+21+static struct platform_device sead3_i2c_device = {22+ .name = "sead3-i2c",23+ .id = 0,24+ .num_resources = ARRAY_SIZE(sead3_i2c_resources),25+ .resource = sead3_i2c_resources,26+};27+28+static int __init sead3_i2c_init(void)29+{30+ return platform_device_register(&sead3_i2c_device);31+}32+33+module_init(sead3_i2c_init);34+35+MODULE_AUTHOR("Chris Dearman <chris@mips.com>");36+MODULE_LICENSE("GPL");37+MODULE_DESCRIPTION("I2C probe driver for SEAD3");
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/init.h>9+#include <linux/io.h>10+11+#include <asm/bootinfo.h>12+#include <asm/cacheflush.h>13+#include <asm/traps.h>14+#include <asm/mips-boards/generic.h>15+#include <asm/mips-boards/prom.h>16+17+extern void prom_init_early_console(char port);18+19+extern char except_vec_nmi;20+extern char except_vec_ejtag_debug;21+22+int prom_argc;23+int *_prom_argv, *_prom_envp;24+25+#define prom_envp(index) ((char *)(long)_prom_envp[(index)])26+27+char *prom_getenv(char *envname)28+{29+ /*30+ * Return a pointer to the given environment variable.31+ * In 64-bit mode: we're using 64-bit pointers, but all pointers32+ * in the PROM structures are only 32-bit, so we need some33+ * workarounds, if we are running in 64-bit mode.34+ */35+ int i, index = 0;36+37+ i = strlen(envname);38+39+ while (prom_envp(index)) {40+ if (strncmp(envname, prom_envp(index), i) == 0)41+ return prom_envp(index+1);42+ index += 2;43+ }44+45+ return NULL;46+}47+48+static void __init mips_nmi_setup(void)49+{50+ void *base;51+52+ base = cpu_has_veic ?53+ (void *)(CAC_BASE + 0xa80) :54+ (void *)(CAC_BASE + 0x380);55+ memcpy(base, &except_vec_nmi, 0x80);56+ flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);57+}58+59+static void __init mips_ejtag_setup(void)60+{61+ void *base;62+63+ base = cpu_has_veic ?64+ (void *)(CAC_BASE + 0xa00) :65+ (void *)(CAC_BASE + 0x300);66+ memcpy(base, &except_vec_ejtag_debug, 0x80);67+ flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);68+}69+70+void __init prom_init(void)71+{72+ prom_argc = fw_arg0;73+ _prom_argv = (int *) fw_arg1;74+ _prom_envp = (int *) fw_arg2;75+76+ board_nmi_handler_setup = mips_nmi_setup;77+ board_ejtag_handler_setup = mips_ejtag_setup;78+79+ prom_init_cmdline();80+ prom_meminit();81+#ifdef CONFIG_EARLY_PRINTK82+ if ((strstr(prom_getcmdline(), "console=ttyS0")) != NULL)83+ prom_init_early_console(0);84+ else if ((strstr(prom_getcmdline(), "console=ttyS1")) != NULL)85+ prom_init_early_console(1);86+#endif87+#ifdef CONFIG_SERIAL_8250_CONSOLE88+ if ((strstr(prom_getcmdline(), "console=")) == NULL)89+ strcat(prom_getcmdline(), " console=ttyS0,38400n8r");90+#endif91+}
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/init.h>9+#include <linux/irq.h>10+#include <linux/io.h>11+12+#include <asm/gic.h>13+#include <asm/irq_cpu.h>14+#include <asm/setup.h>15+16+#include <asm/mips-boards/sead3int.h>17+18+#define SEAD_CONFIG_GIC_PRESENT_SHF 119+#define SEAD_CONFIG_GIC_PRESENT_MSK (1 << SEAD_CONFIG_GIC_PRESENT_SHF)20+#define SEAD_CONFIG_BASE 0x1b10011021+#define SEAD_CONFIG_SIZE 422+23+int gic_present;24+static unsigned long sead3_config_reg;25+26+/*27+ * This table defines the setup for each external GIC interrupt. It is28+ * indexed by interrupt number.29+ */30+#define GIC_CPU_NMI GIC_MAP_TO_NMI_MSK31+static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = {32+ { 0, GIC_CPU_INT4, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },33+ { 0, GIC_CPU_INT3, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },34+ { 0, GIC_CPU_INT2, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },35+ { 0, GIC_CPU_INT2, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },36+ { 0, GIC_CPU_INT1, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },37+ { 0, GIC_CPU_INT0, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },38+ { 0, GIC_CPU_INT0, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },39+ { 0, GIC_CPU_INT0, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },40+ { 0, GIC_CPU_INT0, GIC_POL_POS, GIC_TRIG_LEVEL, GIC_FLAG_TRANSPARENT },41+ { GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED },42+ { GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED },43+ { GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED },44+ { GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED },45+ { GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED },46+ { GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED },47+ { GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED, GIC_UNUSED },48+};49+50+asmlinkage void plat_irq_dispatch(void)51+{52+ unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;53+ int irq;54+55+ irq = (fls(pending) - CAUSEB_IP - 1);56+ if (irq >= 0)57+ do_IRQ(MIPS_CPU_IRQ_BASE + irq);58+ else59+ spurious_interrupt();60+}61+62+void __init arch_init_irq(void)63+{64+ int i;65+66+ if (!cpu_has_veic) {67+ mips_cpu_irq_init();68+69+ if (cpu_has_vint) {70+ /* install generic handler */71+ for (i = 0; i < 8; i++)72+ set_vi_handler(i, plat_irq_dispatch);73+ }74+ }75+76+ sead3_config_reg = (unsigned long)ioremap_nocache(SEAD_CONFIG_BASE,77+ SEAD_CONFIG_SIZE);78+ gic_present = (REG32(sead3_config_reg) & SEAD_CONFIG_GIC_PRESENT_MSK) >>79+ SEAD_CONFIG_GIC_PRESENT_SHF;80+ pr_info("GIC: %spresent\n", (gic_present) ? "" : "not ");81+ pr_info("EIC: %s\n",82+ (current_cpu_data.options & MIPS_CPU_VEIC) ? "on" : "off");83+84+ if (gic_present)85+ gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map,86+ ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE);87+}88+89+void gic_enable_interrupt(int irq_vec)90+{91+ unsigned int i, irq_source;92+93+ /* enable all the interrupts associated with this vector */94+ for (i = 0; i < gic_shared_intr_map[irq_vec].num_shared_intr; i++) {95+ irq_source = gic_shared_intr_map[irq_vec].intr_list[i];96+ GIC_SET_INTR_MASK(irq_source);97+ }98+ /* enable all local interrupts associated with this vector */99+ if (gic_shared_intr_map[irq_vec].local_intr_mask) {100+ GICWRITE(GIC_REG(VPE_LOCAL, GIC_VPE_OTHER_ADDR), 0);101+ GICWRITE(GIC_REG(VPE_OTHER, GIC_VPE_SMASK),102+ gic_shared_intr_map[irq_vec].local_intr_mask);103+ }104+}105+106+void gic_disable_interrupt(int irq_vec)107+{108+ unsigned int i, irq_source;109+110+ /* disable all the interrupts associated with this vector */111+ for (i = 0; i < gic_shared_intr_map[irq_vec].num_shared_intr; i++) {112+ irq_source = gic_shared_intr_map[irq_vec].intr_list[i];113+ GIC_CLR_INTR_MASK(irq_source);114+ }115+ /* disable all local interrupts associated with this vector */116+ if (gic_shared_intr_map[irq_vec].local_intr_mask) {117+ GICWRITE(GIC_REG(VPE_LOCAL, GIC_VPE_OTHER_ADDR), 0);118+ GICWRITE(GIC_REG(VPE_OTHER, GIC_VPE_RMASK),119+ gic_shared_intr_map[irq_vec].local_intr_mask);120+ }121+}122+123+void gic_irq_ack(struct irq_data *d)124+{125+ GIC_CLR_INTR_MASK(d->irq - gic_irq_base);126+}127+128+void gic_finish_irq(struct irq_data *d)129+{130+ unsigned int irq = (d->irq - gic_irq_base);131+ unsigned int i, irq_source;132+133+ /* Clear edge detectors. */134+ for (i = 0; i < gic_shared_intr_map[irq].num_shared_intr; i++) {135+ irq_source = gic_shared_intr_map[irq].intr_list[i];136+ if (gic_irq_flags[irq_source] & GIC_TRIG_EDGE)137+ GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), irq_source);138+ }139+140+ /* Enable interrupts. */141+ GIC_SET_INTR_MASK(irq);142+}143+144+void __init gic_platform_init(int irqs, struct irq_chip *irq_controller)145+{146+ int i;147+148+ /*149+ * For non-EIC mode, we want to setup the GIC in pass-through150+ * mode, as if the GIC didn't exist. Do not map any interrupts151+ * for an external interrupt controller.152+ */153+ if (!cpu_has_veic)154+ return;155+156+ for (i = gic_irq_base; i < (gic_irq_base + irqs); i++)157+ irq_set_chip_and_handler(i, irq_controller, handle_percpu_irq);158+}
+43
arch/mips/mti-sead3/sead3-lcd.c
···0000000000000000000000000000000000000000000
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/init.h>9+#include <linux/platform_device.h>10+11+static struct resource __initdata sead3_lcd_resource = {12+ .start = 0x1f000400,13+ .end = 0x1f00041f,14+ .flags = IORESOURCE_MEM,15+};16+17+static __init int sead3_lcd_add(void)18+{19+ struct platform_device *pdev;20+ int retval;21+22+ /* SEAD-3 and Cobalt platforms use same display type. */23+ pdev = platform_device_alloc("cobalt-lcd", -1);24+ if (!pdev)25+ return -ENOMEM;26+27+ retval = platform_device_add_resources(pdev, &sead3_lcd_resource, 1);28+ if (retval)29+ goto err_free_device;30+31+ retval = platform_device_add(pdev);32+ if (retval)33+ goto err_free_device;34+35+ return 0;36+37+err_free_device:38+ platform_device_put(pdev);39+40+ return retval;41+}42+43+device_initcall(sead3_lcd_add);
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/bootmem.h>9+10+#include <asm/bootinfo.h>11+#include <asm/sections.h>12+#include <asm/mips-boards/prom.h>13+14+enum yamon_memtypes {15+ yamon_dontuse,16+ yamon_prom,17+ yamon_free,18+};19+20+static struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS];21+22+/* determined physical memory size, not overridden by command line args */23+unsigned long physical_memsize = 0L;24+25+struct prom_pmemblock * __init prom_getmdesc(void)26+{27+ char *memsize_str, *ptr;28+ unsigned int memsize;29+ static char cmdline[COMMAND_LINE_SIZE] __initdata;30+ long val;31+ int tmp;32+33+ /* otherwise look in the environment */34+ memsize_str = prom_getenv("memsize");35+ if (!memsize_str) {36+ pr_warn("memsize not set in boot prom, set to default 32Mb\n");37+ physical_memsize = 0x02000000;38+ } else {39+ tmp = kstrtol(memsize_str, 0, &val);40+ physical_memsize = (unsigned long)val;41+ }42+43+#ifdef CONFIG_CPU_BIG_ENDIAN44+ /* SOC-it swaps, or perhaps doesn't swap, when DMA'ing the last45+ word of physical memory */46+ physical_memsize -= PAGE_SIZE;47+#endif48+49+ /* Check the command line for a memsize directive that overrides50+ the physical/default amount */51+ strcpy(cmdline, arcs_cmdline);52+ ptr = strstr(cmdline, "memsize=");53+ if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' '))54+ ptr = strstr(ptr, " memsize=");55+56+ if (ptr)57+ memsize = memparse(ptr + 8, &ptr);58+ else59+ memsize = physical_memsize;60+61+ memset(mdesc, 0, sizeof(mdesc));62+63+ mdesc[0].type = yamon_dontuse;64+ mdesc[0].base = 0x00000000;65+ mdesc[0].size = 0x00001000;66+67+ mdesc[1].type = yamon_prom;68+ mdesc[1].base = 0x00001000;69+ mdesc[1].size = 0x000ef000;70+71+ /*72+ * The area 0x000f0000-0x000fffff is allocated for BIOS memory by the73+ * south bridge and PCI access always forwarded to the ISA Bus and74+ * BIOSCS# is always generated.75+ * This mean that this area can't be used as DMA memory for PCI76+ * devices.77+ */78+ mdesc[2].type = yamon_dontuse;79+ mdesc[2].base = 0x000f0000;80+ mdesc[2].size = 0x00010000;81+82+ mdesc[3].type = yamon_dontuse;83+ mdesc[3].base = 0x00100000;84+ mdesc[3].size = CPHYSADDR(PFN_ALIGN((unsigned long)&_end)) -85+ mdesc[3].base;86+87+ mdesc[4].type = yamon_free;88+ mdesc[4].base = CPHYSADDR(PFN_ALIGN(&_end));89+ mdesc[4].size = memsize - mdesc[4].base;90+91+ return &mdesc[0];92+}93+94+static int __init prom_memtype_classify(unsigned int type)95+{96+ switch (type) {97+ case yamon_free:98+ return BOOT_MEM_RAM;99+ case yamon_prom:100+ return BOOT_MEM_ROM_DATA;101+ default:102+ return BOOT_MEM_RESERVED;103+ }104+}105+106+void __init prom_meminit(void)107+{108+ struct prom_pmemblock *p;109+110+ p = prom_getmdesc();111+112+ while (p->size) {113+ long type;114+ unsigned long base, size;115+116+ type = prom_memtype_classify(p->type);117+ base = p->base;118+ size = p->size;119+120+ add_memory_region(base, size, type);121+ p++;122+ }123+}124+125+void __init prom_free_prom_memory(void)126+{127+ unsigned long addr;128+ int i;129+130+ for (i = 0; i < boot_mem_map.nr_map; i++) {131+ if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)132+ continue;133+134+ addr = boot_mem_map.map[i].addr;135+ free_init_pages("prom memory",136+ addr, addr + boot_mem_map.map[i].size);137+ }138+}
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/delay.h>9+#include <linux/kernel.h>10+#include <linux/module.h>11+#include <linux/spinlock.h>12+#include <linux/platform_device.h>13+#include <linux/init.h>14+#include <linux/errno.h>15+#include <linux/i2c.h>16+#include <linux/slab.h>17+18+#define PIC32_I2CxCON 0x000019+#define PIC32_I2CxCONCLR 0x000420+#define PIC32_I2CxCONSET 0x000821+#define PIC32_I2CxCONINV 0x000C22+#define I2CCON_ON (1<<15)23+#define I2CCON_FRZ (1<<14)24+#define I2CCON_SIDL (1<<13)25+#define I2CCON_SCLREL (1<<12)26+#define I2CCON_STRICT (1<<11)27+#define I2CCON_A10M (1<<10)28+#define I2CCON_DISSLW (1<<9)29+#define I2CCON_SMEN (1<<8)30+#define I2CCON_GCEN (1<<7)31+#define I2CCON_STREN (1<<6)32+#define I2CCON_ACKDT (1<<5)33+#define I2CCON_ACKEN (1<<4)34+#define I2CCON_RCEN (1<<3)35+#define I2CCON_PEN (1<<2)36+#define I2CCON_RSEN (1<<1)37+#define I2CCON_SEN (1<<0)38+39+#define PIC32_I2CxSTAT 0x001040+#define PIC32_I2CxSTATCLR 0x001441+#define PIC32_I2CxSTATSET 0x001842+#define PIC32_I2CxSTATINV 0x001C43+#define I2CSTAT_ACKSTAT (1<<15)44+#define I2CSTAT_TRSTAT (1<<14)45+#define I2CSTAT_BCL (1<<10)46+#define I2CSTAT_GCSTAT (1<<9)47+#define I2CSTAT_ADD10 (1<<8)48+#define I2CSTAT_IWCOL (1<<7)49+#define I2CSTAT_I2COV (1<<6)50+#define I2CSTAT_DA (1<<5)51+#define I2CSTAT_P (1<<4)52+#define I2CSTAT_S (1<<3)53+#define I2CSTAT_RW (1<<2)54+#define I2CSTAT_RBF (1<<1)55+#define I2CSTAT_TBF (1<<0)56+57+#define PIC32_I2CxADD 0x002058+#define PIC32_I2CxADDCLR 0x002459+#define PIC32_I2CxADDSET 0x002860+#define PIC32_I2CxADDINV 0x002C61+#define PIC32_I2CxMSK 0x003062+#define PIC32_I2CxMSKCLR 0x003463+#define PIC32_I2CxMSKSET 0x003864+#define PIC32_I2CxMSKINV 0x003C65+#define PIC32_I2CxBRG 0x004066+#define PIC32_I2CxBRGCLR 0x004467+#define PIC32_I2CxBRGSET 0x004868+#define PIC32_I2CxBRGINV 0x004C69+#define PIC32_I2CxTRN 0x005070+#define PIC32_I2CxTRNCLR 0x005471+#define PIC32_I2CxTRNSET 0x005872+#define PIC32_I2CxTRNINV 0x005C73+#define PIC32_I2CxRCV 0x006074+75+struct i2c_platform_data {76+ u32 base;77+ struct i2c_adapter adap;78+ u32 xfer_timeout;79+ u32 ack_timeout;80+ u32 ctl_timeout;81+};82+83+extern u32 pic32_bus_readl(u32 reg);84+extern void pic32_bus_writel(u32 val, u32 reg);85+86+static inline void87+StartI2C(struct i2c_platform_data *adap)88+{89+ pr_debug("StartI2C\n");90+ pic32_bus_writel(I2CCON_SEN, adap->base + PIC32_I2CxCONSET);91+}92+93+static inline void94+StopI2C(struct i2c_platform_data *adap)95+{96+ pr_debug("StopI2C\n");97+ pic32_bus_writel(I2CCON_PEN, adap->base + PIC32_I2CxCONSET);98+}99+100+static inline void101+AckI2C(struct i2c_platform_data *adap)102+{103+ pr_debug("AckI2C\n");104+ pic32_bus_writel(I2CCON_ACKDT, adap->base + PIC32_I2CxCONCLR);105+ pic32_bus_writel(I2CCON_ACKEN, adap->base + PIC32_I2CxCONSET);106+}107+108+static inline void109+NotAckI2C(struct i2c_platform_data *adap)110+{111+ pr_debug("NakI2C\n");112+ pic32_bus_writel(I2CCON_ACKDT, adap->base + PIC32_I2CxCONSET);113+ pic32_bus_writel(I2CCON_ACKEN, adap->base + PIC32_I2CxCONSET);114+}115+116+static inline int117+IdleI2C(struct i2c_platform_data *adap)118+{119+ int i;120+121+ pr_debug("IdleI2C\n");122+ for (i = 0; i < adap->ctl_timeout; i++) {123+ if (((pic32_bus_readl(adap->base + PIC32_I2CxCON) &124+ (I2CCON_ACKEN | I2CCON_RCEN | I2CCON_PEN | I2CCON_RSEN |125+ I2CCON_SEN)) == 0) &&126+ ((pic32_bus_readl(adap->base + PIC32_I2CxSTAT) &127+ (I2CSTAT_TRSTAT)) == 0))128+ return 0;129+ udelay(1);130+ }131+ return -ETIMEDOUT;132+}133+134+static inline u32135+MasterWriteI2C(struct i2c_platform_data *adap, u32 byte)136+{137+ pr_debug("MasterWriteI2C\n");138+139+ pic32_bus_writel(byte, adap->base + PIC32_I2CxTRN);140+141+ return pic32_bus_readl(adap->base + PIC32_I2CxSTAT) & I2CSTAT_IWCOL;142+}143+144+static inline u32145+MasterReadI2C(struct i2c_platform_data *adap)146+{147+ pr_debug("MasterReadI2C\n");148+149+ pic32_bus_writel(I2CCON_RCEN, adap->base + PIC32_I2CxCONSET);150+151+ while (pic32_bus_readl(adap->base + PIC32_I2CxCON) & I2CCON_RCEN)152+ ;153+154+ pic32_bus_writel(I2CSTAT_I2COV, adap->base + PIC32_I2CxSTATCLR);155+156+ return pic32_bus_readl(adap->base + PIC32_I2CxRCV);157+}158+159+static int160+do_address(struct i2c_platform_data *adap, unsigned int addr, int rd)161+{162+ pr_debug("doaddress\n");163+164+ IdleI2C(adap);165+ StartI2C(adap);166+ IdleI2C(adap);167+168+ addr <<= 1;169+ if (rd)170+ addr |= 1;171+172+ if (MasterWriteI2C(adap, addr))173+ return -EIO;174+ IdleI2C(adap);175+ if (pic32_bus_readl(adap->base + PIC32_I2CxSTAT) & I2CSTAT_ACKSTAT)176+ return -EIO;177+ return 0;178+}179+180+static int181+i2c_read(struct i2c_platform_data *adap, unsigned char *buf,182+ unsigned int len)183+{184+ int i;185+ u32 data;186+187+ pr_debug("i2c_read\n");188+189+ i = 0;190+ while (i < len) {191+ data = MasterReadI2C(adap);192+ buf[i++] = data;193+ if (i < len)194+ AckI2C(adap);195+ else196+ NotAckI2C(adap);197+ }198+199+ StopI2C(adap);200+ IdleI2C(adap);201+ return 0;202+}203+204+static int205+i2c_write(struct i2c_platform_data *adap, unsigned char *buf,206+ unsigned int len)207+{208+ int i;209+ u32 data;210+211+ pr_debug("i2c_write\n");212+213+ i = 0;214+ while (i < len) {215+ data = buf[i];216+ if (MasterWriteI2C(adap, data))217+ return -EIO;218+ IdleI2C(adap);219+ if (pic32_bus_readl(adap->base + PIC32_I2CxSTAT) &220+ I2CSTAT_ACKSTAT)221+ return -EIO;222+ i++;223+ }224+225+ StopI2C(adap);226+ IdleI2C(adap);227+ return 0;228+}229+230+static int231+platform_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num)232+{233+ struct i2c_platform_data *adap = i2c_adap->algo_data;234+ struct i2c_msg *p;235+ int i, err = 0;236+237+ pr_debug("platform_xfer\n");238+ for (i = 0; i < num; i++) {239+#define __BUFSIZE 80240+ int ii;241+ static char buf[__BUFSIZE];242+ char *b = buf;243+244+ p = &msgs[i];245+ b += sprintf(buf, " [%d bytes]", p->len);246+ if ((p->flags & I2C_M_RD) == 0) {247+ for (ii = 0; ii < p->len; ii++) {248+ if (b < &buf[__BUFSIZE-4]) {249+ b += sprintf(b, " %02x", p->buf[ii]);250+ } else {251+ strcat(b, "...");252+ break;253+ }254+ }255+ }256+ pr_debug("xfer%d: DevAddr: %04x Op:%s Data:%s\n", i, p->addr,257+ (p->flags & I2C_M_RD) ? "Rd" : "Wr", buf);258+ }259+260+261+ for (i = 0; !err && i < num; i++) {262+ p = &msgs[i];263+ err = do_address(adap, p->addr, p->flags & I2C_M_RD);264+ if (err || !p->len)265+ continue;266+ if (p->flags & I2C_M_RD)267+ err = i2c_read(adap, p->buf, p->len);268+ else269+ err = i2c_write(adap, p->buf, p->len);270+ }271+272+ /* Return the number of messages processed, or the error code. */273+ if (err == 0)274+ err = num;275+276+ return err;277+}278+279+static u32280+platform_func(struct i2c_adapter *adap)281+{282+ pr_debug("platform_algo\n");283+ return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;284+}285+286+static const struct i2c_algorithm platform_algo = {287+ .master_xfer = platform_xfer,288+ .functionality = platform_func,289+};290+291+static void i2c_platform_setup(struct i2c_platform_data *priv)292+{293+ pr_debug("i2c_platform_setup\n");294+295+ pic32_bus_writel(500, priv->base + PIC32_I2CxBRG);296+ pic32_bus_writel(I2CCON_ON, priv->base + PIC32_I2CxCONCLR);297+ pic32_bus_writel(I2CCON_ON, priv->base + PIC32_I2CxCONSET);298+ pic32_bus_writel((I2CSTAT_BCL | I2CSTAT_IWCOL),299+ (priv->base + PIC32_I2CxSTATCLR));300+}301+302+static void i2c_platform_disable(struct i2c_platform_data *priv)303+{304+ pr_debug("i2c_platform_disable\n");305+}306+307+static int __devinit308+i2c_platform_probe(struct platform_device *pdev)309+{310+ struct i2c_platform_data *priv;311+ struct resource *r;312+ int ret;313+314+ pr_debug("i2c_platform_probe\n");315+ r = platform_get_resource(pdev, IORESOURCE_MEM, 0);316+ if (!r) {317+ ret = -ENODEV;318+ goto out;319+ }320+321+ priv = kzalloc(sizeof(struct i2c_platform_data), GFP_KERNEL);322+ if (!priv) {323+ ret = -ENOMEM;324+ goto out;325+ }326+327+ /* FIXME: need to allocate resource in PIC32 space */328+#if 0329+ priv->base = bus_request_region(r->start, resource_size(r),330+ pdev->name);331+#else332+ priv->base = r->start;333+#endif334+ if (!priv->base) {335+ ret = -EBUSY;336+ goto out_mem;337+ }338+339+ priv->xfer_timeout = 200;340+ priv->ack_timeout = 200;341+ priv->ctl_timeout = 200;342+343+ priv->adap.nr = pdev->id;344+ priv->adap.algo = &platform_algo;345+ priv->adap.algo_data = priv;346+ priv->adap.dev.parent = &pdev->dev;347+ strlcpy(priv->adap.name, "PIC32 I2C", sizeof(priv->adap.name));348+349+ i2c_platform_setup(priv);350+351+ ret = i2c_add_numbered_adapter(&priv->adap);352+ if (ret == 0) {353+ platform_set_drvdata(pdev, priv);354+ return 0;355+ }356+357+ i2c_platform_disable(priv);358+359+out_mem:360+ kfree(priv);361+out:362+ return ret;363+}364+365+static int __devexit366+i2c_platform_remove(struct platform_device *pdev)367+{368+ struct i2c_platform_data *priv = platform_get_drvdata(pdev);369+370+ pr_debug("i2c_platform_remove\n");371+ platform_set_drvdata(pdev, NULL);372+ i2c_del_adapter(&priv->adap);373+ i2c_platform_disable(priv);374+ kfree(priv);375+ return 0;376+}377+378+#ifdef CONFIG_PM379+static int380+i2c_platform_suspend(struct platform_device *pdev, pm_message_t state)381+{382+ struct i2c_platform_data *priv = platform_get_drvdata(pdev);383+384+ dev_dbg(&pdev->dev, "i2c_platform_disable\n");385+ i2c_platform_disable(priv);386+387+ return 0;388+}389+390+static int391+i2c_platform_resume(struct platform_device *pdev)392+{393+ struct i2c_platform_data *priv = platform_get_drvdata(pdev);394+395+ dev_dbg(&pdev->dev, "i2c_platform_setup\n");396+ i2c_platform_setup(priv);397+398+ return 0;399+}400+#else401+#define i2c_platform_suspend NULL402+#define i2c_platform_resume NULL403+#endif404+405+static struct platform_driver i2c_platform_driver = {406+ .driver = {407+ .name = "i2c_pic32",408+ .owner = THIS_MODULE,409+ },410+ .probe = i2c_platform_probe,411+ .remove = __devexit_p(i2c_platform_remove),412+ .suspend = i2c_platform_suspend,413+ .resume = i2c_platform_resume,414+};415+416+static int __init417+i2c_platform_init(void)418+{419+ pr_debug("i2c_platform_init\n");420+ return platform_driver_register(&i2c_platform_driver);421+}422+423+static void __exit424+i2c_platform_exit(void)425+{426+ pr_debug("i2c_platform_exit\n");427+ platform_driver_unregister(&i2c_platform_driver);428+}429+430+MODULE_AUTHOR("Chris Dearman, MIPS Technologies INC.");431+MODULE_DESCRIPTION("PIC32 I2C driver");432+MODULE_LICENSE("GPL");433+434+module_init(i2c_platform_init);435+module_exit(i2c_platform_exit);
+45
arch/mips/mti-sead3/sead3-platform.c
···000000000000000000000000000000000000000000000
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/module.h>9+#include <linux/init.h>10+#include <linux/serial_8250.h>11+12+#define UART(base, int) \13+{ \14+ .mapbase = base, \15+ .irq = int, \16+ .uartclk = 14745600, \17+ .iotype = UPIO_MEM32, \18+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, \19+ .regshift = 2, \20+}21+22+static struct plat_serial8250_port uart8250_data[] = {23+ UART(0x1f000900, MIPS_CPU_IRQ_BASE + 4), /* ttyS0 = USB */24+ UART(0x1f000800, MIPS_CPU_IRQ_BASE + 4), /* ttyS1 = RS232 */25+ { },26+};27+28+static struct platform_device uart8250_device = {29+ .name = "serial8250",30+ .id = PLAT8250_DEV_PLATFORM2,31+ .dev = {32+ .platform_data = uart8250_data,33+ },34+};35+36+static int __init uart8250_init(void)37+{38+ return platform_device_register(&uart8250_device);39+}40+41+module_init(uart8250_init);42+43+MODULE_AUTHOR("Chris Dearman <chris@mips.com>");44+MODULE_LICENSE("GPL");45+MODULE_DESCRIPTION("8250 UART probe driver for SEAD3");
+39
arch/mips/mti-sead3/sead3-reset.c
···000000000000000000000000000000000000000
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/io.h>9+#include <linux/pm.h>10+11+#include <asm/reboot.h>12+#include <asm/mips-boards/generic.h>13+14+static void mips_machine_restart(char *command)15+{16+ unsigned int __iomem *softres_reg =17+ ioremap(SOFTRES_REG, sizeof(unsigned int));18+19+ __raw_writel(GORESET, softres_reg);20+}21+22+static void mips_machine_halt(void)23+{24+ unsigned int __iomem *softres_reg =25+ ioremap(SOFTRES_REG, sizeof(unsigned int));26+27+ __raw_writel(GORESET, softres_reg);28+}29+30+static int __init mips_reboot_setup(void)31+{32+ _machine_restart = mips_machine_restart;33+ _machine_halt = mips_machine_halt;34+ pm_power_off = mips_machine_halt;35+36+ return 0;37+}38+39+arch_initcall(mips_reboot_setup);
+45
arch/mips/mti-sead3/sead3-serial.c
···000000000000000000000000000000000000000000000
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/module.h>9+#include <linux/init.h>10+#include <linux/serial_8250.h>11+12+#define UART(base, int) \13+{ \14+ .mapbase = base, \15+ .irq = int, \16+ .uartclk = 14745600, \17+ .iotype = UPIO_MEM32, \18+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, \19+ .regshift = 2, \20+}21+22+static struct plat_serial8250_port uart8250_data[] = {23+ UART(0x1f000900, MIPS_CPU_IRQ_BASE + 4), /* ttyS0 = USB */24+ UART(0x1f000800, MIPS_CPU_IRQ_BASE + 4), /* ttyS1 = RS232 */25+ { },26+};27+28+static struct platform_device uart8250_device = {29+ .name = "serial8250",30+ .id = PLAT8250_DEV_PLATFORM,31+ .dev = {32+ .platform_data = uart8250_data,33+ },34+};35+36+static int __init uart8250_init(void)37+{38+ return platform_device_register(&uart8250_device);39+}40+41+module_init(uart8250_init);42+43+MODULE_AUTHOR("Chris Dearman <chris@mips.com>");44+MODULE_LICENSE("GPL");45+MODULE_DESCRIPTION("8250 UART probe driver for the SEAD-3 platform");
+20
arch/mips/mti-sead3/sead3-setup.c
···00000000000000000000
···1+/*2+ * This file is subject to the terms and conditions of the GNU General Public3+ * License. See the file "COPYING" in the main directory of this archive4+ * for more details.5+ *6+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.7+ */8+#include <linux/init.h>9+10+int coherentio; /* 0 => no DMA cache coherency (may be set by user) */11+int hw_coherentio; /* 0 => no HW DMA cache coherency (reflects real HW) */12+13+const char *get_system_type(void)14+{15+ return "MIPS SEAD3";16+}17+18+void __init plat_mem_setup(void)19+{20+}