linux/drivers/ssb/pcmcia.c

/*
 * Sonics Silicon Backplane
 * PCMCIA-Hostbus related functions
 *
 * Copyright 2006 Johannes Berg <[email protected]>
 * Copyright 2007-2008 Michael Buesch <[email protected]>
 *
 * Licensed under the GNU/GPL. See COPYING for details.
 */

#include "ssb_private.h"

#include <linux/ssb/ssb.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/etherdevice.h>

#include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h>
#include <pcmcia/ds.h>
#include <pcmcia/cisreg.h>


/* Define the following to 1 to enable a printk on each coreswitch. */
#define SSB_VERBOSE_PCMCIACORESWITCH_DEBUG


/* PCMCIA configuration registers */
#define SSB_PCMCIA_ADDRESS0
#define SSB_PCMCIA_ADDRESS1
#define SSB_PCMCIA_ADDRESS2
#define SSB_PCMCIA_MEMSEG
#define SSB_PCMCIA_SPROMCTL
#define SSB_PCMCIA_SPROMCTL_IDLE
#define SSB_PCMCIA_SPROMCTL_WRITE
#define SSB_PCMCIA_SPROMCTL_READ
#define SSB_PCMCIA_SPROMCTL_WRITEEN
#define SSB_PCMCIA_SPROMCTL_WRITEDIS
#define SSB_PCMCIA_SPROMCTL_DONE
#define SSB_PCMCIA_SPROM_DATALO
#define SSB_PCMCIA_SPROM_DATAHI
#define SSB_PCMCIA_SPROM_ADDRLO
#define SSB_PCMCIA_SPROM_ADDRHI

/* Hardware invariants CIS tuples */
#define SSB_PCMCIA_CIS
#define SSB_PCMCIA_CIS_ID
#define SSB_PCMCIA_CIS_BOARDREV
#define SSB_PCMCIA_CIS_PA
#define SSB_PCMCIA_CIS_PA_PA0B0_LO
#define SSB_PCMCIA_CIS_PA_PA0B0_HI
#define SSB_PCMCIA_CIS_PA_PA0B1_LO
#define SSB_PCMCIA_CIS_PA_PA0B1_HI
#define SSB_PCMCIA_CIS_PA_PA0B2_LO
#define SSB_PCMCIA_CIS_PA_PA0B2_HI
#define SSB_PCMCIA_CIS_PA_ITSSI
#define SSB_PCMCIA_CIS_PA_MAXPOW
#define SSB_PCMCIA_CIS_OEMNAME
#define SSB_PCMCIA_CIS_CCODE
#define SSB_PCMCIA_CIS_ANTENNA
#define SSB_PCMCIA_CIS_ANTGAIN
#define SSB_PCMCIA_CIS_BFLAGS
#define SSB_PCMCIA_CIS_LEDS

/* PCMCIA SPROM size. */
#define SSB_PCMCIA_SPROM_SIZE
#define SSB_PCMCIA_SPROM_SIZE_BYTES


/* Write to a PCMCIA configuration register. */
static int ssb_pcmcia_cfg_write(struct ssb_bus *bus, u8 offset, u8 value)
{}

/* Read from a PCMCIA configuration register. */
static int ssb_pcmcia_cfg_read(struct ssb_bus *bus, u8 offset, u8 *value)
{}

int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
			      u8 coreidx)
{}

static int ssb_pcmcia_switch_core(struct ssb_bus *bus, struct ssb_device *dev)
{}

int ssb_pcmcia_switch_segment(struct ssb_bus *bus, u8 seg)
{}

static int select_core_and_segment(struct ssb_device *dev,
				   u16 *offset)
{}

static u8 ssb_pcmcia_read8(struct ssb_device *dev, u16 offset)
{}

static u16 ssb_pcmcia_read16(struct ssb_device *dev, u16 offset)
{}

static u32 ssb_pcmcia_read32(struct ssb_device *dev, u16 offset)
{}

#ifdef CONFIG_SSB_BLOCKIO
static void ssb_pcmcia_block_read(struct ssb_device *dev, void *buffer,
				  size_t count, u16 offset, u8 reg_width)
{}
#endif /* CONFIG_SSB_BLOCKIO */

static void ssb_pcmcia_write8(struct ssb_device *dev, u16 offset, u8 value)
{}

static void ssb_pcmcia_write16(struct ssb_device *dev, u16 offset, u16 value)
{}

static void ssb_pcmcia_write32(struct ssb_device *dev, u16 offset, u32 value)
{}

#ifdef CONFIG_SSB_BLOCKIO
static void ssb_pcmcia_block_write(struct ssb_device *dev, const void *buffer,
				   size_t count, u16 offset, u8 reg_width)
{}
#endif /* CONFIG_SSB_BLOCKIO */

/* Not "static", as it's used in main.c */
const struct ssb_bus_ops ssb_pcmcia_ops =;

static int ssb_pcmcia_sprom_command(struct ssb_bus *bus, u8 command)
{}

/* offset is the 16bit word offset */
static int ssb_pcmcia_sprom_read(struct ssb_bus *bus, u16 offset, u16 *value)
{}

/* offset is the 16bit word offset */
static int ssb_pcmcia_sprom_write(struct ssb_bus *bus, u16 offset, u16 value)
{}

/* Read the SPROM image. bufsize is in 16bit words. */
static int ssb_pcmcia_sprom_read_all(struct ssb_bus *bus, u16 *sprom)
{}

/* Write the SPROM image. size is in 16bit words. */
static int ssb_pcmcia_sprom_write_all(struct ssb_bus *bus, const u16 *sprom)
{}

static int ssb_pcmcia_sprom_check_crc(const u16 *sprom, size_t size)
{}

#define GOTO_ERROR_ON(condition, description)

static int ssb_pcmcia_get_mac(struct pcmcia_device *p_dev,
			tuple_t *tuple,
			void *priv)
{
	struct ssb_sprom *sprom = priv;

	if (tuple->TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID)
		return -EINVAL;
	if (tuple->TupleDataLen != ETH_ALEN + 2)
		return -EINVAL;
	if (tuple->TupleData[1] != ETH_ALEN)
		return -EINVAL;
	memcpy(sprom->il0mac, &tuple->TupleData[2], ETH_ALEN);
	return 0;
};

static int ssb_pcmcia_do_get_invariants(struct pcmcia_device *p_dev,
					tuple_t *tuple,
					void *priv)
{}


int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
			      struct ssb_init_invariants *iv)
{}

static ssize_t ssb_sprom_show(struct device *pcmciadev,
			      struct device_attribute *attr,
			      char *buf)
{}

static ssize_t ssb_sprom_store(struct device *pcmciadev,
			       struct device_attribute *attr,
			       const char *buf, size_t count)
{}

static DEVICE_ATTR_ADMIN_RW(ssb_sprom);

static int ssb_pcmcia_cor_setup(struct ssb_bus *bus, u8 cor)
{}

/* Initialize the PCMCIA hardware. This is called on Init and Resume. */
int ssb_pcmcia_hardware_setup(struct ssb_bus *bus)
{}

void ssb_pcmcia_exit(struct ssb_bus *bus)
{}

int ssb_pcmcia_init(struct ssb_bus *bus)
{}