bcsr.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright 2007 Freescale Semiconductor.
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <common.h>
  23. #include <asm/io.h>
  24. #include "bcsr.h"
  25. void enable_8568mds_duart()
  26. {
  27. volatile uint* duart_mux = (uint *)(CONFIG_SYS_CCSRBAR + 0xe0060);
  28. volatile uint* devices = (uint *)(CONFIG_SYS_CCSRBAR + 0xe0070);
  29. volatile u8 *bcsr = (u8 *)(CONFIG_SYS_BCSR);
  30. *duart_mux = 0x80000000; /* Set the mux to Duart on PMUXCR */
  31. *devices = 0; /* Enable all peripheral devices */
  32. bcsr[5] |= 0x01; /* Enable Duart in BCSR*/
  33. }
  34. void enable_8568mds_flash_write()
  35. {
  36. volatile u8 *bcsr = (u8 *)(CONFIG_SYS_BCSR);
  37. bcsr[9] |= 0x01;
  38. }
  39. void disable_8568mds_flash_write()
  40. {
  41. volatile u8 *bcsr = (u8 *)(CONFIG_SYS_BCSR);
  42. bcsr[9] &= ~(0x01);
  43. }
  44. void enable_8568mds_qe_mdio()
  45. {
  46. u8 *bcsr = (u8 *)(CONFIG_SYS_BCSR);
  47. bcsr[7] |= 0x01;
  48. }
  49. #if defined(CONFIG_UEC_ETH1) || defined(CONFIG_UEC_ETH2)
  50. void reset_8568mds_uccs(void)
  51. {
  52. volatile u8 *bcsr = (u8 *)(CONFIG_SYS_BCSR);
  53. /* Turn off UCC1 & UCC2 */
  54. out_8(&bcsr[8], in_8(&bcsr[8]) & ~BCSR_UCC1_GETH_EN);
  55. out_8(&bcsr[9], in_8(&bcsr[9]) & ~BCSR_UCC2_GETH_EN);
  56. /* Mode is RGMII, all bits clear */
  57. out_8(&bcsr[11], in_8(&bcsr[11]) & ~(BCSR_UCC1_MODE_MSK |
  58. BCSR_UCC2_MODE_MSK));
  59. /* Turn UCC1 & UCC2 on */
  60. out_8(&bcsr[8], in_8(&bcsr[8]) | BCSR_UCC1_GETH_EN);
  61. out_8(&bcsr[9], in_8(&bcsr[9]) | BCSR_UCC2_GETH_EN);
  62. }
  63. #endif