All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: Jeff Garzik <jgarzik@redhat.com>,
	linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 12/12] ahci: Add platform driver
Date: Tue, 02 Mar 2010 22:41:04 +0300	[thread overview]
Message-ID: <4B8D69D0.1050209@ru.mvista.com> (raw)
In-Reply-To: <20100302182947.GL3445@oksana.dev.rtsoft.ru>

Hello.

Anton Vorontsov wrote:

> This can be used for AHCI-compatible interfaces implemented inside
> a System-On-Chip solutions, or AHCI devices connected via localbus.
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
[...]
> diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
> new file mode 100644
> index 0000000..f3f96d6
> --- /dev/null
> +++ b/drivers/ata/ahci_platform.c
> @@ -0,0 +1,196 @@
> +/*
> + * AHCI SATA platform driver
> + *
> + * Copyright 2004-2005  Red Hat, Inc.
> + *   Jeff Garzik <jgarzik@pobox.com>
> + * Copyright 2010  MontaVista Software, LLC.
> + *   Anton Vorontsov <avorontsov@ru.mvista.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2, or (at your option)
> + * any later version.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/interrupt.h>
> +#include <linux/device.h>
> +#include <linux/libata.h>
> +#include <linux/platform_device.h>
> +#include "ahci.h"
> +#include "ahci_platform.h"
> +
> +static int __devinit ahci_probe(struct platform_device *pdev)
>   

  Does it make sense to make this driver hotplug capable?

> +{
> +	struct device *dev = &pdev->dev;
> +	struct ahci_platform_data *pdata = pdev->dev.platform_data;
> +	struct ata_port_info pi = {
> +		.flags		= AHCI_FLAG_COMMON,
> +		.pio_mask	= ATA_PIO4,
> +		.udma_mask	= ATA_UDMA6,
> +		.port_ops	= &ahci_ops,
> +	};
> +	const struct ata_port_info *ppi[] = { &pi, NULL };
> +	struct ahci_host_priv *hpriv;
> +	struct ata_host *host;
> +	struct resource *res;
> +	int n_ports;
> +	int i;
> +	int rc;
> +
> +	WARN_ON(ATA_MAX_QUEUE > AHCI_MAX_CMDS);
>   

   Hm...

> +	ahci_set_em_messages(hpriv, &pi);
> +
> +
>   

   Extra newline?

> +
> +
>   

  Another one?

> +		/* disabled/not-implemented port */
> +		if (!(hpriv->port_map & (1 << i)))
> +			ap->ops = &ata_dummy_port_ops;
> +	}
> +
> +	rc = ahci_reset_controller(host);
> +	if (rc)
> +		goto err0;
> +
> +	ahci_init_controller(host);
> +	ahci_print_info(host, "platform");
> +
> +	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>   

   Could also use platform_get_irq()...

> diff --git a/drivers/ata/ahci_platform.h b/drivers/ata/ahci_platform.h
> new file mode 100644
> index 0000000..f7dd576
> --- /dev/null
> +++ b/drivers/ata/ahci_platform.h
>   

   I doubt that it's good place for declaring the platform data which 
will be used by the platform code. This file should be somewhere in 
include/linux/, don't you think?

> @@ -0,0 +1,29 @@
> +/*
> + * AHCI SATA platform driver
> + *
> + * Copyright 2004-2005  Red Hat, Inc.
> + *   Jeff Garzik <jgarzik@pobox.com>
> + * Copyright 2010  MontaVista Software, LLC.
> + *   Anton Vorontsov <avorontsov@ru.mvista.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2, or (at your option)
> + * any later version.
> + */
> +
> +#ifndef _AHCI_PLATFORM_H
> +#define _AHCI_PLATFORM_H
> +
> +struct device;
> +struct ata_port_info;
> +
> +struct ahci_platform_data {
> +	int (*init)(struct device *dev);
> +	void (*exit)(struct device *dev);
> +	const struct ata_port_info *ata_port_info;
> +	unsigned int force_port_map;
> +	unsigned int mask_port_map;
> +};
> +
> +#endif /* _AHCI_PLATFORM_H */
>   

MBR, Sergei


  reply	other threads:[~2010-03-02 19:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-02 18:28 [PATCH RFC 0/12] ahci: Add support for non-PCI devices Anton Vorontsov
2010-03-02 18:29 ` [PATCH 01/12] ahci: Fix some sparse warnings Anton Vorontsov
2010-03-02 18:29 ` [PATCH 02/12] ahci: Get rid of host->iomap usage Anton Vorontsov
2010-03-02 18:29 ` [PATCH 03/12] ahci: Factor out PCI specifics from ahci_save_initial_config() Anton Vorontsov
2010-03-02 18:29 ` [PATCH 04/12] ahci: Get rid of pci_dev argument in ahci_save_initial_config() Anton Vorontsov
2010-03-02 18:29 ` [PATCH 05/12] ahci: Factor out PCI specifics from ahci_reset_controller() Anton Vorontsov
2010-03-02 18:29 ` [PATCH 06/12] ahci: Get rid of pci_dev argument in ahci_port_init() Anton Vorontsov
2010-03-02 18:29 ` [PATCH 07/12] ahci: Factor out PCI specifics from ahci_init_controller() Anton Vorontsov
2010-03-02 18:29 ` [PATCH 08/12] ahci: Factor out PCI specifics from ahci_print_info() Anton Vorontsov
2010-03-02 18:29 ` [PATCH 09/12] ahci: Introduce ahci_set_em_messages() Anton Vorontsov
2010-03-02 21:18   ` Sergei Shtylyov
2010-03-02 23:19     ` Jeff Garzik
2010-03-03 10:40       ` Sergei Shtylyov
2010-03-03 11:41         ` Jeff Garzik
2010-03-03 14:38           ` Greg Freemyer
2010-03-02 18:29 ` [PATCH 10/12] ahci: Move PCI code into ahci_pci.c Anton Vorontsov
2010-03-02 18:29 ` [PATCH 11/12] ahci: Export generic AHCI symbols Anton Vorontsov
2010-03-02 18:29 ` [PATCH 12/12] ahci: Add platform driver Anton Vorontsov
2010-03-02 19:41   ` Sergei Shtylyov [this message]
2010-03-03 13:14     ` Anton Vorontsov
2010-03-02 21:34 ` [PATCH RFC 0/12] ahci: Add support for non-PCI devices Jeff Garzik
2010-03-03 13:15   ` Anton Vorontsov
2010-03-03 13:40     ` Jeff Garzik

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=4B8D69D0.1050209@ru.mvista.com \
    --to=sshtylyov@mvista.com \
    --cc=avorontsov@ru.mvista.com \
    --cc=jgarzik@redhat.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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.