1 /* 2 * Copyright 2007 Freescale Semiconductor. 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #include <common.h> 8 #include <asm/io.h> 9 10 #include "bcsr.h" 11 12 void enable_8568mds_duart(void) 13 { 14 volatile uint* duart_mux = (uint *)(CONFIG_SYS_CCSRBAR + 0xe0060); 15 volatile uint* devices = (uint *)(CONFIG_SYS_CCSRBAR + 0xe0070); 16 volatile u8 *bcsr = (u8 *)(CONFIG_SYS_BCSR); 17 18 *duart_mux = 0x80000000; /* Set the mux to Duart on PMUXCR */ 19 *devices = 0; /* Enable all peripheral devices */ 20 bcsr[5] |= 0x01; /* Enable Duart in BCSR*/ 21 } 22 23 void enable_8568mds_flash_write(void) 24 { 25 volatile u8 *bcsr = (u8 *)(CONFIG_SYS_BCSR); 26 27 bcsr[9] |= 0x01; 28 } 29 30 void disable_8568mds_flash_write(void) 31 { 32 volatile u8 *bcsr = (u8 *)(CONFIG_SYS_BCSR); 33 34 bcsr[9] &= ~(0x01); 35 } 36 37 void enable_8568mds_qe_mdio(void) 38 { 39 u8 *bcsr = (u8 *)(CONFIG_SYS_BCSR); 40 41 bcsr[7] |= 0x01; 42 } 43 44 #if defined(CONFIG_UEC_ETH1) || defined(CONFIG_UEC_ETH2) 45 void reset_8568mds_uccs(void) 46 { 47 volatile u8 *bcsr = (u8 *)(CONFIG_SYS_BCSR); 48 49 /* Turn off UCC1 & UCC2 */ 50 out_8(&bcsr[8], in_8(&bcsr[8]) & ~BCSR_UCC1_GETH_EN); 51 out_8(&bcsr[9], in_8(&bcsr[9]) & ~BCSR_UCC2_GETH_EN); 52 53 /* Mode is RGMII, all bits clear */ 54 out_8(&bcsr[11], in_8(&bcsr[11]) & ~(BCSR_UCC1_MODE_MSK | 55 BCSR_UCC2_MODE_MSK)); 56 57 /* Turn UCC1 & UCC2 on */ 58 out_8(&bcsr[8], in_8(&bcsr[8]) | BCSR_UCC1_GETH_EN); 59 out_8(&bcsr[9], in_8(&bcsr[9]) | BCSR_UCC2_GETH_EN); 60 } 61 #endif 62