Re: [PATCH 05/11] ppc/mpc8xx: remove ppc_ide_md hooks
On Thu, 14 Feb 2008 01:36:56 +0100 Bartlomiej Zolnierkiewicz wrote: > * Initialize IDE ports in mpc8xx_ide_probe(). > > * Remove m8xx_ide_init() and ppc_ide_md hooks - no need for them > (IDE mpc8xx host driver takes care of all this setup). > > * Remove needless 'if (irq)' and 'if (data_port >= MAX_HWIFS)' checks > from m8xx_ide_init_hwif_ports(). > > * Remove 'ctrl_port' and 'irq' arguments from > m8xx_ide_init_hwif_ports(). > > * Rename m8xx_ide_init_hwif_ports() to m8xx_ide_init_ports(). > > * Add __init tag to m8xx_ide_init_ports(). > > This patch fixes hwif->irq always being overriden to 0 (== > auto-probe, is this even working on PPC?) because of > ide_init_default_irq() call in ide.c. > > There should be no other functional changes. > > Cc: Benjamin Herrenschmidt <[EMAIL PROTECTED]> > Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]> Acked-by: Vitaly Bordug <[EMAIL PROTECTED]> > --- > arch/ppc/syslib/m8xx_setup.c |6 --- > drivers/ide/ppc/mpc8xx.c | 86 > +++ 2 files changed, 22 > insertions(+), 70 deletions(-) > > Index: b/arch/ppc/syslib/m8xx_setup.c > === > --- a/arch/ppc/syslib/m8xx_setup.c > +++ b/arch/ppc/syslib/m8xx_setup.c > @@ -87,8 +87,6 @@ void m8xx_calibrate_decr(void); > > unsigned char __res[sizeof(bd_t)]; > > -extern void m8xx_ide_init(void); > - > extern unsigned long find_available_memory(void); > extern void m8xx_cpm_reset(void); > extern void m8xx_wdt_handler_install(bd_t *bp); > @@ -474,8 +472,4 @@ platform_init(unsigned long r3, unsigned > > ppc_md.find_end_of_memory = m8xx_find_end_of_memory; > ppc_md.setup_io_mappings= m8xx_map_io; > - > -#if defined(CONFIG_BLK_DEV_MPC8xx_IDE) > - m8xx_ide_init(); > -#endif > } > Index: b/drivers/ide/ppc/mpc8xx.c > === > --- a/drivers/ide/ppc/mpc8xx.c > +++ b/drivers/ide/ppc/mpc8xx.c > @@ -99,32 +99,6 @@ static int _slot_ = -1;/* > will be rea /* Make clock cycles and always round up */ > #define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/100) + 999U ) / > 1000U ) > - > - > -/* > - * IDE stuff. > - */ > -static int > -m8xx_ide_default_irq(unsigned long base) > -{ > -#ifdef CONFIG_BLK_DEV_MPC8xx_IDE > - if (base >= MAX_HWIFS) > - return 0; > - > - printk("[%d] m8xx_ide_default_irq > %d\n",__LINE__,ioport_dsc[base].irq); > - > - return (ioport_dsc[base].irq); > -#else > -return 9; > -#endif > -} > - > -static unsigned long > -m8xx_ide_default_io_base(int index) > -{ > -return index; > -} > - > #define M8XX_PCMCIA_CD2(slot) (0x1000 >> (slot << 4)) > #define M8XX_PCMCIA_CD1(slot) (0x0800 >> (slot << 4)) > > @@ -149,12 +123,11 @@ static int pcmcia_schlvl = PCMCIA_SCHLVL > */ > > /* > - * m8xx_ide_init_hwif_ports for a direct IDE interface _using_ > + * m8xx_ide_init_ports() for a direct IDE interface _using_ > + * MPC8xx's internal PCMCIA interface > */ > #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) > -static void > -m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, > - unsigned long ctrl_port, int *irq) > +static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long > data_port) { > unsigned long *p = hw->io_ports; > int i; > @@ -173,8 +146,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, > unsigned long base; > > *p = 0; > - if (irq) > - *irq = 0; > > pcmp = (pcmconf8xx_t *)(&(((immap_t > *)IMAP_ADDR)->im_pcmcia)); > @@ -248,9 +219,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, > } > } > > - if (data_port >= MAX_HWIFS) > - return; > - > if (_slot_ == -1) { > printk ("PCMCIA slot has not been defined! Using A > as default\n"); _slot_ = 0; > @@ -292,11 +260,13 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, > *p++ = base + ioport_dsc[data_port].reg_off[i]; > } > > - if (irq) { > + hw->irq = ioport_dsc[data_port].irq; > + hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; > + > #ifdef CONFIG_IDE_8xx_PCCARD > + { > unsigned int reg; > > - *irq = ioport_dsc[data_port].irq; > if (_slot_) > pgcrx = &((immap
Re: [PATCH POWERPC] i2c: adds support for i2c bus on Frescale CPM1/CPM2 controllers
On Fri, 21 Dec 2007 20:36:28 +0100 Jochen Friedrich wrote: > Using the port of 2.4 code from Vitaly Bordug > <[EMAIL PROTECTED]> and the actual algorithm used by the i2c > driver of the DBox code on cvs.tuxboc.org from Tmbinc, Gillem > ([EMAIL PROTECTED]). Renamed i2c-rpx.c and i2c-algo-8xx.c to i2c-cpm.c and > converted the driver to an of_platform_driver. > I had an attempt a while ago to do this but haven't had enough time to get it completed, so I am glad to see it finally picked up. There was some sort of discussion that time, you seem to have some of those points addressed but something not, please check: http://lkml.org/lkml/2007/5/8/45 (for instance, cpm_i2c_shutdown() and i2c_cpm_del_bus() are void because they cant' fail) Also, why this was directed to Scott? This is lm-sensors stuff and is Jean Delvare <[EMAIL PROTECTED]> material... -- Sincerely, Vitaly -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
On Sat, 01 Dec 2007 14:48:54 +0100 Jochen Friedrich wrote: > Hi Vitaly, > > > With that patch fixed.c now fully emulates MDIO bus, thus no need > > to duplicate PHY layer functionality. That, in turn, drastically > > simplifies the code, and drops down line count. > > > > As an additional bonus, now there is no need to register MDIO bus > > for each PHY, all emulated PHYs placed on the platform fixed MDIO > > bus. There is also no more need to pre-allocate PHYs via .config > > option, this is all now handled dynamically. > > > > p.s. Don't even try to understand patch content! Better: apply patch > > and look into resulting drivers/net/phy/fixed.c. > > > If i understand your code correctly, you seem to rely on the fact > that fixed_phy_add() is called before the fixed MDIO bus is scanned > for devices. How is this supposed to work for modules or for the > PPC_CPM_NEW_BINDING mode where the device tree is no longer scanned > during fs_soc initialization but during device initialization? > Well, this is kind of known issue - to work it around for now, place PHY lib after fs_enet in Makefile. This way it works for me for _NEW_BINDING and mpc866ads. > I tried to add fixed-phy support to fs_enet, but the fixed phy is not > found this way. > The point is I have the code and it works now(for fs_enet etc.), but I need to find the way for the fixed phy pinning to work in either order with phylib. If you have ideas, please go ahead :) > --- a/drivers/net/fs_enet/fs_enet-main.c > +++ b/drivers/net/fs_enet/fs_enet-main.c > @@ -36,6 +36,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -1174,8 +1175,24 @@ static int __devinit find_phy(struct > device_node *np, struct device_node *phynode, *mdionode; > struct resource res; > int ret = 0, len; > + const u32 *data; > + struct fixed_phy_status status = {}; > + > + data = of_get_property(np, "fixed-link", NULL); > + if (data) { > + status.link = 1; > + status.duplex = data[1]; > + status.speed = data[2]; > + > + ret = fixed_phy_add(PHY_POLL, data[0], &status); > + if (ret) > + return ret; > + > + snprintf(fpi->bus_id, 16, PHY_ID_FMT, 0, *data); > + return 0; > + } > > - const u32 *data = of_get_property(np, "phy-handle", &len); > + data = of_get_property(np, "phy-handle", &len); > if (!data || len != 4) > return -EINVAL; > > Thanks, > Jochen -- Sincerely, Vitaly -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
On Sat, 01 Dec 2007 16:59:52 -0500 Jeff Garzik wrote: > Vitaly Bordug wrote: > > With that patch fixed.c now fully emulates MDIO bus, thus no need > > to duplicate PHY layer functionality. That, in turn, drastically > > simplifies the code, and drops down line count. > > > > As an additional bonus, now there is no need to register MDIO bus > > for each PHY, all emulated PHYs placed on the platform fixed MDIO > > bus. There is also no more need to pre-allocate PHYs via .config > > option, this is all now handled dynamically. > > > > p.s. Don't even try to understand patch content! Better: apply patch > > and look into resulting drivers/net/phy/fixed.c. > > > > Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]> > > Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> > > what's the context of this patchset? 2.6.25? > Fine with it. > it's late for 2.6.24-rc, IMO. > > Do I have the latest version (sent Nov 26 @ 9:29am)? yes, that's it. -- Sincerely, Vitaly -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
On Sun, 2 Dec 2007 00:34:03 +0300 Anton Vorontsov wrote: > > If i understand your code correctly, you seem to rely on the fact > > that fixed_phy_add() is called before the fixed MDIO bus is scanned > > for devices. > > Yes, indeed. The other name of "fixed phys" are "platform phys" > or "platform MDIO bus" on which virtual PHYs are placed. > > That is, these phys supposed to be created by the platform setup > code (arch/). The rationale here is: we do hardware emulation, thus > to make drivers actually see that "hardware", we have to create it > early. well that was the intention but... The point is - as device is emulated, (nearly) everything is doable, and the only tradeoff to consider, is how far will we go with that emulation. IOW, PHYlib could be tricked to "do the right thing", and I thought about adding module flexibility... But thinking more about it, it seems that BSP-code-phy-creation just sucks less and is clear enough yet flexible. -- Sincerely, Vitaly -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
On Tue, 04 Dec 2007 15:07:49 -0500 Jeff Garzik wrote: > Vitaly Bordug wrote: > > With that patch fixed.c now fully emulates MDIO bus, thus no need > > to duplicate PHY layer functionality. That, in turn, drastically > > simplifies the code, and drops down line count. > > > > As an additional bonus, now there is no need to register MDIO bus > > for each PHY, all emulated PHYs placed on the platform fixed MDIO > > bus. There is also no more need to pre-allocate PHYs via .config > > option, this is all now handled dynamically. > > > > p.s. Don't even try to understand patch content! Better: apply patch > > and look into resulting drivers/net/phy/fixed.c. > > > > Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]> > > Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> > > ACK, I presume this will go via the ppc tree? > Yes, I'll add your ack in next respin and will ask Paul to consider it, if you don't mind. -- Sincerely, Vitaly -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
With that patch fixed.c now fully emulates MDIO bus, thus no need to duplicate PHY layer functionality. That, in turn, drastically simplifies the code, and drops down line count. As an additional bonus, now there is no need to register MDIO bus for each PHY, all emulated PHYs placed on the platform fixed MDIO bus. There is also no more need to pre-allocate PHYs via .config option, this is all now handled dynamically. p.s. Don't even try to understand patch content! Better: apply patch and look into resulting drivers/net/phy/fixed.c. Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]> Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/net/phy/Kconfig | 32 +-- drivers/net/phy/fixed.c | 427 - include/linux/phy_fixed.h | 49 ++--- 3 files changed, 176 insertions(+), 332 deletions(-) diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 54b2ba9..a05c614 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -61,34 +61,12 @@ config ICPLUS_PHY Currently supports the IP175C PHY. config FIXED_PHY - tristate "Drivers for PHY emulation on fixed speed/link" + tristate "Drivers for MDIO Bus/PHY emulation on fixed speed/link" ---help--- - Adds the driver to PHY layer to cover the boards that do not have any PHY bound, - but with the ability to manipulate the speed/link in software. The relevant MII - speed/duplex parameters could be effectively handled in a user-specified function. - Currently tested with mpc866ads. - -config FIXED_MII_10_FDX - bool "Emulation for 10M Fdx fixed PHY behavior" - depends on FIXED_PHY - -config FIXED_MII_100_FDX - bool "Emulation for 100M Fdx fixed PHY behavior" - depends on FIXED_PHY - -config FIXED_MII_1000_FDX - bool "Emulation for 1000M Fdx fixed PHY behavior" - depends on FIXED_PHY - -config FIXED_MII_AMNT -int "Number of emulated PHYs to allocate " -depends on FIXED_PHY -default "1" ----help--- -Sometimes it is required to have several independent emulated -PHYs on the bus (in case of multi-eth but phy-less HW for instance). -This control will have specified number allocated for each fixed -PHY type enabled. + Adds the platform "fixed" MDIO Bus to cover the boards that use + PHYs that are not connected to the real MDIO bus. + + Currently tested with mpc866ads and mpc8349e-mitx. config MDIO_BITBANG tristate "Support for bitbanged MDIO buses" diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 5619182..31719b3 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -1,362 +1,237 @@ /* - * drivers/net/phy/fixed.c + * Fixed MDIO bus (MDIO bus emulation with fixed PHYs) * - * Driver for fixed PHYs, when transceiver is able to operate in one fixed mode. + * Author: Vitaly Bordug <[EMAIL PROTECTED]> + * Anton Vorontsov <[EMAIL PROTECTED]> * - * Author: Vitaly Bordug - * - * Copyright (c) 2006 MontaVista Software, Inc. + * Copyright (c) 2006-2007 MontaVista Software, Inc. * * 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. - * */ + #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include +#include #include -#include #include #include -#include -#include -#include - -/* we need to track the allocated pointers in order to free them on exit */ -static struct fixed_info *fixed_phy_ptrs[CONFIG_FIXED_MII_AMNT*MAX_PHY_AMNT]; - -/*- - * If something weird is required to be done with link/speed, - * network driver is able to assign a function to implement this. - * May be useful for PHY's that need to be software-driven. - *-*/ -int fixed_mdio_set_link_update(struct phy_device *phydev, - int (*link_update) (struct net_device *, - struct fixed_phy_status *)) -{ - struct fixed_info *fixed; - - if (link_update == NULL) - return -EINVAL; - - if (phydev) { - if (phydev->bus) { - fixed = phydev->bus->priv; - fixed->link_update = link_update; - return 0; - } - } - return -EINVAL; -} +#define MII_REGS_NUM 29 -EXPORT_SYMBOL(fixed_mdio_
[PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar for fixed-link property
fixed-link says: register new "Fixed/emulated PHY", i.e. PHY that not connected to the real MDIO bus. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]> --- Documentation/powerpc/booting-without-of.txt |3 + arch/powerpc/sysdev/fsl_soc.c| 56 ++ 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt index e9a3cb1..cf25070 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt @@ -1254,6 +1254,9 @@ platforms are moved over to use the flattened-device-tree model. services interrupts for this device. - phy-handle : The phandle for the PHY connected to this ethernet controller. +- fixed-link : where a is emulated phy id - choose any, + but unique to the all specified fixed-links, b is duplex - 0 half, + 1 full, c is link speed - d#10/d#100/d#1000. Recommended properties: diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 3ace747..e06a5c9 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -193,7 +194,6 @@ static const char *gfar_tx_intr = "tx"; static const char *gfar_rx_intr = "rx"; static const char *gfar_err_intr = "error"; - static int __init gfar_of_init(void) { struct device_node *np; @@ -277,29 +277,51 @@ static int __init gfar_of_init(void) gfar_data.interface = PHY_INTERFACE_MODE_MII; ph = of_get_property(np, "phy-handle", NULL); - phy = of_find_node_by_phandle(*ph); + if (ph == NULL) { + struct fixed_phy_status status = {}; + u32 *fixed_link; - if (phy == NULL) { - ret = -ENODEV; - goto unreg; - } + fixed_link = (u32*)of_get_property(np, "fixed-link",NULL); + if (!fixed_link) { + ret = -ENODEV; + goto unreg; + } - mdio = of_get_parent(phy); + status.link = 1; + status.duplex = fixed_link[1]; + status.speed = fixed_link[2]; + + ret = fixed_phy_add(PHY_POLL, fixed_link[0], &status); + if (ret) + goto unreg; + + gfar_data.bus_id = 0; + gfar_data.phy_id = fixed_link[0]; + } else { + phy = of_find_node_by_phandle(*ph); + + if (phy == NULL) { + ret = -ENODEV; + goto unreg; + } + + mdio = of_get_parent(phy); + + id = of_get_property(phy, "reg", NULL); + ret = of_address_to_resource(mdio, 0, &res); + if (ret) { + of_node_put(phy); + of_node_put(mdio); + goto unreg; + } + + gfar_data.phy_id = *id; + gfar_data.bus_id = res.start; - id = of_get_property(phy, "reg", NULL); - ret = of_address_to_resource(mdio, 0, &res); - if (ret) { of_node_put(phy); of_node_put(mdio); - goto unreg; } - gfar_data.phy_id = *id; - gfar_data.bus_id = res.start; - - of_node_put(phy); - of_node_put(mdio); - ret = platform_device_add_data(gfar_dev, &gfar_data, sizeof(struct - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] [POWERPC] MPC8349E-mITX: Vitesse 7385 PHY is not connected to the MDIO bus
...thus use fixed-link to register proper "Fixed PHY" Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]> Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc8349emitx.dts | 11 ++- 1 files changed, 2 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts index 5072f6d..e2d00f1 100644 --- a/arch/powerpc/boot/dts/mpc8349emitx.dts +++ b/arch/powerpc/boot/dts/mpc8349emitx.dts @@ -115,14 +115,6 @@ reg = <1c>; device_type = "ethernet-phy"; }; - - /* Vitesse 7385 */ - phy1f: [EMAIL PROTECTED] { - interrupt-parent = < &ipic >; - interrupts = <12 8>; - reg = <1f>; - device_type = "ethernet-phy"; - }; }; [EMAIL PROTECTED] { @@ -159,7 +151,8 @@ local-mac-address = [ 00 00 00 00 00 00 ]; interrupts = <23 8 24 8 25 8>; interrupt-parent = < &ipic >; - phy-handle = < &phy1f >; + /* Vitesse 7385 isn't on the MDIO bus */ + fixed-link = <1 1 d#1000>; linux,network-index = <1>; }; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] arch/ppc/: Spelling fixes
On Mon, 17 Dec 2007 11:30:14 -0800 Joe Perches wrote: > > Signed-off-by: Joe Perches <[EMAIL PROTECTED]> > --- > arch/ppc/syslib/ppc8xx_pic.c |2 +- > arch/ppc/syslib/ppc_sys.c|2 +- I'm not really sure we should still care about typos in arch/ppc.. -- Sincerely, Vitaly -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH/RFC] [POWERPC] Add fixed-phy support for fs_enet
On Mon, 17 Dec 2007 18:20:14 -0500 Jeff Garzik wrote: > Jochen Friedrich wrote: > > This patch adds support to use the fixed-link property > > of an ethernet node to fs_enet for the > > CONFIG_PPC_CPM_NEW_BINDING case. > > > > Signed-off-by: Jochen Friedrich <[EMAIL PROTECTED]> Acked-by: Vitaly Bordug <[EMAIL PROTECTED]> Jochen, will you resend the patch with all acks to paulus? I'll do that if not. -- Sincerely, Vitaly -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [updated] PHY fixed driver: rework release path and update phy_id notation
On Thu, 19 Jul 2007 23:23:37 -0700 Andrew Morton wrote: > On Thu, 19 Jul 2007 03:38:04 +0400 Vitaly Bordug > <[EMAIL PROTECTED]> wrote: > > > > > device_bind_driver() error code returning has been fixed. > > release() function has been written, so that to free resources > > in correct way; the release path is now clean. > > > > Before the rework, it used to cause > > Device '[EMAIL PROTECTED]:1' does not have a release() function, it is > > broken and must be fixed. > > BUG: at drivers/base/core.c:104 device_release() > > > > Call Trace: > > [] kobject_cleanup+0x53/0x7e > > [] kobject_release+0x0/0x9 > > [] kref_put+0x74/0x81 > > [] fixed_mdio_register_device+0x230/0x265 > > [] fixed_init+0x1f/0x35 > > [] init+0x147/0x2fb > > [] schedule_tail+0x36/0x92 > > [] child_rip+0xa/0x12 > > [] acpi_ds_init_one_object+0x0/0x83 > > [] init+0x0/0x2fb > > [] child_rip+0x0/0x12 > > > > > > Also changed the notation of the fixed phy definition on > > mdio bus to the form of + to make it able to be used > > by gianfar and ucc_geth that define phy_id strictly as "%d:%d" and > > cleaned up the whitespace issues. > > > > Confused. Does the above refer to the difference between this patch > and the previous version, or does it just describe this patch? > Hopefully the latter, because the former isn't interesting, long-term. > Latter. IOW, that does mean, that mdio bus registered by this driver, now uses same naming conventioun that other PHYLIB things use. Hereby it will make it able to be used in NIC drivers other than fs_enet (and gianfar and ucc_geth are now points of interest). > If is _is_ a full standalone description of this patch then it's a > bit hard to follow ;) > Hmm -so what are my options - change the description and resubmit? > > +config FIXED_MII_1000_FDX > > + bool "Emulation for 1000M Fdx fixed PHY behavior" > > + depends on FIXED_PHY > > + > > +config FIXED_MII_AMNT > > +int "Number of emulated PHYs to allocate " > > +depends on FIXED_PHY > > +default "1" > > +---help--- > > +Sometimes it is required to have several independent > > emulated > > +PHYs on the bus (in case of multi-eth but phy-less HW for > > instance). > > +This control will have specified number allocated for each > > fixed > > +PHY type enabled. > > Shouldn't these be runtime options (ie: module parameters)? > I thought about it but this thing is more like the one that will never tend/required to change while\ configured.. Will add if you see it appropriate though. > > > > ... > > > > + * Private information hoder for mii_bus > > tpyo. ok -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] [IDE] Platform IDE driver (was: MMIO IDE driver)
This is now very similar to pata_platform.c, they both use same platform data structure and same resources. To achieve that, byte_lanes_swapping platform data variable and platform specified iops removed from that driver. It's fine, since those were never used anyway. pata_platform and ide_platform are carrying same driver names, to easily switch between these drivers, without need to touch platform code. Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]> Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/ide/Kconfig |8 ++ drivers/ide/legacy/Makefile |2 drivers/ide/legacy/ide_platform.c | 181 + 3 files changed, 191 insertions(+), 0 deletions(-) diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index b1a9b81..b5a44da 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -308,6 +308,14 @@ config IDE_GENERIC help If unsure, say Y. +config BLK_DEV_PLATFORM + tristate "Platform driver for IDE interfaces" + help + This is the platform IDE driver, used mostly for Memory Mapped + IDE devices, like Compact Flashes running in True IDE mode. + + If unsure, say N. + config BLK_DEV_CMD640 bool "CMD640 chipset bugfix/support" depends on X86 diff --git a/drivers/ide/legacy/Makefile b/drivers/ide/legacy/Makefile index c797106..4098223 100644 --- a/drivers/ide/legacy/Makefile +++ b/drivers/ide/legacy/Makefile @@ -7,6 +7,8 @@ obj-$(CONFIG_BLK_DEV_UMC8672) += umc8672.o obj-$(CONFIG_BLK_DEV_IDECS)+= ide-cs.o +obj-$(CONFIG_BLK_DEV_PLATFORM) += ide_platform.o + # Last of all obj-$(CONFIG_BLK_DEV_HD) += hd.o diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c new file mode 100644 index 000..0b3f5b5 --- /dev/null +++ b/drivers/ide/legacy/ide_platform.c @@ -0,0 +1,181 @@ +/* + * Platform IDE driver + * + * Copyright (C) 2007 MontaVista Software + * + * Maintainer: Kumar Gala <[EMAIL PROTECTED]> + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static struct { + void __iomem *plat_ide_mapbase; + void __iomem *plat_ide_alt_mapbase; + ide_hwif_t *hwif; + int index; +} hwif_prop; + +static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base, + void __iomem *ctrl, struct pata_platform_info *pdata, int irq, + int mmio) +{ + unsigned long port = (unsigned long)base; + ide_hwif_t *hwif; + int index, i; + + for (index = 0; index < MAX_HWIFS; ++index) { + hwif = ide_hwifs + index; + if (hwif->io_ports[IDE_DATA_OFFSET] == port) + goto found; + } + + for (index = 0; index < MAX_HWIFS; ++index) { + hwif = ide_hwifs + index; + if (hwif->io_ports[IDE_DATA_OFFSET] == 0) + goto found; + } + + return NULL; + +found: + + hwif->hw.io_ports[IDE_DATA_OFFSET] = port; + + port += (1 << pdata->ioport_shift); + for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET; +i++, port += (1 << pdata->ioport_shift)) + hwif->hw.io_ports[i] = port; + + hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; + + memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); + hwif->hw.irq = hwif->irq = irq; + + hwif->hw.dma = NO_DMA; + hwif->hw.chipset = ide_generic; + + if (mmio) { + hwif->mmio = 1; + default_hwif_mmiops(hwif); + } + + hwif_prop.hwif = hwif; + hwif_prop.index = index; + + return hwif; +} + +static int __devinit plat_ide_probe(struct platform_device *pdev) +{ + struct resource *res_base, *res_alt, *res_irq; + ide_hwif_t *hwif; + struct pata_platform_info *pdata; + int ret = 0; + int mmio = 0; + + pdata = pdev->dev.platform_data; + + /* get a pointer to the register memory */ + res_base = platform_get_resource(pdev, IORESOURCE_IO, 0); + res_alt = platform_get_resource(pdev, IORESOURCE_IO, 1); + + if (!res_base || !res_alt) { + res_base = platform_get_resource(pdev, IORESOURCE_MEM, 0); + res_alt = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (!res_base || !res_alt) { + ret = -ENOMEM; + goto out; + } + mmio = 1; + } + + res_irq = platform_get_re
[PATCH 2/2] [POWERPC] MPC8349E-mITX: use platform IDE driver for CF interface
This updates relevant platform code (freescale mpc8349itx target) to make the CompactFlash work in TrueIDE mode. Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]> Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc8349emitx.dts|9 arch/powerpc/platforms/83xx/mpc834x_itx.c | 70 + 2 files changed, 79 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts index db0d003..f8f0e8a 100644 --- a/arch/powerpc/boot/dts/mpc8349emitx.dts +++ b/arch/powerpc/boot/dts/mpc8349emitx.dts @@ -37,6 +37,15 @@ reg = < 1000>; }; + [EMAIL PROTECTED] { + compatible = "mmio-ide"; + device_type = "ide"; + reg = ; + ioport_shift = <1>; + interrupts = <17 8>; + interrupt-parent = < &ipic >; + }; + [EMAIL PROTECTED] { #address-cells = <1>; #size-cells = <1>; diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c index 40a0194..d63a104 100644 --- a/arch/powerpc/platforms/83xx/mpc834x_itx.c +++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -43,6 +44,75 @@ unsigned long isa_io_base = 0; unsigned long isa_mem_base = 0; #endif +static int __init mmio_ide_of_init(void) +{ + struct device_node *np; + unsigned int i; + + for (np = NULL, i = 0; +(np = of_find_compatible_node(np, "ide", "mmio-ide")) != NULL; +i++) { + int ret = 0; + struct resource res[3]; + struct platform_device *pdev = NULL; + static struct pata_platform_info pdata; + + memset(res, 0, sizeof(res)); + + ret = of_address_to_resource(np, 0, &res[0]); + if (ret) { + printk(KERN_ERR "mmio-ide.%d: unable to get " + "resource from OF\n", i); + goto err0; + } + + ret = of_address_to_resource(np, 1, &res[1]); + if (ret) { + printk(KERN_ERR "mmio-ide.%d: unable to get " + "resource from OF\n", i); + goto err0; + } + + res[2].start = res[2].end = irq_of_parse_and_map(np, 0); + if (res[2].start == NO_IRQ) { + printk(KERN_ERR "mmio-ide.%d: no IRQ\n", i); + goto err0; + } + res[2].name = "pata_platform"; + res[2].flags = IORESOURCE_IRQ; + + pdata.ioport_shift = *((u32 *)of_get_property(np, + "ioport_shift", NULL)); + + pdev = platform_device_alloc("pata_platform", i); + if (!pdev) + goto err1; + + ret = platform_device_add_data(pdev, &pdata, sizeof(pdata)); + if (ret) + goto err1; + + ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); + if (ret) + goto err1; + + ret = platform_device_register(pdev); + if (ret) + goto err1; + + continue; +err1: + printk(KERN_ERR "mmio-ide.%d: registration failed\n", i); + platform_device_del(pdev); /* it will free everything */ +err0: + /* Even if some device failed, try others */ + continue; + } + + return 0; +} +device_initcall(mmio_ide_of_init); + /* * * Setup the architecture - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] [POWERPC] Add support of platforms without PHY to gianfar driver
Gianfar driver is now able to work without real phy subnode, that is necessary to cope with fixed-link situation, when SoC is connected to the Ethernet inteface or embedded switch without any PHY. In this case, fixed-speed property will describe such a situation for gianfar driver. The property is in form Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/sysdev/fsl_soc.c | 39 +++ drivers/net/gianfar.c | 17 ++--- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index cad1757..6864534 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -255,29 +255,36 @@ static int __init gfar_of_init(void) FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; ph = of_get_property(np, "phy-handle", NULL); - phy = of_find_node_by_phandle(*ph); + if (ph == NULL) { + unsigned int *bus_id; - if (phy == NULL) { - ret = -ENODEV; - goto unreg; - } + bus_id = of_get_property(np, "fixed_speed",NULL); + gfar_data.bus_id = (bus_id[0]<<16) | bus_id[1]; + } else { + phy = of_find_node_by_phandle(*ph); - mdio = of_get_parent(phy); + if (phy == NULL) { + ret = -ENODEV; + goto unreg; + } + + mdio = of_get_parent(phy); + + id = of_get_property(phy, "reg", NULL); + ret = of_address_to_resource(mdio, 0, &res); + if (ret) { + of_node_put(phy); + of_node_put(mdio); + goto unreg; + } + + gfar_data.phy_id = *id; + gfar_data.bus_id = res.start; - id = of_get_property(phy, "reg", NULL); - ret = of_address_to_resource(mdio, 0, &res); - if (ret) { of_node_put(phy); of_node_put(mdio); - goto unreg; } - gfar_data.phy_id = *id; - gfar_data.bus_id = res.start; - - of_node_put(phy); - of_node_put(mdio); - ret = platform_device_add_data(gfar_dev, &gfar_data, sizeof(struct diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 1b854bf..cf08ced 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -93,6 +93,7 @@ #include #include #include +#include #include "gianfar.h" #include "gianfar_mii.h" @@ -445,11 +446,21 @@ static int init_phy(struct net_device *dev) priv->oldspeed = 0; priv->oldduplex = -1; - snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, priv->einfo->bus_id, priv->einfo->phy_id); - interface = gfar_get_interface(dev); - phydev = phy_connect(dev, phy_id, &adjust_link, 0, interface); + if (priv->einfo->phy_id) { + snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, priv->einfo->bus_id, priv->einfo->phy_id); + phydev = phy_connect(dev, phy_id, &adjust_link, 0, interface); + } else { + struct fixed_info *phyinfo; + int phy_addr = (priv->einfo->bus_id >> 16); + + phyinfo = fixed_mdio_get_phydev(phy_addr-1); + phydev = phyinfo->phydev; + snprintf(phydev->dev.bus_id, BUS_ID_SIZE, PHY_ID_FMT, + (priv->einfo->bus_id & 0x) , phy_addr); + memset(phyinfo->regs,0xff,sizeof(phyinfo->regs[0])*phyinfo->regs_num); + } if (IS_ERR(phydev)) { printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] [POWERPC] Remove dummy network phy from MPC8313E-RDB
Cleaned up inexistent network phy from the target dts, added necessary property to gianfar node there. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc8313erdb.dts |8 +--- 1 files changed, 1 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts b/arch/powerpc/boot/dts/mpc8313erdb.dts index a1533cc..b602a8b 100644 --- a/arch/powerpc/boot/dts/mpc8313erdb.dts +++ b/arch/powerpc/boot/dts/mpc8313erdb.dts @@ -98,12 +98,6 @@ reg = <24520 20>; #address-cells = <1>; #size-cells = <0>; - phy1: [EMAIL PROTECTED] { - interrupt-parent = < &ipic >; - interrupts = <13 8>; - reg = <1>; - device_type = "ethernet-phy"; - }; phy4: [EMAIL PROTECTED] { interrupt-parent = < &ipic >; interrupts = <14 8>; @@ -120,7 +114,7 @@ local-mac-address = [ 00 00 00 00 00 00 ]; interrupts = <25 8 24 8 23 8>; interrupt-parent = < &ipic >; - phy-handle = < &phy1 >; + fixed_speed = <1 1000>; }; [EMAIL PROTECTED] { - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] [POWERPC] MPC8349E-mITX: use platform IDE driver for CF interface
On Wed, 25 Jul 2007 13:46:57 -0500 Scott Wood wrote: > Sergei Shtylyov wrote: > >I acn undertand your complaint in the context of an OF driver > > (which we don't have yet) but "mmio-ide" just means nothing to the > > current driver, and it doesn't convery enough info on the > > programming interface for the conceivable OF driver, it also does > > need to know at least "reg-stride" (and maybe "reg-size" in case > > only 16/32-bit accesses can be used). Well, if such driver will be > > written, I/O mapping support will probably be dropped from it, so > > indeed, calling it mmio-ide.c would make sense. But that can be > > added when this driver is done, and for now > > I don't think the details of what Linux code currently exists should > drive the device tree binding. That the current patches use > platform_device glue code is an implementation detail (and one I'd > rather see go away, in favor of a driver that supports both > platform_device and of_device). > > > I'd really prefer the board name to appear in the "compatible" prop > > (to which "mmio-ide" can be appended)... > > Sure, that's always good... it was the "instead" that I objected to. > Hmmm. So what is finally suggested devicetree node for this beast - can somebody refine? I am a little bit confused about decided device_type and compatible fields... -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] [POWERPC] MPC8349E-mITX: use platform IDE driver for CF interface
On Wed, 25 Jul 2007 21:06:42 +0400 Sergei Shtylyov wrote: > Hello. > > Vitaly Bordug wrote: > > > This updates relevant platform code (freescale mpc8349itx target) > > to make the CompactFlash work in TrueIDE mode. > >Erm, I'm not sure it's worth submitting the platform device driver > for PowerPC at this point, but well... > As Ben already confirmed, it is OK to have "constructor" insert platform device if such is required by design. > > Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]> > > Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> > > > arch/powerpc/boot/dts/mpc8349emitx.dts|9 > > arch/powerpc/platforms/83xx/mpc834x_itx.c | 70 > > + 2 files changed, 79 insertions(+), 0 > > deletions(-) > > > diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts > > b/arch/powerpc/boot/dts/mpc8349emitx.dts index db0d003..f8f0e8a > > 100644 --- a/arch/powerpc/boot/dts/mpc8349emitx.dts > > +++ b/arch/powerpc/boot/dts/mpc8349emitx.dts > > @@ -37,6 +37,15 @@ > > reg = < 1000>; > > }; > > > > + [EMAIL PROTECTED] { > > + compatible = "mmio-ide"; > > + device_type = "ide"; > > Why not "ata"? > we already argued around this iirc. I have no preferences and will put whatever agreed appropriate finally in here. > > + reg = ; > > + ioport_shift = <1>; > > Please use hyphen, not underscore in the property names > ("device_type" seems an only exception from this rule). > And since using shift instead of size buys you nothing is this > case, I'd prefer this property to be called reg-size or reg-stride. > > [...] > > diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c > > b/arch/powerpc/platforms/83xx/mpc834x_itx.c index 40a0194..d63a104 > > 100644 --- a/arch/powerpc/platforms/83xx/mpc834x_itx.c > > +++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c > [...] > > @@ -43,6 +44,75 @@ unsigned long isa_io_base = 0; > > unsigned long isa_mem_base = 0; > > #endif > > > > +static int __init mmio_ide_of_init(void) > > +{ > > + struct device_node *np; > > + unsigned int i; > > + > > + for (np = NULL, i = 0; > > +(np = of_find_compatible_node(np, "ide", > > "mmio-ide")) != NULL; > > +i++) { > > + int ret = 0; > > Unneeded initialization. > > > + struct resource res[3]; > > + struct platform_device *pdev = NULL; > > Another one. > ok > > + static struct pata_platform_info pdata; > > + > > + memset(res, 0, sizeof(res)); > > + > > + ret = of_address_to_resource(np, 0, &res[0]); > > + if (ret) { > > + printk(KERN_ERR "mmio-ide.%d: unable to > > get " > > + "resource from OF\n", i); > > + goto err0; > > + } > > + > > + ret = of_address_to_resource(np, 1, &res[1]); > > + if (ret) { > > + printk(KERN_ERR "mmio-ide.%d: unable to > > get " > > + "resource from OF\n", i); > > + goto err0; > > Erm, these printk's are repetitive, isn't it better to put them > under err0 label? > > > + } > > + > > + res[2].start = res[2].end = > > irq_of_parse_and_map(np, 0); > > + if (res[2].start == NO_IRQ) { > > + printk(KERN_ERR "mmio-ide.%d: no IRQ\n", > > i); > > + goto err0; > > + } > > + res[2].name = "pata_platform"; > > + res[2].flags = IORESOURCE_IRQ; > > + > > + pdata.ioport_shift = *((u32 *)of_get_property(np, > > + "ioport_shift", NULL)); > > + > > + pdev = platform_device_alloc("pata_platform", i); > > + if (!pdev) > > + goto err1; > > Hm, not err0? > agreed. > > + > > + ret = platform_device_add_data(pdev, &pdata, > > sizeof(pdata)); > > + if (ret) > > + goto err1; > > + > > + ret = platform_device_add_resources(pdev, res, > > ARRAY_SIZE(res)); > > + if (ret) > > + goto
drivers/base: device_bind_driver() fix
Keeps sysfs from creating link if device is already bound to driver. Similar behavior was before the rework; now without this patch fixed PHY will complain about not been able to create file in sysfs. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/base/dd.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 510e788..6da3d01 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -26,12 +26,12 @@ #define to_drv(node) container_of(node, struct device_driver, kobj.entry) -static void driver_bound(struct device *dev) +static int driver_bound(struct device *dev) { if (klist_node_attached(&dev->knode_driver)) { printk(KERN_WARNING "%s: device %s already bound\n", __FUNCTION__, kobject_name(&dev->kobj)); - return; + return 0; } pr_debug("bound device '%s' to driver '%s'\n", @@ -42,6 +42,7 @@ static void driver_bound(struct device *dev) BUS_NOTIFY_BOUND_DRIVER, dev); klist_add_tail(&dev->knode_driver, &dev->driver->klist_devices); + return 1; } static int driver_sysfs_add(struct device *dev) @@ -86,7 +87,8 @@ static void driver_sysfs_remove(struct device *dev) */ int device_bind_driver(struct device *dev) { - driver_bound(dev); + if (!driver_bound(dev)) + return 0; return driver_sysfs_add(dev); } signature.asc Description: PGP signature
[PATCH] [FS_ENET] OF-related fixup for FEC and SCC MAC's
Updated direct resource pass with ioremap call, make it grant proper IRQ mapping, stuff incompatible with the new approach were respectively put under #ifndef CONFIG_PPC_MERGE. It is required so that both ppc and powerpc could utilize fs_enet effectively. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/net/fs_enet/mac-fec.c | 13 + drivers/net/fs_enet/mac-scc.c |6 -- drivers/net/phy/fixed.c |2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c index c2c5fd4..ff68394 100644 --- a/drivers/net/fs_enet/mac-fec.c +++ b/drivers/net/fs_enet/mac-fec.c @@ -104,9 +104,9 @@ static int do_pd_setup(struct fs_enet_private *fep) fep->interrupt = platform_get_irq_byname(pdev,"interrupt"); if (fep->interrupt < 0) return -EINVAL; - + r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); - fep->fec.fecp =(void*)r->start; + fep->fec.fecp = ioremap(r->start, r->end - r->start + 1); if(fep->fec.fecp == NULL) return -EINVAL; @@ -319,11 +319,14 @@ static void restart(struct net_device *dev) * Clear any outstanding interrupt. */ FW(fecp, ievent, 0xffc0); +#ifndef CONFIG_PPC_MERGE FW(fecp, ivec, (fep->interrupt / 2) << 29); - +#else + FW(fecp, ivec, (virq_to_hw(fep->interrupt) / 2) << 29); +#endif /* -* adjust to speed (only for DUET & RMII) +* adjust to speed (only for DUET & RMII) */ #ifdef CONFIG_DUET if (fpi->use_rmii) { @@ -418,6 +421,7 @@ static void stop(struct net_device *dev) static void pre_request_irq(struct net_device *dev, int irq) { +#ifndef CONFIG_PPC_MERGE immap_t *immap = fs_enet_immap; u32 siel; @@ -431,6 +435,7 @@ static void pre_request_irq(struct net_device *dev, int irq) siel &= ~(0x8000 >> (irq & ~1)); out_be32(&immap->im_siu_conf.sc_siel, siel); } +#endif } static void post_free_irq(struct net_device *dev, int irq) diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index 95ec587..afd7fca 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c @@ -121,13 +121,13 @@ static int do_pd_setup(struct fs_enet_private *fep) return -EINVAL; r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); - fep->scc.sccp = (void *)r->start; + fep->scc.sccp = ioremap(r->start, r->end - r->start + 1); if (fep->scc.sccp == NULL) return -EINVAL; r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pram"); - fep->scc.ep = (void *)r->start; + fep->scc.ep = ioremap(r->start, r->end - r->start + 1); if (fep->scc.ep == NULL) return -EINVAL; @@ -397,6 +397,7 @@ static void stop(struct net_device *dev) static void pre_request_irq(struct net_device *dev, int irq) { +#ifndef CONFIG_PPC_MERGE immap_t *immap = fs_enet_immap; u32 siel; @@ -410,6 +411,7 @@ static void pre_request_irq(struct net_device *dev, int irq) siel &= ~(0x8000 >> (irq & ~1)); out_be32(&immap->im_siu_conf.sc_siel, siel); } +#endif } static void post_free_irq(struct net_device *dev, int irq) diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 096d4a1..8613539 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -349,7 +349,7 @@ static int __init fixed_init(void) fixed_mdio_register_device(0, 100, 1); #endif -#ifdef CONFIX_FIXED_MII_10_FDX +#ifdef CONFIG_FIXED_MII_10_FDX fixed_mdio_register_device(0, 10, 1); #endif return 0; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Device does not have a release() function
Avuton, Thanks for this report, > Please excuse me if this has already been discussed. Anything else > that's needed please let me know. > > kernel: Linux version 2.6.20-rc2 ([EMAIL PROTECTED]) (gcc version 4.1.1 > (Gentoo 4.1.1-r3)) #6 SMP PREEMPT Thu Dec 28 21:07:58 PST 2006 > > Spotted this in the dmesg: [...] Maybe some additional failure case is not handled, I'll have a look at it. -- Sincerely, Vitaly signature.asc Description: PGP signature
[PATCH] [FS_ENET] OF-related update for FEC and SCC MAC's
Updated direct resource pass with ioremap call, make it grant proper IRQ mapping, stuff incompatible with the new approach were respectively put under #ifndef CONFIG_PPC_MERGE. --- drivers/net/fs_enet/mac-fec.c | 13 + drivers/net/fs_enet/mac-scc.c |6 -- drivers/net/phy/fixed.c |2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c index c2c5fd4..474d6d7 100644 --- a/drivers/net/fs_enet/mac-fec.c +++ b/drivers/net/fs_enet/mac-fec.c @@ -104,9 +104,9 @@ static int do_pd_setup(struct fs_enet_pr fep->interrupt = platform_get_irq_byname(pdev,"interrupt"); if (fep->interrupt < 0) return -EINVAL; - + r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); - fep->fec.fecp =(void*)r->start; + fep->fec.fecp = (void *)ioremap(r->start, r->end - r->start + 1); if(fep->fec.fecp == NULL) return -EINVAL; @@ -319,11 +319,14 @@ #endif * Clear any outstanding interrupt. */ FW(fecp, ievent, 0xffc0); +#ifndef CONFIG_PPC_MERGE FW(fecp, ivec, (fep->interrupt / 2) << 29); - +#else + FW(fecp, ivec, (irq_map[fep->interrupt].hwirq / 2) << 29); +#endif /* -* adjust to speed (only for DUET & RMII) +* adjust to speed (only for DUET & RMII) */ #ifdef CONFIG_DUET if (fpi->use_rmii) { @@ -418,6 +421,7 @@ static void stop(struct net_device *dev) static void pre_request_irq(struct net_device *dev, int irq) { +#ifndef CONFIG_PPC_MERGE immap_t *immap = fs_enet_immap; u32 siel; @@ -431,6 +435,7 @@ static void pre_request_irq(struct net_d siel &= ~(0x8000 >> (irq & ~1)); out_be32(&immap->im_siu_conf.sc_siel, siel); } +#endif } static void post_free_irq(struct net_device *dev, int irq) diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index 95ec587..62057f4 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c @@ -121,13 +121,13 @@ static int do_pd_setup(struct fs_enet_pr return -EINVAL; r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); - fep->scc.sccp = (void *)r->start; + fep->scc.sccp = (void *)ioremap(r->start, r->end - r->start + 1); if (fep->scc.sccp == NULL) return -EINVAL; r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pram"); - fep->scc.ep = (void *)r->start; + fep->scc.ep = (void *)ioremap(r->start, r->end - r->start + 1); if (fep->scc.ep == NULL) return -EINVAL; @@ -397,6 +397,7 @@ static void stop(struct net_device *dev) static void pre_request_irq(struct net_device *dev, int irq) { +#ifndef CONFIG_PPC_MERGE immap_t *immap = fs_enet_immap; u32 siel; @@ -410,6 +411,7 @@ static void pre_request_irq(struct net_d siel &= ~(0x8000 >> (irq & ~1)); out_be32(&immap->im_siu_conf.sc_siel, siel); } +#endif } static void post_free_irq(struct net_device *dev, int irq) diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 096d4a1..8613539 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -349,7 +349,7 @@ #ifdef CONFIG_FIXED_MII_100_FDX fixed_mdio_register_device(0, 100, 1); #endif -#ifdef CONFIX_FIXED_MII_10_FDX +#ifdef CONFIG_FIXED_MII_10_FDX fixed_mdio_register_device(0, 10, 1); #endif return 0; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [FS_ENET] OF-related update for FEC and SCC MAC's
On Mon, 11 Dec 2006 21:00:49 +0300 Vitaly Bordug <[EMAIL PROTECTED]> wrote: > > Updated direct resource pass with ioremap call, make it grant proper IRQ > mapping, stuff incompatible with the new approach were respectively put > under > #ifndef CONFIG_PPC_MERGE. Hrm, Signed-off-by: missed, I'll resend, sorry about that. -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] [ide] mmio ide support
This adds support for MMIO IDE device like CompactFlash in TrueIDE mode. Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]> Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/ide/Kconfig |6 + drivers/ide/legacy/Makefile |2 drivers/ide/legacy/mmio-ide.c | 211 + 3 files changed, 219 insertions(+), 0 deletions(-) diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index b1a9b81..0dab799 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -946,6 +946,12 @@ config BLK_DEV_MPC8xx_IDE If unsure, say N. +config BLK_DEV_MMIOIDE + tristate "Memory Mapped IDE support" + help + This is the IDE driver for Memory Mapped IDE devices. Like + Compact Flash running in True IDE mode. + choice prompt "Type of MPC8xx IDE interface" depends on BLK_DEV_MPC8xx_IDE diff --git a/drivers/ide/legacy/Makefile b/drivers/ide/legacy/Makefile index c797106..61bd21e 100644 --- a/drivers/ide/legacy/Makefile +++ b/drivers/ide/legacy/Makefile @@ -7,6 +7,8 @@ obj-$(CONFIG_BLK_DEV_UMC8672) += umc8672.o obj-$(CONFIG_BLK_DEV_IDECS)+= ide-cs.o +obj-$(CONFIG_BLK_DEV_MMIOIDE) += mmio-ide.o + # Last of all obj-$(CONFIG_BLK_DEV_HD) += hd.o diff --git a/drivers/ide/legacy/mmio-ide.c b/drivers/ide/legacy/mmio-ide.c new file mode 100644 index 000..77fb7dd --- /dev/null +++ b/drivers/ide/legacy/mmio-ide.c @@ -0,0 +1,211 @@ +/* + * Memory Mapped IDE driver + * + * Author: Kumar Gala <[EMAIL PROTECTED]> + * + * 2007 (c) MontaVista Software, Inc. + * Vitaly Bordug <[EMAIL PROTECTED]> + * Anton Vorontsov <[EMAIL PROTECTED]> + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static struct { + void __iomem *mmio_ide_mapbase; + void __iomem *mmio_ide_alt_mapbase; + ide_hwif_t *hwif; + int index; +} hwif_prop; + +static ide_hwif_t * __devinit mmio_ide_locate_hwif(void __iomem * base, +void __iomem * ctrl, struct mmio_ide_platform_data *pdata, int irq) +{ + unsigned long port = (unsigned long)base; + ide_hwif_t *hwif; + int index, i; + + for (index = 0; index < MAX_HWIFS; ++index) { + hwif = ide_hwifs + index; + if (hwif->io_ports[IDE_DATA_OFFSET] == port) + goto found; + } + + for (index = 0; index < MAX_HWIFS; ++index) { + hwif = ide_hwifs + index; + if (hwif->io_ports[IDE_DATA_OFFSET] == 0) + goto found; + } + + return NULL; + +found: + + hwif->hw.io_ports[IDE_DATA_OFFSET] = port; + + port += pdata->regaddr_step + pdata->byte_lanes_swapping; + for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET; +i++, port += pdata->regaddr_step) + hwif->hw.io_ports[i] = port; + + hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl + + 6 * pdata->regaddr_step + pdata->byte_lanes_swapping; + + memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); + hwif->hw.irq = hwif->irq = irq; + hwif->selectproc = pdata->selectproc; + + hwif->hw.dma = NO_DMA; + hwif->hw.chipset = ide_generic; + + hwif->mmio = 2; + pdata->mmiops(hwif); + hwif_prop.hwif = hwif; + hwif_prop.index = index; + + return hwif; +} + +static int __devinit mmio_ide_probe(struct platform_device *pdev) +{ + struct resource *res_base, *res_alt, *res_irq; + ide_hwif_t *hwif; + struct mmio_ide_platform_data *pdata; + int ret = 0; + + pdata = (struct mmio_ide_platform_data*)pdev->dev.platform_data; + + /* get a pointer to the register memory */ + res_base = platform_get_resource(pdev, IORESOURCE_MEM, 0); + res_alt = platform_get_resource(pdev, IORESOURCE_MEM, 1); + res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + + if ((!res_base) || (!res_alt) || (!res_irq)) { + ret = -ENODEV; + goto out; + } + + if (!request_mem_region(res_base->start, res_base->end - + res_base->start + 1, pdev->name)) { + dev_dbg(&pdev->dev, "%s: request_mem_region of base failed\n", + pdev->name); + ret = -EBUSY; + goto out; + } + + if (!request_mem_region(res_alt->start, res_alt->end - +
[PATCH 2/2] [POWERPC] mmio ide support for mpc8349-itx target
This updates relevant platform code (freescale mpc8349itx target) to make the CompactFlash work in TrueIDE mode. Signed-off-by: Anton Vorontsov <[EMAIL PROTECTED]> Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc8349emitx.dts | 17 + arch/powerpc/sysdev/fsl_soc.c | 113 2 files changed, 129 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts index db0d003..b3e80ab 100644 --- a/arch/powerpc/boot/dts/mpc8349emitx.dts +++ b/arch/powerpc/boot/dts/mpc8349emitx.dts @@ -42,7 +42,7 @@ #size-cells = <1>; #interrupt-cells = <2>; device_type = "soc"; - ranges = <0 e000 0010>; + ranges = <0 e000 1f00>; reg = ; bus-frequency = <0>;// from bootloader @@ -229,6 +229,21 @@ descriptor-types-mask = <01010ebf>; }; + [EMAIL PROTECTED] { + #interrupt-cells = <2>; + interrupts = <17 8>; + interrupt-map = <0 0 0 1 700 17 8>; + interrupt-map-mask = <0>; + + #size-cells = <1>; + #address-cells = <1>; + reg = <1000 10 1200 10>; + + device_type = "ide"; + compatible = "mmio-ide"; + interrupt-parent = < &ipic >; + }; + ipic: [EMAIL PROTECTED] { interrupt-controller; #address-cells = <0>; diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index cad1757..b3fe011 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -1103,3 +1103,116 @@ err: arch_initcall(cpm_smc_uart_of_init); #endif /* CONFIG_8xx */ + +#ifdef CONFIG_MPC834x_ITX + +#include +#include +#include + +static void mmio_ide_outsw(unsigned long port, void *addr, u32 count) +{ + _outsw_ns((void __iomem *)port, addr, count); +} + +static void mmio_ide_insw(unsigned long port, void *addr, u32 count) +{ + _insw_ns((void __iomem *)port, addr, count); +} + +void mmio_ide_mmiops (ide_hwif_t *hwif) +{ + default_hwif_mmiops(hwif); + hwif->OUTL = NULL; + hwif->OUTSW = mmio_ide_outsw; + hwif->OUTSL = NULL; + hwif->INL = NULL; + hwif->INSW = mmio_ide_insw; + hwif->INSL = NULL; +} + +void mmio_ide_selectproc (ide_drive_t *drive) +{ + u8 stat; + + stat = drive->hwif->INB(IDE_STATUS_REG); + if ((stat & READY_STAT) && (stat & BUSY_STAT)) + drive->present = 0; + else + drive->present = 1; +} + +static int __init fsl_mmio_ide_of_init(void) +{ + struct device_node *np; + unsigned int i; + + for (np = NULL, i = 0; +(np = of_find_compatible_node(np, "ide", "mmio-ide")) != NULL; +i++) { + int ret = 0; + struct resource res[3]; + struct platform_device *pdev = NULL; + static struct mmio_ide_platform_data pdata = { + /* TODO: pass via OF? */ + .byte_lanes_swapping = 0, + .regaddr_step= 2, + .mmiops = mmio_ide_mmiops, + .selectproc = mmio_ide_selectproc, + }; + + memset(res, 0, sizeof(res)); + + ret = of_address_to_resource(np, 0, &res[0]); + if (ret) { + printk(KERN_ERR "mmio-ide.%d: unable to get " + "resource from OF\n",i ); + goto err0; + } + + ret = of_address_to_resource(np, 1, &res[1]); + if (ret) { + printk(KERN_ERR "mmio-ide.%d: unable to get " + "resource from OF\n", i); + goto err0; + } + + res[2].start = res[2].end = irq_of_parse_and_map(np, 0); + if (res[2].start == NO_IRQ) { + printk(KERN_ERR "mmio-ide.%d: no IRQ\n", i); + goto err0; + } + res[2].name = "mmio-ide"; + res[2].flags = IORESOURCE_IRQ;; + + pdev = platform_device_alloc("mmio-ide", i); + if (!pdev) + goto err1; + + ret = platform_device_add_data(pdev, &pdata, sizeof(pd
Re: [PATCH 1/2] [ide] mmio ide support
On Sat, 7 Jul 2007 10:01:47 -0500 Olof Johansson wrote: > On Sat, Jul 07, 2007 at 01:48:52PM +0400, Vitaly Bordug wrote: > > > > This adds support for MMIO IDE device like CompactFlash > > in TrueIDE mode. > > Doesn't this duplicate most of pata_platform, but as the > no-longer-preferred legacy IDE device? Did you try using > pata_platform instead? > prolly true, but as Sergei told upper, that's not an option so far due to internal reasons. But it is likely to be followed-up that way a little bit later. > > -Olof -- Sincerely, Vitaly -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] [ide] mmio ide support
On Sat, 7 Jul 2007 21:13:06 +0100 Alan Cox wrote: > On Sat, 07 Jul 2007 13:48:52 +0400 > Vitaly Bordug <[EMAIL PROTECTED]> wrote: > > > > > This adds support for MMIO IDE device like CompactFlash > > in TrueIDE mode. > > Really we should be working towards libata support for all new > devices. This looks like a candidate for the existing (or a little > enhanced) pata_platform driver. > Yes I am aware of it, yet, the code was created for IDE subsystem due to internal reasons, and I thought to better make it available for others at least. We'll prolly pick it up to move to libata/pata_platform but not instantly afaict now. > > +config BLK_DEV_MMIOIDE > > + tristate "Memory Mapped IDE support" > > Please pick a better description. This isn't a generic option for > enabling MMIO based IDE as you make it sound. > > > Also we have an accepted match name for ATA platform devices - and > adding another one messes it up irrespective of whether you want > libata or legacy IDE support. If you use the same matches then your > platform code, and everyone elses platform code can work with both > drivers, except for hotpluggability. > > Other bugs > > - Your remove code releases the resources before the hwif which means > it races another user trying to claim the resource > - Be careful with ide_unregister. It exists and you can call it but > its actually not very safe and there are lots of unfixed races in the > IDE layer if you do > OK, makes sense. > > The "should we have a legacy ide driver that matches the libata > pata_platform" question I don't really care about. Its a waste of > effort in many ways but if you've written the code the work is done > so why not use it. > > However it needs to be *compatible* so that platform devices can be > claimed by either so the kernel build can pick legacy IDE v libata and > not have to #ifdef all the platform code. > Sounds good. I'll look forward to address the issues, thanks. > Alan -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] [POWERPC] mmio ide support for mpc8349-itx target
On Sat, 07 Jul 2007 20:46:46 +0400 Sergei Shtylyov wrote: > > + > > +#ifdef CONFIG_MPC834x_ITX > > Erm, isn't this stuff misplaced? Is this really SoC device? I > remember seeng this in the arch/ppc/ platform code before (in the > internal tree)... The point is to declare methods bsp, as mmio access may effectively vary (having bugs or intentionally) from platform to platform. All-in-one driver approach is nice but might be an issue to handle/maintain. Thanks for looking at it, other notes make sense. -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Oops while modprobing phy fixed module
Folks, I will have the fix and rework to the fixed phy posted by today/tomorrow. You'll have to modify platform code a bit Thanks, -Vitaly On Sun, 15 Jul 2007 19:42:44 +0200 Gabriel C <[EMAIL PROTECTED]> wrote: > Satyam Sharma wrote: > > Hi Gabriel, > > > > Hi Satyam , > > > On 7/14/07, Gabriel C <[EMAIL PROTECTED]> wrote: > > > >> Hi, > >> > >> doing a modprobe fixed the driver segfaults and I get this Oops: > >> > >> > >> Jul 14 13:43:30 lara [ 157.952915] Fixed PHY: Registered new driver > >> Jul 14 13:43:30 lara [ 157.953010] Device '[EMAIL PROTECTED]:1' does not > >> have a > >> release() function, it is broken and must be fixed. > >> Jul 14 13:43:30 lara [ 157.953019] WARNING: at drivers/base/core.c:107 > >> device_release() > >> Jul 14 13:43:30 lara [ 157.953032] [] kobject_cleanup+0x3d/0x54 > >> Jul 14 13:43:30 lara [ 157.953050] [] kobject_release+0x0/0x8 > >> Jul 14 13:43:30 lara [ 157.953060] [] kref_put+0x60/0x6d > >> Jul 14 13:43:30 lara [ 157.953068] [] device_del+0x1f3/0x215 > >> Jul 14 13:43:30 lara [ 157.953083] [] > >> fixed_mdio_register_device+0x1e2/0x20d [fixed] > >> Jul 14 13:43:30 lara [ 157.953108] [] fixed_init+0x1b/0x2f > >> [fixed] > >> Jul 14 13:43:30 lara [ 157.953119] [] > >> sys_init_module+0x1686/0x175a > >> Jul 14 13:43:30 lara [ 157.953133] [] do_sync_read+0x0/0x10a > >> Jul 14 13:43:30 lara [ 157.953180] [] > >> sysenter_past_esp+0x5f/0x85 > >> Jul 14 13:43:30 lara [ 157.953195] [] > >> packet_setsockopt+0x1c9/0x2f3 > >> Jul 14 13:43:30 lara [ 157.953232] === > >> > > > > This looks unrelated to the oops itself, but still something that > > needs to be fixed, of course. [ Maintainers added to Cc: ] > > > > > >> Jul 14 13:43:30 lara [ 157.953261] BUG: unable to handle kernel paging > >> request at virtual address 43b7a800 > >> > > > > 43b7a800 looks suspicious, it could have been a valid kernel > > address, if only for what looks like a single-bit flip. > > > > > >> Jul 14 13:43:30 lara [ 157.953273] printing eip: > >> Jul 14 13:43:30 lara [ 157.953278] c015d269 > >> Jul 14 13:43:30 lara [ 157.953283] *pde = > >> Jul 14 13:43:30 lara [ 157.953293] Oops: [#1] > >> Jul 14 13:43:30 lara [ 157.953301] PREEMPT SMP > >> Jul 14 13:43:30 lara [ 157.953309] Modules linked in: fixed pc87360 > >> hwmon_vid i2c_isa eeprom adm1021 uhci_hcd sr_mod shpchp pci_hotplug > >> ohci_hcd iTCO_wdt iTCO_vendor_support intel_agp i82860_edac i2c_i801 > >> ehci_hcd usbcore edac_mc cdrom agpgart 3c59x mii ext4dev jbd2 capability > >> commoncap loop lp parport_pc parport > >> Jul 14 13:43:30 lara [ 157.953386] CPU:3 > >> Jul 14 13:43:30 lara [ 157.953387] EIP:0060:[]Not > >> tainted VLI > >> Jul 14 13:43:30 lara [ 157.953391] EFLAGS: 00210006 (2.6.22-g8d9107e8 > >> #7) > >> Jul 14 13:43:30 lara [ 157.953404] EIP is at kmem_cache_zalloc+0x75/0x89 > >> Jul 14 13:43:30 lara [ 157.953412] eax: ebx: 00200282 ecx: > >> c14c8760 edx: 43b7a800 > >> Jul 14 13:43:30 lara [ 157.953423] esi: e7f75840 edi: c17937b8 ebp: > >> 00d0 esp: db1ced98 > >> Jul 14 13:43:30 lara [ 157.953434] ds: 007b es: 007b fs: 00d8 gs: > >> 0033 ss: 0068 > >> Jul 14 13:43:30 lara [ 157.953444] Process modprobe (pid: 2164, > >> ti=db1ce000 task=de78ac20 task.ti=db1ce000) > >> Jul 14 13:43:30 lara [ 157.953450] Stack: c014cfd4 c01cf2f7 43b7a800 > >> c03ae384 c036d990 db150690 c17937b8 c17937b8 > >> Jul 14 13:43:30 lara [ 157.953470]c019752a 0002 41ed > >> e643bb60 c036d990 db150690 c036d990 e643bb60 > >> Jul 14 13:43:30 lara [ 157.953489]c01979b1 c0197712 db1cede4 > >> e643bb60 c036d990 c03b8e98 > >> Jul 14 13:43:30 lara [ 157.953513] Call Trace: > >> Jul 14 13:43:30 lara [ 157.953518] [] kstrdup+0x27/0x47 > >> Jul 14 13:43:30 lara [ 157.953530] [] > >> ida_get_new_above+0xe6/0x166 > >> Jul 14 13:43:30 lara [ 157.953551] [] > >> sysfs_new_dirent+0x3d/0xdc > >> Jul 14 13:43:30 lara [ 157.953574] [] create_dir+0x1e/0x8c > >> Jul 14 13:43:30 lara [ 157.953588] [] > >> sysfs_addrm_finish+0x13/0x1d8 > >> Jul 14 13:43:30 lara [ 157.953609] [] > >> sysfs_create_subdir+0x13/0x16 > >> Jul 14 13:43:30 lara [ 157.953622] [] > >> sysfs_create_group+0x25/0xe7 > >> Jul 14 13:43:30 lara [ 157.953642] [] device_pm_add+0x38/0x72 > >> Jul 14 13:43:30 lara [ 157.953655] [] device_add+0x230/0x3d8 > >> Jul 14 13:43:30 lara [ 157.953678] [] > >> fixed_mdio_register_device+0x17a/0x20d [fixed] > >> Jul 14 13:43:30 lara [ 157.953706] [] fixed_init+0x2c/0x2f > >> [fixed] > >> Jul 14 13:43:30 lara [ 157.953718] [] > >> sys_init_module+0x1686/0x175a > >> Jul 14 13:43:30 lara [ 157.953734] [] do_sync_read+0x0/0x10a > >> Jul 14 13:43:30 lara [ 157.953797] [] > >> sysenter_past_esp+0x5f/0x85 > >> Jul 14 13:43:30 lara [ 157.953816] [] > >> packet_setsockopt+0x1c9/0x2f3 > >> Jul 14 13:43:30 lara [ 157.953835] === > >> Jul 14
[PATCH] PHY fixed driver: rework release path and update phy_id notation
device_bind_driver() error code returning has been fixed. release() function has been written, so that to free resources in correct way; the release path is now clean. Before the rework, it used to cause Device '[EMAIL PROTECTED]:1' does not have a release() function, it is broken and must be fixed. BUG: at drivers/base/core.c:104 device_release() Call Trace: [] kobject_cleanup+0x53/0x7e [] kobject_release+0x0/0x9 [] kref_put+0x74/0x81 [] fixed_mdio_register_device+0x230/0x265 [] fixed_init+0x1f/0x35 [] init+0x147/0x2fb [] schedule_tail+0x36/0x92 [] child_rip+0xa/0x12 [] acpi_ds_init_one_object+0x0/0x83 [] init+0x0/0x2fb [] child_rip+0x0/0x12 Also changed the notation of the fixed phy definition on mdio bus to the form of + to make it able to be used by gianfar and ucc_geth that define phy_id strictly as "%d:%d" and cleaned up the whitespace issues. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/net/phy/Kconfig | 14 ++ drivers/net/phy/fixed.c | 310 --- 2 files changed, 169 insertions(+), 155 deletions(-) diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index dd09011..432c210 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -76,4 +76,18 @@ config FIXED_MII_100_FDX bool "Emulation for 100M Fdx fixed PHY behavior" depends on FIXED_PHY +config FIXED_MII_1000_FDX + bool "Emulation for 1000M Fdx fixed PHY behavior" + depends on FIXED_PHY + +config FIXED_MII_AMNT +int "Number of emulated PHYs to allocate " +depends on FIXED_PHY +default "1" +---help--- +Sometimes it is required to have several independent emulated +PHYs on the bus (in case of multi-eth but phy-less HW for instance). +This control will have specified number allocated for each fixed +PHY type enabled. + endif # PHYLIB diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index bb96691..5619182 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -30,53 +30,31 @@ #include #include #include +#include #include #include #include -#define MII_REGS_NUM 7 - -/* -The idea is to emulate normal phy behavior by responding with -pre-defined values to mii BMCR read, so that read_status hook could -take all the needed info. -*/ - -struct fixed_phy_status { - u8 link; - u16 speed; - u8 duplex; -}; - -/*- - * Private information hoder for mii_bus - *-*/ -struct fixed_info { - u16 *regs; - u8 regs_num; - struct fixed_phy_status phy_status; - struct phy_device *phydev; /* pointer to the container */ - /* link & speed cb */ - int(*link_update)(struct net_device*, struct fixed_phy_status*); - -}; +/* we need to track the allocated pointers in order to free them on exit */ +static struct fixed_info *fixed_phy_ptrs[CONFIG_FIXED_MII_AMNT*MAX_PHY_AMNT]; /*- * If something weird is required to be done with link/speed, * network driver is able to assign a function to implement this. * May be useful for PHY's that need to be software-driven. *-*/ -int fixed_mdio_set_link_update(struct phy_device* phydev, - int(*link_update)(struct net_device*, struct fixed_phy_status*)) +int fixed_mdio_set_link_update(struct phy_device *phydev, + int (*link_update) (struct net_device *, + struct fixed_phy_status *)) { struct fixed_info *fixed; - if(link_update == NULL) + if (link_update == NULL) return -EINVAL; - if(phydev) { - if(phydev->bus) { + if (phydev) { + if (phydev->bus) { fixed = phydev->bus->priv; fixed->link_update = link_update; return 0; @@ -84,54 +62,64 @@ int fixed_mdio_set_link_update(struct phy_device* phydev, } return -EINVAL; } + EXPORT_SYMBOL(fixed_mdio_set_link_update); +struct fixed_info *fixed_mdio_get_phydev (int phydev_ind) +{ + if (phydev_ind >= MAX_PHY_AMNT) + return NULL; + return fixed_phy_ptrs[phydev_ind]; +} + +EXPORT_SYMBOL(fixed_mdio_get_phydev); + /*- * This is used for updating internal mii regs from the status *--
[PATCH] [updated] PHY fixed driver: rework release path and update phy_id notation
device_bind_driver() error code returning has been fixed. release() function has been written, so that to free resources in correct way; the release path is now clean. Before the rework, it used to cause Device '[EMAIL PROTECTED]:1' does not have a release() function, it is broken and must be fixed. BUG: at drivers/base/core.c:104 device_release() Call Trace: [] kobject_cleanup+0x53/0x7e [] kobject_release+0x0/0x9 [] kref_put+0x74/0x81 [] fixed_mdio_register_device+0x230/0x265 [] fixed_init+0x1f/0x35 [] init+0x147/0x2fb [] schedule_tail+0x36/0x92 [] child_rip+0xa/0x12 [] acpi_ds_init_one_object+0x0/0x83 [] init+0x0/0x2fb [] child_rip+0x0/0x12 Also changed the notation of the fixed phy definition on mdio bus to the form of + to make it able to be used by gianfar and ucc_geth that define phy_id strictly as "%d:%d" and cleaned up the whitespace issues. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/net/phy/Kconfig | 14 ++ drivers/net/phy/fixed.c | 310 +++-- include/linux/phy_fixed.h | 38 ++ 3 files changed, 207 insertions(+), 155 deletions(-) diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index dd09011..432c210 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -76,4 +76,18 @@ config FIXED_MII_100_FDX bool "Emulation for 100M Fdx fixed PHY behavior" depends on FIXED_PHY +config FIXED_MII_1000_FDX + bool "Emulation for 1000M Fdx fixed PHY behavior" + depends on FIXED_PHY + +config FIXED_MII_AMNT +int "Number of emulated PHYs to allocate " +depends on FIXED_PHY +default "1" +---help--- +Sometimes it is required to have several independent emulated +PHYs on the bus (in case of multi-eth but phy-less HW for instance). +This control will have specified number allocated for each fixed +PHY type enabled. + endif # PHYLIB diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index bb96691..5619182 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -30,53 +30,31 @@ #include #include #include +#include #include #include #include -#define MII_REGS_NUM 7 - -/* -The idea is to emulate normal phy behavior by responding with -pre-defined values to mii BMCR read, so that read_status hook could -take all the needed info. -*/ - -struct fixed_phy_status { - u8 link; - u16 speed; - u8 duplex; -}; - -/*- - * Private information hoder for mii_bus - *-*/ -struct fixed_info { - u16 *regs; - u8 regs_num; - struct fixed_phy_status phy_status; - struct phy_device *phydev; /* pointer to the container */ - /* link & speed cb */ - int(*link_update)(struct net_device*, struct fixed_phy_status*); - -}; +/* we need to track the allocated pointers in order to free them on exit */ +static struct fixed_info *fixed_phy_ptrs[CONFIG_FIXED_MII_AMNT*MAX_PHY_AMNT]; /*- * If something weird is required to be done with link/speed, * network driver is able to assign a function to implement this. * May be useful for PHY's that need to be software-driven. *-*/ -int fixed_mdio_set_link_update(struct phy_device* phydev, - int(*link_update)(struct net_device*, struct fixed_phy_status*)) +int fixed_mdio_set_link_update(struct phy_device *phydev, + int (*link_update) (struct net_device *, + struct fixed_phy_status *)) { struct fixed_info *fixed; - if(link_update == NULL) + if (link_update == NULL) return -EINVAL; - if(phydev) { - if(phydev->bus) { + if (phydev) { + if (phydev->bus) { fixed = phydev->bus->priv; fixed->link_update = link_update; return 0; @@ -84,54 +62,64 @@ int fixed_mdio_set_link_update(struct phy_device* phydev, } return -EINVAL; } + EXPORT_SYMBOL(fixed_mdio_set_link_update); +struct fixed_info *fixed_mdio_get_phydev (int phydev_ind) +{ + if (phydev_ind >= MAX_PHY_AMNT) + return NULL; + return fixed_phy_ptrs[phydev_ind]; +} + +EXPORT_SYMBOL(fixed_mdio_get_phydev); + /*- * This is used for updating internal mii regs from the status *
[PATCH] PHY fixed driver: rework release path and update phy_id notation
device_bind_driver() error code returning has been fixed. release() function has been written, so that to free resources in correct way; the release path is now clean. Before the rework, it used to cause Device '[EMAIL PROTECTED]:1' does not have a release() function, it is broken and must be fixed. BUG: at drivers/base/core.c:104 device_release() Call Trace: [] kobject_cleanup+0x53/0x7e [] kobject_release+0x0/0x9 [] kref_put+0x74/0x81 [] fixed_mdio_register_device+0x230/0x265 [] fixed_init+0x1f/0x35 [] init+0x147/0x2fb [] schedule_tail+0x36/0x92 [] child_rip+0xa/0x12 [] acpi_ds_init_one_object+0x0/0x83 [] init+0x0/0x2fb [] child_rip+0x0/0x12 Also changed the notation of the fixed phy definition on mdio bus to the form of + to make it able to be used by gianfar and ucc_geth that define phy_id strictly as "%d:%d" Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/net/phy/Kconfig |4 ++ drivers/net/phy/fixed.c | 93 +++ 2 files changed, 57 insertions(+), 40 deletions(-) diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 09b6f25..a938c48 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -71,4 +71,8 @@ config FIXED_MII_100_FDX bool "Emulation for 100M Fdx fixed PHY behavior" depends on FIXED_PHY +config FIXED_MII_1000_FDX + bool "Emulation for 1000M Fdx fixed PHY behavior" + depends on FIXED_PHY + endif # PHYLIB diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 68c99b4..34b9111 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -187,12 +187,29 @@ static struct phy_driver fixed_mdio_driver = { .driver = { .owner = THIS_MODULE,}, }; +static void fixed_mdio_release (struct device * dev) +{ + struct phy_device *phydev = container_of(dev, struct phy_device, dev); + struct mii_bus *bus = phydev->bus; + struct fixed_info *fixed = bus->priv; + + kfree(phydev); + kfree(bus->dev); + kfree(bus); + kfree(fixed->regs); + kfree(fixed); +} + /*- * This func is used to create all the necessary stuff, bind * the fixed phy driver and register all it on the mdio_bus_type. - * speed is either 10 or 100, duplex is boolean. + * speed is either 10 or 100 or 1000, duplex is boolean. * number is used to create multiple fixed PHYs, so that several devices can * utilize them simultaneously. + * + * The device on mdio bus will look like :, + * bus_id = number + * phy_id = speed+duplex. *-*/ static int fixed_mdio_register_device(int number, int speed, int duplex) { @@ -221,6 +238,12 @@ static int fixed_mdio_register_device(int number, int speed, int duplex) } fixed->regs = kzalloc(MII_REGS_NUM*sizeof(int), GFP_KERNEL); + if (NULL == fixed->regs) { + kfree(dev); + kfree(new_bus); + kfree(fixed); + return -ENOMEM; + } fixed->regs_num = MII_REGS_NUM; fixed->phy_status.speed = speed; fixed->phy_status.duplex = duplex; @@ -249,57 +272,43 @@ static int fixed_mdio_register_device(int number, int speed, int duplex) fixed->phydev = phydev; if(NULL == phydev) { - err = -ENOMEM; - goto device_create_fail; + kfree(dev); + kfree(new_bus); + kfree(fixed->regs); + kfree(fixed); + return -ENOMEM; } phydev->irq = PHY_IGNORE_INTERRUPT; phydev->dev.bus = &mdio_bus_type; - if(number) - snprintf(phydev->dev.bus_id, BUS_ID_SIZE, - "[EMAIL PROTECTED]:%d", number, speed, duplex); - else - snprintf(phydev->dev.bus_id, BUS_ID_SIZE, - "[EMAIL PROTECTED]:%d", speed, duplex); + snprintf(phydev->dev.bus_id, BUS_ID_SIZE, + "%d:%d", number, speed + duplex); + phydev->bus = new_bus; + phydev->dev.driver = &fixed_mdio_driver.driver; + phydev->dev.release = fixed_mdio_release; + + err = phydev->dev.driver->probe(&phydev->dev); + if(err < 0) { + printk(KERN_ERR "Phy %s: problems with fixed driver\n", + phydev->dev.bus_id); + kfree(phydev); + kfree(dev); + kfree(new_bus); + kfree(fixed->regs); +
[PATCH] PHY fixed driver: rework release path and update phy_id notation
device_bind_driver() error code returning has been fixed. release() function has been written, so that to free resources in correct way; the release path is now clean. Before the rework, it used to cause Device '[EMAIL PROTECTED]:1' does not have a release() function, it is broken and must be fixed. BUG: at drivers/base/core.c:104 device_release() Call Trace: [] kobject_cleanup+0x53/0x7e [] kobject_release+0x0/0x9 [] kref_put+0x74/0x81 [] fixed_mdio_register_device+0x230/0x265 [] fixed_init+0x1f/0x35 [] init+0x147/0x2fb [] schedule_tail+0x36/0x92 [] child_rip+0xa/0x12 [] acpi_ds_init_one_object+0x0/0x83 [] init+0x0/0x2fb [] child_rip+0x0/0x12 Also changed the notation of the fixed phy definition on mdio bus to the form of + to make it able to be used by gianfar and ucc_geth that define phy_id strictly as "%d:%d" Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/net/phy/Kconfig |4 ++ drivers/net/phy/fixed.c | 93 +++ 2 files changed, 57 insertions(+), 40 deletions(-) diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 09b6f25..a938c48 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -71,4 +71,8 @@ config FIXED_MII_100_FDX bool "Emulation for 100M Fdx fixed PHY behavior" depends on FIXED_PHY +config FIXED_MII_1000_FDX + bool "Emulation for 1000M Fdx fixed PHY behavior" + depends on FIXED_PHY + endif # PHYLIB diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 68c99b4..34b9111 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -187,12 +187,29 @@ static struct phy_driver fixed_mdio_driver = { .driver = { .owner = THIS_MODULE,}, }; +static void fixed_mdio_release (struct device * dev) +{ + struct phy_device *phydev = container_of(dev, struct phy_device, dev); + struct mii_bus *bus = phydev->bus; + struct fixed_info *fixed = bus->priv; + + kfree(phydev); + kfree(bus->dev); + kfree(bus); + kfree(fixed->regs); + kfree(fixed); +} + /*- * This func is used to create all the necessary stuff, bind * the fixed phy driver and register all it on the mdio_bus_type. - * speed is either 10 or 100, duplex is boolean. + * speed is either 10 or 100 or 1000, duplex is boolean. * number is used to create multiple fixed PHYs, so that several devices can * utilize them simultaneously. + * + * The device on mdio bus will look like :, + * bus_id = number + * phy_id = speed+duplex. *-*/ static int fixed_mdio_register_device(int number, int speed, int duplex) { @@ -221,6 +238,12 @@ static int fixed_mdio_register_device(int number, int speed, int duplex) } fixed->regs = kzalloc(MII_REGS_NUM*sizeof(int), GFP_KERNEL); + if (NULL == fixed->regs) { + kfree(dev); + kfree(new_bus); + kfree(fixed); + return -ENOMEM; + } fixed->regs_num = MII_REGS_NUM; fixed->phy_status.speed = speed; fixed->phy_status.duplex = duplex; @@ -249,57 +272,43 @@ static int fixed_mdio_register_device(int number, int speed, int duplex) fixed->phydev = phydev; if(NULL == phydev) { - err = -ENOMEM; - goto device_create_fail; + kfree(dev); + kfree(new_bus); + kfree(fixed->regs); + kfree(fixed); + return -ENOMEM; } phydev->irq = PHY_IGNORE_INTERRUPT; phydev->dev.bus = &mdio_bus_type; - if(number) - snprintf(phydev->dev.bus_id, BUS_ID_SIZE, - "[EMAIL PROTECTED]:%d", number, speed, duplex); - else - snprintf(phydev->dev.bus_id, BUS_ID_SIZE, - "[EMAIL PROTECTED]:%d", speed, duplex); + snprintf(phydev->dev.bus_id, BUS_ID_SIZE, + "%d:%d", number, speed + duplex); + phydev->bus = new_bus; + phydev->dev.driver = &fixed_mdio_driver.driver; + phydev->dev.release = fixed_mdio_release; + + err = phydev->dev.driver->probe(&phydev->dev); + if(err < 0) { + printk(KERN_ERR "Phy %s: problems with fixed driver\n", + phydev->dev.bus_id); + kfree(phydev); + kfree(dev); + kfree(new_bus); + kfree(fixed->regs); + kfree(fixed); + return err; + } + err = device_register(&phydev->dev); if(err) { pr
Re: STRANGE ERROR
On Sat, May 19, 2007 at 16:34 -0700, Andrew Morton wrote: > On Sun, 20 May 2007 00:30:55 +0200 "Sasa Ostrouska" <[EMAIL PROTECTED]> wrote: > > > Hi everybody, > > > > I tried today to upgrade the kernel to 2.6.21.1 and i got the same > > error during the boot time. > > Here is the dmesg of the 2.6.20.2, can somebody tell me what this is ? > > > > ... > > > > Marvell 88E1101: Registered new driver > > Fixed PHY: Registered new driver > > driver_bound: device [EMAIL PROTECTED]:1 already bound > > I don't know what caused that one. > this is because of issue in fixed phy driver initialisation - have a patch but need to test it a bit more. > > Device '[EMAIL PROTECTED]:1' does not have a release() function, it is > > broken > > and must be fixed. > > BUG: at drivers/base/core.c:104 device_release() > > > > Call Trace: > > [] kobject_cleanup+0x53/0x7e > > [] kobject_release+0x0/0x9 > > [] kref_put+0x74/0x81 > > [] fixed_mdio_register_device+0x230/0x265 > > [] fixed_init+0x1f/0x35 > > [] init+0x147/0x2fb > > [] schedule_tail+0x36/0x92 > > [] child_rip+0xa/0x12 > > [] acpi_ds_init_one_object+0x0/0x83 > > [] init+0x0/0x2fb > > [] child_rip+0x0/0x12 > > This appears to have happened because fixed_mdio_register_device() (or > phy_device_create) didn't suitably initialise phy_device.dev. > > But I don't immediately see why this doesn't affect all phy drivers. > Presumably it's the fixed driver which is at fault. Jeff, how is this > supposed to work? > the fixed phy used to have "specific" bus bound stuff but I've reworked this point. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH][RFC][POWERPC] i2c: adds support for i2c bus on 8xx
Utilized devicetree to store I2C data, ported i2c-algo-8xx.c from 2.4 approach(which remains nearly intact), refined i2c-rpx.c. I2C functionality has been validated on mpc885ads with EEPROM access. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- Jean, The patch below may have rough edges but I'd appreciate you to take a look. It adds I2C capabilities of PQ series (mpc8xx mostly) or, more correctly, takes them off from the 2.4 kernel and makes it work. Validated with quilt tree residing at http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/ arch/powerpc/boot/dts/mpc885ads.dts |7 arch/powerpc/platforms/8xx/mpc885ads_setup.c | 14 + arch/powerpc/sysdev/fsl_soc.c| 61 +++ drivers/i2c/algos/Kconfig|2 drivers/i2c/algos/Makefile |1 drivers/i2c/algos/i2c-algo-8xx.c | 622 ++ drivers/i2c/busses/Kconfig |4 drivers/i2c/busses/i2c-rpx.c | 129 - include/linux/i2c-algo-8xx.h | 29 + 9 files changed, 822 insertions(+), 47 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts index 19d2d79..90e047a 100644 --- a/arch/powerpc/boot/dts/mpc885ads.dts +++ b/arch/powerpc/boot/dts/mpc885ads.dts @@ -188,6 +188,13 @@ interrupts = <1d 3>; interrupt-parent = <930>; }; + [EMAIL PROTECTED] { + device_type = "i2c"; + compatible = "fsl-i2c-cpm"; + reg = <860 20 3c80 30>; + interrupts = <10 3>; + interrupt-parent = <930>; + }; }; }; }; diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index 9bd81c7..d32e066 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -51,6 +51,7 @@ static void init_smc1_uart_ioports(struc static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); static void init_scc3_ioports(struct fs_platform_info* ptr); static void init_irda_ioports(void); +static void init_i2c_ioports(void); void __init mpc885ads_board_setup(void) { @@ -120,6 +121,10 @@ #endif #ifdef CONFIG_8XX_SIR init_irda_ioports(); #endif + +#ifdef CONFIG_I2C_RPXLITE + init_i2c_ioports(); +#endif } @@ -361,6 +366,15 @@ static void init_irda_ioports() immr_unmap(cp); } +static void init_i2c_ioports() +{ + cpm8xx_t *cp = (cpm8xx_t *)immr_map(im_cpm); + +setbits32(&cp->cp_pbpar, 0x0030); +setbits32(&cp->cp_pbdir, 0x0030); +setbits16(&cp->cp_pbodr, 0x0030); +} + int platform_device_skip(const char *model, int id) { #ifdef CONFIG_MPC8xx_SECOND_ETH_SCC3 diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 419b688..7ecd537 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -331,7 +331,7 @@ static int __init fsl_i2c_of_init(void) for (np = NULL, i = 0; (np = of_find_compatible_node(np, "i2c", "fsl-i2c")) != NULL; i++) { - struct resource r[2]; + struct resource r[3]; struct fsl_i2c_platform_data i2c_data; const unsigned char *flags = NULL; @@ -1215,4 +1215,63 @@ err: arch_initcall(fs_irda_of_init); +static const char *i2c_regs = "regs"; +static const char *i2c_pram = "pram"; +static const char *i2c_irq = "interrupt"; + +static int __init fsl_i2c_cpm_of_init(void) +{ + struct device_node *np; + unsigned int i; + struct platform_device *i2c_dev; + int ret; + + for (np = NULL, i = 0; +(np = of_find_compatible_node(np, "i2c", "fsl-i2c-cpm")) != NULL; +i++) { + struct resource r[3]; + struct fsl_i2c_platform_data i2c_data; + + memset(&r, 0, sizeof(r)); + memset(&i2c_data, 0, sizeof(i2c_data)); + + ret = of_address_to_resource(np, 0, &r[0]); + if (ret) + goto err; + r[0].name = i2c_regs; + + ret = of_address_to_resource(np, 1, &r[1]); + if (ret) + goto err; + r[1].name = i2c_pram; + + r[2].start = r[2].end = irq_of_parse_and_map(np, 0); + r[2].flags = IORESOURCE_IRQ; + r[2].name = i2c_irq; + + i2c_dev = platform_device_register_simple("fsl-i2c-cpm", i, &r[0], 3); + if (IS_ER
Re: [PATCH][RFC] i2c: adds support for i2c bus on 8xx
On Sat, 21 Apr 2007 09:57:07 +0200 Jean Delvare wrote: > Hi Vitaly, > > On Fri, 20 Apr 2007 08:27:14 +0400, Vitaly Bordug wrote: > > Utilized devicetree to store I2C data, ported i2c-algo-8xx.c > > from 2.4 approach(which remains nearly intact), refined i2c-rpx.c. > > I2C functionality has been validated on mpc885ads with EEPROM > > access. > > Thanks for working on this. I was about to kill i2c-rpx because it's > broken for so long: > http://lists.lm-sensors.org/pipermail/i2c/2007-March/000970.html > Noticed this :) > > Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> > > --- > > Jean, > > > > The patch below may have rough edges but I'd appreciate you to take > > a look. It adds I2C capabilities of PQ series (mpc8xx mostly) or, > > more correctly, takes them off from the 2.4 kernel and makes it > > work. > > OK. I can't comment on the platform-specific part I am not familiar > with, but here's a quick review of the rest. > > > Validated with quilt tree residing at > > http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/ > > > > > > arch/powerpc/boot/dts/mpc885ads.dts |7 > > arch/powerpc/platforms/8xx/mpc885ads_setup.c | 14 + > > arch/powerpc/sysdev/fsl_soc.c| 61 +++ > > drivers/i2c/algos/Kconfig|2 > > drivers/i2c/algos/Makefile |1 > > drivers/i2c/algos/i2c-algo-8xx.c | 622 > > ++ > > drivers/i2c/busses/Kconfig |4 > > drivers/i2c/busses/i2c-rpx.c | 129 - > > include/linux/i2c-algo-8xx.h | 29 + 9 files > > changed, 822 insertions(+), 47 deletions(-) > > I wonder what's the point of having a separate i2c algorithm driver. > We don't expect any other driver than i2c-rpx to ever use it, do we? > In that case, all the code should be added to i2c-rpx directly, this > will makes things more simple and more efficient. > That is how it was back in 2.4 - if you see combine is a good move, I'm OK with it. But what shouldn't be rpc then - basically rpx(lite) is 8xx-based target, so let's call it all mpc8xx then. > > diff --git a/arch/powerpc/boot/dts/mpc885ads.dts > > b/arch/powerpc/boot/dts/mpc885ads.dts index 19d2d79..90e047a 100644 > > --- a/arch/powerpc/boot/dts/mpc885ads.dts > > +++ b/arch/powerpc/boot/dts/mpc885ads.dts > > @@ -188,6 +188,13 @@ > > interrupts = <1d 3>; > > interrupt-parent = <930>; > > }; > > + [EMAIL PROTECTED] { > > + device_type = "i2c"; > > + compatible = "fsl-i2c-cpm"; > > + reg = <860 20 3c80 30>; > > + interrupts = <10 3>; > > + interrupt-parent = <930>; > > + }; > > }; > > }; > > }; > > diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c > > b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index > > 9bd81c7..d32e066 100644 --- > > a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ > > b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -51,6 +51,7 @@ > > static void init_smc1_uart_ioports(struc static void > > init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); static > > void init_scc3_ioports(struct fs_platform_info* ptr); static void > > init_irda_ioports(void); +static void init_i2c_ioports(void); > > > > void __init mpc885ads_board_setup(void) > > { > > @@ -120,6 +121,10 @@ #endif > > #ifdef CONFIG_8XX_SIR > > init_irda_ioports(); > > #endif > > + > > +#ifdef CONFIG_I2C_RPXLITE > > + init_i2c_ioports(); > > +#endif > > } > > > > > > @@ -361,6 +366,15 @@ static void init_irda_ioports() > > immr_unmap(cp); > > } > > > > +static void init_i2c_ioports() > > +{ > > + cpm8xx_t *cp = (cpm8xx_t *)immr_map(im_cpm); > > + > > +setbits32(&cp->cp_pbpar, 0x0030); > > +setbits32(&cp->cp_pbdir, 0x0030); > > +setbits16(&cp->cp_pbodr, 0x0030); > > +} > > If !CONFIG_I2C_RPXLITE, you define a static function which you never > use. This is inefficient, and gcc will complain. > yap, this one is board-specific anyway, will fix. > > + > > int platform_device_skip(const char *model, int id) >
Fw: [PATCH][RFC] PCMCIA support for 8xx using platform devices
This utilizes PCMCIA on mpc885ads and mpc866ads from arch/powerpc. In the new approach, direct IMMR accesses from within drivers/ were totally eliminated, that requires hardware_enable, hardware_disable, voltage_set board-specific functions to be moved over to BSP code section (arch/powerpc/platforms/8xx in 885 case). There is just no way to have both arch/ppc and arch/powerpc approaches to work simultaneously because of that. It implies a bit of work to move other target's bits over to BSP region, but no ifdef hell worths it, in addition to the fact of being moved/merged to arch/powerpc, the code would spot this problem anyway. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- This is FW of original message sent to [EMAIL PROTECTED] to attach wider audience. Original maillist kept in loop to prevent misunderstanding... arch/powerpc/boot/dts/mpc885ads.dts | 12 + arch/powerpc/platforms/8xx/mpc885ads.h |5 arch/powerpc/platforms/8xx/mpc885ads_setup.c | 63 + arch/powerpc/sysdev/fsl_soc.c| 58 drivers/pcmcia/Kconfig |1 drivers/pcmcia/m8xx_pcmcia.c | 342 -- include/linux/fs_pcmcia_pd.h | 27 ++ 7 files changed, 318 insertions(+), 190 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts index 90e047a..330ac91 100644 --- a/arch/powerpc/boot/dts/mpc885ads.dts +++ b/arch/powerpc/boot/dts/mpc885ads.dts @@ -112,6 +112,18 @@ compatible = "CPM"; }; + [EMAIL PROTECTED] { + linux,phandle = <0080>; + #interrupt-cells = <1>; + #size-cells = <2>; + compatible = "8xx"; + device_type = "pcmcia"; + reg = <80 80>; + clock-frequency = <2faf080>; + interrupt-parent = ; + interrupts = ; + }; + [EMAIL PROTECTED] { linux,phandle = ; #address-cells = <1>; diff --git a/arch/powerpc/platforms/8xx/mpc885ads.h b/arch/powerpc/platforms/8xx/mpc885ads.h index 7c31aec..4439346 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads.h +++ b/arch/powerpc/platforms/8xx/mpc885ads.h @@ -91,5 +91,10 @@ #define PC_ENET_RENA ((ushort)0x0800) #define SICR_ENET_MASK ((uint)0x00ff) #define SICR_ENET_CLKRT((uint)0x002c) +/* Some internal interrupt registers use an 8-bit mask for the interrupt + * level instead of a number. + */ +#define mk_int_int_mask(IL) (1 << (7 - (IL/2))) + #endif /* __ASM_MPC885ADS_H__ */ #endif /* __KERNEL__ */ diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index 394f983..1ba423f 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -375,6 +376,68 @@ static void init_i2c_ioports() setbits16(&cp->cp_pbodr, 0x0030); } +void pcmcia_hw_setup(int slot, int enable) +{ + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + if (enable) + clrbits32(bcsr_io, BCSR1_PCCEN); + else + setbits32(bcsr_io, BCSR1_PCCEN); + + iounmap(bcsr_io); +} + +int pcmcia_set_voltage(int slot, int vcc, int vpp) +{ +u32 reg = 0; +unsigned *bcsr_io; + +bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + +switch(vcc) { +case 0: +break; +case 33: +reg |= BCSR1_PCCVCC0; +break; +case 50: +reg |= BCSR1_PCCVCC1; +break; +default: +return 1; +} + +switch(vpp) { +case 0: +break; +case 33: +case 50: +if(vcc == vpp) +reg |= BCSR1_PCCVPP1; +else +return 1; +break; +case 120: +if ((vcc == 33) || (vcc == 50)) +reg |= BCSR1_PCCVPP0; +else +return 1; +default: +return 1; +} + +/* first, turn off all power */ +clrbits32(bcsr_io, 0x0061); + +/* enable new powersettings */ +setbits32(bcsr_io, reg); + +iounmap(bcsr_io); +return 0; +} + int platform_device_skip(char *model, int id)
Re: [PATCH][RFC] PCMCIA support for 8xx using platform devices
On Sun, 22 Apr 2007 23:49:41 +0200 Arnd Bergmann wrote: > On Sunday 22 April 2007, Vitaly Bordug wrote: > > This utilizes PCMCIA on mpc885ads and mpc866ads from arch/powerpc. > > In the new approach, direct IMMR accesses from within drivers/ were > > totally eliminated, that requires hardware_enable, > > hardware_disable, voltage_set board-specific functions to be moved > > over to BSP code section (arch/powerpc/platforms/8xx in 885 case). > > There is just no way to have both arch/ppc and arch/powerpc > > approaches to work simultaneously because of that. > > Maybe I'm missing a key issue here, but what's the point of adding > more platform_devices for stuff that is already in the device tree? > Shouldn't this be made an of_platform_driver instead so you can > use the existing of_device directly? > Was thinking of it but platform_device is better for migration purposes. Hence, assuming somebody would want to have pcmcia working not bothering to add whole arch/powerpc support, it can be accomplished quickly. OTOH, further change from pd to of_device is not hard as well. So far, most ppc stuff (if not all) still existing both in ppc/ and powerpc/ paths, and to keep consistency platform_devices are used here and there. So, with pd approach arch/ppc/ boards are encouraged to get source device/driver bus ready, hereby simplifying transition to of_device later. With current bootwrapper activities it may happen sooner, but there are many places in kernel nobody want to move for almost zero value.. -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [POWERPC] 8xx: mpc885ads pcmcia support
Adds support for PowerQuicc on-chip PCMCIA. The driver is implemented as of_device, so only arch/powerpc stuff is capable to use it, which now implies only mpc885ads reference board. To cope with the code that should be hooked inside driver, but is really board specific (like set_voltage), global structure mpc8xx_pcmcia_ops holds necessary function pointers that are filled in the BSP code. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc885ads.dts | 12 + arch/powerpc/platforms/8xx/m8xx_setup.c |5 arch/powerpc/platforms/8xx/mpc885ads.h |5 arch/powerpc/platforms/8xx/mpc885ads_setup.c | 77 ++ arch/powerpc/sysdev/fsl_soc.c| 12 + drivers/pcmcia/Kconfig |1 drivers/pcmcia/m8xx_pcmcia.c | 352 -- include/linux/fsl_devices.h |5 8 files changed, 279 insertions(+), 190 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts index 110bf61..56a9f6a 100644 --- a/arch/powerpc/boot/dts/mpc885ads.dts +++ b/arch/powerpc/boot/dts/mpc885ads.dts @@ -112,6 +112,18 @@ compatible = "CPM"; }; + [EMAIL PROTECTED] { + linux,phandle = <0080>; + #interrupt-cells = <1>; + #size-cells = <2>; + compatible = "fsl,pq-pcmcia"; + device_type = "pcmcia"; + reg = <80 80>; + clock-frequency = <2faf080>; + interrupt-parent = ; + interrupts = ; + }; + [EMAIL PROTECTED] { linux,phandle = ; #address-cells = <1>; diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c index 0901dba..f169355 100644 --- a/arch/powerpc/platforms/8xx/m8xx_setup.c +++ b/arch/powerpc/platforms/8xx/m8xx_setup.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -49,6 +50,10 @@ #include "sysdev/mpc8xx_pic.h" +#ifdef CONFIG_PCMCIA_M8XX +struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops; +#endif + void m8xx_calibrate_decr(void); extern void m8xx_wdt_handler_install(bd_t *bp); extern int cpm_pic_init(void); diff --git a/arch/powerpc/platforms/8xx/mpc885ads.h b/arch/powerpc/platforms/8xx/mpc885ads.h index 7c31aec..4439346 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads.h +++ b/arch/powerpc/platforms/8xx/mpc885ads.h @@ -91,5 +91,10 @@ #define SICR_ENET_MASK ((uint)0x00ff) #define SICR_ENET_CLKRT((uint)0x002c) +/* Some internal interrupt registers use an 8-bit mask for the interrupt + * level instead of a number. + */ +#define mk_int_int_mask(IL) (1 << (7 - (IL/2))) + #endif /* __ASM_MPC885ADS_H__ */ #endif /* __KERNEL__ */ diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index a57b577..a339026 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -51,6 +52,12 @@ static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi); static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); static void init_scc3_ioports(struct fs_platform_info* ptr); +#ifdef CONFIG_PCMCIA_M8XX +extern struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops; +static void pcmcia_hw_setup(int slot, int enable); +static int pcmcia_set_voltage(int slot, int vcc, int vpp); +#endif + void __init mpc885ads_board_setup(void) { cpm8xx_t *cp; @@ -115,6 +122,12 @@ void __init mpc885ads_board_setup(void) immr_unmap(io_port); #endif + +#ifdef CONFIG_PCMCIA_M8XX + /*Set up board specific hook-ups*/ + m8xx_pcmcia_ops.hw_ctrl = pcmcia_hw_setup; + m8xx_pcmcia_ops.voltage_set = pcmcia_set_voltage; +#endif } @@ -322,6 +335,70 @@ void init_smc_ioports(struct fs_uart_platform_info *data) } } +#ifdef CONFIG_PCMCIA_M8XX +static void pcmcia_hw_setup(int slot, int enable) +{ + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + if (enable) + clrbits32(bcsr_io, BCSR1_PCCEN); + else + setbits32(bcsr_io, BCSR1_PCCEN); + + iounmap(bcsr_io); +} + +static int pcmcia_set_voltage(int slot, int vcc, int vpp) +{ +u32 reg = 0; +unsigned *bcsr_io; + +bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + +switch(vcc) { +case 0: +break; +case 33: +reg |= BCSR1_PCCVCC0; +
Re: [PATCH] [POWERPC] 8xx: mpc885ads pcmcia support
On Fri, 4 May 2007 12:35:43 -0700 Andrew Morton wrote: > On Fri, 04 May 2007 03:57:51 +0400 > Vitaly Bordug <[EMAIL PROTECTED]> wrote: > > > > > Adds support for PowerQuicc on-chip PCMCIA. The driver is > > implemented as of_device, so only arch/powerpc stuff is capable to > > use it, which now implies only mpc885ads reference board. > > > > To cope with the code that should be hooked inside driver, but is > > really board specific (like set_voltage), global structure > > mpc8xx_pcmcia_ops holds necessary function pointers that are filled > > in the BSP code. > > > > argh. > > akpm:/home/akpm> grep '^.*' x | wc -l > 72 > > please, Linux uses hard-tabs, not > spacespacespacespacespacespacespacespace everywhere. > Whoops. That must've survived being copypasted from the original m8xx_pcmcia.c. That reminds me to do Lindent on the affected sources but that is subject for another patch. Sorry for the hassle. Apparently all the issues were correct, and I'll follow-up with the reworked patch. Thanks for looking at it. -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [POWERPC] 8xx: mpc885ads pcmcia support
Adds support for PowerQuicc on-chip PCMCIA. The driver is implemented as of_device, so only arch/powerpc stuff is capable to use it, which now implies only mpc885ads reference board. To cope with the code that should be hooked inside driver, but is really board specific (like set_voltage), global structure mpc8xx_pcmcia_ops holds necessary function pointers that are filled in the BSP code. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> Acked-by: Arnd Bergmann <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc885ads.dts | 12 + arch/powerpc/platforms/8xx/m8xx_setup.c |5 arch/powerpc/platforms/8xx/mpc885ads.h |8 + arch/powerpc/platforms/8xx/mpc885ads_setup.c | 76 ++ arch/powerpc/sysdev/fsl_soc.c| 13 + arch/powerpc/sysdev/mpc8xx_pic.h |2 drivers/pcmcia/Kconfig |1 drivers/pcmcia/m8xx_pcmcia.c | 352 -- include/asm-powerpc/mpc8xx.h |4 include/linux/fsl_devices.h |5 10 files changed, 292 insertions(+), 186 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts index 110bf61..0f3e8cf 100644 --- a/arch/powerpc/boot/dts/mpc885ads.dts +++ b/arch/powerpc/boot/dts/mpc885ads.dts @@ -112,6 +112,18 @@ compatible = "CPM"; }; + [EMAIL PROTECTED] { + linux,phandle = <0080>; + #interrupt-cells = <1>; + #size-cells = <2>; + compatible = "fsl,pq-pcmcia"; + device_type = "pcmcia"; + reg = <80 80>; + clock-frequency = <2faf080>; + interrupt-parent = ; + interrupts = ; + }; + [EMAIL PROTECTED] { linux,phandle = ; #address-cells = <1>; diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c index 0901dba..f169355 100644 --- a/arch/powerpc/platforms/8xx/m8xx_setup.c +++ b/arch/powerpc/platforms/8xx/m8xx_setup.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -49,6 +50,10 @@ #include "sysdev/mpc8xx_pic.h" +#ifdef CONFIG_PCMCIA_M8XX +struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops; +#endif + void m8xx_calibrate_decr(void); extern void m8xx_wdt_handler_install(bd_t *bp); extern int cpm_pic_init(void); diff --git a/arch/powerpc/platforms/8xx/mpc885ads.h b/arch/powerpc/platforms/8xx/mpc885ads.h index 7c31aec..932b59a 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads.h +++ b/arch/powerpc/platforms/8xx/mpc885ads.h @@ -91,5 +91,13 @@ #define SICR_ENET_MASK ((uint)0x00ff) #define SICR_ENET_CLKRT((uint)0x002c) +/* + * Some internal interrupt registers use an 8-bit mask for the interrupt + * level instead of a number. + */ +static inline uint mk_int_int_mask(uint mask) { + return (1 << (7 - (mask/2))); +} + #endif /* __ASM_MPC885ADS_H__ */ #endif /* __KERNEL__ */ diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index a57b577..4e76e1c 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -51,6 +52,11 @@ static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi); static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); static void init_scc3_ioports(struct fs_platform_info* ptr); +#ifdef CONFIG_PCMCIA_M8XX +static void pcmcia_hw_setup(int slot, int enable); +static int pcmcia_set_voltage(int slot, int vcc, int vpp); +#endif + void __init mpc885ads_board_setup(void) { cpm8xx_t *cp; @@ -115,6 +121,12 @@ void __init mpc885ads_board_setup(void) immr_unmap(io_port); #endif + +#ifdef CONFIG_PCMCIA_M8XX + /*Set up board specific hook-ups*/ + m8xx_pcmcia_ops.hw_ctrl = pcmcia_hw_setup; + m8xx_pcmcia_ops.voltage_set = pcmcia_set_voltage; +#endif } @@ -322,6 +334,70 @@ void init_smc_ioports(struct fs_uart_platform_info *data) } } +#ifdef CONFIG_PCMCIA_M8XX +static void pcmcia_hw_setup(int slot, int enable) +{ + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + if (enable) + clrbits32(bcsr_io, BCSR1_PCCEN); + else + setbits32(bcsr_io, BCSR1_PCCEN); + + iounmap(bcsr_io); +} + +static int pcmcia_set_voltage(int slot, int vcc, int vpp) +{ + u32 reg = 0; + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + + switch(vcc) { + case 0: + break; + case 33: +
[PATCH 0/2] of_device 8xx PCMCIA support && cleanup
Current series features the reworked 8xx of_device PCMCIA patch based on feedback from Andrew + indentation & whitespace fixes in drivers/pcmcia/m8xx_pcmcia.c Andrew, Please disregard previous patch since it contains a typo. Indentation patch is not strictly necessary but is useful too, imho. -- -Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] [POWERPC] 8xx: mpc885ads pcmcia support
Adds support for PowerQuicc on-chip PCMCIA. The driver is implemented as of_device, so only arch/powerpc stuff is capable to use it, which now implies only mpc885ads reference board. To cope with the code that should be hooked inside driver, but is really board specific (like set_voltage), global structure mpc8xx_pcmcia_ops holds necessary function pointers that are filled in the BSP code. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> Acked-by: Arnd Bergmann <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc885ads.dts | 12 + arch/powerpc/platforms/8xx/m8xx_setup.c |5 arch/powerpc/platforms/8xx/mpc885ads.h |8 + arch/powerpc/platforms/8xx/mpc885ads_setup.c | 76 ++ arch/powerpc/sysdev/fsl_soc.c| 13 + arch/powerpc/sysdev/mpc8xx_pic.h |2 drivers/pcmcia/Kconfig |1 drivers/pcmcia/m8xx_pcmcia.c | 351 -- include/asm-powerpc/mpc8xx.h |4 include/linux/fsl_devices.h |5 10 files changed, 292 insertions(+), 185 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts index 110bf61..0f3e8cf 100644 --- a/arch/powerpc/boot/dts/mpc885ads.dts +++ b/arch/powerpc/boot/dts/mpc885ads.dts @@ -112,6 +112,18 @@ compatible = "CPM"; }; + [EMAIL PROTECTED] { + linux,phandle = <0080>; + #interrupt-cells = <1>; + #size-cells = <2>; + compatible = "fsl,pq-pcmcia"; + device_type = "pcmcia"; + reg = <80 80>; + clock-frequency = <2faf080>; + interrupt-parent = ; + interrupts = ; + }; + [EMAIL PROTECTED] { linux,phandle = ; #address-cells = <1>; diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c index 0901dba..f169355 100644 --- a/arch/powerpc/platforms/8xx/m8xx_setup.c +++ b/arch/powerpc/platforms/8xx/m8xx_setup.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -49,6 +50,10 @@ #include "sysdev/mpc8xx_pic.h" +#ifdef CONFIG_PCMCIA_M8XX +struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops; +#endif + void m8xx_calibrate_decr(void); extern void m8xx_wdt_handler_install(bd_t *bp); extern int cpm_pic_init(void); diff --git a/arch/powerpc/platforms/8xx/mpc885ads.h b/arch/powerpc/platforms/8xx/mpc885ads.h index 7c31aec..932b59a 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads.h +++ b/arch/powerpc/platforms/8xx/mpc885ads.h @@ -91,5 +91,13 @@ #define SICR_ENET_MASK ((uint)0x00ff) #define SICR_ENET_CLKRT((uint)0x002c) +/* + * Some internal interrupt registers use an 8-bit mask for the interrupt + * level instead of a number. + */ +static inline uint mk_int_int_mask(uint mask) { + return (1 << (7 - (mask/2))); +} + #endif /* __ASM_MPC885ADS_H__ */ #endif /* __KERNEL__ */ diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index a57b577..4e76e1c 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -51,6 +52,11 @@ static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi); static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); static void init_scc3_ioports(struct fs_platform_info* ptr); +#ifdef CONFIG_PCMCIA_M8XX +static void pcmcia_hw_setup(int slot, int enable); +static int pcmcia_set_voltage(int slot, int vcc, int vpp); +#endif + void __init mpc885ads_board_setup(void) { cpm8xx_t *cp; @@ -115,6 +121,12 @@ void __init mpc885ads_board_setup(void) immr_unmap(io_port); #endif + +#ifdef CONFIG_PCMCIA_M8XX + /*Set up board specific hook-ups*/ + m8xx_pcmcia_ops.hw_ctrl = pcmcia_hw_setup; + m8xx_pcmcia_ops.voltage_set = pcmcia_set_voltage; +#endif } @@ -322,6 +334,70 @@ void init_smc_ioports(struct fs_uart_platform_info *data) } } +#ifdef CONFIG_PCMCIA_M8XX +static void pcmcia_hw_setup(int slot, int enable) +{ + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + if (enable) + clrbits32(bcsr_io, BCSR1_PCCEN); + else + setbits32(bcsr_io, BCSR1_PCCEN); + + iounmap(bcsr_io); +} + +static int pcmcia_set_voltage(int slot, int vcc, int vpp) +{ + u32 reg = 0; + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + + switch(vcc) { + case 0: + break; + case 33: +
[PATCH 2/2] [POWERPC] 8xx: fix whitespace and indentation
Rolling forward PCMCIA driver, it was discovered that the indentation in existing one is very odd. This patch is just result of Lindent run ontop of culprit files. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/pcmcia/m8xx_pcmcia.c | 548 +- 1 files changed, 278 insertions(+), 270 deletions(-) diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index 40f6e20..79e14ab 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c @@ -113,7 +113,7 @@ MODULE_LICENSE("Dual MPL/GPL"); #define CONFIG_PCMCIA_SLOT_B #endif -#endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */ +#endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */ #if defined(CONFIG_PCMCIA_SLOT_A) && defined(CONFIG_PCMCIA_SLOT_B) @@ -146,9 +146,9 @@ MODULE_LICENSE("Dual MPL/GPL"); /* - */ -#define PCMCIA_MEM_WIN_BASE 0xe000 /* base address for memory window 0 */ -#define PCMCIA_MEM_WIN_SIZE 0x0400 /* each memory window is 64 MByte */ -#define PCMCIA_IO_WIN_BASE _IO_BASE /* base address for io window 0 */ +#define PCMCIA_MEM_WIN_BASE 0xe000 /* base address for memory window 0 */ +#define PCMCIA_MEM_WIN_SIZE 0x0400 /* each memory window is 64 MByte */ +#define PCMCIA_IO_WIN_BASE _IO_BASE /* base address for io window 0 */ /* - */ static int pcmcia_schlvl; @@ -169,8 +169,8 @@ static u32 *m8xx_pgcrx[2]; */ struct pcmcia_win { - u32 br; - u32 or; + u32 br; + u32 or; }; /* @@ -214,7 +214,7 @@ struct pcmcia_win { /* we keep one lookup table per socket to check flags */ -#define PCMCIA_EVENTS_MAX 5 /* 4 max at a time + termination */ +#define PCMCIA_EVENTS_MAX 5/* 4 max at a time + termination */ struct event_table { u32 regbit; @@ -224,8 +224,8 @@ struct event_table { static const char driver_name[] = "m8xx-pcmcia"; struct socket_info { - void(*handler)(void *info, u32 events); - void*info; + void (*handler) (void *info, u32 events); + void *info; u32 slot; pcmconf8xx_t *pcmcia; @@ -234,7 +234,7 @@ struct socket_info { socket_state_t state; struct pccard_mem_map mem_win[PCMCIA_MEM_WIN_NO]; - struct pccard_io_map io_win[PCMCIA_IO_WIN_NO]; + struct pccard_io_map io_win[PCMCIA_IO_WIN_NO]; struct event_table events[PCMCIA_EVENTS_MAX]; struct pcmcia_socket socket; }; @@ -248,8 +248,7 @@ static struct socket_info socket[PCMCIA_SOCKETS_NO]; #define M8XX_SIZES_NO 32 -static const u32 m8xx_size_to_gray[M8XX_SIZES_NO] = -{ +static const u32 m8xx_size_to_gray[M8XX_SIZES_NO] = { 0x0001, 0x0002, 0x0008, 0x0004, 0x0080, 0x0040, 0x0010, 0x0020, 0x8000, 0x4000, 0x1000, 0x2000, @@ -265,7 +264,7 @@ static const u32 m8xx_size_to_gray[M8XX_SIZES_NO] = static irqreturn_t m8xx_interrupt(int irq, void *dev); -#define PCMCIA_BMT_LIMIT (15*4) /* Bus Monitor Timeout value */ +#define PCMCIA_BMT_LIMIT (15*4)/* Bus Monitor Timeout value */ /* - */ /* board specific stuff: */ @@ -289,8 +288,9 @@ static int voltage_set(int slot, int vcc, int vpp) { u32 reg = 0; - switch(vcc) { - case 0: break; + switch (vcc) { + case 0: + break; case 33: reg |= BCSR1_PCVCTL4; break; @@ -301,11 +301,12 @@ static int voltage_set(int slot, int vcc, int vpp) return 1; } - switch(vpp) { - case 0: break; + switch (vpp) { + case 0: + break; case 33: case 50: - if(vcc == vpp) + if (vcc == vpp) reg |= BCSR1_PCVCTL6; else return 1; @@ -316,25 +317,29 @@ static int voltage_set(int slot, int vcc, int vpp) return 1; } - if(!((vcc == 50) || (vcc == 0))) + if (!((vcc == 50) || (vcc == 0))) return 1; /* first, turn off all power */ - out_be32(((u32 *)RPX_CSR_ADDR), in_be32(((u32 *)RPX_CSR_ADDR)) & ~(BCSR1_PCVCTL4 | BCSR1_PCVCTL5 | BCSR1_PCVCTL6 | BCSR1_PCVCTL7)); + out_be32(((u32 *) RPX_CSR_ADDR), +in_be32(((u32 *) RPX_CSR_ADDR)) & ~(BCSR1_PCVCTL4 | +BCSR1_PCVCTL5 | +BCSR1_PCVCTL6 | +BCSR1_PCVCTL7)
Re: [PATCH] [POWERPC] 8xx: mpc885ads pcmcia support
On Sun, 6 May 2007 03:04:14 +0200 Segher Boessenkool wrote: > > + [EMAIL PROTECTED] { > > > + #interrupt-cells = <1>; > > > + interrupt-parent = ; > > + interrupts = ; > > + }; > > Since this node's children's interrupt representation > is different from the node's parent's, you need an > interrupt-map in here. You also forgot "#address-cells" > and I think you need "ranges" too? > Well, in fact it does not introduce SoC device different from any others represented inside soc885 node. mk_int_int_mask() is just special way of enabling irq for PCMCIA stuff, in addition to normal pic stuff. Emm. Why would I need #address-cells and ranges here? it uses parent bus address space... -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [POWERPC] 8xx: mpc885ads pcmcia support
On Sun, 6 May 2007 12:04:27 +1000 David Gibson wrote: > On Sun, May 06, 2007 at 03:04:14AM +0200, Segher Boessenkool wrote: > > > + [EMAIL PROTECTED] { > > > > > + #interrupt-cells = <1>; > > > > > + interrupt-parent = ; > > > + interrupts = ; > > > + }; > > > > Since this node's children's interrupt representation > > is different from the node's parent's, you need an > > interrupt-map in here. You also forgot "#address-cells" > > and I think you need "ranges" too? > > And we should use a reference, instead of an implicit phandle for the > interrupt-parent. > I have one more patch for this - I think it makes sense to append it to the series... Thinking it would be better to do the phandles->labels transition in one step for all the relevant stuff in dts as well. -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [POWERPC] 8xx: PQ SoC IRDA support
Adds support of IRDA transceiver residing on PowerQUICC processors and enabling such on mpc885ads reference board. The driver is implemented using of_device concept, hereby implies arch/powerpc support of the target. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/Kconfig |1 arch/powerpc/boot/dts/mpc885ads.dts | 10 arch/powerpc/platforms/8xx/mpc885ads_setup.c | 39 + arch/powerpc/sysdev/fsl_soc.c| 58 ++ drivers/net/irda/Kconfig |4 drivers/net/irda/Makefile|1 drivers/net/irda/m8xx-sir.c | 715 ++ include/asm-ppc/commproc.h | 67 ++ 8 files changed, 895 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index a8e08f4..c283907 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -605,6 +605,7 @@ endmenu config ISA_DMA_API bool default y + depends on !PPC_8xx menu "Bus options" diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts index 110bf61..95b280c 100644 --- a/arch/powerpc/boot/dts/mpc885ads.dts +++ b/arch/powerpc/boot/dts/mpc885ads.dts @@ -178,6 +178,16 @@ interrupt-parent = <930>; phy-handle = ; }; + + [EMAIL PROTECTED] { + device_type = "network"; + compatible = "fsl,irda"; + model = "SCC"; + device-id = <2>; + reg = ; + interrupts = <1d 3>; + interrupt-parent = <930>; + }; }; }; }; diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index a57b577..8611318 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -50,6 +50,7 @@ extern unsigned int mpc8xx_get_irq(void); static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi); static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); static void init_scc3_ioports(struct fs_platform_info* ptr); +static void init_irda_ioports(void); void __init mpc885ads_board_setup(void) { @@ -115,6 +116,10 @@ void __init mpc885ads_board_setup(void) immr_unmap(io_port); #endif + +#ifdef CONFIG_8XX_SIR + init_irda_ioports(); +#endif } @@ -322,6 +327,40 @@ void init_smc_ioports(struct fs_uart_platform_info *data) } } +static void init_irda_ioports() +{ + iop8xx_t *io_port; + cpm8xx_t *cp; + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + + if (bcsr_io == NULL) { + printk(KERN_CRIT "Could not remap BCSR1\n"); + return; + } + + /* Enable the IRDA. */ + clrbits32(bcsr_io,BCSR1_IRDAEN); + iounmap(bcsr_io); + + io_port = (iop8xx_t *)immr_map(im_ioport); + cp = (cpm8xx_t *)immr_map(im_cpm); + + /* Configure port A pins. */ + setbits16(&io_port->iop_papar, 0x000c); + clrbits16(&io_port->iop_padir, 0x000c); + + /* Configure Serial Interface clock routing. +* First, clear all SCC bits to zero, then set the ones we want. +*/ + clrbits32(&cp->cp_sicr, 0xff00); + setbits32(&cp->cp_sicr, 0x1200); + + immr_unmap(io_port); + immr_unmap(cp); +} + int platform_device_skip(const char *model, int id) { #ifdef CONFIG_MPC8xx_SECOND_ETH_SCC3 diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 8a123c7..f827147 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -1102,4 +1102,62 @@ err: arch_initcall(cpm_smc_uart_of_init); +static const char *irda_regs = "regs"; +static const char *irda_pram = "pram"; +static const char *irda_irq = "interrupt"; +static char bus_id[9][BUS_ID_SIZE]; + +static int __init fs_irda_of_init(void) +{ + struct device_node *np; + unsigned int i; + struct platform_device *fs_irda_dev = NULL; + int ret; + + for (np = NULL, i = 0; +(np = of_find_compatible_node(np, "network", "fsl,irda")) != NULL; +i++) { + struct resource r[4]; + unsigned int *id; + char *model; + + memset(r, 0, sizeof(r)); + + model = (char *)get_property(np, "model", NULL); + if (model == NULL) + return -ENODEV; + + id = (u32 *) get_property(np, "device-id", NU
[PATCH 1/3] [POWERPC] 8xx: mpc885ads pcmcia support
Adds support for PowerQuicc on-chip PCMCIA. The driver is implemented as of_device, so only arch/powerpc stuff is capable to use it, which now implies only mpc885ads reference board. To cope with the code that should be hooked inside driver, but is really board specific (like set_voltage), global structure mpc8xx_pcmcia_ops holds necessary function pointers that are filled in the BSP code. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> Acked-by: Arnd Bergmann <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc885ads.dts | 13 + arch/powerpc/platforms/8xx/m8xx_setup.c |5 arch/powerpc/platforms/8xx/mpc885ads.h |8 + arch/powerpc/platforms/8xx/mpc885ads_setup.c | 76 ++ arch/powerpc/sysdev/fsl_soc.c| 13 + arch/powerpc/sysdev/mpc8xx_pic.h |2 drivers/pcmcia/Kconfig |1 drivers/pcmcia/m8xx_pcmcia.c | 351 -- include/asm-powerpc/mpc8xx.h |4 include/linux/fsl_devices.h |5 10 files changed, 293 insertions(+), 185 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts index 110bf61..9e937df 100644 --- a/arch/powerpc/boot/dts/mpc885ads.dts +++ b/arch/powerpc/boot/dts/mpc885ads.dts @@ -112,6 +112,19 @@ compatible = "CPM"; }; + [EMAIL PROTECTED] { + #address-cells = <3>; + #interrupt-cells = <1>; + #size-cells = <2>; + compatible = "fsl,pq-pcmcia"; + device_type = "pcmcia"; + reg = <80 80>; + ranges=<0>; + clock-frequency = <2faf080>; + interrupt-parent = <&mpc8xx-pic>; + interrupts = ; + }; + [EMAIL PROTECTED] { linux,phandle = ; #address-cells = <1>; diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c index 0901dba..f169355 100644 --- a/arch/powerpc/platforms/8xx/m8xx_setup.c +++ b/arch/powerpc/platforms/8xx/m8xx_setup.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -49,6 +50,10 @@ #include "sysdev/mpc8xx_pic.h" +#ifdef CONFIG_PCMCIA_M8XX +struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops; +#endif + void m8xx_calibrate_decr(void); extern void m8xx_wdt_handler_install(bd_t *bp); extern int cpm_pic_init(void); diff --git a/arch/powerpc/platforms/8xx/mpc885ads.h b/arch/powerpc/platforms/8xx/mpc885ads.h index 7c31aec..932b59a 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads.h +++ b/arch/powerpc/platforms/8xx/mpc885ads.h @@ -91,5 +91,13 @@ #define SICR_ENET_MASK ((uint)0x00ff) #define SICR_ENET_CLKRT((uint)0x002c) +/* + * Some internal interrupt registers use an 8-bit mask for the interrupt + * level instead of a number. + */ +static inline uint mk_int_int_mask(uint mask) { + return (1 << (7 - (mask/2))); +} + #endif /* __ASM_MPC885ADS_H__ */ #endif /* __KERNEL__ */ diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index a57b577..4e76e1c 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -51,6 +52,11 @@ static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi); static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); static void init_scc3_ioports(struct fs_platform_info* ptr); +#ifdef CONFIG_PCMCIA_M8XX +static void pcmcia_hw_setup(int slot, int enable); +static int pcmcia_set_voltage(int slot, int vcc, int vpp); +#endif + void __init mpc885ads_board_setup(void) { cpm8xx_t *cp; @@ -115,6 +121,12 @@ void __init mpc885ads_board_setup(void) immr_unmap(io_port); #endif + +#ifdef CONFIG_PCMCIA_M8XX + /*Set up board specific hook-ups*/ + m8xx_pcmcia_ops.hw_ctrl = pcmcia_hw_setup; + m8xx_pcmcia_ops.voltage_set = pcmcia_set_voltage; +#endif } @@ -322,6 +334,70 @@ void init_smc_ioports(struct fs_uart_platform_info *data) } } +#ifdef CONFIG_PCMCIA_M8XX +static void pcmcia_hw_setup(int slot, int enable) +{ + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + if (enable) + clrbits32(bcsr_io, BCSR1_PCCEN); + else + setbits32(bcsr_io, BCSR1_PCCEN); + + iounmap(bcsr_io); +} + +static int pcmcia_set_voltage(int slot, int vcc, int vpp) +{ + u32 reg = 0; + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + + switch(vcc) { +
[PATCH 3/3] [POWERPC] dts: kill hardcoded phandles
Removed explicit linux,phandle usage. Using references and labels now in PQ and PQ2 boards currently supported in arch/powerpc. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc8272ads.dts | 42 -- arch/powerpc/boot/dts/mpc866ads.dts | 31 + arch/powerpc/boot/dts/mpc885ads.dts |2 +- 3 files changed, 27 insertions(+), 48 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts b/arch/powerpc/boot/dts/mpc8272ads.dts index 423eedc..83461fe 100644 --- a/arch/powerpc/boot/dts/mpc8272ads.dts +++ b/arch/powerpc/boot/dts/mpc8272ads.dts @@ -14,12 +14,10 @@ compatible = "MPC8260ADS"; #address-cells = <1>; #size-cells = <1>; - linux,phandle = <100>; cpus { #address-cells = <1>; #size-cells = <0>; - linux,phandle = <200>; PowerPC,[EMAIL PROTECTED] { device_type = "cpu"; @@ -32,12 +30,10 @@ bus-frequency = <0>; clock-frequency = <0>; 32-bit; - linux,phandle = <201>; }; }; - [EMAIL PROTECTED] { - linux,phandle = ; + pci_pic:[EMAIL PROTECTED] { #address-cells = <0>; #interrupt-cells = <2>; interrupt-controller; @@ -47,15 +43,13 @@ }; memory { device_type = "memory"; - linux,phandle = <300>; reg = < 400 f450 0020>; }; chosen { name = "chosen"; linux,platform = <0>; - interrupt-controller = <10c00>; - linux,phandle = <400>; + interrupt-controller = <&cpm_pic>; }; [EMAIL PROTECTED] { @@ -70,20 +64,17 @@ device_type = "mdio"; compatible = "fs_enet"; reg = <0 0>; - linux,phandle = <24520>; #address-cells = <1>; #size-cells = <0>; - [EMAIL PROTECTED] { - linux,phandle = <2452000>; - interrupt-parent = <10c00>; + phy0:[EMAIL PROTECTED] { + interrupt-parent = <&cpm_pic>; interrupts = <17 4>; reg = <0>; bitbang = [ 12 12 13 02 02 01 ]; device_type = "ethernet-phy"; }; - [EMAIL PROTECTED] { - linux,phandle = <2452001>; - interrupt-parent = <10c00>; + phy1:[EMAIL PROTECTED] { + interrupt-parent = <&cpm_pic>; interrupts = <17 4>; bitbang = [ 12 12 13 02 02 01 ]; reg = <3>; @@ -101,8 +92,8 @@ reg = <11300 20 8400 100 11380 30>; mac-address = [ 00 11 2F 99 43 54 ]; interrupts = <20 2>; - interrupt-parent = <10c00>; - phy-handle = <2452000>; + interrupt-parent = <&cpm_pic>; + phy-handle = <&phy0>; rx-clock = <13>; tx-clock = <12>; }; @@ -115,14 +106,13 @@ reg = <11320 20 8500 100 113b0 30>; mac-address = [ 00 11 2F 99 44 54 ]; interrupts = <21 2>; - interrupt-parent = <10c00>; - phy-handle = <2452001>; + interrupt-parent = <&cpm_pic>; + phy-handle = <&phy1>; rx-clock = <17>; tx-clock = <18>; }; [EMAIL PROTECTED] { - linux,phandle = ; #address-cells = <1>; #size-cells = <1>; #interrupt-cells = <2>; @@ -142,7 +132,7 @@ reg = <11a00 20 8000 100>; current-speed = <1c200>; interrupts = <28
[PATCH 2/3] [POWERPC] 8xx: fix whitespace and indentation
Rolling forward PCMCIA driver, it was discovered that the indentation in existing one is very odd. This patch is just result of Lindent run ontop of culprit files. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/pcmcia/m8xx_pcmcia.c | 548 +- 1 files changed, 278 insertions(+), 270 deletions(-) diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index 40f6e20..79e14ab 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c @@ -113,7 +113,7 @@ MODULE_LICENSE("Dual MPL/GPL"); #define CONFIG_PCMCIA_SLOT_B #endif -#endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */ +#endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */ #if defined(CONFIG_PCMCIA_SLOT_A) && defined(CONFIG_PCMCIA_SLOT_B) @@ -146,9 +146,9 @@ MODULE_LICENSE("Dual MPL/GPL"); /* - */ -#define PCMCIA_MEM_WIN_BASE 0xe000 /* base address for memory window 0 */ -#define PCMCIA_MEM_WIN_SIZE 0x0400 /* each memory window is 64 MByte */ -#define PCMCIA_IO_WIN_BASE _IO_BASE /* base address for io window 0 */ +#define PCMCIA_MEM_WIN_BASE 0xe000 /* base address for memory window 0 */ +#define PCMCIA_MEM_WIN_SIZE 0x0400 /* each memory window is 64 MByte */ +#define PCMCIA_IO_WIN_BASE _IO_BASE /* base address for io window 0 */ /* - */ static int pcmcia_schlvl; @@ -169,8 +169,8 @@ static u32 *m8xx_pgcrx[2]; */ struct pcmcia_win { - u32 br; - u32 or; + u32 br; + u32 or; }; /* @@ -214,7 +214,7 @@ struct pcmcia_win { /* we keep one lookup table per socket to check flags */ -#define PCMCIA_EVENTS_MAX 5 /* 4 max at a time + termination */ +#define PCMCIA_EVENTS_MAX 5/* 4 max at a time + termination */ struct event_table { u32 regbit; @@ -224,8 +224,8 @@ struct event_table { static const char driver_name[] = "m8xx-pcmcia"; struct socket_info { - void(*handler)(void *info, u32 events); - void*info; + void (*handler) (void *info, u32 events); + void *info; u32 slot; pcmconf8xx_t *pcmcia; @@ -234,7 +234,7 @@ struct socket_info { socket_state_t state; struct pccard_mem_map mem_win[PCMCIA_MEM_WIN_NO]; - struct pccard_io_map io_win[PCMCIA_IO_WIN_NO]; + struct pccard_io_map io_win[PCMCIA_IO_WIN_NO]; struct event_table events[PCMCIA_EVENTS_MAX]; struct pcmcia_socket socket; }; @@ -248,8 +248,7 @@ static struct socket_info socket[PCMCIA_SOCKETS_NO]; #define M8XX_SIZES_NO 32 -static const u32 m8xx_size_to_gray[M8XX_SIZES_NO] = -{ +static const u32 m8xx_size_to_gray[M8XX_SIZES_NO] = { 0x0001, 0x0002, 0x0008, 0x0004, 0x0080, 0x0040, 0x0010, 0x0020, 0x8000, 0x4000, 0x1000, 0x2000, @@ -265,7 +264,7 @@ static const u32 m8xx_size_to_gray[M8XX_SIZES_NO] = static irqreturn_t m8xx_interrupt(int irq, void *dev); -#define PCMCIA_BMT_LIMIT (15*4) /* Bus Monitor Timeout value */ +#define PCMCIA_BMT_LIMIT (15*4)/* Bus Monitor Timeout value */ /* - */ /* board specific stuff: */ @@ -289,8 +288,9 @@ static int voltage_set(int slot, int vcc, int vpp) { u32 reg = 0; - switch(vcc) { - case 0: break; + switch (vcc) { + case 0: + break; case 33: reg |= BCSR1_PCVCTL4; break; @@ -301,11 +301,12 @@ static int voltage_set(int slot, int vcc, int vpp) return 1; } - switch(vpp) { - case 0: break; + switch (vpp) { + case 0: + break; case 33: case 50: - if(vcc == vpp) + if (vcc == vpp) reg |= BCSR1_PCVCTL6; else return 1; @@ -316,25 +317,29 @@ static int voltage_set(int slot, int vcc, int vpp) return 1; } - if(!((vcc == 50) || (vcc == 0))) + if (!((vcc == 50) || (vcc == 0))) return 1; /* first, turn off all power */ - out_be32(((u32 *)RPX_CSR_ADDR), in_be32(((u32 *)RPX_CSR_ADDR)) & ~(BCSR1_PCVCTL4 | BCSR1_PCVCTL5 | BCSR1_PCVCTL6 | BCSR1_PCVCTL7)); + out_be32(((u32 *) RPX_CSR_ADDR), +in_be32(((u32 *) RPX_CSR_ADDR)) & ~(BCSR1_PCVCTL4 | +BCSR1_PCVCTL5 | +BCSR1_PCVCTL6 | +BCSR1_PCVCTL7)
[PATCH] [POWERPC] i2c: adds support for i2c bus on 8xx
Utilized devicetree to store I2C data, ported i2c-algo-8xx.c from 2.4 approach(which remains nearly intact), refined i2c-rpx.c. I2C functionality has been validated on mpc885ads with EEPROM access. Interface has been reworked to of_device as well as other feedback addressed. Repeated start ability is missing from the implementation. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/platforms/8xx/mpc885ads_setup.c | 15 + arch/powerpc/sysdev/fsl_soc.c| 15 + drivers/i2c/algos/Kconfig|2 drivers/i2c/algos/Makefile |1 drivers/i2c/algos/i2c-algo-8xx.c | 520 ++ drivers/i2c/busses/Kconfig |2 drivers/i2c/busses/i2c-rpx.c | 143 +-- include/linux/i2c-algo-8xx.h | 29 + 8 files changed, 683 insertions(+), 44 deletions(-) diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index a57b577..40d12a2 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -51,6 +51,17 @@ static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi); static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); static void init_scc3_ioports(struct fs_platform_info* ptr); +#ifdef CONFIG_I2C_RPXLITE +static void init_i2c_ioports() +{ + cpm8xx_t *cp = (cpm8xx_t *)immr_map(im_cpm); + + setbits32(&cp->cp_pbpar, 0x0030); + setbits32(&cp->cp_pbdir, 0x0030); + setbits16(&cp->cp_pbodr, 0x0030); +} +#endif + void __init mpc885ads_board_setup(void) { cpm8xx_t *cp; @@ -115,6 +126,10 @@ void __init mpc885ads_board_setup(void) immr_unmap(io_port); #endif + +#ifdef CONFIG_I2C_RPXLITE + init_i2c_ioports(); +#endif } diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 8a123c7..be60db7 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -1102,4 +1103,18 @@ err: arch_initcall(cpm_smc_uart_of_init); +static int __init fsl_i2c_cpm_of_init(void) +{ + struct device_node *np = NULL; + /* +* Register all the devices which type is "i2c-cpm" +*/ + while ((np = of_find_compatible_node(np, "i2c", "fsl,i2c-cpm")) != NULL) + of_platform_device_create(np, "fsl-i2c-cpm", NULL); + return 0; +} + +arch_initcall(fsl_i2c_cpm_of_init); + + #endif /* CONFIG_8xx */ diff --git a/drivers/i2c/algos/Kconfig b/drivers/i2c/algos/Kconfig index af02034..11e37ff 100644 --- a/drivers/i2c/algos/Kconfig +++ b/drivers/i2c/algos/Kconfig @@ -41,6 +41,8 @@ config I2C_ALGOPCA config I2C_ALGO8XX tristate "MPC8xx CPM I2C interface" depends on 8xx && I2C + help + 8xx I2C Algorithm,supports the CPM I2C interface for mpc8xx CPUs. config I2C_ALGO_SGI tristate "I2C SGI interfaces" diff --git a/drivers/i2c/algos/Makefile b/drivers/i2c/algos/Makefile index cac1051..1bd3b37 100644 --- a/drivers/i2c/algos/Makefile +++ b/drivers/i2c/algos/Makefile @@ -6,6 +6,7 @@ obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o obj-$(CONFIG_I2C_ALGOPCF) += i2c-algo-pcf.o obj-$(CONFIG_I2C_ALGOPCA) += i2c-algo-pca.o obj-$(CONFIG_I2C_ALGO_SGI) += i2c-algo-sgi.o +obj-$(CONFIG_I2C_ALGO8XX) += i2c-algo-8xx.o ifeq ($(CONFIG_I2C_DEBUG_ALGO),y) EXTRA_CFLAGS += -DDEBUG diff --git a/drivers/i2c/algos/i2c-algo-8xx.c b/drivers/i2c/algos/i2c-algo-8xx.c new file mode 100644 index 000..01ffcee --- /dev/null +++ b/drivers/i2c/algos/i2c-algo-8xx.c @@ -0,0 +1,520 @@ +/* + * i2c-algo-8xx.c i2x driver algorithms for MPC8XX CPM + * Copyright (c) 1999 Dan Malek ([EMAIL PROTECTED]). + * +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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * moved into proper i2c interface; separated out platform specific + * parts into i2c-rpx.c + * Brad Parker ([EMAIL PROTECTED]) + * + * (C) 2007 Montavista Software, Inc. + * Vitaly Bordug <[EMAIL PROTECTED]> + */ + +#include +#include +#include +#include +#include +#include +#incl
Re: [PATCH 1/2] [POWERPC] 8xx: mpc885ads pcmcia support
On Mon, 7 May 2007 08:56:09 -0500 Olof Johansson wrote: > Hi, > > Some minor nitpicks below. Overall it looks good. > > > -Olof > > On Sun, May 06, 2007 at 05:26:33AM +0400, Vitaly Bordug wrote: > > @@ -322,6 +334,70 @@ void init_smc_ioports(struct > > fs_uart_platform_info *data) } > > } > > > > +#ifdef CONFIG_PCMCIA_M8XX > > +static void pcmcia_hw_setup(int slot, int enable) > > +{ > > + unsigned *bcsr_io; > > + > > + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); > > + if (enable) > > + clrbits32(bcsr_io, BCSR1_PCCEN); > > + else > > + setbits32(bcsr_io, BCSR1_PCCEN); > > + > > + iounmap(bcsr_io); > > +} > > If you move this (and next) function up, you don't have to do the > prototypes in the beginning of the file. One less #ifdef that way. > ok. > > + > > +static int pcmcia_set_voltage(int slot, int vcc, int vpp) > > +{ > > + u32 reg = 0; > > + unsigned *bcsr_io; > > + > > + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); > > + > > + switch(vcc) { > > + case 0: > > + break; > > + case 33: > > + reg |= BCSR1_PCCVCC0; > > + break; > > + case 50: > > + reg |= BCSR1_PCCVCC1; > > + break; > > + default: > > + return 1; > > + } > > + > > + switch(vpp) { > > + case 0: > > + break; > > + case 33: > > + case 50: > > + if(vcc == vpp) > > + reg |= BCSR1_PCCVPP1; > > + else > > + return 1; > > + break; > > + case 120: > > + if ((vcc == 33) || (vcc == 50)) > > + reg |= BCSR1_PCCVPP0; > > + else > > + return 1; > > + default: > > + return 1; > > + } > > + > > + /* first, turn off all power */ > > + clrbits32(bcsr_io, 0x0061); > > + > > + /* enable new powersettings */ > > + setbits32(bcsr_io, reg); > > + > > + iounmap(bcsr_io); > > + return 0; > > +} > > +#endif > > + > > int platform_device_skip(const char *model, int id) > > { > > #ifdef CONFIG_MPC8xx_SECOND_ETH_SCC3 > > diff --git a/arch/powerpc/sysdev/fsl_soc.c > > b/arch/powerpc/sysdev/fsl_soc.c index 8a123c7..880e45f 100644 > > --- a/arch/powerpc/sysdev/fsl_soc.c > > +++ b/arch/powerpc/sysdev/fsl_soc.c > > @@ -1028,6 +1028,19 @@ err: > > > > arch_initcall(fs_enet_of_init); > > > > +static int __init fsl_pcmcia_of_init(void) > > +{ > > + struct device_node *np = NULL; > > + /* > > +* Register all the devices which type is "pcmcia" > > +*/ > > + while ((np = of_find_compatible_node(np, > > + "pcmcia", "fsl,pq-pcmcia")) != NULL) > > + of_platform_device_create(np, > > "m8xx-pcmcia", NULL); > > Do you really need this now that you have the device table in the > driver? > Want to keep this one for now... > > + return 0; > > +} > > + > > +arch_initcall(fsl_pcmcia_of_init); > > > > static const char *smc_regs = "regs"; > > static const char *smc_pram = "pram"; > > diff --git a/arch/powerpc/sysdev/mpc8xx_pic.h > > b/arch/powerpc/sysdev/mpc8xx_pic.h index afa2ee6..07be061 100644 > > --- a/arch/powerpc/sysdev/mpc8xx_pic.h > > +++ b/arch/powerpc/sysdev/mpc8xx_pic.h > > @@ -4,7 +4,7 @@ > > #include > > #include > > > > -extern struct hw_interrupt_type mpc8xx_pic; > > +/*extern struct hw_interrupt_type mpc8xx_pic;*/ > > Take it out or leave it in, but don't comment it out, please > ok > > > > int mpc8xx_pic_init(void); > > unsigned int mpc8xx_get_irq(void); > > diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig > > index 35f8864..c3fd55d 100644 > > --- a/drivers/pcmcia/Kconfig > > +++ b/drivers/pcmcia/Kconfig > > @@ -183,6 +183,7 @@ config PCMCIA_M8XX > > tristate "MPC8xx PCMCIA support" > > depends on PCMCIA && PPC && 8xx > > select PCCARD_IODYN > > + select PCCARD_NONSTATIC > > I was going to say "whitespace!", but seems like this added line is > the only one that's actually using tabs. :-) (Yes, I saw 2/2 that > fixes this). > > > help > > Say Y here to include support for PowerPC 8xx series PCMCIA > > controller. -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] [POWERPC] dts: kill hardcoded phandles
Removed explicit linux,phandle usage. Using references and labels now in PQ and PQ2 boards currently supported in arch/powerpc. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc8272ads.dts | 42 +++- arch/powerpc/boot/dts/mpc866ads.dts | 31 --- arch/powerpc/boot/dts/mpc885ads.dts | 45 +- 3 files changed, 43 insertions(+), 75 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts b/arch/powerpc/boot/dts/mpc8272ads.dts index 423eedc..1934b80 100644 --- a/arch/powerpc/boot/dts/mpc8272ads.dts +++ b/arch/powerpc/boot/dts/mpc8272ads.dts @@ -14,12 +14,10 @@ compatible = "MPC8260ADS"; #address-cells = <1>; #size-cells = <1>; - linux,phandle = <100>; cpus { #address-cells = <1>; #size-cells = <0>; - linux,phandle = <200>; PowerPC,[EMAIL PROTECTED] { device_type = "cpu"; @@ -32,12 +30,10 @@ bus-frequency = <0>; clock-frequency = <0>; 32-bit; - linux,phandle = <201>; }; }; - [EMAIL PROTECTED] { - linux,phandle = ; + pci_pic: [EMAIL PROTECTED] { #address-cells = <0>; #interrupt-cells = <2>; interrupt-controller; @@ -47,15 +43,13 @@ }; memory { device_type = "memory"; - linux,phandle = <300>; reg = < 400 f450 0020>; }; chosen { name = "chosen"; linux,platform = <0>; - interrupt-controller = <10c00>; - linux,phandle = <400>; + interrupt-controller = <&Cpm_pic>; }; [EMAIL PROTECTED] { @@ -70,20 +64,17 @@ device_type = "mdio"; compatible = "fs_enet"; reg = <0 0>; - linux,phandle = <24520>; #address-cells = <1>; #size-cells = <0>; - [EMAIL PROTECTED] { - linux,phandle = <2452000>; - interrupt-parent = <10c00>; + phy0:[EMAIL PROTECTED] { + interrupt-parent = <&Cpm_pic>; interrupts = <17 4>; reg = <0>; bitbang = [ 12 12 13 02 02 01 ]; device_type = "ethernet-phy"; }; - [EMAIL PROTECTED] { - linux,phandle = <2452001>; - interrupt-parent = <10c00>; + phy1:[EMAIL PROTECTED] { + interrupt-parent = <&Cpm_pic>; interrupts = <17 4>; bitbang = [ 12 12 13 02 02 01 ]; reg = <3>; @@ -101,8 +92,8 @@ reg = <11300 20 8400 100 11380 30>; mac-address = [ 00 11 2F 99 43 54 ]; interrupts = <20 2>; - interrupt-parent = <10c00>; - phy-handle = <2452000>; + interrupt-parent = <&Cpm_pic>; + phy-handle = <&Phy0>; rx-clock = <13>; tx-clock = <12>; }; @@ -115,14 +106,13 @@ reg = <11320 20 8500 100 113b0 30>; mac-address = [ 00 11 2F 99 44 54 ]; interrupts = <21 2>; - interrupt-parent = <10c00>; - phy-handle = <2452001>; + interrupt-parent = <&Cpm_pic>; + phy-handle = <&Phy1>; rx-clock = <17>; tx-clock = <18>; }; [EMAIL PROTECTED] { - linux,phandle = ; #address-cells = <1>; #size-cells = <1>; #interrupt-cells = <2>; @@ -142,7 +132,7 @@ reg = <11a00 20 8000 100>; current-speed = <1c200>; interrupts = <28
[PATCH 2/3] [POWERPC] 8xx: fix whitespace and indentation
Rolling forward PCMCIA driver, it was discovered that the indentation in existing one is very odd. This patch is just result of Lindent run ontop of culprit files. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/pcmcia/m8xx_pcmcia.c | 548 +- 1 files changed, 278 insertions(+), 270 deletions(-) diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index 40f6e20..79e14ab 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c @@ -113,7 +113,7 @@ MODULE_LICENSE("Dual MPL/GPL"); #define CONFIG_PCMCIA_SLOT_B #endif -#endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */ +#endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */ #if defined(CONFIG_PCMCIA_SLOT_A) && defined(CONFIG_PCMCIA_SLOT_B) @@ -146,9 +146,9 @@ MODULE_LICENSE("Dual MPL/GPL"); /* - */ -#define PCMCIA_MEM_WIN_BASE 0xe000 /* base address for memory window 0 */ -#define PCMCIA_MEM_WIN_SIZE 0x0400 /* each memory window is 64 MByte */ -#define PCMCIA_IO_WIN_BASE _IO_BASE /* base address for io window 0 */ +#define PCMCIA_MEM_WIN_BASE 0xe000 /* base address for memory window 0 */ +#define PCMCIA_MEM_WIN_SIZE 0x0400 /* each memory window is 64 MByte */ +#define PCMCIA_IO_WIN_BASE _IO_BASE /* base address for io window 0 */ /* - */ static int pcmcia_schlvl; @@ -169,8 +169,8 @@ static u32 *m8xx_pgcrx[2]; */ struct pcmcia_win { - u32 br; - u32 or; + u32 br; + u32 or; }; /* @@ -214,7 +214,7 @@ struct pcmcia_win { /* we keep one lookup table per socket to check flags */ -#define PCMCIA_EVENTS_MAX 5 /* 4 max at a time + termination */ +#define PCMCIA_EVENTS_MAX 5/* 4 max at a time + termination */ struct event_table { u32 regbit; @@ -224,8 +224,8 @@ struct event_table { static const char driver_name[] = "m8xx-pcmcia"; struct socket_info { - void(*handler)(void *info, u32 events); - void*info; + void (*handler) (void *info, u32 events); + void *info; u32 slot; pcmconf8xx_t *pcmcia; @@ -234,7 +234,7 @@ struct socket_info { socket_state_t state; struct pccard_mem_map mem_win[PCMCIA_MEM_WIN_NO]; - struct pccard_io_map io_win[PCMCIA_IO_WIN_NO]; + struct pccard_io_map io_win[PCMCIA_IO_WIN_NO]; struct event_table events[PCMCIA_EVENTS_MAX]; struct pcmcia_socket socket; }; @@ -248,8 +248,7 @@ static struct socket_info socket[PCMCIA_SOCKETS_NO]; #define M8XX_SIZES_NO 32 -static const u32 m8xx_size_to_gray[M8XX_SIZES_NO] = -{ +static const u32 m8xx_size_to_gray[M8XX_SIZES_NO] = { 0x0001, 0x0002, 0x0008, 0x0004, 0x0080, 0x0040, 0x0010, 0x0020, 0x8000, 0x4000, 0x1000, 0x2000, @@ -265,7 +264,7 @@ static const u32 m8xx_size_to_gray[M8XX_SIZES_NO] = static irqreturn_t m8xx_interrupt(int irq, void *dev); -#define PCMCIA_BMT_LIMIT (15*4) /* Bus Monitor Timeout value */ +#define PCMCIA_BMT_LIMIT (15*4)/* Bus Monitor Timeout value */ /* - */ /* board specific stuff: */ @@ -289,8 +288,9 @@ static int voltage_set(int slot, int vcc, int vpp) { u32 reg = 0; - switch(vcc) { - case 0: break; + switch (vcc) { + case 0: + break; case 33: reg |= BCSR1_PCVCTL4; break; @@ -301,11 +301,12 @@ static int voltage_set(int slot, int vcc, int vpp) return 1; } - switch(vpp) { - case 0: break; + switch (vpp) { + case 0: + break; case 33: case 50: - if(vcc == vpp) + if (vcc == vpp) reg |= BCSR1_PCVCTL6; else return 1; @@ -316,25 +317,29 @@ static int voltage_set(int slot, int vcc, int vpp) return 1; } - if(!((vcc == 50) || (vcc == 0))) + if (!((vcc == 50) || (vcc == 0))) return 1; /* first, turn off all power */ - out_be32(((u32 *)RPX_CSR_ADDR), in_be32(((u32 *)RPX_CSR_ADDR)) & ~(BCSR1_PCVCTL4 | BCSR1_PCVCTL5 | BCSR1_PCVCTL6 | BCSR1_PCVCTL7)); + out_be32(((u32 *) RPX_CSR_ADDR), +in_be32(((u32 *) RPX_CSR_ADDR)) & ~(BCSR1_PCVCTL4 | +BCSR1_PCVCTL5 | +BCSR1_PCVCTL6 | +BCSR1_PCVCTL7)
[PATCH 1/3] [POWERPC] 8xx: mpc885ads pcmcia support
Adds support for PowerQuicc on-chip PCMCIA. The driver is implemented as of_device, so only arch/powerpc stuff is capable to use it, which now implies only mpc885ads reference board. To cope with the code that should be hooked inside driver, but is really board specific (like set_voltage), global structure mpc8xx_pcmcia_ops holds necessary function pointers that are filled in the BSP code. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> Acked-by: Arnd Bergmann <[EMAIL PROTECTED]> Acked-by: Olof Johansson <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc885ads.dts | 12 + arch/powerpc/platforms/8xx/m8xx_setup.c |5 arch/powerpc/platforms/8xx/mpc885ads.h |8 + arch/powerpc/platforms/8xx/mpc885ads_setup.c | 72 + arch/powerpc/sysdev/fsl_soc.c| 13 + arch/powerpc/sysdev/mpc8xx_pic.h |2 drivers/pcmcia/Kconfig |1 drivers/pcmcia/m8xx_pcmcia.c | 351 -- include/asm-powerpc/mpc8xx.h |4 include/linux/fsl_devices.h |5 10 files changed, 287 insertions(+), 186 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts index 110bf61..0786ac1 100644 --- a/arch/powerpc/boot/dts/mpc885ads.dts +++ b/arch/powerpc/boot/dts/mpc885ads.dts @@ -112,6 +112,18 @@ compatible = "CPM"; }; + [EMAIL PROTECTED] { + #address-cells = <3>; + #interrupt-cells = <1>; + #size-cells = <2>; + compatible = "fsl,pq-pcmcia"; + device_type = "pcmcia"; + reg = <80 80>; + clock-frequency = <2faf080>; + interrupt-parent = <&mpc8xx-pic>; + interrupts = ; + }; + [EMAIL PROTECTED] { linux,phandle = ; #address-cells = <1>; diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c index 0901dba..f169355 100644 --- a/arch/powerpc/platforms/8xx/m8xx_setup.c +++ b/arch/powerpc/platforms/8xx/m8xx_setup.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -49,6 +50,10 @@ #include "sysdev/mpc8xx_pic.h" +#ifdef CONFIG_PCMCIA_M8XX +struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops; +#endif + void m8xx_calibrate_decr(void); extern void m8xx_wdt_handler_install(bd_t *bp); extern int cpm_pic_init(void); diff --git a/arch/powerpc/platforms/8xx/mpc885ads.h b/arch/powerpc/platforms/8xx/mpc885ads.h index 7c31aec..932b59a 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads.h +++ b/arch/powerpc/platforms/8xx/mpc885ads.h @@ -91,5 +91,13 @@ #define SICR_ENET_MASK ((uint)0x00ff) #define SICR_ENET_CLKRT((uint)0x002c) +/* + * Some internal interrupt registers use an 8-bit mask for the interrupt + * level instead of a number. + */ +static inline uint mk_int_int_mask(uint mask) { + return (1 << (7 - (mask/2))); +} + #endif /* __ASM_MPC885ADS_H__ */ #endif /* __KERNEL__ */ diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index a57b577..80e7214 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -51,6 +52,70 @@ static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi); static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); static void init_scc3_ioports(struct fs_platform_info* ptr); +#ifdef CONFIG_PCMCIA_M8XX +static void pcmcia_hw_setup(int slot, int enable) +{ + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + if (enable) + clrbits32(bcsr_io, BCSR1_PCCEN); + else + setbits32(bcsr_io, BCSR1_PCCEN); + + iounmap(bcsr_io); +} + +static int pcmcia_set_voltage(int slot, int vcc, int vpp) +{ + u32 reg = 0; + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + + switch(vcc) { + case 0: + break; + case 33: + reg |= BCSR1_PCCVCC0; + break; + case 50: + reg |= BCSR1_PCCVCC1; + break; + default: + return 1; + } + + switch(vpp) { + case 0: + break; + case 33: + case 50: + if(vcc == vpp) + reg |= BCSR1_PCCVPP1; + else + return 1; + break; + case 120: + if ((vcc == 33) || (vcc == 50)) + reg |= BCSR1_PCCVPP0; + else +
[PATCH 0/3] 8xx PCMCIA stuff && cleanup: take 3
Sorry for such amount of noise, have to resubmit to catch up with Olof's notes, and to kill empty ranges property in dts since it is not appropriate before driver could handle it. Thanks all for attention. -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [POWERPC] 8xx: PQ SoC IRDA support
On Tue, 8 May 2007 07:36:48 -0700 "Loeliger Jon-LOELIGER" <[EMAIL PROTECTED]> wrote: > > Adds support of IRDA transceiver residing on PowerQUICC processors and > > enabling such on mpc885ads reference board. The driver is implemented > > using of_device concept, hereby implies arch/powerpc support > > of the target. > > > > Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> > > > diff --git a/arch/powerpc/boot/dts/mpc885ads.dts > > b/arch/powerpc/boot/dts/mpc885ads.dts > > index 110bf61..95b280c 100644 > > --- a/arch/powerpc/boot/dts/mpc885ads.dts > > +++ b/arch/powerpc/boot/dts/mpc885ads.dts > > @@ -178,6 +178,16 @@ > > interrupt-parent = <930>; > > phy-handle = ; > > }; > > + > > + [EMAIL PROTECTED] { > > + device_type = "network"; > > + compatible = "fsl,irda"; > > + model = "SCC"; > > + device-id = <2>; > > + reg = ; > > + interrupts = <1d 3>; > > + interrupt-parent = <930>; > > + }; > > }; > > }; > > }; > > > Any chance we could get an update to the booting-without-of.txt > for any of this? > Yes of course. my note is that it makes sense once defines would settle down stuff that looks OK in docs might not look such in driver... -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [POWERPC] 8xx: PQ SoC IRDA support
On Tue, 8 May 2007 08:33:19 -0500 Kumar Gala <[EMAIL PROTECTED]> wrote: > > + [EMAIL PROTECTED] { > > + device_type = "network"; > > + compatible = "fsl,irda"; > > is this specific enough? 52xx also has irda and I'm guessing they'd > require different drivers (haven't looked). Yap, I'll do "fsl,pq-irda" here... -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/3] [POWERPC] dts: kill hardcoded phandles
On Tue, 8 May 2007 07:29:20 -0700 "Loeliger Jon-LOELIGER" <[EMAIL PROTECTED]> wrote: > > > > - [EMAIL PROTECTED] { > > > - linux,phandle = ; > > > + pci_pic:[EMAIL PROTECTED] { > > > > I'd like to establish a convention of putting a space after the : and > > using capitals for labels unless there's a strong reason not to in a > > particular case. It makes them easier to visually distinguish next to > > the node name. > > Colon-space is easy and I'll buy it. > I'm not big on uppercase shouting, though. > > Perhaps something more like case or goto labels:? > > pci_pic: > [EMAIL PROTECTED] { > > if needed? > I used middle solution Pci_pic: [EMAIL PROTECTED] { so first letter of the label should be uppercase. It makes them easily distinguishable and at the same time, not "shouting" manner. -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] [POWERPC] 8xx: mpc885ads pcmcia support
On Tue, 8 May 2007 09:04:22 -0500 Kumar Gala wrote: > > On May 8, 2007, at 4:50 AM, Vitaly Bordug wrote: > > > > > Adds support for PowerQuicc on-chip PCMCIA. The driver is > > implemented as > > of_device, so only arch/powerpc stuff is capable to use it, which > > now implies only mpc885ads reference board. > > > > To cope with the code that should be hooked inside driver, but is > > really > > board specific (like set_voltage), global structure > > mpc8xx_pcmcia_ops holds necessary function pointers that are filled > > in the BSP code. > > > > Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> > > Acked-by: Arnd Bergmann <[EMAIL PROTECTED]> > > Acked-by: Olof Johansson <[EMAIL PROTECTED]> > > > > --- > > > > arch/powerpc/boot/dts/mpc885ads.dts | 12 + > > arch/powerpc/platforms/8xx/m8xx_setup.c |5 > > arch/powerpc/platforms/8xx/mpc885ads.h |8 + > > arch/powerpc/platforms/8xx/mpc885ads_setup.c | 72 + > > arch/powerpc/sysdev/fsl_soc.c| 13 + > > arch/powerpc/sysdev/mpc8xx_pic.h |2 > > drivers/pcmcia/Kconfig |1 > > drivers/pcmcia/m8xx_pcmcia.c | 351 +++ > > +-- > > include/asm-powerpc/mpc8xx.h |4 > > include/linux/fsl_devices.h |5 > > 10 files changed, 287 insertions(+), 186 deletions(-) > > > > diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/ > > boot/dts/mpc885ads.dts > > index 110bf61..0786ac1 100644 > > --- a/arch/powerpc/boot/dts/mpc885ads.dts > > +++ b/arch/powerpc/boot/dts/mpc885ads.dts > > @@ -112,6 +112,18 @@ > > compatible = "CPM"; > > }; > > > > + [EMAIL PROTECTED] { > > + #address-cells = <3>; > > + #interrupt-cells = <1>; > > + #size-cells = <2>; > > + compatible = "fsl,pq-pcmcia"; > > should this be fsl,pq1-pcmcia or fsl,8xx-pcmcia? > there were a note that eventually fsl may create some 8xx that is not cpm... I really think pq and pq1 is the same, for pq2, 3 etc number passed explicitly. > > + device_type = "pcmcia"; > > + reg = <80 80>; > > + clock-frequency = <2faf080>; > > is the clock-freq fixed? > gotta check, will follow-up. > > + interrupt-parent = <&mpc8xx-pic>; > > + interrupts = ; > > + }; > > + > > [EMAIL PROTECTED] { > > linux,phandle = ; > > #address-cells = <1>; > > diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c > > b/arch/powerpc/ platforms/8xx/m8xx_setup.c > > index 0901dba..f169355 100644 > > --- a/arch/powerpc/platforms/8xx/m8xx_setup.c > > +++ b/arch/powerpc/platforms/8xx/m8xx_setup.c > > @@ -32,6 +32,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > #include > > @@ -49,6 +50,10 @@ > > > > #include "sysdev/mpc8xx_pic.h" > > > > +#ifdef CONFIG_PCMCIA_M8XX > > +struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops; > > +#endif > > + > > void m8xx_calibrate_decr(void); > > extern void m8xx_wdt_handler_install(bd_t *bp); > > extern int cpm_pic_init(void); > > diff --git a/arch/powerpc/platforms/8xx/mpc885ads.h b/arch/powerpc/ > > platforms/8xx/mpc885ads.h > > index 7c31aec..932b59a 100644 > > --- a/arch/powerpc/platforms/8xx/mpc885ads.h > > +++ b/arch/powerpc/platforms/8xx/mpc885ads.h > > @@ -91,5 +91,13 @@ > > #define SICR_ENET_MASK ((uint)0x00ff) > > #define SICR_ENET_CLKRT((uint)0x002c) > > > > +/* > > + * Some internal interrupt registers use an 8-bit mask for the > > interrupt > > + * level instead of a number. > > + */ > > +static inline uint mk_int_int_mask(uint mask) { > > + return (1 << (7 - (mask/2))); > > +} > > would this be better off in sysdev/mpc8xx_pic.h? > hmm, maybe. > > + > > #endif /* __ASM_MPC885ADS_H__ */ > > #endif /* __KERNEL__ */ > > diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/ > > powerpc/platforms/8xx/mpc885ads_setup.c > > index a57b577..80e7214 100644 > > --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c > > +++ b/arch/powerpc/platforms/8x
Re: [PATCH 1/3] [POWERPC] 8xx: mpc885ads pcmcia support
On Tue, 8 May 2007 09:04:22 -0500 Kumar Gala wrote: > > + device_type = "pcmcia"; > > + reg = <80 80>; > > + clock-frequency = <2faf080>; > > is the clock-freq fixed? As I see now, that field is not really required as never extracted or used. The intention was to use dts value iirc, later it was switched to ppc_proc_freq, but never removed from dts. Hence I'll do that now. -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/3] 8xx PCMCIA stuff && cleanup: take 4
Hopefully last round, with Kumar's notes addressed, and BSP mpc885_setup.c Lindented in 2-nd patch as well as PCMCIA driver. - Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] [POWERPC] 8xx: mpc885ads pcmcia support
Adds support for PowerQuicc on-chip PCMCIA. The driver is implemented as of_device, so only arch/powerpc stuff is capable to use it, which now implies only mpc885ads reference board. To cope with the code that should be hooked inside driver, but is really board specific (like set_voltage), global structure mpc8xx_pcmcia_ops holds necessary function pointers that are filled in the BSP code. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> Acked-by: Arnd Bergmann <[EMAIL PROTECTED]> Acked-by: Olof Johansson <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc885ads.dts | 11 + arch/powerpc/platforms/8xx/m8xx_setup.c |5 arch/powerpc/platforms/8xx/mpc885ads_setup.c | 71 + arch/powerpc/sysdev/fsl_soc.c| 13 + arch/powerpc/sysdev/mpc8xx_pic.h | 10 + drivers/pcmcia/Kconfig |1 drivers/pcmcia/m8xx_pcmcia.c | 351 -- include/asm-powerpc/mpc8xx.h |4 include/linux/fsl_devices.h |5 9 files changed, 285 insertions(+), 186 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts index 110bf61..aee0108 100644 --- a/arch/powerpc/boot/dts/mpc885ads.dts +++ b/arch/powerpc/boot/dts/mpc885ads.dts @@ -112,6 +112,17 @@ compatible = "CPM"; }; + [EMAIL PROTECTED] { + #address-cells = <3>; + #interrupt-cells = <1>; + #size-cells = <2>; + compatible = "fsl,pq-pcmcia"; + device_type = "pcmcia"; + reg = <80 80>; + interrupt-parent = ; + interrupts = ; + }; + [EMAIL PROTECTED] { linux,phandle = ; #address-cells = <1>; diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c index 0901dba..f169355 100644 --- a/arch/powerpc/platforms/8xx/m8xx_setup.c +++ b/arch/powerpc/platforms/8xx/m8xx_setup.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -49,6 +50,10 @@ #include "sysdev/mpc8xx_pic.h" +#ifdef CONFIG_PCMCIA_M8XX +struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops; +#endif + void m8xx_calibrate_decr(void); extern void m8xx_wdt_handler_install(bd_t *bp); extern int cpm_pic_init(void); diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index a57b577..1f6ca04 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -51,6 +52,70 @@ static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi); static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); static void init_scc3_ioports(struct fs_platform_info* ptr); +#ifdef CONFIG_PCMCIA_M8XX +static void pcmcia_hw_setup(int slot, int enable) +{ + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + if (enable) + clrbits32(bcsr_io, BCSR1_PCCEN); + else + setbits32(bcsr_io, BCSR1_PCCEN); + + iounmap(bcsr_io); +} + +static int pcmcia_set_voltage(int slot, int vcc, int vpp) +{ + u32 reg = 0; + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + + switch(vcc) { + case 0: + break; + case 33: + reg |= BCSR1_PCCVCC0; + break; + case 50: + reg |= BCSR1_PCCVCC1; + break; + default: + return 1; + } + + switch(vpp) { + case 0: + break; + case 33: + case 50: + if(vcc == vpp) + reg |= BCSR1_PCCVPP1; + else + return 1; + break; + case 120: + if ((vcc == 33) || (vcc == 50)) + reg |= BCSR1_PCCVPP0; + else + return 1; + default: + return 1; + } + + /* first, turn off all power */ + clrbits32(bcsr_io, 0x0061); + + /* enable new powersettings */ + setbits32(bcsr_io, reg); + + iounmap(bcsr_io); + return 0; +} +#endif + void __init mpc885ads_board_setup(void) { cpm8xx_t *cp; @@ -115,6 +180,12 @@ void __init mpc885ads_board_setup(void) immr_unmap(io_port); #endif + +#ifdef CONFIG_PCMCIA_M8XX + /*Set up board specific hook-ups*/ + m8xx_pcmcia_ops.hw_ctrl = pcmcia_hw_setup; + m8xx_pcmcia_ops.voltage_set = pcmcia_set_voltage; +#endif } diff --git a/arch/powerpc/sysdev/fsl_soc.c
[PATCH 3/3] [POWERPC] dts: kill hardcoded phandles
Removed explicit linux,phandle usage. Using references and labels now in PQ and PQ2 boards currently supported in arch/powerpc. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc8272ads.dts | 42 +++- arch/powerpc/boot/dts/mpc866ads.dts | 31 --- arch/powerpc/boot/dts/mpc885ads.dts | 45 +- 3 files changed, 43 insertions(+), 75 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts b/arch/powerpc/boot/dts/mpc8272ads.dts index 423eedc..1934b80 100644 --- a/arch/powerpc/boot/dts/mpc8272ads.dts +++ b/arch/powerpc/boot/dts/mpc8272ads.dts @@ -14,12 +14,10 @@ compatible = "MPC8260ADS"; #address-cells = <1>; #size-cells = <1>; - linux,phandle = <100>; cpus { #address-cells = <1>; #size-cells = <0>; - linux,phandle = <200>; PowerPC,[EMAIL PROTECTED] { device_type = "cpu"; @@ -32,12 +30,10 @@ bus-frequency = <0>; clock-frequency = <0>; 32-bit; - linux,phandle = <201>; }; }; - [EMAIL PROTECTED] { - linux,phandle = ; + pci_pic: [EMAIL PROTECTED] { #address-cells = <0>; #interrupt-cells = <2>; interrupt-controller; @@ -47,15 +43,13 @@ }; memory { device_type = "memory"; - linux,phandle = <300>; reg = < 400 f450 0020>; }; chosen { name = "chosen"; linux,platform = <0>; - interrupt-controller = <10c00>; - linux,phandle = <400>; + interrupt-controller = <&Cpm_pic>; }; [EMAIL PROTECTED] { @@ -70,20 +64,17 @@ device_type = "mdio"; compatible = "fs_enet"; reg = <0 0>; - linux,phandle = <24520>; #address-cells = <1>; #size-cells = <0>; - [EMAIL PROTECTED] { - linux,phandle = <2452000>; - interrupt-parent = <10c00>; + phy0:[EMAIL PROTECTED] { + interrupt-parent = <&Cpm_pic>; interrupts = <17 4>; reg = <0>; bitbang = [ 12 12 13 02 02 01 ]; device_type = "ethernet-phy"; }; - [EMAIL PROTECTED] { - linux,phandle = <2452001>; - interrupt-parent = <10c00>; + phy1:[EMAIL PROTECTED] { + interrupt-parent = <&Cpm_pic>; interrupts = <17 4>; bitbang = [ 12 12 13 02 02 01 ]; reg = <3>; @@ -101,8 +92,8 @@ reg = <11300 20 8400 100 11380 30>; mac-address = [ 00 11 2F 99 43 54 ]; interrupts = <20 2>; - interrupt-parent = <10c00>; - phy-handle = <2452000>; + interrupt-parent = <&Cpm_pic>; + phy-handle = <&Phy0>; rx-clock = <13>; tx-clock = <12>; }; @@ -115,14 +106,13 @@ reg = <11320 20 8500 100 113b0 30>; mac-address = [ 00 11 2F 99 44 54 ]; interrupts = <21 2>; - interrupt-parent = <10c00>; - phy-handle = <2452001>; + interrupt-parent = <&Cpm_pic>; + phy-handle = <&Phy1>; rx-clock = <17>; tx-clock = <18>; }; [EMAIL PROTECTED] { - linux,phandle = ; #address-cells = <1>; #size-cells = <1>; #interrupt-cells = <2>; @@ -142,7 +132,7 @@ reg = <11a00 20 8000 100>; current-speed = <1c200>; interrupts = <28
[PATCH 2/3] [POWERPC] 8xx: fix whitespace and indentation
Rolling forward PCMCIA driver, it was discovered that the indentation in existing one, as well as in BSP side are very odd. This patch is just result of Lindent run ontop of culprit files. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/platforms/8xx/mpc885ads_setup.c | 125 +++--- drivers/pcmcia/m8xx_pcmcia.c | 548 +- 2 files changed, 336 insertions(+), 337 deletions(-) diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index 1f6ca04..7be6239 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -40,7 +40,7 @@ #include extern void cpm_reset(void); -extern void mpc8xx_show_cpuinfo(struct seq_file*); +extern void mpc8xx_show_cpuinfo(struct seq_file *); extern void mpc8xx_restart(char *cmd); extern void mpc8xx_calibrate_decr(void); extern int mpc8xx_set_rtc_time(struct rtc_time *tm); @@ -48,9 +48,9 @@ extern void mpc8xx_get_rtc_time(struct rtc_time *tm); extern void m8xx_pic_init(void); extern unsigned int mpc8xx_get_irq(void); -static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi); -static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); -static void init_scc3_ioports(struct fs_platform_info* ptr); +static void init_smc1_uart_ioports(struct fs_uart_platform_info *fpi); +static void init_smc2_uart_ioports(struct fs_uart_platform_info *fpi); +static void init_scc3_ioports(struct fs_platform_info *ptr); #ifdef CONFIG_PCMCIA_M8XX static void pcmcia_hw_setup(int slot, int enable) @@ -73,7 +73,7 @@ static int pcmcia_set_voltage(int slot, int vcc, int vpp) bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); - switch(vcc) { + switch (vcc) { case 0: break; case 33: @@ -86,12 +86,12 @@ static int pcmcia_set_voltage(int slot, int vcc, int vpp) return 1; } - switch(vpp) { + switch (vpp) { case 0: break; case 33: case 50: - if(vcc == vpp) + if (vcc == vpp) reg |= BCSR1_PCCVPP1; else return 1; @@ -127,7 +127,7 @@ void __init mpc885ads_board_setup(void) #endif bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); - cp = (cpm8xx_t *)immr_map(im_cpm); + cp = (cpm8xx_t *) immr_map(im_cpm); if (bcsr_io == NULL) { printk(KERN_CRIT "Could not remap BCSR\n"); @@ -140,13 +140,13 @@ void __init mpc885ads_board_setup(void) out_8(&(cp->cp_smc[0].smc_smcm), tmpval8); clrbits16(&cp->cp_smc[0].smc_smcmr, SMCMR_REN | SMCMR_TEN); /* brg1 */ #else - setbits32(bcsr_io,BCSR1_RS232EN_1); + setbits32(bcsr_io, BCSR1_RS232EN_1); out_be16(&cp->cp_smc[0].smc_smcmr, 0); out_8(&cp->cp_smc[0].smc_smce, 0); #endif #ifdef CONFIG_SERIAL_CPM_SMC2 - clrbits32(bcsr_io,BCSR1_RS232EN_2); + clrbits32(bcsr_io, BCSR1_RS232EN_2); clrbits32(&cp->cp_simode, 0xe000 >> 1); setbits32(&cp->cp_simode, 0x2000 >> 1); /* brg2 */ tmpval8 = in_8(&(cp->cp_smc[1].smc_smcm)) | (SMCM_RX | SMCM_TX); @@ -155,7 +155,7 @@ void __init mpc885ads_board_setup(void) init_smc2_uart_ioports(0); #else - setbits32(bcsr_io,BCSR1_RS232EN_2); + setbits32(bcsr_io, BCSR1_RS232EN_2); out_be16(&cp->cp_smc[1].smc_smcmr, 0); out_8(&cp->cp_smc[1].smc_smce, 0); #endif @@ -164,16 +164,16 @@ void __init mpc885ads_board_setup(void) #ifdef CONFIG_FS_ENET /* use MDC for MII (common) */ - io_port = (iop8xx_t*)immr_map(im_ioport); + io_port = (iop8xx_t *) immr_map(im_ioport); setbits16(&io_port->iop_pdpar, 0x0080); clrbits16(&io_port->iop_pddir, 0x0080); bcsr_io = ioremap(BCSR5, sizeof(unsigned long)); - clrbits32(bcsr_io,BCSR5_MII1_EN); - clrbits32(bcsr_io,BCSR5_MII1_RST); + clrbits32(bcsr_io, BCSR5_MII1_EN); + clrbits32(bcsr_io, BCSR5_MII1_RST); #ifndef CONFIG_FC_ENET_HAS_SCC - clrbits32(bcsr_io,BCSR5_MII2_EN); - clrbits32(bcsr_io,BCSR5_MII2_RST); + clrbits32(bcsr_io, BCSR5_MII2_EN); + clrbits32(bcsr_io, BCSR5_MII2_RST); #endif iounmap(bcsr_io); @@ -182,17 +182,16 @@ void __init mpc885ads_board_setup(void) #endif #ifdef CONFIG_PCMCIA_M8XX - /*Set up board specific hook-ups*/ + /*Set up board specific hook-ups */ m8xx_pcmcia_ops.hw_ctrl = pcmcia_hw_setup; m8xx_pcmcia_ops.voltage_set = pcmcia_set_voltage; #endif } - -static void init_fec1_ioports(struct fs_platform_info* ptr) +static void init_fec1_ioports(struct fs_platform_info *ptr) { - cpm8xx_t *cp = (cpm8xx_t *)immr_map(im_cpm); - iop8xx_t *io_port = (iop8xx_t *)immr_ma
[PATCH] [POWERPC] 8xx: PQ SoC IRDA support
Adds support of IRDA transceiver residing on PowerQUICC processors and enabling such on mpc885ads reference board. The driver is implemented using of_device concept, hereby implies arch/powerpc support of the target. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/Kconfig |1 arch/powerpc/boot/dts/mpc885ads.dts | 10 arch/powerpc/platforms/8xx/mpc885ads_setup.c | 39 + arch/powerpc/sysdev/fsl_soc.c| 58 ++ drivers/net/irda/Kconfig |4 drivers/net/irda/Makefile|1 drivers/net/irda/m8xx-sir.c | 715 ++ include/asm-ppc/commproc.h | 67 ++ 8 files changed, 895 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 808d2ef..9e48c80 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -629,6 +629,7 @@ endmenu config ISA_DMA_API bool default y + depends on !PPC_8xx menu "Bus options" diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts index 110bf61..0d4286a 100644 --- a/arch/powerpc/boot/dts/mpc885ads.dts +++ b/arch/powerpc/boot/dts/mpc885ads.dts @@ -178,6 +178,16 @@ interrupt-parent = <930>; phy-handle = ; }; + + [EMAIL PROTECTED] { + device_type = "network"; + compatible = "fsl,pq-irda"; + model = "SCC"; + device-id = <2>; + reg = ; + interrupts = <1d 3>; + interrupt-parent = <930>; + }; }; }; }; diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index a57b577..8611318 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -50,6 +50,7 @@ extern unsigned int mpc8xx_get_irq(void); static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi); static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); static void init_scc3_ioports(struct fs_platform_info* ptr); +static void init_irda_ioports(void); void __init mpc885ads_board_setup(void) { @@ -115,6 +116,10 @@ void __init mpc885ads_board_setup(void) immr_unmap(io_port); #endif + +#ifdef CONFIG_8XX_SIR + init_irda_ioports(); +#endif } @@ -322,6 +327,40 @@ void init_smc_ioports(struct fs_uart_platform_info *data) } } +static void init_irda_ioports() +{ + iop8xx_t *io_port; + cpm8xx_t *cp; + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + + if (bcsr_io == NULL) { + printk(KERN_CRIT "Could not remap BCSR1\n"); + return; + } + + /* Enable the IRDA. */ + clrbits32(bcsr_io,BCSR1_IRDAEN); + iounmap(bcsr_io); + + io_port = (iop8xx_t *)immr_map(im_ioport); + cp = (cpm8xx_t *)immr_map(im_cpm); + + /* Configure port A pins. */ + setbits16(&io_port->iop_papar, 0x000c); + clrbits16(&io_port->iop_padir, 0x000c); + + /* Configure Serial Interface clock routing. +* First, clear all SCC bits to zero, then set the ones we want. +*/ + clrbits32(&cp->cp_sicr, 0xff00); + setbits32(&cp->cp_sicr, 0x1200); + + immr_unmap(io_port); + immr_unmap(cp); +} + int platform_device_skip(const char *model, int id) { #ifdef CONFIG_MPC8xx_SECOND_ETH_SCC3 diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 8a123c7..f827147 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -1102,4 +1102,62 @@ err: arch_initcall(cpm_smc_uart_of_init); +static const char *irda_regs = "regs"; +static const char *irda_pram = "pram"; +static const char *irda_irq = "interrupt"; +static char bus_id[9][BUS_ID_SIZE]; + +static int __init fs_irda_of_init(void) +{ + struct device_node *np; + unsigned int i; + struct platform_device *fs_irda_dev = NULL; + int ret; + + for (np = NULL, i = 0; +(np = of_find_compatible_node(np, "network", "fsl,irda")) != NULL; +i++) { + struct resource r[4]; + unsigned int *id; + char *model; + + memset(r, 0, sizeof(r)); + + model = (char *)get_property(np, "model", NULL); + if (model == NULL) + return -ENODEV; + + id = (u32 *) get_property(np, "device-id", NU
Re: [PATCH] i2c: adds support for i2c bus on 8xx
On Thu, 10 May 2007 11:28:35 +0200 Jean Delvare wrote: > Hi Vitaly, > > There is a mailing list dedicated to Linux I2C development (check > MAINTAINERS), so why don't you use it instead of the already cluttered > LKML? > because it's both arch-specific and drivers/ thing. I'll Cc that ML next time. > On Tue, 08 May 2007 10:31:31 +0400, Vitaly Bordug wrote: > > Utilized devicetree to store I2C data, ported i2c-algo-8xx.c from > > 2.4 approach(which remains nearly intact), refined i2c-rpx.c. I2C > > functionality has been validated on mpc885ads with EEPROM access. > > > > Interface has been reworked to of_device as well as other feedback > > addressed. Repeated start ability is missing from the > > implementation. > > Did you check the hardware documentation? Is is a hardware limitation? > It is likely to cause problems, so it should be investigated, and if > it really cannot be fixed, then this must be clearly documented (in > Kconfig and in the driver) and the advertised functionalities of the > driver should be reduced accordingly (most SMBus transactions include > a repeated start.) > Yes, I've checked RM about I2C controller, and cannot find anything about repeated start. There are a few words about multi-master considerations, that SoC features bus arbitration, but to avoid collisions, "higher-level handshake protocol must be used" (MPC885 RM, p. 32-6). How the driver should advertise this case, can you suggest? > > > > Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> > > > > --- > > > > arch/powerpc/platforms/8xx/mpc885ads_setup.c | 15 + > > arch/powerpc/sysdev/fsl_soc.c| 15 + > > drivers/i2c/algos/Kconfig|2 > > drivers/i2c/algos/Makefile |1 > > drivers/i2c/algos/i2c-algo-8xx.c | 520 > > ++ > > drivers/i2c/busses/Kconfig |2 > > drivers/i2c/busses/i2c-rpx.c | 143 +-- > > include/linux/i2c-algo-8xx.h | 29 + 8 files > > changed, 683 insertions(+), 44 deletions(-) > > After my original review, we had agreed that having a separate > algorithm driver wasn't needed. You didn't change that though. Why? I > will not consider applying this patch until that change is done (or a > good reason not to do it is given.) > yes, that's correct, missed this point... > > diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c > > b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index > > a57b577..40d12a2 100644 --- > > a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ > > b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -51,6 +51,17 @@ > > static void init_smc1_uart_ioports(struct fs_uart_platform_info* > > fpi); static void init_smc2_uart_ioports(struct > > fs_uart_platform_info* fpi); static void init_scc3_ioports(struct > > fs_platform_info* ptr); +#ifdef CONFIG_I2C_RPXLITE > > +static void init_i2c_ioports() > > +{ > > + cpm8xx_t *cp = (cpm8xx_t *)immr_map(im_cpm); > > + > > + setbits32(&cp->cp_pbpar, 0x0030); > > + setbits32(&cp->cp_pbdir, 0x0030); > > + setbits16(&cp->cp_pbodr, 0x0030); > > +} > > +#endif > > + > > void __init mpc885ads_board_setup(void) > > { > > cpm8xx_t *cp; > > @@ -115,6 +126,10 @@ void __init mpc885ads_board_setup(void) > > immr_unmap(io_port); > > > > #endif > > + > > +#ifdef CONFIG_I2C_RPXLITE > > + init_i2c_ioports(); > > +#endif > > } > > > > > > diff --git a/arch/powerpc/sysdev/fsl_soc.c > > b/arch/powerpc/sysdev/fsl_soc.c index 8a123c7..be60db7 100644 > > --- a/arch/powerpc/sysdev/fsl_soc.c > > +++ b/arch/powerpc/sysdev/fsl_soc.c > > @@ -33,6 +33,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -1102,4 +1103,18 @@ err: > > > > arch_initcall(cpm_smc_uart_of_init); > > > > +static int __init fsl_i2c_cpm_of_init(void) > > +{ > > + struct device_node *np = NULL; > > + /* > > +* Register all the devices which type is "i2c-cpm" > > +*/ > > + while ((np = of_find_compatible_node(np, "i2c", > > "fsl,i2c-cpm")) != NULL) > > + of_platform_device_create(np, "fsl-i2c-cpm", NULL); > > + return 0; > > +} > > + > > +arch_initcall(fsl_i2c_cpm_of_init); > > + > > + > > #endif /* CONFIG_8xx */ &
Re: [PATCH][RFC] PCMCIA support for 8xx using platform devices
On Mon, 23 Apr 2007 08:59:57 +0100 Christoph Hellwig wrote: > On Mon, Apr 23, 2007 at 10:14:27AM +0400, Vitaly Bordug wrote: > > On Sun, 22 Apr 2007 23:49:41 +0200 > > Arnd Bergmann wrote: > > > > > On Sunday 22 April 2007, Vitaly Bordug wrote: > > > > This utilizes PCMCIA on mpc885ads and mpc866ads from > > > > arch/powerpc. In the new approach, direct IMMR accesses from > > > > within drivers/ were totally eliminated, that requires > > > > hardware_enable, hardware_disable, voltage_set board-specific > > > > functions to be moved over to BSP code section > > > > (arch/powerpc/platforms/8xx in 885 case). There is just no way > > > > to have both arch/ppc and arch/powerpc approaches to work > > > > simultaneously because of that. > > > > > > Maybe I'm missing a key issue here, but what's the point of adding > > > more platform_devices for stuff that is already in the device > > > tree? Shouldn't this be made an of_platform_driver instead so you > > > can use the existing of_device directly? > > > > > Was thinking of it but platform_device is better for migration > > purposes. Hence, assuming somebody would want to have pcmcia > > working not bothering to add whole arch/powerpc support, it can be > > accomplished quickly. > > That's a horrible argument. Please do it properly, and let arch/ppc > die as it should. We shouldn't be adding anything to it anymore > anyway. > I understand your point, but we shouldn't trash existing bits either. Things are a bit different with embedded stuff, and especially in case of 8xx, there are targets without OF-powered uboot. Bootwrapper thing might be helpful in resolving it, but not a holy tablet after all. The main point is: current 8xx pcmcia code is a holy mess of ifdefs, direct immr accesses (assuming it is io_block_mapped 1:1) etc. And limiting pcmcia to 885ads only (the only 8xx that supports OF so far) is not good. We have to admit, that many 8xx boards will remain in ppc/ for a while, and instead of just dropping BSP bits I'm going to let them be refactored via pdevs (with announcement in feature removal reference) as it would take couple of hrs only. If nobody will care, then the whole 8xx pcmcia driver will be cleaned up and switched to of_device. Does that make sense? -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH][RFC] i2c: adds support for i2c bus on 8xx
On Thu, 26 Apr 2007 17:54:38 +0200 Jean Delvare <[EMAIL PROTECTED]> wrote: > Hi Vitaly, > > On Wed, 25 Apr 2007 21:06:10 +0400, Vitaly Bordug wrote: > > Jean Delvare wrote: > > >>>> +/* Structure for a device driver */ > > >>>> +static struct device_driver i2c_rpx_driver = { > > >>>> + .name = "fsl-i2c-cpm", > > >>>> + .bus = &platform_bus_type, > > >>>> + .probe = i2c_rpx_probe, > > >>>> + .remove = i2c_rpx_remove, > > >>>> +}; > > >>>> > > >>> Why don't you declare it as a struct platform_driver, register it with > > >>> platform_driver_register() and unregister it with > > >>> platform_driver_unregister()? > > >>> > > >> Well. This stuff belongs to CPM1, of the mpc8xx family, but the > > >> target boards are different, and they may/should provide board > > >> specific inits and filling of platform data. With > > >> platform_driver_register we may end up with ifdef stuff here > > >> (which is evil). > > >> > > > > > > I don't follow you here, sorry. Platform devices are declared by > > > board-specific code which can include all the needed initialization. > > > And device-specific data can be carried to the platform driver for > > > further use. The platform device/driver infrastructure is meant to > > > handle that kind of situation, so there really is no excuse that I can > > > see not to use it. i2c-omap and i2c-mpc use it. As a matter of fact you > > > _are_ declaring a platform driver (.bus = &platform_bus_type), just not > > > using the standard way. > > > > > > > > Standard way here - platform devices got registered from elsewhere - > > from arch/ppc/ppc_sys.c if arch/ppc or from > > arch/powerpc/sysdev/fsl_soc.c if powerpc. > > Every way (powerpc is more flexible since is pulling the information > > from the firmware-passed device tree) fills in the resources and > > platform data, and > > is capable with device/drive bound you are talking about. > > This doesn't explain why you can't use platform_driver_register(), > which is the right way to register a platform driver. Ahm, I clearly confused myself (with device/driver stuff), sorry. Anyway I think we'll look at of_device for this, to reduce extract from OF->insert platform device overhead. -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/1] ppc: Possible bug fix for FCC driver
On Tue, 6 Mar 2007 10:23:43 +0800 Li Yang-r58472 wrote: > Hi Cedric, > > For ppc embedded related patches, please also cc: > [EMAIL PROTECTED] > > > We use a kernel 2.6.14 on PPC platform (MPC 8555). The FCC driver > works > > To submit a kernel patch upstream, the patch should be against the > latest kernel version which is 2.6.21-rc now. > > well with a 100Mbps link. But it doesn't with a 10Mbps link. To > > solve it, I modified the GFMR register init: removed TCI bit and > > set CRC32 > bit > > instead of. > > I don't know how these bits caused the 10M link issue. Do you have > any reasoning? > > > Signed-off-by: Cedric Pontois <[EMAIL PROTECTED]> > > > > > > > - > > > > diff -ruN pa-original/arch/ppc/8260_io/fcc_enet.c The fcc code in 8260_io has been obsoleted by fs_enet driver (drivers/net/fs_enet). It is known to work with 85xx at least in recent kernels. If it does not for some reason, please letus know. Thanks, -Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/1] ppc: Possible bug fix for FCC driver
On Tue, 6 Mar 2007 12:03:57 +0100 Cedric Pontois wrote: > Hi Vitaly, > > The problem seems to be similar in recent kernels > (/drivers/net/fs_enet/mac-fcc.c). The transmit clock is inverted (TCI > bit set). The packets are well received, transmitted packets go out > (tx counter is ok), unfortunately as the clock is inverted (TCI) the > data are not correctly received by the other side. The FCC works in > 100Mbps (luck?) but doesn't in 10Mbps. I solved this problem by > removing the TCI bit set as described in the patch. Actually, this > problem depends also of the Ethernet phy used on board. > IIRC it worked for us with Davicom PHY on 10 MBps on one of 8260-like... Well I give it a try once more with the recent kernel, but anyway if you think you've located and fixed root cause, do (and test) a patch against recent kernel, send it to me cc'ing netdev and linuxppc-embedded, and I'll push it along if it is not breaking existing boards. -Vitaly > Cedric > > -Original Message- > From: Vitaly Bordug [mailto:[EMAIL PROTECTED] > Sent: mardi 6 mars 2007 10:42 > To: Li Yang-r58472 > Cc: Pontois, Cedric UMTS (CEZ:8Z10); [EMAIL PROTECTED]; > linux-kernel@vger.kernel.org; linuxppc-embedded@ozlabs.org > Subject: Re: [patch 1/1] ppc: Possible bug fix for FCC driver > > > On Tue, 6 Mar 2007 10:23:43 +0800 > Li Yang-r58472 wrote: > > > Hi Cedric, > > > > For ppc embedded related patches, please also cc: > > [EMAIL PROTECTED] > > > > > We use a kernel 2.6.14 on PPC platform (MPC 8555). The FCC driver > > works > > > > To submit a kernel patch upstream, the patch should be against the > > latest kernel version which is 2.6.21-rc now. > > > well with a 100Mbps link. But it doesn't with a 10Mbps link. To > > > solve it, I modified the GFMR register init: removed TCI bit and > > > set > > > > CRC32 > > bit > > > instead of. > > > > I don't know how these bits caused the 10M link issue. Do you have > > any reasoning? > > > > > Signed-off-by: Cedric Pontois <[EMAIL PROTECTED]> > > > > > > > > -- > > -- > > > - > > > > > > diff -ruN pa-original/arch/ppc/8260_io/fcc_enet.c > The fcc code in 8260_io has been obsoleted by fs_enet driver > (drivers/net/fs_enet). It is known to work with 85xx at least in > recent kernels. If it does not for some reason, please letus know. > > Thanks, > > -Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [bug] fixed_init(): BUG: at drivers/base/core.c:120 device_release(), was: "2.6.21-rc5: known regressions"
On Fri, 30 Mar 2007 16:25:14 +0200 Ingo Molnar <[EMAIL PROTECTED]> wrote: > > * Greg KH <[EMAIL PROTECTED]> wrote: > > > > Device '[EMAIL PROTECTED]:1' does not have a release() function, it is > > > broken and must be fixed. > > > BUG: at drivers/base/core.c:120 device_release() > > > [] show_trace_log_lvl+0x19/0x2e > > > [] show_trace+0x12/0x14 > > > [] dump_stack+0x14/0x16 > > > [] device_release+0x7c/0x7e > > > [] kobject_cleanup+0x44/0x5e > > > [] kobject_release+0xb/0xd > > > [] kref_put+0x63/0x71 > > > [] kobject_put+0x14/0x16 > > > [] put_device+0x11/0x13 > > > [] device_unregister+0x12/0x15 > > > [] fixed_mdio_register_device+0x210/0x23b > > > [] fixed_init+0x2f/0x33 > > > [] init+0x15d/0x2bd > > > [] kernel_thread_helper+0x7/0x10 > > > > That means that whatever driver has fixed_mdio_register_device() in it > > is broken and needs to be fixed. > > that would be drivers/net/phy/fixed.c. > OK, I'll look into it, thanks for pointing out. > > It is independant from your previous question about unregistering the > > device from within module_init(). > > (yes - hence the different subject line, etc.) > -- Sincerely, Vitaly - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [POWERPC] 8xx: mpc885ads pcmcia support
Adds support for PowerQuicc on-chip PCMCIA. The driver is implemented as of_device, so only arch/powerpc stuff is capable to use it, which now implies only mpc885ads reference board. To cope with the code that should be hooked inside driver, but is really board specific (like set_voltage), global structure mpc8xx_pcmcia_ops holds necessary function pointers that are filled in the BSP code. Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- arch/powerpc/boot/dts/mpc885ads.dts | 12 + arch/powerpc/platforms/8xx/mpc885ads.h |5 arch/powerpc/platforms/8xx/mpc885ads_setup.c | 75 + arch/powerpc/sysdev/fsl_soc.c| 12 + drivers/pcmcia/Kconfig |1 drivers/pcmcia/m8xx_pcmcia.c | 356 -- 6 files changed, 271 insertions(+), 190 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts index 110bf61..89d585f 100644 --- a/arch/powerpc/boot/dts/mpc885ads.dts +++ b/arch/powerpc/boot/dts/mpc885ads.dts @@ -112,6 +112,18 @@ compatible = "CPM"; }; + [EMAIL PROTECTED] { + linux,phandle = <0080>; + #interrupt-cells = <1>; + #size-cells = <2>; + compatible = "8xx"; + device_type = "pcmcia"; + reg = <80 80>; + clock-frequency = <2faf080>; + interrupt-parent = ; + interrupts = ; + }; + [EMAIL PROTECTED] { linux,phandle = ; #address-cells = <1>; diff --git a/arch/powerpc/platforms/8xx/mpc885ads.h b/arch/powerpc/platforms/8xx/mpc885ads.h index 7c31aec..4439346 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads.h +++ b/arch/powerpc/platforms/8xx/mpc885ads.h @@ -91,5 +91,10 @@ #define SICR_ENET_MASK ((uint)0x00ff) #define SICR_ENET_CLKRT((uint)0x002c) +/* Some internal interrupt registers use an 8-bit mask for the interrupt + * level instead of a number. + */ +#define mk_int_int_mask(IL) (1 << (7 - (IL/2))) + #endif /* __ASM_MPC885ADS_H__ */ #endif /* __KERNEL__ */ diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index a57b577..056e1e0 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -51,6 +52,16 @@ static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi); static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi); static void init_scc3_ioports(struct fs_platform_info* ptr); +#ifdef CONFIG_PCMCIA_M8XX +static void pcmcia_hw_setup(int slot, int enable); +static int pcmcia_set_voltage(int slot, int vcc, int vpp); + +struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops = { + .hw_ctrl = pcmcia_hw_setup, + .voltage_set = pcmcia_set_voltage, +}; +#endif + void __init mpc885ads_board_setup(void) { cpm8xx_t *cp; @@ -322,6 +333,70 @@ void init_smc_ioports(struct fs_uart_platform_info *data) } } +#ifdef CONFIG_PCMCIA_M8XX +static void pcmcia_hw_setup(int slot, int enable) +{ + unsigned *bcsr_io; + + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + if (enable) + clrbits32(bcsr_io, BCSR1_PCCEN); + else + setbits32(bcsr_io, BCSR1_PCCEN); + + iounmap(bcsr_io); +} + +static int pcmcia_set_voltage(int slot, int vcc, int vpp) +{ +u32 reg = 0; +unsigned *bcsr_io; + +bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); + +switch(vcc) { +case 0: +break; +case 33: +reg |= BCSR1_PCCVCC0; +break; +case 50: +reg |= BCSR1_PCCVCC1; +break; +default: +return 1; +} + +switch(vpp) { +case 0: +break; +case 33: +case 50: +if(vcc == vpp) +reg |= BCSR1_PCCVPP1; +else +return 1; +break; +case 120: +if ((vcc == 33) || (vcc == 50)) +reg |= BCSR1_PCCVPP0; +else +return 1; +default: +return 1; +} + +/* first, turn off all power */ +clrbits32(bcsr_io, 0x006100
[PATCH 1/2] [FS_ENET] TX stuff should use fep->tx_lock, instead of fep->lock.
Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/net/fs_enet/fs_enet-main.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index a4a2a0e..927cd9e 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c @@ -348,7 +348,7 @@ static void fs_enet_tx(struct net_device *dev) int dirtyidx, do_wake, do_restart; u16 sc; - spin_lock(&fep->lock); + spin_lock(&fep->tx_lock); bdp = fep->dirty_tx; do_wake = do_restart = 0; @@ -428,7 +428,7 @@ static void fs_enet_tx(struct net_device *dev) if (do_restart) (*fep->ops->tx_restart)(dev); - spin_unlock(&fep->lock); + spin_unlock(&fep->tx_lock); if (do_wake) netif_wake_queue(dev); @@ -826,7 +826,9 @@ static int fs_enet_close(struct net_device *dev) phy_stop(fep->phydev); spin_lock_irqsave(&fep->lock, flags); + spin_lock(&fep->tx_lock); (*fep->ops->stop)(dev); + spin_unlock(&fep->tx_lock); spin_unlock_irqrestore(&fep->lock, flags); /* release any irqs */ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] [FS_ENET] Add polling support
Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]> --- drivers/net/fs_enet/fs_enet-main.c | 16 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 927cd9e..0e2d2b2 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c @@ -61,6 +61,9 @@ module_param(fs_enet_debug, int, 0); MODULE_PARM_DESC(fs_enet_debug, "Freescale bitmapped debugging message enable value"); +#ifdef CONFIG_NET_POLL_CONTROLLER +static void fs_enet_netpoll(struct net_device *dev); +#endif static void fs_set_multicast_list(struct net_device *dev) { @@ -1049,6 +1052,10 @@ static struct net_device *fs_init_instance(struct device *dev, ndev->stop = fs_enet_close; ndev->get_stats = fs_enet_get_stats; ndev->set_multicast_list = fs_set_multicast_list; + +#ifdef CONFIG_NET_POLL_CONTROLLER + ndev->poll_controller = fs_enet_netpoll; +#endif if (fpi->use_napi) { ndev->poll = fs_enet_rx_napi; ndev->weight = fpi->napi_weight; @@ -1275,6 +1282,15 @@ static void __exit fs_cleanup(void) cleanup_immap(); } +#ifdef CONFIG_NET_POLL_CONTROLLER +static void fs_enet_netpoll(struct net_device *dev) +{ + disable_irq(dev->irq); + fs_enet_interrupt(dev->irq, dev, NULL); + enable_irq(dev->irq); +} +#endif + /**/ module_init(fs_init); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/