Re: [U-Boot] [PATCH 4/4] cm-t54: add cm-t54 board support

2014-05-13 Thread Igor Grinberg
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Tom,

On 05/06/14 20:45, Tom Rini wrote:
> On Sun, Apr 27, 2014 at 01:17:28PM +0300, Dmitry Lifshitz wrote:
> 
>> Add cm-t54 board directory, config file. Enable build.
> [snip]
>> diff --git a/board/compulab/cm_t54/Makefile b/board/compulab/cm_t54/Makefile
>> new file mode 100644
>> index 000..bd8bc51
>> --- /dev/null
>> +++ b/board/compulab/cm_t54/Makefile
>> @@ -0,0 +1,10 @@
>> +#
>> +# Copyright (C) 2014 Compulab Ltd - http://compulab.co.il/
>> +#
>> +# Author: Dmitry Lifshitz 
>> +#
>> +# SPDX-License-Identifier:  GPL-2.0+
>> +#
>> +
>> +obj-y += $(BOARD).o
> 
> Please don't use $(BOARD) here, just went and changed the other users of
> this convention.
> 
>> +/*
>> + * Routine: board_init
>> + * Description: hardware init.
>> + */
>> +int board_init(void)
>> +{
>> +gd->bd->bi_boot_params = (0x8000 + 0x100); /* boot param addr */
>> +
>> +return 0;
>> +}
> 
> CONFIG_SYS_SDRAM_BASE + 0x100
> 
>> +#define CONFIG_EXTRA_ENV_SETTINGS \
>> +"loadaddr=0x8200\0" \
>> +"fdtaddr=0x80F8\0" \
>> +"fdt_high=0x\0" \
>> +"rdaddr=0x8100\0" \
> 
> Can you use DEFAULT_LINUX_BOOT_ENV here (see u-boot-ti) ?  I really
> don't like disabling fdt relocation with it being below 128MB (I'd
> prefer what we do with DEFAULT_LINUX_BOOT_ENV and bootm_size, please see
> the various ML threads about that).

Thanks Tom,

We will fix the comments and repost v2 in a couple of days.

- -- 
Regards,
Igor.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBAgAGBQJTcwroAAoJEBDE8YO64EfaxQoP/2GKp8kJErMdiMZs8TdIhkGp
De1T6qw+qoTsA/91nFQUq4AMv5lfApghTgjmU/zx5oI4Uo8IPE8uMtZw9VSwTucu
Zfy1BrhGj8kbVe9u6oOf2uZiqvzyaEqdi9a/EwmB69cYu8QcQFP+nbPPMqmxgA2i
B9aUP/+54PluWcBDN0Z5btPfeRBgodyHLJlOtNWCwy4SmzgoARYbS+wrrKqiZApJ
NPYdH1wtgVcrsqiBFGILCktgVkUl4ncC7oa0MTzQfzAPKaKvbhbuwT98lhgUNcsZ
xf7QS3KSGD6/H8xZS0VTAmC5frf7/IAHzSFJsb25OMfi8gwrL8a1Nf9XA+UaAB0I
cpv53xxEoTvdAP/gmBz0sKdC0YKLvYin/OqY0PeFl1itPrKJ1CiKBXL60l0u7wkT
J4HtxsUUfl/nbZc/KbB9cnYCf57V1nnDw3KesRR2nwWaBf0dTWFiPIKCHpZjyUKg
OUinqCjRIbL6KTLEkcipPYXHuFGVNqcE3a+uRDn7jLW0+XcU2zKi04Djpn7F84TM
LXUhnJX8UC59AZuseMqi3yK26OOmTFcIOMcRDi45Zri3qsaYIi7TrD9offwlxb6/
+JEP3YROi0fm8jrC//0GUjx8idmjeZYlx0U4EDjLxKBqnABVlTjrBoiheB+rr+f0
t2HoJHgnV89Dtu26mZi5
=C1e2
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] cm-t54: add cm-t54 board support

