From 31e0bd6974cbaca15e15f400acf1d7499e86fe17 Mon Sep 17 00:00:00 2001 From: Luka Perkov Date: Mon, 4 Nov 2013 02:12:00 +0100 Subject: config: arm: exynos5250: remove duplicate defines The SPI section is already defined in this file (lines 268-288) so we can remove the duplicate definitions. While at it, also fix one tiny whitespace typo. Signed-off-by: Luka Perkov Signed-off-by: Minkyu Kang --- include/configs/exynos5250-dt.h | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h index bdefee1..2bd91a5 100644 --- a/include/configs/exynos5250-dt.h +++ b/include/configs/exynos5250-dt.h @@ -255,7 +255,7 @@ #define CONFIG_DRIVER_S3C24X0_I2C #define CONFIG_I2C_MULTI_BUS #define CONFIG_MAX_I2C_NUM 8 -#define CONFIG_SYS_I2C_SLAVE 0x0 +#define CONFIG_SYS_I2C_SLAVE 0x0 #define CONFIG_I2C_EDID /* PMIC */ @@ -290,27 +290,6 @@ #define CONFIG_POWER_I2C #define CONFIG_POWER_MAX77686 -/* SPI */ -#define CONFIG_ENV_IS_IN_SPI_FLASH -#define CONFIG_SPI_FLASH - -#ifdef CONFIG_SPI_FLASH -#define CONFIG_EXYNOS_SPI -#define CONFIG_CMD_SF -#define CONFIG_CMD_SPI -#define CONFIG_SPI_FLASH_WINBOND -#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0 -#define CONFIG_SF_DEFAULT_SPEED 50000000 -#define EXYNOS5_SPI_NUM_CONTROLLERS 5 -#endif - -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH -#define CONFIG_ENV_SPI_MODE SPI_MODE_0 -#define CONFIG_ENV_SECT_SIZE CONFIG_ENV_SIZE -#define CONFIG_ENV_SPI_BUS 1 -#define CONFIG_ENV_SPI_MAX_HZ 50000000 -#endif - /* Ethernet Controllor Driver */ #ifdef CONFIG_CMD_NET #define CONFIG_SMC911X -- cgit v1.1 From 4498cf252bfd7f69a4e9aedd897306211a0be5af Mon Sep 17 00:00:00 2001 From: Piotr Wilczek Date: Thu, 21 Nov 2013 15:46:44 +0100 Subject: driver:usb:s3c_udc: add support for Exynos4x12 This patch add new defines for usb phy for Exynos4x12. Signed-off-by: Piotr Wilczek Signed-off-by: Kyungmin Park Signed-off-by: Minkyu Kang --- drivers/usb/gadget/regs-otg.h | 5 +++++ drivers/usb/gadget/s3c_udc_otg.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/regs-otg.h b/drivers/usb/gadget/regs-otg.h index 84bfcc5..ac5d112 100644 --- a/drivers/usb/gadget/regs-otg.h +++ b/drivers/usb/gadget/regs-otg.h @@ -226,6 +226,11 @@ struct s3c_usbotg_reg { #define CLK_SEL_12MHZ (0x2 << 0) #define CLK_SEL_48MHZ (0x0 << 0) +#define EXYNOS4X12_ID_PULLUP0 (0x01 << 3) +#define EXYNOS4X12_COMMON_ON_N0 (0x01 << 4) +#define EXYNOS4X12_CLK_SEL_12MHZ (0x02 << 0) +#define EXYNOS4X12_CLK_SEL_24MHZ (0x05 << 0) + /* Device Configuration Register DCFG */ #define DEV_SPEED_HIGH_SPEED_20 (0x0 << 0) #define DEV_SPEED_FULL_SPEED_20 (0x1 << 0) diff --git a/drivers/usb/gadget/s3c_udc_otg.c b/drivers/usb/gadget/s3c_udc_otg.c index 7e20209..ba17a04 100644 --- a/drivers/usb/gadget/s3c_udc_otg.c +++ b/drivers/usb/gadget/s3c_udc_otg.c @@ -167,8 +167,13 @@ void otg_phy_init(struct s3c_udc *dev) writel((readl(&phy->phypwr) &~(OTG_DISABLE_0 | ANALOG_PWRDOWN) &~FORCE_SUSPEND_0), &phy->phypwr); - writel((readl(&phy->phyclk) &~(ID_PULLUP0 | COMMON_ON_N0)) | - CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */ + if (s5p_cpu_id == 0x4412) + writel((readl(&phy->phyclk) & ~(EXYNOS4X12_ID_PULLUP0 | + EXYNOS4X12_COMMON_ON_N0)) | EXYNOS4X12_CLK_SEL_24MHZ, + &phy->phyclk); /* PLL 24Mhz */ + else + writel((readl(&phy->phyclk) & ~(ID_PULLUP0 | COMMON_ON_N0)) | + CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */ writel((readl(&phy->rstcon) &~(LINK_SW_RST | PHYLNK_SW_RST)) | PHY_SW_RST0, &phy->rstcon); -- cgit v1.1 From ab8efbb283a6c9cf8cb1d4a26e040c924417e7c7 Mon Sep 17 00:00:00 2001 From: Piotr Wilczek Date: Thu, 21 Nov 2013 15:46:45 +0100 Subject: trats2: enable ums support on Trats2 This patch adds support for USB and enables 'ums' command on Trats2 board. Signed-off-by: Piotr Wilczek Signed-off-by: Kyungmin Park Acked-by: Jaehoon Chung Signed-off-by: Minkyu Kang --- board/samsung/trats2/trats2.c | 92 +++++++++++++++++++++++++++++++++++++++++++ include/configs/trats2.h | 18 +++++++++ 2 files changed, 110 insertions(+) diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c index d44d825..b932a60 100644 --- a/board/samsung/trats2/trats2.c +++ b/board/samsung/trats2/trats2.c @@ -25,6 +25,9 @@ #include #include #include +#include +#include +#include DECLARE_GLOBAL_DATA_PTR; @@ -308,6 +311,95 @@ int board_mmc_init(bd_t *bis) return err0 & err2; } +#ifdef CONFIG_USB_GADGET +static int s5pc210_phy_control(int on) +{ + int ret = 0; + unsigned int val; + struct pmic *p, *p_pmic, *p_muic; + + p_pmic = pmic_get("MAX77686_PMIC"); + if (!p_pmic) + return -ENODEV; + + if (pmic_probe(p_pmic)) + return -1; + + p_muic = pmic_get("MAX77693_MUIC"); + if (!p_muic) + return -ENODEV; + + if (pmic_probe(p_muic)) + return -1; + + if (on) { + ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_ON); + if (ret) + return -1; + + p = pmic_get("MAX77693_PMIC"); + if (!p) + return -ENODEV; + + if (pmic_probe(p)) + return -1; + + /* SAFEOUT */ + ret = pmic_reg_read(p, MAX77693_SAFEOUT, &val); + if (ret) + return -1; + + val |= MAX77693_ENSAFEOUT1; + ret = pmic_reg_write(p, MAX77693_SAFEOUT, val); + if (ret) + return -1; + + /* PATH: USB */ + ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1, + MAX77693_MUIC_CTRL1_DN1DP2); + + } else { + ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_LPM); + if (ret) + return -1; + + /* PATH: UART */ + ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1, + MAX77693_MUIC_CTRL1_UT1UR2); + } + + if (ret) + return -1; + + return 0; +} + +struct s3c_plat_otg_data s5pc210_otg_data = { + .phy_control = s5pc210_phy_control, + .regs_phy = EXYNOS4X12_USBPHY_BASE, + .regs_otg = EXYNOS4X12_USBOTG_BASE, + .usb_phy_ctrl = EXYNOS4X12_USBPHY_CONTROL, + .usb_flags = PHY0_SLEEP, +}; + +int board_usb_init(int index, enum usb_init_type init) +{ + debug("USB_udc_probe\n"); + return s3c_udc_probe(&s5pc210_otg_data); +} + +#ifdef CONFIG_USB_CABLE_CHECK +int usb_cable_connected(void) +{ + struct pmic *muic = pmic_get("MAX77693_MUIC"); + if (!muic) + return 0; + + return !!muic->chrg->chrg_type(muic); +} +#endif +#endif + static int pmic_init_max77686(void) { struct pmic *p = pmic_get("MAX77686_PMIC"); diff --git a/include/configs/trats2.h b/include/configs/trats2.h index 0e93836..66b1c95 100644 --- a/include/configs/trats2.h +++ b/include/configs/trats2.h @@ -113,6 +113,16 @@ #define CONFIG_CMD_EXT4 #define CONFIG_CMD_EXT4_WRITE +/* USB Composite download gadget - g_dnl */ +#define CONFIG_USBDOWNLOAD_GADGET +#define CONFIG_DFU_FUNCTION +#define CONFIG_DFU_MMC + +/* USB Samsung's IDs */ +#define CONFIG_G_DNL_VENDOR_NUM 0x04E8 +#define CONFIG_G_DNL_PRODUCT_NUM 0x6601 +#define CONFIG_G_DNL_MANUFACTURER "Samsung" + /* To use the TFTPBOOT over USB, Please enable the CONFIG_CMD_NET */ #undef CONFIG_CMD_NET @@ -293,6 +303,11 @@ #define CONFIG_POWER_MUIC_MAX77693 #define CONFIG_POWER_FG_MAX77693 #define CONFIG_POWER_BATTERY_TRATS2 +#define CONFIG_USB_GADGET +#define CONFIG_USB_GADGET_S3C_UDC_OTG +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_GADGET_VBUS_DRAW 2 +#define CONFIG_USB_CABLE_CHECK /* LCD */ #define CONFIG_EXYNOS_FB @@ -305,6 +320,9 @@ #define CONFIG_VIDEO_BMP_GZIP #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 250 * 4) + (1 << 12)) +#define CONFIG_CMD_USB_MASS_STORAGE +#define CONFIG_USB_GADGET_MASS_STORAGE + /* Pass open firmware flat tree */ #define CONFIG_OF_LIBFDT 1 -- cgit v1.1 From 09f980107db05d0c4b063298f29373a3790a5de6 Mon Sep 17 00:00:00 2001 From: Piotr Wilczek Date: Tue, 12 Nov 2013 15:22:46 +0100 Subject: trats2: enable dfu and thor protocol for Tizen download Trats2 config is updated to support DFU mode. Malloc pool must be increased for DFU buffer allocation. Signed-off-by: Piotr Wilczek Signed-off-by: Kyungmin Park Signed-off-by: Minkyu Kang --- include/configs/trats2.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/include/configs/trats2.h b/include/configs/trats2.h index 66b1c95..bf49dd5 100644 --- a/include/configs/trats2.h +++ b/include/configs/trats2.h @@ -65,10 +65,9 @@ #define CONFIG_DISPLAY_CPUINFO -/* - * Size of malloc() pool - */ -#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (2 << 20)) +#include +/* Size of malloc() pool */ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (80 * SZ_1M)) /* select serial console configuration */ #define CONFIG_SERIAL2 @@ -100,6 +99,7 @@ #define CONFIG_CMD_CACHE #define CONFIG_CMD_I2C #define CONFIG_CMD_MMC +#define CONFIG_CMD_DFU #define CONFIG_CMD_GPT #define CONFIG_CMD_PMIC @@ -115,12 +115,19 @@ /* USB Composite download gadget - g_dnl */ #define CONFIG_USBDOWNLOAD_GADGET +#define CONFIG_SYS_DFU_DATA_BUF_SIZE SZ_32M #define CONFIG_DFU_FUNCTION #define CONFIG_DFU_MMC +/* TIZEN THOR downloader support */ +#define CONFIG_CMD_THOR_DOWNLOAD +#define CONFIG_THOR_FUNCTION + /* USB Samsung's IDs */ #define CONFIG_G_DNL_VENDOR_NUM 0x04E8 #define CONFIG_G_DNL_PRODUCT_NUM 0x6601 +#define CONFIG_G_DNL_THOR_VENDOR_NUM CONFIG_G_DNL_VENDOR_NUM +#define CONFIG_G_DNL_THOR_PRODUCT_NUM 0x685D #define CONFIG_G_DNL_MANUFACTURER "Samsung" /* To use the TFTPBOOT over USB, Please enable the CONFIG_CMD_NET */ @@ -165,6 +172,12 @@ "name="PARTS_CSC",size=150MiB,uuid=${uuid_gpt_"PARTS_CSC"};" \ "name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \ +#define CONFIG_DFU_ALT \ + "u-boot mmc 80 800;" \ + "uImage ext4 0 2;" \ + "exynos4412-trats2.dtb ext4 0 2;" \ + ""PARTS_ROOT" part 0 5\0" + #define CONFIG_EXTRA_ENV_SETTINGS \ "bootk=" \ "run loaddtb; run loaduimage; bootm 0x40007FC0 - ${fdtaddr}\0" \ @@ -197,6 +210,7 @@ "mmcrootpart=5\0" \ "opts=always_resume=1\0" \ "partitions=" PARTS_DEFAULT \ + "dfu_alt_info=" CONFIG_DFU_ALT \ "uartpath=ap\0" \ "usbpath=ap\0" \ "consoleon=set console console=ttySAC2,115200n8; save; reset\0" \ -- cgit v1.1 From 0938f5b275702107c736e05e377dd1045a8cba27 Mon Sep 17 00:00:00 2001 From: Przemyslaw Marczak Date: Mon, 2 Dec 2013 13:54:01 +0100 Subject: trats: usb: Add usb_cable_connected() function Signed-off-by: Przemyslaw Marczak Signed-off-by: Minkyu Kang --- board/samsung/trats/trats.c | 11 +++++++++++ include/configs/trats.h | 1 + 2 files changed, 12 insertions(+) diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c index 7012c13..6bd106e 100644 --- a/board/samsung/trats/trats.c +++ b/board/samsung/trats/trats.c @@ -501,6 +501,17 @@ int board_usb_init(int index, enum usb_init_type init) debug("USB_udc_probe\n"); return s3c_udc_probe(&s5pc210_otg_data); } + +#ifdef CONFIG_USB_CABLE_CHECK +int usb_cable_connected(void) +{ + struct pmic *muic = pmic_get("MAX8997_MUIC"); + if (!muic) + return 0; + + return !!muic->chrg->chrg_type(muic); +} +#endif #endif static void pmic_reset(void) diff --git a/include/configs/trats.h b/include/configs/trats.h index 3d080c4..8ff9800 100644 --- a/include/configs/trats.h +++ b/include/configs/trats.h @@ -308,6 +308,7 @@ #define CONFIG_USB_GADGET_S3C_UDC_OTG #define CONFIG_USB_GADGET_DUALSPEED #define CONFIG_USB_GADGET_VBUS_DRAW 2 +#define CONFIG_USB_CABLE_CHECK /* LCD */ #define CONFIG_EXYNOS_FB -- cgit v1.1 From a85ca22f62cb262fe33757792fdb78d1927cb2d0 Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Mon, 2 Dec 2013 14:25:33 +0900 Subject: arm: exynos: fix set_mmc_clk for exynos4x12 Fix the set_mmc_clk() for exnos4x12. If board is exynos4x12, mmc clock should be set to wrong value. Signed-off-by: Jaehoon Chung Signed-off-by: Minkyu Kang --- arch/arm/cpu/armv7/exynos/clock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c index 36fedd6..84a5047 100644 --- a/arch/arm/cpu/armv7/exynos/clock.c +++ b/arch/arm/cpu/armv7/exynos/clock.c @@ -1410,7 +1410,8 @@ void set_mmc_clk(int dev_index, unsigned int div) else { if (proid_is_exynos4412()) exynos4x12_set_mmc_clk(dev_index, div); - exynos4_set_mmc_clk(dev_index, div); + else + exynos4_set_mmc_clk(dev_index, div); } } -- cgit v1.1 From 771b3ba34ce80215b481e1aaade33bd3089d76a2 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Fri, 29 Nov 2013 10:02:34 +0900 Subject: arm: exynos: fix the align for exynos4_power structure res3 should be 4bytes Signed-off-by: Minkyu Kang Cc: Dominik Klein --- arch/arm/include/asm/arch-exynos/power.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h index 8db18c5..2bfee18 100644 --- a/arch/arm/include/asm/arch-exynos/power.h +++ b/arch/arm/include/asm/arch-exynos/power.h @@ -16,7 +16,7 @@ struct exynos4_power { unsigned int gnss_rtc_out_ctrl; unsigned char res2[0x1ec]; unsigned int system_power_down_ctrl; - unsigned char res3[0x1]; + unsigned int res3; unsigned int system_power_down_option; unsigned char res4[0x1f4]; unsigned int swreset; -- cgit v1.1 From 347e45d745e9b90d81752e7567833c835e08e1f3 Mon Sep 17 00:00:00 2001 From: Rajeshwari Shinde Date: Tue, 8 Oct 2013 18:42:22 +0530 Subject: exynos: spl: Add a custom spi copy function This patch implements a custom spi_copy funtion to copy u-boot from SF to RAM. This is faster then iROM spi_copy funtion as this runs spi at 50Mhz and also in WORD mode of operation. Changed a printf in pinmux.c to debug just to avoid the compilation error in SPL. Signed-off-by: Alim Akhtar Signed-off-by: Tom Wai-Hong Tam Signed-off-by: Rajeshwari S Shinde Signed-off-by: Minkyu Kang --- arch/arm/cpu/armv7/exynos/pinmux.c | 2 +- arch/arm/cpu/armv7/exynos/spl_boot.c | 122 ++++++++++++++++++++++++++++++++- arch/arm/include/asm/arch-exynos/spi.h | 1 + include/configs/exynos5250-dt.h | 2 + 4 files changed, 123 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c b/arch/arm/cpu/armv7/exynos/pinmux.c index 8002bce..74cc700 100644 --- a/arch/arm/cpu/armv7/exynos/pinmux.c +++ b/arch/arm/cpu/armv7/exynos/pinmux.c @@ -462,7 +462,7 @@ static int exynos4_pinmux_config(int peripheral, int flags) case PERIPH_ID_SDMMC1: case PERIPH_ID_SDMMC3: case PERIPH_ID_SDMMC4: - printf("SDMMC device %d not implemented\n", peripheral); + debug("SDMMC device %d not implemented\n", peripheral); return -1; default: debug("%s: invalid peripheral %d", __func__, peripheral); diff --git a/arch/arm/cpu/armv7/exynos/spl_boot.c b/arch/arm/cpu/armv7/exynos/spl_boot.c index 3651c00..6faf13f 100644 --- a/arch/arm/cpu/armv7/exynos/spl_boot.c +++ b/arch/arm/cpu/armv7/exynos/spl_boot.c @@ -10,8 +10,11 @@ #include #include #include +#include +#include #include #include +#include #include "common_setup.h" #include "clock_init.h" @@ -59,6 +62,119 @@ static int config_branch_prediction(int set_cr_z) } #endif +static void spi_rx_tx(struct exynos_spi *regs, int todo, + void *dinp, void const *doutp, int i) +{ + uint *rxp = (uint *)(dinp + (i * (32 * 1024))); + int rx_lvl, tx_lvl; + uint out_bytes, in_bytes; + + out_bytes = todo; + in_bytes = todo; + setbits_le32(®s->ch_cfg, SPI_CH_RST); + clrbits_le32(®s->ch_cfg, SPI_CH_RST); + writel(((todo * 8) / 32) | SPI_PACKET_CNT_EN, ®s->pkt_cnt); + + while (in_bytes) { + uint32_t spi_sts; + int temp; + + spi_sts = readl(®s->spi_sts); + rx_lvl = ((spi_sts >> 15) & 0x7f); + tx_lvl = ((spi_sts >> 6) & 0x7f); + while (tx_lvl < 32 && out_bytes) { + temp = 0xffffffff; + writel(temp, ®s->tx_data); + out_bytes -= 4; + tx_lvl += 4; + } + while (rx_lvl >= 4 && in_bytes) { + temp = readl(®s->rx_data); + if (rxp) + *rxp++ = temp; + in_bytes -= 4; + rx_lvl -= 4; + } + } +} + +/* + * Copy uboot from spi flash to RAM + * + * @parma uboot_size size of u-boot to copy + * @param uboot_addr address in u-boot to copy + */ +static void exynos_spi_copy(unsigned int uboot_size, unsigned int uboot_addr) +{ + int upto, todo; + int i, timeout = 100; + struct exynos_spi *regs = (struct exynos_spi *)CONFIG_ENV_SPI_BASE; + + set_spi_clk(PERIPH_ID_SPI1, 50000000); /* set spi clock to 50Mhz */ + /* set the spi1 GPIO */ + exynos_pinmux_config(PERIPH_ID_SPI1, PINMUX_FLAG_NONE); + + /* set pktcnt and enable it */ + writel(4 | SPI_PACKET_CNT_EN, ®s->pkt_cnt); + /* set FB_CLK_SEL */ + writel(SPI_FB_DELAY_180, ®s->fb_clk); + /* set CH_WIDTH and BUS_WIDTH as word */ + setbits_le32(®s->mode_cfg, SPI_MODE_CH_WIDTH_WORD | + SPI_MODE_BUS_WIDTH_WORD); + clrbits_le32(®s->ch_cfg, SPI_CH_CPOL_L); /* CPOL: active high */ + + /* clear rx and tx channel if set priveously */ + clrbits_le32(®s->ch_cfg, SPI_RX_CH_ON | SPI_TX_CH_ON); + + setbits_le32(®s->swap_cfg, SPI_RX_SWAP_EN | + SPI_RX_BYTE_SWAP | + SPI_RX_HWORD_SWAP); + + /* do a soft reset */ + setbits_le32(®s->ch_cfg, SPI_CH_RST); + clrbits_le32(®s->ch_cfg, SPI_CH_RST); + + /* now set rx and tx channel ON */ + setbits_le32(®s->ch_cfg, SPI_RX_CH_ON | SPI_TX_CH_ON | SPI_CH_HS_EN); + clrbits_le32(®s->cs_reg, SPI_SLAVE_SIG_INACT); /* CS low */ + + /* Send read instruction (0x3h) followed by a 24 bit addr */ + writel((SF_READ_DATA_CMD << 24) | SPI_FLASH_UBOOT_POS, ®s->tx_data); + + /* waiting for TX done */ + while (!(readl(®s->spi_sts) & SPI_ST_TX_DONE)) { + if (!timeout) { + debug("SPI TIMEOUT\n"); + break; + } + timeout--; + } + + for (upto = 0, i = 0; upto < uboot_size; upto += todo, i++) { + todo = min(uboot_size - upto, (1 << 15)); + spi_rx_tx(regs, todo, (void *)(uboot_addr), + (void *)(SPI_FLASH_UBOOT_POS), i); + } + + setbits_le32(®s->cs_reg, SPI_SLAVE_SIG_INACT);/* make the CS high */ + + /* + * Let put controller mode to BYTE as + * SPI driver does not support WORD mode yet + */ + clrbits_le32(®s->mode_cfg, SPI_MODE_CH_WIDTH_WORD | + SPI_MODE_BUS_WIDTH_WORD); + writel(0, ®s->swap_cfg); + + /* + * Flush spi tx, rx fifos and reset the SPI controller + * and clear rx/tx channel + */ + clrsetbits_le32(®s->ch_cfg, SPI_CH_HS_EN, SPI_CH_RST); + clrbits_le32(®s->ch_cfg, SPI_CH_RST); + clrbits_le32(®s->ch_cfg, SPI_TX_CH_ON | SPI_RX_CH_ON); +} + /* * Copy U-boot from mmc to RAM: * COPY_BL2_FNPTR_ADDR: Address in iRAM, which Contains @@ -70,6 +186,7 @@ void copy_uboot_to_ram(void) u32 (*copy_bl2)(u32 offset, u32 nblock, u32 dst) = NULL; u32 offset = 0, size = 0; + struct spl_machine_param *param = spl_get_machine_params(); #ifdef CONFIG_SUPPORT_EMMC_BOOT u32 (*copy_bl2_from_emmc)(u32 nblock, u32 dst); void (*end_bootop_from_emmc)(void); @@ -91,9 +208,8 @@ void copy_uboot_to_ram(void) switch (bootmode) { #ifdef CONFIG_SPI_BOOTING case BOOT_MODE_SERIAL: - offset = SPI_FLASH_UBOOT_POS; - size = CONFIG_BL2_SIZE; - copy_bl2 = get_irom_func(SPI_INDEX); + /* Customised function to copy u-boot from SF */ + exynos_spi_copy(param->uboot_size, CONFIG_SYS_TEXT_BASE); break; #endif case BOOT_MODE_MMC: diff --git a/arch/arm/include/asm/arch-exynos/spi.h b/arch/arm/include/asm/arch-exynos/spi.h index 147c1a7..0ba931b 100644 --- a/arch/arm/include/asm/arch-exynos/spi.h +++ b/arch/arm/include/asm/arch-exynos/spi.h @@ -30,6 +30,7 @@ struct exynos_spi { #define EXYNOS_SPI_MAX_FREQ 50000000 #define SPI_TIMEOUT_MS 10 +#define SF_READ_DATA_CMD 0x3 /* SPI_CHCFG */ #define SPI_CH_HS_EN (1 << 6) diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h index 2bd91a5..dee18a7 100644 --- a/include/configs/exynos5250-dt.h +++ b/include/configs/exynos5250-dt.h @@ -157,6 +157,7 @@ #define COPY_BL2_FNPTR_ADDR 0x02020030 #define CONFIG_SPL_LIBCOMMON_SUPPORT +#define CONFIG_SPL_GPIO_SUPPORT /* specific .lds file */ #define CONFIG_SPL_LDSCRIPT "board/samsung/common/exynos-uboot-spl.lds" @@ -266,6 +267,7 @@ /* SPI */ #define CONFIG_ENV_IS_IN_SPI_FLASH #define CONFIG_SPI_FLASH +#define CONFIG_ENV_SPI_BASE 0x12D30000 #ifdef CONFIG_SPI_FLASH #define CONFIG_EXYNOS_SPI -- cgit v1.1 From f258db5b315d654801c27789f6d4b20c56ea8614 Mon Sep 17 00:00:00 2001 From: Piotr Wilczek Date: Wed, 27 Nov 2013 11:10:59 +0100 Subject: board: trats2: remove unused defines from config file Signed-off-by: Piotr Wilczek Signed-off-by: Kyungmin Park Signed-off-by: Minkyu Kang --- include/configs/trats2.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/configs/trats2.h b/include/configs/trats2.h index bf49dd5..8de41ff 100644 --- a/include/configs/trats2.h +++ b/include/configs/trats2.h @@ -20,8 +20,6 @@ #define CONFIG_EXYNOS4 /* which is in a EXYNOS4XXX */ #define CONFIG_TIZEN /* TIZEN lib */ -#define PLATFORM_NO_UNALIGNED - #include /* get chip and board defs */ #define CONFIG_ARCH_CPU_INIT @@ -257,8 +255,6 @@ #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR \ - GENERATED_GBL_DATA_SIZE) -#define CONFIG_SYS_HZ 1000 - /* valid baudrates */ #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } -- cgit v1.1 From 2c8043c946ffeda6a016943fa3572331d9a4d61f Mon Sep 17 00:00:00 2001 From: Piotr Wilczek Date: Wed, 27 Nov 2013 11:11:00 +0100 Subject: board: trats2: fix environmental variables In this patch variable names are used instead of hardcoded names Signed-off-by: Piotr Wilczek Signed-off-by: Kyungmin Park Signed-off-by: Minkyu Kang --- include/configs/trats2.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/configs/trats2.h b/include/configs/trats2.h index 8de41ff..9a90941 100644 --- a/include/configs/trats2.h +++ b/include/configs/trats2.h @@ -199,11 +199,11 @@ "rootfstype=ext4\0" \ "console=" CONFIG_DEFAULT_CONSOLE \ "kernelname=uImage\0" \ - "loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x40007FC0 uImage\0" \ - "0x40007FC0 ${kernelname}\0" \ + "loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x40007FC0 " \ + "${kernelname}\0" \ "loaddtb=ext4load mmc ${mmcdev}:${mmcbootpart} ${fdtaddr} " \ "${fdtfile}\0" \ - "mmcdev=0\0" \ + "mmcdev=CONFIG_MMC_DEFAULT_DEV\0" \ "mmcbootpart=2\0" \ "mmcrootpart=5\0" \ "opts=always_resume=1\0" \ -- cgit v1.1 From 5234b6e0d48154c90f2bad29e7b059a4246a37ca Mon Sep 17 00:00:00 2001 From: Piotr Wilczek Date: Wed, 27 Nov 2013 11:11:01 +0100 Subject: board: trats2: fix access to samsung registers This patch use 'samsung_get_base' common functions to access registers. Signed-off-by: Piotr Wilczek Signed-off-by: Kyungmin Park Signed-off-by: Minkyu Kang --- board/samsung/trats2/trats2.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c index b932a60..9552522 100644 --- a/board/samsung/trats2/trats2.c +++ b/board/samsung/trats2/trats2.c @@ -43,7 +43,7 @@ static void check_hw_revision(void) int modelrev = 0; int i; - gpio2 = (struct exynos4x12_gpio_part2 *)EXYNOS4X12_GPIO_PART2_BASE; + gpio2 = (struct exynos4x12_gpio_part2 *)samsung_get_base_gpio_part2(); /* * GPM1[1:0]: MODEL_REV[1:0] @@ -93,7 +93,7 @@ static inline u32 get_model_rev(void) static void board_external_gpio_init(void) { - gpio2 = (struct exynos4x12_gpio_part2 *)EXYNOS4X12_GPIO_PART2_BASE; + gpio2 = (struct exynos4x12_gpio_part2 *)samsung_get_base_gpio_part2(); /* * some pins which in alive block are connected with external pull-up @@ -118,8 +118,8 @@ static void board_external_gpio_init(void) #ifdef CONFIG_SYS_I2C_INIT_BOARD static void board_init_i2c(void) { - gpio1 = (struct exynos4x12_gpio_part1 *)EXYNOS4X12_GPIO_PART1_BASE; - gpio2 = (struct exynos4x12_gpio_part2 *)EXYNOS4X12_GPIO_PART2_BASE; + gpio1 = (struct exynos4x12_gpio_part1 *)samsung_get_base_gpio_part1(); + gpio2 = (struct exynos4x12_gpio_part2 *)samsung_get_base_gpio_part2(); /* I2C_7 */ s5p_gpio_direction_output(&gpio1->d0, 2, 1); @@ -150,7 +150,7 @@ static int pmic_init_max77686(void); int board_init(void) { struct exynos4_power *pwr = - (struct exynos4_power *)EXYNOS4X12_POWER_BASE; + (struct exynos4_power *)samsung_get_base_power(); gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; @@ -257,7 +257,7 @@ int board_mmc_init(bd_t *bis) { int err0, err2 = 0; - gpio2 = (struct exynos4x12_gpio_part2 *)EXYNOS4X12_GPIO_PART2_BASE; + gpio2 = (struct exynos4x12_gpio_part2 *)samsung_get_base_gpio_part2(); /* eMMC_EN: SD_0_CDn: GPK0[2] Output High */ s5p_gpio_direction_output(&gpio2->k0, 2, 1); @@ -513,7 +513,7 @@ void exynos_lcd_power_on(void) { struct pmic *p = pmic_get("MAX77686_PMIC"); - gpio1 = (struct exynos4x12_gpio_part1 *)EXYNOS4X12_GPIO_PART1_BASE; + gpio1 = (struct exynos4x12_gpio_part1 *)samsung_get_base_gpio_part1(); /* LCD_2.2V_EN: GPC0[1] */ s5p_gpio_set_pull(&gpio1->c0, 1, GPIO_PULL_UP); @@ -527,7 +527,7 @@ void exynos_lcd_power_on(void) void exynos_reset_lcd(void) { - gpio1 = (struct exynos4x12_gpio_part1 *)EXYNOS4X12_GPIO_PART1_BASE; + gpio1 = (struct exynos4x12_gpio_part1 *)samsung_get_base_gpio_part1(); /* reset lcd */ s5p_gpio_direction_output(&gpio1->f2, 1, 0); -- cgit v1.1 From dca3668434ba6c1990d8a421ca6784e3bc597f42 Mon Sep 17 00:00:00 2001 From: Piotr Wilczek Date: Wed, 27 Nov 2013 11:11:02 +0100 Subject: board: trats2: update Tizen partition definitions This patch updates Tizen partions layout. Signed-off-by: Piotr Wilczek Signed-off-by: Kyungmin Park Signed-off-by: Minkyu Kang --- include/configs/trats2.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/include/configs/trats2.h b/include/configs/trats2.h index 9a90941..c49a969e 100644 --- a/include/configs/trats2.h +++ b/include/configs/trats2.h @@ -151,23 +151,21 @@ #define CONFIG_SYS_CONSOLE_IS_IN_ENV /* Tizen - partitions definitions */ -#define PARTS_CSA "csa-mmc" -#define PARTS_BOOTLOADER "u-boot" +#define PARTS_CSA "csa" #define PARTS_BOOT "boot" +#define PARTS_MODEM "modem" +#define PARTS_CSC "csc" #define PARTS_ROOT "platform" #define PARTS_DATA "data" -#define PARTS_CSC "csc" #define PARTS_UMS "ums" #define PARTS_DEFAULT \ - "uuid_disk=${uuid_gpt_disk};" \ - "name="PARTS_CSA",size=8MiB,uuid=${uuid_gpt_"PARTS_CSA"};" \ - "name="PARTS_BOOTLOADER",size=60MiB," \ - "uuid=${uuid_gpt_"PARTS_BOOTLOADER"};" \ - "name="PARTS_BOOT",size=100MiB,uuid=${uuid_gpt_"PARTS_BOOT"};" \ - "name="PARTS_ROOT",size=1GiB,uuid=${uuid_gpt_"PARTS_ROOT"};" \ - "name="PARTS_DATA",size=3GiB,uuid=${uuid_gpt_"PARTS_DATA"};" \ + "name="PARTS_CSA",start=5MiB,size=8MiB,uuid=${uuid_gpt_"PARTS_CSA"};" \ + "name="PARTS_BOOT",size=64MiB,uuid=${uuid_gpt_"PARTS_BOOT"};" \ + "name="PARTS_MODEM",size=100MiB,uuid=${uuid_gpt_"PARTS_MODEM"};" \ "name="PARTS_CSC",size=150MiB,uuid=${uuid_gpt_"PARTS_CSC"};" \ + "name="PARTS_ROOT",size=1536MiB,uuid=${uuid_gpt_"PARTS_ROOT"};" \ + "name="PARTS_DATA",size=512MiB,uuid=${uuid_gpt_"PARTS_DATA"};" \ "name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \ #define CONFIG_DFU_ALT \ -- cgit v1.1 From 4bee78f5027509b30307b6bfb4f1b457ecce529c Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Tue, 3 Dec 2013 14:01:06 +0900 Subject: arm: exynos/goni: fix the return type for s5p_mmc_init The "int" type is right. Signed-off-by: Jaehoon Chung Signed-off-by: Minkyu Kang --- arch/arm/include/asm/arch-exynos/mmc.h | 2 +- arch/arm/include/asm/arch-s5pc1xx/mmc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/arch-exynos/mmc.h b/arch/arm/include/asm/arch-exynos/mmc.h index 98312d1..98d6530 100644 --- a/arch/arm/include/asm/arch-exynos/mmc.h +++ b/arch/arm/include/asm/arch-exynos/mmc.h @@ -55,7 +55,7 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width); -static inline unsigned int s5p_mmc_init(int index, int bus_width) +static inline int s5p_mmc_init(int index, int bus_width) { unsigned int base = samsung_get_base_mmc() + (S5P_MMC_DEV_OFFSET * index); diff --git a/arch/arm/include/asm/arch-s5pc1xx/mmc.h b/arch/arm/include/asm/arch-s5pc1xx/mmc.h index 55ff10b..dd473c8 100644 --- a/arch/arm/include/asm/arch-s5pc1xx/mmc.h +++ b/arch/arm/include/asm/arch-s5pc1xx/mmc.h @@ -55,7 +55,7 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width); -static inline unsigned int s5p_mmc_init(int index, int bus_width) +static inline int s5p_mmc_init(int index, int bus_width) { unsigned int base = samsung_get_base_mmc() + (S5P_MMC_DEV_OFFSET * index); -- cgit v1.1 From 01322004ec08c207141b08a2e0423b9b4c7b2714 Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Tue, 3 Dec 2013 14:00:21 +0900 Subject: arm: exynos: remove the unused define. These defines didn't use anywhere. Signed-off-by: Jaehoon Chung Acked-by: Alexey Brodkin Signed-off-by: Minkyu Kang --- arch/arm/include/asm/arch-exynos/dwmmc.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/arm/include/asm/arch-exynos/dwmmc.h b/arch/arm/include/asm/arch-exynos/dwmmc.h index d1c5d4f..09d739d 100644 --- a/arch/arm/include/asm/arch-exynos/dwmmc.h +++ b/arch/arm/include/asm/arch-exynos/dwmmc.h @@ -6,10 +6,6 @@ */ #define DWMCI_CLKSEL 0x09C -#define DWMCI_SHIFT_0 0x0 -#define DWMCI_SHIFT_1 0x1 -#define DWMCI_SHIFT_2 0x2 -#define DWMCI_SHIFT_3 0x3 #define DWMCI_SET_SAMPLE_CLK(x) (x) #define DWMCI_SET_DRV_CLK(x) ((x) << 16) #define DWMCI_SET_DIV_RATIO(x) ((x) << 24) -- cgit v1.1 From d8fa31a71f76bd24550291bbaa22c52f14de8e8f Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Fri, 6 Dec 2013 19:04:03 +0900 Subject: arm: exynos: adds ifdef for spi boot This patch fix following errors and warnings spl_boot.c: In function 'exynos_spi_copy': spl_boot.c:111:49: error: 'CONFIG_ENV_SPI_BASE' undeclared (first use in this function) spl_boot.c:111:49: note: each undeclared identifier is reported only once for each function it appears in spl_boot.c:142:2: error: 'SPI_FLASH_UBOOT_POS' undeclared (first use in this function) spl_boot.c: In function 'copy_uboot_to_ram': spl_boot.c:189:28: warning: unused variable 'param' [-Wunused-variable] spl_boot.c: At top level: spl_boot.c:107:13: warning: 'exynos_spi_copy' defined but not used [-Wunused-function] Signed-off-by: Minkyu Kang Cc: Albert ARIBAUD --- arch/arm/cpu/armv7/exynos/spl_boot.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/cpu/armv7/exynos/spl_boot.c b/arch/arm/cpu/armv7/exynos/spl_boot.c index 6faf13f..ade45fd 100644 --- a/arch/arm/cpu/armv7/exynos/spl_boot.c +++ b/arch/arm/cpu/armv7/exynos/spl_boot.c @@ -62,6 +62,7 @@ static int config_branch_prediction(int set_cr_z) } #endif +#ifdef CONFIG_SPI_BOOTING static void spi_rx_tx(struct exynos_spi *regs, int todo, void *dinp, void const *doutp, int i) { @@ -174,6 +175,7 @@ static void exynos_spi_copy(unsigned int uboot_size, unsigned int uboot_addr) clrbits_le32(®s->ch_cfg, SPI_CH_RST); clrbits_le32(®s->ch_cfg, SPI_TX_CH_ON | SPI_RX_CH_ON); } +#endif /* * Copy U-boot from mmc to RAM: @@ -186,7 +188,9 @@ void copy_uboot_to_ram(void) u32 (*copy_bl2)(u32 offset, u32 nblock, u32 dst) = NULL; u32 offset = 0, size = 0; +#ifdef CONFIG_SPI_BOOTING struct spl_machine_param *param = spl_get_machine_params(); +#endif #ifdef CONFIG_SUPPORT_EMMC_BOOT u32 (*copy_bl2_from_emmc)(u32 nblock, u32 dst); void (*end_bootop_from_emmc)(void); -- cgit v1.1 From 55f2118c11ff933e272c1084f93e72ff719a269b Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Fri, 6 Dec 2013 19:18:13 +0900 Subject: arm: arndale: disable spi boot arndale board is booted from mmc Signed-off-by: Minkyu Kang Cc: Albert ARIBAUD Cc: Inderpal Singh --- include/configs/arndale.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/configs/arndale.h b/include/configs/arndale.h index 45fa047..f0b9f94 100644 --- a/include/configs/arndale.h +++ b/include/configs/arndale.h @@ -198,10 +198,6 @@ #define BL2_START_OFFSET (CONFIG_BL2_OFFSET/512) #define BL2_SIZE_BLOC_COUNT (CONFIG_BL2_SIZE/512) -#define CONFIG_SPI_BOOTING -#define EXYNOS_COPY_SPI_FNPTR_ADDR 0x02020058 -#define SPI_FLASH_UBOOT_POS (CONFIG_SEC_FW_SIZE + CONFIG_BL1_SIZE) - #define CONFIG_DOS_PARTITION #define CONFIG_EFI_PARTITION #define CONFIG_CMD_PART -- cgit v1.1