From: Mike Rapoport <mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
To: Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org,
konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 4/6] ARM: tegra: harmony: register sdhci devices
Date: Tue, 22 Feb 2011 08:59:16 +0200 [thread overview]
Message-ID: <4D635EC4.2030102@compulab.co.il> (raw)
In-Reply-To: <1298354117-19097-5-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
Hi Olof,
Sorry for jumping late, haven't thought about the proposal below yesterday.
I'm not objecting to applying the patch as is, we can refactor the code
afterwards as well.
On 02/22/11 07:55, Olof Johansson wrote:
> Add the 3 sdhci devices that are available on Harmony as
> platform devices. Two go to slots (one 4-lane, one 8-lane),
> and one goes to onboard wifi.
>
> Signed-off-by: Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
> ---
> arch/arm/mach-tegra/board-harmony.c | 30 ++++++++++++++++++++++++++++++
> 1 files changed, 30 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c
> index f6ad58b..7010774 100644
> --- a/arch/arm/mach-tegra/board-harmony.c
> +++ b/arch/arm/mach-tegra/board-harmony.c
> @@ -30,10 +30,13 @@
>
> #include <mach/iomap.h>
> #include <mach/irqs.h>
> +#include <mach/sdhci.h>
>
> #include "board.h"
> #include "board-harmony.h"
> #include "clock.h"
> +#include "devices.h"
> +#include "gpio-names.h"
>
> static struct plat_serial8250_port debug_uart_platform_data[] = {
> {
> @@ -59,6 +62,9 @@ static struct platform_device debug_uart = {
>
> static struct platform_device *harmony_devices[] __initdata = {
> &debug_uart,
> + &tegra_sdhci_device1,
> + &tegra_sdhci_device2,
> + &tegra_sdhci_device4,
> };
>
> static void __init tegra_harmony_fixup(struct machine_desc *desc,
> @@ -77,6 +83,26 @@ static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = {
> { NULL, NULL, 0, 0},
> };
>
> +
> +static struct tegra_sdhci_platform_data sdhci_pdata1 = {
> + .cd_gpio = -1,
> + .wp_gpio = -1,
> + .power_gpio = -1,
> +};
> +
> +static struct tegra_sdhci_platform_data sdhci_pdata2 = {
> + .cd_gpio = TEGRA_GPIO_PI5,
> + .wp_gpio = TEGRA_GPIO_PH1,
> + .power_gpio = TEGRA_GPIO_PT3,
> +};
> +
> +static struct tegra_sdhci_platform_data sdhci_pdata4 = {
> + .cd_gpio = TEGRA_GPIO_PH2,
> + .wp_gpio = TEGRA_GPIO_PH3,
> + .power_gpio = TEGRA_GPIO_PI6,
> + .is_8bit = 1,
> +};
> +
> static void __init tegra_harmony_init(void)
> {
> tegra_common_init();
> @@ -85,6 +111,10 @@ static void __init tegra_harmony_init(void)
>
> harmony_pinmux_init();
>
> + tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
> + tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2;
> + tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
> +
I think that instead of copying explicit initialization of the platform_data
member from board to board we can do something similar to what PXA does. The
board file would have to call something like
tegra_set_device_X_info(struct tegra_device_X_platform_data *data);
and then static registration of platform devices in the board files can be dropped.
For instance, the devices.c would have
void __init tegra_register_device(struct platform_device *dev, void *data)
{
int ret;
dev->dev.platform_data = data;
ret = platform_device_register(dev);
if (ret)
dev_err(&dev->dev, "unable to register device: %d\n", ret);
}
void __init tegra_set_sdhci1_info(struct tegra_sdhci_platform_data *info)
{
tegra_register_device(&tegra_sdhci_device1, info);
}
and the board files would just call tegra_set_sdhci1_info to pass the platform
data for the tegra_sdhci_device1 and register the device.
This way we could reduce amount of copy/paste between the board files. Besides,
if/when tegra will be using device trees, handling of the device registration in
common place would make the transition easier.
> platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices));
> }
>
--
Sincerely yours,
Mike.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: mike@compulab.co.il (Mike Rapoport)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/6] ARM: tegra: harmony: register sdhci devices
Date: Tue, 22 Feb 2011 08:59:16 +0200 [thread overview]
Message-ID: <4D635EC4.2030102@compulab.co.il> (raw)
In-Reply-To: <1298354117-19097-5-git-send-email-olof@lixom.net>
Hi Olof,
Sorry for jumping late, haven't thought about the proposal below yesterday.
I'm not objecting to applying the patch as is, we can refactor the code
afterwards as well.
On 02/22/11 07:55, Olof Johansson wrote:
> Add the 3 sdhci devices that are available on Harmony as
> platform devices. Two go to slots (one 4-lane, one 8-lane),
> and one goes to onboard wifi.
>
> Signed-off-by: Olof Johansson <olof@lixom.net>
> ---
> arch/arm/mach-tegra/board-harmony.c | 30 ++++++++++++++++++++++++++++++
> 1 files changed, 30 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c
> index f6ad58b..7010774 100644
> --- a/arch/arm/mach-tegra/board-harmony.c
> +++ b/arch/arm/mach-tegra/board-harmony.c
> @@ -30,10 +30,13 @@
>
> #include <mach/iomap.h>
> #include <mach/irqs.h>
> +#include <mach/sdhci.h>
>
> #include "board.h"
> #include "board-harmony.h"
> #include "clock.h"
> +#include "devices.h"
> +#include "gpio-names.h"
>
> static struct plat_serial8250_port debug_uart_platform_data[] = {
> {
> @@ -59,6 +62,9 @@ static struct platform_device debug_uart = {
>
> static struct platform_device *harmony_devices[] __initdata = {
> &debug_uart,
> + &tegra_sdhci_device1,
> + &tegra_sdhci_device2,
> + &tegra_sdhci_device4,
> };
>
> static void __init tegra_harmony_fixup(struct machine_desc *desc,
> @@ -77,6 +83,26 @@ static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = {
> { NULL, NULL, 0, 0},
> };
>
> +
> +static struct tegra_sdhci_platform_data sdhci_pdata1 = {
> + .cd_gpio = -1,
> + .wp_gpio = -1,
> + .power_gpio = -1,
> +};
> +
> +static struct tegra_sdhci_platform_data sdhci_pdata2 = {
> + .cd_gpio = TEGRA_GPIO_PI5,
> + .wp_gpio = TEGRA_GPIO_PH1,
> + .power_gpio = TEGRA_GPIO_PT3,
> +};
> +
> +static struct tegra_sdhci_platform_data sdhci_pdata4 = {
> + .cd_gpio = TEGRA_GPIO_PH2,
> + .wp_gpio = TEGRA_GPIO_PH3,
> + .power_gpio = TEGRA_GPIO_PI6,
> + .is_8bit = 1,
> +};
> +
> static void __init tegra_harmony_init(void)
> {
> tegra_common_init();
> @@ -85,6 +111,10 @@ static void __init tegra_harmony_init(void)
>
> harmony_pinmux_init();
>
> + tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
> + tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2;
> + tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
> +
I think that instead of copying explicit initialization of the platform_data
member from board to board we can do something similar to what PXA does. The
board file would have to call something like
tegra_set_device_X_info(struct tegra_device_X_platform_data *data);
and then static registration of platform devices in the board files can be dropped.
For instance, the devices.c would have
void __init tegra_register_device(struct platform_device *dev, void *data)
{
int ret;
dev->dev.platform_data = data;
ret = platform_device_register(dev);
if (ret)
dev_err(&dev->dev, "unable to register device: %d\n", ret);
}
void __init tegra_set_sdhci1_info(struct tegra_sdhci_platform_data *info)
{
tegra_register_device(&tegra_sdhci_device1, info);
}
and the board files would just call tegra_set_sdhci1_info to pass the platform
data for the tegra_sdhci_device1 and register the device.
This way we could reduce amount of copy/paste between the board files. Besides,
if/when tegra will be using device trees, handling of the device registration in
common place would make the transition easier.
> platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices));
> }
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2011-02-22 6:59 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 5:55 [PATCH v3 0/6] Tegra board patches Olof Johansson
2011-02-22 5:55 ` Olof Johansson
[not found] ` <1298354117-19097-1-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-22 5:55 ` [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config Olof Johansson
2011-02-22 5:55 ` Olof Johansson
[not found] ` <1298354117-19097-2-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-22 13:13 ` Sergei Shtylyov
2011-02-22 13:13 ` Sergei Shtylyov
[not found] ` <4D63B661.6000407-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2011-02-22 15:31 ` Olof Johansson
2011-02-22 15:31 ` Olof Johansson
2011-02-22 19:18 ` Erik Gilling
2011-02-22 19:18 ` Erik Gilling
[not found] ` <AANLkTik9_t0mq07mysO2CcK4ppKAmuPAujownfeWEGL5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-22 19:35 ` Olof Johansson
2011-02-22 19:35 ` Olof Johansson
[not found] ` <AANLkTimBh2qDx71+P3QCeWJ0sKS1AzYOUohAdSW=AoeS-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-22 23:14 ` Erik Gilling
2011-02-22 23:14 ` Erik Gilling
2011-02-22 20:46 ` Russell King - ARM Linux
2011-02-22 20:46 ` Russell King - ARM Linux
[not found] ` <20110222204654.GD29559-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-02-22 21:00 ` Olof Johansson
2011-02-22 21:00 ` Olof Johansson
2011-02-22 5:55 ` [PATCH 2/6] ARM: tegra: common device resources Olof Johansson
2011-02-22 5:55 ` Olof Johansson
2011-02-22 5:55 ` [PATCH 3/6] ARM: tegra: remove stale nvidia atag handler Olof Johansson
2011-02-22 5:55 ` Olof Johansson
[not found] ` <1298354117-19097-4-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-22 19:39 ` Colin Cross
2011-02-22 19:39 ` Colin Cross
2011-02-22 5:55 ` [PATCH 4/6] ARM: tegra: harmony: register sdhci devices Olof Johansson
2011-02-22 5:55 ` Olof Johansson
[not found] ` <1298354117-19097-5-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-22 6:59 ` Mike Rapoport [this message]
2011-02-22 6:59 ` Mike Rapoport
[not found] ` <4D635EC4.2030102-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
2011-02-22 15:44 ` Olof Johansson
2011-02-22 15:44 ` Olof Johansson
[not found] ` <AANLkTi=mjR6dnxcTxYzTvJK4DgEW7mO+p4TUeu6kq6fn-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-23 20:53 ` Grant Likely
2011-02-23 20:53 ` Grant Likely
2011-02-22 19:40 ` Colin Cross
2011-02-22 19:40 ` Colin Cross
2011-02-22 5:55 ` [PATCH 5/6] ARM: tegra: harmony: fix pinmux for MMC slot Olof Johansson
2011-02-22 5:55 ` Olof Johansson
2011-02-22 5:55 ` [PATCH 6/6] ARM: tegra: add seaboard, wario and kaen boards Olof Johansson
2011-02-22 5:55 ` Olof Johansson
[not found] ` <1298354117-19097-7-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-22 7:05 ` Colin Cross
2011-02-22 7:05 ` Colin Cross
2011-02-22 20:48 ` Russell King - ARM Linux
2011-02-22 20:48 ` Russell King - ARM Linux
[not found] ` <20110222204821.GE29559-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-02-22 21:05 ` Olof Johansson
2011-02-22 21:05 ` Olof Johansson
-- strict thread matches above, loose matches on Subject: below --
2011-02-21 19:06 [PATCH 0/6] Tegra board patches Olof Johansson
[not found] ` <1298315206-8887-1-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-21 19:06 ` [PATCH 4/6] ARM: tegra: harmony: register sdhci devices Olof Johansson
[not found] ` <1298315206-8887-5-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-22 2:52 ` Colin Cross
[not found] ` <AANLkTinimyZe0Z49=X1Jpuejjmr9=Ns8AJG2SscH0=kP-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-22 4:32 ` Olof Johansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D635EC4.2030102@compulab.co.il \
--to=mike-utxizqzc01rs1mouv/rt9w@public.gmane.org \
--cc=ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
--cc=konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.