Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Vladimir Zapolskiy | 6b20ef8 | 2012-04-19 04:33:08 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2011 by Vladimir Zapolskiy <vz@mleia.com> |
Vladimir Zapolskiy | 6b20ef8 | 2012-04-19 04:33:08 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef _LPC32XX_EMC_H |
| 7 | #define _LPC32XX_EMC_H |
| 8 | |
| 9 | #include <asm/types.h> |
| 10 | |
| 11 | /* EMC Registers */ |
| 12 | struct emc_regs { |
| 13 | u32 ctrl; /* Controls operation of the EMC */ |
| 14 | u32 status; /* Provides EMC status information */ |
| 15 | u32 config; /* Configures operation of the EMC */ |
| 16 | u32 reserved0[5]; |
| 17 | u32 control; /* Controls dyn memory operation */ |
| 18 | u32 refresh; /* Configures dyn memory refresh operation */ |
| 19 | u32 read_config; /* Configures the dyn memory read strategy */ |
| 20 | u32 reserved1; |
| 21 | u32 t_rp; /* Precharge command period */ |
| 22 | u32 t_ras; /* Active to precharge command period */ |
| 23 | u32 t_srex; /* Self-refresh exit time */ |
| 24 | u32 reserved2[2]; |
| 25 | u32 t_wr; /* Write recovery time */ |
| 26 | u32 t_rc; /* Active to active command period */ |
| 27 | u32 t_rfc; /* Auto-refresh period */ |
| 28 | u32 t_xsr; /* Exit self-refresh to active command time */ |
| 29 | u32 t_rrd; /* Active bank A to active bank B latency */ |
| 30 | u32 t_mrd; /* Load mode register to active command time */ |
| 31 | u32 t_cdlr; /* Last data in to read command time */ |
| 32 | u32 reserved3[8]; |
| 33 | u32 extended_wait; /* time for static memory rd/wr transfers */ |
| 34 | u32 reserved4[31]; |
| 35 | u32 config0; /* Configuration information for the SDRAM */ |
| 36 | u32 rascas0; /* RAS and CAS latencies for the SDRAM */ |
| 37 | u32 reserved5[6]; |
| 38 | u32 config1; /* Configuration information for the SDRAM */ |
| 39 | u32 rascas1; /* RAS and CAS latencies for the SDRAM */ |
| 40 | u32 reserved6[54]; |
| 41 | struct emc_stat_t { |
| 42 | u32 config; /* Static memory configuration */ |
| 43 | u32 waitwen; /* Delay from chip select to write enable */ |
| 44 | u32 waitoen; /* Delay to output enable */ |
| 45 | u32 waitrd; /* Delay to a read access */ |
| 46 | u32 waitpage; /* Delay for async page mode read */ |
| 47 | u32 waitwr; /* Delay to a write access */ |
| 48 | u32 waitturn; /* Number of bus turnaround cycles */ |
| 49 | u32 reserved; |
| 50 | } stat[4]; |
| 51 | u32 reserved7[96]; |
| 52 | struct emc_ahb_t { |
| 53 | u32 control; /* Control register for AHB */ |
| 54 | u32 status; /* Status register for AHB */ |
| 55 | u32 timeout; /* Timeout register for AHB */ |
| 56 | u32 reserved[5]; |
| 57 | } ahb[5]; |
| 58 | }; |
| 59 | |
| 60 | /* Static Memory Configuration Register bits */ |
| 61 | #define EMC_STAT_CONFIG_WP (1 << 20) |
| 62 | #define EMC_STAT_CONFIG_EW (1 << 8) |
| 63 | #define EMC_STAT_CONFIG_PB (1 << 7) |
| 64 | #define EMC_STAT_CONFIG_PC (1 << 6) |
| 65 | #define EMC_STAT_CONFIG_PM (1 << 3) |
| 66 | #define EMC_STAT_CONFIG_32BIT (2 << 0) |
| 67 | #define EMC_STAT_CONFIG_16BIT (1 << 0) |
| 68 | #define EMC_STAT_CONFIG_8BIT (0 << 0) |
| 69 | |
| 70 | /* Static Memory Delay Registers */ |
| 71 | #define EMC_STAT_WAITWEN(n) (((n) - 1) & 0x0F) |
Vladimir Zapolskiy | 902d796 | 2015-10-04 23:18:24 +0100 | [diff] [blame] | 72 | #define EMC_STAT_WAITOEN(n) ((n) & 0x0F) |
Vladimir Zapolskiy | 6b20ef8 | 2012-04-19 04:33:08 +0000 | [diff] [blame] | 73 | #define EMC_STAT_WAITRD(n) (((n) - 1) & 0x1F) |
| 74 | #define EMC_STAT_WAITPAGE(n) (((n) - 1) & 0x1F) |
| 75 | #define EMC_STAT_WAITWR(n) (((n) - 2) & 0x1F) |
| 76 | #define EMC_STAT_WAITTURN(n) (((n) - 1) & 0x0F) |
| 77 | |
Albert ARIBAUD \(3ADEV\) | ee69a39 | 2015-03-31 11:40:51 +0200 | [diff] [blame] | 78 | /* EMC settings for DRAM */ |
| 79 | struct emc_dram_settings { |
| 80 | u32 cmddelay; |
| 81 | u32 config0; |
| 82 | u32 rascas0; |
| 83 | u32 rdconfig; |
| 84 | u32 trp; |
| 85 | u32 tras; |
| 86 | u32 tsrex; |
| 87 | u32 twr; |
| 88 | u32 trc; |
| 89 | u32 trfc; |
| 90 | u32 txsr; |
| 91 | u32 trrd; |
| 92 | u32 tmrd; |
| 93 | u32 tcdlr; |
| 94 | u32 refresh; |
| 95 | u32 mode; |
| 96 | u32 emode; |
| 97 | }; |
| 98 | |
Vladimir Zapolskiy | 6b20ef8 | 2012-04-19 04:33:08 +0000 | [diff] [blame] | 99 | #endif /* _LPC32XX_EMC_H */ |