setup.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * linux/arch/sh/boards/cat68701/setup.c
  3. *
  4. * Copyright (C) 2000 Niibe Yutaka
  5. * 2001 Yutaro Ebihara
  6. *
  7. * Setup routines for A-ONE Corp CAT-68701 SH7708 Board
  8. *
  9. * This file is subject to the terms and conditions of the GNU General Public
  10. * License. See the file "COPYING" in the main directory of this archive
  11. * for more details.
  12. *
  13. */
  14. #include <asm/io.h>
  15. #include <asm/machvec.h>
  16. #include <asm/mach/io.h>
  17. #include <linux/module.h>
  18. #include <linux/init.h>
  19. #include <linux/sched.h>
  20. const char *get_system_type(void)
  21. {
  22. return "CAT-68701";
  23. }
  24. #ifdef CONFIG_HEARTBEAT
  25. void heartbeat_cat68701()
  26. {
  27. static unsigned int cnt = 0, period = 0 , bit = 0;
  28. cnt += 1;
  29. if (cnt < period) {
  30. return;
  31. }
  32. cnt = 0;
  33. /* Go through the points (roughly!):
  34. * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110
  35. */
  36. period = 110 - ( (300<<FSHIFT)/
  37. ((avenrun[0]/5) + (3<<FSHIFT)) );
  38. if(bit){ bit=0; }else{ bit=1; }
  39. outw(bit<<15,0x3fe);
  40. }
  41. #endif /* CONFIG_HEARTBEAT */
  42. unsigned long cat68701_isa_port2addr(unsigned long offset)
  43. {
  44. /* CompactFlash (IDE) */
  45. if (((offset >= 0x1f0) && (offset <= 0x1f7)) || (offset==0x3f6))
  46. return 0xba000000 + offset;
  47. /* INPUT PORT */
  48. if ((offset >= 0x3fc) && (offset <= 0x3fd))
  49. return 0xb4007000 + offset;
  50. /* OUTPUT PORT */
  51. if ((offset >= 0x3fe) && (offset <= 0x3ff))
  52. return 0xb4007400 + offset;
  53. return offset + 0xb4000000; /* other I/O (EREA 5)*/
  54. }
  55. /*
  56. * The Machine Vector
  57. */
  58. struct sh_machine_vector mv_cat68701 __initmv = {
  59. .mv_nr_irqs = 32,
  60. .mv_isa_port2addr = cat68701_isa_port2addr,
  61. .mv_irq_demux = cat68701_irq_demux,
  62. .mv_init_irq = init_cat68701_IRQ,
  63. #ifdef CONFIG_HEARTBEAT
  64. .mv_heartbeat = heartbeat_cat68701,
  65. #endif
  66. };
  67. ALIAS_MV(cat68701)
  68. int __init platform_setup(void)
  69. {
  70. /* dummy read erea5 (CS8900A) */
  71. }