From: Kalle Valo <kvalo@qca.qualcomm.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH v2 01/10] ath10k: decouple pci init/deinit logic
Date: Thu, 13 Jun 2013 21:09:06 +0300 [thread overview]
Message-ID: <87wqpxnarh.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <1371041642-20273-2-git-send-email-michal.kazior@tieto.com> (Michal Kazior's message of "Wed, 12 Jun 2013 14:53:53 +0200")
Michal Kazior <michal.kazior@tieto.com> writes:
> Split logic that prepares the device for BMI
> phase/cleans up related resources.
>
> This is necessary for ath10k to be able to restart
> hw on the fly without reloading the module.
>
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Few comments:
> --- a/drivers/net/wireless/ath/ath10k/hif.h
> +++ b/drivers/net/wireless/ath/ath10k/hif.h
> @@ -46,8 +46,11 @@ struct ath10k_hif_ops {
> void *request, u32 request_len,
> void *response, u32 *response_len);
>
> + /* Post BMI phase, after FW is loaded. Starts regular operation */
> int (*start)(struct ath10k *ar);
>
> + /* Clean up what start() did. This does not revert to BMI phase. If
> + * desired so, call deinit() and init() */
> void (*stop)(struct ath10k *ar);
>
> int (*map_service_to_pipe)(struct ath10k *ar, u16 service_id,
> @@ -70,6 +73,13 @@ struct ath10k_hif_ops {
> struct ath10k_hif_cb *callbacks);
>
> u16 (*get_free_queue_number)(struct ath10k *ar, u8 pipe_id);
> +
> + /* Power up the device and enter BMI transfer mode for FW download */
> + int (*init)(struct ath10k *ar);
> +
> + /* Power down the device and free up resources. stop() must be called
> + * before this if start() was called earlier */
> + void (*deinit)(struct ath10k *ar);
I think terminology is mixed here as well. To me init() does here a lot
more than other init() functions in ath10k. Should we rename these to
power_up() and power_down(), as how your documentation already uses
those terms?
So when booting the firwmware we call:
hif_power_up()
hif_start()
and when we want to kill the firmware we do:
hif_stop()
hif_power_down()
[...]
> +static int ath10k_pci_hif_init(struct ath10k *ar)
> +{
> + int ret;
> +
> + /*
> + * Bring the target up cleanly.
> + *
> + * The target may be in an undefined state with an AUX-powered Target
> + * and a Host in WoW mode. If the Host crashes, loses power, or is
> + * restarted (without unloading the driver) then the Target is left
> + * (aux) powered and running. On a subsequent driver load, the Target
> + * is in an unexpected state. We try to catch that here in order to
> + * reset the Target and retry the probe.
> + */
> + ath10k_pci_device_reset(ar);
> +
> + ret = ath10k_pci_reset_target(ar);
> + if (ret)
> + goto err;
> +
> + if (ath10k_target_ps) {
> + ath10k_dbg(ATH10K_DBG_PCI, "on-chip power save enabled\n");
> + } else {
> + /* Force AWAKE forever */
> + ath10k_dbg(ATH10K_DBG_PCI, "on-chip power save disabled\n");
> + ath10k_do_pci_wake(ar);
> + }
> +
> + ret = ath10k_pci_ce_init(ar);
> + if (ret)
> + goto err_ps;
I noticed ath10k_pci_ce_init() also allocs host memory etc. If possible,
in the future we might want to refactor the function into two:
ath10k_pci_ce_init() and ath10k_pci_ce_start(). And the former would be
called only from ath10k_pci_probe(). That way we would not need to do
any memory allocation during start time.
But no need to refactor it right now, this is good enough for the first
implementation.
--
Kalle Valo
next prev parent reply other threads:[~2013-06-13 18:09 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-12 12:53 [ath9k-devel] [PATCH v2 00/10] ath10k: device setup refactor Michal Kazior
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 01/10] ath10k: decouple pci init/deinit logic Michal Kazior
2013-06-13 18:09 ` Kalle Valo [this message]
2013-06-14 12:02 ` Michal Kazior
2013-06-14 12:14 ` Kalle Valo
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 02/10] ath10k: decouple core start/stop logic Michal Kazior
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 03/10] ath10k: allow deferred regd update Michal Kazior
2013-06-13 18:08 ` Kalle Valo
2013-06-14 12:03 ` Michal Kazior
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 04/10] ath10k: reset BMI state upon init Michal Kazior
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 05/10] ath10k: decouple suspend code Michal Kazior
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 06/10] ath10k: move free_vdev_map initialization Michal Kazior
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 07/10] ath10k: make sure all resources are freed upon ath10k_stop() Michal Kazior
2013-06-12 12:54 ` [ath9k-devel] [PATCH v2 08/10] ath10k: defer hw setup to start/stop mac80211 hooks Michal Kazior
2013-06-14 12:23 ` Kalle Valo
2013-06-14 12:43 ` Michal Kazior
2013-06-12 12:54 ` [ath9k-devel] [PATCH v2 09/10] ath10k: skip updating some params during resume Michal Kazior
2013-06-12 12:54 ` [ath9k-devel] [PATCH v2 10/10] ath10k: store firmware files in memory Michal Kazior
2013-06-25 7:59 ` [ath9k-devel] [PATCH v3 0/9] ath10k: device setup refactor Michal Kazior
2013-06-25 7:59 ` [ath9k-devel] [PATCH v3 1/9] ath10k: decouple pci start/stop logic Michal Kazior
2013-07-05 6:29 ` Kalle Valo
2013-07-05 7:05 ` Michal Kazior
2013-06-25 7:59 ` [ath9k-devel] [PATCH v3 2/9] ath10k: decouple core " Michal Kazior
2013-06-25 7:59 ` [ath9k-devel] [PATCH v3 3/9] ath10k: allow deferred regd update Michal Kazior
2013-06-25 7:59 ` [ath9k-devel] [PATCH v3 4/9] ath10k: reset BMI state upon init Michal Kazior
2013-06-25 7:59 ` [ath9k-devel] [PATCH v3 5/9] ath10k: decouple suspend code Michal Kazior
2013-07-05 6:51 ` Kalle Valo
2013-07-05 7:12 ` Michal Kazior
2013-07-05 7:20 ` Kalle Valo
2013-06-25 7:59 ` [ath9k-devel] [PATCH v3 6/9] ath10k: move free_vdev_map initialization Michal Kazior
2013-07-05 7:03 ` Kalle Valo
2013-06-25 7:59 ` [ath9k-devel] [PATCH v3 7/9] ath10k: make sure all resources are freed upon ath10k_stop() Michal Kazior
2013-06-25 7:59 ` [ath9k-devel] [PATCH v3 8/9] ath10k: defer hw setup to start/stop mac80211 hooks Michal Kazior
2013-06-25 7:59 ` [ath9k-devel] [PATCH v3 9/9] ath10k: store firmware files in memory Michal Kazior
2013-06-25 8:09 ` [ath9k-devel] [PATCH v3 10/10] ath10k: skip fw stats debugfs interface if device is down Michal Kazior
2013-07-05 7:09 ` Kalle Valo
2013-07-16 7:19 ` [PATCH v3 00/10] ath10k: device setup refactor Michal Kazior
2013-07-16 7:19 ` [PATCH v3 01/10] ath10k: decouple pci start/stop logic Michal Kazior
2013-07-16 7:19 ` [PATCH v3 02/10] ath10k: decouple core " Michal Kazior
2013-07-16 7:19 ` [PATCH v3 03/10] ath10k: allow deferred regd update Michal Kazior
2013-07-16 7:19 ` [PATCH v3 04/10] ath10k: reset BMI state upon init Michal Kazior
2013-07-16 7:19 ` [PATCH v3 05/10] ath10k: decouple suspend code Michal Kazior
2013-07-16 7:19 ` [PATCH v3 06/10] ath10k: move free_vdev_map initialization Michal Kazior
2013-07-16 7:19 ` [PATCH v3 07/10] ath10k: make sure all resources are freed upon ath10k_stop() Michal Kazior
2013-07-16 7:19 ` [PATCH v3 08/10] ath10k: defer hw setup to start/stop mac80211 hooks Michal Kazior
2013-07-16 7:19 ` [PATCH v3 09/10] ath10k: store firmware files in memory Michal Kazior
2013-07-16 7:19 ` [PATCH v3 10/10] ath10k: skip fw stats debugfs interface if device is down Michal Kazior
2013-07-16 7:27 ` [PATCH v3 00/10] ath10k: device setup refactor Michal Kazior
2013-07-16 7:38 ` [PATCH v4 " Michal Kazior
2013-07-16 7:38 ` Michal Kazior
2013-07-16 7:38 ` [PATCH v4 01/10] ath10k: decouple pci start/stop logic Michal Kazior
2013-07-16 7:38 ` Michal Kazior
2013-07-16 7:38 ` [PATCH v4 02/10] ath10k: decouple core " Michal Kazior
2013-07-16 7:38 ` Michal Kazior
2013-07-16 7:38 ` [PATCH v4 03/10] ath10k: allow deferred regd update Michal Kazior
2013-07-16 7:38 ` Michal Kazior
2013-07-16 7:38 ` [PATCH v4 04/10] ath10k: reset BMI state upon init Michal Kazior
2013-07-16 7:38 ` Michal Kazior
2013-07-16 7:38 ` [PATCH v4 05/10] ath10k: decouple suspend code Michal Kazior
2013-07-16 7:38 ` Michal Kazior
2013-07-16 7:38 ` [PATCH v4 06/10] ath10k: move free_vdev_map initialization Michal Kazior
2013-07-16 7:38 ` Michal Kazior
2013-07-16 7:38 ` [PATCH v4 07/10] ath10k: make sure all resources are freed upon ath10k_stop() Michal Kazior
2013-07-16 7:38 ` Michal Kazior
2013-07-16 7:38 ` [PATCH v4 08/10] ath10k: defer hw setup to start/stop mac80211 hooks Michal Kazior
2013-07-16 7:38 ` Michal Kazior
2013-07-16 7:38 ` [PATCH v4 09/10] ath10k: store firmware files in memory Michal Kazior
2013-07-16 7:38 ` Michal Kazior
2013-07-16 7:38 ` [PATCH v4 10/10] ath10k: skip fw stats debugfs interface if device is down Michal Kazior
2013-07-16 7:38 ` Michal Kazior
2013-07-19 10:18 ` [PATCH v4 00/10] ath10k: device setup refactor Kalle Valo
2013-07-19 10:18 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wqpxnarh.fsf@kamboji.qca.qualcomm.com \
--to=kvalo@qca.qualcomm.com \
--cc=ath9k-devel@lists.ath9k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.