apollohw.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* apollohw.h : some structures to access apollo HW */
  3. #ifndef _ASMm68k_APOLLOHW_H_
  4. #define _ASMm68k_APOLLOHW_H_
  5. #include <linux/types.h>
  6. #include <asm/bootinfo-apollo.h>
  7. extern u_long apollo_model;
  8. /*
  9. see scn2681 data sheet for more info.
  10. member names are read_write.
  11. */
  12. #define DECLARE_2681_FIELD(x) unsigned char x; unsigned char dummy##x
  13. struct SCN2681 {
  14. DECLARE_2681_FIELD(mra);
  15. DECLARE_2681_FIELD(sra_csra);
  16. DECLARE_2681_FIELD(BRGtest_cra);
  17. DECLARE_2681_FIELD(rhra_thra);
  18. DECLARE_2681_FIELD(ipcr_acr);
  19. DECLARE_2681_FIELD(isr_imr);
  20. DECLARE_2681_FIELD(ctu_ctur);
  21. DECLARE_2681_FIELD(ctl_ctlr);
  22. DECLARE_2681_FIELD(mrb);
  23. DECLARE_2681_FIELD(srb_csrb);
  24. DECLARE_2681_FIELD(tst_crb);
  25. DECLARE_2681_FIELD(rhrb_thrb);
  26. DECLARE_2681_FIELD(reserved);
  27. DECLARE_2681_FIELD(ip_opcr);
  28. DECLARE_2681_FIELD(startCnt_setOutBit);
  29. DECLARE_2681_FIELD(stopCnt_resetOutBit);
  30. };
  31. struct mc146818 {
  32. unsigned char second, alarm_second;
  33. unsigned char minute, alarm_minute;
  34. unsigned char hours, alarm_hours;
  35. unsigned char day_of_week, day_of_month;
  36. unsigned char month, year;
  37. };
  38. #define IO_BASE 0x80000000
  39. extern u_long sio01_physaddr;
  40. extern u_long sio23_physaddr;
  41. extern u_long rtc_physaddr;
  42. extern u_long pica_physaddr;
  43. extern u_long picb_physaddr;
  44. extern u_long cpuctrl_physaddr;
  45. extern u_long timer_physaddr;
  46. #define SAU7_SIO01_PHYSADDR 0x10400
  47. #define SAU7_SIO23_PHYSADDR 0x10500
  48. #define SAU7_RTC_PHYSADDR 0x10900
  49. #define SAU7_PICA 0x11000
  50. #define SAU7_PICB 0x11100
  51. #define SAU7_CPUCTRL 0x10100
  52. #define SAU7_TIMER 0x010800
  53. #define SAU8_SIO01_PHYSADDR 0x8400
  54. #define SAU8_RTC_PHYSADDR 0x8900
  55. #define SAU8_PICA 0x9400
  56. #define SAU8_PICB 0x9500
  57. #define SAU8_CPUCTRL 0x8100
  58. #define SAU8_TIMER 0x8800
  59. #define sio01 ((*(volatile struct SCN2681 *)(IO_BASE + sio01_physaddr)))
  60. #define sio23 ((*(volatile struct SCN2681 *)(IO_BASE + sio23_physaddr)))
  61. #define rtc (((volatile struct mc146818 *)(IO_BASE + rtc_physaddr)))
  62. #define cpuctrl (*(volatile unsigned int *)(IO_BASE + cpuctrl_physaddr))
  63. #define pica (IO_BASE + pica_physaddr)
  64. #define picb (IO_BASE + picb_physaddr)
  65. #define apollo_timer (IO_BASE + timer_physaddr)
  66. #define addr_xlat_map ((unsigned short *)(IO_BASE + 0x17000))
  67. #define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE)
  68. #define IRQ_APOLLO IRQ_USER
  69. #endif