18 #include <linux/export.h>
19 #include <linux/kernel.h>
20 #include <linux/compiler.h>
22 #include <linux/types.h>
25 #include <linux/slab.h>
26 #include <linux/sched.h>
49 u32 addr = addr_base & 0xffff8000;
54 return addr | ((addr_base & 0x300000000ull) >> 19);
72 if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->
regs)
75 lbc = fsl_lbc_ctrl_dev->
regs;
107 if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->
regs)
110 lbc = fsl_lbc_ctrl_dev->
regs;
127 switch (br &
BR_PS) {
160 if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->
regs)
167 switch (upm->
width) {
182 spin_unlock_irqrestore(&fsl_lbc_lock, flags);
228 dev_err(ctrl->
dev,
"Local bus monitor time-out: "
229 "LTESR 0x%08X\n", status);
232 "LTESR 0x%08X\n", status);
235 "LTESR 0x%08X\n", status);
238 "LTESR 0x%08X\n", status);
241 "LTESR 0x%08X\n", status);
246 "LTESR 0x%08X\n", status);
251 dev_err(ctrl->
dev,
"Parity or Uncorrectable ECC error: "
252 "LTESR 0x%08X\n", status);
262 "LTESR 0x%08X\n", status);
280 if (!dev->
dev.of_node) {
285 fsl_lbc_ctrl_dev = kzalloc(
sizeof(*fsl_lbc_ctrl_dev),
GFP_KERNEL);
286 if (!fsl_lbc_ctrl_dev)
295 if (!fsl_lbc_ctrl_dev->
regs) {
296 dev_err(&dev->
dev,
"failed to get memory region\n");
303 dev_err(&dev->
dev,
"failed to get irq resource\n");
308 fsl_lbc_ctrl_dev->
dev = &dev->
dev;
310 ret = fsl_lbc_ctrl_init(fsl_lbc_ctrl_dev, dev->
dev.of_node);
315 "fsl-lbc", fsl_lbc_ctrl_dev);
317 dev_err(&dev->
dev,
"failed to install irq (%d)\n",
318 fsl_lbc_ctrl_dev->
irq);
319 ret = fsl_lbc_ctrl_dev->
irq;
330 kfree(fsl_lbc_ctrl_dev);
331 fsl_lbc_ctrl_dev =
NULL;
335 #ifdef CONFIG_SUSPEND
344 if (!ctrl->saved_regs)
357 if (ctrl->saved_regs) {
360 kfree(ctrl->saved_regs);
361 ctrl->saved_regs =
NULL;
368 { .compatible =
"fsl,elbc", },
369 { .compatible =
"fsl,pq3-localbus", },
370 { .compatible =
"fsl,pq2-localbus", },
371 { .compatible =
"fsl,pq2pro-localbus", },
378 .of_match_table = fsl_lbc_match,
380 .probe = fsl_lbc_ctrl_probe,
381 #ifdef CONFIG_SUSPEND
382 .suspend = fsl_lbc_suspend,
383 .resume = fsl_lbc_resume,
387 static int __init fsl_lbc_init(
void)