kup.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * (C) Copyright 2004
  3. * Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <mpc8xx.h>
  25. #include "kup.h"
  26. int misc_init_f (void)
  27. {
  28. volatile immap_t *immap = (immap_t *) CFG_IMMR;
  29. volatile sysconf8xx_t *siu = &immap->im_siu_conf;
  30. while (siu->sc_sipend & 0x20000000) {
  31. /* printf("waiting for 5V VCC\n"); */
  32. ;
  33. }
  34. /* RS232 / RS485 default is RS232 */
  35. immap->im_ioport.iop_padat &= ~(PA_RS485);
  36. immap->im_ioport.iop_papar &= ~(PA_RS485);
  37. immap->im_ioport.iop_paodr &= ~(PA_RS485);
  38. immap->im_ioport.iop_padir |= (PA_RS485);
  39. return (0);
  40. }
  41. #ifdef CONFIG_IDE_LED
  42. void ide_led (uchar led, uchar status)
  43. {
  44. volatile immap_t *immap = (immap_t *) CFG_IMMR;
  45. /* We have one led for both pcmcia slots */
  46. if (status) { /* led on */
  47. immap->im_ioport.iop_padat &= ~(PA_LED_YELLOW);
  48. } else {
  49. immap->im_ioport.iop_padat |= (PA_LED_YELLOW);
  50. }
  51. }
  52. #endif
  53. void poweron_key (void)
  54. {
  55. volatile immap_t *immap = (immap_t *) CFG_IMMR;
  56. immap->im_ioport.iop_pcpar &= ~(PC_SWITCH1);
  57. immap->im_ioport.iop_pcdir &= ~(PC_SWITCH1);
  58. if (immap->im_ioport.iop_pcdat & (PC_SWITCH1))
  59. setenv ("key1", "off");
  60. else
  61. setenv ("key1", "on");
  62. }
  63. #ifdef CONFIG_POST
  64. /*
  65. * Returns 1 if keys pressed to start the power-on long-running tests
  66. * Called from board_init_f().
  67. */
  68. int post_hotkeys_pressed (void)
  69. {
  70. return (0);
  71. }
  72. #endif