Wolfgang Denk | 83c1585 | 2006-10-24 14:21:16 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 Atmel Corporation |
| 3 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
Wolfgang Denk | 83c1585 | 2006-10-24 14:21:16 +0200 | [diff] [blame] | 5 | */ |
| 6 | #ifndef __ASM_AVR32_SDRAM_H |
| 7 | #define __ASM_AVR32_SDRAM_H |
| 8 | |
Haavard Skinnemoen | 23f62f1 | 2008-05-19 11:36:28 +0200 | [diff] [blame] | 9 | struct sdram_config { |
| 10 | /* Number of data bits. */ |
| 11 | enum { |
Haavard Skinnemoen | baa593c | 2008-08-30 17:28:36 +0200 | [diff] [blame] | 12 | SDRAM_DATA_16BIT = 16, |
| 13 | SDRAM_DATA_32BIT = 32, |
Haavard Skinnemoen | 23f62f1 | 2008-05-19 11:36:28 +0200 | [diff] [blame] | 14 | } data_bits; |
| 15 | |
| 16 | /* Number of address bits */ |
| 17 | uint8_t row_bits, col_bits, bank_bits; |
| 18 | |
| 19 | /* SDRAM timings in cycles */ |
| 20 | uint8_t cas, twr, trc, trp, trcd, tras, txsr; |
Haavard Skinnemoen | d5d6ca6 | 2008-01-23 17:20:14 +0100 | [diff] [blame] | 21 | |
| 22 | /* SDRAM refresh period in cycles */ |
| 23 | unsigned long refresh_period; |
Wolfgang Denk | 83c1585 | 2006-10-24 14:21:16 +0200 | [diff] [blame] | 24 | }; |
| 25 | |
Haavard Skinnemoen | 23f62f1 | 2008-05-19 11:36:28 +0200 | [diff] [blame] | 26 | /* |
| 27 | * Attempt to initialize the SDRAM controller using the specified |
| 28 | * parameters. Return the expected size of the memory area based on |
| 29 | * the number of address and data bits. |
| 30 | * |
| 31 | * The caller should verify that the configuration is correct by |
| 32 | * running a memory test, e.g. get_ram_size(). |
| 33 | */ |
| 34 | extern unsigned long sdram_init(void *sdram_base, |
| 35 | const struct sdram_config *config); |
Wolfgang Denk | 83c1585 | 2006-10-24 14:21:16 +0200 | [diff] [blame] | 36 | |
| 37 | #endif /* __ASM_AVR32_SDRAM_H */ |