23 #include <linux/kernel.h>
24 #include <linux/module.h>
30 static char *sram_size;
31 static char *sram_offset;
36 unsigned long long addr;
39 if (!sram_size || (
kstrtouint(sram_size, 0, &size) < 0))
42 if (!sram_offset || (
kstrtoull(sram_offset, 0, &addr) < 0))
51 static int __init get_size_from_cmdline(
char *
str)
60 static int __init get_offset_from_cmdline(
char *str)
69 __setup(
"cache-sram-size=", get_size_from_cmdline);
70 __setup(
"cache-sram-offset=", get_offset_from_cmdline);
77 const unsigned int *prop;
78 unsigned int l2cache_size;
81 if (!dev->
dev.of_node) {
82 dev_err(&dev->
dev,
"Device's OF-node is NULL\n");
93 if (get_cache_sram_params(&sram_params)) {
95 "Entire L2 as cache, provide valid sram offset and size\n");
100 rem = l2cache_size % sram_params.sram_size;
102 if (rem || (ways & (ways - 1))) {
103 dev_err(&dev->
dev,
"Illegal cache-sram-size in command line\n");
109 dev_err(&dev->
dev,
"Can't map L2 controller\n");
122 #ifdef CONFIG_PHYS_64BIT
131 setbits32(&l2ctlr->
ctl,
136 setbits32(&l2ctlr->
ctl,
141 setbits32(&l2ctlr->
ctl,
147 setbits32(&l2ctlr->
ctl,
155 dev_err(&dev->
dev,
"Can't instantiate Cache-SRAM\n");
169 dev_info(&dev->
dev,
"MPC85xx L2 controller unloaded\n");
174 static struct of_device_id mpc85xx_l2ctlr_of_match[] = {
176 .compatible =
"fsl,p2020-l2-cache-controller",
179 .compatible =
"fsl,p2010-l2-cache-controller",
182 .compatible =
"fsl,p1020-l2-cache-controller",
185 .compatible =
"fsl,p1011-l2-cache-controller",
188 .compatible =
"fsl,p1013-l2-cache-controller",
191 .compatible =
"fsl,p1022-l2-cache-controller",
194 .compatible =
"fsl,mpc8548-l2-cache-controller",
196 { .compatible =
"fsl,mpc8544-l2-cache-controller",},
197 { .compatible =
"fsl,mpc8572-l2-cache-controller",},
198 { .compatible =
"fsl,mpc8536-l2-cache-controller",},
199 { .compatible =
"fsl,p1021-l2-cache-controller",},
200 { .compatible =
"fsl,p1012-l2-cache-controller",},
201 { .compatible =
"fsl,p1025-l2-cache-controller",},
202 { .compatible =
"fsl,p1016-l2-cache-controller",},
203 { .compatible =
"fsl,p1024-l2-cache-controller",},
204 { .compatible =
"fsl,p1015-l2-cache-controller",},
205 { .compatible =
"fsl,p1010-l2-cache-controller",},
211 .name =
"fsl-l2ctlr",
213 .of_match_table = mpc85xx_l2ctlr_of_match,
215 .probe = mpc85xx_l2ctlr_of_probe,
219 static __init int mpc85xx_l2ctlr_of_init(
void)
224 static void __exit mpc85xx_l2ctlr_of_exit(
void)