diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/wireless/ath/ath9k/ahb.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ahb.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ahb.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c index 2ad7d0280f7a..ca4994f13151 100644 --- a/drivers/net/wireless/ath/ath9k/ahb.c +++ b/drivers/net/wireless/ath/ath9k/ahb.c | |||
@@ -22,27 +22,23 @@ | |||
22 | #include "ath9k.h" | 22 | #include "ath9k.h" |
23 | 23 | ||
24 | /* return bus cachesize in 4B word units */ | 24 | /* return bus cachesize in 4B word units */ |
25 | static void ath_ahb_read_cachesize(struct ath_softc *sc, int *csz) | 25 | static void ath_ahb_read_cachesize(struct ath_common *common, int *csz) |
26 | { | 26 | { |
27 | *csz = L1_CACHE_BYTES >> 2; | 27 | *csz = L1_CACHE_BYTES >> 2; |
28 | } | 28 | } |
29 | 29 | ||
30 | static void ath_ahb_cleanup(struct ath_softc *sc) | 30 | static bool ath_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data) |
31 | { | 31 | { |
32 | iounmap(sc->mem); | 32 | struct ath_softc *sc = (struct ath_softc *)common->priv; |
33 | } | ||
34 | |||
35 | static bool ath_ahb_eeprom_read(struct ath_hw *ah, u32 off, u16 *data) | ||
36 | { | ||
37 | struct ath_softc *sc = ah->ah_sc; | ||
38 | struct platform_device *pdev = to_platform_device(sc->dev); | 33 | struct platform_device *pdev = to_platform_device(sc->dev); |
39 | struct ath9k_platform_data *pdata; | 34 | struct ath9k_platform_data *pdata; |
40 | 35 | ||
41 | pdata = (struct ath9k_platform_data *) pdev->dev.platform_data; | 36 | pdata = (struct ath9k_platform_data *) pdev->dev.platform_data; |
42 | if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { | 37 | if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { |
43 | DPRINTF(ah->ah_sc, ATH_DBG_FATAL, | 38 | ath_print(common, ATH_DBG_FATAL, |
44 | "%s: flash read failed, offset %08x is out of range\n", | 39 | "%s: flash read failed, offset %08x " |
45 | __func__, off); | 40 | "is out of range\n", |
41 | __func__, off); | ||
46 | return false; | 42 | return false; |
47 | } | 43 | } |
48 | 44 | ||
@@ -52,8 +48,6 @@ static bool ath_ahb_eeprom_read(struct ath_hw *ah, u32 off, u16 *data) | |||
52 | 48 | ||
53 | static struct ath_bus_ops ath_ahb_bus_ops = { | 49 | static struct ath_bus_ops ath_ahb_bus_ops = { |
54 | .read_cachesize = ath_ahb_read_cachesize, | 50 | .read_cachesize = ath_ahb_read_cachesize, |
55 | .cleanup = ath_ahb_cleanup, | ||
56 | |||
57 | .eeprom_read = ath_ahb_eeprom_read, | 51 | .eeprom_read = ath_ahb_eeprom_read, |
58 | }; | 52 | }; |
59 | 53 | ||
@@ -67,6 +61,7 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
67 | int irq; | 61 | int irq; |
68 | int ret = 0; | 62 | int ret = 0; |
69 | struct ath_hw *ah; | 63 | struct ath_hw *ah; |
64 | char hw_name[64]; | ||
70 | 65 | ||
71 | if (!pdev->dev.platform_data) { | 66 | if (!pdev->dev.platform_data) { |
72 | dev_err(&pdev->dev, "no platform data specified\n"); | 67 | dev_err(&pdev->dev, "no platform data specified\n"); |
@@ -116,36 +111,35 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
116 | sc->hw = hw; | 111 | sc->hw = hw; |
117 | sc->dev = &pdev->dev; | 112 | sc->dev = &pdev->dev; |
118 | sc->mem = mem; | 113 | sc->mem = mem; |
119 | sc->bus_ops = &ath_ahb_bus_ops; | ||
120 | sc->irq = irq; | 114 | sc->irq = irq; |
121 | 115 | ||
122 | ret = ath_init_device(AR5416_AR9100_DEVID, sc, 0x0); | 116 | /* Will be cleared in ath9k_start() */ |
117 | sc->sc_flags |= SC_OP_INVALID; | ||
118 | |||
119 | ret = request_irq(irq, ath_isr, IRQF_SHARED, "ath9k", sc); | ||
123 | if (ret) { | 120 | if (ret) { |
124 | dev_err(&pdev->dev, "failed to initialize device\n"); | 121 | dev_err(&pdev->dev, "request_irq failed\n"); |
125 | goto err_free_hw; | 122 | goto err_free_hw; |
126 | } | 123 | } |
127 | 124 | ||
128 | ret = request_irq(irq, ath_isr, IRQF_SHARED, "ath9k", sc); | 125 | ret = ath9k_init_device(AR5416_AR9100_DEVID, sc, 0x0, &ath_ahb_bus_ops); |
129 | if (ret) { | 126 | if (ret) { |
130 | dev_err(&pdev->dev, "request_irq failed\n"); | 127 | dev_err(&pdev->dev, "failed to initialize device\n"); |
131 | goto err_detach; | 128 | goto err_irq; |
132 | } | 129 | } |
133 | 130 | ||
134 | ah = sc->sc_ah; | 131 | ah = sc->sc_ah; |
132 | ath9k_hw_name(ah, hw_name, sizeof(hw_name)); | ||
135 | printk(KERN_INFO | 133 | printk(KERN_INFO |
136 | "%s: Atheros AR%s MAC/BB Rev:%x, " | 134 | "%s: %s mem=0x%lx, irq=%d\n", |
137 | "AR%s RF Rev:%x, mem=0x%lx, irq=%d\n", | ||
138 | wiphy_name(hw->wiphy), | 135 | wiphy_name(hw->wiphy), |
139 | ath_mac_bb_name(ah->hw_version.macVersion), | 136 | hw_name, |
140 | ah->hw_version.macRev, | ||
141 | ath_rf_name((ah->hw_version.analog5GhzRev & AR_RADIO_SREV_MAJOR)), | ||
142 | ah->hw_version.phyRev, | ||
143 | (unsigned long)mem, irq); | 137 | (unsigned long)mem, irq); |
144 | 138 | ||
145 | return 0; | 139 | return 0; |
146 | 140 | ||
147 | err_detach: | 141 | err_irq: |
148 | ath_detach(sc); | 142 | free_irq(irq, sc); |
149 | err_free_hw: | 143 | err_free_hw: |
150 | ieee80211_free_hw(hw); | 144 | ieee80211_free_hw(hw); |
151 | platform_set_drvdata(pdev, NULL); | 145 | platform_set_drvdata(pdev, NULL); |
@@ -162,8 +156,12 @@ static int ath_ahb_remove(struct platform_device *pdev) | |||
162 | if (hw) { | 156 | if (hw) { |
163 | struct ath_wiphy *aphy = hw->priv; | 157 | struct ath_wiphy *aphy = hw->priv; |
164 | struct ath_softc *sc = aphy->sc; | 158 | struct ath_softc *sc = aphy->sc; |
159 | void __iomem *mem = sc->mem; | ||
165 | 160 | ||
166 | ath_cleanup(sc); | 161 | ath9k_deinit_device(sc); |
162 | free_irq(sc->irq, sc); | ||
163 | ieee80211_free_hw(sc->hw); | ||
164 | iounmap(mem); | ||
167 | platform_set_drvdata(pdev, NULL); | 165 | platform_set_drvdata(pdev, NULL); |
168 | } | 166 | } |
169 | 167 | ||