2014-05-06 Thread Tom Rini
On Sun, Apr 27, 2014 at 01:17:28PM +0300, Dmitry Lifshitz wrote:

> Add cm-t54 board directory, config file. Enable build.
[snip]
> diff --git a/board/compulab/cm_t54/Makefile b/board/compulab/cm_t54/Makefile
> new file mode 100644
> index 000..bd8bc51
> --- /dev/null
> +++ b/board/compulab/cm_t54/Makefile
> @@ -0,0 +1,10 @@
> +#
> +# Copyright (C) 2014 Compulab Ltd - http://compulab.co.il/
> +#
> +# Author: Dmitry Lifshitz 
> +#
> +# SPDX-License-Identifier:   GPL-2.0+
> +#
> +
> +obj-y += $(BOARD).o

Please don't use $(BOARD) here, just went and changed the other users of
this convention.

> +/*
> + * Routine: board_init
> + * Description: hardware init.
> + */
> +int board_init(void)
> +{
> + gd->bd->bi_boot_params = (0x8000 + 0x100); /* boot param addr */
> +
> + return 0;
> +}

CONFIG_SYS_SDRAM_BASE + 0x100

> +#define CONFIG_EXTRA_ENV_SETTINGS \
> + "loadaddr=0x8200\0" \
> + "fdtaddr=0x80F8\0" \
> + "fdt_high=0x\0" \
> + "rdaddr=0x8100\0" \

Can you use DEFAULT_LINUX_BOOT_ENV here (see u-boot-ti) ?  I really
don't like disabling fdt relocation with it being below 128MB (I'd
prefer what we do with DEFAULT_LINUX_BOOT_ENV and bootm_size, please see
the various ML threads about that).

Thanks!

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 4/4] cm-t54: add cm-t54 board support

2014-04-27 Thread Dmitry Lifshitz
Add cm-t54 board directory, config file. Enable build.

Basic support includes:

Serial console
SD/MMC
eMMC
USB
Ethernet

Signed-off-by: Dmitry Lifshitz 
Acked-by: Igor Grinberg 
---
 board/compulab/cm_t54/Makefile |   10 ++
 board/compulab/cm_t54/cm_t54.c |  177 
 board/compulab/cm_t54/mux.c|   94 +
 board/compulab/cm_t54/spl.c|   66 +++
 boards.cfg |1 +
 include/configs/cm_t54.h   |  144 
 6 files changed, 492 insertions(+), 0 deletions(-)
 create mode 100644 board/compulab/cm_t54/Makefile
 create mode 100644 board/compulab/cm_t54/cm_t54.c
 create mode 100644 board/compulab/cm_t54/mux.c
 create mode 100644 board/compulab/cm_t54/spl.c
 create mode 100644 include/configs/cm_t54.h

