[063ae706] | 1 | /*
|
---|
| 2 | * Copyright (c) 2012 Jan Vesely
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
[4122410] | 29 | /** @addtogroup amdm37x
|
---|
[063ae706] | 30 | * @{
|
---|
| 31 | */
|
---|
| 32 | /** @file
|
---|
| 33 | * @brief USBTLL IO register structure.
|
---|
| 34 | */
|
---|
| 35 | #ifndef AMDM37x_USBTLL_H
|
---|
| 36 | #define AMDM37x_USBTLL_H
|
---|
[7ee7e6a] | 37 |
|
---|
[a5a73c0] | 38 | #include <macros.h>
|
---|
[7ee7e6a] | 39 | #include <ddi.h>
|
---|
[063ae706] | 40 |
|
---|
| 41 | #define AMDM37x_USBTLL_BASE_ADDRESS 0x48062000
|
---|
| 42 | #define AMDM37x_USBTLL_SIZE 4096
|
---|
| 43 |
|
---|
| 44 | typedef struct {
|
---|
| 45 | const ioport32_t revision;
|
---|
[52fc805] | 46 | #define TLL_REVISION_MINOR_MASK 0x0f
|
---|
| 47 | #define TLL_REVISION_MAJOR_MASK 0xf0
|
---|
[063ae706] | 48 |
|
---|
[af60409] | 49 | PADD32(3);
|
---|
[063ae706] | 50 | ioport32_t sysconfig;
|
---|
| 51 | #define TLL_SYSCONFIG_AUTOIDLE_FLAG (1 << 0)
|
---|
| 52 | #define TLL_SYSCONFIG_SOFTRESET_FLAG (1 << 1)
|
---|
| 53 | #define TLL_SYSCONFIG_ENWAKEUP_FLAG (1 << 2)
|
---|
[52fc805] | 54 | #define TLL_SYSCONFIG_SIDLE_MODE_MASK (0x3 << 3)
|
---|
| 55 | #define TLL_SYSCONFIG_SIDLE_MODE_FORCE (0x0 << 3)
|
---|
| 56 | #define TLL_SYSCONFIG_SIDLE_MODE_NO (0x1 << 3)
|
---|
| 57 | #define TLL_SYSCONFIG_SIDLE_MODE_SMART (0x2 << 3)
|
---|
[063ae706] | 58 | #define TLL_SYSCONFIG_CLOCKACTIVITY_FLAG (1 << 8)
|
---|
| 59 |
|
---|
[d27a9c8f] | 60 | const ioport32_t sysstatus;
|
---|
[063ae706] | 61 | #define TLL_SYSSTATUS_RESET_DONE_FLAG (1 << 0)
|
---|
| 62 |
|
---|
| 63 | const ioport32_t irqstatus;
|
---|
| 64 | #define TLL_IRQSTATUS_FCLK_START_FLAG (1 << 0)
|
---|
| 65 | #define TLL_IRQSTATUS_FCLK_END_FLAG (1 << 1)
|
---|
| 66 | #define TLL_IRQSTATUS_ACCESS_ERROR_FLAG (1 << 2)
|
---|
| 67 |
|
---|
| 68 | ioport32_t irqenable;
|
---|
| 69 | #define TLL_IRQSTATUS_FCLK_START_EN_FLAG (1 << 0)
|
---|
| 70 | #define TLL_IRQSTATUS_FCLK_END_EN_FLAG (1 << 1)
|
---|
| 71 | #define TLL_IRQSTATUS_ACCESS_ERROR_EN_FLAG (1 << 2)
|
---|
| 72 |
|
---|
[af60409] | 73 | PADD32(4);
|
---|
[063ae706] | 74 | ioport32_t shared_conf;
|
---|
| 75 | #define TLL_SHARED_CONF_FCLK_IS_ON_FLAG (1 << 0)
|
---|
| 76 | #define TLL_SHARED_CONF_FCLK_REQ_FLAG (1 << 1)
|
---|
[52fc805] | 77 | #define TLL_SHARED_CONF_USB_DIVRATIO_MASK (0x7 << 2)
|
---|
| 78 | #define TLL_SHARED_CONF_USB_DIVRATIO(x) (((x) & 0x7) << 2)
|
---|
[063ae706] | 79 | #define TLL_SHARED_CONF_USB_180D_SDR_EN_FLAG (1 << 5)
|
---|
| 80 | #define TLL_SHARED_CONF_USB_90D_DDR_EN_FLAG (1 << 6)
|
---|
| 81 |
|
---|
[af60409] | 82 | PADD32(3);
|
---|
[063ae706] | 83 | ioport32_t channel_conf[3];
|
---|
| 84 | #define TLL_CHANNEL_CONF_CHANEN_FLAG (1 << 0)
|
---|
[52fc805] | 85 | #define TLL_CHANNEL_CONF_CHANMODE_MASK (0x3 << 1)
|
---|
| 86 | #define TLL_CHANNEL_CONF_CHANMODE_UTMI_ULPI_MODE (0x0 << 1)
|
---|
| 87 | #define TLL_CHANNEL_CONF_CHANMODE_UTMI_SERIAL_MODE (0x1 << 1)
|
---|
| 88 | #define TLL_CHANNEL_CONF_CHANMODE_UTMI_TRANS_MODE (0x2 << 1)
|
---|
| 89 | #define TLL_CHANNEL_CONF_CHANMODE_NO_MODE (0x3 << 1)
|
---|
[063ae706] | 90 | #define TLL_CHANNEL_CONF_UTMIISADEV_FLAG (1 << 3)
|
---|
| 91 | #define TLL_CHANNEL_CONF_TLLATTACH_FLAG (1 << 4)
|
---|
| 92 | #define TLL_CHANNEL_CONF_TLLCONNECT_FLAG (1 << 5)
|
---|
| 93 | #define TLL_CHANNEL_CONF_TLLFULLSPEED_FLAG (1 << 6)
|
---|
| 94 | #define TLL_CHANNEL_CONF_ULPIOUTCLKMODE_FLAG (1 << 7)
|
---|
| 95 | #define TLL_CHANNEL_CONF_ULPIDDRMODE_FLAG (1 << 8)
|
---|
| 96 | #define TLL_CHANNEL_CONF_UTMIAUTOIDLE_FLAG (1 << 9)
|
---|
| 97 | #define TLL_CHANNEL_CONF_ULPIAUTOIDLE_FLAG (1 << 10)
|
---|
| 98 | #define TLL_CHANNEL_CONF_ULPINOBITSTUFF_FLAG (1 << 11)
|
---|
| 99 | #define TLL_CHANNEL_CONF_CHRGVBUS_FLAG (1 << 15)
|
---|
| 100 | #define TLL_CHANNEL_CONF_DRVVBUS_FLAG (1 << 16)
|
---|
| 101 | #define TLL_CHANNEL_CONF_TESTEN_FLAG (1 << 17)
|
---|
| 102 | #define TLL_CHANNEL_CONF_TESTTXEN_FLAG (1 << 18)
|
---|
| 103 | #define TLL_CHANNEL_CONF_TESTTXDAT_FLAG (1 << 19)
|
---|
| 104 | #define TLL_CHANNEL_CONF_TESTTXSE0_FLAG (1 << 20)
|
---|
[52fc805] | 105 | #define TLL_CHANNEL_CONF_FSLSMODE_MASK (0xf << 24)
|
---|
| 106 | #define TLL_CHANNEL_CONF_FSLSMODE_6PIN_UNI_PHY_TX_DATSE0 (0x0 << 24)
|
---|
| 107 | #define TLL_CHANNEL_CONF_FSLSMODE_6PIN_UNI_PHY_TX_DPDM (0x1 << 24)
|
---|
| 108 | #define TLL_CHANNEL_CONF_FSLSMODE_3PIN_BIDI_PHY (0x2 << 24)
|
---|
| 109 | #define TLL_CHANNEL_CONF_FSLSMODE_4PIN_BIDI_PHY (0x3 << 24)
|
---|
| 110 | #define TLL_CHANNEL_CONF_FSLSMODE_6PIN_UNI_TLL_TX_DATSE0 (0x4 << 24)
|
---|
| 111 | #define TLL_CHANNEL_CONF_FSLSMODE_6PIN_UNI_TLL_TX_DPDM (0x5 << 24)
|
---|
| 112 | #define TLL_CHANNEL_CONF_FSLSMODE_3PIN_BIDI_TLL (0x6 << 24)
|
---|
| 113 | #define TLL_CHANNEL_CONF_FSLSMODE_4PIN_BIDI_TLL (0x7 << 24)
|
---|
| 114 | #define TLL_CHANNEL_CONF_FSLSMODE_2PIN_BIDI_TLL_DATSE0 (0xa << 24)
|
---|
| 115 | #define TLL_CHANNEL_CONF_FSLSMODE_2PIN_BIDI_TLL_DPDM (0xb << 24)
|
---|
| 116 |
|
---|
| 117 | #define TLL_CHANNEL_CONF_FSLSLINESTATE_MASK (0x3 << 28)
|
---|
| 118 | #define TLL_CHANNEL_CONF_FSLSLINESTATE_SE0 (0x0 << 28)
|
---|
| 119 | #define TLL_CHANNEL_CONF_FSLSLINESTATE_FS_J (0x1 << 28)
|
---|
| 120 | #define TLL_CHANNEL_CONF_FSLSLINESTATE_FS_K (0x2 << 28)
|
---|
| 121 | #define TLL_CHANNEL_CONF_FSLSLINESTATE_SE1 (0x3 << 28)
|
---|
[063ae706] | 122 |
|
---|
| 123 | /* The rest are 8bit ULPI registers */
|
---|
| 124 | } tll_regs_t;
|
---|
| 125 |
|
---|
| 126 | #endif
|
---|
| 127 | /**
|
---|
| 128 | * @}
|
---|
| 129 | */
|
---|