Path: blob/master/arch/sh/boot/romimage/mmcif-sh7724.c
10819 views
/*1* sh7724 MMCIF loader2*3* Copyright (C) 2010 Magnus Damm4*5* This file is subject to the terms and conditions of the GNU General Public6* License. See the file "COPYING" in the main directory of this archive7* for more details.8*/910#include <linux/mmc/sh_mmcif.h>11#include <linux/mmc/boot.h>12#include <mach/romimage.h>1314#define MMCIF_BASE (void __iomem *)0xa4ca00001516#define MSTPCR2 0xa415003817#define PTWCR 0xa405014618#define PTXCR 0xa405014819#define PSELA 0xa405014e20#define PSELE 0xa405015621#define HIZCRC 0xa405015c22#define DRVCRA 0xa405018a2324/* SH7724 specific MMCIF loader25*26* loads the romImage from an MMC card starting from block 51227* use the following line to write the romImage to an MMC card28* # dd if=arch/sh/boot/romImage of=/dev/sdx bs=512 seek=51229*/30asmlinkage void mmcif_loader(unsigned char *buf, unsigned long no_bytes)31{32mmcif_update_progress(MMC_PROGRESS_ENTER);3334/* enable clock to the MMCIF hardware block */35__raw_writel(__raw_readl(MSTPCR2) & ~0x20000000, MSTPCR2);3637/* setup pins D7-D0 */38__raw_writew(0x0000, PTWCR);3940/* setup pins MMC_CLK, MMC_CMD */41__raw_writew(__raw_readw(PTXCR) & ~0x000f, PTXCR);4243/* select D3-D0 pin function */44__raw_writew(__raw_readw(PSELA) & ~0x2000, PSELA);4546/* select D7-D4 pin function */47__raw_writew(__raw_readw(PSELE) & ~0x3000, PSELE);4849/* disable Hi-Z for the MMC pins */50__raw_writew(__raw_readw(HIZCRC) & ~0x0620, HIZCRC);5152/* high drive capability for MMC pins */53__raw_writew(__raw_readw(DRVCRA) | 0x3000, DRVCRA);5455mmcif_update_progress(MMC_PROGRESS_INIT);5657/* setup MMCIF hardware */58sh_mmcif_boot_init(MMCIF_BASE);5960mmcif_update_progress(MMC_PROGRESS_LOAD);6162/* load kernel via MMCIF interface */63sh_mmcif_boot_do_read(MMCIF_BASE, 512,64(no_bytes + SH_MMCIF_BBS - 1) / SH_MMCIF_BBS,65buf);6667/* disable clock to the MMCIF hardware block */68__raw_writel(__raw_readl(MSTPCR2) | 0x20000000, MSTPCR2);6970mmcif_update_progress(MMC_PROGRESS_DONE);71}727374