[PATCH] powerpc: export copy_page() on 32bit
Export copy_page() on 32bit powerpc; unionfs needs it. Unionfs already builds as a module on 64bit powerpc, so the export is placed within an existing CONFIG_PPC32 #ifdef. Signed-off-by: Joseph Fannin <[EMAIL PROTECTED]> --- I ran into this in the -mm tree; it's not new to 2.6.24-rc6-mm1. I haven't been able to find any evidence that copy_page() is exported with 64bit; maybe this is because copy_page there is a wrapper around the exported copy_4K_page() and gets optimized away, or maybe I just don't know where to look. If copy_page() is exported for 64bit somewhere, this might not be the right thing? diff -aurN -x .git linux-mm.orig/arch/powerpc/kernel/ppc_ksyms.c linux-mm.patched/arch/powerpc/kernel/ppc_ksyms.c --- linux-mm.orig/arch/powerpc/kernel/ppc_ksyms.c 2008-01-01 04:03:33.0 -0500 +++ linux-mm.patched/arch/powerpc/kernel/ppc_ksyms.c2008-01-01 04:15:33.0 -0500 @@ -59,6 +59,7 @@ extern int sys_sigreturn(struct pt_regs *regs); EXPORT_SYMBOL(clear_pages); +EXPORT_SYMBOL(copy_page); EXPORT_SYMBOL(ISA_DMA_THRESHOLD); EXPORT_SYMBOL(DMA_MODE_READ); EXPORT_SYMBOL(DMA_MODE_WRITE); -- Joseph Fannin [EMAIL PROTECTED] ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] ASoC drivers for the Freescale MPC8610 SoC
On 12/19/07, Timur Tabi <[EMAIL PROTECTED]> wrote: > + [EMAIL PROTECTED] { > + compatible = "fsl,ssi"; > + cell-index = <0>; > + reg = <16000 100>; > + interrupt-parent = <&mpic>; > + interrupts = <3e 2>; > + fsl,mode = "i2s-slave"; > + codec { > + compatible = "cirrus,cs4270"; > + /* MCLK source is a stand-alone oscillator */ > + bus-frequency = ; > + }; > + }; Does this need to be bus-frequency? It's always called MCLK in all of the literature. In my case the MCLK comes from a chip on the i2c bus that is programmable How would that be encoded?. -- Jon Smirl [EMAIL PROTECTED] ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] ASoC drivers for the Freescale MPC8610 SoC
On 1/1/08, Jon Smirl <[EMAIL PROTECTED]> wrote: > On 12/19/07, Timur Tabi <[EMAIL PROTECTED]> wrote: > > + [EMAIL PROTECTED] { > > + compatible = "fsl,ssi"; > > + cell-index = <0>; > > + reg = <16000 100>; > > + interrupt-parent = <&mpic>; > > + interrupts = <3e 2>; > > + fsl,mode = "i2s-slave"; > > + codec { > > + compatible = "cirrus,cs4270"; > > + /* MCLK source is a stand-alone oscillator > > */ > > + bus-frequency = ; > > + }; > > + }; > > Does this need to be bus-frequency? It's always called MCLK in all of > the literature. > > In my case the MCLK comes from a chip on the i2c bus that is > programmable How would that be encoded?. Looking at the cs4270 codec driver it is controlled by i2c (supports SPI too). What happened to the conversation about putting codecs on the controlling bus and then linking them to the data bus? If that's the case the cs4270 should be in the i2c bus node (missing currently) and then a link from the SSI bus would point to it. cs4270 is still an old style i2c driver which is going to get deprecated. It takes about thirty minutes to convert it to new style. If was new style it could pick up its i2c address from the device tree instead of searching for it. -- Jon Smirl [EMAIL PROTECTED] ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/2] [POWERPC] smp_call_function_map should be static
On Thu, 2007-12-27 at 22:08 -0600, Olof Johansson wrote: > smp_call_function_map should be static, and for consistency prepend it > with __ like other local helper functions in the same file. > > Signed-off-by: Olof Johansson <[EMAIL PROTECTED]> NAK. I want it exported to other arch code, I'll need it in some stuff that I haven't released yet, like some BookE SMP stuff. Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/2] [POWERPC] smp_call_function_map should be static
On Wed, Jan 02, 2008 at 07:28:33AM +1100, Benjamin Herrenschmidt wrote: > > On Thu, 2007-12-27 at 22:08 -0600, Olof Johansson wrote: > > smp_call_function_map should be static, and for consistency prepend it > > with __ like other local helper functions in the same file. > > > > Signed-off-by: Olof Johansson <[EMAIL PROTECTED]> > > NAK. I want it exported to other arch code, I'll need it in some stuff > that I haven't released yet, like some BookE SMP stuff. With the locking changes in 2/2, it will need a new exported function that does the locking around the call to __*. With that, it'd be easier to just merge this. I.e. __smp_call_function_map() will be the internal (lockless) version, and you'll end up adding a nonstatic smp_call_function_map() that does locking and calls the __* one. Is that OK with you? -Olof ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 1/2] [POWERPC] smp_call_function_map should be static
> With the locking changes in 2/2, it will need a new exported function > that does the locking around the call to __*. With that, it'd be easier > to just merge this. > > I.e. __smp_call_function_map() will be the internal (lockless) version, > and you'll end up adding a nonstatic smp_call_function_map() that does > locking and calls the __* one. > > Is that OK with you? Yup, it's fine. Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] [2.6.24] Add PPC nvram ioctls to compat_ioctl
On Monday 31 December 2007, Olof Johansson wrote: > Fix the following console warning when running 'nvsetenv', and makes > setting of new variables work again: > > ioctl32(nvsetenv:4022): Unknown cmd fd(3) cmd(20007043){t:'p';sz:0} > arg(0003) on /dev/nvram > > That's the IOC_NVRAM_SYNC call. > > > Signed-off-by: Olof Johansson <[EMAIL PROTECTED]> > > diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c > index e8b7c3a..7be6765 100644 > --- a/fs/compat_ioctl.c > +++ b/fs/compat_ioctl.c Please don't. I have this long-term plan of getting rid of fs/compat_ioctl.c, the better answer is to convert arch/powerpc/kernel/nvram_64.c and drivers/char/generic_nvram.c from the .ioctl file_operation to .unlocked_ioctl/.compat_ioctl. Arnd <>< ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] ASoC drivers for the Freescale MPC8610 SoC
On Tue, Jan 01, 2008 at 12:25:32PM -0500, Jon Smirl wrote: > On 12/19/07, Timur Tabi <[EMAIL PROTECTED]> wrote: > > + [EMAIL PROTECTED] { > > + compatible = "fsl,ssi"; > > + cell-index = <0>; > > + reg = <16000 100>; > > + interrupt-parent = <&mpic>; > > + interrupts = <3e 2>; > > + fsl,mode = "i2s-slave"; > > + codec { > > + compatible = "cirrus,cs4270"; > > + /* MCLK source is a stand-alone oscillator > > */ > > + bus-frequency = ; > > + }; > > + }; > > Does this need to be bus-frequency? It's always called MCLK in all of > the literature. > > In my case the MCLK comes from a chip on the i2c bus that is > programmable How would that be encoded?. Grah! If there's one obvious frequency for a node, it should always be "clock-frequency". This bus-frequency nonsense seems to be a disease that started as a secondary frequency in Freescale CPU nodes, and has escaped to all sorts of other places. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] [POWERPC] Update .gitignore files.
On Mon, Dec 31, 2007 at 05:14:53PM +0100, Jochen Friedrich wrote: > Update .gitignore as needed by dtc addition. > > Signed-off-by: Jochen Friedrich <[EMAIL PROTECTED]> Acked-by: David Gibson <[EMAIL PROTECTED]> -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] ASoC drivers for the Freescale MPC8610 SoC
On 12/19/07, Timur Tabi <[EMAIL PROTECTED]> wrote: > sound/soc/fsl/fsl_ssi.c | 614 +++ > sound/soc/fsl/fsl_ssi.h | 224 +++ I'm confused about this part. You built a driver for the mpc8610 ssi port. This port has a device tree entry. + [EMAIL PROTECTED] { + compatible = "fsl,ssi"; + cell-index = <0>; + reg = <16000 100>; + interrupt-parent = <&mpic>; + interrupts = <3e 2>; + fsl,mode = "i2s-slave"; + codec { + compatible = "cirrus,cs4270"; + /* MCLK source is a stand-alone oscillator */ + bus-frequency = ; + }; + }; But then you don't create an of_platform_driver for this device. Instead you create one for the fabric driver, struct of_platform_driver mpc8610_hpcd_of_driver, and directly link the SSI driver into it. +static struct of_device_id mpc8610_hpcd_match[] = { + { + .compatible = "fsl,ssi", + }, + {} +}; +MODULE_DEVICE_TABLE(of, mpc8610_hpcd_match); + +static struct of_platform_driver mpc8610_hpcd_of_driver = { + .owner = THIS_MODULE, + .name = "mpc8610_hpcd", + .match_table= mpc8610_hpcd_match, + .probe = mpc8610_hpcd_probe, + .remove = mpc8610_hpcd_remove, +}; static int mpc8610_hpcd_probe(struct of_device *ofdev, const struct of_device_id *match) { . machine_data->dai.cpu_dai = fsl_ssi_create_dai(&ssi_info); Isn't this two separate drivers that have been combined into one driver? Or does the fsl_ssi channel only work on the mpc8610_hpcd? This is the problem of knowing how to load the fabric driver that I was talking about in the other threads. A device that can occur on more than one chip ".compatible = "fsl,ssi"," is being used to pull in a platform specific fabric driver, "mpc8610_hpcd". You can use the kernel config system to select the right driver for ".compatible = "fsl,ssi"," that matches you hardware and compile it in. But that doesn't work in my environment. My generic channel is "fsl,i2s". I have four different systems booting off from a shared network drive. Each of these systems needs the common "fsl,i2s" driver but they all four need different fabric drivers. -- Jon Smirl [EMAIL PROTECTED] ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: Using C67x00 on PXA255 with ov511
On 1/1/08, LIU KAN <[EMAIL PROTECTED]> wrote: > Hello, Grant > > Thank you for the work on the patch of c67x00, I have use it > successfully on PXA255, but I still have some problem. > Now I can use c67x00 together with usb-disk in 2.6 kerenl at a > writing speed around 5MB/s. But when I use c67x00 to connect webcam, which > is drived by ov511, I get the mosaic like picture in attachment. And when I > use cy7c67300 provided by cypress in 2.4 kernel with ov511, it work fine. Is > this because the speed the c67x00 driver for iso_ transfers is too slow? or > any other reason? > How can I solve the problem? Most likely the scheduling algorithm is not quite right for the c67x00. I've had problems with that in the past myself. You can try playing around with the parameters in claim_frame_bw() in c67x00-sched.c. The web cam is probably using iso transfers so you should try to find out if all the requested ISO transfers are actually getting scheduled by the driver. Please let me know what you find out. This driver still needs a lot of tuning and your observations will help a lot. Cheers, g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. [EMAIL PROTECTED] (403) 399-0195 ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: Please pull powerpc.git merge branch
Hi all, > I'm still out of office and can't do a proper test on this in the > way I should have done on the original patch, but your assessment and > patch looks entirely correct. Just built this for =y and =m, all seems fine. Cheers, Jeremy ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Please pull powerpc.git merge branch
Linus, Please do git pull \ git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git merge to get a fix for a bug introduced in one of the two commits I asked you to pull last time. Thanks, Paul. arch/powerpc/platforms/cell/spufs/sched.c |9 - 1 files changed, 0 insertions(+), 9 deletions(-) commit a5a971129cc6155e26315fd28a450505ccc35fd8 Author: Paul Mackerras <[EMAIL PROTECTED]> Date: Wed Jan 2 15:56:30 2008 +1100 [POWERPC] Fix build failure on Cell when CONFIG_SPU_FS=y Commit aed3a8c9bb1a8623a618232087c5ff62718e3b9a introduced a definition of notify_spus_active in .../cell/spu_syscalls.c, and another definition under #ifndef MODULE in .../cell/spufs/sched.c. The latter is not necessary and causes the build to fail when CONFIG_SPU_FS=y, so this removes it. It also removes the export of do_notify_spus_active, which is unnecessary. Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]> Acked-by: Arnd Bergmann <[EMAIL PROTECTED]> Acked-by: Jeremy Kerr <[EMAIL PROTECTED]> ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH] [POWERPC] therm_pm72: suppress some compile warnings
We don't really care if any of these calls to device_create_file fails, so just issue warnings in that case. drivers/macintosh/therm_pm72.c: In function 'init_cpu_state': drivers/macintosh/therm_pm72.c:1185: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c:1186: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c:1187: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c:1188: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c:1189: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c:1191: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c:1192: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c:1193: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c:1194: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c:1195: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c: In function 'init_backside_state': drivers/macintosh/therm_pm72.c:1383: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c:1384: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c: In function 'init_drives_state': drivers/macintosh/therm_pm72.c:1503: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c:1504: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c: In function 'init_dimms_state': drivers/macintosh/therm_pm72.c:1625: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c: In function 'init_slots_state': drivers/macintosh/therm_pm72.c:1743: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result drivers/macintosh/therm_pm72.c:1744: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]> --- drivers/macintosh/therm_pm72.c | 55 +++ 1 files changed, 38 insertions(+), 17 deletions(-) diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index 6fadc9a..1e0a69a 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c @@ -1157,6 +1157,8 @@ static void do_monitor_cpu_rack(struct cpu_pid_state *state) */ static int init_cpu_state(struct cpu_pid_state *state, int index) { + int err; + state->index = index; state->first = 1; state->rpm = (cpu_pid_type == CPU_PID_TYPE_RACKMAC) ? 4000 : 1000; @@ -1182,18 +1184,21 @@ static int init_cpu_state(struct cpu_pid_state *state, int index) DBG("CPU %d Using %d power history entries\n", index, state->count_power); if (index == 0) { - device_create_file(&of_dev->dev, &dev_attr_cpu0_temperature); - device_create_file(&of_dev->dev, &dev_attr_cpu0_voltage); - device_create_file(&of_dev->dev, &dev_attr_cpu0_current); - device_create_file(&of_dev->dev, &dev_attr_cpu0_exhaust_fan_rpm); - device_create_file(&of_dev->dev, &dev_attr_cpu0_intake_fan_rpm); + err = device_create_file(&of_dev->dev, &dev_attr_cpu0_temperature); + err |= device_create_file(&of_dev->dev, &dev_attr_cpu0_voltage); + err |= device_create_file(&of_dev->dev, &dev_attr_cpu0_current); + err |= device_create_file(&of_dev->dev, &dev_attr_cpu0_exhaust_fan_rpm); + err |= device_create_file(&of_dev->dev, &dev_attr_cpu0_intake_fan_rpm); } else { - device_create_file(&of_dev->dev, &dev_attr_cpu1_temperature); - device_create_file(&of_dev->dev, &dev_attr_cpu1_voltage); - device_create_file(&of_dev->dev, &dev_attr_cpu1_current); - device_create_file(&of_dev->dev, &dev_attr_cpu1_exhaust_fan_rpm); - device_create_file(&of_dev->dev, &dev_attr_cpu1_intake_fan_rpm); + err = device_create_file(&of_dev->dev, &dev_attr_cpu1_temperature); + err |= device_create_file(&of_de
[PATCH v3 2/4] USB: add Cypress c67x00 OTG controller core driver
From: Grant Likely <[EMAIL PROTECTED]> This patch add the core driver for the c67x00 USB OTG controller. The core driver is responsible for the platform bus binding and creating either USB HCD or USB Gadget instances for each of the serial interface engines on the chip. This driver does not directly implement the HCD or gadget behaviours; it just controls access to the chip. Signed-off-by: Grant Likely <[EMAIL PROTECTED]> --- drivers/usb/c67x00/c67x00-drv.c | 278 +++ include/linux/usb/c67x00.h | 45 ++ 2 files changed, 323 insertions(+), 0 deletions(-) diff --git a/drivers/usb/c67x00/c67x00-drv.c b/drivers/usb/c67x00/c67x00-drv.c new file mode 100644 index 000..0f0720a --- /dev/null +++ b/drivers/usb/c67x00/c67x00-drv.c @@ -0,0 +1,278 @@ +/* + * c67x00-drv.c: Cypress C67X00 USB Common infrastructure + * + * Copyright (C) 2006-2007 Barco N.V. + *Derived from the Cypress cy7c67200/300 ezusb linux driver and + *based on multiple host controller drivers inside the linux kernel. + * + * 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 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA. + */ + +/* + * This file implements the common infrastructure for using the c67x00. + * It is both the link between the platform configuration and subdrivers and + * the link between the common hardware parts and the subdrivers (e.g. + * interrupt handling). + * + * The c67x00 has 2 SIE's (serial interface engine) wich can be configured + * to be host, device or OTG (with some limitations, E.G. only SIE1 can be OTG). + * + * Depending on the platform configuration, the SIE's are created (setup_sie) + * and the corresponding subdriver is initialized (c67x00_probe_sie). + */ + +#include +#include +#include +#include +#include + +#include "c67x00.h" + +static struct platform_driver c67x00_driver; + +static void +c67x00_setup_sie(struct c67x00_sie *sie, struct c67x00_device *dev, int sie_num) +{ + static unsigned int id = 0; + + /* Fill in needed attributes */ + sie->pdev = platform_device_register_simple("c67x00_sie", + id++, NULL, 0); + /* driver used in hub.c: hub_port_init */ + sie->pdev->dev.driver = &c67x00_driver.driver; + spin_lock_init(&sie->lock); + sie->dev = dev; + sie->sie_num = sie_num; + sie->mode = c67x00_sie_config(dev->pdata->sie_config, sie_num); +} + +static void c67x00_teardown_sie(struct c67x00_sie *sie) +{ + sie->pdev->dev.driver = NULL; + platform_device_unregister(sie->pdev); +} + +/* -- */ + +static void c67x00_probe_sie(struct c67x00_sie *sie) +{ + switch (c67x00_sie_config(sie->dev->pdata->sie_config, sie->sie_num)) { + case C67X00_SIE_HOST: + c67x00_hcd_probe(sie); + break; + + case C67X00_SIE_UNUSED: + dev_info(sie_dev(sie), +"Not using SIE %d as requested\n", sie->sie_num); + break; + + default: + dev_err(sie_dev(sie), + "Unsupported configuration: 0x%x for SIE %d\n", + c67x00_sie_config(sie->dev->pdata->sie_config, + sie->sie_num), sie->sie_num); + break; + } +} + +static void c67x00_remove_sie(struct c67x00_sie *sie) +{ + switch (c67x00_sie_config(sie->dev->pdata->sie_config, sie->sie_num)) { + case C67X00_SIE_HOST: + c67x00_hcd_remove(sie); + break; + + default: + break; + } +} + +/* -- */ + +static irqreturn_t c67x00_irq(int irq, void *__dev) +{ + struct c67x00_device *c67x00 = __dev; + struct c67x00_sie *sie; + u16 msg; + int i, count = 8; + + c67x00->int_status = c67x00_ll_hpi_status(c67x00); + if (!c67x00->int_status) + return IRQ_NONE; + + while (c67x00->int_status != 0 && (count-- >= 0)) { + c67x00_ll_irq(c67x00); + for (i = 0; i < C67X00_SIES; i++) { + sie = &c67x00->sie[i]; + msg = 0; + spin_lock(&sie->lock); +
[PATCH v3 1/4] USB: add Cypress c67x00 low level interface code
From: Grant Likely <[EMAIL PROTECTED]> This patch adds the low level support code for the Cypress c67x00 family of OTG controllers. The low level code is responsible for register access and implements the software protocol for communicating with the c67x00 device. Signed-off-by: Grant Likely <[EMAIL PROTECTED]> --- drivers/usb/c67x00/c67x00-ll-hpi.c | 516 drivers/usb/c67x00/c67x00.h| 242 + 2 files changed, 758 insertions(+), 0 deletions(-) diff --git a/drivers/usb/c67x00/c67x00-ll-hpi.c b/drivers/usb/c67x00/c67x00-ll-hpi.c new file mode 100644 index 000..d6a95d6 --- /dev/null +++ b/drivers/usb/c67x00/c67x00-ll-hpi.c @@ -0,0 +1,516 @@ +/* + * c67x00-ll-hpi.c: Cypress C67X00 USB Low level interface using HPI + * + * Copyright (C) 2006-2007 Barco N.V. + *Derived from the Cypress cy7c67200/300 ezusb linux driver and + *based on multiple host controller drivers inside the linux kernel. + * + * 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 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA. + */ + +#include +#include +#include "c67x00.h" + +/* -- */ +/* Interface definitions */ + +#define COMM_ACK 0x0FED +#define COMM_NAK 0xDEAD + +#define COMM_CTRL_REG_ADDR 0x01BC +#define COMM_CTRL_REG_DATA 0x01BE +#define COMM_CTRL_REG_LOGIC0x01C0 +#define COMM_WRITE_CTRL_REG0xCE03 +#define COMM_READ_CTRL_REG 0xCE02 + +#define COMM_RESET 0xFA50 +#define COMM_EXEC_INT 0xCE01 +#define COMM_INT_NUM 0x01C2 +/* Registers 0 to COMM_REGS-1 */ +#define COMM_R(x) (0x01C4 + 2 * (x)) + +#define HUSB_SIE_pCurrentTDPtr(x) ( (x) ? 0x01B2 : 0x01B0 ) +#define HUSB_SIE_pTDListDone_Sem(x)( (x) ? 0x01B8 : 0x01B6 ) +#define HUSB_pEOT 0x01B4 + +/* Software interrupts */ +/* 114, 115: */ +#define HUSB_SIE_INIT_INT(x) ( (x) ? 0x0073 : 0x0072 ) +#define HUSB_RESET_INT 0x0074 /* 116 */ + +#define SUSB_INIT_INT 0x0071 +/* - + * HPI implementation + * + * The c67x00 chip also support control via SPI or HSS serial + * interfaces. However, this driver assumes that register access can + * be performed from IRQ context. While this is a safe assuption with + * the HPI interface, it is not true for the serial interfaces. + */ + +/* HPI registers */ +#define HPI_DATA 0 +#define HPI_MAILBOX1 +#define HPI_ADDR 2 +#define HPI_STATUS 3 + +static inline u16 hpi_read_reg(struct c67x00_device *dev, int reg) +{ + return __raw_readw(dev->hpi.base + reg * dev->hpi.regstep); +} + +static inline void hpi_write_reg(struct c67x00_device *dev, int reg, u16 value) +{ + __raw_writew(value, dev->hpi.base + reg * dev->hpi.regstep); +} + +static inline u16 hpi_read_word_nolock(struct c67x00_device *dev, u16 reg) +{ + hpi_write_reg(dev, HPI_ADDR, reg); + return hpi_read_reg(dev, HPI_DATA); +} + +static inline u16 hpi_read_word(struct c67x00_device *dev, u16 reg) +{ + u16 value; + unsigned long flags; + + spin_lock_irqsave(&dev->hw_lock, flags); + value = hpi_read_word_nolock(dev, reg); + spin_unlock_irqrestore(&dev->hw_lock, flags); + + return value; +} + +static inline void hpi_write_word_nolock(struct c67x00_device *dev, u16 reg, +u16 value) +{ + hpi_write_reg(dev, HPI_ADDR, reg); + hpi_write_reg(dev, HPI_DATA, value); +} + +static inline void hpi_write_word(struct c67x00_device *dev, u16 reg, u16 value) +{ + unsigned long flags; + + spin_lock_irqsave(&dev->hw_lock, flags); + hpi_write_word_nolock(dev, reg, value); + spin_unlock_irqrestore(&dev->hw_lock, flags); +} + +/* + * Only data is little endian, addr has cpu endianess + */ +static inline void hpi_write_words_le16(struct c67x00_device *dev, u16 addr, + u16 * data, u16 count) +{ + unsigned long flags; + int i; + + spin_lock_irqsave(&dev->hw_lock, flags); + + hpi_write_reg(dev, HPI_ADDR, addr); + for (i = 0;
[PATCH v3 3/4] USB: add Cypress c67x00 OTG controller HCD driver
From: Grant Likely <[EMAIL PROTECTED]> This patch adds HDC support for the Cypress c67x00 family of devices. Signed-off-by: Grant Likely <[EMAIL PROTECTED]> --- drivers/usb/c67x00/c67x00-hcd.c | 391 drivers/usb/c67x00/c67x00-hcd.h | 137 drivers/usb/c67x00/c67x00-sched.c | 1203 + 3 files changed, 1731 insertions(+), 0 deletions(-) diff --git a/drivers/usb/c67x00/c67x00-hcd.c b/drivers/usb/c67x00/c67x00-hcd.c new file mode 100644 index 000..3d0b77e --- /dev/null +++ b/drivers/usb/c67x00/c67x00-hcd.c @@ -0,0 +1,391 @@ +/* + * c67x00-hcd.c: Cypress C67X00 USB Host Controller Driver + * + * Copyright (C) 2006-2007 Barco N.V. + *Derived from the Cypress cy7c67200/300 ezusb linux driver and + *based on multiple host controller drivers inside the linux kernel. + * + * 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 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA. + */ + +#include +#include +#include + +#include "c67x00.h" +#include "c67x00-hcd.h" + +/* -- + * Root Hub Support + */ + +static __u8 c67x00_hub_des[] = { + 0x09, /* __u8 bLength; */ + 0x29, /* __u8 bDescriptorType; Hub-descriptor */ + 0x02, /* __u8 bNbrPorts; */ + 0x00, /* __u16 wHubCharacteristics; */ + 0x00, /* (per-port OC, no power switching) */ + 0x32, /* __u8 bPwrOn2pwrGood; 2ms */ + 0x00, /* __u8 bHubContrCurrent; 0 mA */ + 0x00, /* __u8 DeviceRemovable; ** 7 Ports max ** */ + 0xff, /* __u8 PortPwrCtrlMask; ** 7 ports max ** */ +}; + +static void c67x00_hub_reset_host_port(struct c67x00_sie *sie, int port) +{ + struct c67x00_hcd *c67x00 = sie->private_data; + unsigned long flags; + + c67x00_ll_husb_reset(sie, port); + + spin_lock_irqsave(&c67x00->lock, flags); + c67x00_ll_husb_reset_port(sie, port); + spin_unlock_irqrestore(&c67x00->lock, flags); + + c67x00_ll_set_husb_eot(sie->dev, DEFAULT_EOT); +} + +static int c67x00_hub_status_data(struct usb_hcd *hcd, char *buf) +{ + struct c67x00_hcd *c67x00 = hcd_to_c67x00_hcd(hcd); + struct c67x00_sie *sie = c67x00->sie; + u16 status; + int i; + + *buf = 0; + status = c67x00_ll_husb_get_status(sie); + for (i = 0; i < C67X00_PORTS; i++) + if (status & PORT_CONNECT_CHANGE(i)) + *buf |= (1 << i); + + /* bit 0 denotes hub change, b1..n port change */ + *buf <<= 1; + + return !!*buf; +} + +static int c67x00_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, + u16 wIndex, char *buf, u16 wLength) +{ + struct c67x00_hcd *c67x00 = hcd_to_c67x00_hcd(hcd); + struct c67x00_sie *sie = c67x00->sie; + u16 status, usb_status; + int len = 0; + unsigned int port = wIndex-1; + u16 wPortChange, wPortStatus; + + switch (typeReq) { + + case GetHubStatus: + *(__le32 *) buf = cpu_to_le32(0); + len = 4;/* hub power */ + break; + case GetPortStatus: + if (wIndex > C67X00_PORTS) + return -EPIPE; + + status = c67x00_ll_husb_get_status(sie); + usb_status = c67x00_ll_get_usb_ctl(sie); + + wPortChange = 0; + if (status & PORT_CONNECT_CHANGE(port)) + wPortChange |= USB_PORT_STAT_C_CONNECTION; + + wPortStatus = USB_PORT_STAT_POWER; + if (!(status & PORT_SE0_STATUS(port))) + wPortStatus |= USB_PORT_STAT_CONNECTION; + if (usb_status & LOW_SPEED_PORT(port)) { + wPortStatus |= USB_PORT_STAT_LOW_SPEED; + c67x00->low_speed_ports |= (1 << port); + } else + c67x00->low_speed_ports &= ~(1 << port); + + if (usb_status & SOF_EOP_EN(port)) + wPortStatus |= USB_PORT_STAT_ENABLE; + + *(__le16 *) buf = cpu_to_le16(wPortStatus); + *(__le16 *) (buf + 2) = cpu_to_l
[PATCH v3 4/4] USB: add Cypress c67x00 OTG controller driver to Kconfig and Makefiles
From: Grant Likely <[EMAIL PROTECTED]> add c67x00 driver to build Signed-off-by: Grant Likely <[EMAIL PROTECTED]> --- drivers/usb/Makefile|2 ++ drivers/usb/c67x00/Makefile | 11 +++ drivers/usb/host/Kconfig| 12 3 files changed, 25 insertions(+), 0 deletions(-) diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index 516a640..a419c42 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile @@ -17,6 +17,8 @@ obj-$(CONFIG_USB_SL811_HCD) += host/ obj-$(CONFIG_USB_U132_HCD) += host/ obj-$(CONFIG_USB_R8A66597_HCD) += host/ +obj-$(CONFIG_USB_C67X00_HCD) += c67x00/ + obj-$(CONFIG_USB_ACM) += class/ obj-$(CONFIG_USB_PRINTER) += class/ diff --git a/drivers/usb/c67x00/Makefile b/drivers/usb/c67x00/Makefile new file mode 100644 index 000..7e6eb0b --- /dev/null +++ b/drivers/usb/c67x00/Makefile @@ -0,0 +1,11 @@ +# +# Makefile for Cypress C67X00 USB Controller +# + +ifeq ($(CONFIG_USB_DEBUG),y) + EXTRA_CFLAGS+= -DDEBUG +endif + +obj-$(CONFIG_USB_C67X00_HCD) += c67x00.o + +c67x00-objs := c67x00-drv.o c67x00-ll-hpi.o c67x00-hcd.o c67x00-sched.o diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 49a91c5..49521d1 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -261,3 +261,15 @@ config USB_R8A66597_HCD To compile this driver as a module, choose M here: the module will be called r8a66597-hcd. +config USB_C67X00_HCD + tristate "Cypress C67x00 HCD support" + depends on USB + help + The Cypress C67x00 (EZ-Host/EZ-OTG) chips are dual-role + host/peripheral/OTG USB controllers. + + Enable this option to support this chip in host controller mode. + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called c67x00. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev