aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2014-01-28 06:36:48 -0500
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2014-04-16 06:03:14 -0400
commit81b3b2711072b6047d5f332cd8751a1c5c9a3fb2 (patch)
tree025f8338c98d31deb618fdc8c115d32364bfc609
parentfb28a659813084365eced5c2876c6383da52e634 (diff)
clocksource: sh_cmt: Add support for multiple channels per device
CMT hardware devices can support multiple channels, with global registers and per-channel registers. The sh_cmt driver currently models the hardware with one Linux device per channel. This model makes it difficult to handle global registers in a clean way. Add support for a new model that uses one Linux device per timer with multiple channels per device. This requires changes to platform data, add new channel configuration fields. Support for the legacy model is kept and will be removed after all platforms switch to the new model. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-rw-r--r--drivers/clocksource/sh_cmt.c304
-rw-r--r--include/linux/sh_timer.h1
2 files changed, 237 insertions, 68 deletions
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index c753efcfe9f5..1efe7d64efca 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -53,7 +53,16 @@ struct sh_cmt_device;
53 * channel registers block. All other versions have a shared start/stop register 53 * channel registers block. All other versions have a shared start/stop register
54 * located in the global space. 54 * located in the global space.
55 * 55 *
56 * Note that CMT0 on r8a73a4, r8a7790 and r8a7791, while implementing 32-bit 56 * Channels are indexed from 0 to N-1 in the documentation. The channel index
57 * infers the start/stop bit position in the control register and the channel
58 * registers block address. Some CMT instances have a subset of channels
59 * available, in which case the index in the documentation doesn't match the
60 * "real" index as implemented in hardware. This is for instance the case with
61 * CMT0 on r8a7740, which is a 32-bit variant with a single channel numbered 0
62 * in the documentation but using start/stop bit 5 and having its registers
63 * block at 0x60.
64 *
65 * Similarly CMT0 on r8a73a4, r8a7790 and r8a7791, while implementing 32-bit
57 * channels only, is a 48-bit gen2 CMT with the 48-bit channels unavailable. 66 * channels only, is a 48-bit gen2 CMT with the 48-bit channels unavailable.
58 */ 67 */
59 68
@@ -85,10 +94,14 @@ struct sh_cmt_info {
85 94
86struct sh_cmt_channel { 95struct sh_cmt_channel {
87 struct sh_cmt_device *cmt; 96 struct sh_cmt_device *cmt;
88 unsigned int index;
89 97
90 void __iomem *base; 98 unsigned int index; /* Index in the documentation */
99 unsigned int hwidx; /* Real hardware index */
100
101 void __iomem *iostart;
102 void __iomem *ioctrl;
91 103
104 unsigned int timer_bit;
92 unsigned long flags; 105 unsigned long flags;
93 unsigned long match_value; 106 unsigned long match_value;
94 unsigned long next_match_value; 107 unsigned long next_match_value;
@@ -105,6 +118,7 @@ struct sh_cmt_device {
105 struct platform_device *pdev; 118 struct platform_device *pdev;
106 119
107 const struct sh_cmt_info *info; 120 const struct sh_cmt_info *info;
121 bool legacy;
108 122
109 void __iomem *mapbase_ch; 123 void __iomem *mapbase_ch;
110 void __iomem *mapbase; 124 void __iomem *mapbase;
@@ -112,6 +126,9 @@ struct sh_cmt_device {
112 126
113 struct sh_cmt_channel *channels; 127 struct sh_cmt_channel *channels;
114 unsigned int num_channels; 128 unsigned int num_channels;
129
130 bool has_clockevent;
131 bool has_clocksource;
115}; 132};
116 133
117#define SH_CMT16_CMCSR_CMF (1 << 7) 134#define SH_CMT16_CMCSR_CMF (1 << 7)
@@ -223,41 +240,47 @@ static const struct sh_cmt_info sh_cmt_info[] = {
223 240
224static inline unsigned long sh_cmt_read_cmstr(struct sh_cmt_channel *ch) 241static inline unsigned long sh_cmt_read_cmstr(struct sh_cmt_channel *ch)
225{ 242{
226 return ch->cmt->info->read_control(ch->cmt->mapbase, 0); 243 if (ch->iostart)
244 return ch->cmt->info->read_control(ch->iostart, 0);
245 else
246 return ch->cmt->info->read_control(ch->cmt->mapbase, 0);
227} 247}
228 248
229static inline unsigned long sh_cmt_read_cmcsr(struct sh_cmt_channel *ch) 249static inline void sh_cmt_write_cmstr(struct sh_cmt_channel *ch,
250 unsigned long value)
230{ 251{
231 return ch->cmt->info->read_control(ch->base, CMCSR); 252 if (ch->iostart)
253 ch->cmt->info->write_control(ch->iostart, 0, value);
254 else
255 ch->cmt->info->write_control(ch->cmt->mapbase, 0, value);
232} 256}
233 257
234static inline unsigned long sh_cmt_read_cmcnt(struct sh_cmt_channel *ch) 258static inline unsigned long sh_cmt_read_cmcsr(struct sh_cmt_channel *ch)
235{ 259{
236 return ch->cmt->info->read_count(ch->base, CMCNT); 260 return ch->cmt->info->read_control(ch->ioctrl, CMCSR);
237} 261}
238 262
239static inline void sh_cmt_write_cmstr(struct sh_cmt_channel *ch, 263static inline void sh_cmt_write_cmcsr(struct sh_cmt_channel *ch,
240 unsigned long value) 264 unsigned long value)
241{ 265{
242 ch->cmt->info->write_control(ch->cmt->mapbase, 0, value); 266 ch->cmt->info->write_control(ch->ioctrl, CMCSR, value);
243} 267}
244 268
245static inline void sh_cmt_write_cmcsr(struct sh_cmt_channel *ch, 269static inline unsigned long sh_cmt_read_cmcnt(struct sh_cmt_channel *ch)
246 unsigned long value)
247{ 270{
248 ch->cmt->info->write_control(ch->base, CMCSR, value); 271 return ch->cmt->info->read_count(ch->ioctrl, CMCNT);
249} 272}
250 273
251static inline void sh_cmt_write_cmcnt(struct sh_cmt_channel *ch, 274static inline void sh_cmt_write_cmcnt(struct sh_cmt_channel *ch,
252 unsigned long value) 275 unsigned long value)
253{ 276{
254 ch->cmt->info->write_count(ch->base, CMCNT, value); 277 ch->cmt->info->write_count(ch->ioctrl, CMCNT, value);
255} 278}
256 279
257static inline void sh_cmt_write_cmcor(struct sh_cmt_channel *ch, 280static inline void sh_cmt_write_cmcor(struct sh_cmt_channel *ch,
258 unsigned long value) 281 unsigned long value)
259{ 282{
260 ch->cmt->info->write_count(ch->base, CMCOR, value); 283 ch->cmt->info->write_count(ch->ioctrl, CMCOR, value);
261} 284}
262 285
263static unsigned long sh_cmt_get_counter(struct sh_cmt_channel *ch, 286static unsigned long sh_cmt_get_counter(struct sh_cmt_channel *ch,
@@ -286,7 +309,6 @@ static DEFINE_RAW_SPINLOCK(sh_cmt_lock);
286 309
287static void sh_cmt_start_stop_ch(struct sh_cmt_channel *ch, int start) 310static void sh_cmt_start_stop_ch(struct sh_cmt_channel *ch, int start)
288{ 311{
289 struct sh_timer_config *cfg = ch->cmt->pdev->dev.platform_data;
290 unsigned long flags, value; 312 unsigned long flags, value;
291 313
292 /* start stop register shared by multiple timer channels */ 314 /* start stop register shared by multiple timer channels */
@@ -294,9 +316,9 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_channel *ch, int start)
294 value = sh_cmt_read_cmstr(ch); 316 value = sh_cmt_read_cmstr(ch);
295 317
296 if (start) 318 if (start)
297 value |= 1 << cfg->timer_bit; 319 value |= 1 << ch->timer_bit;
298 else 320 else
299 value &= ~(1 << cfg->timer_bit); 321 value &= ~(1 << ch->timer_bit);
300 322
301 sh_cmt_write_cmstr(ch, value); 323 sh_cmt_write_cmstr(ch, value);
302 raw_spin_unlock_irqrestore(&sh_cmt_lock, flags); 324 raw_spin_unlock_irqrestore(&sh_cmt_lock, flags);
@@ -790,27 +812,72 @@ static void sh_cmt_register_clockevent(struct sh_cmt_channel *ch,
790static int sh_cmt_register(struct sh_cmt_channel *ch, const char *name, 812static int sh_cmt_register(struct sh_cmt_channel *ch, const char *name,
791 bool clockevent, bool clocksource) 813 bool clockevent, bool clocksource)
792{ 814{
793 if (clockevent) 815 if (clockevent) {
816 ch->cmt->has_clockevent = true;
794 sh_cmt_register_clockevent(ch, name); 817 sh_cmt_register_clockevent(ch, name);
818 }
795 819
796 if (clocksource) 820 if (clocksource) {
821 ch->cmt->has_clocksource = true;
797 sh_cmt_register_clocksource(ch, name); 822 sh_cmt_register_clocksource(ch, name);
823 }
798 824
799 return 0; 825 return 0;
800} 826}
801 827
802static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index, 828static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index,
803 struct sh_cmt_device *cmt) 829 unsigned int hwidx, bool clockevent,
830 bool clocksource, struct sh_cmt_device *cmt)
804{ 831{
805 struct sh_timer_config *cfg = cmt->pdev->dev.platform_data;
806 int irq; 832 int irq;
807 int ret; 833 int ret;
808 834
835 /* Skip unused channels. */
836 if (!clockevent && !clocksource)
837 return 0;
838
809 ch->cmt = cmt; 839 ch->cmt = cmt;
810 ch->base = cmt->mapbase_ch;
811 ch->index = index; 840 ch->index = index;
841 ch->hwidx = hwidx;
842
843 /*
844 * Compute the address of the channel control register block. For the
845 * timers with a per-channel start/stop register, compute its address
846 * as well.
847 *
848 * For legacy configuration the address has been mapped explicitly.
849 */
850 if (cmt->legacy) {
851 ch->ioctrl = cmt->mapbase_ch;
852 } else {
853 switch (cmt->info->model) {
854 case SH_CMT_16BIT:
855 ch->ioctrl = cmt->mapbase + 2 + ch->hwidx * 6;
856 break;
857 case SH_CMT_32BIT:
858 case SH_CMT_48BIT:
859 ch->ioctrl = cmt->mapbase + 0x10 + ch->hwidx * 0x10;
860 break;
861 case SH_CMT_32BIT_FAST:
862 /*
863 * The 32-bit "fast" timer has a single channel at hwidx
864 * 5 but is located at offset 0x40 instead of 0x60 for
865 * some reason.
866 */
867 ch->ioctrl = cmt->mapbase + 0x40;
868 break;
869 case SH_CMT_48BIT_GEN2:
870 ch->iostart = cmt->mapbase + ch->hwidx * 0x100;
871 ch->ioctrl = ch->iostart + 0x10;
872 break;
873 }
874 }
875
876 if (cmt->legacy)
877 irq = platform_get_irq(cmt->pdev, 0);
878 else
879 irq = platform_get_irq(cmt->pdev, ch->index);
812 880
813 irq = platform_get_irq(cmt->pdev, 0);
814 if (irq < 0) { 881 if (irq < 0) {
815 dev_err(&cmt->pdev->dev, "ch%u: failed to get irq\n", 882 dev_err(&cmt->pdev->dev, "ch%u: failed to get irq\n",
816 ch->index); 883 ch->index);
@@ -825,9 +892,15 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index,
825 ch->match_value = ch->max_match_value; 892 ch->match_value = ch->max_match_value;
826 raw_spin_lock_init(&ch->lock); 893 raw_spin_lock_init(&ch->lock);
827 894
895 if (cmt->legacy) {
896 ch->timer_bit = ch->hwidx;
897 } else {
898 ch->timer_bit = cmt->info->model == SH_CMT_48BIT_GEN2
899 ? 0 : ch->hwidx;
900 }
901
828 ret = sh_cmt_register(ch, dev_name(&cmt->pdev->dev), 902 ret = sh_cmt_register(ch, dev_name(&cmt->pdev->dev),
829 cfg->clockevent_rating != 0, 903 clockevent, clocksource);
830 cfg->clocksource_rating != 0);
831 if (ret) { 904 if (ret) {
832 dev_err(&cmt->pdev->dev, "ch%u: registration failed\n", 905 dev_err(&cmt->pdev->dev, "ch%u: registration failed\n",
833 ch->index); 906 ch->index);
@@ -847,97 +920,180 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index,
847 return 0; 920 return 0;
848} 921}
849 922
850static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev) 923static int sh_cmt_map_memory(struct sh_cmt_device *cmt)
851{ 924{
852 struct sh_timer_config *cfg = pdev->dev.platform_data; 925 struct resource *mem;
853 struct resource *res, *res2;
854 int ret;
855 ret = -ENXIO;
856 926
857 cmt->pdev = pdev; 927 mem = platform_get_resource(cmt->pdev, IORESOURCE_MEM, 0);
928 if (!mem) {
929 dev_err(&cmt->pdev->dev, "failed to get I/O memory\n");
930 return -ENXIO;
931 }
858 932
859 if (!cfg) { 933 cmt->mapbase = ioremap_nocache(mem->start, resource_size(mem));
860 dev_err(&cmt->pdev->dev, "missing platform data\n"); 934 if (cmt->mapbase == NULL) {
861 goto err0; 935 dev_err(&cmt->pdev->dev, "failed to remap I/O memory\n");
936 return -ENXIO;
862 } 937 }
863 938
939 return 0;
940}
941
942static int sh_cmt_map_memory_legacy(struct sh_cmt_device *cmt)
943{
944 struct sh_timer_config *cfg = cmt->pdev->dev.platform_data;
945 struct resource *res, *res2;
946
947 /* map memory, let mapbase_ch point to our channel */
864 res = platform_get_resource(cmt->pdev, IORESOURCE_MEM, 0); 948 res = platform_get_resource(cmt->pdev, IORESOURCE_MEM, 0);
865 if (!res) { 949 if (!res) {
866 dev_err(&cmt->pdev->dev, "failed to get I/O memory\n"); 950 dev_err(&cmt->pdev->dev, "failed to get I/O memory\n");
867 goto err0; 951 return -ENXIO;
868 } 952 }
869 953
870 /* optional resource for the shared timer start/stop register */
871 res2 = platform_get_resource(cmt->pdev, IORESOURCE_MEM, 1);
872
873 /* map memory, let mapbase_ch point to our channel */
874 cmt->mapbase_ch = ioremap_nocache(res->start, resource_size(res)); 954 cmt->mapbase_ch = ioremap_nocache(res->start, resource_size(res));
875 if (cmt->mapbase_ch == NULL) { 955 if (cmt->mapbase_ch == NULL) {
876 dev_err(&cmt->pdev->dev, "failed to remap I/O memory\n"); 956 dev_err(&cmt->pdev->dev, "failed to remap I/O memory\n");
877 goto err0; 957 return -ENXIO;
878 } 958 }
879 959
960 /* optional resource for the shared timer start/stop register */
961 res2 = platform_get_resource(cmt->pdev, IORESOURCE_MEM, 1);
962
880 /* map second resource for CMSTR */ 963 /* map second resource for CMSTR */
881 cmt->mapbase = ioremap_nocache(res2 ? res2->start : 964 cmt->mapbase = ioremap_nocache(res2 ? res2->start :
882 res->start - cfg->channel_offset, 965 res->start - cfg->channel_offset,
883 res2 ? resource_size(res2) : 2); 966 res2 ? resource_size(res2) : 2);
884 if (cmt->mapbase == NULL) { 967 if (cmt->mapbase == NULL) {
885 dev_err(&cmt->pdev->dev, "failed to remap I/O second memory\n"); 968 dev_err(&cmt->pdev->dev, "failed to remap I/O second memory\n");
886 goto err1; 969 iounmap(cmt->mapbase_ch);
970 return -ENXIO;
887 } 971 }
888 972
889 /* get hold of clock */ 973 /* identify the model based on the resources */
974 if (resource_size(res) == 6)
975 cmt->info = &sh_cmt_info[SH_CMT_16BIT];
976 else if (res2 && (resource_size(res2) == 4))
977 cmt->info = &sh_cmt_info[SH_CMT_48BIT_GEN2];
978 else
979 cmt->info = &sh_cmt_info[SH_CMT_32BIT];
980
981 return 0;
982}
983
984static void sh_cmt_unmap_memory(struct sh_cmt_device *cmt)
985{
986 iounmap(cmt->mapbase);
987 if (cmt->mapbase_ch)
988 iounmap(cmt->mapbase_ch);
989}
990
991static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
992{
993 struct sh_timer_config *cfg = pdev->dev.platform_data;
994 const struct platform_device_id *id = pdev->id_entry;
995 unsigned int hw_channels;
996 int ret;
997
998 memset(cmt, 0, sizeof(*cmt));
999 cmt->pdev = pdev;
1000
1001 if (!cfg) {
1002 dev_err(&cmt->pdev->dev, "missing platform data\n");
1003 return -ENXIO;
1004 }
1005
1006 cmt->info = (const struct sh_cmt_info *)id->driver_data;
1007 cmt->legacy = cmt->info ? false : true;
1008
1009 /* Get hold of clock. */
890 cmt->clk = clk_get(&cmt->pdev->dev, "cmt_fck"); 1010 cmt->clk = clk_get(&cmt->pdev->dev, "cmt_fck");
891 if (IS_ERR(cmt->clk)) { 1011 if (IS_ERR(cmt->clk)) {
892 dev_err(&cmt->pdev->dev, "cannot get clock\n"); 1012 dev_err(&cmt->pdev->dev, "cannot get clock\n");
893 ret = PTR_ERR(cmt->clk); 1013 return PTR_ERR(cmt->clk);
894 goto err2;
895 } 1014 }
896 1015
897 ret = clk_prepare(cmt->clk); 1016 ret = clk_prepare(cmt->clk);
898 if (ret < 0) 1017 if (ret < 0)
899 goto err3; 1018 goto err_clk_put;
900 1019
901 /* identify the model based on the resources */ 1020 /*
902 if (resource_size(res) == 6) 1021 * Map the memory resource(s). We need to support both the legacy
903 cmt->info = &sh_cmt_info[SH_CMT_16BIT]; 1022 * platform device configuration (with one device per channel) and the
904 else if (res2 && (resource_size(res2) == 4)) 1023 * new version (with multiple channels per device).
905 cmt->info = &sh_cmt_info[SH_CMT_48BIT_GEN2]; 1024 */
1025 if (cmt->legacy)
1026 ret = sh_cmt_map_memory_legacy(cmt);
906 else 1027 else
907 cmt->info = &sh_cmt_info[SH_CMT_32BIT]; 1028 ret = sh_cmt_map_memory(cmt);
908 1029
909 cmt->channels = kzalloc(sizeof(*cmt->channels), GFP_KERNEL); 1030 if (ret < 0)
1031 goto err_clk_unprepare;
1032
1033 /* Allocate and setup the channels. */
1034 if (cmt->legacy) {
1035 cmt->num_channels = 1;
1036 hw_channels = 0;
1037 } else {
1038 cmt->num_channels = hweight8(cfg->channels_mask);
1039 hw_channels = cfg->channels_mask;
1040 }
1041
1042 cmt->channels = kzalloc(cmt->num_channels * sizeof(*cmt->channels),
1043 GFP_KERNEL);
910 if (cmt->channels == NULL) { 1044 if (cmt->channels == NULL) {
911 ret = -ENOMEM; 1045 ret = -ENOMEM;
912 goto err4; 1046 goto err_unmap;
913 } 1047 }
914 1048
915 cmt->num_channels = 1; 1049 if (cmt->legacy) {
1050 ret = sh_cmt_setup_channel(&cmt->channels[0],
1051 cfg->timer_bit, cfg->timer_bit,
1052 cfg->clockevent_rating != 0,
1053 cfg->clocksource_rating != 0, cmt);
1054 if (ret < 0)
1055 goto err_unmap;
1056 } else {
1057 unsigned int mask = hw_channels;
1058 unsigned int i;
916 1059
917 ret = sh_cmt_setup_channel(&cmt->channels[0], cfg->timer_bit, cmt); 1060 /*
918 if (ret < 0) 1061 * Use the first channel as a clock event device and the second
919 goto err4; 1062 * channel as a clock source. If only one channel is available
1063 * use it for both.
1064 */
1065 for (i = 0; i < cmt->num_channels; ++i) {
1066 unsigned int hwidx = ffs(mask) - 1;
1067 bool clocksource = i == 1 || cmt->num_channels == 1;
1068 bool clockevent = i == 0;
1069
1070 ret = sh_cmt_setup_channel(&cmt->channels[i], i, hwidx,
1071 clockevent, clocksource,
1072 cmt);
1073 if (ret < 0)
1074 goto err_unmap;
1075
1076 mask &= ~(1 << hwidx);
1077 }
1078 }
920 1079
921 platform_set_drvdata(pdev, cmt); 1080 platform_set_drvdata(pdev, cmt);
922 1081
923 return 0; 1082 return 0;
924err4: 1083
1084err_unmap:
925 kfree(cmt->channels); 1085 kfree(cmt->channels);
1086 sh_cmt_unmap_memory(cmt);
1087err_clk_unprepare:
926 clk_unprepare(cmt->clk); 1088 clk_unprepare(cmt->clk);
927err3: 1089err_clk_put:
928 clk_put(cmt->clk); 1090 clk_put(cmt->clk);
929err2:
930 iounmap(cmt->mapbase);
931err1:
932 iounmap(cmt->mapbase_ch);
933err0:
934 return ret; 1091 return ret;
935} 1092}
936 1093
937static int sh_cmt_probe(struct platform_device *pdev) 1094static int sh_cmt_probe(struct platform_device *pdev)
938{ 1095{
939 struct sh_cmt_device *cmt = platform_get_drvdata(pdev); 1096 struct sh_cmt_device *cmt = platform_get_drvdata(pdev);
940 struct sh_timer_config *cfg = pdev->dev.platform_data;
941 int ret; 1097 int ret;
942 1098
943 if (!is_early_platform_device(pdev)) { 1099 if (!is_early_platform_device(pdev)) {
@@ -966,7 +1122,7 @@ static int sh_cmt_probe(struct platform_device *pdev)
966 return 0; 1122 return 0;
967 1123
968 out: 1124 out:
969 if (cfg->clockevent_rating || cfg->clocksource_rating) 1125 if (cmt->has_clockevent || cmt->has_clocksource)
970 pm_runtime_irq_safe(&pdev->dev); 1126 pm_runtime_irq_safe(&pdev->dev);
971 else 1127 else
972 pm_runtime_idle(&pdev->dev); 1128 pm_runtime_idle(&pdev->dev);
@@ -979,12 +1135,24 @@ static int sh_cmt_remove(struct platform_device *pdev)
979 return -EBUSY; /* cannot unregister clockevent and clocksource */ 1135 return -EBUSY; /* cannot unregister clockevent and clocksource */
980} 1136}
981 1137
1138static const struct platform_device_id sh_cmt_id_table[] = {
1139 { "sh_cmt", 0 },
1140 { "sh-cmt-16", (kernel_ulong_t)&sh_cmt_info[SH_CMT_16BIT] },
1141 { "sh-cmt-32", (kernel_ulong_t)&sh_cmt_info[SH_CMT_32BIT] },
1142 { "sh-cmt-32-fast", (kernel_ulong_t)&sh_cmt_info[SH_CMT_32BIT_FAST] },
1143 { "sh-cmt-48", (kernel_ulong_t)&sh_cmt_info[SH_CMT_48BIT] },
1144 { "sh-cmt-48-gen2", (kernel_ulong_t)&sh_cmt_info[SH_CMT_48BIT_GEN2] },
1145 { }
1146};
1147MODULE_DEVICE_TABLE(platform, sh_cmt_id_table);
1148
982static struct platform_driver sh_cmt_device_driver = { 1149static struct platform_driver sh_cmt_device_driver = {
983 .probe = sh_cmt_probe, 1150 .probe = sh_cmt_probe,
984 .remove = sh_cmt_remove, 1151 .remove = sh_cmt_remove,
985 .driver = { 1152 .driver = {
986 .name = "sh_cmt", 1153 .name = "sh_cmt",
987 } 1154 },
1155 .id_table = sh_cmt_id_table,
988}; 1156};
989 1157
990static int __init sh_cmt_init(void) 1158static int __init sh_cmt_init(void)
diff --git a/include/linux/sh_timer.h b/include/linux/sh_timer.h
index 4d9dcd138315..8e1e036d6d45 100644
--- a/include/linux/sh_timer.h
+++ b/include/linux/sh_timer.h
@@ -7,6 +7,7 @@ struct sh_timer_config {
7 int timer_bit; 7 int timer_bit;
8 unsigned long clockevent_rating; 8 unsigned long clockevent_rating;
9 unsigned long clocksource_rating; 9 unsigned long clocksource_rating;
10 unsigned int channels_mask;
10}; 11};
11 12
12#endif /* __SH_TIMER_H__ */ 13#endif /* __SH_TIMER_H__ */