| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2012-2011, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: chip.s $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/2 $ |
|---|
| 12 | * $brcm_Date: 12/19/11 5:27p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /rockford/bsp/bcm97358/no-os/src/sde/chip.s $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/2 12/19/11 5:27p jkim |
|---|
| 21 | * SWCFE-690: Add support for 7552B0 |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/1 4/28/11 1:39p jkim |
|---|
| 24 | * SWCFE-507: Initial file |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/2 11/12/10 4:26p jkim |
|---|
| 27 | * SWCFE-399: bring all blocks ot of reset |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/1 11/9/10 4:53p jkim |
|---|
| 30 | * SWCFE-399: initial files |
|---|
| 31 | * |
|---|
| 32 | * |
|---|
| 33 | ***************************************************************************/ |
|---|
| 34 | #ifndef __ASSEMBLER__ |
|---|
| 35 | #define __ASSEMBLER__ |
|---|
| 36 | #endif |
|---|
| 37 | #include "bmips.h" |
|---|
| 38 | #include "chipcfg.h" |
|---|
| 39 | #include "bchp_common.h" |
|---|
| 40 | #include "bchp_sun_top_ctrl.h" |
|---|
| 41 | #include "bchp_sun_gisb_arb.h" |
|---|
| 42 | |
|---|
| 43 | .text |
|---|
| 44 | /****************************************************************************** |
|---|
| 45 | * Function: do_chip_init |
|---|
| 46 | * Arguments: None |
|---|
| 47 | * Returns: v0 |
|---|
| 48 | * Description: |
|---|
| 49 | * Trashes: |
|---|
| 50 | * |
|---|
| 51 | * pseudo code: |
|---|
| 52 | * |
|---|
| 53 | ******************************************************************************/ |
|---|
| 54 | LEAF(do_chip_init) |
|---|
| 55 | |
|---|
| 56 | move s0, ra |
|---|
| 57 | |
|---|
| 58 | /* Clear SW init signal to various blocks */ |
|---|
| 59 | li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_SUN_TOP_CTRL_SW_INIT_0_CLEAR) |
|---|
| 60 | li t1, 0xffffffff |
|---|
| 61 | sw t1, 0(t0) |
|---|
| 62 | |
|---|
| 63 | /* Clear SW init signal to various blocks */ |
|---|
| 64 | li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_SUN_TOP_CTRL_SW_INIT_1_CLEAR) |
|---|
| 65 | li t1, 0xffffffff |
|---|
| 66 | sw t1, 0(t0) |
|---|
| 67 | |
|---|
| 68 | /* masking gisb timer */ |
|---|
| 69 | li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_SUN_GISB_ARB_TIMER) |
|---|
| 70 | li t1, 0x0000ffff |
|---|
| 71 | sw t1, 0(t0) |
|---|
| 72 | |
|---|
| 73 | /* masking gisb req */ |
|---|
| 74 | li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_SUN_GISB_ARB_REQ_MASK) |
|---|
| 75 | li t1,0x00000000 |
|---|
| 76 | sw t1,0(t0) |
|---|
| 77 | |
|---|
| 78 | #if 0 |
|---|
| 79 | /* init the EBI/PCI bus parking */ |
|---|
| 80 | li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_PCI_GEN_PCI_CTRL) |
|---|
| 81 | lw t1,0(t0) |
|---|
| 82 | or t1, t1, BCHP_PCI_GEN_PCI_CTRL_ARB_PARK_ID_MASK |
|---|
| 83 | sw t1,0(t0) |
|---|
| 84 | #endif |
|---|
| 85 | |
|---|
| 86 | li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_SUN_TOP_CTRL_PIN_MUX_CTRL_13) |
|---|
| 87 | /* Set ephy_link and activity led*/ |
|---|
| 88 | lw t1, 0(t0) |
|---|
| 89 | li v0, ~BCHP_SUN_TOP_CTRL_PIN_MUX_CTRL_13_gpio_102_MASK |
|---|
| 90 | and t1, t1, v0 |
|---|
| 91 | li v0, (0x00000006<<BCHP_SUN_TOP_CTRL_PIN_MUX_CTRL_13_gpio_102_SHIFT) |
|---|
| 92 | or t1, t1, v0 |
|---|
| 93 | sw t1, 0(t0) |
|---|
| 94 | |
|---|
| 95 | lw t1, 0(t0) |
|---|
| 96 | li v0, ~BCHP_SUN_TOP_CTRL_PIN_MUX_CTRL_13_gpio_105_MASK |
|---|
| 97 | and t1, t1, v0 |
|---|
| 98 | li v0, (0x00000001<<BCHP_SUN_TOP_CTRL_PIN_MUX_CTRL_13_gpio_105_SHIFT) |
|---|
| 99 | or t1, t1, v0 |
|---|
| 100 | sw t1, 0(t0) |
|---|
| 101 | |
|---|
| 102 | jr s0 |
|---|
| 103 | nop |
|---|
| 104 | |
|---|
| 105 | END(do_chip_init) |
|---|
| 106 | |
|---|
| 107 | /****************************************************************************** |
|---|
| 108 | * Function: print_chip_details |
|---|
| 109 | * Arguments: None |
|---|
| 110 | * Returns: v0 |
|---|
| 111 | * Description: |
|---|
| 112 | * Trashes: |
|---|
| 113 | * |
|---|
| 114 | * pseudo code: |
|---|
| 115 | * |
|---|
| 116 | ******************************************************************************/ |
|---|
| 117 | LEAF(print_chip_details) |
|---|
| 118 | |
|---|
| 119 | move s0, ra |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | li a0, '\r' |
|---|
| 123 | bal _writeasm |
|---|
| 124 | nop |
|---|
| 125 | |
|---|
| 126 | li a0, '\n' |
|---|
| 127 | bal _writeasm |
|---|
| 128 | nop |
|---|
| 129 | |
|---|
| 130 | li a0, 'B' |
|---|
| 131 | bal _writeasm |
|---|
| 132 | nop |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | li a0, 'C' |
|---|
| 136 | bal _writeasm |
|---|
| 137 | nop |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | li a0, 'M' |
|---|
| 141 | bal _writeasm |
|---|
| 142 | nop |
|---|
| 143 | |
|---|
| 144 | li v0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_SUN_TOP_CTRL_CHIP_FAMILY_ID) |
|---|
| 145 | lw a0, (v0) |
|---|
| 146 | |
|---|
| 147 | bal uartout_hex32 |
|---|
| 148 | nop |
|---|
| 149 | |
|---|
| 150 | li a0, '\r' |
|---|
| 151 | bal _writeasm |
|---|
| 152 | nop |
|---|
| 153 | |
|---|
| 154 | li a0, '\n' |
|---|
| 155 | bal _writeasm |
|---|
| 156 | nop |
|---|
| 157 | |
|---|
| 158 | jr s0 |
|---|
| 159 | nop |
|---|
| 160 | |
|---|
| 161 | END(print_chip_details) |
|---|
| 162 | #if 0 |
|---|
| 163 | LEAF(sata_init) |
|---|
| 164 | /* must write this before writing to IMPL reg*/ |
|---|
| 165 | li v0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_SATA_TOP_CTRL_BUS_CTRL) |
|---|
| 166 | lw t0, 0(v0) |
|---|
| 167 | li t1, 0x00010000 |
|---|
| 168 | or t0, t0, t1 |
|---|
| 169 | sw t0, 0(v0) |
|---|
| 170 | |
|---|
| 171 | /* Set correct port number and disable port multiplier support for now */ |
|---|
| 172 | /* masked # of port implementation */ |
|---|
| 173 | li v0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_SATA_AHCI_GHC_HBA_CAP) |
|---|
| 174 | lw t0, 0(v0) |
|---|
| 175 | li t1, 0xfffdffe0 |
|---|
| 176 | and t0, t0, t1 |
|---|
| 177 | or t0, t0, 1 |
|---|
| 178 | sw t0, 0(v0) |
|---|
| 179 | |
|---|
| 180 | /* Write port implement*/ |
|---|
| 181 | li v0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_SATA_AHCI_GHC_Ports_Implemented) |
|---|
| 182 | li t0, 3 |
|---|
| 183 | sw t0, 0(v0) |
|---|
| 184 | |
|---|
| 185 | /* Must clear after used */ |
|---|
| 186 | li v0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_SATA_TOP_CTRL_BUS_CTRL) |
|---|
| 187 | lw t0, 0(v0) |
|---|
| 188 | li t1, 0xFFFEFFFF; |
|---|
| 189 | and t0, t0, t1 |
|---|
| 190 | sw t0, 0(v0) |
|---|
| 191 | |
|---|
| 192 | /* wait until bit gets cleared */ |
|---|
| 193 | 1: |
|---|
| 194 | li v0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_SATA_TOP_CTRL_BUS_CTRL) |
|---|
| 195 | lw t0, 0(v0) |
|---|
| 196 | li t1, 0x00010000 |
|---|
| 197 | and t0, t0, t1 |
|---|
| 198 | bnez t0, 1b |
|---|
| 199 | nop |
|---|
| 200 | |
|---|
| 201 | END(sata_init) |
|---|
| 202 | #endif |
|---|
| 203 | |
|---|