diff options
Diffstat (limited to 'drivers/spi/spi-fsl-spi.c')
-rw-r--r-- | drivers/spi/spi-fsl-spi.c | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index aba00fd0791f..b9064434e0f7 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c | |||
@@ -39,6 +39,37 @@ | |||
39 | #include "spi-fsl-cpm.h" | 39 | #include "spi-fsl-cpm.h" |
40 | #include "spi-fsl-spi.h" | 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 | static void fsl_spi_change_mode(struct spi_device *spi) | 73 | static void fsl_spi_change_mode(struct spi_device *spi) |
43 | { | 74 | { |
44 | struct mpc8xxx_spi *mspi = spi_master_get_devdata(spi->master); | 75 | struct mpc8xxx_spi *mspi = spi_master_get_devdata(spi->master); |
@@ -489,7 +520,7 @@ static struct spi_master * fsl_spi_probe(struct device *dev, | |||
489 | mpc8xxx_spi = spi_master_get_devdata(master); | 520 | mpc8xxx_spi = spi_master_get_devdata(master); |
490 | mpc8xxx_spi->spi_do_one_msg = fsl_spi_do_one_msg; | 521 | mpc8xxx_spi->spi_do_one_msg = fsl_spi_do_one_msg; |
491 | mpc8xxx_spi->spi_remove = fsl_spi_remove; | 522 | mpc8xxx_spi->spi_remove = fsl_spi_remove; |
492 | 523 | mpc8xxx_spi->type = fsl_spi_get_type(dev); | |
493 | 524 | ||
494 | ret = fsl_spi_cpm_init(mpc8xxx_spi); | 525 | ret = fsl_spi_cpm_init(mpc8xxx_spi); |
495 | if (ret) | 526 | if (ret) |
@@ -714,12 +745,6 @@ static int of_fsl_spi_remove(struct platform_device *ofdev) | |||
714 | return 0; | 745 | return 0; |
715 | } | 746 | } |
716 | 747 | ||
717 | static const struct of_device_id of_fsl_spi_match[] = { | ||
718 | { .compatible = "fsl,spi" }, | ||
719 | {} | ||
720 | }; | ||
721 | MODULE_DEVICE_TABLE(of, of_fsl_spi_match); | ||
722 | |||
723 | static struct platform_driver of_fsl_spi_driver = { | 748 | static struct platform_driver of_fsl_spi_driver = { |
724 | .driver = { | 749 | .driver = { |
725 | .name = "fsl_spi", | 750 | .name = "fsl_spi", |