int omap4430_enable_emu() { int ret = -1; void *base_cm_emu, *base_l3instr_l3; int timeout = GLOBAL_TIMEOUT; base_cm_emu = map_page(OMAP4430_CM_EMU); if (base_cm_emu == NULL) goto end; base_l3instr_l3 = map_page(OMAP4430_CM_L3INSTR_L3); if (base_l3instr_l3 == NULL) goto unmap_cm_emu; // Enable clocks __writel(0x2, base_cm_emu + 0xA00); __writel(0x1, base_l3instr_l3 + 0xE20); __writel(0x1, base_l3instr_l3 + 0xE28); // Check if it worked while (--timeout) if (((__readl(base_cm_emu + 0xA00) & 0xf00) == 0x300) && (__readl(base_cm_emu + 0xA20) & 0x40000)) { ret = 0; break; } unmap_page(base_l3instr_l3); unmap_cm_emu: unmap_page(base_cm_emu); end: return ret; }
int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type) { size_t i; int mask_type, num_entries = __get_num_entries(); if (mem->page_count == 0) return 0; #ifdef __PATCH__ num_entries = agp_num_entries(); if (((pg_start + mem->page_count) > num_entries) || ((pg_start + mem->page_count) < pg_start)) return -EINVAL; #endif mask_type = __agp_type_to_mask_type(type); if (mask_type != 0) { /* The generic routines know nothing of memory types */ return -EINVAL; } /* AK: bogus, should encode addresses > 4GB */ for (i = pg_start; i < (mem->page_count + pg_start); i++) { // exp: {{uadd}} __writel(i); } return 0; }
void _writel(unsigned int b, unsigned long addr) { __writel(b, addr); }