hh.org updates
[hh.org.git] / arch / arm / mach-pxa / h5400 / h5400_wifi.c
blobd47e2383213205135a8696527be32c4ad348251a
1 /*
2 * Driver for iPAQ H5400 internal USB OHCI host controller
4 * Copyright 2003 Hewlett-Packard Company.
6 * Use consistent with the GNU GPL is permitted,
7 * provided that this copyright notice is
8 * preserved in its entirety in all copies and derived works.
10 * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
11 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
12 * FITNESS FOR ANY PARTICULAR PURPOSE.
14 * Author: Jamey Hicks.
16 * History:
18 * 2003-03-19 Jamey Hicks Created file.
22 #include <linux/module.h>
23 #include <linux/version.h>
24 #include <linux/config.h>
25 #include <linux/init.h>
26 #include <linux/device.h>
27 #include <linux/soc-old.h>
28 #include <linux/usb.h>
29 #include <linux/slab.h>
30 #define CONFIG_PCI
31 #include <linux/pci.h> /* pci_pool defs */
33 #include <asm/arch/hardware.h>
34 #include <asm/irq.h>
36 #include <asm/arch-pxa/h5400-asic.h>
38 #include <asm/hardware/samcop_base.h>
40 typedef struct ohci ohci_t;
42 extern int hc_add_ohci(struct pci_dev *dev, int irq, void *mem_base, unsigned long flags,
43 ohci_t **ohci, const char *name, const char *slot_name);
44 extern void hc_remove_ohci(ohci_t *ohci);
46 static void
47 h5400_ohci_remove (struct device *dev)
49 #if 0
50 #warning port to kernel 2.6
51 if (dev->driver_data) {
52 hc_remove_ohci (dev->driver_data);
53 dev->driver_data = NULL;
55 #endif
57 samcop_set_gpio_b (dev->parent, SAMCOP_GPIO_GPB_RF_POWER_ON | SAMCOP_GPIO_GPB_WLAN_POWER_ON, 0);
60 static int
61 h5400_ohci_probe (struct device *dev)
63 struct platform_device *sdev;
64 int irq;
65 void *mem_base;
66 unsigned long flags = 0;
67 int result = 0;
69 sdev = to_platform_device (dev);
70 mem_base = (void *)sdev->resource[1].start;
71 irq = sdev->resource[2].start;
73 /* make sure the clocks are enabled */
74 samcop_clock_enable (dev->parent, SAMCOP_CPM_CLKCON_USBHOST_CLKEN, 1);
75 samcop_clock_enable (dev->parent, SAMCOP_CPM_CLKCON_UCLK_EN, 0);
77 /* both needed? */
78 samcop_set_gpio_b (dev->parent, SAMCOP_GPIO_GPB_RF_POWER_ON | SAMCOP_GPIO_GPB_WLAN_POWER_ON,
79 SAMCOP_GPIO_GPB_RF_POWER_ON | SAMCOP_GPIO_GPB_WLAN_POWER_ON);
81 #if 0
82 #warning port to kernel 2.6
83 msleep (100);
85 result = hc_add_ohci (pcidev, irq, mem_base, flags, (ohci_t **)&dev->driver_data, "h5400-ohci", "asic");
86 if (result)
87 h5400_ohci_remove (dev);
88 #endif
90 return result;
93 static int
94 h5400_ohci_suspend (struct device *dev, u32 state, u32 level)
98 static int
99 h5400_ohci_resume (struct device *dev, u32 level)
101 return 0;
104 static platform_device_id h5400_usb_device_ids[] = { IPAQ_SAMCOP_USBH_DEVICE_ID, 0 };
106 struct device_driver h5400_usb_device_driver = {
107 .name = "h5400 wifi",
108 .probe = h5400_ohci_probe,
109 .shutdown = h5400_ohci_remove,
110 .suspend = h5400_ohci_suspend,
111 .resume = h5400_ohci_resume
114 static int __init
115 h5400_ohci_init (void)
117 return driver_register (&h5400_usb_device_driver);
120 static void __exit
121 h5400_ohci_exit (void)
123 driver_unregister (&h5400_usb_device_driver);
126 module_init(h5400_ohci_init);
127 module_exit(h5400_ohci_exit);