John Garry | e8899fa | 2015-11-18 00:50:30 +0800 | [diff] [blame] | 1 | /* |
| 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 Garry | 7eb7869 | 2015-11-18 00:50:31 +0800 | [diff] [blame] | 26 | #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 Garry | e26b2f4 | 2015-11-18 00:50:32 +0800 | [diff] [blame^] | 31 | #define HISI_SAS_NAME_LEN 32 |
| 32 | |
John Garry | 7eb7869 | 2015-11-18 00:50:31 +0800 | [diff] [blame] | 33 | struct hisi_sas_phy { |
| 34 | struct asd_sas_phy sas_phy; |
| 35 | }; |
| 36 | |
| 37 | struct hisi_sas_port { |
| 38 | struct asd_sas_port sas_port; |
| 39 | }; |
| 40 | |
| 41 | struct hisi_sas_hw { |
| 42 | }; |
| 43 | |
| 44 | struct 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 Garry | e26b2f4 | 2015-11-18 00:50:32 +0800 | [diff] [blame^] | 49 | 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 Garry | 7eb7869 | 2015-11-18 00:50:31 +0800 | [diff] [blame] | 54 | 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 Garry | e26b2f4 | 2015-11-18 00:50:32 +0800 | [diff] [blame^] | 63 | |
| 64 | int queue_count; |
| 65 | char *int_names; |
John Garry | 7eb7869 | 2015-11-18 00:50:31 +0800 | [diff] [blame] | 66 | const struct hisi_sas_hw *hw; /* Low level hw interface */ |
| 67 | }; |
| 68 | |
| 69 | #define HISI_SAS_SGE_PAGE_CNT SCSI_MAX_SG_SEGMENTS |
John Garry | e8899fa | 2015-11-18 00:50:30 +0800 | [diff] [blame] | 70 | #endif |