Re: [PATCH/RESEND v4 1/2] spi_topcliff_pch: support new device ML7213 IOH

2011-06-08 Thread Tomoya MORINAGA
Hi Grant,

Why don't you give us your comment/opinion at all for our v4 patch ??
We have been long waiting since 27-April.

(2011/06/07 14:50), Tomoya MORINAGA wrote:
 ***Modify Grant's comments.
 - Delete unrelated whitespace
 - Prevent device driver from accessing platform data
 - Add __devinit and __devexit
 - Save pdev-dev to pd_dev-dev.parent
 - Have own suspend/resume processing in platform_driver.
 - Care returned value in pch_spi_init
 - Change unregister order
 
 Support ML7213 device of OKI SEMICONDUCTOR.
 ML7213 is companion chip of Intel Atom E6xx series for IVI(In-Vehicle 
 Infotainment).
 ML7213 is compatible for Intel EG20T PCH.
 
 Signed-off-by: Tomoya MORINAGAtomoya-li...@dsn.okisemi.com
 ---
   drivers/spi/Kconfig|5 +-
   drivers/spi/spi_topcliff_pch.c |  599 
 +---
   2 files changed, 317 insertions(+), 287 deletions(-)
 
-- 
tomoya
OKI SEMICONDUCTOR CO., LTD.

--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH/RESEND v4 1/2] spi_topcliff_pch: support new device ML7213 IOH

2011-06-08 Thread Grant Likely
On Tue, Jun 07, 2011 at 02:50:10PM +0900, Tomoya MORINAGA wrote:
 ***Modify Grant's comments.
- Delete unrelated whitespace
- Prevent device driver from accessing platform data
- Add __devinit and __devexit
- Save pdev-dev to pd_dev-dev.parent
- Have own suspend/resume processing in platform_driver.
- Care returned value in pch_spi_init
- Change unregister order
 
 Support ML7213 device of OKI SEMICONDUCTOR.
 ML7213 is companion chip of Intel Atom E6xx series for IVI(In-Vehicle 
 Infotainment).
 ML7213 is compatible for Intel EG20T PCH.
 
 Signed-off-by: Tomoya MORINAGA tomoya-li...@dsn.okisemi.com
 ---

Hi Tomoya,

