Luciano Coelho | b2ba99f | 2011-11-20 23:32:10 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of wl1271 |
| 3 | * |
| 4 | * Copyright (C) 2008-2010 Nokia Corporation |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * version 2 as published by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 18 | * 02110-1301 USA |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #include <linux/module.h> |
| 23 | #include <linux/platform_device.h> |
| 24 | |
Luciano Coelho | ffeb501 | 2011-11-21 18:55:51 +0200 | [diff] [blame] | 25 | #include <linux/err.h> |
| 26 | |
Luciano Coelho | b2ba99f | 2011-11-20 23:32:10 +0200 | [diff] [blame] | 27 | #include "../wlcore/wlcore.h" |
Luciano Coelho | ffeb501 | 2011-11-21 18:55:51 +0200 | [diff] [blame] | 28 | #include "../wlcore/debug.h" |
| 29 | |
Luciano Coelho | 25a43d7 | 2011-11-21 20:37:14 +0200 | [diff] [blame^] | 30 | #include "../wlcore/reg.h" |
| 31 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 32 | static struct wlcore_ops wl12xx_ops = { |
| 33 | }; |
| 34 | |
Luciano Coelho | 25a43d7 | 2011-11-21 20:37:14 +0200 | [diff] [blame^] | 35 | static struct wlcore_partition_set wl12xx_ptable[PART_TABLE_LEN] = { |
| 36 | [PART_DOWN] = { |
| 37 | .mem = { |
| 38 | .start = 0x00000000, |
| 39 | .size = 0x000177c0 |
| 40 | }, |
| 41 | .reg = { |
| 42 | .start = REGISTERS_BASE, |
| 43 | .size = 0x00008800 |
| 44 | }, |
| 45 | .mem2 = { |
| 46 | .start = 0x00000000, |
| 47 | .size = 0x00000000 |
| 48 | }, |
| 49 | .mem3 = { |
| 50 | .start = 0x00000000, |
| 51 | .size = 0x00000000 |
| 52 | }, |
| 53 | }, |
| 54 | |
| 55 | [PART_WORK] = { |
| 56 | .mem = { |
| 57 | .start = 0x00040000, |
| 58 | .size = 0x00014fc0 |
| 59 | }, |
| 60 | .reg = { |
| 61 | .start = REGISTERS_BASE, |
| 62 | .size = 0x0000a000 |
| 63 | }, |
| 64 | .mem2 = { |
| 65 | .start = 0x003004f8, |
| 66 | .size = 0x00000004 |
| 67 | }, |
| 68 | .mem3 = { |
| 69 | .start = 0x00040404, |
| 70 | .size = 0x00000000 |
| 71 | }, |
| 72 | }, |
| 73 | |
| 74 | [PART_DRPW] = { |
| 75 | .mem = { |
| 76 | .start = 0x00040000, |
| 77 | .size = 0x00014fc0 |
| 78 | }, |
| 79 | .reg = { |
| 80 | .start = DRPW_BASE, |
| 81 | .size = 0x00006000 |
| 82 | }, |
| 83 | .mem2 = { |
| 84 | .start = 0x00000000, |
| 85 | .size = 0x00000000 |
| 86 | }, |
| 87 | .mem3 = { |
| 88 | .start = 0x00000000, |
| 89 | .size = 0x00000000 |
| 90 | } |
| 91 | } |
| 92 | }; |
| 93 | |
Luciano Coelho | ffeb501 | 2011-11-21 18:55:51 +0200 | [diff] [blame] | 94 | static int __devinit wl12xx_probe(struct platform_device *pdev) |
| 95 | { |
| 96 | struct wl1271 *wl; |
| 97 | struct ieee80211_hw *hw; |
| 98 | |
| 99 | hw = wlcore_alloc_hw(); |
| 100 | if (IS_ERR(hw)) { |
| 101 | wl1271_error("can't allocate hw"); |
| 102 | return PTR_ERR(hw); |
| 103 | } |
| 104 | |
| 105 | wl = hw->priv; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 106 | wl->ops = &wl12xx_ops; |
Luciano Coelho | 25a43d7 | 2011-11-21 20:37:14 +0200 | [diff] [blame^] | 107 | wl->ptable = wl12xx_ptable; |
Luciano Coelho | ffeb501 | 2011-11-21 18:55:51 +0200 | [diff] [blame] | 108 | |
| 109 | return wlcore_probe(wl, pdev); |
| 110 | } |
Luciano Coelho | b2ba99f | 2011-11-20 23:32:10 +0200 | [diff] [blame] | 111 | |
| 112 | static const struct platform_device_id wl12xx_id_table[] __devinitconst = { |
| 113 | { "wl12xx", 0 }, |
| 114 | { } /* Terminating Entry */ |
| 115 | }; |
| 116 | MODULE_DEVICE_TABLE(platform, wl12xx_id_table); |
| 117 | |
| 118 | static struct platform_driver wl12xx_driver = { |
Luciano Coelho | ffeb501 | 2011-11-21 18:55:51 +0200 | [diff] [blame] | 119 | .probe = wl12xx_probe, |
Luciano Coelho | b2ba99f | 2011-11-20 23:32:10 +0200 | [diff] [blame] | 120 | .remove = __devexit_p(wlcore_remove), |
| 121 | .id_table = wl12xx_id_table, |
| 122 | .driver = { |
| 123 | .name = "wl12xx_driver", |
| 124 | .owner = THIS_MODULE, |
| 125 | } |
| 126 | }; |
| 127 | |
| 128 | static int __init wl12xx_init(void) |
| 129 | { |
| 130 | return platform_driver_register(&wl12xx_driver); |
| 131 | } |
| 132 | module_init(wl12xx_init); |
| 133 | |
| 134 | static void __exit wl12xx_exit(void) |
| 135 | { |
| 136 | platform_driver_unregister(&wl12xx_driver); |
| 137 | } |
| 138 | module_exit(wl12xx_exit); |
| 139 | |
| 140 | MODULE_LICENSE("GPL v2"); |
| 141 | MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>"); |