diff options
author | Logan Gunthorpe <logang@deltatee.com> | 2017-08-03 12:19:49 -0600 |
---|---|---|
committer | Jon Mason <jdmason@kudzu.us> | 2017-11-18 20:37:12 -0500 |
commit | e099b45b7c27b4fc6510918ea8c7d18980787283 (patch) | |
tree | 4bfa91837a09d678313bfa31011ce19771eb5d44 /drivers/ntb | |
parent | 3dd4db475cfe172bb01bab89aa63bf7939b2a584 (diff) | |
download | linux-e099b45b7c27b4fc6510918ea8c7d18980787283.tar.bz2 |
NTB: switchtec_ntb: Add skeleton NTB driver
Add a skeleton NTB driver which will be filled out in subsequent patches.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Stephen Bates <sbates@raithlin.com>
Reviewed-by: Kurt Schwemmer <kurt.schwemmer@microsemi.com>
Acked-by: Allen Hubbe <Allen.Hubbe@dell.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
Diffstat (limited to 'drivers/ntb')
-rw-r--r-- | drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 148 |
1 files changed, 147 insertions, 1 deletions
diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c index 175ac0baa7a0..158ed310cbaf 100644 --- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c +++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c @@ -18,6 +18,7 @@ #include <linux/delay.h> #include <linux/kthread.h> #include <linux/interrupt.h> +#include <linux/ntb.h> MODULE_DESCRIPTION("Microsemi Switchtec(tm) NTB Driver"); MODULE_VERSION("0.1"); @@ -71,6 +72,7 @@ struct shared_mw { #define LUT_SIZE SZ_64K struct switchtec_ntb { + struct ntb_dev ntb; struct switchtec_dev *stdev; int self_partition; @@ -161,10 +163,148 @@ static int switchtec_ntb_part_op(struct switchtec_ntb *sndev, return -EIO; } +static int switchtec_ntb_mw_count(struct ntb_dev *ntb, int pidx) +{ + return 0; +} + +static int switchtec_ntb_mw_get_align(struct ntb_dev *ntb, int pidx, + int widx, resource_size_t *addr_align, + resource_size_t *size_align, + resource_size_t *size_max) +{ + return 0; +} + +static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx, + dma_addr_t addr, resource_size_t size) +{ + return 0; +} + +static int switchtec_ntb_peer_mw_count(struct ntb_dev *ntb) +{ + return 0; +} + +static int switchtec_ntb_peer_mw_get_addr(struct ntb_dev *ntb, int idx, + phys_addr_t *base, + resource_size_t *size) +{ + return 0; +} + +static u64 switchtec_ntb_link_is_up(struct ntb_dev *ntb, + enum ntb_speed *speed, + enum ntb_width *width) +{ + return 0; +} + +static int switchtec_ntb_link_enable(struct ntb_dev *ntb, + enum ntb_speed max_speed, + enum ntb_width max_width) +{ + return 0; +} + +static int switchtec_ntb_link_disable(struct ntb_dev *ntb) +{ + return 0; +} + +static u64 switchtec_ntb_db_valid_mask(struct ntb_dev *ntb) +{ + return 0; +} + +static int switchtec_ntb_db_vector_count(struct ntb_dev *ntb) +{ + return 0; +} + +static u64 switchtec_ntb_db_vector_mask(struct ntb_dev *ntb, int db_vector) +{ + return 0; +} + +static u64 switchtec_ntb_db_read(struct ntb_dev *ntb) +{ + return 0; +} + +static int switchtec_ntb_db_clear(struct ntb_dev *ntb, u64 db_bits) +{ + return 0; +} + +static int switchtec_ntb_db_set_mask(struct ntb_dev *ntb, u64 db_bits) +{ + return 0; +} + +static int switchtec_ntb_db_clear_mask(struct ntb_dev *ntb, u64 db_bits) +{ + return 0; +} + +static int switchtec_ntb_peer_db_set(struct ntb_dev *ntb, u64 db_bits) +{ + return 0; +} + +static int switchtec_ntb_spad_count(struct ntb_dev *ntb) +{ + return 0; +} + +static u32 switchtec_ntb_spad_read(struct ntb_dev *ntb, int idx) +{ + return 0; +} + +static int switchtec_ntb_spad_write(struct ntb_dev *ntb, int idx, u32 val) +{ + return 0; +} + +static int switchtec_ntb_peer_spad_write(struct ntb_dev *ntb, int pidx, + int sidx, u32 val) +{ + return 0; +} + +static const struct ntb_dev_ops switchtec_ntb_ops = { + .mw_count = switchtec_ntb_mw_count, + .mw_get_align = switchtec_ntb_mw_get_align, + .mw_set_trans = switchtec_ntb_mw_set_trans, + .peer_mw_count = switchtec_ntb_peer_mw_count, + .peer_mw_get_addr = switchtec_ntb_peer_mw_get_addr, + .link_is_up = switchtec_ntb_link_is_up, + .link_enable = switchtec_ntb_link_enable, + .link_disable = switchtec_ntb_link_disable, + .db_valid_mask = switchtec_ntb_db_valid_mask, + .db_vector_count = switchtec_ntb_db_vector_count, + .db_vector_mask = switchtec_ntb_db_vector_mask, + .db_read = switchtec_ntb_db_read, + .db_clear = switchtec_ntb_db_clear, + .db_set_mask = switchtec_ntb_db_set_mask, + .db_clear_mask = switchtec_ntb_db_clear_mask, + .peer_db_set = switchtec_ntb_peer_db_set, + .spad_count = switchtec_ntb_spad_count, + .spad_read = switchtec_ntb_spad_read, + .spad_write = switchtec_ntb_spad_write, + .peer_spad_write = switchtec_ntb_peer_spad_write, +}; + static void switchtec_ntb_init_sndev(struct switchtec_ntb *sndev) { u64 part_map; + sndev->ntb.pdev = sndev->stdev->pdev; + sndev->ntb.topo = NTB_TOPO_SWITCH; + sndev->ntb.ops = &switchtec_ntb_ops; + sndev->self_partition = sndev->stdev->partition; sndev->mmio_ntb = sndev->stdev->mmio_ntb; @@ -517,7 +657,6 @@ static int switchtec_ntb_add(struct device *dev, return -ENOMEM; sndev->stdev = stdev; - switchtec_ntb_init_sndev(sndev); switchtec_ntb_init_mw(sndev); switchtec_ntb_init_db(sndev); @@ -535,11 +674,17 @@ static int switchtec_ntb_add(struct device *dev, if (rc) goto deinit_shared_and_exit; + rc = ntb_register_device(&sndev->ntb); + if (rc) + goto deinit_and_exit; + stdev->sndev = sndev; dev_info(dev, "NTB device registered"); return 0; +deinit_and_exit: + switchtec_ntb_deinit_db_msg_irq(sndev); deinit_shared_and_exit: switchtec_ntb_deinit_shared_mw(sndev); free_and_exit: @@ -558,6 +703,7 @@ void switchtec_ntb_remove(struct device *dev, return; stdev->sndev = NULL; + ntb_unregister_device(&sndev->ntb); switchtec_ntb_deinit_db_msg_irq(sndev); switchtec_ntb_deinit_shared_mw(sndev); kfree(sndev); |