Home | History | Annotate | Line # | Download | only in alchemy
      1  1.12    kamil /* $NetBSD: au1000.c,v 1.12 2019/04/11 14:38:06 kamil Exp $ */
      2   1.1  gdamore 
      3   1.1  gdamore /*-
      4   1.1  gdamore  * Copyright (c) 2006 Itronix Inc.
      5   1.1  gdamore  * All rights reserved.
      6   1.1  gdamore  *
      7   1.1  gdamore  * Written by Garrett D'Amore for Itronix Inc.
      8   1.1  gdamore  *
      9   1.1  gdamore  * Redistribution and use in source and binary forms, with or without
     10   1.1  gdamore  * modification, are permitted provided that the following conditions
     11   1.1  gdamore  * are met:
     12   1.1  gdamore  * 1. Redistributions of source code must retain the above copyright
     13   1.1  gdamore  *    notice, this list of conditions and the following disclaimer.
     14   1.1  gdamore  * 2. Redistributions in binary form must reproduce the above copyright
     15   1.1  gdamore  *    notice, this list of conditions and the following disclaimer in the
     16   1.1  gdamore  *    documentation and/or other materials provided with the distribution.
     17   1.1  gdamore  * 3. The name of Itronix Inc. may not be used to endorse
     18   1.1  gdamore  *    or promote products derived from this software without specific
     19   1.1  gdamore  *    prior written permission.
     20   1.1  gdamore  *
     21   1.1  gdamore  * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND
     22   1.1  gdamore  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     23   1.1  gdamore  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     24   1.1  gdamore  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
     25   1.1  gdamore  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     26   1.1  gdamore  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     27   1.1  gdamore  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     28   1.1  gdamore  * ON ANY THEORY OF LIABILITY, WHETHER IN
     29   1.1  gdamore  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     30   1.1  gdamore  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     31   1.1  gdamore  * POSSIBILITY OF SUCH DAMAGE.
     32   1.1  gdamore  */
     33   1.1  gdamore 
     34   1.1  gdamore /*
     35   1.1  gdamore  * Copyright 2001 Wasabi Systems, Inc.
     36   1.1  gdamore  * All rights reserved.
     37   1.1  gdamore  *
     38   1.1  gdamore  * Written by Simon Burge for Wasabi Systems, Inc.
     39   1.1  gdamore  *
     40   1.1  gdamore  * Redistribution and use in source and binary forms, with or without
     41   1.1  gdamore  * modification, are permitted provided that the following conditions
     42   1.1  gdamore  * are met:
     43   1.1  gdamore  * 1. Redistributions of source code must retain the above copyright
     44   1.1  gdamore  *    notice, this list of conditions and the following disclaimer.
     45   1.1  gdamore  * 2. Redistributions in binary form must reproduce the above copyright
     46   1.1  gdamore  *    notice, this list of conditions and the following disclaimer in the
     47   1.1  gdamore  *    documentation and/or other materials provided with the distribution.
     48   1.1  gdamore  * 3. All advertising materials mentioning features or use of this software
     49   1.1  gdamore  *    must display the following acknowledgement:
     50   1.1  gdamore  *      This product includes software developed for the NetBSD Project by
     51   1.1  gdamore  *      Wasabi Systems, Inc.
     52   1.1  gdamore  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
     53   1.1  gdamore  *    or promote products derived from this software without specific prior
     54   1.1  gdamore  *    written permission.
     55   1.1  gdamore  *
     56   1.1  gdamore  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
     57   1.1  gdamore  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     58   1.1  gdamore  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     59   1.1  gdamore  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
     60   1.1  gdamore  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     61   1.1  gdamore  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     62   1.1  gdamore  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     63   1.1  gdamore  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     64   1.1  gdamore  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     65   1.1  gdamore  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     66   1.1  gdamore  * POSSIBILITY OF SUCH DAMAGE.
     67   1.1  gdamore  */
     68   1.1  gdamore 
     69   1.1  gdamore /*
     70   1.1  gdamore  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
     71   1.1  gdamore  *
     72   1.1  gdamore  * Redistribution and use in source and binary forms, with or without
     73   1.1  gdamore  * modification, are permitted provided that the following conditions
     74   1.1  gdamore  * are met:
     75   1.1  gdamore  * 1. Redistributions of source code must retain the above copyright
     76   1.1  gdamore  *    notice, this list of conditions and the following disclaimer.
     77   1.1  gdamore  * 2. Redistributions in binary form must reproduce the above copyright
     78   1.1  gdamore  *    notice, this list of conditions and the following disclaimer in the
     79   1.1  gdamore  *    documentation and/or other materials provided with the distribution.
     80   1.1  gdamore  * 3. All advertising materials mentioning features or use of this software
     81   1.1  gdamore  *    must display the following acknowledgement:
     82   1.1  gdamore  *      This product includes software developed by Christopher G. Demetriou
     83   1.1  gdamore  *	for the NetBSD Project.
     84   1.1  gdamore  * 4. The name of the author may not be used to endorse or promote products
     85   1.1  gdamore  *    derived from this software without specific prior written permission
     86   1.1  gdamore  *
     87   1.1  gdamore  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     88   1.1  gdamore  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     89   1.1  gdamore  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     90   1.1  gdamore  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     91   1.1  gdamore  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     92   1.1  gdamore  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     93   1.1  gdamore  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     94   1.1  gdamore  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     95   1.1  gdamore  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     96   1.1  gdamore  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     97   1.1  gdamore  */
     98   1.1  gdamore 
     99   1.1  gdamore #include <sys/cdefs.h>
    100  1.12    kamil __KERNEL_RCSID(0, "$NetBSD: au1000.c,v 1.12 2019/04/11 14:38:06 kamil Exp $");
    101   1.1  gdamore 
    102   1.1  gdamore #include <sys/param.h>
    103   1.9   dyoung #include <sys/bus.h>
    104  1.11     matt #include <sys/cpu.h>
    105  1.11     matt 
    106  1.10     matt #include <mips/locore.h>
    107   1.1  gdamore #include <mips/alchemy/include/aureg.h>
    108   1.1  gdamore #include <mips/alchemy/include/auvar.h>
    109   1.1  gdamore 
    110  1.10     matt static const char * const au1000_irqnames[] = {
    111   1.1  gdamore 	"uart0",
    112   1.1  gdamore 	"uart1",
    113   1.1  gdamore 	"uart2",
    114   1.1  gdamore 	"uart3",
    115   1.1  gdamore 	"ssi0",
    116   1.1  gdamore 	"ssi1",
    117   1.1  gdamore 	"dma0",
    118   1.1  gdamore 	"dma1",
    119   1.1  gdamore 	"dma2",
    120   1.1  gdamore 	"dma3",
    121   1.1  gdamore 	"dma4",
    122   1.1  gdamore 	"dma5",
    123   1.1  gdamore 	"dma6",
    124   1.1  gdamore 	"dma7",
    125   1.1  gdamore 	"toy tick",
    126   1.1  gdamore 	"toy match0",
    127   1.1  gdamore 	"toy match1",
    128   1.1  gdamore 	"toy match2",
    129   1.1  gdamore 	"rtc tick",
    130   1.1  gdamore 	"rtc match0",
    131   1.1  gdamore 	"rtc match1",
    132   1.1  gdamore 	"rtc match2",
    133   1.1  gdamore 	"irda tx",
    134   1.1  gdamore 	"irda rx",
    135   1.1  gdamore 	"usb intr",
    136   1.1  gdamore 	"usb suspend",
    137   1.1  gdamore 	"usb host",
    138   1.1  gdamore 	"ac97",
    139   1.1  gdamore 	"mac0",
    140   1.1  gdamore 	"mac1",
    141   1.1  gdamore 	"i2s",
    142   1.1  gdamore 	"ac97 cmd",
    143   1.1  gdamore 	"gpio 0",
    144   1.1  gdamore 	"gpio 1",
    145   1.1  gdamore 	"gpio 2",
    146   1.1  gdamore 	"gpio 3",
    147   1.1  gdamore 	"gpio 4",
    148   1.1  gdamore 	"gpio 5",
    149   1.1  gdamore 	"gpio 6",
    150   1.1  gdamore 	"gpio 7",
    151   1.1  gdamore 	"gpio 8",
    152   1.1  gdamore 	"gpio 9",
    153   1.1  gdamore 	"gpio 10",
    154   1.1  gdamore 	"gpio 11",
    155   1.1  gdamore 	"gpio 12",
    156   1.1  gdamore 	"gpio 13",
    157   1.1  gdamore 	"gpio 14",
    158   1.1  gdamore 	"gpio 15",
    159   1.1  gdamore 	"gpio 16",
    160   1.1  gdamore 	"gpio 17",
    161   1.1  gdamore 	"gpio 18",
    162   1.1  gdamore 	"gpio 19",
    163   1.1  gdamore 	"gpio 20",
    164   1.1  gdamore 	"gpio 21",
    165   1.1  gdamore 	"gpio 22",
    166   1.1  gdamore 	"gpio 23",
    167   1.1  gdamore 	"gpio 24",
    168   1.1  gdamore 	"gpio 25",
    169   1.1  gdamore 	"gpio 26",
    170   1.1  gdamore 	"gpio 27",
    171   1.1  gdamore 	"gpio 28",
    172   1.1  gdamore 	"gpio 29",
    173   1.1  gdamore 	"gpio 30",
    174   1.1  gdamore 	"gpio 31"
    175   1.1  gdamore };
    176   1.1  gdamore 
    177   1.1  gdamore static struct au_dev au1000_devices[] = {
    178   1.5  gdamore 	{ "com",	{ UART0_BASE },				   {  0, -1 }},
    179   1.5  gdamore 	{ "com",	{ UART1_BASE },				   {  1, -1 }},
    180   1.5  gdamore 	{ "com",	{ UART2_BASE },				   {  2, -1 }},
    181   1.5  gdamore 	{ "com",	{ UART3_BASE },				   {  3, -1 }},
    182   1.4   simonb 	{ "aurtc",	{ -1 },					   { -1, -1 }},
    183   1.1  gdamore 	{ "aumac",	{ MAC0_BASE, MAC0_ENABLE, MAC0_DMA_BASE }, { 28, -1 }},
    184   1.1  gdamore 	{ "aumac",	{ MAC1_BASE, MAC1_ENABLE, MAC1_DMA_BASE }, { 29, -1 }},
    185   1.1  gdamore 	{ "ohci",	{ USBH_BASE, USBH_ENABLE, USBH_SIZE },	   { 26, -1 }},
    186   1.3  gdamore 	{ "augpio",	{ GPIO_BASE, 32 },			   { -1, -1 }},
    187   1.1  gdamore #if 0
    188   1.1  gdamore 	{ "auaudio",	{ AC97_BASE },				   { 27, 31 }},
    189   1.1  gdamore 	{ "i2s",	{ I2S_BASE },				   { 30, -1 }},
    190   1.1  gdamore 	{ "ssi",	{ SSI0_BASE },				   {  4, -1 }},
    191   1.1  gdamore 	{ "ssi",	{ SSI1_BASE },				   {  5, -1 }},
    192   1.1  gdamore 	{ "usbd",	{ USBD_BASE },				   { 24, 25 }},
    193   1.1  gdamore 	{ "irda",	{ IRDA_BASE },				   { 22, 23 }},
    194   1.1  gdamore 	/* XXX: lcd? */
    195   1.1  gdamore #endif
    196   1.1  gdamore 	{ NULL }
    197   1.1  gdamore };
    198   1.1  gdamore 
    199   1.1  gdamore static struct au_chipdep au1000_chipdep = {
    200   1.1  gdamore 	"au1000",
    201   1.1  gdamore 	{ IC0_BASE, IC1_BASE },		/* ICUs */
    202   1.1  gdamore 	au1000_devices,
    203   1.1  gdamore 	au1000_irqnames,
    204   1.1  gdamore };
    205   1.1  gdamore 
    206   1.6  thorpej bool
    207   1.1  gdamore au1000_match(struct au_chipdep **cpp)
    208   1.1  gdamore {
    209   1.1  gdamore 
    210   1.8     matt 	if (MIPS_PRID_COPTS(mips_options.mips_cpu_id) == MIPS_AU1000) {
    211   1.1  gdamore 		*cpp = &au1000_chipdep;
    212   1.7  thorpej 		return true;
    213   1.1  gdamore 	}
    214   1.7  thorpej 	return false;
    215   1.1  gdamore }
    216