Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
spi_ks8995.c File Reference
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/spi/spi.h>

Go to the source code of this file.

Data Structures

struct  ks8995_pdata
 
struct  ks8995_switch
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define DRV_VERSION   "0.1.1"
 
#define DRV_DESC   "Micrel KS8995 Ethernet switch SPI driver"
 
#define KS8995_REG_ID0   0x00 /* Chip ID0 */
 
#define KS8995_REG_ID1   0x01 /* Chip ID1 */
 
#define KS8995_REG_GC0   0x02 /* Global Control 0 */
 
#define KS8995_REG_GC1   0x03 /* Global Control 1 */
 
#define KS8995_REG_GC2   0x04 /* Global Control 2 */
 
#define KS8995_REG_GC3   0x05 /* Global Control 3 */
 
#define KS8995_REG_GC4   0x06 /* Global Control 4 */
 
#define KS8995_REG_GC5   0x07 /* Global Control 5 */
 
#define KS8995_REG_GC6   0x08 /* Global Control 6 */
 
#define KS8995_REG_GC7   0x09 /* Global Control 7 */
 
#define KS8995_REG_GC8   0x0a /* Global Control 8 */
 
#define KS8995_REG_GC9   0x0b /* Global Control 9 */
 
#define KS8995_REG_PC(p, r)   ((0x10 * p) + r) /* Port Control */
 
#define KS8995_REG_PS(p, r)   ((0x10 * p) + r + 0xe) /* Port Status */
 
#define KS8995_REG_TPC0   0x60 /* TOS Priority Control 0 */
 
#define KS8995_REG_TPC1   0x61 /* TOS Priority Control 1 */
 
#define KS8995_REG_TPC2   0x62 /* TOS Priority Control 2 */
 
#define KS8995_REG_TPC3   0x63 /* TOS Priority Control 3 */
 
#define KS8995_REG_TPC4   0x64 /* TOS Priority Control 4 */
 
#define KS8995_REG_TPC5   0x65 /* TOS Priority Control 5 */
 
#define KS8995_REG_TPC6   0x66 /* TOS Priority Control 6 */
 
#define KS8995_REG_TPC7   0x67 /* TOS Priority Control 7 */
 
#define KS8995_REG_MAC0   0x68 /* MAC address 0 */
 
#define KS8995_REG_MAC1   0x69 /* MAC address 1 */
 
#define KS8995_REG_MAC2   0x6a /* MAC address 2 */
 
#define KS8995_REG_MAC3   0x6b /* MAC address 3 */
 
#define KS8995_REG_MAC4   0x6c /* MAC address 4 */
 
#define KS8995_REG_MAC5   0x6d /* MAC address 5 */
 
#define KS8995_REG_IAC0   0x6e /* Indirect Access Control 0 */
 
#define KS8995_REG_IAC1   0x6f /* Indirect Access Control 0 */
 
#define KS8995_REG_IAD7   0x70 /* Indirect Access Data 7 */
 
#define KS8995_REG_IAD6   0x71 /* Indirect Access Data 6 */
 
#define KS8995_REG_IAD5   0x72 /* Indirect Access Data 5 */
 
#define KS8995_REG_IAD4   0x73 /* Indirect Access Data 4 */
 
#define KS8995_REG_IAD3   0x74 /* Indirect Access Data 3 */
 
#define KS8995_REG_IAD2   0x75 /* Indirect Access Data 2 */
 
#define KS8995_REG_IAD1   0x76 /* Indirect Access Data 1 */
 
#define KS8995_REG_IAD0   0x77 /* Indirect Access Data 0 */
 
#define KS8995_REGS_SIZE   0x80
 
#define ID1_CHIPID_M   0xf
 
#define ID1_CHIPID_S   4
 
#define ID1_REVISION_M   0x7
 
#define ID1_REVISION_S   1
 
#define ID1_START_SW   1 /* start the switch */
 
#define FAMILY_KS8995   0x95
 
#define CHIPID_M   0
 
#define KS8995_CMD_WRITE   0x02U
 
#define KS8995_CMD_READ   0x03U
 
#define KS8995_RESET_DELAY   10 /* usec */
 

Functions

 module_init (ks8995_init)
 
 module_exit (ks8995_exit)
 
 MODULE_DESCRIPTION (DRV_DESC)
 
 MODULE_VERSION (DRV_VERSION)
 
 MODULE_AUTHOR ("Gabor Juhos <juhosg at openwrt.org>")
 
 MODULE_LICENSE ("GPL v2")
 

Macro Definition Documentation

#define CHIPID_M   0

Definition at line 83 of file spi_ks8995.c.

#define DRV_DESC   "Micrel KS8995 Ethernet switch SPI driver"

Definition at line 26 of file spi_ks8995.c.

#define DRV_VERSION   "0.1.1"

Definition at line 25 of file spi_ks8995.c.

#define FAMILY_KS8995   0x95

Definition at line 82 of file spi_ks8995.c.

#define ID1_CHIPID_M   0xf

Definition at line 76 of file spi_ks8995.c.

#define ID1_CHIPID_S   4

Definition at line 77 of file spi_ks8995.c.

#define ID1_REVISION_M   0x7

Definition at line 78 of file spi_ks8995.c.

#define ID1_REVISION_S   1

Definition at line 79 of file spi_ks8995.c.

#define ID1_START_SW   1 /* start the switch */

Definition at line 80 of file spi_ks8995.c.

#define KS8995_CMD_READ   0x03U

Definition at line 86 of file spi_ks8995.c.

#define KS8995_CMD_WRITE   0x02U

Definition at line 85 of file spi_ks8995.c.

#define KS8995_REG_GC0   0x02 /* Global Control 0 */

