mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Tomoya MORINAGA" <tomoya-linux@dsn.okisemi.com>
To: "'Milton Miller'" <miltonm@bga.com>,
	"'Grant Likely'" <grant.likely@secretlab.ca>
Cc: "'David Brownell'" <dbrownell@users.sourceforge.net>,
	<spi-devel-general@lists.sourceforge.net>,
	<linux-kernel@vger.kernel.org>, <yong.y.wang@intel.com>,
	<joel.clark@intel.com>, <kok.howg.ewe@intel.com>,
	"'Toshiharu Okada'" <toshiharu-linux@dsn.okisemi.com>,
	"'Wang, Qi'" <qi.wang@intel.com>
Subject: RE: [PATCH 1/3] spi_topcliff_pch: support new device ML7213
Date: Tue, 18 Jan 2011 21:36:48 +0900	[thread overview]
Message-ID: <EEE6F4C641AC4593B5CDF5139FCAD0F6@hacdom.okisemi.com> (raw)
In-Reply-To: <A780EBC01B4946F895EA47BE425B56F8@hacdom.okisemi.com>

Hi Grant,

Need your help!
Could you give us your answer ?

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.


> -----Original Message-----
> From: linux-kernel-owner@vger.kernel.org 
> [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of 
> Tomoya MORINAGA
> Sent: Wednesday, January 12, 2011 2:27 PM
> To: 'Milton Miller'; 'Grant Likely'
> Cc: 'David Brownell'; 
> spi-devel-general@lists.sourceforge.net; 
> linux-kernel@vger.kernel.org; yong.y.wang@intel.com; 
> joel.clark@intel.com; kok.howg.ewe@intel.com; 'Toshiharu 
> Okada'; 'Wang, Qi'
> Subject: RE: [PATCH 1/3] spi_topcliff_pch: support new device ML7213
> 
> On Tuesday, January 11, 2011 6:42 PM, Tomoya MORINAGA wrote:
> > However, I couldn't clear my question.
> 
> I show the current our coding image.
> Is the following agreeable with your saying ?
> 
> struct spi_platform_data {
> 	u16 num_chipselect;
> 	bool little_endian;
> 	u8 bits_per_word;
> 	struct spi_board_info *devices;
> 	u8 num_devices;
> };
> 
> static struct resource pch_spi_resources[] = {
> 	{
> 		.start 	= 0,
> 		.end	= 0,
> 		.flags	= IORESOURCE_MEM,
> 	},
> 	{
> 		.start	= 0,
> 		.end	= 0,
> 		.flags	= IORESOURCE_IRQ,
> 	},
> };
> 
> static struct spi_platform_data pch_spi_platform_data = {
> 	.num_chipselect = 2,
> 	.little_endian = true,
> };
> 
> static struct pch_spi_cell pch_spi_cfg0 = {
> 	.name = "pch_spi",
> 	.num_resources = ARRAY_SIZE(pch_spi_resources),
> 	.resources = pch_spi_resources,
> 	.platform_data = &pch_spi_platform_data,
> 	.data_size = sizeof(pch_spi_platform_data), };
> 
> static int pch_spi_get_resources(struct pch_spi_board_data 
> *board_dat, int num) {
> 	int retval;
> 	int i;
> 
> 	/* create workqueue */
> 	board_dat->data[num]->wk = 
> create_singlethread_workqueue(KBUILD_MODNAME);
> 
> 	pci_request_regions(board_dat->pdev, KBUILD_MODNAME); }
> 
> static int pch_spi_add_device(struct device *parent, int id,
> 			  struct pch_spi_cell *cell,
> 			  struct resource *mem_base, int irq_base,
> 			      struct pch_spi_board_data *board_dat) {
> 
> 	platform_device_alloc(cell->name, id + cell->id);
> 
> 	res = kzalloc(sizeof(*res) * cell->num_resources, GFP_KERNEL);
> 	if (!res)
> 		goto fail_device;
> 
> 	platform_set_drvdata(pdev, cell->driver_data);
> 
> 	if (cell->data_size) {
> 		platform_device_add_data(pdev,
> 					cell->platform_data, 
> cell->data_size);
> 	}
> 
> 	for (i = 0; i < cell->num_resources; i++) {
> 		if ((cell->resources[i].flags & IORESOURCE_MEM) 
> && mem_base) {
> 			res[i].parent = 
> 			res[i].start = 
> 			res[i].end = 
> 		} else if (cell->resources[i].flags & IORESOURCE_IRQ) {
> 			res[i].start = 
> 			res[i].end   = 
> 		} else {
> 
> 
> 	}
> 
> 	ret = platform_device_add_resources(pdev, res, 
> cell->num_resources);
> 	if (ret)
> 		goto fail_res;
> 
> 	ret = platform_device_add(pdev);
> 	if (ret)
> 		goto fail_res;
> 
> 	kfree(res);
> 
> 	spi_alloc_master( );
> 
> 	board_dat->data[num] = spi_master_get_devdata( );
> 
> 	pch_spi_get_resources( );
> 
> 	/* set master mode */
> 	pch_spi_set_master_mode( );
> 
> 	/* Register the controller with the SPI core. */
> 	spi_register_master( );
> 
> 	return 0;
> }
> 
> int pch_spi_add_devices(struct device *parent,
> 		    struct pch_spi_cell *cells, int n_devs,
> 		    struct resource *mem_base,
> 		    struct pch_spi_board_data *board_dat) {
> 	pci_iomap()
> 
> 	for (i < n_devs)
> 		pch_spi_add_device()
> 
> }
> 
> static int pch_spi_probe(struct pci_dev *pdev, const struct 
> pci_device_id *id) {
> 	board_dat = kzalloc(sizeof(struct pch_spi_board_data), 
> GFP_KERNEL);
> 	pci_enable_device()
> 	request_irq()
> 	pch_spi_add_devices(&pdev->dev, 
> 			&pch_spi_cfg0,
> 			2,
> 			&pdev->resource[0], board_dat);
> 
> }
> 
> static irqreturn_t pch_spi_handler(int irq, void *dev_id) {
> 
> 	for (i = 0; i < board_dat->num; i++) {
> 		data = board_dat->data[i];
> 		io_remap_addr = data->io_remap_addr;
> 		spsr = io_remap_addr + PCH_SPSR;
> 
> 		reg_spsr_val = ioread32(spsr);
> 
> 		/* Check if the interrupt is for SPI device */
> 		if (reg_spsr_val & (SPSR_FI_BIT | SPSR_RFI_BIT)) {
> 			pch_spi_handler_sub(data, reg_spsr_val, 
> io_remap_addr);
> 			ret = IRQ_HANDLED;
> 		}
> 
> 		dev_dbg(&board_dat->pdev->dev, "%s EXIT return 
> value=%d\n",
> 			__func__, ret);
> 	}
> 	return ret;
> }
> 
> Thanks,
> -----------------------------------------
> Tomoya MORINAGA
> OKI SEMICONDUCTOR CO., LTD.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-kernel" in the body of a message to 
> majordomo@vger.kernel.org More majordomo info at  
> http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


  reply	other threads:[~2011-01-18 12:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-27 11:23 Tomoya MORINAGA
2010-12-27 11:23 ` [PATCH 2/3] spi_topcliff_pch: change calling function order correctly in remove Tomoya MORINAGA
2010-12-27 11:23   ` [PATCH 3/3] spi_topcliff_pch: fix resource leak issue Tomoya MORINAGA
2010-12-29  6:51     ` Grant Likely
2010-12-29  6:51   ` [PATCH 2/3] spi_topcliff_pch: change calling function order correctly in remove Grant Likely
2010-12-29  6:49 ` [PATCH 1/3] spi_topcliff_pch: support new device ML7213 Grant Likely
2011-01-05  2:34   ` Tomoya MORINAGA
2011-01-05 16:38     ` Grant Likely
2011-01-07  6:40       ` Tomoya MORINAGA
2011-01-07  9:57         ` Milton Miller
     [not found]         ` <topcliff-split@mdm.bga.com>
2011-01-11  9:42           ` Tomoya MORINAGA
2011-01-12  5:27             ` Tomoya MORINAGA
2011-01-18 12:36               ` Tomoya MORINAGA [this message]
2011-01-19  6:25                 ` Grant Likely
2011-01-07  6:47       ` Tomoya MORINAGA

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=EEE6F4C641AC4593B5CDF5139FCAD0F6@hacdom.okisemi.com \
    --to=tomoya-linux@dsn.okisemi.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=grant.likely@secretlab.ca \
    --cc=joel.clark@intel.com \
    --cc=kok.howg.ewe@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miltonm@bga.com \
    --cc=qi.wang@intel.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    --cc=toshiharu-linux@dsn.okisemi.com \
    --cc=yong.y.wang@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®