linux/drivers/ssb/sdio.c

/*
 * Sonics Silicon Backplane
 * SDIO-Hostbus related functions
 *
 * Copyright 2009 Albert Herranz <[email protected]>
 *
 * Based on drivers/ssb/pcmcia.c
 * 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 <linux/mmc/sdio_func.h>

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


/* Hardware invariants CIS tuples */
#define SSB_SDIO_CIS
#define SSB_SDIO_CIS_SROMREV
#define SSB_SDIO_CIS_ID
#define SSB_SDIO_CIS_BOARDREV
#define SSB_SDIO_CIS_PA
#define SSB_SDIO_CIS_PA_PA0B0_LO
#define SSB_SDIO_CIS_PA_PA0B0_HI
#define SSB_SDIO_CIS_PA_PA0B1_LO
#define SSB_SDIO_CIS_PA_PA0B1_HI
#define SSB_SDIO_CIS_PA_PA0B2_LO
#define SSB_SDIO_CIS_PA_PA0B2_HI
#define SSB_SDIO_CIS_PA_ITSSI
#define SSB_SDIO_CIS_PA_MAXPOW
#define SSB_SDIO_CIS_OEMNAME
#define SSB_SDIO_CIS_CCODE
#define SSB_SDIO_CIS_ANTENNA
#define SSB_SDIO_CIS_ANTGAIN
#define SSB_SDIO_CIS_BFLAGS
#define SSB_SDIO_CIS_LEDS

#define CISTPL_FUNCE_LAN_NODE_ID


/*
 * Function 1 miscellaneous registers.
 *
 * Definitions match src/include/sbsdio.h from the
 * Android Open Source Project
 * http://android.git.kernel.org/?p=platform/system/wlan/broadcom.git
 *
 */
#define SBSDIO_FUNC1_SBADDRLOW
#define SBSDIO_FUNC1_SBADDRMID
#define SBSDIO_FUNC1_SBADDRHIGH

/* valid bits in SBSDIO_FUNC1_SBADDRxxx regs */
#define SBSDIO_SBADDRLOW_MASK
#define SBSDIO_SBADDRMID_MASK
#define SBSDIO_SBADDRHIGH_MASK

#define SBSDIO_SB_OFT_ADDR_MASK

/* REVISIT: this flag doesn't seem to matter */
#define SBSDIO_SB_ACCESS_2_4B_FLAG


/*
 * Address map within the SDIO function address space (128K).
 *
 *   Start   End     Description
 *   ------- ------- ------------------------------------------
 *   0x00000 0x0ffff selected backplane address window (64K)
 *   0x10000 0x1ffff backplane control registers (max 64K)
 *
 * The current address window is configured by writing to registers
 * SBADDRLOW, SBADDRMID and SBADDRHIGH.
 *
 * In order to access the contents of a 32-bit Silicon Backplane address
 * the backplane address window must be first loaded with the highest
 * 16 bits of the target address. Then, an access must be done to the
 * SDIO function address space using the lower 15 bits of the address.
 * Bit 15 of the address must be set when doing 32 bit accesses.
 *
 * 10987654321098765432109876543210
 * WWWWWWWWWWWWWWWWW                 SB Address Window
 *                 OOOOOOOOOOOOOOOO  Offset within SB Address Window
 *                 a                 32-bit access flag
 */


/*
 * SSB I/O via SDIO.
 *
 * NOTE: SDIO address @addr is 17 bits long (SDIO address space is 128K).
 */

static inline struct device *ssb_sdio_dev(struct ssb_bus *bus)
{}

/* host claimed */
static int ssb_sdio_writeb(struct ssb_bus *bus, unsigned int addr, u8 val)
{}

#if 0
static u8 ssb_sdio_readb(struct ssb_bus *bus, unsigned int addr)
{
	u8 val;
	int error = 0;

	val = sdio_readb(bus->host_sdio, addr, &error);
	if (unlikely(error)) {
		dev_dbg(ssb_sdio_dev(bus), "%08X -> %02x, error %d\n",
			addr, val, error);
	}

	return val;
}
#endif

/* host claimed */
static int ssb_sdio_set_sbaddr_window(struct ssb_bus *bus, u32 address)
{}

/* for enumeration use only */
u32 ssb_sdio_scan_read32(struct ssb_bus *bus, u16 offset)
{}

/* for enumeration use only */
int ssb_sdio_scan_switch_coreidx(struct ssb_bus *bus, u8 coreidx)
{}

/* host must be already claimed */
static int ssb_sdio_switch_core(struct ssb_bus *bus, struct ssb_device *dev)
{}

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

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

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

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

static void ssb_sdio_write8(struct ssb_device *dev, u16 offset, u8 val)
{}

static void ssb_sdio_write16(struct ssb_device *dev, u16 offset, u16 val)
{}

static void ssb_sdio_write32(struct ssb_device *dev, u16 offset, u32 val)
{}

#ifdef CONFIG_SSB_BLOCKIO
static void ssb_sdio_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_sdio_ops =;

#define GOTO_ERROR_ON(condition, description)

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

void ssb_sdio_exit(struct ssb_bus *bus)
{}

int ssb_sdio_init(struct ssb_bus *bus)
{}