Definition at line 33 of file spi_ks8995.c.

#define KS8995_REG_GC1   0x03 /* Global Control 1 */

Definition at line 34 of file spi_ks8995.c.

#define KS8995_REG_GC2   0x04 /* Global Control 2 */

Definition at line 35 of file spi_ks8995.c.

#define KS8995_REG_GC3   0x05 /* Global Control 3 */

Definition at line 36 of file spi_ks8995.c.

#define KS8995_REG_GC4   0x06 /* Global Control 4 */

Definition at line 37 of file spi_ks8995.c.

#define KS8995_REG_GC5   0x07 /* Global Control 5 */

Definition at line 38 of file spi_ks8995.c.

#define KS8995_REG_GC6   0x08 /* Global Control 6 */

Definition at line 39 of file spi_ks8995.c.

#define KS8995_REG_GC7   0x09 /* Global Control 7 */

Definition at line 40 of file spi_ks8995.c.

#define KS8995_REG_GC8   0x0a /* Global Control 8 */

Definition at line 41 of file spi_ks8995.c.

#define KS8995_REG_GC9   0x0b /* Global Control 9 */

Definition at line 42 of file spi_ks8995.c.

#define KS8995_REG_IAC0   0x6e /* Indirect Access Control 0 */

Definition at line 63 of file spi_ks8995.c.

#define KS8995_REG_IAC1   0x6f /* Indirect Access Control 0 */

Definition at line 64 of file spi_ks8995.c.

#define KS8995_REG_IAD0   0x77 /* Indirect Access Data 0 */

Definition at line 72 of file spi_ks8995.c.

#define KS8995_REG_IAD1   0x76 /* Indirect Access Data 1 */

Definition at line 71 of file spi_ks8995.c.

#define KS8995_REG_IAD2   0x75 /* Indirect Access Data 2 */

Definition at line 70 of file spi_ks8995.c.

#define KS8995_REG_IAD3   0x74 /* Indirect Access Data 3 */

Definition at line 69 of file spi_ks8995.c.

#define KS8995_REG_IAD4   0x73 /* Indirect Access Data 4 */

Definition at line 68 of file spi_ks8995.c.

#define KS8995_REG_IAD5   0x72 /* Indirect Access Data 5 */

Definition at line 67 of file spi_ks8995.c.

#define KS8995_REG_IAD6   0x71 /* Indirect Access Data 6 */

Definition at line 66 of file spi_ks8995.c.

#define KS8995_REG_IAD7   0x70 /* Indirect Access Data 7 */

Definition at line 65 of file spi_ks8995.c.

#define KS8995_REG_ID0   0x00 /* Chip ID0 */

Definition at line 30 of file spi_ks8995.c.

#define KS8995_REG_ID1   0x01 /* Chip ID1 */

Definition at line 31 of file spi_ks8995.c.

#define KS8995_REG_MAC0   0x68 /* MAC address 0 */

Definition at line 56 of file spi_ks8995.c.

#define KS8995_REG_MAC1   0x69 /* MAC address 1 */

Definition at line 57 of file spi_ks8995.c.

#define KS8995_REG_MAC2   0x6a /* MAC address 2 */

Definition at line 58 of file spi_ks8995.c.

#define KS8995_REG_MAC3   0x6b /* MAC address 3 */

Definition at line 59 of file spi_ks8995.c.

#define KS8995_REG_MAC4   0x6c /* MAC address 4 */

Definition at line 60 of file spi_ks8995.c.

#define KS8995_REG_MAC5   0x6d /* MAC address 5 */

Definition at line 61 of file spi_ks8995.c.

#define KS8995_REG_PC (   p,
  r 
)    ((0x10 * p) + r) /* Port Control */

Definition at line 44 of file spi_ks8995.c.

#define KS8995_REG_PS (   p,
  r 
)    ((0x10 * p) + r + 0xe) /* Port Status */

Definition at line 45 of file spi_ks8995.c.

#define KS8995_REG_TPC0   0x60 /* TOS Priority Control 0 */

Definition at line 47 of file spi_ks8995.c.

#define KS8995_REG_TPC1   0x61 /* TOS Priority Control 1 */

Definition at line 48 of file spi_ks8995.c.

#define KS8995_REG_TPC2   0x62 /* TOS Priority Control 2 */

Definition at line 49 of file spi_ks8995.c.

#define KS8995_REG_TPC3   0x63 /* TOS Priority Control 3 */

Definition at line 50 of file spi_ks8995.c.

#define KS8995_REG_TPC4   0x64 /* TOS Priority Control 4 */

Definition at line 51 of file spi_ks8995.c.

#define KS8995_REG_TPC5   0x65 /* TOS Priority Control 5 */

Definition at line 52 of file spi_ks8995.c.

#define KS8995_REG_TPC6   0x66 /* TOS Priority Control 6 */

Definition at line 53 of file spi_ks8995.c.

#define KS8995_REG_TPC7   0x67 /* TOS Priority Control 7 */

Definition at line 54 of file spi_ks8995.c.

#define KS8995_REGS_SIZE   0x80

Definition at line 74 of file spi_ks8995.c.

#define KS8995_RESET_DELAY   10 /* usec */

Definition at line 88 of file spi_ks8995.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 14 of file spi_ks8995.c.

Function Documentation

MODULE_AUTHOR ( "Gabor Juhos <juhosg at openwrt.org>"  )
MODULE_DESCRIPTION ( DRV_DESC  )
module_exit ( ks8995_exit  )
module_init ( ks8995_init  )
MODULE_LICENSE ( "GPL v2 )
MODULE_VERSION ( DRV_VERSION  )