setup.c 1.8 KB

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