From patchwork Mon Jan 4 14:01:49 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: 562399 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 82AFE1402D8 for ; Tue, 5 Jan 2016 01:04:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BBC644B8BB; Mon, 4 Jan 2016 15:03:25 +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 WCKtzsu8r9eo; Mon, 4 Jan 2016 15:03:25 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 519644B89D; Mon, 4 Jan 2016 15:03:23 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D6C894B89C for ; Mon, 4 Jan 2016 15:03:05 +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 9jDwqdXwz-Rw for ; Mon, 4 Jan 2016 15:03:05 +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 1EF914B8E6 for ; Mon, 4 Jan 2016 15:03:04 +0100 (CET) Received: from centos7pc (10.10.76.4) by chn-sv-exch03.mchp-main.com (10.10.76.49) with Microsoft SMTP Server id 14.3.181.6; Mon, 4 Jan 2016 07:02:57 -0700 Message-ID: <1451916109.27601.128.camel@microchip.com> From: Purna Chandra Mandal To: Date: Mon, 4 Jan 2016 19:31:49 +0530 Organization: Microchip India Technology Pvt Ltd X-Mailer: Evolution 3.12.11 (3.12.11-15.el7) MIME-Version: 1.0 Cc: purna.mandal@microchip.com Subject: [U-Boot] [PATCH v2 09/13] 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" Added custom environment variables and rules to locate and load files (from uSD card) in order to boot Linux. Signed-off-by: Purna Chandra Mandal --- Changes in v2: None arch/mips/dts/pic32mzda.dtsi | 13 +++++++++ arch/mips/dts/pic32mzda_sk.dts | 7 +++++ configs/pic32mzdask_defconfig | 2 ++ include/configs/pic32mzdask.h | 61 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+) diff --git a/arch/mips/dts/pic32mzda.dtsi b/arch/mips/dts/pic32mzda.dtsi index f518ba8..bdddb93 100644 --- a/arch/mips/dts/pic32mzda.dtsi +++ b/arch/mips/dts/pic32mzda.dtsi @@ -61,4 +61,17 @@ <0x1f801500 0x200>; /* out */ status = "disabled"; }; + + 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"; + bus-width = <4>; + cap-sd-highspeed; + clock-freq-min-max = <25000000>,<25000000>; + clock-irq-pins = <1>,<1>; + 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 13760e6..d11eddd 100644 --- a/configs/pic32mzdask_defconfig +++ b/configs/pic32mzdask_defconfig @@ -19,3 +19,5 @@ CONFIG_CLK=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_FULL is not set CONFIG_PIC32_PINCTRL=y +CONFIG_DM_MMC=y +CONFIG_PIC32_SDHCI=y \ No newline at end of file diff --git a/include/configs/pic32mzdask.h b/include/configs/pic32mzdask.h index 3624107..52e53e9 100644 --- a/include/configs/pic32mzdask.h +++ b/include/configs/pic32mzdask.h @@ -84,6 +84,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 */ @@ -97,4 +124,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 */