diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/fsl-diu-fb.c | 65 |
1 files changed, 24 insertions, 41 deletions
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 6c544cff3143..96417abb4bec 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c | |||
@@ -1425,13 +1425,12 @@ static ssize_t show_monitor(struct device *device, | |||
1425 | return 0; | 1425 | return 0; |
1426 | } | 1426 | } |
1427 | 1427 | ||
1428 | static int __devinit fsl_diu_probe(struct platform_device *ofdev) | 1428 | static int __devinit fsl_diu_probe(struct platform_device *pdev) |
1429 | { | 1429 | { |
1430 | struct device_node *np = ofdev->dev.of_node; | 1430 | struct device_node *np = pdev->dev.of_node; |
1431 | struct mfb_info *mfbi; | 1431 | struct mfb_info *mfbi; |
1432 | phys_addr_t dummy_ad_addr = 0; | 1432 | phys_addr_t dummy_ad_addr = 0; |
1433 | int ret, i, error = 0; | 1433 | int ret, i, error = 0; |
1434 | struct resource res; | ||
1435 | struct fsl_diu_data *machine_data; | 1434 | struct fsl_diu_data *machine_data; |
1436 | int diu_mode; | 1435 | int diu_mode; |
1437 | 1436 | ||
@@ -1441,9 +1440,9 @@ static int __devinit fsl_diu_probe(struct platform_device *ofdev) | |||
1441 | 1440 | ||
1442 | for (i = 0; i < ARRAY_SIZE(machine_data->fsl_diu_info); i++) { | 1441 | for (i = 0; i < ARRAY_SIZE(machine_data->fsl_diu_info); i++) { |
1443 | machine_data->fsl_diu_info[i] = | 1442 | machine_data->fsl_diu_info[i] = |
1444 | framebuffer_alloc(sizeof(struct mfb_info), &ofdev->dev); | 1443 | framebuffer_alloc(sizeof(struct mfb_info), &pdev->dev); |
1445 | if (!machine_data->fsl_diu_info[i]) { | 1444 | if (!machine_data->fsl_diu_info[i]) { |
1446 | dev_err(&ofdev->dev, "cannot allocate memory\n"); | 1445 | dev_err(&pdev->dev, "cannot allocate memory\n"); |
1447 | ret = -ENOMEM; | 1446 | ret = -ENOMEM; |
1448 | goto error2; | 1447 | goto error2; |
1449 | } | 1448 | } |
@@ -1463,19 +1462,9 @@ static int __devinit fsl_diu_probe(struct platform_device *ofdev) | |||
1463 | } | 1462 | } |
1464 | } | 1463 | } |
1465 | 1464 | ||
1466 | ret = of_address_to_resource(np, 0, &res); | 1465 | dr.diu_reg = of_iomap(np, 0); |
1467 | if (ret) { | ||
1468 | dev_err(&ofdev->dev, "could not obtain DIU address\n"); | ||
1469 | goto error; | ||
1470 | } | ||
1471 | if (!res.start) { | ||
1472 | dev_err(&ofdev->dev, "invalid DIU address\n"); | ||
1473 | goto error; | ||
1474 | } | ||
1475 | |||
1476 | dr.diu_reg = ioremap(res.start, sizeof(struct diu)); | ||
1477 | if (!dr.diu_reg) { | 1466 | if (!dr.diu_reg) { |
1478 | dev_err(&ofdev->dev, "Err: can't map DIU registers!\n"); | 1467 | dev_err(&pdev->dev, "cannot map DIU registers\n"); |
1479 | ret = -EFAULT; | 1468 | ret = -EFAULT; |
1480 | goto error2; | 1469 | goto error2; |
1481 | } | 1470 | } |
@@ -1488,25 +1477,25 @@ static int __devinit fsl_diu_probe(struct platform_device *ofdev) | |||
1488 | machine_data->irq = irq_of_parse_and_map(np, 0); | 1477 | machine_data->irq = irq_of_parse_and_map(np, 0); |
1489 | 1478 | ||
1490 | if (!machine_data->irq) { | 1479 | if (!machine_data->irq) { |
1491 | dev_err(&ofdev->dev, "could not get DIU IRQ\n"); | 1480 | dev_err(&pdev->dev, "could not get DIU IRQ\n"); |
1492 | ret = -EINVAL; | 1481 | ret = -EINVAL; |
1493 | goto error; | 1482 | goto error; |
1494 | } | 1483 | } |
1495 | machine_data->monitor_port = monitor_port; | 1484 | machine_data->monitor_port = monitor_port; |
1496 | 1485 | ||
1497 | /* Area descriptor memory pool aligns to 64-bit boundary */ | 1486 | /* Area descriptor memory pool aligns to 64-bit boundary */ |
1498 | if (allocate_buf(&ofdev->dev, &pool.ad, | 1487 | if (allocate_buf(&pdev->dev, &pool.ad, |
1499 | sizeof(struct diu_ad) * FSL_AOI_NUM, 8)) | 1488 | sizeof(struct diu_ad) * FSL_AOI_NUM, 8)) |
1500 | return -ENOMEM; | 1489 | return -ENOMEM; |
1501 | 1490 | ||
1502 | /* Get memory for Gamma Table - 32-byte aligned memory */ | 1491 | /* Get memory for Gamma Table - 32-byte aligned memory */ |
1503 | if (allocate_buf(&ofdev->dev, &pool.gamma, 768, 32)) { | 1492 | if (allocate_buf(&pdev->dev, &pool.gamma, 768, 32)) { |
1504 | ret = -ENOMEM; | 1493 | ret = -ENOMEM; |
1505 | goto error; | 1494 | goto error; |
1506 | } | 1495 | } |
1507 | 1496 | ||
1508 | /* For performance, cursor bitmap buffer aligns to 32-byte boundary */ | 1497 | /* For performance, cursor bitmap buffer aligns to 32-byte boundary */ |
1509 | if (allocate_buf(&ofdev->dev, &pool.cursor, MAX_CURS * MAX_CURS * 2, | 1498 | if (allocate_buf(&pdev->dev, &pool.cursor, MAX_CURS * MAX_CURS * 2, |
1510 | 32)) { | 1499 | 32)) { |
1511 | ret = -ENOMEM; | 1500 | ret = -ENOMEM; |
1512 | goto error; | 1501 | goto error; |
@@ -1548,16 +1537,13 @@ static int __devinit fsl_diu_probe(struct platform_device *ofdev) | |||
1548 | mfbi->ad->paddr = pool.ad.paddr + i * sizeof(struct diu_ad); | 1537 | mfbi->ad->paddr = pool.ad.paddr + i * sizeof(struct diu_ad); |
1549 | ret = install_fb(machine_data->fsl_diu_info[i]); | 1538 | ret = install_fb(machine_data->fsl_diu_info[i]); |
1550 | if (ret) { | 1539 | if (ret) { |
1551 | dev_err(&ofdev->dev, | 1540 | dev_err(&pdev->dev, "could not register fb %d\n", i); |
1552 | "Failed to register framebuffer %d\n", | ||
1553 | i); | ||
1554 | goto error; | 1541 | goto error; |
1555 | } | 1542 | } |
1556 | } | 1543 | } |
1557 | 1544 | ||
1558 | if (request_irq_local(machine_data->irq)) { | 1545 | if (request_irq_local(machine_data->irq)) { |
1559 | dev_err(machine_data->fsl_diu_info[0]->dev, | 1546 | dev_err(&pdev->dev, "could not claim irq\n"); |
1560 | "could not request irq for diu."); | ||
1561 | goto error; | 1547 | goto error; |
1562 | } | 1548 | } |
1563 | 1549 | ||
@@ -1569,12 +1555,11 @@ static int __devinit fsl_diu_probe(struct platform_device *ofdev) | |||
1569 | error = device_create_file(machine_data->fsl_diu_info[0]->dev, | 1555 | error = device_create_file(machine_data->fsl_diu_info[0]->dev, |
1570 | &machine_data->dev_attr); | 1556 | &machine_data->dev_attr); |
1571 | if (error) { | 1557 | if (error) { |
1572 | dev_err(machine_data->fsl_diu_info[0]->dev, | 1558 | dev_err(&pdev->dev, "could not create sysfs file %s\n", |
1573 | "could not create sysfs %s file\n", | ||
1574 | machine_data->dev_attr.attr.name); | 1559 | machine_data->dev_attr.attr.name); |
1575 | } | 1560 | } |
1576 | 1561 | ||
1577 | dev_set_drvdata(&ofdev->dev, machine_data); | 1562 | dev_set_drvdata(&pdev->dev, machine_data); |
1578 | return 0; | 1563 | return 0; |
1579 | 1564 | ||
1580 | error: | 1565 | error: |
@@ -1582,12 +1567,12 @@ error: | |||
1582 | i > 0; i--) | 1567 | i > 0; i--) |
1583 | uninstall_fb(machine_data->fsl_diu_info[i - 1]); | 1568 | uninstall_fb(machine_data->fsl_diu_info[i - 1]); |
1584 | if (pool.ad.vaddr) | 1569 | if (pool.ad.vaddr) |
1585 | free_buf(&ofdev->dev, &pool.ad, | 1570 | free_buf(&pdev->dev, &pool.ad, |
1586 | sizeof(struct diu_ad) * FSL_AOI_NUM, 8); | 1571 | sizeof(struct diu_ad) * FSL_AOI_NUM, 8); |
1587 | if (pool.gamma.vaddr) | 1572 | if (pool.gamma.vaddr) |
1588 | free_buf(&ofdev->dev, &pool.gamma, 768, 32); | 1573 | free_buf(&pdev->dev, &pool.gamma, 768, 32); |
1589 | if (pool.cursor.vaddr) | 1574 | if (pool.cursor.vaddr) |
1590 | free_buf(&ofdev->dev, &pool.cursor, MAX_CURS * MAX_CURS * 2, | 1575 | free_buf(&pdev->dev, &pool.cursor, MAX_CURS * MAX_CURS * 2, |
1591 | 32); | 1576 | 32); |
1592 | if (machine_data->dummy_aoi_virt) | 1577 | if (machine_data->dummy_aoi_virt) |
1593 | fsl_diu_free(machine_data->dummy_aoi_virt, 64); | 1578 | fsl_diu_free(machine_data->dummy_aoi_virt, 64); |
@@ -1602,25 +1587,23 @@ error2: | |||
1602 | return ret; | 1587 | return ret; |
1603 | } | 1588 | } |
1604 | 1589 | ||
1605 | 1590 | static int fsl_diu_remove(struct platform_device *pdev) | |
1606 | static int fsl_diu_remove(struct platform_device *ofdev) | ||
1607 | { | 1591 | { |
1608 | struct fsl_diu_data *machine_data; | 1592 | struct fsl_diu_data *machine_data; |
1609 | int i; | 1593 | int i; |
1610 | 1594 | ||
1611 | machine_data = dev_get_drvdata(&ofdev->dev); | 1595 | machine_data = dev_get_drvdata(&pdev->dev); |
1612 | disable_lcdc(machine_data->fsl_diu_info[0]); | 1596 | disable_lcdc(machine_data->fsl_diu_info[0]); |
1613 | free_irq_local(machine_data->irq); | 1597 | free_irq_local(machine_data->irq); |
1614 | for (i = ARRAY_SIZE(machine_data->fsl_diu_info); i > 0; i--) | 1598 | for (i = ARRAY_SIZE(machine_data->fsl_diu_info); i > 0; i--) |
1615 | uninstall_fb(machine_data->fsl_diu_info[i - 1]); | 1599 | uninstall_fb(machine_data->fsl_diu_info[i - 1]); |
1616 | if (pool.ad.vaddr) | 1600 | if (pool.ad.vaddr) |
1617 | free_buf(&ofdev->dev, &pool.ad, | 1601 | free_buf(&pdev->dev, &pool.ad, |
1618 | sizeof(struct diu_ad) * FSL_AOI_NUM, 8); | 1602 | sizeof(struct diu_ad) * FSL_AOI_NUM, 8); |
1619 | if (pool.gamma.vaddr) | 1603 | if (pool.gamma.vaddr) |
1620 | free_buf(&ofdev->dev, &pool.gamma, 768, 32); | 1604 | free_buf(&pdev->dev, &pool.gamma, 768, 32); |
1621 | if (pool.cursor.vaddr) | 1605 | if (pool.cursor.vaddr) |
1622 | free_buf(&ofdev->dev, &pool.cursor, MAX_CURS * MAX_CURS * 2, | 1606 | free_buf(&pdev->dev, &pool.cursor, MAX_CURS * MAX_CURS * 2, 32); |
1623 | 32); | ||
1624 | if (machine_data->dummy_aoi_virt) | 1607 | if (machine_data->dummy_aoi_virt) |
1625 | fsl_diu_free(machine_data->dummy_aoi_virt, 64); | 1608 | fsl_diu_free(machine_data->dummy_aoi_virt, 64); |
1626 | iounmap(dr.diu_reg); | 1609 | iounmap(dr.diu_reg); |
@@ -1722,7 +1705,7 @@ static int __init fsl_diu_init(void) | |||
1722 | * Freescale PLRU requires 13/8 times the cache size to do a proper | 1705 | * Freescale PLRU requires 13/8 times the cache size to do a proper |
1723 | * displacement flush | 1706 | * displacement flush |
1724 | */ | 1707 | */ |
1725 | coherence_data_size = *prop * 13; | 1708 | coherence_data_size = be32_to_cpup(prop) * 13; |
1726 | coherence_data_size /= 8; | 1709 | coherence_data_size /= 8; |
1727 | 1710 | ||
1728 | prop = of_get_property(np, "d-cache-line-size", NULL); | 1711 | prop = of_get_property(np, "d-cache-line-size", NULL); |
@@ -1732,7 +1715,7 @@ static int __init fsl_diu_init(void) | |||
1732 | of_node_put(np); | 1715 | of_node_put(np); |
1733 | return -ENODEV; | 1716 | return -ENODEV; |
1734 | } | 1717 | } |
1735 | d_cache_line_size = *prop; | 1718 | d_cache_line_size = be32_to_cpup(prop); |
1736 | 1719 | ||
1737 | of_node_put(np); | 1720 | of_node_put(np); |
1738 | coherence_data = vmalloc(coherence_data_size); | 1721 | coherence_data = vmalloc(coherence_data_size); |