Changeset 4c754f6 in mainline for kernel/genarch
- Timestamp:
- 2013-02-11T22:55:29Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0f66886
- Parents:
- 40762c6
- Location:
- kernel/genarch
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/include/drivers/am335x/cm_dpll.h
r40762c6 r4c754f6 37 37 #define _KERN_AM335X_CM_DPLL_H_ 38 38 39 #include <drivers/am335x/cm_dpll_regs.h> 39 #include "cm_dpll_regs.h" 40 #include "timer.h" 40 41 41 42 #define AM335x_CM_DPLL_BASE_ADDRESS 0x44E00500 42 43 #define AM335x_CM_DPLL_SIZE 256 44 45 static ioport32_t *am335x_cm_dpll_timer_reg_get(am335x_cm_dpll_regs_t *cm, 46 am335x_timer_id_t id) 47 { 48 switch (id) { 49 default: 50 return NULL; 51 case DMTIMER2: 52 return &cm->clksel_timer2; 53 case DMTIMER3: 54 return &cm->clksel_timer3; 55 case DMTIMER4: 56 return &cm->clksel_timer4; 57 case DMTIMER5: 58 return &cm->clksel_timer5; 59 case DMTIMER6: 60 return &cm->clksel_timer6; 61 case DMTIMER7: 62 return &cm->clksel_timer7; 63 } 64 } 65 66 static void am335x_clock_source_select(am335x_cm_dpll_regs_t *cm, 67 am335x_timer_id_t id, am335x_clk_src_t src) 68 { 69 ioport32_t *reg = am335x_cm_dpll_timer_reg_get(cm, id); 70 if (!reg) 71 return; 72 73 *reg = (*reg & ~0x03) | src; 74 } 43 75 44 76 #endif -
kernel/genarch/include/drivers/am335x/cm_dpll_regs.h
r40762c6 r4c754f6 37 37 #define _KERN_AM335X_CM_DPLL_REGS_H_ 38 38 39 #define AM335x_CM_CLKSEL_TIMERS_CLK32KHZ 0x02 40 #define AM335x_CM_CLKSEL_TIMERS_CLKMOSC 0x01 41 #define AM335x_CM_CLKSEL_TIMERS_TCLKIN 0x00 39 typedef enum { 40 CLK_SRC_TCLKIN = 0x00, 41 CLK_SRC_M_OSC, 42 CLK_SRC_32_KHZ 43 } am335x_clk_src_t; 42 44 43 45 typedef struct am335x_cm_dpll_regs { … … 76 78 ioport32_t clksel_gpio0_db; 77 79 78 79 80 } am335x_cm_dpll_regs_t; 80 81 -
kernel/genarch/include/drivers/am335x/cm_per_regs.h
r40762c6 r4c754f6 37 37 #define _KERN_AM335X_CM_PER_REGS_H_ 38 38 39 #include <typedefs.h> 40 39 41 typedef struct am335x_cm_per_regs { 40 42 … … 145 147 #define AM335x_CM_PER_MMC0_CLKCTRL_IDLEST_SHIFT 16 146 148 147 ioport32_ elm_clkctrl;149 ioport32_t elm_clkctrl; 148 150 #define AM335x_CM_PER_ELM_CLKCTRL_MODULEMODE_MASK 0x3 149 151 #define AM335x_CM_PER_ELM_CLKCTRL_MODULEMODE_SHIFT 0 … … 406 408 ioport32_t const pad7[2]; 407 409 408 ioport32_t l3_clkstctrl;409 #define AM335x_CM_PER_ L3_CLKSTCTRL_CLKTRCTRL_MASK 0x3410 #define AM335x_CM_PER_ L3_CLKSTCTRL_CLKTRCTRL_SHIFT 0411 #define AM335x_CM_PER_ L3_CLKSTCTRL_CLKACTIVITY_OCPWP_L3_FLAG (1 << 4)412 #define AM335x_CM_PER_ L3_CLKSTCTRL_CLKACTIVITY_OCPWP_L4_FLAG (1 << 5)410 ioport32_t ocpwp_l3_clkstctrl; 411 #define AM335x_CM_PER_OCPWP_L3_CLKSTCTRL_CLKTRCTRL_MASK 0x3 412 #define AM335x_CM_PER_OCPWP_L3_CLKSTCTRL_CLKTRCTRL_SHIFT 0 413 #define AM335x_CM_PER_OCPWP_L3_CLKSTCTRL_CLKACTIVITY_OCPWP_L3_FLAG (1 << 4) 414 #define AM335x_CM_PER_OCPWP_L3_CLKSTCTRL_CLKACTIVITY_OCPWP_L4_FLAG (1 << 5) 413 415 414 416 ioport32_t ocpwp_clkctrl; -
kernel/genarch/include/drivers/am335x/ctrl_module.h
r40762c6 r4c754f6 37 37 #define _KERN_AM335X_CTRL_MODULE_H_ 38 38 39 #include <drivers/am335x/ctrl_module_regs.h> 39 #include <typedefs.h> 40 #include "ctrl_module_regs.h" 40 41 41 42 #define AM335x_CTRL_MODULE_BASE_ADDRESS 0x44E10000 42 43 #define AM335x_CTRL_MODULE_SIZE 131072 /* 128 Kb */ 43 44 44 static unsigned am335x_ctrl_module_clock_freq_get(void *base) 45 typedef ioport32_t am335x_ctrl_module_t; 46 47 static unsigned am335x_ctrl_module_clock_freq_get(am335x_ctrl_module_t *base) 45 48 { 46 unsigned const control_status = AM335x_CTRL_MODULE_REG_ADDR(base,49 unsigned const control_status = *AM335x_CTRL_MODULE_REG_ADDR(base, 47 50 CONTROL_SYSCONFIG); 48 51 unsigned const sysboot1 = (control_status >> 22) & 0x03; 49 52 50 switch (sysboot ) {53 switch (sysboot1) { 51 54 default: 52 55 case 0: -
kernel/genarch/include/drivers/am335x/timer.h
r40762c6 r4c754f6 37 37 #define _KERN_AM335X_TIMER_H_ 38 38 39 #include "timer_regs.h"39 #include <genarch/drivers/am335x/timer_regs.h> 40 40 41 41 #define AM335x_DMTIMER0_BASE_ADDRESS 0x44E05000 … … 86 86 87 87 extern void am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id, 88 unsigned hz );88 unsigned hz, unsigned srcclk_hz); 89 89 extern void am335x_timer_intr_ack(am335x_timer_t *timer); 90 90 extern void am335x_timer_reset(am335x_timer_t *timer); -
kernel/genarch/src/drivers/am335x/timer.c
r40762c6 r4c754f6 56 56 57 57 void 58 am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id, unsigned hz) 58 am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id, unsigned hz, 59 unsigned srcclk_hz) 59 60 { 60 61 uintptr_t base_addr; … … 86 87 regs->tclr |= AM335x_TIMER_TCLR_AR_FLAG; 87 88 88 /* XXX Here we assume that the timer clock source 89 * is running at 32 Khz but this is not always the 90 * case; DMTIMER[2 - 7] can use the internal system 24 Mhz 91 * clock source or an external clock also. 92 */ 93 unsigned const count = 0xFFFFFFFE - 32768 / hz; 89 /* Disable the emulation mode */ 90 regs->tiocp_cfg |= AM335x_TIMER_TIOCPCFG_EMUFREE_FLAG; 91 92 unsigned const count = 0xFFFFFFFE - (srcclk_hz / hz); 94 93 regs->tcrr = count; 95 94 regs->tldr = count;
Note:
See TracChangeset
for help on using the changeset viewer.