diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2010-04-07 03:43:48 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2010-04-07 03:43:48 +0000 |
commit | 87eea33def283e23e239e716ee67093b0bdde226 (patch) | |
tree | 834f1914514735a39842e5ec69047138d28bb433 /firmware | |
parent | 48789c5361419ebc88fe603912c139ca077b5cfb (diff) | |
download | rockbox-87eea33def283e23e239e716ee67093b0bdde226.tar.gz rockbox-87eea33def283e23e239e716ee67093b0bdde226.zip |
Gigabeat S (imx31): Begin voltage and frequency scaling code. For now, to avoid overdrive voltage, just lower core voltage to 1.35V since voltage scaling shouldn't be required for frequencies lower than 399 MHz (according to Freescale BSP, which set all working points to 1.35V for those frequencies). Perhaps battery life will improve as well (cross fingers :).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25506 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 1 | ||||
-rw-r--r-- | firmware/export/imx31l.h | 203 | ||||
-rw-r--r-- | firmware/export/mc13783.h | 46 | ||||
-rw-r--r-- | firmware/target/arm/imx31/dvfs_dptc-imx31.c | 48 | ||||
-rw-r--r-- | firmware/target/arm/imx31/dvfs_dptc-imx31.h | 30 | ||||
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/kernel-imx31.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/system-imx31.c | 2 |
7 files changed, 332 insertions, 0 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index cfd6db372d..dd1575a076 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -872,6 +872,7 @@ target/arm/lcd-as-memframe.S | |||
872 | target/arm/mmu-armv6.S | 872 | target/arm/mmu-armv6.S |
873 | target/arm/imx31/ccm-imx31.c | 873 | target/arm/imx31/ccm-imx31.c |
874 | target/arm/imx31/debug-imx31.c | 874 | target/arm/imx31/debug-imx31.c |
875 | target/arm/imx31/dvfs_dptc-imx31.c | ||
875 | target/arm/imx31/rolo_restart.S | 876 | target/arm/imx31/rolo_restart.S |
876 | target/arm/imx31/sdma-imx31.c | 877 | target/arm/imx31/sdma-imx31.c |
877 | target/arm/imx31/gigabeat-s/adc-imx31.c | 878 | target/arm/imx31/gigabeat-s/adc-imx31.c |
diff --git a/firmware/export/imx31l.h b/firmware/export/imx31l.h index dea5588e59..6ad50f0a16 100644 --- a/firmware/export/imx31l.h +++ b/firmware/export/imx31l.h | |||
@@ -1410,6 +1410,101 @@ | |||
1410 | #define CCM_PDR1_SSI1_PODF (0x3f << 0) | 1410 | #define CCM_PDR1_SSI1_PODF (0x3f << 0) |
1411 | #define CCM_PDR1_SSI1_PODF_POS (0) | 1411 | #define CCM_PDR1_SSI1_PODF_POS (0) |
1412 | 1412 | ||
1413 | /* RCSR */ | ||
1414 | #define CCM_RCSR_NF16B (1 << 31) | ||
1415 | |||
1416 | #define CCM_RCSR_NFMS (1 << 30) | ||
1417 | |||
1418 | #define CCM_RCSR_BTP4 (1 << 27) | ||
1419 | #define CCM_RCSR_BTP3 (1 << 26) | ||
1420 | #define CCM_RCSR_BTP2 (1 << 25) | ||
1421 | #define CCM_RCSR_BTP1 (1 << 24) | ||
1422 | #define CCM_RCSR_BTP0 (1 << 23) | ||
1423 | |||
1424 | #define CCM_RCSR_OSCNT (0x7f << 16) | ||
1425 | #define CCM_RCSR_OSCNT_POS (16) | ||
1426 | |||
1427 | #define CCM_RCSR_PERES (1 << 15) | ||
1428 | |||
1429 | #define CCM_RCSR_SDM (0x3 << 12) | ||
1430 | #define CCM_RCSR_SDM_POS (12) | ||
1431 | |||
1432 | #define CCM_RCSR_GPF (0x7 << 5) | ||
1433 | #define CCM_RCSR_GPF_POS (5) | ||
1434 | |||
1435 | #define CCM_RCSR_WFIS (1 << 4) | ||
1436 | |||
1437 | #define CCM_RCSR_REST (0x7 << 0) | ||
1438 | #define CCM_RCSR_REST_POS (0) | ||
1439 | #define CCM_RCSR_REST_POR_EXT (0x0) | ||
1440 | #define CCM_RCSR_REST_QUALIFIED_EXT (0x1) | ||
1441 | #define CCM_RCSR_REST_WATCHDOG_TMO (0x2) | ||
1442 | /* 0x3 - 0x5: reserved */ | ||
1443 | #define CCM_RCSR_REST_JTAG (0x6) | ||
1444 | #define CCM_RCSR_REST_ARM11P_GATING (0x7) | ||
1445 | |||
1446 | /* MPCTL */ | ||
1447 | #define CCM_MPCTL_BRM (1 << 31) | ||
1448 | #define CCM_MPCTL_PD (0xf << 26) | ||
1449 | #define CCM_MPCTL_PD_POS (26) | ||
1450 | #define CCM_MPCTL_MFD (0x3ff << 16) | ||
1451 | #define CCM_MPCTL_MFD_POS (16) | ||
1452 | #define CCM_MPCTL_MFI (0xf << 10) | ||
1453 | #define CCM_MPCTL_MFI_POS (10) | ||
1454 | #define CCM_MPCTL_MFN (0x3ff << 0) | ||
1455 | #define CCM_MPCTL_MFN_POS (0) | ||
1456 | |||
1457 | /* UPCTL */ | ||
1458 | #define CCM_UPCTL_BRM (1 << 31) | ||
1459 | #define CCM_UPCTL_PD (0xf << 26) | ||
1460 | #define CCM_UPCTL_PD_POS (26) | ||
1461 | #define CCM_UPCTL_MFD (0x3ff << 16) | ||
1462 | #define CCM_UPCTL_MFD_POS (16) | ||
1463 | #define CCM_UPCTL_MFI (0xf << 10) | ||
1464 | #define CCM_UPCTL_MFI_POS (10) | ||
1465 | #define CCM_UPCTL_MFN (0x3ff << 0) | ||
1466 | #define CCM_UPCTL_MFN_POS (0) | ||
1467 | |||
1468 | /* SPCTL */ | ||
1469 | #define CCM_SPCTL_BRM (1 << 31) | ||
1470 | #define CCM_SPCTL_PD (0xf << 26) | ||
1471 | #define CCM_SPCTL_PD_POS (26) | ||
1472 | #define CCM_SPCTL_MFD (0x3ff << 16) | ||
1473 | #define CCM_SPCTL_MFD_POS (16) | ||
1474 | #define CCM_SPCTL_MFI (0xf << 10) | ||
1475 | #define CCM_SPCTL_MFI_POS (10) | ||
1476 | #define CCM_SPCTL_MFN (0x3ff << 0) | ||
1477 | #define CCM_SPCTL_MFN_POS (0) | ||
1478 | |||
1479 | /* COSR */ | ||
1480 | #define CCM_COSR_CLKOEN (1 << 9) | ||
1481 | #define CCM_COSR_CLKOUTDIV (0x7 << 6) | ||
1482 | #define CCM_COSR_CLKOUTDIV_POS (6) | ||
1483 | #define CCM_COSR_CLKOSEL (0xf << 0) | ||
1484 | #define CCM_COSR_CLKOSEL_POS (0) | ||
1485 | #define CCM_COSR_CLKOSEL_MPL_DPDGCK_CLK (0x0) | ||
1486 | #define CCM_COSR_CLKOSEL_IPG_CLK_CCM (0x1) | ||
1487 | #define CCM_COSR_CLKOSEL_UPL_DPDGCK_CLK (0x2) | ||
1488 | #define CCM_COSR_CLKOSEL_PLL_REF_CLK (0x3) | ||
1489 | #define CCM_COSR_CLKOSEL_FPM_CKIL512_CLK (0x4) | ||
1490 | #define CCM_COSR_CLKOSEL_IPG_CLK_AHB_ARM (0x5) | ||
1491 | #define CCM_COSR_CLKOSEL_IPG_CLK_ARM (0x6) | ||
1492 | #define CCM_COSR_CLKOSEL_SPL_DPDGCK_CLK (0x7) | ||
1493 | #define CCM_COSR_CLKOSEL_CKIH (0x8) | ||
1494 | #define CCM_COSR_CLKOSEL_IPG_CLK_AHB_EMI_CLK (0x9) | ||
1495 | #define CCM_COSR_CLKOSEL_IPG_CLK_IPU_HSP (0x9) | ||
1496 | #define CCM_COSR_CLKOSEL_IPG_CLK_NFC_20M (0xa) | ||
1497 | #define CCM_COSR_CLKOSEL_IPG_CLK_PERCLK_UART1 (0xb) | ||
1498 | #define CCM_COSR_CLKOSEL_IPG_REF_CIR1 (0xc) /* ref_cir_gateload */ | ||
1499 | #define CCM_COSR_CLKOSEL_IPG_REF_CIR2 (0xc) /* ref_cir_intrcload */ | ||
1500 | #define CCM_COSR_CLKOSEL_IPG_REF_CIR3 (0xc) /* ref_cir_path */ | ||
1501 | |||
1502 | /* CGR0 */ | ||
1503 | /* CGR1 */ | ||
1504 | /* CGR2 */ | ||
1505 | /* Handled in ccm-imx31.h and ccm-imx31.c */ | ||
1506 | |||
1507 | |||
1413 | #define CCM_WIMR0_GPIO3 (1 << 0) | 1508 | #define CCM_WIMR0_GPIO3 (1 << 0) |
1414 | #define CCM_WIMR0_GPIO2 (1 << 1) | 1509 | #define CCM_WIMR0_GPIO2 (1 << 1) |
1415 | #define CCM_WIMR0_GPIO1 (1 << 2) | 1510 | #define CCM_WIMR0_GPIO1 (1 << 2) |
@@ -1443,6 +1538,114 @@ | |||
1443 | #define CCM_WIMR0_RESERVED30 (1 << 30) | 1538 | #define CCM_WIMR0_RESERVED30 (1 << 30) |
1444 | #define CCM_WIMR0_RESERVED31 (1 << 31) | 1539 | #define CCM_WIMR0_RESERVED31 (1 << 31) |
1445 | 1540 | ||
1541 | /* LDC */ | ||
1542 | /* 32 bits specify value */ | ||
1543 | |||
1544 | /* DCVR0-DCVR3 */ | ||
1545 | #define CCM_DCVR_ULV (0x3ff << 22) /* Upper limit */ | ||
1546 | #define CCM_DCVR_ULV_POS (22) | ||
1547 | #define CCM_DCVR_LLV (0x3ff << 12) /* Lower limit */ | ||
1548 | #define CCM_DCVR_LLV_POS (12) | ||
1549 | #define CCM_DCVR_ELV (0x3ff << 2) /* Emergency limit */ | ||
1550 | #define CCM_DCVR_ELV_POS (2) | ||
1551 | |||
1552 | #if 0 | ||
1553 | enum DVFS_W_SIGS | ||
1554 | { | ||
1555 | DVFS_W_SIGS_M3IF_M0_BUF = 0, /* Hready signal of M3IF's master #0 | ||
1556 | (L2 Cache) */ | ||
1557 | DVFS_W_SIGS_M3IF_M1 = 1, /* Hready signal of M3IF's master #1 | ||
1558 | (L2 Cache) */ | ||
1559 | DVFS_W_SIGS_MBX_MBXCLKGATE = 2, /* Hready signal of M3IF's master #2 | ||
1560 | (MBX) */ | ||
1561 | DVFS_W_SIGS_M3IF_M3 = 3, /* Hready signal of M3IF's master #3 | ||
1562 | (MAX) */ | ||
1563 | DVFS_W_SIGS_M3IF_M4 = 4, /* Hready signal of M3IF's master #4 | ||
1564 | (SDMA) */ | ||
1565 | DVFS_W_SIGS_M3IF_M5 = 5, /* Hready signal of M3IF's master #5 | ||
1566 | (mpeg4_vga_encoder) */ | ||
1567 | DVFS_W_SIGS_M3IF_M6 = 6, /* Hready signal of M3IF's master #6 | ||
1568 | (IPU) */ | ||
1569 | DVFS_W_SIGS_M3IF_M7 = 7, /* Hready signal of M3IF's master #7 | ||
1570 | (IPU) */ | ||
1571 | DVFS_W_SIGS_ARM11_P_IRQ_B_RBT_GATE = 8, /* ARM normal interrupt */ | ||
1572 | DVFS_W_SIGS_ARM11_P_FIQ_B_RBT_GATE = 9, /* ARM fast interrupt */ | ||
1573 | DVFS_W_SIGS_IPI_GPIO1_INT0 = 10, /* Interrupt line from GPIO */ | ||
1574 | DVFS_W_SIGS_IPI_INT_IPU_FUNC = 11, /* Interrupt line from IPU */ | ||
1575 | DVFS_W_SIGS_DVGP0 = 12, /* Software-controllable general-purpose | ||
1576 | bits from the CCM */ | ||
1577 | DVFS_W_SIGS_DVGP1 = 13, /* Software-controllable general-purpose | ||
1578 | bits from the CCM */ | ||
1579 | DVFS_W_SIGS_DVGP2 = 14, /* Software-controllable general-purpose | ||
1580 | bits from the CCM */ | ||
1581 | DVFS_W_SIGS_DVGP3 = 15, /* Software-controllable general-purpose | ||
1582 | bits from the CCM */ | ||
1583 | }; | ||
1584 | #endif | ||
1585 | |||
1586 | /* LTR0 */ | ||
1587 | #define CCM_LTR0_UPTHR (0x3f << 22) | ||
1588 | #define CCM_LTR0_UPTHR_POS (22) | ||
1589 | #define CCM_LTR0_DNTHR (0x3f << 16) | ||
1590 | #define CCM_LTR0_DNTHR_POS (16) | ||
1591 | /* for div_3_clk */ | ||
1592 | #define CCM_LTR0_DIV3CK (0x3 << 1) | ||
1593 | #define CCM_LTR0_DIV3CK_POS (1) | ||
1594 | #define CCM_LTR0_DIV3CK_2048 (0x0 << 1) /* 1/2048 ARM clock */ | ||
1595 | #define CCM_LTR0_DIV3CK_8192 (0x1 << 1) /* 1/8192 ARM clock */ | ||
1596 | #define CCM_LTR0_DIV3CK_32768 (0x2 << 1) /* 1/32768 ARM clock */ | ||
1597 | #define CCM_LTR0_DIV3CK_131072 (0x3 << 1) /* 1/131072 ARM clock */ | ||
1598 | |||
1599 | /* PMCR0 */ | ||
1600 | #define CCM_PMCR0_DVSUP_MCUPLL (1 << 31) | ||
1601 | #define CCM_PMCR0_DVSUP_POST_DIVIDERS (1 << 30) | ||
1602 | #define CCM_PMCR0_DVSUP_DVS (0x3 << 28) | ||
1603 | #define CCM_PMCR0_DVS1_0_DVS0_0 (0x0 << 28) /* Highest frequency/voltage */ | ||
1604 | #define CCM_PMCR0_DVS1_0_DVS0_1 (0x1 << 28) /* ... */ | ||
1605 | #define CCM_PMCR0_DVS1_1_DVS0_0 (0x2 << 28) /* ... */ | ||
1606 | #define CCM_PMCR0_DVS1_1_DVS0_1 (0x3 << 28) /* Lowest frequency/voltage */ | ||
1607 | #define CCM_PMCR0_DVS_POS (28) | ||
1608 | #define CCM_PMCR0_UDSC (1 << 27) | ||
1609 | #define CCM_PMCR0_VSCNT (0x7 << 24) | ||
1610 | #define CCM_PMCR0_VSCNT_POS (24) | ||
1611 | #define CCM_PMCR0_DVFEV (1 << 23) | ||
1612 | #define CCM_PMCR0_DVFIS (1 << 22) | ||
1613 | #define CCM_PMCR0_LBMI (1 << 21) | ||
1614 | #define CCM_PMCR0_LBFL (1 << 20) | ||
1615 | #define CCM_PMCR0_LBCF (0x3 << 18) | ||
1616 | #define CCM_PMCR0_LBCF_4 (0x0 << 18) | ||
1617 | #define CCM_PMCR0_LBCF_8 (0x1 << 18) | ||
1618 | #define CCM_PMCR0_LBCF_12 (0x2 << 18) | ||
1619 | #define CCM_PMCR0_LBCF_16 (0x3 << 18) | ||
1620 | #define CCM_PMCR0_PTVIS (1 << 17) | ||
1621 | #define CCM_PMCR0_UPDTEN (1 << 16) | ||
1622 | #define CCM_PMCR0_FSVAIM (1 << 15) | ||
1623 | #define CCM_PMCR0_FSVAI (0x3 << 13) | ||
1624 | #define CCM_PMCR0_FSVAI_NO_INT (0x0 << 13) | ||
1625 | #define CCM_PMCR0_FSVAI_INCREASE (0x1 << 13) | ||
1626 | #define CCM_PMCR0_FSVAI_DECREASE (0x2 << 13) | ||
1627 | #define CCM_PMCR0_FSVAI_INCREASE_NOW (0x3 << 13) | ||
1628 | #define CCM_PMCR0_FSVAI_POS (13) | ||
1629 | #define CCM_PMCR0_DPVCR (1 << 12) | ||
1630 | #define CCM_PMCR0_DPVV (1 << 11) | ||
1631 | #define CCM_PMCR0_WFIM (1 << 10) | ||
1632 | #define CCM_PMCR0_DRCE3 (1 << 9) | ||
1633 | #define CCM_PMCR0_DRCE2 (1 << 8) | ||
1634 | #define CCM_PMCR0_DRCE1 (1 << 7) | ||
1635 | #define CCM_PMCR0_DRCE0 (1 << 6) | ||
1636 | #define CCM_PMCR0_DCR (1 << 5) /* 512 vs 256 count */ | ||
1637 | #define CCM_PMCR0_DVFEN (1 << 4) | ||
1638 | #define CCM_PMCR0_PTVAIM (1 << 3) | ||
1639 | #define CCM_PMCR0_PTVAI (0x3 << 1) | ||
1640 | #define CCM_PMCR0_PTVAI_NO_INT (0x0 << 1) | ||
1641 | #define CCM_PMCR0_PTVAI_DECREASE (0x1 << 1) | ||
1642 | #define CCM_PMCR0_PTVAI_INCREASE (0x2 << 1) | ||
1643 | #define CCM_PMCR0_PTVAI_INCREASE_NOW (0x3 << 1) | ||
1644 | #define CCM_PMCR0_DPTEN (1 << 0) | ||
1645 | |||
1646 | |||
1647 | |||
1648 | |||
1446 | /* WEIM - CS0 */ | 1649 | /* WEIM - CS0 */ |
1447 | #define CSCRU 0x00 | 1650 | #define CSCRU 0x00 |
1448 | #define CSCRL 0x04 | 1651 | #define CSCRL 0x04 |
diff --git a/firmware/export/mc13783.h b/firmware/export/mc13783.h index 09fb1f1fc4..0a83527c57 100644 --- a/firmware/export/mc13783.h +++ b/firmware/export/mc13783.h | |||
@@ -523,6 +523,52 @@ enum mc13783_regs_enum | |||
523 | #define MC13783_SW2BSTBY (0x3f << 12) | 523 | #define MC13783_SW2BSTBY (0x3f << 12) |
524 | #define MC13783_SW2BSTBY_POS (12) | 524 | #define MC13783_SW2BSTBY_POS (12) |
525 | 525 | ||
526 | /* Switcher Voltages (SWITCHERS0-SWITCHERS3) */ | ||
527 | /* Switcher 1 and 2 */ | ||
528 | #define MC13783_SW_0_900 0x00 /* 0.900 V */ | ||
529 | #define MC13783_SW_0_925 0x01 /* 0.925 V */ | ||
530 | #define MC13783_SW_0_950 0x02 /* 0.950 V */ | ||
531 | #define MC13783_SW_0_975 0x03 /* 0.975 V */ | ||
532 | #define MC13783_SW_1_000 0x04 /* 1.000 V */ | ||
533 | #define MC13783_SW_1_025 0x05 /* 1.025 V */ | ||
534 | #define MC13783_SW_1_050 0x06 /* 1.050 V */ | ||
535 | #define MC13783_SW_1_075 0x07 /* 1.075 V */ | ||
536 | #define MC13783_SW_1_100 0x08 /* 1.100 V */ | ||
537 | #define MC13783_SW_1_125 0x09 /* 1.125 V */ | ||
538 | #define MC13783_SW_1_150 0x0a /* 1.150 V */ | ||
539 | #define MC13783_SW_1_175 0x0b /* 1.175 V */ | ||
540 | #define MC13783_SW_1_200 0x0c /* 1.200 V */ | ||
541 | #define MC13783_SW_1_225 0x0d /* 1.225 V */ | ||
542 | #define MC13783_SW_1_250 0x0e /* 1.250 V */ | ||
543 | #define MC13783_SW_1_275 0x0f /* 1.275 V */ | ||
544 | #define MC13783_SW_1_300 0x10 /* 1.300 V */ | ||
545 | #define MC13783_SW_1_325 0x11 /* 1.325 V */ | ||
546 | #define MC13783_SW_1_350 0x12 /* 1.350 V */ | ||
547 | #define MC13783_SW_1_375 0x13 /* 1.375 V */ | ||
548 | #define MC13783_SW_1_400 0x14 /* 1.400 V */ | ||
549 | #define MC13783_SW_1_425 0x15 /* 1.425 V */ | ||
550 | #define MC13783_SW_1_450 0x16 /* 1.450 V */ | ||
551 | #define MC13783_SW_1_475 0x17 /* 1.475 V */ | ||
552 | #define MC13783_SW_1_500 0x18 /* 1.500 V */ | ||
553 | #define MC13783_SW_1_525 0x19 /* 1.525 V */ | ||
554 | #define MC13783_SW_1_550 0x1a /* 1.550 V */ | ||
555 | #define MC13783_SW_1_575 0x1b /* 1.575 V */ | ||
556 | #define MC13783_SW_1_600 0x1c /* 1.600 V */ | ||
557 | #define MC13783_SW_1_625 0x1d /* 1.625 V */ | ||
558 | #define MC13783_SW_1_650 0x1e /* 1.650 V */ | ||
559 | #define MC13783_SW_1_675 0x1f /* 1.675 V */ | ||
560 | #define MC13783_SW_1_700 0x20 /* 0x20 - 0x23 = 1.700V */ | ||
561 | #define MC13783_SW_1_800 0x24 /* 0x24 - 0x27 = 1.800V */ | ||
562 | /* Switcher 1 */ | ||
563 | #define MC13783_SW1_1_850 0x28 /* 0x29 - 0x2b = 1.850V */ | ||
564 | /* Switcher 2 */ | ||
565 | #define MC13783_SW2_1_900 0x28 /* 0x29 - 0x2b = 1.900V */ | ||
566 | /* Switcher 1 and 2 */ | ||
567 | #define MC13783_SW_2_000 0x2c /* 0x2c - 0x2f = 2.000V */ | ||
568 | #define MC13783_SW_2_100 0x30 /* 0x30 - 0x33 = 2.100V */ | ||
569 | #define MC13783_SW_2_200 0x34 /* 0x34 - 0x3f = 2.200V */ | ||
570 | |||
571 | |||
526 | /* SWITCHERS4 (28) */ | 572 | /* SWITCHERS4 (28) */ |
527 | #define MC13783_SW1AMODE (0x3 << 0) | 573 | #define MC13783_SW1AMODE (0x3 << 0) |
528 | #define MC13783_SW1AMODE_OFF (0x0 << 0) | 574 | #define MC13783_SW1AMODE_OFF (0x0 << 0) |
diff --git a/firmware/target/arm/imx31/dvfs_dptc-imx31.c b/firmware/target/arm/imx31/dvfs_dptc-imx31.c new file mode 100644 index 0000000000..8f32fd0fba --- /dev/null +++ b/firmware/target/arm/imx31/dvfs_dptc-imx31.c | |||
@@ -0,0 +1,48 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 by Michael Sevakis | ||
11 | * | ||
12 | * i.MX31 DVFS and DPTC drivers | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | #include "config.h" | ||
24 | #include "system.h" | ||
25 | #include "ccm-imx31.h" | ||
26 | #include "mc13783.h" | ||
27 | |||
28 | /* Most of the code in here is based upon the Linux BSP provided by Freescale | ||
29 | * Copyright 2004-2008 Freescale Semiconductor, Inc. All Rights Reserved. */ | ||
30 | |||
31 | void dvfs_dptc_start(void) | ||
32 | { | ||
33 | /* For now, just set the regulator voltage off of overdrive mode */ | ||
34 | /* For 264 MHz, DPTC is not needed and lower V can be used */ | ||
35 | |||
36 | mc13783_write_masked(MC13783_SWITCHERS0, | ||
37 | MC13783_SW_1_350 << MC13783_SW1A_POS, | ||
38 | MC13783_SW1A); | ||
39 | imx31_regmod32(&CCM_PMCR0, CCM_PMCR0_DVS1_0_DVS0_0, | ||
40 | CCM_PMCR0_DVSUP_DVS); | ||
41 | } | ||
42 | |||
43 | |||
44 | void dvfs_dptc_stop(void) | ||
45 | { | ||
46 | /* Nothing for now */ | ||
47 | } | ||
48 | |||
diff --git a/firmware/target/arm/imx31/dvfs_dptc-imx31.h b/firmware/target/arm/imx31/dvfs_dptc-imx31.h new file mode 100644 index 0000000000..8f6f5da98d --- /dev/null +++ b/firmware/target/arm/imx31/dvfs_dptc-imx31.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 by Michael Sevakis | ||
11 | * | ||
12 | * i.MX31 DVFS and DPTC driver declarations | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | #ifndef _DVFS_DPTC_IMX31_H_ | ||
25 | #define _DVFS_DPTC_IMX31_H_ | ||
26 | |||
27 | void dvfs_dptc_start(void); | ||
28 | void dvfs_dptc_stop(void); | ||
29 | |||
30 | #endif /* _DVFS_DPTC_IMX31_H_ */ | ||
diff --git a/firmware/target/arm/imx31/gigabeat-s/kernel-imx31.c b/firmware/target/arm/imx31/gigabeat-s/kernel-imx31.c index 775f5cebf0..8e81447bd3 100644 --- a/firmware/target/arm/imx31/gigabeat-s/kernel-imx31.c +++ b/firmware/target/arm/imx31/gigabeat-s/kernel-imx31.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "mc13783.h" | 25 | #include "mc13783.h" |
26 | #include "ccm-imx31.h" | 26 | #include "ccm-imx31.h" |
27 | #include "sdma-imx31.h" | 27 | #include "sdma-imx31.h" |
28 | #include "dvfs_dptc-imx31.h" | ||
28 | #include "kernel.h" | 29 | #include "kernel.h" |
29 | #include "thread.h" | 30 | #include "thread.h" |
30 | 31 | ||
@@ -69,6 +70,7 @@ void kernel_device_init(void) | |||
69 | sdma_init(); | 70 | sdma_init(); |
70 | spi_init(); | 71 | spi_init(); |
71 | mc13783_init(); | 72 | mc13783_init(); |
73 | dvfs_dptc_start(); | ||
72 | } | 74 | } |
73 | 75 | ||
74 | #ifdef BOOTLOADER | 76 | #ifdef BOOTLOADER |
diff --git a/firmware/target/arm/imx31/gigabeat-s/system-imx31.c b/firmware/target/arm/imx31/gigabeat-s/system-imx31.c index 65299cb8d0..cd684e77ac 100644 --- a/firmware/target/arm/imx31/gigabeat-s/system-imx31.c +++ b/firmware/target/arm/imx31/gigabeat-s/system-imx31.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "debug.h" | 31 | #include "debug.h" |
32 | #include "ccm-imx31.h" | 32 | #include "ccm-imx31.h" |
33 | #include "mc13783.h" | 33 | #include "mc13783.h" |
34 | #include "dvfs_dptc-imx31.h" | ||
34 | 35 | ||
35 | static unsigned long product_rev; | 36 | static unsigned long product_rev; |
36 | static unsigned long system_rev; | 37 | static unsigned long system_rev; |
@@ -241,6 +242,7 @@ void __attribute__((naked)) imx31_regclr32(volatile uint32_t *reg_p, | |||
241 | #ifdef BOOTLOADER | 242 | #ifdef BOOTLOADER |
242 | void system_prepare_fw_start(void) | 243 | void system_prepare_fw_start(void) |
243 | { | 244 | { |
245 | dvfs_dptc_stop(); | ||
244 | disable_interrupt(IRQ_FIQ_STATUS); | 246 | disable_interrupt(IRQ_FIQ_STATUS); |
245 | avic_disable_int(INT_ALL); | 247 | avic_disable_int(INT_ALL); |
246 | mc13783_close(); | 248 | mc13783_close(); |