Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi/spi-fsl-spi: Introduce a type for the driver

For being able to distinguishing between the regular type of cores and others
with different entries in of_fsl_spi_match.

Acked-by: Anton Vorontsov <anton@enomsg.org>
Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

authored by

Andreas Larsson and committed by
Grant Likely
c3f3e771 b48c4e3c

+34 -7
+2
drivers/spi/spi-fsl-lib.h
··· 70 70 unsigned int flags; 71 71 72 72 #ifdef CONFIG_SPI_FSL_SPI 73 + int type; 74 + 73 75 void (*set_shifts)(u32 *rx_shift, u32 *tx_shift, 74 76 int bits_per_word, int msb_first); 75 77 #endif
+32 -7
drivers/spi/spi-fsl-spi.c
··· 39 39 #include "spi-fsl-cpm.h" 40 40 #include "spi-fsl-spi.h" 41 41 42 + #define TYPE_FSL 0 43 + 44 + struct fsl_spi_match_data { 45 + int type; 46 + }; 47 + 48 + static struct fsl_spi_match_data of_fsl_spi_fsl_config = { 49 + .type = TYPE_FSL, 50 + }; 51 + 52 + static struct of_device_id of_fsl_spi_match[] = { 53 + { 54 + .compatible = "fsl,spi", 55 + .data = &of_fsl_spi_fsl_config, 56 + }, 57 + {} 58 + }; 59 + MODULE_DEVICE_TABLE(of, of_fsl_spi_match); 60 + 61 + static int fsl_spi_get_type(struct device *dev) 62 + { 63 + const struct of_device_id *match; 64 + 65 + if (dev->of_node) { 66 + match = of_match_node(of_fsl_spi_match, dev->of_node); 67 + if (match && match->data) 68 + return ((struct fsl_spi_match_data *)match->data)->type; 69 + } 70 + return TYPE_FSL; 71 + } 72 + 42 73 static void fsl_spi_change_mode(struct spi_device *spi) 43 74 { 44 75 struct mpc8xxx_spi *mspi = spi_master_get_devdata(spi->master); ··· 520 489 mpc8xxx_spi = spi_master_get_devdata(master); 521 490 mpc8xxx_spi->spi_do_one_msg = fsl_spi_do_one_msg; 522 491 mpc8xxx_spi->spi_remove = fsl_spi_remove; 523 - 492 + mpc8xxx_spi->type = fsl_spi_get_type(dev); 524 493 525 494 ret = fsl_spi_cpm_init(mpc8xxx_spi); 526 495 if (ret) ··· 744 713 of_fsl_spi_free_chipselects(&ofdev->dev); 745 714 return 0; 746 715 } 747 - 748 - static const struct of_device_id of_fsl_spi_match[] = { 749 - { .compatible = "fsl,spi" }, 750 - {} 751 - }; 752 - MODULE_DEVICE_TABLE(of, of_fsl_spi_match); 753 716 754 717 static struct platform_driver of_fsl_spi_driver = { 755 718 .driver = {