diff options
author | Andreas Larsson <andreas@gaisler.com> | 2013-02-15 10:52:24 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2013-04-07 05:07:55 -0400 |
commit | c3f3e7717f1cf01d9117a98ed89decc41d7cb5db (patch) | |
tree | 3bb80cad2273ddaa68edfd0e49be7f3920c79427 /drivers/spi | |
parent | b48c4e3c944e8c52dcb0f477e9d80da045c7cab4 (diff) |
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>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-fsl-lib.h | 2 | ||||
-rw-r--r-- | drivers/spi/spi-fsl-spi.c | 39 |
2 files changed, 34 insertions, 7 deletions
diff --git a/drivers/spi/spi-fsl-lib.h b/drivers/spi/spi-fsl-lib.h index eae54b666907..5a9c36c7cb68 100644 --- a/drivers/spi/spi-fsl-lib.h +++ b/drivers/spi/spi-fsl-lib.h | |||
@@ -70,6 +70,8 @@ struct mpc8xxx_spi { | |||
70 | unsigned int flags; | 70 | unsigned int flags; |
71 | 71 | ||
72 | #ifdef CONFIG_SPI_FSL_SPI | 72 | #ifdef CONFIG_SPI_FSL_SPI |
73 | int type; | ||
74 | |||
73 | void (*set_shifts)(u32 *rx_shift, u32 *tx_shift, | 75 | void (*set_shifts)(u32 *rx_shift, u32 *tx_shift, |
74 | int bits_per_word, int msb_first); | 76 | int bits_per_word, int msb_first); |
75 | #endif | 77 | #endif |
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", |