linux/drivers/ata/sata_gemini.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Cortina Systems Gemini SATA bridge add-on to Faraday FTIDE010
 * Copyright (C) 2017 Linus Walleij <[email protected]>
 */

#include <linux/init.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/bitops.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
#include <linux/delay.h>
#include <linux/reset.h>
#include <linux/of.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/pinctrl/consumer.h>
#include "sata_gemini.h"

#define DRV_NAME

/**
 * struct sata_gemini - a state container for a Gemini SATA bridge
 * @dev: the containing device
 * @base: remapped I/O memory base
 * @muxmode: the current muxing mode
 * @ide_pins: if the device is using the plain IDE interface pins
 * @sata_bridge: if the device enables the SATA bridge
 * @sata0_reset: SATA0 reset handler
 * @sata1_reset: SATA1 reset handler
 * @sata0_pclk: SATA0 PCLK handler
 * @sata1_pclk: SATA1 PCLK handler
 */
struct sata_gemini {};

/* Miscellaneous Control Register */
#define GEMINI_GLOBAL_MISC_CTRL
/*
 * Values of IDE IOMUX bits in the misc control register
 *
 * Bits 26:24 are "IDE IO Select", which decides what SATA
 * adapters are connected to which of the two IDE/ATA
 * controllers in the Gemini. We can connect the two IDE blocks
 * to one SATA adapter each, both acting as master, or one IDE
 * blocks to two SATA adapters so the IDE block can act in a
 * master/slave configuration.
 *
 * We also bring out different blocks on the actual IDE
 * pins (not SATA pins) if (and only if) these are muxed in.
 *
 * 111-100 - Reserved
 * Mode 0: 000 - ata0 master <-> sata0
 *               ata1 master <-> sata1
 *               ata0 slave interface brought out on IDE pads
 * Mode 1: 001 - ata0 master <-> sata0
 *               ata1 master <-> sata1
 *               ata1 slave interface brought out on IDE pads
 * Mode 2: 010 - ata1 master <-> sata1
 *               ata1 slave  <-> sata0
 *               ata0 master and slave interfaces brought out
 *                    on IDE pads
 * Mode 3: 011 - ata0 master <-> sata0
 *               ata1 slave  <-> sata1
 *               ata1 master and slave interfaces brought out
 *                    on IDE pads
 */
#define GEMINI_IDE_IOMUX_MASK
#define GEMINI_IDE_IOMUX_MODE0
#define GEMINI_IDE_IOMUX_MODE1
#define GEMINI_IDE_IOMUX_MODE2
#define GEMINI_IDE_IOMUX_MODE3
#define GEMINI_IDE_IOMUX_SHIFT

/*
 * Registers directly controlling the PATA<->SATA adapters
 */
#define GEMINI_SATA_ID
#define GEMINI_SATA_PHY_ID
#define GEMINI_SATA0_STATUS
#define GEMINI_SATA1_STATUS
#define GEMINI_SATA0_CTRL
#define GEMINI_SATA1_CTRL

#define GEMINI_SATA_STATUS_BIST_DONE
#define GEMINI_SATA_STATUS_BIST_OK
#define GEMINI_SATA_STATUS_PHY_READY

#define GEMINI_SATA_CTRL_PHY_BIST_EN
#define GEMINI_SATA_CTRL_PHY_FORCE_IDLE
#define GEMINI_SATA_CTRL_PHY_FORCE_READY
#define GEMINI_SATA_CTRL_PHY_AFE_LOOP_EN
#define GEMINI_SATA_CTRL_PHY_DIG_LOOP_EN
#define GEMINI_SATA_CTRL_HOTPLUG_DETECT_EN
#define GEMINI_SATA_CTRL_ATAPI_EN
#define GEMINI_SATA_CTRL_BUS_WITH_20
#define GEMINI_SATA_CTRL_SLAVE_EN
#define GEMINI_SATA_CTRL_EN

/*
 * There is only ever one instance of this bridge on a system,
 * so create a singleton so that the FTIDE010 instances can grab
 * a reference to it.
 */
static struct sata_gemini *sg_singleton;

struct sata_gemini *gemini_sata_bridge_get(void)
{}
EXPORT_SYMBOL();

bool gemini_sata_bridge_enabled(struct sata_gemini *sg, bool is_ata1)
{}
EXPORT_SYMBOL();

enum gemini_muxmode gemini_sata_get_muxmode(struct sata_gemini *sg)
{}
EXPORT_SYMBOL();

static int gemini_sata_setup_bridge(struct sata_gemini *sg,
				    unsigned int bridge)
{}

int gemini_sata_start_bridge(struct sata_gemini *sg, unsigned int bridge)
{}
EXPORT_SYMBOL();

void gemini_sata_stop_bridge(struct sata_gemini *sg, unsigned int bridge)
{}
EXPORT_SYMBOL();

int gemini_sata_reset_bridge(struct sata_gemini *sg,
			     unsigned int bridge)
{}
EXPORT_SYMBOL();

static int gemini_sata_bridge_init(struct sata_gemini *sg)
{}

static int gemini_setup_ide_pins(struct device *dev)
{}

static int gemini_sata_probe(struct platform_device *pdev)
{}

static void gemini_sata_remove(struct platform_device *pdev)
{}

static const struct of_device_id gemini_sata_of_match[] =;

static struct platform_driver gemini_sata_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_ALIAS();