From: Greg K-H <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org
Cc: Martyn Welch <martyn.welch@gefanuc.com>
Subject: [patch 5/5] Staging: vme: add TODO file
Date: Mon, 3 Aug 2009 14:01:23 -0700 [thread overview]
Message-ID: <20090803210123.GF28430@kroah.com> (raw)
In-Reply-To: <20090803210054.GA28430@kroah.com>
[-- Attachment #1: staging-vme-add-todo-file.patch --]
[-- Type: text/plain, Size: 13712 bytes --]
From: Martyn Welch <martyn.welch@gefanuc.com>
This describes the current vme api, along with a list of things
that needs to be fixed up.
Signed-off-by: Martyn Welch <martyn.welch@gefanuc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/staging/vme/TODO | 388 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 388 insertions(+)
--- /dev/null
+++ b/drivers/staging/vme/TODO
@@ -0,0 +1,388 @@
+ VME Device Driver API
+ =====================
+
+Driver registration
+===================
+
+As with other subsystems within the Linux kernel, VME device drivers register
+with the VME subsystem, typically called from the devices init routine. This is
+achieved via a call to the follwoing function:
+
+ int vme_register_driver (struct vme_driver *driver);
+
+If driver registration is successful this function returns zero, if an error
+occurred a negative error code will be returned.
+
+A pointer to a structure of type ???vme_driver??? must be provided to the
+registration function. The structure is as follows:
+
+ struct vme_driver {
+ struct list_head node;
+ char *name;
+ const struct vme_device_id *bind_table;
+ int (*probe) (struct device *, int, int);
+ int (*remove) (struct device *, int, int);
+ void (*shutdown) (void);
+ struct device_driver driver;
+ };
+
+At the minimum, the ???.name???, ???.probe??? and ???.bind_table??? elements of this
+structure should be correctly set. The ???.name??? element is a pointer to a string
+holding the device driver???s name. The ???.probe??? element should contain a pointer
+to the probe routine.
+
+The arguments of the probe routine are as follows:
+
+ probe(struct device *dev, int bus, int slot);
+
+The ???.bind_table??? is a pointer to an array of type ???vme_device_id???:
+
+ struct vme_device_id {
+ int bus;
+ int slot;
+ };
+
+Each structure in this array should provide a bus and slot number where the core
+should probe, using the driver???s probe routine, for a device on the specified
+VME bus.
+
+The VME subsystem supports a single VME driver per ???slot???. There are considered
+to be 32 slots per bus, one for each slot-ID as defined in the ANSI/VITA 1-1994
+specification and are analogious to the physical slots on the VME backplane.
+
+A function is also provided to unregister the driver from the VME core and is
+usually called from the device driver???s exit routine:
+
+ void vme_unregister_driver (struct vme_driver *driver);
+
+
+Resource management
+===================
+
+Once a driver has registered with the VME core the provided probe routine will
+be called for each of the bus/slot combination that becomes valid as VME buses
+are themselves registered. The probe routine is passed a pointer to the devices
+device structure. This pointer should be saved, it will be required for
+requesting VME resources.
+
+The driver can request ownership of one or more master windows, slave windows
+and/or dma channels. Rather than allowing the device driver to request a
+specific window or DMA channel (which may be used by a different driver) this
+driver allows a resource to be assigned based on the required attributes of the
+driver in question:
+
+ struct vme_resource * vme_master_request(struct device *dev,
+ vme_address_t aspace, vme_cycle_t cycle, vme_width_t width);
+
+ struct vme_resource * vme_slave_request(struct device *dev,
+ vme_address_t aspace, vme_cycle_t cycle);
+
+TODO: DMA Resource Allocation incomplete. No attribute based selection.
+
+ struct vme_resource *vme_request_dma(struct device *dev);
+
+For slave windows these attributes are split into those of type ???vme_address_t???
+and ???vme_cycle_t???. Master windows add a further set of attributes ???vme_cycle_t???.
+These attributes are defined as bitmasks and as such any combination of the
+attributes can be requested for a single window, the core will assign a window
+that meets the requirements, returning a pointer of type vme_resource that
+should be used to identify the allocated resource when it is used. If an
+unallocated window fitting the requirements can not be found a NULL pointer will
+be returned.
+
+Functions are also provided to free window allocations once they are no longer
+required. These functions should be passed the pointer to the resource provided
+during resource allocation:
+
+ void vme_master_free(struct vme_resource *res);
+
+ void vme_slave_free(struct vme_resource *res);
+
+ void vme_dma_free(struct vme_resource *res);
+
+
+Master windows
+==============
+
+Master windows provide access from the local processor[s] out onto the VME bus.
+The number of windows available and the available access modes is dependant on
+the underlying chipset. A window must be configured before it can be used.
+
+
+Master window configuration
+---------------------------
+
+Once a master window has been assigned the following functions can be used to
+configure it and retrieve the current settings:
+
+ int vme_master_set (struct vme_resource *res, int enabled,
+ unsigned long long base, unsigned long long size,
+ vme_address_t aspace, vme_cycle_t cycle, vme_width_t width);
+
+ int vme_master_get (struct vme_resource *res, int *enabled,
+ unsigned long long *base, unsigned long long *size,
+ vme_address_t *aspace, vme_cycle_t *cycle, vme_width_t *width);
+
+The address spaces, transfer widths and cycle types are the same as described
+under resource management, however some of the options are mutually exclusive.
+For example, only one address space may be specified.
+
+These functions return 0 on success or an error code should the call fail.
+
+
+Master window broadcast select mask
+-----------------------------------
+
+TODO: Add functions to set and get Broadcast Select mask:
+
+ int vme_master_bmsk_set (struct vme_resource *res, int mask);
+ int vme_master_bmsk_get (struct vme_resource *res, int *mask);
+
+
+Master window access
+--------------------
+
+The following functions can be used to read from and write to configured master
+windows. These functions return the number of bytes copied:
+
+ ssize_t vme_master_read(struct vme_resource *res, void *buf,
+ size_t count, loff_t offset);
+
+ ssize_t vme_master_write(struct vme_resource *res, void *buf,
+ size_t count, loff_t offset);
+
+In addition to simple reads and writes, a function is provided to do a
+read-modify-write transaction. This function returns the original value of the
+VME bus location :
+
+ unsigned int vme_master_rmw (struct vme_resource *res,
+ unsigned int mask, unsigned int compare, unsigned int swap,
+ loff_t offset);
+
+This functions by reading the offset, applying the mask. If the bits selected in
+the mask match with the values of the corresponding bits in the compare field,
+the value of swap is written the specified offset.
+
+
+Slave windows
+=============
+
+Slave windows provide devices on the VME bus access into mapped portions of the
+local memory. The number of windows available and the access modes that can be
+used is dependant on the underlying chipset. A window must be configured before
+it can be used.
+
+
+Slave window configuration
+--------------------------
+
+Once a slave window has been assigned the following functions can be used to
+configure it and retrieve the current settings:
+
+ int vme_slave_set (struct vme_resource *res, int enabled,
+ unsigned long long base, unsigned long long size,
+ dma_addr_t mem, vme_address_t aspace, vme_cycle_t cycle);
+
+ int vme_slave_get (struct vme_resource *res, int *enabled,
+ unsigned long long *base, unsigned long long *size,
+ dma_addr_t *mem, vme_address_t *aspace, vme_cycle_t *cycle);
+
+The address spaces, transfer widths and cycle types are the same as described
+under resource management, however some of the options are mutually exclusive.
+For example, only one address space may be specified.
+
+These functions return 0 on success or an error code should the call fail.
+
+
+Slave window buffer allocation
+------------------------------
+
+Functions are provided to allow the user to allocate and free a contiguous
+buffers which will be accessible by the VME bridge. These functions do not have
+to be used, other methods can be used to allocate a buffer, though care must be
+taken to ensure that they are contiguous and accessible by the VME bridge:
+
+ void * vme_alloc_consistent(struct vme_resource *res, size_t size,
+ dma_addr_t *mem);
+
+ void vme_free_consistent(struct vme_resource *res, size_t size,
+ void *virt, dma_addr_t mem);
+
+
+Slave window access
+-------------------
+
+Slave windows map local memory onto the VME bus, the standard methods for
+accessing memory should be used.
+
+
+DMA channels
+============
+
+The VME DMA transfer provides the ability to run link-list DMA transfers. The
+API introduces the concept of DMA lists. Each DMA list is a link-list which can
+be passed to a DMA controller. Multiple lists can be created, extended,
+executed, reused and destroyed.
+
+
+List Management
+---------------
+
+The following functions are provided to create and destroy DMA lists. Execution
+of a list will not automatically destroy the list, thus enabling a list to be
+reused for repetitive tasks:
+
+ struct vme_dma_list *vme_new_dma_list(struct vme_resource *res);
+
+ int vme_dma_list_free(struct vme_dma_list *list);
+
+
+List Population
+---------------
+
+An item can be added to a list using the following function ( the source and
+destination attributes need to be created before calling this function, this is
+covered under "Transfer Attributes"):
+
+ int vme_dma_list_add(struct vme_dma_list *list,
+ struct vme_dma_attr *src, struct vme_dma_attr *dest,
+ size_t count);
+
+
+Transfer Attributes
+-------------------
+
+The attributes for the source and destination are handled separately from adding
+an item to a list. This is due to the diverse attributes required for each type
+of source and destination. There are functions to create attributes for PCI, VME
+and pattern sources and destinations (where appropriate):
+
+Pattern source:
+
+ struct vme_dma_attr *vme_dma_pattern_attribute(u32 pattern,
+ vme_pattern_t type);
+
+PCI source or destination:
+
+ struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t mem);
+
+VME source or destination:
+
+ struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long base,
+ vme_address_t aspace, vme_cycle_t cycle, vme_width_t width);
+
+The following function should be used to free an attribute:
+
+ void vme_dma_free_attribute(struct vme_dma_attr *attr);
+
+
+List Execution
+--------------
+
+The following function queues a list for execution. The function will return
+once the list has been executed:
+
+ int vme_dma_list_exec(struct vme_dma_list *list);
+
+
+Interrupts
+==========
+
+The VME API provides functions to attach and detach callbacks to specific VME
+level and status ID combinations and for the generation of VME interrupts with
+specific VME level and status IDs.
+
+
+Attaching Interrupt Handlers
+----------------------------
+
+The following functions can be used to attach and free a specific VME level and
+status ID combination. Any given combination can only be assigned a single
+callback function. A void pointer parameter is provided, the value of which is
+passed to the callback function, the use of this pointer is user undefined:
+
+ int vme_request_irq(struct device *dev, int level, int statid,
+ void (*callback)(int, int, void *), void *priv);
+
+ void vme_free_irq(struct device *dev, int level, int statid);
+
+The callback parameters are as follows. Care must be taken in writing a callback
+function, callback functions run in interrupt context:
+
+ void callback(int level, int statid, void *priv);
+
+
+Interrupt Generation
+--------------------
+
+The following function can be used to generate a VME interrupt at a given VME
+level and VME status ID:
+
+ int vme_generate_irq(struct device *dev, int level, int statid);
+
+
+Location monitors
+=================
+
+The VME API provides the following functionality to configure the location
+monitor.
+
+
+Location Monitor Management
+---------------------------
+
+TODO: Provide a mechanism to request use of the location monitor. The location
+ monitors can be moved and we only want one driver to be able to do that
+ at a time! We also need to be able to free the location monitor for
+ others to use.
+
+ struct vme_resource * vme_request_lm(struct device *dev);
+
+ void vme_free_lm(struct vme_resource * res);
+
+
+Location Monitor Configuration
+------------------------------
+
+TODO: Change to struct "vme_resource *res" rather than "struct device *dev".
+
+The following functions are provided to configure the location and mode of the
+location monitor:
+
+ int vme_lm_set(struct device *dev, unsigned long long base,
+ vme_address_t aspace, vme_cycle_t cycle);
+
+ int vme_lm_get(struct device *dev, unsigned long long *base,
+ vme_address_t *aspace, vme_cycle_t *cycle);
+
+
+Location Monitor Use
+--------------------
+
+TODO: Change to struct "vme_resource *res" rather than "struct device *dev".
+
+The following functions allow a callback to be attached and detached from each
+location monitor location. The API currently supports 4 location monitors,
+monitoring 4 adjacent locations:
+
+ int vme_lm_attach(struct device *dev, int num,
+ void (*callback)(int));
+
+ int vme_lm_detach(struct device *dev, int num);
+
+The callback function is declared as follows.
+
+ void callback(int num);
+
+
+CR/CSR
+======
+
+TODO: The VME API needs functions to access the CR/CSR buffer.
+
+Slot Detection
+==============
+
+This function returns the slot ID of the provided bridge.
+
+ int vme_slot_get(struct device *dev);
next prev parent reply other threads:[~2009-08-03 21:03 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20090803205657.964064732@mini.kroah.org>
2009-08-03 21:00 ` [patch 0/5] [ANNOUNCE] VME Bus drivers and framework for Linux Greg K-H
2009-08-03 21:01 ` [patch 1/5] Staging: VME Framework for the Linux Kernel Greg K-H
2009-08-08 23:01 ` Emilio G. Cota
2009-08-10 12:44 ` Martyn Welch
2009-08-10 14:14 ` Emilio G. Cota
2009-08-10 15:31 ` Emilio G. Cota
2009-08-10 16:40 ` Martyn Welch
2009-08-10 19:50 ` Emilio G. Cota
2009-08-11 8:02 ` Martyn Welch
2009-08-11 8:43 ` Emilio G. Cota
2009-08-10 15:53 ` Martyn Welch
2009-08-10 16:26 ` Shawn Bohrer
2009-08-10 19:38 ` Emilio G. Cota
2009-08-11 8:29 ` Martyn Welch
2009-08-11 14:49 ` Emilio G. Cota
2009-08-11 15:10 ` Martyn Welch
2009-08-11 15:36 ` Emilio G. Cota
2009-08-11 15:41 ` Martyn Welch
2009-08-11 15:42 ` Emilio G. Cota
2009-08-11 16:38 ` Martyn Welch
2009-08-11 20:48 ` Emilio G. Cota
2009-08-12 9:54 ` Emilio G. Cota
2009-08-12 9:59 ` Martyn Welch
2009-08-12 10:09 ` Emilio G. Cota
2009-08-12 10:19 ` Martyn Welch
2009-08-11 4:54 ` Mike Frysinger
2009-08-11 7:48 ` Martyn Welch
2009-08-10 16:30 ` Greg KH
2009-08-10 14:52 ` [PATCH] Staging: vme: fix {master,slave}_get check bug Emilio G. Cota
2009-08-10 16:50 ` Martyn Welch
2009-08-03 21:01 ` [patch 2/5] Staging: vme: add VME userspace driver Greg K-H
2009-08-08 23:22 ` Emilio G. Cota
2009-08-09 12:17 ` Emilio G. Cota
2009-08-10 13:13 ` Martyn Welch
2009-08-10 15:26 ` Emilio G. Cota
2009-08-10 16:29 ` Greg KH
2009-08-10 16:30 ` Martyn Welch
2009-08-10 20:36 ` Emilio G. Cota
2009-08-11 9:03 ` Martyn Welch
2009-08-11 9:40 ` Emilio G. Cota
2009-08-11 12:46 ` Martyn Welch
2009-08-11 21:01 ` Emilio G. Cota
2009-08-12 8:17 ` Martyn Welch
2009-08-12 9:39 ` Emilio G. Cota
2009-08-12 9:57 ` Martyn Welch
2009-08-12 11:20 ` Emilio G. Cota
2009-08-12 12:19 ` Martyn Welch
2009-08-10 16:28 ` Greg KH
2009-08-10 20:05 ` Emilio G. Cota
2009-08-10 21:09 ` Greg KH
2009-08-11 7:04 ` Emilio G. Cota
2009-08-03 21:01 ` [patch 3/5] Staging: vme: add Universe I/II bridge driver Greg K-H
2009-08-03 23:00 ` Jiri Slaby
2009-08-03 21:01 ` [patch 4/5] Staging: vme: add Tundra TSI148 VME-PCI Bridge driver Greg K-H
2009-08-03 22:50 ` Jiri Slaby
2009-08-03 22:55 ` Jiri Slaby
2009-08-05 16:33 ` [PATCH] Staging: Correct tsi-148 VME interrupt free routine Martyn Welch
2009-08-05 16:38 ` [PATCH v2] " Martyn Welch
2009-08-05 21:53 ` Jiri Slaby
2009-08-06 7:20 ` Martyn Welch
2009-08-09 0:09 ` [patch 4/5] Staging: vme: add Tundra TSI148 VME-PCI Bridge driver Emilio G. Cota
2009-08-11 14:59 ` [patch 4/5] Staging: vme: add Tundra TSI148 VME-PCI Bridgedriver Martyn Welch
2009-08-03 21:01 ` Greg K-H [this message]
2009-08-04 7:56 ` [patch 0/5] [ANNOUNCE] VME Bus drivers and framework for Linux Martyn Welch
2009-08-08 22:25 ` Emilio G. Cota
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=20090803210123.GF28430@kroah.com \
--to=gregkh@suse.de \
--cc=devel@driverdev.osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martyn.welch@gefanuc.com \
/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