1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+ 2765547dcSHaiying Wang /* 34c2e3da8SKumar Gala * Copyright (C) 2009 Freescale Semiconductor, Inc. 4765547dcSHaiying Wang */ 5765547dcSHaiying Wang 6765547dcSHaiying Wang #include <common.h> 7765547dcSHaiying Wang #include <asm/io.h> 8765547dcSHaiying Wang 9765547dcSHaiying Wang #include "bcsr.h" 10765547dcSHaiying Wang 11e56143e5SKim Phillips void enable_8569mds_flash_write(void) 12765547dcSHaiying Wang { 1316e7559cSDave Liu setbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 17), BCSR17_FLASH_nWP); 14765547dcSHaiying Wang } 15765547dcSHaiying Wang 16e56143e5SKim Phillips void disable_8569mds_flash_write(void) 17765547dcSHaiying Wang { 18765547dcSHaiying Wang clrbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 17), BCSR17_FLASH_nWP); 19765547dcSHaiying Wang } 20765547dcSHaiying Wang 21e56143e5SKim Phillips void enable_8569mds_qe_uec(void) 22765547dcSHaiying Wang { 23f82107f6SHaiying Wang #if defined(CONFIG_SYS_UCC_RGMII_MODE) 24765547dcSHaiying Wang setbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 7), 25765547dcSHaiying Wang BCSR7_UCC1_GETH_EN | BCSR7_UCC1_RGMII_EN); 26765547dcSHaiying Wang setbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 8), 27765547dcSHaiying Wang BCSR8_UCC2_GETH_EN | BCSR8_UCC2_RGMII_EN); 28750098d3SHaiying Wang setbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 9), 29750098d3SHaiying Wang BCSR9_UCC3_GETH_EN | BCSR9_UCC3_RGMII_EN); 30750098d3SHaiying Wang setbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 10), 31750098d3SHaiying Wang BCSR10_UCC4_GETH_EN | BCSR10_UCC4_RGMII_EN); 32f82107f6SHaiying Wang #elif defined(CONFIG_SYS_UCC_RMII_MODE) 33f82107f6SHaiying Wang /* Set UCC1-4 working at RMII mode */ 34f82107f6SHaiying Wang clrbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 7), 35f82107f6SHaiying Wang BCSR7_UCC1_GETH_EN | BCSR7_UCC1_RGMII_EN); 36f82107f6SHaiying Wang clrbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 8), 37f82107f6SHaiying Wang BCSR8_UCC2_GETH_EN | BCSR8_UCC2_RGMII_EN); 38f82107f6SHaiying Wang clrbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 9), 39f82107f6SHaiying Wang BCSR9_UCC3_GETH_EN | BCSR9_UCC3_RGMII_EN); 40f82107f6SHaiying Wang clrbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 10), 41f82107f6SHaiying Wang BCSR10_UCC4_GETH_EN | BCSR10_UCC4_RGMII_EN); 42f82107f6SHaiying Wang setbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 9), BCSR9_UCC3_RMII_EN); 43f82107f6SHaiying Wang #endif 44765547dcSHaiying Wang } 45765547dcSHaiying Wang 46e56143e5SKim Phillips void disable_8569mds_brd_eeprom_write_protect(void) 47765547dcSHaiying Wang { 48765547dcSHaiying Wang clrbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 7), BCSR7_BRD_WRT_PROTECT); 49765547dcSHaiying Wang } 50