blob: 87f4b61028ebf3f2a34ff32b162a98ea79ae5a6a [file] [log] [blame]
John Garrye8899fa2015-11-18 00:50:30 +08001/*
2 * Copyright (c) 2015 Linaro Ltd.
3 * Copyright (c) 2015 Hisilicon Limited.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 */
11
12#ifndef _HISI_SAS_H_
13#define _HISI_SAS_H_
14
15#include <linux/dmapool.h>
16#include <linux/mfd/syscon.h>
17#include <linux/module.h>
18#include <linux/of_address.h>
19#include <linux/of_irq.h>
20#include <linux/platform_device.h>
21#include <linux/regmap.h>
22#include <scsi/libsas.h>
23
24#define DRV_VERSION "v1.0"
25
John Garry7eb78692015-11-18 00:50:31 +080026#define HISI_SAS_MAX_PHYS 9
27#define HISI_SAS_MAX_ITCT_ENTRIES 4096
28#define HISI_SAS_MAX_DEVICES HISI_SAS_MAX_ITCT_ENTRIES
29#define HISI_SAS_COMMAND_ENTRIES 8192
30
John Garrye26b2f42015-11-18 00:50:32 +080031#define HISI_SAS_NAME_LEN 32
32
John Garry7eb78692015-11-18 00:50:31 +080033struct hisi_sas_phy {
34 struct asd_sas_phy sas_phy;
35};
36
37struct hisi_sas_port {
38 struct asd_sas_port sas_port;
39};
40
41struct hisi_sas_hw {
42};
43
44struct hisi_hba {
45 /* This must be the first element, used by SHOST_TO_SAS_HA */
46 struct sas_ha_struct *p;
47
48 struct platform_device *pdev;
John Garrye26b2f42015-11-18 00:50:32 +080049 void __iomem *regs;
50 struct regmap *ctrl;
51 u32 ctrl_reset_reg;
52 u32 ctrl_reset_sts_reg;
53 u32 ctrl_clock_ena_reg;
John Garry7eb78692015-11-18 00:50:31 +080054 u8 sas_addr[SAS_ADDR_SIZE];
55
56 int n_phy;
57
58 /* SCSI/SAS glue */
59 struct sas_ha_struct sha;
60 struct Scsi_Host *shost;
61 struct hisi_sas_phy phy[HISI_SAS_MAX_PHYS];
62 struct hisi_sas_port port[HISI_SAS_MAX_PHYS];
John Garrye26b2f42015-11-18 00:50:32 +080063
64 int queue_count;
65 char *int_names;
John Garry7eb78692015-11-18 00:50:31 +080066 const struct hisi_sas_hw *hw; /* Low level hw interface */
67};
68
69#define HISI_SAS_SGE_PAGE_CNT SCSI_MAX_SG_SEGMENTS
John Garrye8899fa2015-11-18 00:50:30 +080070#endif