Gabe Black | 3c7e939 | 2013-05-26 07:15:57 -0700 | [diff] [blame] | 1 | /* |
David Hendricks | 942e69d | 2013-05-27 10:32:57 -0700 | [diff] [blame] | 2 | * Copyright 2013 Google Inc. |
Gabe Black | 3c7e939 | 2013-05-26 07:15:57 -0700 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation; either version 2 of |
| 7 | * the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
Gabe Black | 3c7e939 | 2013-05-26 07:15:57 -0700 | [diff] [blame] | 13 | */ |
| 14 | |
David Hendricks | 942e69d | 2013-05-27 10:32:57 -0700 | [diff] [blame] | 15 | #ifndef AM335X_UART_H |
| 16 | #define AM335X_UART_H |
Gabe Black | 3c7e939 | 2013-05-26 07:15:57 -0700 | [diff] [blame] | 17 | |
| 18 | #define AM335X_UART0_BASE 0x44e09000 |
| 19 | #define AM335X_UART1_BASE 0x48020000 |
| 20 | #define AM335X_UART2_BASE 0x48024000 |
| 21 | #define AM335X_UART3_BASE 0x481A6000 |
| 22 | #define AM335X_UART4_BASE 0x481A8000 |
| 23 | #define AM335X_UART5_BASE 0x481AA000 |
| 24 | |
David Hendricks | 942e69d | 2013-05-27 10:32:57 -0700 | [diff] [blame] | 25 | /* |
| 26 | * The meaning of some AM335x UART register offsets changes depending on read |
| 27 | * or write operation as well as various modes. See section 19.3.7.1.2 for |
| 28 | * register access submode description and 19.5.1 for register descriptions. |
| 29 | */ |
| 30 | struct am335x_uart { |
| 31 | union { |
| 32 | /* operational mode */ |
| 33 | uint16_t rhr; /* receiver holding (read) */ |
| 34 | uint16_t thr; /* transmit holding (write) */ |
| 35 | /* config mode A and B */ |
| 36 | uint16_t dll; /* divisor latches low */ |
| 37 | }; |
| 38 | uint8_t rsvd_0x02[2]; |
| 39 | union { |
| 40 | /* operational mode */ |
| 41 | uint16_t ier; /* interrupt enable */ |
| 42 | /* config mode A and B */ |
| 43 | uint16_t dlh; /* divisor latches high */ |
| 44 | }; |
| 45 | uint8_t rsvd_0x06[2]; |
| 46 | union { |
| 47 | /* operational mode, config mode A */ |
| 48 | uint16_t iir; /* interrupt ID (read) */ |
| 49 | uint16_t fcr; /* FIFO control (write) */ |
| 50 | /* config mode B */ |
| 51 | uint16_t efr; |
| 52 | }; |
| 53 | uint8_t rsvd_0x0a[2]; |
| 54 | uint16_t lcr; /* line control */ |
| 55 | uint8_t rsvd_0x0e[2]; |
| 56 | |
| 57 | /* 0x10 */ |
| 58 | union { |
| 59 | /* operational mode, config mode A */ |
| 60 | uint16_t mcr; /* modem control */ |
| 61 | /* config mode B */ |
| 62 | uint16_t xon1; /* XON1 character (UART mode) */ |
| 63 | uint16_t addr1; /* address 1 (IrDA mode) */ |
| 64 | }; |
| 65 | uint8_t rsvd_0x12[2]; |
| 66 | union { |
| 67 | /* operational mode, config mode A */ |
| 68 | uint16_t lsr; /* line status, read-only */ |
| 69 | /* config mode B */ |
| 70 | uint16_t xon2; /* XON2 character (UART mode) */ |
| 71 | uint16_t addr2; /* IrDA mode (IrDA mode) */ |
| 72 | }; |
| 73 | uint8_t rsvd_0x16[2]; |
| 74 | |
| 75 | /* |
| 76 | * Bytes 0x18 and 0x1c depend on submode TCR_TLR. When EFR[4] = 1 and |
| 77 | * MCR[6] = 1, transmission control register and trigger level register |
| 78 | * will be read/written. If not, the modem status register and the |
| 79 | * scratchpad register will be affected by read/write. |
| 80 | */ |
| 81 | union { |
| 82 | /* operational mode and config mode A */ |
| 83 | uint16_t msr; /* modem status */ |
| 84 | /* config mode B */ |
| 85 | uint16_t xoff1; /* xoff1 character (UART MODE) */ |
| 86 | /* submode TCR_TLR */ |
| 87 | uint16_t tcr; /* transmission control */ |
| 88 | }; |
| 89 | uint8_t rsvd_0x1a[2]; |
| 90 | union { |
| 91 | uint16_t spr; /* scratchpad */ |
| 92 | /* config mode B */ |
| 93 | uint16_t xoff2; /* xoff2 character (UART mode) */ |
| 94 | /* submode TCR_TLR */ |
| 95 | uint16_t tlr; /* trigger level */ |
| 96 | }; |
| 97 | uint8_t rsvd_0x1e[2]; |
| 98 | |
| 99 | /* 0x20 */ |
| 100 | uint16_t mdr1; /* mode definition 1 */ |
| 101 | uint8_t rsvd_0x22[2]; |
| 102 | uint16_t mdr2; /* mode definition 2 */ |
| 103 | uint8_t rsvd_0x26[2]; |
| 104 | union { |
| 105 | uint16_t sflsr; /* status FIFO line status reg (read) */ |
| 106 | uint16_t txfll; /* transmit frame length low (write) */ |
| 107 | }; |
| 108 | uint8_t rsvd_0x2a[2]; |
| 109 | union { |
| 110 | uint16_t resume; /* resume halted operation (read) */ |
| 111 | uint16_t txflh; /* transmit frame length high (write) */ |
| 112 | }; |
| 113 | uint8_t rsvd_0x2e[2]; |
| 114 | |
| 115 | /* 0x30 */ |
| 116 | union { |
| 117 | uint16_t sfregl; /* status FIFO low (read) */ |
| 118 | uint16_t rxfll; /* received frame length low (write) */ |
| 119 | }; |
| 120 | uint8_t rsvd_0x32[2]; |
| 121 | union { |
| 122 | uint16_t sfregh; /* status FIFO high (read) */ |
| 123 | uint16_t rxflh; /* received frame length high (write) */ |
| 124 | }; |
| 125 | uint8_t rsvd_0x36[2]; |
| 126 | uint16_t blr; /* BOF control */ |
| 127 | uint8_t rsvd_0x3a[2]; |
Martin Roth | 4c3ab73 | 2013-07-08 16:23:54 -0600 | [diff] [blame] | 128 | uint16_t acreg; /* auxiliary control */ |
David Hendricks | 942e69d | 2013-05-27 10:32:57 -0700 | [diff] [blame] | 129 | uint8_t rsvd_0x3e[2]; |
| 130 | |
| 131 | /* 0x40 */ |
| 132 | uint16_t scr; /* supplementary control */ |
| 133 | uint8_t rsvd_0x42[2]; |
| 134 | uint16_t ssr; /* supplementary status */ |
| 135 | uint8_t rsvd_0x46[2]; |
| 136 | |
Martin Roth | 4c3ab73 | 2013-07-08 16:23:54 -0600 | [diff] [blame] | 137 | uint16_t eblr; /* BOF length (operational mode only) */ |
David Hendricks | 942e69d | 2013-05-27 10:32:57 -0700 | [diff] [blame] | 138 | uint8_t rsvd_0x4a[6]; |
| 139 | |
| 140 | /* 0x50 */ |
| 141 | uint16_t mvr; /* module version (read-only) */ |
| 142 | uint8_t rsvd_0x52[2]; |
| 143 | uint16_t sysc; /* system config */ |
| 144 | uint8_t rsvd_0x56[2]; |
| 145 | uint16_t syss; /* system status (read-only) */ |
| 146 | uint8_t rsvd_0x5a[2]; |
| 147 | uint16_t wer; /* wake-up enable */ |
| 148 | uint8_t rsvd_0x5e[2]; |
| 149 | |
| 150 | /* 0x60 */ |
| 151 | uint16_t cfps; /* carrier prescale frequency */ |
| 152 | uint8_t rsvd_0x62[2]; |
| 153 | uint16_t rxfifo_lvl; /* received FIFO level */ |
| 154 | uint8_t rsvd_0x66[2]; |
| 155 | uint16_t txfifo_lvl; /* transmit FIFO level */ |
| 156 | uint8_t rsvd_0x6a[2]; |
| 157 | uint16_t ier2; /* RX/TX FIFO empty interrupt enable */ |
| 158 | uint8_t rsvd_0x6e[2]; |
| 159 | |
| 160 | /* 0x70 */ |
| 161 | uint16_t isr2; /* RX/TX FIFO empty interrupt status */ |
| 162 | uint8_t rsvd_0x72[2]; |
| 163 | uint16_t freq_sel; /* frequency select */ |
| 164 | uint8_t rsvd_0x76[10]; |
| 165 | |
| 166 | /* 0x80 */ |
| 167 | uint16_t mdr3; /* mode definition register 3 */ |
| 168 | uint8_t rsvd_0x82[2]; |
| 169 | uint16_t txdma; /* TX DMA threshold */ |
| 170 | |
| 171 | } __attribute__((packed)); |
| 172 | |
| 173 | #endif /* AM335X_UART_H */ |