From patchwork Tue Jan 12 10:18:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Purna Chandra Mandal X-Patchwork-Id: 566459 X-Patchwork-Delegate: daniel.schwierzeck@googlemail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 045101402C4 for ; Tue, 12 Jan 2016 21:22:34 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 14FABA74C5; Tue, 12 Jan 2016 11:21:27 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HE8LYxW0we-F; Tue, 12 Jan 2016 11:21:26 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 79F234BF7B; Tue, 12 Jan 2016 11:21:07 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0CEDE4BF95 for ; Tue, 12 Jan 2016 11:21:04 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NhyCEix9g80N for ; Tue, 12 Jan 2016 11:21:03 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from email.microchip.com (exsmtp03.microchip.com [198.175.253.49]) by theia.denx.de (Postfix) with ESMTPS id 3D9F44BF64 for ; Tue, 12 Jan 2016 11:20:46 +0100 (CET) Received: from mx.microchip.com (10.10.76.4) by chn-sv-exch03.mchp-main.com (10.10.76.49) with Microsoft SMTP Server id 14.3.181.6; Tue, 12 Jan 2016 03:20:43 -0700 Received: by mx.microchip.com (sSMTP sendmail emulation); Tue, 12 Jan 2016 15:49:31 +0530 From: Purna Chandra Mandal To: Date: Tue, 12 Jan 2016 15:48:26 +0530 Message-ID: <1452593909-16184-12-git-send-email-purna.mandal@microchip.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1452593909-16184-1-git-send-email-purna.mandal@microchip.com> References: <1452593909-16184-1-git-send-email-purna.mandal@microchip.com> MIME-Version: 1.0 Cc: Purna Chandra Mandal Subject: [U-Boot] [PATCH v3 11/14] board: add SDHCI support for PIC32MZDASK board. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Enable MMC, SDHCI, FAT FS, EXT4 FS support for PIC32MZ[DA] StarterKit. Also add custom scripts, rules to boot Linux from microSD card. Signed-off-by: Purna Chandra Mandal --- Changes in v3: None Changes in v2: - drop shared bus (shared pin selection) configuration. arch/mips/dts/pic32mzda.dtsi | 11 ++++++++ arch/mips/dts/pic32mzda_sk.dts | 7 +++++ configs/pic32mzdask_defconfig | 6 +++-- include/configs/pic32mzdask.h | 61 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 2 deletions(-) diff --git a/arch/mips/dts/pic32mzda.dtsi b/arch/mips/dts/pic32mzda.dtsi index fe8b13a..3d62a17 100644 --- a/arch/mips/dts/pic32mzda.dtsi +++ b/arch/mips/dts/pic32mzda.dtsi @@ -150,4 +150,15 @@ #gpio-cells = <2>; }; }; + + sdhci: sdhci@1f8ec000 { + compatible = "microchip,pic32mzda-sdhci"; + reg = <0x1f8ec000 0x100>; + interrupts = <191 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clock REF4CLK>, <&clock PB5CLK>; + clock-names = "base_clk", "sys_clk"; + clock-freq-min-max = <25000000>,<25000000>; + bus-width = <4>; + status = "disabled"; + }; }; diff --git a/arch/mips/dts/pic32mzda_sk.dts b/arch/mips/dts/pic32mzda_sk.dts index 99e7f64..f886a0f 100644 --- a/arch/mips/dts/pic32mzda_sk.dts +++ b/arch/mips/dts/pic32mzda_sk.dts @@ -23,6 +23,9 @@ }; &clock { + microchip,refo2-frequency = <50000000>; + microchip,refo4-frequency = <25000000>; + microchip,refo5-frequency = <40000000>; status = "okay"; u-boot,dm-pre-reloc; }; @@ -36,3 +39,7 @@ status = "okay"; u-boot,dm-pre-reloc; }; + +&sdhci { + status = "okay"; +}; \ No newline at end of file diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig index 3483eb0..6981cf7 100644 --- a/configs/pic32mzdask_defconfig +++ b/configs/pic32mzdask_defconfig @@ -122,7 +122,7 @@ CONFIG_CMD_XIMG=y # # Environment commands # -# CONFIG_CMD_EXPORTENV is not set +CONFIG_CMD_EXPORTENV=y CONFIG_CMD_IMPORTENV=y CONFIG_CMD_EDITENV=y # CONFIG_CMD_SAVEENV is not set @@ -284,7 +284,9 @@ CONFIG_PIC32_GPIO=y # # MMC Host controller Support # -# CONFIG_DM_MMC is not set +CONFIG_DM_MMC=y +# CONFIG_ROCKCHIP_DWMMC is not set +CONFIG_PIC32_SDHCI=y # # MTD Support diff --git a/include/configs/pic32mzdask.h b/include/configs/pic32mzdask.h index 6552fa2..224b21c 100644 --- a/include/configs/pic32mzdask.h +++ b/include/configs/pic32mzdask.h @@ -78,6 +78,33 @@ */ #define CONFIG_OF_LIBFDT 1 +/*----------------------------------------------------------------------- + * SDHC Configuration + */ +#define CONFIG_SDHCI +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_CMD_MMC + +/*----------------------------------------------------------------------- + * File System Configuration + */ +/* FAT FS */ +#define CONFIG_DOS_PARTITION +#define CONFIG_PARTITION_UUIDS +#define CONFIG_SUPPORT_VFAT +#define CONFIG_FS_FAT +#define CONFIG_FAT_WRITE +#define CONFIG_CMD_FS_GENERIC +#define CONFIG_CMD_PART +#define CONFIG_CMD_FAT + +/* EXT4 FS */ +#define CONFIG_FS_EXT4 +#define CONFIG_CMD_EXT2 +#define CONFIG_CMD_EXT4 +#define CONFIG_CMD_EXT4_WRITE + /* ------------------------------------------------- * Environment */ @@ -91,4 +118,38 @@ #define CONFIG_BOOTDELAY 5 /* autoboot after X seconds */ #undef CONFIG_BOOTARGS +#define CONFIG_EXTRA_ENV_SETTINGS \ + "loadaddr="__stringify(CONFIG_SYS_LOAD_ADDR)"\0" \ + "uenvfile=uEnv.txt\0" \ + "uenvaddr="__stringify(CONFIG_SYS_ENV_ADDR)"\0" \ + "scriptfile=boot.scr\0" \ + "ubootfile=u-boot.bin\0" \ + "importbootenv= " \ + "env import -t -r ${uenvaddr} ${filesize};\0" \ + \ + "mmcloadenv=fatload mmc 0 ${uenvaddr} ${uenvfile}\0" \ + "mmcloadscr=fatload mmc 0 ${uenvaddr} ${scriptfile}\0" \ + "mmcloadub=fatload mmc 0 ${loadaddr} ${ubootfile}\0" \ + \ + "loadbootenv=run mmcloadenv\0" \ + "loadbootscr=run mmcloadscr\0" \ + "bootcmd_root= " \ + "if run loadbootenv; then " \ + "echo Loaded environment ${uenvfile}; " \ + "run importbootenv; " \ + "fi; " \ + "if test -n \"${bootcmd_uenv}\" ; then " \ + "echo Running bootcmd_uenv ...; " \ + "run bootcmd_uenv; " \ + "fi; " \ + "if run loadbootscr; then " \ + "echo Jumping to ${scriptfile}; " \ + "source ${uenvaddr}; " \ + "fi; " \ + "echo Custom environment or script not found. " \ + "Aborting auto booting...; \0" \ + "" + +#define CONFIG_BOOTCOMMAND "run bootcmd_root" + #endif /* __PIC32MZDASK_CONFIG_H */