setup.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * linux/arch/sh/boards/lbox/setup.c
  3. *
  4. * Copyright (C) 2007 Nobuhiro Iwamatsu
  5. *
  6. * NTT COMWARE L-BOX RE2 Support
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. *
  12. */
  13. #include <linux/init.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/ata_platform.h>
  16. #include <asm/machvec.h>
  17. #include <asm/addrspace.h>
  18. #include <mach/lboxre2.h>
  19. #include <asm/io.h>
  20. static struct resource cf_ide_resources[] = {
  21. [0] = {
  22. .start = 0x1f0,
  23. .end = 0x1f0 + 8 ,
  24. .flags = IORESOURCE_IO,
  25. },
  26. [1] = {
  27. .start = 0x1f0 + 0x206,
  28. .end = 0x1f0 +8 + 0x206 + 8,
  29. .flags = IORESOURCE_IO,
  30. },
  31. [2] = {
  32. .start = IRQ_CF0,
  33. .flags = IORESOURCE_IRQ,
  34. },
  35. };
  36. static struct platform_device cf_ide_device = {
  37. .name = "pata_platform",
  38. .id = -1,
  39. .num_resources = ARRAY_SIZE(cf_ide_resources),
  40. .resource = cf_ide_resources,
  41. };
  42. static struct platform_device *lboxre2_devices[] __initdata = {
  43. &cf_ide_device,
  44. };
  45. static int __init lboxre2_devices_setup(void)
  46. {
  47. u32 cf0_io_base; /* Boot CF base address */
  48. pgprot_t prot;
  49. unsigned long paddrbase, psize;
  50. /* open I/O area window */
  51. paddrbase = virt_to_phys((void*)PA_AREA5_IO);
  52. psize = PAGE_SIZE;
  53. prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
  54. cf0_io_base = (u32)ioremap_prot(paddrbase, psize, pgprot_val(prot));
  55. if (!cf0_io_base) {
  56. printk(KERN_ERR "%s : can't open CF I/O window!\n" , __func__ );
  57. return -ENOMEM;
  58. }
  59. cf_ide_resources[0].start += cf0_io_base ;
  60. cf_ide_resources[0].end += cf0_io_base ;
  61. cf_ide_resources[1].start += cf0_io_base ;
  62. cf_ide_resources[1].end += cf0_io_base ;
  63. return platform_add_devices(lboxre2_devices,
  64. ARRAY_SIZE(lboxre2_devices));
  65. }
  66. device_initcall(lboxre2_devices_setup);
  67. /*
  68. * The Machine Vector
  69. */
  70. static struct sh_machine_vector mv_lboxre2 __initmv = {
  71. .mv_name = "L-BOX RE2",
  72. .mv_init_irq = init_lboxre2_IRQ,
  73. };