diff options
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/cris/include/asm/io.h | 39 | ||||
| -rw-r--r-- | arch/h8300/Kconfig | 1 | ||||
| -rw-r--r-- | arch/x86/platform/iris/iris.c | 67 |
3 files changed, 91 insertions, 16 deletions
diff --git a/arch/cris/include/asm/io.h b/arch/cris/include/asm/io.h index 32567bc2a421..ac12ae2b9286 100644 --- a/arch/cris/include/asm/io.h +++ b/arch/cris/include/asm/io.h | |||
| @@ -133,12 +133,39 @@ static inline void writel(unsigned int b, volatile void __iomem *addr) | |||
| 133 | #define insb(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,1,count) : 0) | 133 | #define insb(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,1,count) : 0) |
| 134 | #define insw(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,2,count) : 0) | 134 | #define insw(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,2,count) : 0) |
| 135 | #define insl(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,4,count) : 0) | 135 | #define insl(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,4,count) : 0) |
| 136 | #define outb(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,1,1) | 136 | static inline void outb(unsigned char data, unsigned int port) |
| 137 | #define outw(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,2,1) | 137 | { |
| 138 | #define outl(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,4,1) | 138 | if (cris_iops) |
| 139 | #define outsb(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,1,count) | 139 | cris_iops->write_io(port, (void *) &data, 1, 1); |
| 140 | #define outsw(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,2,count) | 140 | } |
| 141 | #define outsl(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,3,count) | 141 | static inline void outw(unsigned short data, unsigned int port) |
| 142 | { | ||
| 143 | if (cris_iops) | ||
| 144 | cris_iops->write_io(port, (void *) &data, 2, 1); | ||
| 145 | } | ||
| 146 | static inline void outl(unsigned int data, unsigned int port) | ||
| 147 | { | ||
| 148 | if (cris_iops) | ||
| 149 | cris_iops->write_io(port, (void *) &data, 4, 1); | ||
| 150 | } | ||
| 151 | static inline void outsb(unsigned int port, const void *addr, | ||
| 152 | unsigned long count) | ||
| 153 | { | ||
| 154 | if (cris_iops) | ||
| 155 | cris_iops->write_io(port, (void *)addr, 1, count); | ||
| 156 | } | ||
| 157 | static inline void outsw(unsigned int port, const void *addr, | ||
| 158 | unsigned long count) | ||
| 159 | { | ||
| 160 | if (cris_iops) | ||
| 161 | cris_iops->write_io(port, (void *)addr, 2, count); | ||
| 162 | } | ||
| 163 | static inline void outsl(unsigned int port, const void *addr, | ||
| 164 | unsigned long count) | ||
| 165 | { | ||
| 166 | if (cris_iops) | ||
| 167 | cris_iops->write_io(port, (void *)addr, 4, count); | ||
| 168 | } | ||
| 142 | 169 | ||
| 143 | /* | 170 | /* |
| 144 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | 171 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem |
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index 04bef4d25b4a..0ae445087607 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig | |||
| @@ -3,6 +3,7 @@ config H8300 | |||
| 3 | default y | 3 | default y |
| 4 | select HAVE_IDE | 4 | select HAVE_IDE |
| 5 | select HAVE_GENERIC_HARDIRQS | 5 | select HAVE_GENERIC_HARDIRQS |
| 6 | select GENERIC_ATOMIC64 | ||
| 6 | select HAVE_UID16 | 7 | select HAVE_UID16 |
| 7 | select ARCH_WANT_IPC_PARSE_VERSION | 8 | select ARCH_WANT_IPC_PARSE_VERSION |
| 8 | select GENERIC_IRQ_SHOW | 9 | select GENERIC_IRQ_SHOW |
diff --git a/arch/x86/platform/iris/iris.c b/arch/x86/platform/iris/iris.c index 5917eb56b313..e6cb80f620af 100644 --- a/arch/x86/platform/iris/iris.c +++ b/arch/x86/platform/iris/iris.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include <linux/moduleparam.h> | 24 | #include <linux/moduleparam.h> |
| 25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
| 26 | #include <linux/platform_device.h> | ||
| 26 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
| 27 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
| 28 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
| @@ -62,29 +63,75 @@ static void iris_power_off(void) | |||
| 62 | * by reading its input port and seeing whether the read value is | 63 | * by reading its input port and seeing whether the read value is |
| 63 | * meaningful. | 64 | * meaningful. |
| 64 | */ | 65 | */ |
| 65 | static int iris_init(void) | 66 | static int iris_probe(struct platform_device *pdev) |
| 66 | { | 67 | { |
| 67 | unsigned char status; | 68 | unsigned char status = inb(IRIS_GIO_INPUT); |
| 68 | if (force != 1) { | ||
| 69 | printk(KERN_ERR "The force parameter has not been set to 1 so the Iris poweroff handler will not be installed.\n"); | ||
| 70 | return -ENODEV; | ||
| 71 | } | ||
| 72 | status = inb(IRIS_GIO_INPUT); | ||
| 73 | if (status == IRIS_GIO_NODEV) { | 69 | if (status == IRIS_GIO_NODEV) { |
| 74 | printk(KERN_ERR "This machine does not seem to be an Iris. Power_off handler not installed.\n"); | 70 | printk(KERN_ERR "This machine does not seem to be an Iris. " |
| 71 | "Power off handler not installed.\n"); | ||
| 75 | return -ENODEV; | 72 | return -ENODEV; |
| 76 | } | 73 | } |
| 77 | old_pm_power_off = pm_power_off; | 74 | old_pm_power_off = pm_power_off; |
| 78 | pm_power_off = &iris_power_off; | 75 | pm_power_off = &iris_power_off; |
| 79 | printk(KERN_INFO "Iris power_off handler installed.\n"); | 76 | printk(KERN_INFO "Iris power_off handler installed.\n"); |
| 80 | |||
| 81 | return 0; | 77 | return 0; |
| 82 | } | 78 | } |
| 83 | 79 | ||
| 84 | static void iris_exit(void) | 80 | static int iris_remove(struct platform_device *pdev) |
| 85 | { | 81 | { |
| 86 | pm_power_off = old_pm_power_off; | 82 | pm_power_off = old_pm_power_off; |
| 87 | printk(KERN_INFO "Iris power_off handler uninstalled.\n"); | 83 | printk(KERN_INFO "Iris power_off handler uninstalled.\n"); |
| 84 | return 0; | ||
| 85 | } | ||
| 86 | |||
| 87 | static struct platform_driver iris_driver = { | ||
| 88 | .driver = { | ||
| 89 | .name = "iris", | ||
| 90 | .owner = THIS_MODULE, | ||
| 91 | }, | ||
| 92 | .probe = iris_probe, | ||
| 93 | .remove = iris_remove, | ||
| 94 | }; | ||
| 95 | |||
| 96 | static struct resource iris_resources[] = { | ||
| 97 | { | ||
| 98 | .start = IRIS_GIO_BASE, | ||
| 99 | .end = IRIS_GIO_OUTPUT, | ||
| 100 | .flags = IORESOURCE_IO, | ||
| 101 | .name = "address" | ||
| 102 | } | ||
| 103 | }; | ||
| 104 | |||
| 105 | static struct platform_device *iris_device; | ||
| 106 | |||
| 107 | static int iris_init(void) | ||
| 108 | { | ||
| 109 | int ret; | ||
| 110 | if (force != 1) { | ||
| 111 | printk(KERN_ERR "The force parameter has not been set to 1." | ||
| 112 | " The Iris poweroff handler will not be installed.\n"); | ||
| 113 | return -ENODEV; | ||
| 114 | } | ||
| 115 | ret = platform_driver_register(&iris_driver); | ||
| 116 | if (ret < 0) { | ||
| 117 | printk(KERN_ERR "Failed to register iris platform driver: %d\n", | ||
| 118 | ret); | ||
| 119 | return ret; | ||
| 120 | } | ||
| 121 | iris_device = platform_device_register_simple("iris", (-1), | ||
| 122 | iris_resources, ARRAY_SIZE(iris_resources)); | ||
| 123 | if (IS_ERR(iris_device)) { | ||
| 124 | printk(KERN_ERR "Failed to register iris platform device\n"); | ||
| 125 | platform_driver_unregister(&iris_driver); | ||
| 126 | return PTR_ERR(iris_device); | ||
| 127 | } | ||
| 128 | return 0; | ||
| 129 | } | ||
| 130 | |||
| 131 | static void iris_exit(void) | ||
| 132 | { | ||
| 133 | platform_device_unregister(iris_device); | ||
| 134 | platform_driver_unregister(&iris_driver); | ||
| 88 | } | 135 | } |
| 89 | 136 | ||
| 90 | module_init(iris_init); | 137 | module_init(iris_init); |