comment below...

 -static int pch_spi_probe(struct pci_dev *pdev, const struct pci_device_id 
 *id)
 +static int __devinit pch_spi_pd_probe(struct platform_device *plat_dev)
  {
 -
 + int ret;
   struct spi_master *master;
 + struct pch_spi_board_data *board_dat = dev_get_platdata(plat_dev-dev);
 + struct pch_spi_data *data;
  
 - struct pch_spi_board_data *board_dat;
 - int retval;
 -
 - dev_dbg(pdev-dev, %s ENTRY\n, __func__);
 -
 - /* allocate memory for private data */
 - board_dat = kzalloc(sizeof(struct pch_spi_board_data), GFP_KERNEL);
 - if (board_dat == NULL) {
 - dev_err(pdev-dev,
 -  %s memory allocation for private data failed\n,
 - __func__);
 - retval = -ENOMEM;
 - goto err_kmalloc;
 - }
 -
 - dev_dbg(pdev-dev,
 - %s memory allocation for private data success\n, __func__);
 -
 - /* enable PCI device */
 - retval = pci_enable_device(pdev);
 - if (retval != 0) {
 - dev_err(pdev-dev, %s pci_enable_device FAILED\n, __func__);
 -
 - goto err_pci_en_device;
 + master = spi_alloc_master(board_dat-pdev-dev,
 +   sizeof(struct pch_spi_data));
 + if (!master) {
 + dev_err(plat_dev-dev, spi_alloc_master[%d] failed.\n,
 + plat_dev-id);
 + return -ENOMEM;
   }
  
 - dev_dbg(pdev-dev, %s pci_enable_device returned=%d\n,
 - __func__, retval);
 + data = spi_master_get_devdata(master);
 + data-master = master;
  
 - board_dat-pdev = pdev;
 + platform_set_drvdata(plat_dev, data);
  
 - /* alllocate memory for SPI master */
 - master = spi_alloc_master(pdev-dev, sizeof(struct pch_spi_data));
 - if (master == NULL) {
 - retval = -ENOMEM;
 - dev_err(pdev-dev, %s Fail.\n, __func__);
 - goto err_spi_alloc_master;
 + /* baseaddress + 0x20(offset) */
 + data-io_remap_addr = pci_iomap(board_dat-pdev, 1, 0) +
 +0x20 * plat_dev-id;
 + if (!data-io_remap_addr) {
 + dev_err(plat_dev-dev, %s pci_iomap failed\n, __func__);
 + ret = -ENOMEM;
 + goto err_pci_iomap;
   }
  
 - dev_dbg(pdev-dev,
 - %s spi_alloc_master returned non NULL\n, __func__);
 + dev_dbg(plat_dev-dev, [ch%d] remap_addr=%p\n,
 + plat_dev-id, data-io_remap_addr);
  
   /* initialize members of SPI master */
 - master-bus_num = -1;
 + master-bus_num = plat_dev-id;

This shouldn't be here.  The bus id should be dynamically allocated,
and using the plat_dev-id assumes that there are no other spi busses
in the system, which is a bad assumption.

I picked up the patch (it's about time I guess, I've left this out
alone for too long), but I've dropped this hunk.

You can post a followup patch if it broke anything.

g.


--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH/RESEND v4 1/2] spi_topcliff_pch: support new device ML7213 IOH

2011-06-08 Thread Tomoya MORINAGA
(2011/06/08 23:44), Grant Likely wrote:

 Sorry about that Tomoya.  I got completely overloaded at the end of
 April and all of May.  I ended up dropping a lot of patches on the
 floor because of it.  I'm not purposefully ignoring you!

I can understand you ware very busy last month.
Though I thought you tried to avoid me,
I was relieved to read this your mail.

I wanted to know the information at last month.

Thanks,

tomoya

--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH/RESEND v4 1/2] spi_topcliff_pch: support new device ML7213 IOH

2011-06-06 Thread Tomoya MORINAGA
Sorry for invalid patch From y

It seems My PC's clock is reset.

(2009/01/02 8:29), y wrote:
 From: Tomoya MORINAGAtomoya-li...@dsn.okisemi.com
 
 ***Modify Grant's comments.
 - Delete unrelated whitespace
 - Prevent device driver from accessing platform data
 - Add __devinit and __devexit
 - Save pdev-dev to pd_dev-dev.parent
 - Have own suspend/resume processing in platform_driver.
 - Care returned value in pch_spi_init
 - Change unregister order
 
 Support ML7213 device of OKI SEMICONDUCTOR.
 ML7213 is companion chip of Intel Atom E6xx series for IVI(In-Vehicle 
 Infotainment).
 ML7213 is compatible for Intel EG20T PCH.
 
 Signed-off-by: Tomoya MORINAGAtomoya-li...@dsn.okisemi.com
 ---
   drivers/spi/Kconfig|5 +-
   drivers/spi/spi_topcliff_pch.c |  599 
 +---
   2 files changed, 317 insertions(+), 287 deletions(-)
 
 diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
 index fc14b8d..ed6134b 100644
 --- a/drivers/spi/Kconfig
 +++ b/drivers/spi/Kconfig
 @@ -380,12 +380,15 @@ config SPI_TI_SSP
 module will be called ti-ssp-spi.
 
   config SPI_TOPCLIFF_PCH
 - tristate Topcliff PCH SPI Controller
 + tristate Intel EG20T PCH/OKI SEMICONDUCTOR ML7213 IOH SPI controller
   depends on PCI
   help
 SPI driver for the Topcliff PCH (Platform Controller Hub) SPI bus
 used in some x86 embedded processors.
 
 +   This driver also supports the ML7213, a companion chip for the
 +   Atom E6xx series and compatible with the Intel EG20T PCH.
 +
   config SPI_TXX9
   tristate Toshiba TXx9 SPI controller
   depends on GENERIC_GPIO  CPU_TX49XX
 diff --git a/drivers/spi/spi_topcliff_pch.c b/drivers/spi/spi_topcliff_pch.c
 index 79e48d4..88bd472 100644
 --- a/drivers/spi/spi_topcliff_pch.c
 +++ b/drivers/spi/spi_topcliff_pch.c
 @@ -26,6 +26,7 @@
   #includelinux/spi/spidev.h
   #includelinux/module.h
   #includelinux/device.h
 +#includelinux/platform_device.h
 
   /* Register offsets */
   #define PCH_SPCR0x00/* SPI control register */
 @@ -35,6 +36,7 @@
   #define PCH_SPDRR   0x10/* SPI read data register */
   #define PCH_SSNXCR  0x18/* SSN Expand Control Register */
   #define PCH_SRST0x1C/* SPI reset register */
 +#define PCH_SPI_ADDRESS_SIZE 0x20
 
   #define PCH_SPSR_TFD0x07C0
   #define PCH_SPSR_RFD0xF800
 @@ -75,7 +77,8 @@
   #define SPSR_FI_BIT (1  2)
   #define SPBRR_SIZE_BIT  (1  10)
 
 -#define PCH_ALL  
 (SPCR_TFIE_BIT|SPCR_RFIE_BIT|SPCR_FIE_BIT|SPCR_ORIE_BIT|SPCR_MDFIE_BIT)
 +#define PCH_ALL  
 (SPCR_TFIE_BIT|SPCR_RFIE_BIT|SPCR_FIE_BIT|\
 + SPCR_ORIE_BIT|SPCR_MDFIE_BIT)
 
   #define SPCR_RFIC_FIELD 20
   #define SPCR_TFIC_FIELD 16
 @@ -88,6 +91,16 @@
   #define PCH_CLOCK_HZ5000
   #define PCH_MAX_SPBR1023
 
 +/* Definition for ML7213 by OKI SEMICONDUCTOR */
 +#define PCI_VENDOR_ID_ROHM   0x10DB
 +#define PCI_DEVICE_ID_ML7213_SPI 0x802c
 +
 +/*
 + * Set the number of SPI instance max
 + * Intel EG20T PCH : 1ch
 + * OKI SEMICONDUCTOR ML7213 IOH :2ch
 +*/
 +#define PCH_SPI_MAX_DEV  2
 
   /**
* struct pch_spi_data - Holds the SPI channel specific details
 @@ -121,6 +134,9 @@
* @cur_trans:  The current transfer that this SPI 
 driver is
*  handling
* @board_dat:  Reference to the SPI device data 
 structure
 + * @plat_dev:platform_device structure
 + * @ch:  SPI channel number
 + * @irq_reg_sts: Status of IRQ registration
*/
   struct pch_spi_data {
   void __iomem *io_remap_addr;
 @@ -144,27 +160,33 @@ struct pch_spi_data {
   struct spi_message *current_msg;
   struct spi_transfer *cur_trans;
   struct pch_spi_board_data *board_dat;
 + struct platform_device  *plat_dev;
 + int ch;
 + u8 irq_reg_sts;
   };
 
   /**
* struct pch_spi_board_data - Holds the SPI device specific details
* @pdev:   Pointer to the PCI device
 - * @irq_reg_sts: Status of IRQ registration
 - * @pci_req_sts: Status of pci_request_regions
* @suspend_sts:Status of suspend
 - * @data:Pointer to SPI channel data structure
 + * @num: The number of SPI device instance
*/
   struct pch_spi_board_data {
   struct pci_dev *pdev;
 - u8 irq_reg_sts;
 - u8 pci_req_sts;
   u8 suspend_sts;
 - struct pch_spi_data *data;
 + int num;
 +};
 +
 +struct pch_pd_dev_save {
 + int num;
 + struct platform_device *pd_save[PCH_SPI_MAX_DEV];
 + struct pch_spi_board_data *board_dat;
   };
 
   static struct pci_device_id pch_spi_pcidev_id[] = {
 -