wdenk | aaf224a | 2004-03-14 15:20:55 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2004, Li-Pro.Net <www.li-pro.net> |
| 3 | * Stephan Linz <linz@li-pro.net> |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | #include <common.h> |
| 25 | #include <nios-io.h> |
| 26 | #include <spi.h> |
| 27 | |
| 28 | #if defined(CONFIG_HW_WATCHDOG) |
| 29 | extern void ssv_wd_pio_init(void); /* comes from ../common/wd_pio.c |
| 30 | included by ./misc.c */ |
| 31 | #endif |
| 32 | |
| 33 | void _default_hdlr (void) |
| 34 | { |
| 35 | printf ("default_hdlr\n"); |
| 36 | } |
| 37 | |
| 38 | int board_early_init_f (void) |
| 39 | { |
| 40 | #if defined(CONFIG_HW_WATCHDOG) |
| 41 | ssv_wd_pio_init(); |
| 42 | #endif |
| 43 | return 0; |
| 44 | } |
| 45 | |
| 46 | int checkboard (void) |
| 47 | { |
| 48 | puts ( "Board: SSV DilNetPC ADNP/ESC1" |
| 49 | #if defined(CONFIG_DNPEVA2) |
| 50 | " on DNP/EVA2" |
| 51 | #endif |
| 52 | "\n"); |
| 53 | #if defined(CONFIG_NIOS_BASE_32) |
| 54 | puts ("Conf.: SSV Base 32 (nios_32)\n"); |
| 55 | #endif |
| 56 | |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | long int initdram (int board_type) |
| 61 | { |
| 62 | return (0); |
| 63 | } |
| 64 | |
| 65 | /* |
| 66 | * The following are used to control the SPI chip selects for the SPI command. |
| 67 | */ |
Jon Loeliger | ab3abcb | 2007-07-09 18:45:16 -0500 | [diff] [blame] | 68 | #if defined(CONFIG_CMD_SPI) && CONFIG_NIOS_SPI |
wdenk | aaf224a | 2004-03-14 15:20:55 +0000 | [diff] [blame] | 69 | |
| 70 | #define SPI_RTC_CS_MASK 0x00000001 |
| 71 | |
Haavard Skinnemoen | d255bb0 | 2008-05-16 11:10:31 +0200 | [diff] [blame^] | 72 | int spi_cs_is_valid(unsigned int bus, unsigned int cs) |
| 73 | { |
| 74 | return bus == 0 && cs == 0; |
| 75 | } |
| 76 | |
| 77 | void spi_cs_activate(struct spi_slave *slave) |
wdenk | aaf224a | 2004-03-14 15:20:55 +0000 | [diff] [blame] | 78 | { |
| 79 | nios_spi_t *spi = (nios_spi_t *)CFG_NIOS_SPIBASE; |
| 80 | |
Haavard Skinnemoen | d255bb0 | 2008-05-16 11:10:31 +0200 | [diff] [blame^] | 81 | spi->slaveselect = SPI_RTC_CS_MASK; /* activate (1) */ |
wdenk | aaf224a | 2004-03-14 15:20:55 +0000 | [diff] [blame] | 82 | } |
| 83 | |
Haavard Skinnemoen | d255bb0 | 2008-05-16 11:10:31 +0200 | [diff] [blame^] | 84 | void spi_cs_deactivate(struct spi_slave *slave) |
| 85 | { |
| 86 | nios_spi_t *spi = (nios_spi_t *)CFG_NIOS_SPIBASE; |
| 87 | |
| 88 | spi->slaveselect = 0; /* deactivate (0) */ |
| 89 | } |
wdenk | aaf224a | 2004-03-14 15:20:55 +0000 | [diff] [blame] | 90 | |
Jon Loeliger | d39b574 | 2007-07-10 10:48:22 -0500 | [diff] [blame] | 91 | #endif |
wdenk | aaf224a | 2004-03-14 15:20:55 +0000 | [diff] [blame] | 92 | |
| 93 | #if defined(CONFIG_POST) |
| 94 | /* |
| 95 | * Returns 1 if keys pressed to start the power-on long-running tests |
| 96 | * Called from board_init_f(). |
| 97 | */ |
| 98 | int post_hotkeys_pressed(void) |
| 99 | { |
| 100 | return 0; /* No hotkeys supported */ |
| 101 | } |
| 102 | #endif /* CONFIG_POST */ |