Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * BRIEF MODULE DESCRIPTION |
| 4 | * 4G Systems MTX-1 board setup. |
| 5 | * |
| 6 | * Copyright 2003 MontaVista Software Inc. |
| 7 | * Author: MontaVista Software, Inc. |
| 8 | * ppopov@mvista.com or source@mvista.com |
| 9 | * Bruno Randolf <bruno.randolf@4g-systems.biz> |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify it |
| 12 | * under the terms of the GNU General Public License as published by the |
| 13 | * Free Software Foundation; either version 2 of the License, or (at your |
| 14 | * option) any later version. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN |
| 19 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
| 22 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 23 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | * |
| 27 | * You should have received a copy of the GNU General Public License along |
| 28 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 29 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
| 30 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
Sergei Shtylyov | ce28f94 | 2008-04-23 22:43:55 +0400 | [diff] [blame^] | 32 | #include <linux/init.h> |
| 33 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | #include <asm/mach-au1x00/au1000.h> |
| 35 | |
Florian Fainelli | baa545f | 2007-03-02 22:07:48 +0100 | [diff] [blame] | 36 | extern int (*board_pci_idsel)(unsigned int devsel, int assert); |
| 37 | int mtx1_pci_idsel(unsigned int devsel, int assert); |
| 38 | |
Ralf Baechle | 49a89ef | 2007-10-11 23:46:15 +0100 | [diff] [blame] | 39 | void board_reset(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | { |
| 41 | /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ |
| 42 | au_writel(0x00000000, 0xAE00001C); |
| 43 | } |
| 44 | |
| 45 | void __init board_setup(void) |
| 46 | { |
Florian Fainelli | f708631 | 2007-09-25 17:07:24 +0200 | [diff] [blame] | 47 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | // enable USB power switch |
| 49 | au_writel( au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR ); |
| 50 | au_writel( 0x100000, GPIO2_OUTPUT ); |
Florian Fainelli | f708631 | 2007-09-25 17:07:24 +0200 | [diff] [blame] | 51 | #endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
| 53 | #ifdef CONFIG_PCI |
| 54 | #if defined(__MIPSEB__) |
| 55 | au_writel(0xf | (2<<6) | (1<<4), Au1500_PCI_CFG); |
| 56 | #else |
| 57 | au_writel(0xf, Au1500_PCI_CFG); |
| 58 | #endif |
| 59 | #endif |
| 60 | |
| 61 | // initialize sys_pinfunc: |
Florian Fainelli | 6fff989 | 2007-03-02 22:07:41 +0100 | [diff] [blame] | 62 | au_writel( SYS_PF_NI2, SYS_PINFUNC ); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | |
| 64 | // initialize GPIO |
| 65 | au_writel( 0xFFFFFFFF, SYS_TRIOUTCLR ); |
| 66 | au_writel( 0x00000001, SYS_OUTPUTCLR ); // set M66EN (PCI 66MHz) to OFF |
| 67 | au_writel( 0x00000008, SYS_OUTPUTSET ); // set PCI CLKRUN# to OFF |
Florian Fainelli | baa545f | 2007-03-02 22:07:48 +0100 | [diff] [blame] | 68 | au_writel( 0x00000002, SYS_OUTPUTSET ); // set EXT_IO3 ON |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | au_writel( 0x00000020, SYS_OUTPUTCLR ); // set eth PHY TX_ER to OFF |
| 70 | |
| 71 | // enable LED and set it to green |
| 72 | au_writel( au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR ); |
| 73 | au_writel( 0x18000800, GPIO2_OUTPUT ); |
| 74 | |
Florian Fainelli | baa545f | 2007-03-02 22:07:48 +0100 | [diff] [blame] | 75 | board_pci_idsel = mtx1_pci_idsel; |
| 76 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | printk("4G Systems MTX-1 Board\n"); |
| 78 | } |
Florian Fainelli | baa545f | 2007-03-02 22:07:48 +0100 | [diff] [blame] | 79 | |
| 80 | int |
| 81 | mtx1_pci_idsel(unsigned int devsel, int assert) |
| 82 | { |
| 83 | #define MTX_IDSEL_ONLY_0_AND_3 0 |
| 84 | #if MTX_IDSEL_ONLY_0_AND_3 |
| 85 | if (devsel != 0 && devsel != 3) { |
| 86 | printk("*** not 0 or 3\n"); |
| 87 | return 0; |
| 88 | } |
| 89 | #endif |
| 90 | |
| 91 | if (assert && devsel != 0) { |
Joe Perches | 603e82e | 2008-02-03 16:54:53 +0200 | [diff] [blame] | 92 | // suppress signal to cardbus |
Florian Fainelli | baa545f | 2007-03-02 22:07:48 +0100 | [diff] [blame] | 93 | au_writel( 0x00000002, SYS_OUTPUTCLR ); // set EXT_IO3 OFF |
| 94 | } |
| 95 | else { |
| 96 | au_writel( 0x00000002, SYS_OUTPUTSET ); // set EXT_IO3 ON |
| 97 | } |
| 98 | au_sync_udelay(1); |
| 99 | return 1; |
| 100 | } |
| 101 | |