539568c48953c4f7a0ae05004afafa0ee31d52c4
2 Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
3 <http://rt2x00.serialmonkey.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the
17 Free Software Foundation, Inc.,
18 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 Abstract: rt2x00 generic soc device routines.
26 #include <linux/bug.h>
27 #include <linux/kernel.h>
28 #include <linux/module.h>
29 #include <linux/platform_device.h>
32 #include "rt2x00soc.h"
34 static void rt2x00soc_free_reg(struct rt2x00_dev
*rt2x00dev
)
39 kfree(rt2x00dev
->eeprom
);
40 rt2x00dev
->eeprom
= NULL
;
43 static int rt2x00soc_alloc_reg(struct rt2x00_dev
*rt2x00dev
)
45 struct platform_device
*pdev
= to_platform_device(rt2x00dev
->dev
);
48 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
52 rt2x00dev
->csr
.base
= (void __iomem
*)KSEG1ADDR(res
->start
);
53 if (!rt2x00dev
->csr
.base
)
56 rt2x00dev
->eeprom
= kzalloc(rt2x00dev
->ops
->eeprom_size
, GFP_KERNEL
);
57 if (!rt2x00dev
->eeprom
)
60 rt2x00dev
->rf
= kzalloc(rt2x00dev
->ops
->rf_size
, GFP_KERNEL
);
67 ERROR_PROBE("Failed to allocate registers.\n");
68 rt2x00soc_free_reg(rt2x00dev
);
73 int rt2x00soc_probe(struct platform_device
*pdev
,
74 const unsigned short chipset
,
75 const struct rt2x00_ops
*ops
)
77 struct ieee80211_hw
*hw
;
78 struct rt2x00_dev
*rt2x00dev
;
81 hw
= ieee80211_alloc_hw(sizeof(struct rt2x00_dev
), ops
->hw
);
83 ERROR_PROBE("Failed to allocate hardware.\n");
87 platform_set_drvdata(pdev
, hw
);
90 rt2x00dev
->dev
= &pdev
->dev
;
93 rt2x00dev
->irq
= platform_get_irq(pdev
, 0);
94 rt2x00dev
->name
= pdev
->dev
.driver
->name
;
96 rt2x00_set_chip_rt(rt2x00dev
, chipset
);
98 retval
= rt2x00soc_alloc_reg(rt2x00dev
);
100 goto exit_free_device
;
102 retval
= rt2x00lib_probe_dev(rt2x00dev
);
109 rt2x00soc_free_reg(rt2x00dev
);
112 ieee80211_free_hw(hw
);
117 int rt2x00soc_remove(struct platform_device
*pdev
)
119 struct ieee80211_hw
*hw
= platform_get_drvdata(pdev
);
120 struct rt2x00_dev
*rt2x00dev
= hw
->priv
;
123 * Free all allocated data.
125 rt2x00lib_remove_dev(rt2x00dev
);
126 rt2x00soc_free_reg(rt2x00dev
);
127 ieee80211_free_hw(hw
);
131 EXPORT_SYMBOL_GPL(rt2x00soc_remove
);
134 int rt2x00soc_suspend(struct platform_device
*pdev
, pm_message_t state
)
136 struct ieee80211_hw
*hw
= platform_get_drvdata(pdev
);
137 struct rt2x00_dev
*rt2x00dev
= hw
->priv
;
139 return rt2x00lib_suspend(rt2x00dev
, state
);
141 EXPORT_SYMBOL_GPL(rt2x00soc_suspend
);
143 int rt2x00soc_resume(struct platform_device
*pdev
)
145 struct ieee80211_hw
*hw
= platform_get_drvdata(pdev
);
146 struct rt2x00_dev
*rt2x00dev
= hw
->priv
;
148 return rt2x00lib_resume(rt2x00dev
);
150 EXPORT_SYMBOL_GPL(rt2x00soc_resume
);
151 #endif /* CONFIG_PM */
154 * rt2x00soc module information.
156 MODULE_AUTHOR(DRV_PROJECT
);
157 MODULE_VERSION(DRV_VERSION
);
158 MODULE_DESCRIPTION("rt2x00 soc library");
159 MODULE_LICENSE("GPL");
This page took 0.032664 seconds and 4 git commands to generate.