diff options
Diffstat (limited to 'drivers/net/wireless/bcm43xx/bcm43xx_main.c')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_main.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index 085d7857fe31..27bcf47228e2 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -3237,6 +3237,39 @@ static void bcm43xx_security_init(struct bcm43xx_private *bcm) | |||
3237 | bcm43xx_clear_keys(bcm); | 3237 | bcm43xx_clear_keys(bcm); |
3238 | } | 3238 | } |
3239 | 3239 | ||
3240 | static int bcm43xx_rng_read(struct hwrng *rng, u32 *data) | ||
3241 | { | ||
3242 | struct bcm43xx_private *bcm = (struct bcm43xx_private *)rng->priv; | ||
3243 | unsigned long flags; | ||
3244 | |||
3245 | bcm43xx_lock_irqonly(bcm, flags); | ||
3246 | *data = bcm43xx_read16(bcm, BCM43xx_MMIO_RNG); | ||
3247 | bcm43xx_unlock_irqonly(bcm, flags); | ||
3248 | |||
3249 | return (sizeof(u16)); | ||
3250 | } | ||
3251 | |||
3252 | static void bcm43xx_rng_exit(struct bcm43xx_private *bcm) | ||
3253 | { | ||
3254 | hwrng_unregister(&bcm->rng); | ||
3255 | } | ||
3256 | |||
3257 | static int bcm43xx_rng_init(struct bcm43xx_private *bcm) | ||
3258 | { | ||
3259 | int err; | ||
3260 | |||
3261 | snprintf(bcm->rng_name, ARRAY_SIZE(bcm->rng_name), | ||
3262 | "%s_%s", KBUILD_MODNAME, bcm->net_dev->name); | ||
3263 | bcm->rng.name = bcm->rng_name; | ||
3264 | bcm->rng.data_read = bcm43xx_rng_read; | ||
3265 | bcm->rng.priv = (unsigned long)bcm; | ||
3266 | err = hwrng_register(&bcm->rng); | ||
3267 | if (err) | ||
3268 | printk(KERN_ERR PFX "RNG init failed (%d)\n", err); | ||
3269 | |||
3270 | return err; | ||
3271 | } | ||
3272 | |||
3240 | /* This is the opposite of bcm43xx_init_board() */ | 3273 | /* This is the opposite of bcm43xx_init_board() */ |
3241 | static void bcm43xx_free_board(struct bcm43xx_private *bcm) | 3274 | static void bcm43xx_free_board(struct bcm43xx_private *bcm) |
3242 | { | 3275 | { |
@@ -3248,6 +3281,7 @@ static void bcm43xx_free_board(struct bcm43xx_private *bcm) | |||
3248 | 3281 | ||
3249 | bcm43xx_set_status(bcm, BCM43xx_STAT_SHUTTINGDOWN); | 3282 | bcm43xx_set_status(bcm, BCM43xx_STAT_SHUTTINGDOWN); |
3250 | 3283 | ||
3284 | bcm43xx_rng_exit(bcm); | ||
3251 | for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { | 3285 | for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { |
3252 | if (!bcm->core_80211[i].available) | 3286 | if (!bcm->core_80211[i].available) |
3253 | continue; | 3287 | continue; |
@@ -3325,6 +3359,9 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm) | |||
3325 | bcm43xx_switch_core(bcm, &bcm->core_80211[0]); | 3359 | bcm43xx_switch_core(bcm, &bcm->core_80211[0]); |
3326 | bcm43xx_mac_enable(bcm); | 3360 | bcm43xx_mac_enable(bcm); |
3327 | } | 3361 | } |
3362 | err = bcm43xx_rng_init(bcm); | ||
3363 | if (err) | ||
3364 | goto err_80211_unwind; | ||
3328 | bcm43xx_macfilter_clear(bcm, BCM43xx_MACFILTER_ASSOC); | 3365 | bcm43xx_macfilter_clear(bcm, BCM43xx_MACFILTER_ASSOC); |
3329 | bcm43xx_macfilter_set(bcm, BCM43xx_MACFILTER_SELF, (u8 *)(bcm->net_dev->dev_addr)); | 3366 | bcm43xx_macfilter_set(bcm, BCM43xx_MACFILTER_SELF, (u8 *)(bcm->net_dev->dev_addr)); |
3330 | dprintk(KERN_INFO PFX "80211 cores initialized\n"); | 3367 | dprintk(KERN_INFO PFX "80211 cores initialized\n"); |