diff --git a/board/compulab/cm_t54/Makefile b/board/compulab/cm_t54/Makefile
new file mode 100644
index 000..bd8bc51
--- /dev/null
+++ b/board/compulab/cm_t54/Makefile
@@ -0,0 +1,10 @@
+#
+# Copyright (C) 2014 Compulab Ltd - http://compulab.co.il/
+#
+# Author: Dmitry Lifshitz 
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y += $(BOARD).o
+obj-$(CONFIG_SPL_BUILD) += mux.o spl.o
diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c
new file mode 100644
index 000..1a4be72
--- /dev/null
+++ b/board/compulab/cm_t54/cm_t54.c
@@ -0,0 +1,177 @@
+/*
+ * Board functions for Compulab CM-T54 board
+ *
+ * Copyright (C) 2014, Compulab Ltd - http://compulab.co.il/
+ *
+ * Author: Dmitry Lifshitz 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DIE_ID_REG_BASE(OMAP54XX_L4_CORE_BASE + 0x2000)
+#define DIE_ID_REG_OFFSET  0x200
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if !defined(CONFIG_SPL_BUILD)
+inline void set_muxconf_regs_essential(void){};
+#endif
+
+const struct omap_sysinfo sysinfo = {
+   "Board: CM-T54\n"
+};
+
+/*
+ * Routine: board_init
+ * Description: hardware init.
+ */
+int board_init(void)
+{
+   gd->bd->bi_boot_params = (0x8000 + 0x100); /* boot param addr */
+
+   return 0;
+}
+
+/*
+ * Routine: cm_t54_palmas_regulator_set
+ * Description:  select voltage and turn on/off Palmas PMIC regulator.
+ */
+static int cm_t54_palmas_regulator_set(u8 vreg, u8 vval, u8 creg, u8 cval)
+{
+   int err;
+
+   /* Setup voltage */
+   err = palmas_i2c_write_u8(TWL603X_CHIP_P1, vreg, vval);
+   if (err) {
+   printf("cm_t54: could not set regulator 0x%02x voltage : %d\n",
+  vreg, err);
+   return err;
+   }
+
+   /* Turn on/off regulator */
+   err = palmas_i2c_write_u8(TWL603X_CHIP_P1, creg, cval);
+   if (err) {
+   printf("cm_t54: could not turn on/off regulator 0x%02x : %d\n",
+  creg, err);
+   return err;
+   }
+
+   return 0;
+}
+
+#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
+#define SB_T54_CD_GPIO 228
+#define SB_T54_WP_GPIO 229
+
+int board_mmc_getcd(struct mmc *mmc)
+{
+   return !gpio_get_value(SB_T54_CD_GPIO);
+}
+
+int board_mmc_init(bd_t *bis)
+{
+   int ret0, ret1;
+
+   ret0 = omap_mmc_init(0, 0, 0, -1, SB_T54_WP_GPIO);
+   if (ret0)
+   printf("cm_t54: failed to initialize mmc0\n");
+
+   ret1 = omap_mmc_init(1, 0, 0, -1, -1);
+   if (ret1)
+   printf("cm_t54: failed to initialize mmc1\n");
+
+   if (ret0 && ret1)
+   return -1;
+
+   return 0;
+}
+#endif
+
+#ifdef CONFIG_USB_EHCI
+static struct omap_usbhs_board_data usbhs_bdata = {
+   .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
+   .port_mode[1] = OMAP_EHCI_PORT_MODE_HSIC,
+   .port_mode[2] = OMAP_EHCI_PORT_MODE_HSIC,
+};
+
+static void setup_host_clocks(bool enable)
+{
+   int usbhost_clk = OPTFCLKEN_HSIC60M_P3_CLK |
+ OPTFCLKEN_HSIC480M_P3_CLK |
+ OPTFCLKEN_HSIC60M_P2_CLK |
+ OPTFCLKEN_HSIC480M_P2_CLK |
+ OPTFCLKEN_UTMI_P3_CLK |
+ OPTFCLKEN_UTMI_P2_CLK;
+
+   int usbtll_clk = OPTFCLKEN_USB_CH1_CLK_ENABLE |
+OPTFCLKEN_USB_CH2_CLK_ENABLE;
+
+   int usbhub_clk = CKOBUFFER_CLK_ENABLE_MASK;
+
+   if (enable) {
+   /* Enable port 2 and 3 clocks*/
+   setbits_le32((*prcm)->cm_l3init_hsusbhost_clkctrl, usbhost_clk);
+   /* Enable port 2 and 3 usb host ports tll clocks*/
+   setbits_le32((*prcm)->cm_l3init_hsusbtll_clkctrl, usbtll_clk);
+   /* Request FREF_XTAL_CLK clock for HSIC USB Hub */
+   setbits_le32((*ctrl)->control_ckobuffer, usbhub_clk);
+   } else {
+   clrbits_le32((*ctrl)->control_ckobuffer, usbhub_clk);
+   clrbits_le32((*prcm)->cm_l3init_hsusbtll_clkctrl, usbtll_