Re: [U-Boot] [PATCH 1/7] Tegra114: Add arch-tegra114 include files

2013-01-17 Thread Tom Warren
Allen,

On Wed, Jan 16, 2013 at 3:39 PM, Allen Martin amar...@nvidia.com wrote:
 On Wed, Jan 16, 2013 at 01:14:02PM -0800, Tom Warren wrote:
 Common Tegra files are in arch-tegra, shared between T20/T30/T114.
 Tegra114-specific headers are in arch-tegra114. Note that some of
 these will be filled in as more T114 support is added (drivers,
 WB/LP0 support, etc.).

 Signed-off-by: Tom Warren twar...@nvidia.com
 ---

 +#if defined(CONFIG_TEGRA20)
  #define OSC_FREQ_SHIFT 30
  #define OSC_FREQ_MASK  (3U  OSC_FREQ_SHIFT)
 +#else  /* Tegra30, Tegra114 */
 +#define OSC_FREQ_SHIFT 28
 +#define OSC_FREQ_MASK  (0xF  OSC_FREQ_SHIFT)
 +#endif

 Can this be a new define instead of a #ifdef?  That makes it easier in
 the future to make a single u-boot to boot on all tegras.

I could move it to a SoC-specific header (arch-tegraXX/clock.h, for
instance). Would that do?



 index 953936c..670745f 100644
 --- a/arch/arm/include/asm/arch-tegra/tegra.h
 +++ b/arch/arm/include/asm/arch-tegra/tegra.h
 @@ -73,6 +73,7 @@ enum {
 SKU_ID_AP25E= 0x1b,
 SKU_ID_T25E = 0x1c,
 SKU_ID_T30  = 0x81, /* Cardhu value */
 +   SKU_ID_T114 = 0x00, /* Dalmore value */
  };

 Is that really the proper SKU id?  Or is it just unprogrammed on the
 early chips?

AFAIK, it's unprogrammed - it's what I get when I read the sku_id reg
on my board. I haven't found any documentation about what these'll be
in the future or for other boards. This works for now - could you
verify that your Dalmore has the same ID?




 diff --git a/arch/arm/include/asm/arch-tegra114/clock.h 
 b/arch/arm/include/asm/arch-tegra114/clock.h
 new file mode 100644
 index 000..9e56f57
 --- /dev/null
 +++ b/arch/arm/include/asm/arch-tegra114/clock.h
 @@ -0,0 +1,24 @@
 +/*
 + * Copyright (c) 2010-2012, NVIDIA CORPORATION.  All rights reserved.

 2013, here and all new files

Yeah, crap. Meant to do that before sending. I'll correct 'em all in
V2 of the patchset.

Thanks!

 -Allen
 --
 nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/7] Tegra114: Add arch-tegra114 include files

2013-01-17 Thread Tom Warren
Stephen,

On Wed, Jan 16, 2013 at 3:32 PM, Stephen Warren swar...@wwwdotorg.org wrote:
 On 01/16/2013 02:14 PM, Tom Warren wrote:
 Common Tegra files are in arch-tegra, shared between T20/T30/T114.
 Tegra114-specific headers are in arch-tegra114. Note that some of
 these will be filled in as more T114 support is added (drivers,
 WB/LP0 support, etc.).

 diff --git a/arch/arm/include/asm/arch-tegra114/gpio.h 
 b/arch/arm/include/asm/arch-tegra114/gpio.h

 I think the Tegra30 and Tegra114 GPIO controllers are basically
 identical. Can this file be shared at all?


gpio.h is identical for T30 and T114, but not for T20.  I've already
commonized what I could in arch-tegra/gpio.h, but to do the same for
the gpio_ctlr struct and gpio_pin enums would involve #ifdefs, which
is moving in the wrong direction, IMO.  If you have a way to share one
or two files between T20/T30/T114/future SoCs, I'll give it a try.

 diff --git a/arch/arm/include/asm/arch-tegra114/tegra.h 
 b/arch/arm/include/asm/arch-tegra114/tegra.h

 +#define BCT_ODMDATA_OFFSET   6116/* 12 bytes from end of BCT */

 That's the Tegra30 value. I'm pretty sure the Tegra30 and Tegra114 BCTs
 are laid out very differently, so this value isn't valid.


True, and I have a fix (T114 BIT pointers moved, as did the BCT
ODMDATA offset - I'd assumed they'd stay the same since T30 and T114
are so similar). It'll be in V2.

Thanks,

Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/7] Tegra114: Add arch-tegra114 include files

2013-01-17 Thread Stephen Warren
On 01/17/2013 10:51 AM, Tom Warren wrote:
 Stephen,
 
 On Wed, Jan 16, 2013 at 3:32 PM, Stephen Warren swar...@wwwdotorg.org wrote:
 On 01/16/2013 02:14 PM, Tom Warren wrote:
 Common Tegra files are in arch-tegra, shared between T20/T30/T114.
 Tegra114-specific headers are in arch-tegra114. Note that some of
 these will be filled in as more T114 support is added (drivers,
 WB/LP0 support, etc.).

 diff --git a/arch/arm/include/asm/arch-tegra114/gpio.h 
 b/arch/arm/include/asm/arch-tegra114/gpio.h

 I think the Tegra30 and Tegra114 GPIO controllers are basically
 identical. Can this file be shared at all?

 
 gpio.h is identical for T30 and T114, but not for T20.  I've already
 commonized what I could in arch-tegra/gpio.h, but to do the same for
 the gpio_ctlr struct and gpio_pin enums would involve #ifdefs, which
 is moving in the wrong direction, IMO.  If you have a way to share one
 or two files between T20/T30/T114/future SoCs, I'll give it a try.

This may not work well for U-Boot since it uses structs to define the
register layouts rather than simply #defining the various register
addresses, but:

We use the exact same driver code for Tegra20/30/114. The difference in
register layout between Tegra20/30 can be described algorithmically with
the following data:

 struct tegra_gpio_soc_config {
 u32 bank_stride;
 u32 upper_offset;
 };
 
 static struct tegra_gpio_soc_config tegra20_gpio_config = {
 .bank_stride = 0x80,
 .upper_offset = 0x800,
 };
 
 static struct tegra_gpio_soc_config tegra30_gpio_config = {
 .bank_stride = 0x100,
 .upper_offset = 0x80,
 };
 
 static struct of_device_id tegra_gpio_of_match[] = {
 { .compatible = nvidia,tegra30-gpio, .data = tegra30_gpio_config },
 { .compatible = nvidia,tegra20-gpio, .data = tegra20_gpio_config },
 { },
 };

which feeds into a few register offset #defines:

 #define GPIO_REG(x) (GPIO_BANK(x) * tegra_gpio_bank_stride + \
...
 #define GPIO_CNF(x) (GPIO_REG(x) + 0x00)
...
 #define GPIO_MSK_CNF(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x00)

Alternatively, can the Tegra114 GPIO header simply #include the Tegra30
GPIO header and do nothing else, via some relative include or similar?
I'm not sure how gross that'd turn out to be.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/7] Tegra114: Add arch-tegra114 include files

2013-01-17 Thread Tom Warren
Stephen,

On Thu, Jan 17, 2013 at 3:23 PM, Stephen Warren swar...@wwwdotorg.org wrote:
 On 01/17/2013 10:51 AM, Tom Warren wrote:
 Stephen,

 On Wed, Jan 16, 2013 at 3:32 PM, Stephen Warren swar...@wwwdotorg.org 
 wrote:
 On 01/16/2013 02:14 PM, Tom Warren wrote:
 Common Tegra files are in arch-tegra, shared between T20/T30/T114.
 Tegra114-specific headers are in arch-tegra114. Note that some of
 these will be filled in as more T114 support is added (drivers,
 WB/LP0 support, etc.).

 diff --git a/arch/arm/include/asm/arch-tegra114/gpio.h 
 b/arch/arm/include/asm/arch-tegra114/gpio.h

 I think the Tegra30 and Tegra114 GPIO controllers are basically
 identical. Can this file be shared at all?


 gpio.h is identical for T30 and T114, but not for T20.  I've already
 commonized what I could in arch-tegra/gpio.h, but to do the same for
 the gpio_ctlr struct and gpio_pin enums would involve #ifdefs, which
 is moving in the wrong direction, IMO.  If you have a way to share one
 or two files between T20/T30/T114/future SoCs, I'll give it a try.

 This may not work well for U-Boot since it uses structs to define the
 register layouts rather than simply #defining the various register
 addresses, but:

 We use the exact same driver code for Tegra20/30/114. The difference in
 register layout between Tegra20/30 can be described algorithmically with
 the following data:

 struct tegra_gpio_soc_config {
 u32 bank_stride;
 u32 upper_offset;
 };

 static struct tegra_gpio_soc_config tegra20_gpio_config = {
 .bank_stride = 0x80,
 .upper_offset = 0x800,
 };

 static struct tegra_gpio_soc_config tegra30_gpio_config = {
 .bank_stride = 0x100,
 .upper_offset = 0x80,
 };

 static struct of_device_id tegra_gpio_of_match[] = {
 { .compatible = nvidia,tegra30-gpio, .data = tegra30_gpio_config 
 },
 { .compatible = nvidia,tegra20-gpio, .data = tegra20_gpio_config 
 },
 { },
 };

 which feeds into a few register offset #defines:

 #define GPIO_REG(x) (GPIO_BANK(x) * tegra_gpio_bank_stride + \
 ...
 #define GPIO_CNF(x) (GPIO_REG(x) + 0x00)
 ...
 #define GPIO_MSK_CNF(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 
 0x00)

 Alternatively, can the Tegra114 GPIO header simply #include the Tegra30
 GPIO header and do nothing else, via some relative include or similar?
 I'm not sure how gross that'd turn out to be.

I don't see the value in rewriting the Tegra GPIO driver right now -
maybe after T30 and T114 are more mature and there's more bandwidth.

#including the T30 gpio header is easier. I'll do that in V2.

Thanks
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/7] Tegra114: Add arch-tegra114 include files

2013-01-16 Thread Tom Warren
Common Tegra files are in arch-tegra, shared between T20/T30/T114.
Tegra114-specific headers are in arch-tegra114. Note that some of
these will be filled in as more T114 support is added (drivers,
WB/LP0 support, etc.).

Signed-off-by: Tom Warren twar...@nvidia.com
---
 arch/arm/include/asm/arch-tegra/clk_rst.h |   61 ++-
 arch/arm/include/asm/arch-tegra/gp_padctrl.h  |1 +
 arch/arm/include/asm/arch-tegra/pmc.h |   12 +
 arch/arm/include/asm/arch-tegra/tegra.h   |3 +-
 arch/arm/include/asm/arch-tegra114/clock-tables.h |  402 +
 arch/arm/include/asm/arch-tegra114/clock.h|   24 +
 arch/arm/include/asm/arch-tegra114/flow.h |   35 ++
 arch/arm/include/asm/arch-tegra114/funcmux.h  |   31 +
 arch/arm/include/asm/arch-tegra114/gp_padctrl.h   |   59 ++
 arch/arm/include/asm/arch-tegra114/gpio.h |  304 ++
 arch/arm/include/asm/arch-tegra114/hardware.h |   22 +
 arch/arm/include/asm/arch-tegra114/pinmux.h   |  618 +
 arch/arm/include/asm/arch-tegra114/pmu.h  |   23 +
 arch/arm/include/asm/arch-tegra114/spl.h  |   22 +
 arch/arm/include/asm/arch-tegra114/tegra.h|   26 +
 15 files changed, 1637 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-tegra114/clock-tables.h
 create mode 100644 arch/arm/include/asm/arch-tegra114/clock.h
 create mode 100644 arch/arm/include/asm/arch-tegra114/flow.h
 create mode 100644 arch/arm/include/asm/arch-tegra114/funcmux.h
 create mode 100644 arch/arm/include/asm/arch-tegra114/gp_padctrl.h
 create mode 100644 arch/arm/include/asm/arch-tegra114/gpio.h
 create mode 100644 arch/arm/include/asm/arch-tegra114/hardware.h
 create mode 100644 arch/arm/include/asm/arch-tegra114/pinmux.h
 create mode 100644 arch/arm/include/asm/arch-tegra114/pmu.h
 create mode 100644 arch/arm/include/asm/arch-tegra114/spl.h
 create mode 100644 arch/arm/include/asm/arch-tegra114/tegra.h

diff --git a/arch/arm/include/asm/arch-tegra/clk_rst.h 
b/arch/arm/include/asm/arch-tegra/clk_rst.h
index 6a6e507..f3aa3ed 100644
--- a/arch/arm/include/asm/arch-tegra/clk_rst.h
+++ b/arch/arm/include/asm/arch-tegra/clk_rst.h
@@ -121,16 +121,43 @@ struct clk_rst_ctlr {
uint crc_clk_cpug_cmplx;/* _CLK_CPUG_CMPLX_0,   0x378 */
uint crc_clk_cpulp_cmplx;   /* _CLK_CPULP_CMPLX_0,  0x37C */
uint crc_cpu_softrst_ctrl;  /* _CPU_SOFTRST_CTRL_0, 0x380 */
-   uint crc_reserved33[11];/* _reserved_33,0x384-3ac */
+   uint crc_cpu_softrst_ctrl1; /* _CPU_SOFTRST_CTR1L_0,0x384 */
+   uint crc_cpu_softrst_ctrl2; /* _CPU_SOFTRST_CTRL2_0,0x388 */
+   uint crc_reserved33[9]; /* _reserved_33,0x38c-3ac */
uint crc_clk_src_vw[TEGRA_CLK_SOURCES_VW]; /* _G3D2_0..., 0x3b0-0x42c */
/* _RST_DEV_V/W_SET_0 0x430 ~ 0x43c */
struct clk_set_clr crc_rst_dev_ex_vw[TEGRA_CLK_REGS_VW];
/* _CLK_ENB_V/W_CLR_0 0x440 ~ 0x44c */
struct clk_set_clr crc_clk_enb_ex_vw[TEGRA_CLK_REGS_VW];
-   uint crc_reserved40[12];/* _reserved_40,0x450-47C */
-   uint crc_pll_cfg0;  /* _PLL_CFG0_0, 0x480 */
-   uint crc_pll_cfg1;  /* _PLL_CFG1_0, 0x484 */
-   uint crc_pll_cfg2;  /* _PLL_CFG2_0, 0x488 */
+   /* Additional (T114) registers */
+   uint crc_rst_cpug_cmplx_set;/* _RST_CPUG_CMPLX_SET_0,  0x450 */
+   uint crc_rst_cpug_cmplx_clr;/* _RST_CPUG_CMPLX_CLR_0,  0x454 */
+   uint crc_rst_cpulp_cmplx_set;   /* _RST_CPULP_CMPLX_SET_0, 0x458 */
+   uint crc_rst_cpulp_cmplx_clr;   /* _RST_CPULP_CMPLX_CLR_0, 0x45C */
+   uint crc_clk_cpug_cmplx_set;/* _CLK_CPUG_CMPLX_SET_0,  0x460 */
+   uint crc_clk_cpug_cmplx_clr;/* _CLK_CPUG_CMPLX_CLR_0,  0x464 */
+   uint crc_clk_cpulp_cmplx_set;   /* _CLK_CPULP_CMPLX_SET_0, 0x468 */
+   uint crc_clk_cpulp_cmplx_clr;   /* _CLK_CPULP_CMPLX_CLR_0, 0x46C */
+   uint crc_cpu_cmplx_status;  /* _CPU_CMPLX_STATUS_0,0x470 */
+   uint crc_reserved40[1]; /* _reserved_40,0x474 */
+   uint crc_intstatus; /* __INTSTATUS_0,   0x478 */
+   uint crc_intmask;   /* __INTMASK_0, 0x47C */
+   uint crc_utmip_pll_cfg0;/* _UTMIP_PLL_CFG0_0,   0x480 */
+   uint crc_utmip_pll_cfg1;/* _UTMIP_PLL_CFG1_0,   0x484 */
+   uint crc_utmip_pll_cfg2;/* _UTMIP_PLL_CFG2_0,   0x488 */
+
+   uint crc_plle_aux;  /* _PLLE_AUX_0, 0x48C */
+   uint crc_sata_pll_cfg0; /* _SATA_PLL_CFG0_0,0x490 */
+   uint crc_sata_pll_cfg1; /* _SATA_PLL_CFG1_0,0x494 */
+   uint crc_pcie_pll_cfg0; /* _PCIE_PLL_CFG0_0,0x498 */
+
+   uint crc_prog_audio_dly_clk;/* _PROG_AUDIO_DLY_CLK_0, 0x49C */
+   uint crc_audio_sync_clk_i2s0;   /* _AUDIO_SYNC_CLK_I2S0_0, 0x4A0 */
+ 

Re: [U-Boot] [PATCH 1/7] Tegra114: Add arch-tegra114 include files

2013-01-16 Thread Stephen Warren
On 01/16/2013 02:14 PM, Tom Warren wrote:
 Common Tegra files are in arch-tegra, shared between T20/T30/T114.
 Tegra114-specific headers are in arch-tegra114. Note that some of
 these will be filled in as more T114 support is added (drivers,
 WB/LP0 support, etc.).

 diff --git a/arch/arm/include/asm/arch-tegra114/gpio.h 
 b/arch/arm/include/asm/arch-tegra114/gpio.h

I think the Tegra30 and Tegra114 GPIO controllers are basically
identical. Can this file be shared at all?

 diff --git a/arch/arm/include/asm/arch-tegra114/tegra.h 
 b/arch/arm/include/asm/arch-tegra114/tegra.h

 +#define BCT_ODMDATA_OFFSET   6116/* 12 bytes from end of BCT */

That's the Tegra30 value. I'm pretty sure the Tegra30 and Tegra114 BCTs
are laid out very differently, so this value isn't valid.

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


Re: [U-Boot] [PATCH 1/7] Tegra114: Add arch-tegra114 include files

2013-01-16 Thread Allen Martin
On Wed, Jan 16, 2013 at 01:14:02PM -0800, Tom Warren wrote:
 Common Tegra files are in arch-tegra, shared between T20/T30/T114.
 Tegra114-specific headers are in arch-tegra114. Note that some of
 these will be filled in as more T114 support is added (drivers,
 WB/LP0 support, etc.).
 
 Signed-off-by: Tom Warren twar...@nvidia.com
 ---

 +#if defined(CONFIG_TEGRA20)
  #define OSC_FREQ_SHIFT 30
  #define OSC_FREQ_MASK  (3U  OSC_FREQ_SHIFT)
 +#else  /* Tegra30, Tegra114 */
 +#define OSC_FREQ_SHIFT 28
 +#define OSC_FREQ_MASK  (0xF  OSC_FREQ_SHIFT)
 +#endif

Can this be a new define instead of a #ifdef?  That makes it easier in
the future to make a single u-boot to boot on all tegras.


 index 953936c..670745f 100644
 --- a/arch/arm/include/asm/arch-tegra/tegra.h
 +++ b/arch/arm/include/asm/arch-tegra/tegra.h
 @@ -73,6 +73,7 @@ enum {
 SKU_ID_AP25E= 0x1b,
 SKU_ID_T25E = 0x1c,
 SKU_ID_T30  = 0x81, /* Cardhu value */
 +   SKU_ID_T114 = 0x00, /* Dalmore value */
  };

Is that really the proper SKU id?  Or is it just unprogrammed on the
early chips?



 diff --git a/arch/arm/include/asm/arch-tegra114/clock.h 
 b/arch/arm/include/asm/arch-tegra114/clock.h
 new file mode 100644
 index 000..9e56f57
 --- /dev/null
 +++ b/arch/arm/include/asm/arch-tegra114/clock.h
 @@ -0,0 +1,24 @@
 +/*
 + * Copyright (c) 2010-2012, NVIDIA CORPORATION.  All rights reserved.

2013, here and all new files

-Allen
-- 
nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot