Skip to content

Commit 0f7da92

Browse files
committed
Add support for GEN5 devices in kernel driver code
GEN5 device is fully compatible with GEN4 at the kernel driver level
1 parent feed9d8 commit 0f7da92

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

switchtec.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ static ssize_t field ## _show(struct device *dev, \
363363
struct switchtec_dev *stdev = to_stdev(dev); \
364364
struct sys_info_regs __iomem *si = stdev->mmio_sys_info; \
365365
\
366-
if (stdev->gen == SWITCHTEC_GEN4) \
366+
if (stdev->gen >= SWITCHTEC_GEN4) \
367367
return io_string_show(buf, &si->gen4.field, \
368368
sizeof(si->gen4.field)); \
369369
else \
@@ -655,7 +655,7 @@ static int ioctl_flash_info(struct switchtec_dev *stdev,
655655
if (stdev->gen == SWITCHTEC_GEN3) {
656656
info.flash_length = ioread32(&fi->gen3.flash_length);
657657
info.num_partitions = SWITCHTEC_NUM_PARTITIONS_GEN3;
658-
} else if (stdev->gen == SWITCHTEC_GEN4) {
658+
} else if (stdev->gen >= SWITCHTEC_GEN4) {
659659
info.flash_length = ioread32(&fi->gen4.flash_length);
660660
info.num_partitions = SWITCHTEC_NUM_PARTITIONS_GEN4;
661661
} else {
@@ -861,7 +861,7 @@ static int ioctl_flash_part_info(struct switchtec_dev *stdev,
861861
ret = flash_part_info_gen3(stdev, &info);
862862
if (ret)
863863
return ret;
864-
} else if (stdev->gen == SWITCHTEC_GEN4) {
864+
} else if (stdev->gen >= SWITCHTEC_GEN4) {
865865
ret = flash_part_info_gen4(stdev, &info);
866866
if (ret)
867867
return ret;
@@ -1595,7 +1595,7 @@ static int switchtec_init_pci(struct switchtec_dev *stdev,
15951595
stdev->mmio_sys_info = stdev->mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET;
15961596
stdev->mmio_flash_info = stdev->mmio + SWITCHTEC_GAS_FLASH_INFO_OFFSET;
15971597
stdev->mmio_ntb = stdev->mmio + SWITCHTEC_GAS_NTB_OFFSET;
1598-
if (stdev->gen == SWITCHTEC_GEN4)
1598+
if (stdev->gen >= SWITCHTEC_GEN4)
15991599
stdev->partition = ioread8(&stdev->mmio_sys_info->
16001600
gen4.partition_id);
16011601
else

0 commit comments

Comments
 (0)