Linux wireless drivers development
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@qca.qualcomm.com>
To: linux-wireless@vger.kernel.org
Cc: devel@linuxdriverproject.org, gregkh@suse.de, error27@gmail.com
Subject: [PATCH 10/24] ath6kl: add hif.h
Date: Wed, 13 Jul 2011 04:34:35 +0300	[thread overview]
Message-ID: <20110713013435.8517.83426.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20110713013023.8517.15940.stgit@localhost6.localdomain6>

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath6kl/hif.h |  214 +++++++++++++++++++++++++++++++++
 1 files changed, 214 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath6kl/hif.h

diff --git a/drivers/net/wireless/ath/ath6kl/hif.h b/drivers/net/wireless/ath/ath6kl/hif.h
new file mode 100644
index 0000000..465876f
--- /dev/null
+++ b/drivers/net/wireless/ath/ath6kl/hif.h
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2004-2011 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef HIF_H
+#define HIF_H
+
+#include "common.h"
+#include "core.h"
+
+#define BUS_REQUEST_MAX_NUM                64
+#define HIF_MBOX_BLOCK_SIZE                128
+#define HIF_MBOX0_BLOCK_SIZE               1
+
+#define HIF_DMA_BUFFER_SIZE (32 * 1024)
+#define CMD53_FIXED_ADDRESS 1
+#define CMD53_INCR_ADDRESS  2
+
+#define MAX_SCATTER_REQUESTS             4
+#define MAX_SCATTER_ENTRIES_PER_REQ      16
+#define MAX_SCATTER_REQ_TRANSFER_SIZE    (32 * 1024)
+
+#define MANUFACTURER_ID_AR6003_BASE        0x300
+    /* SDIO manufacturer ID and Codes */
+#define MANUFACTURER_ID_ATH6KL_BASE_MASK     0xFF00
+#define MANUFACTURER_CODE                  0x271	/* Atheros */
+
+/* Mailbox address in SDIO address space */
+#define HIF_MBOX_BASE_ADDR                 0x800
+#define HIF_MBOX_WIDTH                     0x800
+
+#define HIF_MBOX_END_ADDR  (HTC_MAILBOX_NUM_MAX * HIF_MBOX_WIDTH - 1)
+
+/* version 1 of the chip has only a 12K extended mbox range */
+#define HIF_MBOX0_EXT_BASE_ADDR  0x4000
+#define HIF_MBOX0_EXT_WIDTH      (12*1024)
+
+/* GMBOX addresses */
+#define HIF_GMBOX_BASE_ADDR                0x7000
+#define HIF_GMBOX_WIDTH                    0x4000
+
+/* interrupt mode register */
+#define CCCR_SDIO_IRQ_MODE_REG         0xF0
+
+/* mode to enable special 4-bit interrupt assertion without clock */
+#define SDIO_IRQ_MODE_ASYNC_4BIT_IRQ   (1 << 0)
+
+struct bus_request {
+	struct list_head list;
+
+	/* request data */
+	u32 address;
+
+	u8 *buffer;
+	u32 length;
+	u32 request;
+	struct htc_packet *packet;
+	int status;
+
+	/* this is a scatter request */
+	struct hif_scatter_req *scat_req;
+};
+
+/* direction of transfer (read/write) */
+#define HIF_READ                    0x00000001
+#define HIF_WRITE                   0x00000002
+#define HIF_DIR_MASK                (HIF_READ | HIF_WRITE)
+
+/*
+ *     emode - This indicates the whether the command is to be executed in a
+ *             blocking or non-blocking fashion (HIF_SYNCHRONOUS/
+ *             HIF_ASYNCHRONOUS). The read/write data paths in HTC have been
+ *             implemented using the asynchronous mode allowing the the bus
+ *             driver to indicate the completion of operation through the
+ *             registered callback routine. The requirement primarily comes
+ *             from the contexts these operations get called from (a driver's
+ *             transmit context or the ISR context in case of receive).
+ *             Support for both of these modes is essential.
+ */
+#define HIF_SYNCHRONOUS             0x00000010
+#define HIF_ASYNCHRONOUS            0x00000020
+#define HIF_EMODE_MASK              (HIF_SYNCHRONOUS | HIF_ASYNCHRONOUS)
+
+/*
+ *     dmode - An interface may support different kinds of commands based on
+ *             the tradeoff between the amount of data it can carry and the
+ *             setup time. Byte and Block modes are supported (HIF_BYTE_BASIS/
+ *             HIF_BLOCK_BASIS). In case of latter, the data is rounded off
+ *             to the nearest block size by padding. The size of the block is
+ *             configurable at compile time using the HIF_BLOCK_SIZE and is
+ *             negotiated with the target during initialization after the
+ *             ATH6KL interrupts are enabled.
+ */
+#define HIF_BYTE_BASIS              0x00000040
+#define HIF_BLOCK_BASIS             0x00000080
+#define HIF_DMODE_MASK              (HIF_BYTE_BASIS | HIF_BLOCK_BASIS)
+
+/*
+ *     amode - This indicates if the address has to be incremented on ATH6KL
+ *             after every read/write operation (HIF?FIXED_ADDRESS/
+ *             HIF_INCREMENTAL_ADDRESS).
+ */
+#define HIF_FIXED_ADDRESS           0x00000100
+#define HIF_INCREMENTAL_ADDRESS     0x00000200
+#define HIF_AMODE_MASK		  (HIF_FIXED_ADDRESS | HIF_INCREMENTAL_ADDRESS)
+
+#define HIF_WR_ASYNC_BYTE_INC					\
+	(HIF_WRITE | HIF_ASYNCHRONOUS |				\
+	 HIF_BYTE_BASIS | HIF_INCREMENTAL_ADDRESS)
+
+#define HIF_WR_ASYNC_BLOCK_INC					\
+	(HIF_WRITE | HIF_ASYNCHRONOUS |				\
+	 HIF_BLOCK_BASIS | HIF_INCREMENTAL_ADDRESS)
+
+#define HIF_WR_SYNC_BYTE_FIX					\
+	(HIF_WRITE | HIF_SYNCHRONOUS |				\
+	 HIF_BYTE_BASIS | HIF_FIXED_ADDRESS)
+
+#define HIF_WR_SYNC_BYTE_INC					\
+	(HIF_WRITE | HIF_SYNCHRONOUS |				\
+	 HIF_BYTE_BASIS | HIF_INCREMENTAL_ADDRESS)
+
+#define HIF_WR_SYNC_BLOCK_INC					\
+	(HIF_WRITE | HIF_SYNCHRONOUS |				\
+	 HIF_BLOCK_BASIS | HIF_INCREMENTAL_ADDRESS)
+
+#define HIF_RD_SYNC_BYTE_INC						\
+	(HIF_READ | HIF_SYNCHRONOUS |					\
+	 HIF_BYTE_BASIS | HIF_INCREMENTAL_ADDRESS)
+
+#define HIF_RD_SYNC_BYTE_FIX						\
+	(HIF_READ | HIF_SYNCHRONOUS |					\
+	 HIF_BYTE_BASIS | HIF_FIXED_ADDRESS)
+
+#define HIF_RD_ASYNC_BLOCK_FIX						\
+	(HIF_READ | HIF_ASYNCHRONOUS |					\
+	 HIF_BLOCK_BASIS | HIF_FIXED_ADDRESS)
+
+#define HIF_RD_SYNC_BLOCK_FIX						\
+	(HIF_READ | HIF_SYNCHRONOUS |					\
+	 HIF_BLOCK_BASIS | HIF_FIXED_ADDRESS)
+
+struct hif_scatter_item {
+	u8 *buf;
+	int len;
+	struct htc_packet *packet;
+};
+
+struct hif_scatter_req {
+	struct list_head list;
+	/* address for the read/write operation */
+	u32 addr;
+
+	/* request flags */
+	u32 req;
+
+	/* total length of entire transfer */
+	u32 len;
+
+	u32 flags;
+	void (*complete) (struct hif_scatter_req *);
+	int status;
+	struct htc_endpoint *ep;
+	int scat_entries;
+
+	struct hif_scatter_req_priv *req_priv;
+
+	/* bounce buffer for upper layers to copy to/from */
+	u8 *virt_dma_buf;
+
+	struct hif_scatter_item scat_list[1];
+};
+
+struct hif_dev_scat_sup_info {
+	int (*rw_scat_func) (struct ath6kl *ar, struct hif_scatter_req *);
+	int max_scat_entries;
+	int max_xfer_szper_scatreq;
+};
+
+struct hif_scatter_req_priv {
+	struct bus_request *busrequest;
+	struct scatterlist sgentries[MAX_SCATTER_ENTRIES_PER_REQ];
+};
+
+struct ath6kl_hif_ops {
+	int (*read_write_sync)(struct ath6kl *ar, u32 addr, u8 *buf,
+			       u32 len, u32 request);
+	int (*write_async)(struct ath6kl *ar, u32 address, u8 *buffer,
+			   u32 length, u32 request, struct htc_packet *packet);
+
+	void (*irq_enable)(struct ath6kl *ar);
+	void (*irq_disable)(struct ath6kl *ar);
+
+	struct hif_scatter_req *(*scatter_req_get)(struct ath6kl *ar);
+	void (*scatter_req_add)(struct ath6kl *ar,
+				struct hif_scatter_req *s_req);
+	int (*enable_scatter)(struct ath6kl *ar,
+			      struct hif_dev_scat_sup_info *info);
+	void (*cleanup_scatter)(struct ath6kl *ar);
+};
+
+#endif


  parent reply	other threads:[~2011-07-13  1:34 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13  1:32 [PATCH 00/24] ath6kl cleaned up driver Kalle Valo
2011-07-13  1:33 ` [PATCH 01/24] ath6kl: add bmi.c Kalle Valo
2011-07-13  4:28   ` Joe Perches
2011-07-13  7:08     ` Kalle Valo
2011-07-13 12:19       ` Joe Perches
2011-07-14  6:46         ` Kalle Valo
2011-07-14  7:33           ` Joe Perches
2011-07-14  7:38             ` Kalle Valo
2011-07-13  1:33 ` [PATCH 02/24] ath6kl: add bmi.h Kalle Valo
2011-07-13  1:33 ` [PATCH 03/24] ath6kl: add cfg80211.c Kalle Valo
2011-07-13  4:29   ` Joe Perches
2011-07-13  7:22     ` Kalle Valo
2011-07-13  1:33 ` [PATCH 04/24] ath6kl: add cfg80211.h Kalle Valo
2011-07-13  1:33 ` [PATCH 05/24] ath6kl: add common.h Kalle Valo
2011-07-13  1:33 ` [PATCH 06/24] ath6kl: add core.h Kalle Valo
2011-07-13  4:29   ` Joe Perches
2011-07-13  7:41     ` Kalle Valo
2011-07-13  1:34 ` [PATCH 07/24] ath6kl: add debug.c Kalle Valo
2011-07-13  4:29   ` Joe Perches
2011-07-13  1:34 ` [PATCH 08/24] ath6kl: add debug.h Kalle Valo
2011-07-13  1:34 ` [PATCH 09/24] ath6kl: add hif-ops.h Kalle Valo
2011-07-13  1:34 ` Kalle Valo [this message]
2011-07-13  1:34 ` [PATCH 11/24] ath6kl: add htc.c Kalle Valo
2011-07-13  4:30   ` Joe Perches
2011-07-13  7:46     ` Kalle Valo
2011-07-13 12:33       ` Joe Perches
2011-07-13 13:38         ` Vasanthakumar Thiagarajan
2011-07-13  1:34 ` [PATCH 12/24] ath6kl: add htc.h Kalle Valo
2011-07-13  1:35 ` [PATCH 13/24] ath6kl: add htc_hif.c Kalle Valo
2011-07-13  1:35 ` [PATCH 14/24] ath6kl: add htc_hif.h Kalle Valo
2011-07-13  1:35 ` [PATCH 15/24] ath6kl: add ieee80211.h Kalle Valo
2011-07-13  7:29   ` Johannes Berg
2011-07-13  8:25     ` Kalle Valo
2011-07-13  1:35 ` [PATCH 16/24] ath6kl: add init.c Kalle Valo
2011-07-13  1:35 ` [PATCH 17/24] ath6kl: add main.c Kalle Valo
2011-07-13  4:30   ` Joe Perches
2011-07-13  8:18     ` Kalle Valo
2011-07-13  1:35 ` [PATCH 18/24] ath6kl: add node.c Kalle Valo
2011-07-13  1:36 ` [PATCH 19/24] ath6kl: add sdio.c Kalle Valo
2011-07-13  1:36 ` [PATCH 20/24] ath6kl: add target.h Kalle Valo
2011-07-13  1:36 ` [PATCH 21/24] ath6kl: add txrx.c Kalle Valo
2011-07-13  4:31   ` Joe Perches
2011-07-13  8:21     ` Kalle Valo
2011-07-13  8:23       ` Kalle Valo
2011-07-13  1:36 ` [PATCH 22/24] ath6kl: add wmi.c Kalle Valo
2011-07-13  1:36 ` [PATCH 23/24] ath6kl: add wmi.h Kalle Valo
2011-07-13  1:37 ` [PATCH 24/24] ath6kl: add Kconfig and Makefile Kalle Valo
2011-07-13  8:34 ` [PATCH 00/24] ath6kl cleaned up driver Kalle Valo
2011-07-13  9:22 ` Dan Carpenter
2011-07-13  9:28   ` Johannes Berg
2011-07-13  9:34     ` Dan Carpenter
2011-07-13  9:41       ` Johannes Berg
2011-07-13  9:33   ` Dan Carpenter
2011-07-13 10:04   ` Vasanthakumar Thiagarajan
2011-07-14 10:06 ` Dan Carpenter
2011-07-14 10:35   ` 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=20110713013435.8517.83426.stgit@localhost6.localdomain6 \
    --to=kvalo@qca.qualcomm.com \
    --cc=devel@linuxdriverproject.org \
    --cc=error27@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-wireless@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox