[RFC v2 5/8] ARM: tegra: Add auxiliary data for nvhost

2012-11-27 Thread Stephen Warren
On 11/26/2012 11:33 PM, Terje Bergstr?m wrote:
> On 27.11.2012 01:39, Stephen Warren wrote:
>> Clock names shouldn't be passed in platform data; instead, clk_get()
>> should be passed the device object and device-relative (i.e. not global)
>> clock name. I expect if the driver is fixed to make this change, the
>> changes to tegra*_clocks_data.c won't be needed either.
> 
> Isn't this code doing exactly that - getting a device relative clock,
> nvhost_module_init() in nvhost.acm.c:
> 
> (...)
>   /* initialize clocks to known state */
>   while (pdata->clocks[i].name && i < NVHOST_MODULE_MAX_CLOCKS) {
>   long rate = pdata->clocks[i].default_rate;
>   struct clk *c;
> 
>   c = devm_clk_get(>dev, pdata->clocks[i].name);

The line above is getting the (device-relative) clock name from platform
data, rather than using some fixed name as it should be.


[RFC v2 5/8] ARM: tegra: Add auxiliary data for nvhost

2012-11-27 Thread Terje Bergström
On 27.11.2012 01:39, Stephen Warren wrote:
> Clock names shouldn't be passed in platform data; instead, clk_get()
> should be passed the device object and device-relative (i.e. not global)
> clock name. I expect if the driver is fixed to make this change, the
> changes to tegra*_clocks_data.c won't be needed either.

Isn't this code doing exactly that - getting a device relative clock,
nvhost_module_init() in nvhost.acm.c:

(...)
/* initialize clocks to known state */
while (pdata->clocks[i].name && i < NVHOST_MODULE_MAX_CLOCKS) {
long rate = pdata->clocks[i].default_rate;
struct clk *c;

c = devm_clk_get(>dev, pdata->clocks[i].name);
if (IS_ERR_OR_NULL(c)) {
dev_err(>dev, "Cannot get clock %s\n",
pdata->clocks[i].name);
return -ENODEV;
}

rate = clk_round_rate(c, rate);
clk_prepare_enable(c);
clk_set_rate(c, rate);
clk_disable_unprepare(c);
pdata->clk[i] = c;
i++;
}
(...)

Without the clock changes, the clocks in board files are now assigned to
devid "tegra_grhost". I guess the correct way to do this would be to
assign them to "tegra-gr2d" (2d, epp) and "host1x" - except if we also
want to drop "tegra-" from the device name.

Terje


Re: [RFC v2 5/8] ARM: tegra: Add auxiliary data for nvhost

2012-11-27 Thread Stephen Warren
On 11/26/2012 11:33 PM, Terje Bergström wrote:
 On 27.11.2012 01:39, Stephen Warren wrote:
 Clock names shouldn't be passed in platform data; instead, clk_get()
 should be passed the device object and device-relative (i.e. not global)
 clock name. I expect if the driver is fixed to make this change, the
 changes to tegra*_clocks_data.c won't be needed either.
 
 Isn't this code doing exactly that - getting a device relative clock,
 nvhost_module_init() in nvhost.acm.c:
 
 (...)
   /* initialize clocks to known state */
   while (pdata-clocks[i].name  i  NVHOST_MODULE_MAX_CLOCKS) {
   long rate = pdata-clocks[i].default_rate;
   struct clk *c;
 
   c = devm_clk_get(dev-dev, pdata-clocks[i].name);

The line above is getting the (device-relative) clock name from platform
data, rather than using some fixed name as it should be.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[RFC v2 5/8] ARM: tegra: Add auxiliary data for nvhost

2012-11-26 Thread Stephen Warren
On 11/26/2012 06:19 AM, Terje Bergstrom wrote:
> Add SoC specific auxiliary data to host1x and gr2d. nvhost uses
> this data.
> 
> Signed-off-by: Terje Bergstrom 
> Signed-off-by: Arto Merilainen 

Arto's S-o-b really should be first and yours last since you're (Terje)
the one who touched the patches last.

> diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c 
> b/arch/arm/mach-tegra/board-dt-tegra20.c

I think none of the changes the board-dt-tegra*.c should be made.

AUXDATA is a temporary measure to keep things working during the
transition to device tree. We want to remove entries from the AUXDATA
tables rather than add them. The only thing that's stopping us from
doing so right now is the lack of DT-based clock lookups, which hence
require devices to have a specific name.

> +static struct nvhost_device_data tegra_host1x_info = {
> + .clocks = { {"host1x", UINT_MAX} },

> +static struct nvhost_device_data tegra_gr2d_info = {
> + .clocks = { {"gr2d", UINT_MAX, true}, {"epp", UINT_MAX, true} },

Clock names shouldn't be passed in platform data; instead, clk_get()
should be passed the device object and device-relative (i.e. not global)
clock name. I expect if the driver is fixed to make this change, the
changes to tegra*_clocks_data.c won't be needed either.



[RFC v2 5/8] ARM: tegra: Add auxiliary data for nvhost

2012-11-26 Thread Terje Bergstrom
Add SoC specific auxiliary data to host1x and gr2d. nvhost uses
this data.

Signed-off-by: Terje Bergstrom 
Signed-off-by: Arto Merilainen 
---
 arch/arm/mach-tegra/board-dt-tegra20.c|   38 -
 arch/arm/mach-tegra/board-dt-tegra30.c|   38 -
 arch/arm/mach-tegra/tegra20_clocks_data.c |8 +++---
 arch/arm/mach-tegra/tegra30_clocks_data.c |2 ++
 4 files changed, 80 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c 
b/arch/arm/mach-tegra/board-dt-tegra20.c
index 1d30eac..c695392 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -45,6 +46,38 @@
 #include "common.h"
 #include "iomap.h"

+static const char *host1x_syncpt_names[32] = {
+   [0] = "gfx_host",
+   [NVSYNCPT_2D_0] = "2d_0",
+   [NVSYNCPT_2D_1] = "2d_1",
+   [NVSYNCPT_VBLANK0] = "vblank0",
+   [NVSYNCPT_VBLANK1] = "vblank1",
+};
+
+static struct host1x_device_info host1x_info = {
+   .nb_channels= 8,
+   .nb_pts = 32,
+   .nb_mlocks  = 16,
+   .nb_bases   = 8,
+   .syncpt_names   = host1x_syncpt_names,
+   .client_managed = NVSYNCPTS_CLIENT_MANAGED,
+};
+
+static struct nvhost_device_data tegra_host1x_info = {
+   .clocks = { {"host1x", UINT_MAX} },
+   NVHOST_MODULE_NO_POWERGATE_IDS,
+   .private_data = _info,
+};
+
+static struct nvhost_device_data tegra_gr2d_info = {
+   .index  = 2,
+   .syncpts= BIT(NVSYNCPT_2D_0) | BIT(NVSYNCPT_2D_1),
+   .clocks = { {"gr2d", UINT_MAX, true}, {"epp", UINT_MAX, true} },
+   NVHOST_MODULE_NO_POWERGATE_IDS,
+   .clockgate_delay = 0,
+   .serialize  = true,
+};
+
 struct tegra_ehci_platform_data tegra_ehci1_pdata = {
.operating_mode = TEGRA_USB_OTG,
.power_down_on_bus_suspend = 1,
@@ -94,13 +127,16 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata 
= {
OF_DEV_AUXDATA("nvidia,tegra20-slink", 0x7000D600, "spi_tegra.1", NULL),
OF_DEV_AUXDATA("nvidia,tegra20-slink", 0x7000D800, "spi_tegra.2", NULL),
OF_DEV_AUXDATA("nvidia,tegra20-slink", 0x7000DA00, "spi_tegra.3", NULL),
-   OF_DEV_AUXDATA("nvidia,tegra20-host1x", 0x5000, "host1x", NULL),
+   OF_DEV_AUXDATA("nvidia,tegra20-host1x", 0x5000, "host1x",
+   _host1x_info),
OF_DEV_AUXDATA("nvidia,tegra20-dc", 0x5420, "tegradc.0", NULL),
OF_DEV_AUXDATA("nvidia,tegra20-dc", 0x5424, "tegradc.1", NULL),
OF_DEV_AUXDATA("nvidia,tegra20-hdmi", 0x5428, "hdmi", NULL),
OF_DEV_AUXDATA("nvidia,tegra20-dsi", 0x5430, "dsi", NULL),
OF_DEV_AUXDATA("nvidia,tegra20-tvo", 0x542c, "tvo", NULL),
OF_DEV_AUXDATA("nvidia,tegra20-nand", 0x70008000, "tegra-nand", NULL),
+   OF_DEV_AUXDATA("nvidia,tegra20-gr2d", 0x5414, "tegra-gr2d",
+  _gr2d_info),
{}
 };

diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c 
b/arch/arm/mach-tegra/board-dt-tegra30.c
index 6497d12..1afa68b 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -38,6 +39,38 @@
 #include "common.h"
 #include "iomap.h"

+static const char *host1x_syncpt_names[32] = {
+   [0] = "gfx_host",
+   [NVSYNCPT_2D_0] = "2d_0",
+   [NVSYNCPT_2D_1] = "2d_1",
+   [NVSYNCPT_VBLANK0] = "vblank0",
+   [NVSYNCPT_VBLANK1] = "vblank1",
+};
+
+static struct host1x_device_info host1x_info = {
+   .nb_channels= 8,
+   .nb_pts = 32,
+   .nb_mlocks  = 16,
+   .nb_bases   = 8,
+   .syncpt_names   = host1x_syncpt_names,
+   .client_managed = NVSYNCPTS_CLIENT_MANAGED,
+};
+
+static struct nvhost_device_data tegra_host1x_info = {
+   .clocks = { {"host1x", UINT_MAX} },
+   NVHOST_MODULE_NO_POWERGATE_IDS,
+   .private_data = _info,
+};
+
+static struct nvhost_device_data tegra_gr2d_info = {
+   .index  = 2,
+   .syncpts= BIT(NVSYNCPT_2D_0) | BIT(NVSYNCPT_2D_1),
+   .clocks = { {"gr2d", UINT_MAX, true}, {"epp", UINT_MAX, true} },
+   NVHOST_MODULE_NO_POWERGATE_IDS,
+   .clockgate_delay = 0,
+   .serialize  = true,
+};
+
 struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x7800, "sdhci-tegra.0", 
NULL),
OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000200, "sdhci-tegra.1", 
NULL),
@@ -57,12 +90,15 @@ struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = 
{
OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000DA00, "spi_tegra.3", NULL),
OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000DC00, "spi_tegra.4", NULL),
OF_DEV_AUXDATA("nvidia,tegra30-slink", 0x7000DE00, "spi_tegra.5", NULL),
-  

[RFC v2 5/8] ARM: tegra: Add auxiliary data for nvhost

2012-11-26 Thread Terje Bergstrom
Add SoC specific auxiliary data to host1x and gr2d. nvhost uses
this data.

Signed-off-by: Terje Bergstrom tbergst...@nvidia.com
Signed-off-by: Arto Merilainen amerilai...@nvidia.com
---
 arch/arm/mach-tegra/board-dt-tegra20.c|   38 -
 arch/arm/mach-tegra/board-dt-tegra30.c|   38 -
 arch/arm/mach-tegra/tegra20_clocks_data.c |8 +++---
 arch/arm/mach-tegra/tegra30_clocks_data.c |2 ++
 4 files changed, 80 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c 
b/arch/arm/mach-tegra/board-dt-tegra20.c
index 1d30eac..c695392 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -33,6 +33,7 @@
 #include linux/i2c.h
 #include linux/i2c-tegra.h
 #include linux/usb/tegra_usb_phy.h
+#include linux/nvhost.h
 
 #include asm/hardware/gic.h
 #include asm/mach-types.h
@@ -45,6 +46,38 @@
 #include common.h
 #include iomap.h
 
+static const char *host1x_syncpt_names[32] = {
+   [0] = gfx_host,
+   [NVSYNCPT_2D_0] = 2d_0,
+   [NVSYNCPT_2D_1] = 2d_1,
+   [NVSYNCPT_VBLANK0] = vblank0,
+   [NVSYNCPT_VBLANK1] = vblank1,
+};
+
+static struct host1x_device_info host1x_info = {
+   .nb_channels= 8,
+   .nb_pts = 32,
+   .nb_mlocks  = 16,
+   .nb_bases   = 8,
+   .syncpt_names   = host1x_syncpt_names,
+   .client_managed = NVSYNCPTS_CLIENT_MANAGED,
+};
+
+static struct nvhost_device_data tegra_host1x_info = {
+   .clocks = { {host1x, UINT_MAX} },
+   NVHOST_MODULE_NO_POWERGATE_IDS,
+   .private_data = host1x_info,
+};
+
+static struct nvhost_device_data tegra_gr2d_info = {
+   .index  = 2,
+   .syncpts= BIT(NVSYNCPT_2D_0) | BIT(NVSYNCPT_2D_1),
+   .clocks = { {gr2d, UINT_MAX, true}, {epp, UINT_MAX, true} },
+   NVHOST_MODULE_NO_POWERGATE_IDS,
+   .clockgate_delay = 0,
+   .serialize  = true,
+};
+
 struct tegra_ehci_platform_data tegra_ehci1_pdata = {
.operating_mode = TEGRA_USB_OTG,
.power_down_on_bus_suspend = 1,
@@ -94,13 +127,16 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata 
= {
OF_DEV_AUXDATA(nvidia,tegra20-slink, 0x7000D600, spi_tegra.1, NULL),
OF_DEV_AUXDATA(nvidia,tegra20-slink, 0x7000D800, spi_tegra.2, NULL),
OF_DEV_AUXDATA(nvidia,tegra20-slink, 0x7000DA00, spi_tegra.3, NULL),
-   OF_DEV_AUXDATA(nvidia,tegra20-host1x, 0x5000, host1x, NULL),
+   OF_DEV_AUXDATA(nvidia,tegra20-host1x, 0x5000, host1x,
+   tegra_host1x_info),
OF_DEV_AUXDATA(nvidia,tegra20-dc, 0x5420, tegradc.0, NULL),
OF_DEV_AUXDATA(nvidia,tegra20-dc, 0x5424, tegradc.1, NULL),
OF_DEV_AUXDATA(nvidia,tegra20-hdmi, 0x5428, hdmi, NULL),
OF_DEV_AUXDATA(nvidia,tegra20-dsi, 0x5430, dsi, NULL),
OF_DEV_AUXDATA(nvidia,tegra20-tvo, 0x542c, tvo, NULL),
OF_DEV_AUXDATA(nvidia,tegra20-nand, 0x70008000, tegra-nand, NULL),
+   OF_DEV_AUXDATA(nvidia,tegra20-gr2d, 0x5414, tegra-gr2d,
+  tegra_gr2d_info),
{}
 };
 
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c 
b/arch/arm/mach-tegra/board-dt-tegra30.c
index 6497d12..1afa68b 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -29,6 +29,7 @@
 #include linux/of_fdt.h
 #include linux/of_irq.h
 #include linux/of_platform.h
+#include linux/nvhost.h
 
 #include asm/mach/arch.h
 #include asm/hardware/gic.h
@@ -38,6 +39,38 @@
 #include common.h
 #include iomap.h
 
+static const char *host1x_syncpt_names[32] = {
+   [0] = gfx_host,
+   [NVSYNCPT_2D_0] = 2d_0,
+   [NVSYNCPT_2D_1] = 2d_1,
+   [NVSYNCPT_VBLANK0] = vblank0,
+   [NVSYNCPT_VBLANK1] = vblank1,
+};
+
+static struct host1x_device_info host1x_info = {
+   .nb_channels= 8,
+   .nb_pts = 32,
+   .nb_mlocks  = 16,
+   .nb_bases   = 8,
+   .syncpt_names   = host1x_syncpt_names,
+   .client_managed = NVSYNCPTS_CLIENT_MANAGED,
+};
+
+static struct nvhost_device_data tegra_host1x_info = {
+   .clocks = { {host1x, UINT_MAX} },
+   NVHOST_MODULE_NO_POWERGATE_IDS,
+   .private_data = host1x_info,
+};
+
+static struct nvhost_device_data tegra_gr2d_info = {
+   .index  = 2,
+   .syncpts= BIT(NVSYNCPT_2D_0) | BIT(NVSYNCPT_2D_1),
+   .clocks = { {gr2d, UINT_MAX, true}, {epp, UINT_MAX, true} },
+   NVHOST_MODULE_NO_POWERGATE_IDS,
+   .clockgate_delay = 0,
+   .serialize  = true,
+};
+
 struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA(nvidia,tegra20-sdhci, 0x7800, sdhci-tegra.0, 
NULL),
OF_DEV_AUXDATA(nvidia,tegra20-sdhci, 0x78000200, sdhci-tegra.1, 
NULL),
@@ -57,12 +90,15 @@ struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = 
{
OF_DEV_AUXDATA(nvidia,tegra30-slink, 0x7000DA00, spi_tegra.3, NULL),

Re: [RFC v2 5/8] ARM: tegra: Add auxiliary data for nvhost

2012-11-26 Thread Stephen Warren
On 11/26/2012 06:19 AM, Terje Bergstrom wrote:
 Add SoC specific auxiliary data to host1x and gr2d. nvhost uses
 this data.
 
 Signed-off-by: Terje Bergstrom tbergst...@nvidia.com
 Signed-off-by: Arto Merilainen amerilai...@nvidia.com

Arto's S-o-b really should be first and yours last since you're (Terje)
the one who touched the patches last.

 diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c 
 b/arch/arm/mach-tegra/board-dt-tegra20.c

I think none of the changes the board-dt-tegra*.c should be made.

AUXDATA is a temporary measure to keep things working during the
transition to device tree. We want to remove entries from the AUXDATA
tables rather than add them. The only thing that's stopping us from
doing so right now is the lack of DT-based clock lookups, which hence
require devices to have a specific name.

 +static struct nvhost_device_data tegra_host1x_info = {
 + .clocks = { {host1x, UINT_MAX} },

 +static struct nvhost_device_data tegra_gr2d_info = {
 + .clocks = { {gr2d, UINT_MAX, true}, {epp, UINT_MAX, true} },

Clock names shouldn't be passed in platform data; instead, clk_get()
should be passed the device object and device-relative (i.e. not global)
clock name. I expect if the driver is fixed to make this change, the
changes to tegra*_clocks_data.c won't be needed either.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RFC v2 5/8] ARM: tegra: Add auxiliary data for nvhost

2012-11-26 Thread Terje Bergström
On 27.11.2012 01:39, Stephen Warren wrote:
 Clock names shouldn't be passed in platform data; instead, clk_get()
 should be passed the device object and device-relative (i.e. not global)
 clock name. I expect if the driver is fixed to make this change, the
 changes to tegra*_clocks_data.c won't be needed either.

Isn't this code doing exactly that - getting a device relative clock,
nvhost_module_init() in nvhost.acm.c:

(...)
/* initialize clocks to known state */
while (pdata-clocks[i].name  i  NVHOST_MODULE_MAX_CLOCKS) {
long rate = pdata-clocks[i].default_rate;
struct clk *c;

c = devm_clk_get(dev-dev, pdata-clocks[i].name);
if (IS_ERR_OR_NULL(c)) {
dev_err(dev-dev, Cannot get clock %s\n,
pdata-clocks[i].name);
return -ENODEV;
}

rate = clk_round_rate(c, rate);
clk_prepare_enable(c);
clk_set_rate(c, rate);
clk_disable_unprepare(c);
pdata-clk[i] = c;
i++;
}
(...)

Without the clock changes, the clocks in board files are now assigned to
devid tegra_grhost. I guess the correct way to do this would be to
assign them to tegra-gr2d (2d, epp) and host1x - except if we also
want to drop tegra- from the device name.

Terje
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel