* Re: 44x: How to increase PCIe space (is it kernel/dts/...)
From: Benjamin Herrenschmidt @ 2012-09-18 22:19 UTC (permalink / raw)
To: Ayman El-Khashab; +Cc: linuxppc-dev
In-Reply-To: <20120918215027.GA26803@crust.elkhashab.com>
On Tue, 2012-09-18 at 16:50 -0500, Ayman El-Khashab wrote:
> I've got a design that is 405EXr based so its got 32 bit
> address space. We have an FPGA that sits on our pcie bus
> and we want it to have 2 BARs with 1G of space and maybe
> 256MB of space. I cannot figure out what I need to change
> in the kernel/dts to make this work.
>
> Right now, if I go over 512MB in the DTS "ranges" parameter
> then I'll get an error during kernel boot.
>
> My thought is that the magic happens in the function:
>
> ppc4xx_pciex_port_init_mapping(...)
>
> In there I see it setting up the REGBAH and REGBAL and then
> this curious statement:
>
> /* XXX FIXME: Use size from reg property. For now, map * 512M */
> dcr_write(port->dcrs, DCRO_PEGPL_CFGMSK, 0xe0000001);
Nah, I think that's only the CFG/REG stuff isn't it ? Look at the OMR
settings in ppc4xx_setup_one_pciex_POM. Maybe something is wrong here,
or maybe it's overlapping with another region somewhere ?
Also make sure that the PCI side address is changed accordingly in
"ranges". My usual setup is to do map 512M of host space to 3.5G...4G
PCI.
If you're going to change that to 1G you need to change the PCI side to
be 1G aligned, ie, 3G..4G (and reduce the DMA window accordingly).
Cheers,
Ben.
> I figure I need to change that or fix it the right way
> (though I don't know how to do that). The other thing is my
> dts file. It is based on the amcc kilauea and here is the
> part that I am unsure of. The PCIe entry falls under the
> PLB which could also be a problem but again, I am not sure.
> So basically, is there an easy way to change what I've got
> to map 1.25 or 2GB of space?
>
Cheers,
Ben.
> Thanks
> Ayman
>
> PCIE0: pciex@0a0000000 {
> device_type = "pci";
> #interrupt-cells = <1>;
> #size-cells = <2>;
> #address-cells = <3>;
> compatible = "ibm,plb-pciex-405ex", "ibm,plb-pciex";
> primary;
> port = <0x0>; /* port number */
> reg = <0xa0000000 0x20000000 /* Config space access */
> 0xef000000 0x00001000>; /* Registers */
> dcr-reg = <0x040 0x020>;
> sdr-base = <0x400>;
>
> /* Outbound ranges, one memory and * one IO,
> * later cannot be changed
> */
> ranges = <0x02000000 0x00000000 0x80000000 0x90000000 0x00000000 0x08000000
> 0x01000000 0x00000000 0x00000000 0xe0000000 0x00000000 0x00010000>;
>
> /* Inbound 2GB range starting at 0 * */
> dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>;
>
> /* This drives busses 0x00 to 0x3f * */
> bus-range = <0x0 0x3f>;
>
> /* Legacy interrupts (note the weird * polarity, the bridge seems
> * to invert PCIe legacy
> * interrupts).
> * We are de-swizzling here because
> * the numbers are actually for
> * port of the root complex virtual
> * P2P bridge. But I want
> * to avoid putting a node for it in
> * the tree, so the numbers
> * below are basically de-swizzled
> * numbers.
> * The real slot is on idsel 0, so
> * the swizzling is 1:1
> */
> interrupt-map-mask = <0x0 0x0 0x0 0x7>;
> interrupt-map = < 0x0 0x0 0x0 0x1 &UIC2 0x0 0x4 /* swizzled int A */
> 0x0 0x0 0x0 0x2 &UIC2 0x1 0x4 /* swizzled int B */
> 0x0 0x0 0x0 0x3 &UIC2 0x2 0x4 /* swizzled int C */
> 0x0 0x0 0x0 0x4 &UIC2 0x3 0x4 /* swizzled int D */>;
> };
>
>
>
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply
* 44x: How to increase PCIe space (is it kernel/dts/...)
From: Ayman El-Khashab @ 2012-09-18 21:50 UTC (permalink / raw)
To: linuxppc-dev
I've got a design that is 405EXr based so its got 32 bit
address space. We have an FPGA that sits on our pcie bus
and we want it to have 2 BARs with 1G of space and maybe
256MB of space. I cannot figure out what I need to change
in the kernel/dts to make this work.
Right now, if I go over 512MB in the DTS "ranges" parameter
then I'll get an error during kernel boot.
My thought is that the magic happens in the function:
ppc4xx_pciex_port_init_mapping(...)
In there I see it setting up the REGBAH and REGBAL and then
this curious statement:
/* XXX FIXME: Use size from reg property. For now, map * 512M */
dcr_write(port->dcrs, DCRO_PEGPL_CFGMSK, 0xe0000001);
I figure I need to change that or fix it the right way
(though I don't know how to do that). The other thing is my
dts file. It is based on the amcc kilauea and here is the
part that I am unsure of. The PCIe entry falls under the
PLB which could also be a problem but again, I am not sure.
So basically, is there an easy way to change what I've got
to map 1.25 or 2GB of space?
Thanks
Ayman
PCIE0: pciex@0a0000000 {
device_type = "pci";
#interrupt-cells = <1>;
#size-cells = <2>;
#address-cells = <3>;
compatible = "ibm,plb-pciex-405ex", "ibm,plb-pciex";
primary;
port = <0x0>; /* port number */
reg = <0xa0000000 0x20000000 /* Config space access */
0xef000000 0x00001000>; /* Registers */
dcr-reg = <0x040 0x020>;
sdr-base = <0x400>;
/* Outbound ranges, one memory and * one IO,
* later cannot be changed
*/
ranges = <0x02000000 0x00000000 0x80000000 0x90000000 0x00000000 0x08000000
0x01000000 0x00000000 0x00000000 0xe0000000 0x00000000 0x00010000>;
/* Inbound 2GB range starting at 0 * */
dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>;
/* This drives busses 0x00 to 0x3f * */
bus-range = <0x0 0x3f>;
/* Legacy interrupts (note the weird * polarity, the bridge seems
* to invert PCIe legacy
* interrupts).
* We are de-swizzling here because
* the numbers are actually for
* port of the root complex virtual
* P2P bridge. But I want
* to avoid putting a node for it in
* the tree, so the numbers
* below are basically de-swizzled
* numbers.
* The real slot is on idsel 0, so
* the swizzling is 1:1
*/
interrupt-map-mask = <0x0 0x0 0x0 0x7>;
interrupt-map = < 0x0 0x0 0x0 0x1 &UIC2 0x0 0x4 /* swizzled int A */
0x0 0x0 0x0 0x2 &UIC2 0x1 0x4 /* swizzled int B */
0x0 0x0 0x0 0x3 &UIC2 0x2 0x4 /* swizzled int C */
0x0 0x0 0x0 0x4 &UIC2 0x3 0x4 /* swizzled int D */>;
};
^ permalink raw reply
* Re: [PATCH] powerpc/fsl-pci: fix warning when CONFIG_SWIOTLB is disabled
From: Michael Neuling @ 2012-09-18 21:06 UTC (permalink / raw)
To: Jia Hongtao; +Cc: linuxppc-dev
In-Reply-To: <1347962268-25136-1-git-send-email-B38951@freescale.com>
Jia Hongtao <B38951@freescale.com> wrote:
> Fix the following warning:
> arch/powerpc/sysdev/fsl_pci.c: In function 'fsl_pci_probe':
> arch/powerpc/sysdev/fsl_pci.c:867:25: error: unused variable 'hose'
>
> Signed-off-by: Jia Hongtao <B38951@freescale.com>
Acked-by: Michael Neuling <mikey@neuling.org>
> ---
> arch/powerpc/sysdev/fsl_pci.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
> index 2ff3576..3d6f4d8 100644
> --- a/arch/powerpc/sysdev/fsl_pci.c
> +++ b/arch/powerpc/sysdev/fsl_pci.c
> @@ -864,7 +864,9 @@ static int __devinit fsl_pci_probe(struct platform_device *pdev)
> {
> int ret;
> struct device_node *node;
> +#ifdef CONFIG_SWIOTLB
> struct pci_controller *hose;
> +#endif
>
> node = pdev->dev.of_node;
> ret = fsl_add_bridge(node, fsl_pci_primary == node);
> --
> 1.7.5.1
>
>
^ permalink raw reply
* [PATCH] arch/powerpc: dtc is required to build dtb files
From: Matthew McClintock @ 2012-09-18 19:50 UTC (permalink / raw)
To: linuxppc-dev
Fixes this following:
$ make distclean; make corenet32_smp_defconfig; make p4080ds.dtb
CLEAN arch/powerpc/boot
CLEAN scripts/basic
CLEAN scripts/dtc
CLEAN scripts/genksyms
CLEAN scripts/kconfig
CLEAN scripts/mod
CLEAN scripts
CLEAN include/config include/generated
CLEAN .config
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
DTC arch/powerpc/boot/p4080ds.dtb
/bin/sh: /local/home/mattsm/git/linux/scripts/dtc/dtc: No such file or directory
make[1]: *** [arch/powerpc/boot/p4080ds.dtb] Error 1
make: *** [p4080ds.dtb] Error 2
Signed-off-by: Matthew McClintock <msm@freescale.com>
---
arch/powerpc/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 159e94f..b639852 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -181,7 +181,7 @@ $(BOOT_TARGETS2): vmlinux
bootwrapper_install:
$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
-%.dtb:
+%.dtb: scripts
$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
define archhelp
--
1.7.9.7
^ permalink raw reply related
* [PATCH RESEND] rapidio: apply RX/TX enable to active switch ports only
From: Alexandre Bounine @ 2012-09-18 18:27 UTC (permalink / raw)
To: Andrew Morton, linux-kernel, linuxppc-dev; +Cc: Alexandre Bounine
Apply port RX/TX enable operations only to active switch ports.
RapidIO specification (Part 6: LP-Serial Physical Layer)
recommends to keep Output Port Enable (TX) and Input Port Enable (RX)
control bits in disabled state (0b0) after device reset. It also allows
to have implementation specific reset state for these bits.
This patch ensures that TX/RX enable action is applied only to active
switch's ports while preserving an initial state of inactive ones.
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
---
RESEND: Initial submission of this patch was dropped due to feedback
comment which raised concern about some RapidIO switch implementations
that may be affected by the change. After specification and device details
review this patch declared to be safe because it preserves any combination
of initial states of RX/TX enable for inactive port.
drivers/rapidio/rio-scan.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index 2bebd79..02e686b 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -839,12 +839,10 @@ static int __devinit rio_enum_peer(struct rio_net *net, struct rio_mport *port,
for (port_num = 0;
port_num < RIO_GET_TOTAL_PORTS(rdev->swpinfo);
port_num++) {
- /*Enable Input Output Port (transmitter reviever)*/
- rio_enable_rx_tx_port(port, 0,
+ if (sw_inport == port_num) {
+ rio_enable_rx_tx_port(port, 0,
RIO_ANY_DESTID(port->sys_size),
hopcount, port_num);
-
- if (sw_inport == port_num) {
rdev->rswitch->port_ok |= (1 << port_num);
continue;
}
@@ -857,6 +855,9 @@ static int __devinit rio_enum_peer(struct rio_net *net, struct rio_mport *port,
pr_debug(
"RIO: scanning device on port %d\n",
port_num);
+ rio_enable_rx_tx_port(port, 0,
+ RIO_ANY_DESTID(port->sys_size),
+ hopcount, port_num);
rdev->rswitch->port_ok |= (1 << port_num);
rio_route_add_entry(rdev, RIO_GLOBAL_TABLE,
RIO_ANY_DESTID(port->sys_size),
--
1.7.8.4
^ permalink raw reply related
* Re: Build regressions/improvements in v3.6-rc6
From: Geert Uytterhoeven @ 2012-09-18 18:15 UTC (permalink / raw)
To: linux-kernel, linuxppc-dev, Linux-sh list
In-Reply-To: <1347991700-22730-1-git-send-email-geert@linux-m68k.org>
On Tue, Sep 18, 2012 at 8:08 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> JFYI, when comparing v3.6-rc6 to v3.6-rc5[3], the summaries are:
> - build errors: +14/-16
14 regressions:
+ arch/powerpc/mm/tlb_nohash_low.S: Error: bad expression: => 212,
234, 232, 230
+ arch/powerpc/mm/tlb_nohash_low.S: Error: junk at end of line,
first unrecognized character is `r': => 212, 234, 232, 230
+ arch/powerpc/mm/tlb_nohash_low.S: Error: missing ')': => 212, 234, 232, 230
44x/currituck_defconfig
+ error: ci13xxx_imx.c: undefined reference to `devm_clk_get': =>
.devinit.text+0x4b154)
+ error: exynos-rng.c: undefined reference to `devm_clk_get': =>
.devinit.text+0x2da54)
+ error: flexcan.c: undefined reference to `devm_clk_get': =>
.devinit.text+0x43148), .devinit.text+0x430c8)
powerpc-randconfig
+ error: fore200e.c: relocation truncated to fit: R_PPC64_REL24
against symbol `.ktime_get_real' defined in .text section in
kernel/built-in.o: => (.text+0x1ff8928)
+ error: fore200e.c: relocation truncated to fit: R_PPC64_REL24
against symbol `.msecs_to_jiffies' defined in .text section in
kernel/built-in.o: => (.text+0x1ff9068)
+ error: fore200e.c: relocation truncated to fit: R_PPC64_REL24
against symbol `.panic' defined in .text.unlikely section in
kernel/built-in.o: => (.text+0x1ff9be4)
+ error: fore200e.c: relocation truncated to fit: R_PPC64_REL24
against symbol `_restgpr0_14' defined in .text.save.restore section in
arch/powerpc/lib/built-in.o: => (.text+0x1ff876c)
+ error: fore200e.c: relocation truncated to fit: R_PPC64_REL24
against symbol `_savegpr0_20' defined in .text.save.restore section in
arch/powerpc/lib/built-in.o: => (.text+0x1ff8774)
+ error: fore200e.c: relocation truncated to fit: R_PPC64_REL24
against symbol `_savegpr0_23' defined in .text.save.restore section in
arch/powerpc/lib/built-in.o: => (.text+0x1ff9358)
+ error: fore200e.c: relocation truncated to fit: R_PPC64_REL24
against symbol `_savegpr0_29' defined in .text.save.restore section in
arch/powerpc/lib/built-in.o: => (.text+0x1ff8ebc)
powerpc-allyesconfig
+ kernel/sys.c: error: 'mmap_min_addr' undeclared (first use in this
function): 1868:34 => 1868:37, 1868:34
sh-allyesconfig, sh-allmodconfig, sh-randconfig
> [1] http://kisskb.ellerman.id.au/kisskb/head/5424/ (117 out of 116 configs)
Doh, forgot to update my scripts for the increase in configs...
> [3] http://kisskb.ellerman.id.au/kisskb/head/5400/ (all 116 configs)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH v2] powerpc/usb: fix bug of CPU hang when missing USB PHY clock
From: Greg KH @ 2012-09-18 14:34 UTC (permalink / raw)
To: Kumar Gala; +Cc: linux-usb, linuxppc-dev@lists.ozlabs.org list, Shengzhou Liu
In-Reply-To: <6E81CB63-79F1-4C45-87A6-28048351FF84@kernel.crashing.org>
On Tue, Sep 18, 2012 at 12:35:09AM -0500, Kumar Gala wrote:
>
> On Aug 22, 2012, at 5:17 AM, Shengzhou Liu wrote:
>
> > when missing USB PHY clock, kernel booting up will hang during USB
> > initialization. We should check USBGP[PHY_CLK_VALID] bit to avoid
> > CPU hanging in this case.
> >
> > Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> > ---
> > v2 changes: use spin_event_timeout() instead.
> >
> > drivers/usb/host/ehci-fsl.c | 58 +++++++++++++++++++++++++++++-------------
> > drivers/usb/host/ehci-fsl.h | 1 +
> > include/linux/fsl_devices.h | 1 +
> > 3 files changed, 42 insertions(+), 18 deletions(-)
>
> Greg,
>
> Any issues picking this fix up for v3.6 inclusion?
Yes, I will not as there is a v3 out there that I want some review on
before I can take it...
thanks,
greg k-h
^ permalink raw reply
* [PATCH 2/2] rapidio/tsi721: add inbound memory mapping callbacks
From: Alexandre Bounine @ 2012-09-18 13:37 UTC (permalink / raw)
To: Andrew Morton, linux-kernel, linuxppc-dev; +Cc: Alexandre Bounine
In-Reply-To: <1347975441-6723-1-git-send-email-alexandre.bounine@idt.com>
Add Tsi721 routines to support RapidIO subsystem's inbound memory mapping
interface (RapidIO to system's local memory).
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
---
drivers/rapidio/devices/tsi721.c | 88 +++++++++++++++++++++++++++++++++++++-
drivers/rapidio/devices/tsi721.h | 15 +++++-
2 files changed, 99 insertions(+), 4 deletions(-)
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
index 1974359..961dc7a 100644
--- a/drivers/rapidio/devices/tsi721.c
+++ b/drivers/rapidio/devices/tsi721.c
@@ -862,6 +862,90 @@ static void tsi721_init_pc2sr_mapping(struct tsi721_device *priv)
}
/**
+ * tsi721_rio_map_inb_mem -- Mapping inbound memory region.
+ * @mport: RapidIO master port
+ * @lstart: Local memory space start address.
+ * @rstart: RapidIO space start address.
+ * @size: The mapping region size.
+ * @flags: Flags for mapping. 0 for using default flags.
+ *
+ * Return: 0 -- Success.
+ *
+ * This function will create the inbound mapping
+ * from rstart to lstart.
+ */
+static int tsi721_rio_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
+ u64 rstart, u32 size, u32 flags)
+{
+ struct tsi721_device *priv = mport->priv;
+ int i;
+ u32 regval;
+
+ if (!is_power_of_2(size) || size < 0x1000 ||
+ ((u64)lstart & (size - 1)) || (rstart & (size - 1)))
+ return -EINVAL;
+
+ /* Search for free inbound translation window */
+ for (i = 0; i < TSI721_IBWIN_NUM; i++) {
+ regval = ioread32(priv->regs + TSI721_IBWIN_LB(i));
+ if (!(regval & TSI721_IBWIN_LB_WEN))
+ break;
+ }
+
+ if (i >= TSI721_IBWIN_NUM) {
+ dev_err(&priv->pdev->dev,
+ "Unable to find free inbound window\n");
+ return -EBUSY;
+ }
+
+ iowrite32(TSI721_IBWIN_SIZE(size) << 8,
+ priv->regs + TSI721_IBWIN_SZ(i));
+
+ iowrite32(((u64)lstart >> 32), priv->regs + TSI721_IBWIN_TUA(i));
+ iowrite32(((u64)lstart & TSI721_IBWIN_TLA_ADD),
+ priv->regs + TSI721_IBWIN_TLA(i));
+
+ iowrite32(rstart >> 32, priv->regs + TSI721_IBWIN_UB(i));
+ iowrite32((rstart & TSI721_IBWIN_LB_BA) | TSI721_IBWIN_LB_WEN,
+ priv->regs + TSI721_IBWIN_LB(i));
+ dev_dbg(&priv->pdev->dev,
+ "Configured IBWIN%d mapping (RIO_0x%llx -> PCIe_0x%llx)\n",
+ i, rstart, (unsigned long long)lstart);
+
+ return 0;
+}
+
+/**
+ * fsl_rio_unmap_inb_mem -- Unmapping inbound memory region.
+ * @mport: RapidIO master port
+ * @lstart: Local memory space start address.
+ */
+static void tsi721_rio_unmap_inb_mem(struct rio_mport *mport,
+ dma_addr_t lstart)
+{
+ struct tsi721_device *priv = mport->priv;
+ int i;
+ u64 addr;
+ u32 regval;
+
+ /* Search for matching active inbound translation window */
+ for (i = 0; i < TSI721_IBWIN_NUM; i++) {
+ regval = ioread32(priv->regs + TSI721_IBWIN_LB(i));
+ if (regval & TSI721_IBWIN_LB_WEN) {
+ regval = ioread32(priv->regs + TSI721_IBWIN_TUA(i));
+ addr = (u64)regval << 32;
+ regval = ioread32(priv->regs + TSI721_IBWIN_TLA(i));
+ addr |= regval & TSI721_IBWIN_TLA_ADD;
+
+ if (addr == (u64)lstart) {
+ iowrite32(0, priv->regs + TSI721_IBWIN_LB(i));
+ break;
+ }
+ }
+ }
+}
+
+/**
* tsi721_init_sr2pc_mapping - initializes inbound (SRIO->PCIe)
* translation regions.
* @priv: pointer to tsi721 private data
@@ -874,7 +958,7 @@ static void tsi721_init_sr2pc_mapping(struct tsi721_device *priv)
/* Disable all SR2PC inbound windows */
for (i = 0; i < TSI721_IBWIN_NUM; i++)
- iowrite32(0, priv->regs + TSI721_IBWINLB(i));
+ iowrite32(0, priv->regs + TSI721_IBWIN_LB(i));
}
/**
@@ -2144,6 +2228,8 @@ static int __devinit tsi721_setup_mport(struct tsi721_device *priv)
ops->add_outb_message = tsi721_add_outb_message;
ops->add_inb_buffer = tsi721_add_inb_buffer;
ops->get_inb_message = tsi721_get_inb_message;
+ ops->map_inb = tsi721_rio_map_inb_mem;
+ ops->unmap_inb = tsi721_rio_unmap_inb_mem;
mport = kzalloc(sizeof(struct rio_mport), GFP_KERNEL);
if (!mport) {
diff --git a/drivers/rapidio/devices/tsi721.h b/drivers/rapidio/devices/tsi721.h
index 59de9d7..7d5b13b 100644
--- a/drivers/rapidio/devices/tsi721.h
+++ b/drivers/rapidio/devices/tsi721.h
@@ -156,9 +156,18 @@
#define TSI721_IBWIN_NUM 8
-#define TSI721_IBWINLB(x) (0x29000 + (x) * 0x20)
-#define TSI721_IBWINLB_BA 0xfffff000
-#define TSI721_IBWINLB_WEN 0x00000001
+#define TSI721_IBWIN_LB(x) (0x29000 + (x) * 0x20)
+#define TSI721_IBWIN_LB_BA 0xfffff000
+#define TSI721_IBWIN_LB_WEN 0x00000001
+
+#define TSI721_IBWIN_UB(x) (0x29004 + (x) * 0x20)
+#define TSI721_IBWIN_SZ(x) (0x29008 + (x) * 0x20)
+#define TSI721_IBWIN_SZ_SIZE 0x00001f00
+#define TSI721_IBWIN_SIZE(size) (__fls(size) - 12)
+
+#define TSI721_IBWIN_TLA(x) (0x2900c + (x) * 0x20)
+#define TSI721_IBWIN_TLA_ADD 0xfffff000
+#define TSI721_IBWIN_TUA(x) (0x29010 + (x) * 0x20)
#define TSI721_SR2PC_GEN_INTE 0x29800
#define TSI721_SR2PC_PWE 0x29804
--
1.7.8.4
^ permalink raw reply related
* [PATCH 0/2] rapidio: add inbound memory mapping API
From: Alexandre Bounine @ 2012-09-18 13:37 UTC (permalink / raw)
To: Andrew Morton, linux-kernel, linuxppc-dev; +Cc: Alexandre Bounine
Add RapidIO subsystem interface to support mapping of RapidIO memory space into
system's local memory.
RapidIO specification defines memory mapped read (NREAD) and write (NWRITE,
NWRITE_R and SWRITE) requests that allow to access memory space on remote target
device. Existing RapidIO controllers/bridges provide hardware mechanism
to map addresses on RapidIO side into system's local memory. Patches provided in
this package define common interface that has to be supported by RIO master port
devices and hardware dependent implementation for IDT Tsi721 PCIe-to-SRIO bridge.
These patches are based on the work submitted by Li Yang <leoli@freescale.com>
(https://lists.ozlabs.org/pipermail/linuxppc-dev/2009-April/071210.html) but
implement only the inbound mapping portion of it.
Combined with RapidIO DMA engine interface support these patches allow to perform
memory mapped data transfers between devices connected to a RapidIO network.
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
---
Alexandre Bounine (2):
rapidio: add inbound memory mapping interface
rapidio/tsi721: add inbound memory mapping callbacks
drivers/rapidio/devices/tsi721.c | 88 +++++++++++++++++++++++++++++++++++++-
drivers/rapidio/devices/tsi721.h | 15 +++++-
drivers/rapidio/rio.c | 44 +++++++++++++++++++
include/linux/rio.h | 5 ++
include/linux/rio_drv.h | 5 ++
5 files changed, 153 insertions(+), 4 deletions(-)
--
1.7.8.4
^ permalink raw reply
* [PATCH 1/2] rapidio: add inbound memory mapping interface
From: Alexandre Bounine @ 2012-09-18 13:37 UTC (permalink / raw)
To: Andrew Morton, linux-kernel, linuxppc-dev; +Cc: Alexandre Bounine
In-Reply-To: <1347975441-6723-1-git-send-email-alexandre.bounine@idt.com>
Add common inbound memory mapping/unmapping interface. This allows to make
local memory space accessible from the RapidIO side using hardware mapping
capabilities of RapidIO bridging devices. The new interface is intended to
enable data transfers between RapidIO devices in combination with DMA engine
support.
This patch is based on patch submitted by Li Yang <leoli@freescale.com>
(https://lists.ozlabs.org/pipermail/linuxppc-dev/2009-April/071210.html)
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
---
drivers/rapidio/rio.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
include/linux/rio.h | 5 +++++
include/linux/rio_drv.h | 5 +++++
3 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index c40665a..d7b68cc 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -33,6 +33,7 @@
static LIST_HEAD(rio_mports);
static unsigned char next_portid;
+static DEFINE_SPINLOCK(rio_mmap_lock);
/**
* rio_local_get_device_id - Get the base/extended device id for a port
@@ -398,6 +399,49 @@ int rio_release_inb_pwrite(struct rio_dev *rdev)
EXPORT_SYMBOL_GPL(rio_release_inb_pwrite);
/**
+ * rio_map_inb_region -- Map inbound memory region.
+ * @mport: Master port.
+ * @lstart: physical address of memory region to be mapped
+ * @rbase: RIO base address assigned to this window
+ * @size: Size of the memory region
+ * @rflags: Flags for mapping.
+ *
+ * Return: 0 -- Success.
+ *
+ * This function will create the mapping from RIO space to local memory.
+ */
+int rio_map_inb_region(struct rio_mport *mport, dma_addr_t local,
+ u64 rbase, u32 size, u32 rflags)
+{
+ int rc = 0;
+ unsigned long flags;
+
+ if (!mport->ops->map_inb)
+ return -1;
+ spin_lock_irqsave(&rio_mmap_lock, flags);
+ rc = mport->ops->map_inb(mport, local, rbase, size, rflags);
+ spin_unlock_irqrestore(&rio_mmap_lock, flags);
+ return rc;
+}
+EXPORT_SYMBOL_GPL(rio_map_inb_region);
+
+/**
+ * rio_unmap_inb_region -- Unmap the inbound memory region
+ * @mport: Master port
+ * @lstart: physical address of memory region to be unmapped
+ */
+void rio_unmap_inb_region(struct rio_mport *mport, dma_addr_t lstart)
+{
+ unsigned long flags;
+ if (!mport->ops->unmap_inb)
+ return;
+ spin_lock_irqsave(&rio_mmap_lock, flags);
+ mport->ops->unmap_inb(mport, lstart);
+ spin_unlock_irqrestore(&rio_mmap_lock, flags);
+}
+EXPORT_SYMBOL_GPL(rio_unmap_inb_region);
+
+/**
* rio_mport_get_physefb - Helper function that returns register offset
* for Physical Layer Extended Features Block.
* @port: Master port to issue transaction
diff --git a/include/linux/rio.h b/include/linux/rio.h
index ba382f2..4d1a104 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -301,6 +301,8 @@ struct rio_net {
* @add_outb_message: Callback to add a message to an outbound mailbox queue.
* @add_inb_buffer: Callback to add a buffer to an inbound mailbox queue.
* @get_inb_message: Callback to get a message from an inbound mailbox queue.
+ * @map_inb: Callback to map RapidIO address region into local memory space.
+ * @unmap_inb: Callback to unmap RapidIO address region mapped with map_inb().
*/
struct rio_ops {
int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
@@ -323,6 +325,9 @@ struct rio_ops {
int mbox, void *buffer, size_t len);
int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf);
void *(*get_inb_message)(struct rio_mport *mport, int mbox);
+ int (*map_inb)(struct rio_mport *mport, dma_addr_t lstart,
+ u64 rstart, u32 size, u32 flags);
+ void (*unmap_inb)(struct rio_mport *mport, dma_addr_t lstart);
};
#define RIO_RESOURCE_MEM 0x00000100
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 31ad146..b75c059 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -365,6 +365,11 @@ void rio_release_regions(struct rio_dev *);
int rio_request_region(struct rio_dev *, int, char *);
void rio_release_region(struct rio_dev *, int);
+/* Memory mapping functions */
+extern int rio_map_inb_region(struct rio_mport *mport, dma_addr_t local,
+ u64 rbase, u32 size, u32 rflags);
+extern void rio_unmap_inb_region(struct rio_mport *mport, dma_addr_t lstart);
+
/* Port-Write management */
extern int rio_request_inb_pwrite(struct rio_dev *,
int (*)(struct rio_dev *, union rio_pw_msg*, int));
--
1.7.8.4
^ permalink raw reply related
* [PATCH 09/10] drivers/video/ps3fb.c: fix error return code
From: Peter Senna Tschudin @ 2012-09-18 12:07 UTC (permalink / raw)
To: geoff
Cc: cbe-oss-dev, linux-fbdev, FlorianSchandinat, Peter Senna Tschudin,
kernel-janitors, linux-kernel, linuxppc-dev
In-Reply-To: <1347970080-25175-1-git-send-email-peter.senna@gmail.com>
From: Peter Senna Tschudin <peter.senna@gmail.com>
Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
drivers/video/ps3fb.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 4e292f2..0b340d6 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -1034,6 +1034,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
if (status) {
dev_err(&dev->core, "%s: lv1_gpu_memory_allocate failed: %d\n",
__func__, status);
+ retval = -ENOMEM;
goto err_close_device;
}
dev_dbg(&dev->core, "ddr:lpar:0x%llx\n", ddr_lpar);
@@ -1046,6 +1047,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
dev_err(&dev->core,
"%s: lv1_gpu_context_allocate failed: %d\n", __func__,
status);
+ retval = -ENOMEM;
goto err_gpu_memory_free;
}
@@ -1053,6 +1055,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
dinfo = (void __force *)ioremap(lpar_driver_info, 128 * 1024);
if (!dinfo) {
dev_err(&dev->core, "%s: ioremap failed\n", __func__);
+ retval = -ENOMEM;
goto err_gpu_context_free;
}
@@ -1121,8 +1124,10 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
}
info = framebuffer_alloc(sizeof(struct ps3fb_par), &dev->core);
- if (!info)
+ if (!info) {
+ retval = -ENOMEM;
goto err_context_fb_close;
+ }
par = info->par;
par->mode_id = ~ps3fb_mode; /* != ps3fb_mode, to trigger change */
--
1.7.11.4
^ permalink raw reply related
* RE: [PATCH V10] powerpc/fsl-pci: Unify pci/pcie initialization code
From: Jia Hongtao-B38951 @ 2012-09-18 10:34 UTC (permalink / raw)
To: Michael Neuling
Cc: Wood Scott-B07421, linux-next@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org
In-Reply-To: <14502.1347962174@neuling.org>
> -----Original Message-----
> From: Michael Neuling [mailto:mikey@neuling.org]
> Sent: Tuesday, September 18, 2012 5:56 PM
> To: Jia Hongtao-B38951
> Cc: linuxppc-dev@lists.ozlabs.org; galak@kernel.crashing.org; Wood Scott-
> B07421; benh@kernel.crashing.org; linux-next@vger.kernel.org
> Subject: Re: [PATCH V10] powerpc/fsl-pci: Unify pci/pcie initialization
> code
>=20
> > +static int __devinit fsl_pci_probe(struct platform_device *pdev) {
> > + int ret;
> > + struct device_node *node;
> > + struct pci_controller *hose;
> > +
> > + node =3D pdev->dev.of_node;
> > + ret =3D fsl_add_bridge(node, fsl_pci_primary =3D=3D node);
> >
> > #ifdef CONFIG_SWIOTLB
> > - /*
> > - * if we couldn't map all of DRAM via the dma windows
> > - * we need SWIOTLB to handle buffers located outside of
> > - * dma capable memory region
> > - */
> > - if (memblock_end_of_DRAM() - 1 > max)
> > - ppc_swiotlb_enable =3D 1;
> > + if (ret =3D=3D 0) {
> > + hose =3D pci_find_hose_for_OF_device(pdev->dev.of_node);
> > +
> > + /*
> > + * if we couldn't map all of DRAM via the dma windows
> > + * we need SWIOTLB to handle buffers located outside of
> > + * dma capable memory region
> > + */
> > + if (memblock_end_of_DRAM() - 1 > hose->dma_window_base_cur +
> > + hose->dma_window_size)
> > + ppc_swiotlb_enable =3D 1;
> > + }
> > #endif
> > +
> > + mpc85xx_pci_err_probe(pdev);
> > +
> > + return 0;
> > +}
>=20
> This breaks when CONFIG_SWIOTLB is disabled (chroma_defconfig hit this
> next-20120918), but think this could also hit in Linus tree:
>=20
> arch/powerpc/sysdev/fsl_pci.c: In function 'fsl_pci_probe':
> arch/powerpc/sysdev/fsl_pci.c:867:25: error: unused variable 'hose' [-
> Werror=3Dunused-variable]
> cc1: all warnings being treated as errors
>=20
> Mikey
You are right, it's a problem.
I already send a patch to fix this.
Pls refer to http://patchwork.ozlabs.org/patch/184673/
Thanks for your response.
- Hongtao.
^ permalink raw reply
* [PATCH] powerpc/fsl-pci: fix warning when CONFIG_SWIOTLB is disabled
From: Jia Hongtao @ 2012-09-18 9:57 UTC (permalink / raw)
To: linuxppc-dev, galak; +Cc: mikey, b38951
Fix the following warning:
arch/powerpc/sysdev/fsl_pci.c: In function 'fsl_pci_probe':
arch/powerpc/sysdev/fsl_pci.c:867:25: error: unused variable 'hose'
Signed-off-by: Jia Hongtao <B38951@freescale.com>
---
arch/powerpc/sysdev/fsl_pci.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 2ff3576..3d6f4d8 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -864,7 +864,9 @@ static int __devinit fsl_pci_probe(struct platform_device *pdev)
{
int ret;
struct device_node *node;
+#ifdef CONFIG_SWIOTLB
struct pci_controller *hose;
+#endif
node = pdev->dev.of_node;
ret = fsl_add_bridge(node, fsl_pci_primary == node);
--
1.7.5.1
^ permalink raw reply related
* Re: [PATCH V10] powerpc/fsl-pci: Unify pci/pcie initialization code
From: Michael Neuling @ 2012-09-18 9:56 UTC (permalink / raw)
To: Jia Hongtao; +Cc: B07421, linux-next, linuxppc-dev
In-Reply-To: <1346139848-28021-1-git-send-email-B38951@freescale.com>
> +static int __devinit fsl_pci_probe(struct platform_device *pdev)
> +{
> + int ret;
> + struct device_node *node;
> + struct pci_controller *hose;
> +
> + node = pdev->dev.of_node;
> + ret = fsl_add_bridge(node, fsl_pci_primary == node);
>
> #ifdef CONFIG_SWIOTLB
> - /*
> - * if we couldn't map all of DRAM via the dma windows
> - * we need SWIOTLB to handle buffers located outside of
> - * dma capable memory region
> - */
> - if (memblock_end_of_DRAM() - 1 > max)
> - ppc_swiotlb_enable = 1;
> + if (ret == 0) {
> + hose = pci_find_hose_for_OF_device(pdev->dev.of_node);
> +
> + /*
> + * if we couldn't map all of DRAM via the dma windows
> + * we need SWIOTLB to handle buffers located outside of
> + * dma capable memory region
> + */
> + if (memblock_end_of_DRAM() - 1 > hose->dma_window_base_cur +
> + hose->dma_window_size)
> + ppc_swiotlb_enable = 1;
> + }
> #endif
> +
> + mpc85xx_pci_err_probe(pdev);
> +
> + return 0;
> +}
This breaks when CONFIG_SWIOTLB is disabled (chroma_defconfig hit this
next-20120918), but think this could also hit in Linus tree:
arch/powerpc/sysdev/fsl_pci.c: In function 'fsl_pci_probe':
arch/powerpc/sysdev/fsl_pci.c:867:25: error: unused variable 'hose' [-Werror=unused-variable]
cc1: all warnings being treated as errors
Mikey
^ permalink raw reply
* Re: [RFC v8 PATCH 00/20] memory-hotplug: hot-remove physical memory
From: Wen Congyang @ 2012-09-18 9:39 UTC (permalink / raw)
To: Vasilis Liaskovitis
Cc: linux-s390, linux-ia64, len.brown, linux-acpi, linux-sh, x86,
linux-kernel, cmetcalf, linux-mm, Yasuaki Ishimatsu, paulus,
minchan.kim, kosaki.motohiro, rientjes, sparclinux, Andrew Morton,
linuxppc-dev, cl, liuj97
In-Reply-To: <20120912171814.GB5253@dhcp-192-168-178-175.profitbricks.localdomain>
At 09/13/2012 01:18 AM, Vasilis Liaskovitis Wrote:
> Hi,
>
> On Wed, Sep 12, 2012 at 01:20:28PM +0800, Wen Congyang wrote:
>>>
>>> On Mon, Sep 10, 2012 at 10:01:44AM +0800, Wen Congyang wrote:
>>>> At 09/10/2012 09:46 AM, Yasuaki Ishimatsu Wrote:
>>>>> How do you test the patch? As Andrew says, for hot-removing memory,
>>>>> we need a particular hardware. I think so too. So many people may want
>>>>> to know how to test the patch.
>>>>> If we apply following patch to kvm guest, can we hot-remove memory on
>>>>> kvm guest?
>>>>>
>>>>> http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg01389.html
>>>>
>>>> Yes, if we apply this patchset, we can test hot-remove memory on kvm guest.
>>>> But that patchset doesn't implement _PS3, so there is some restriction.
>>>
>>> the following repos contain the patchset above, plus 2 more patches that add
>>> PS3 support to the dimm devices in qemu/seabios:
>>>
>>> https://github.com/vliaskov/seabios/commits/memhp-v2
>>> https://github.com/vliaskov/qemu-kvm/commits/memhp-v2
>>>
>>> I have not posted the PS3 patches yet in the qemu list, but will post them
>>> soon for v3 of the memory hotplug series. If you have issues testing, let me
>>> know.
>>
>> Hmm, seabios doesn't support ACPI table SLIT. We can specify node it for dimm
>> device, so I think we should support SLIT in seabios. Otherwise we may meet
>> the following kernel messages:
>> [ 325.016769] init_memory_mapping: [mem 0x40000000-0x5fffffff]
>> [ 325.018060] [mem 0x40000000-0x5fffffff] page 2M
>> [ 325.019168] [ffffea0001000000-ffffea00011fffff] potential offnode page_structs
>> [ 325.024172] [ffffea0001200000-ffffea00013fffff] potential offnode page_structs
>> [ 325.028596] [ffffea0001400000-ffffea00017fffff] PMD -> [ffff880035000000-ffff8800353fffff] on node 1
>> [ 325.031775] [ffffea0001600000-ffffea00017fffff] potential offnode page_structs
>>
>> Do you have plan to do it?
> thanks for testing.
>
> commit 5294828 from https://github.com/vliaskov/seabios/commits/memhp-v2
> implements a SLIT table for the given numa nodes.
Hmm, why do you set node_distance(i, j) to REMOTE_DISTANCE if i != j?
>
> However I am not sure the SLIT is the problem. The kernel builds a default
> numa_distance table in arch/x86/mm/numa.c: numa_alloc_distance(). If the BIOS
> doesn't present a SLIT, this should take effect (numactl --hardware should
> report this table)
If the BIOS doesn't present a SLIT, numa_distance_cnt is set to 0 in the
function numa_reset_distance(). So node_distance(i, j) is REMOTE_DISTANCE(i != j).
>
> Do you have more details on how to reproduce the warning? e.g. how many dimms
> are present in the system? Does this happen on the first dimm hot-plugged?
> Are all SRAT entries parsed correctly at boot-time or do you see any other
> warnings at boot-time?
I can't reproduce it again. IIRC, I only do the following things:
hotplug a memory device, online the pages, offline the pages and hot remove
the memory device.
Thanks
Wen Congyang
>
> I 'll investigate a bit more and report back.
>
> thanks,
>
> - Vasilis
>
^ permalink raw reply
* RE: [PATCH v2] powerpc/usb: fix bug of CPU hang when missing USB PHY clock
From: Liu Shengzhou-B36685 @ 2012-09-18 9:31 UTC (permalink / raw)
To: Kumar Gala, Greg KH
Cc: linux-usb@vger.kernel.org, linuxppc-dev@lists.ozlabs.org list
In-Reply-To: <6E81CB63-79F1-4C45-87A6-28048351FF84@kernel.crashing.org>
> -----Original Message-----
> From: Kumar Gala [mailto:galak@kernel.crashing.org]
> Sent: Tuesday, September 18, 2012 1:35 PM
> To: Greg KH
> Cc: Liu Shengzhou-B36685; linuxppc-dev@lists.ozlabs.org list; linux-
> usb@vger.kernel.org
> Subject: Re: [PATCH v2] powerpc/usb: fix bug of CPU hang when missing USB
> PHY clock
>=20
>=20
> On Aug 22, 2012, at 5:17 AM, Shengzhou Liu wrote:
>=20
> > when missing USB PHY clock, kernel booting up will hang during USB
> > initialization. We should check USBGP[PHY_CLK_VALID] bit to avoid CPU
> > hanging in this case.
> >
> > Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> > ---
> > v2 changes: use spin_event_timeout() instead.
> >
> > drivers/usb/host/ehci-fsl.c | 58 +++++++++++++++++++++++++++++-------
> ------
> > drivers/usb/host/ehci-fsl.h | 1 +
> > include/linux/fsl_devices.h | 1 +
> > 3 files changed, 42 insertions(+), 18 deletions(-)
>=20
> Greg,
>=20
> Any issues picking this fix up for v3.6 inclusion?
>=20
> - k
>=20
[Shengzhou] please pick the v3, thanks.
http://patchwork.ozlabs.org/patch/184666/
^ permalink raw reply
* [PATCH v3] powerpc/usb: fix bug of CPU hang when missing USB PHY clock
From: Shengzhou Liu @ 2012-09-18 8:52 UTC (permalink / raw)
To: linuxppc-dev, linux-usb, greg; +Cc: Shengzhou Liu
when missing USB PHY clock, kernel booting up will hang during USB
initialization. We should check USBGP[PHY_CLK_VALID] bit to avoid
CPU hanging in this case.
Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
---
v3 change: no check for UTMI PHY.
v2 change: use spin_event_timeout() instead.
drivers/usb/host/ehci-fsl.c | 57 +++++++++++++++++++++++++++++-------------
drivers/usb/host/ehci-fsl.h | 1 +
include/linux/fsl_devices.h | 1 +
3 files changed, 41 insertions(+), 18 deletions(-)
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index b7451b2..9bfde82 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -210,11 +210,11 @@ static void usb_hcd_fsl_remove(struct usb_hcd *hcd,
usb_put_hcd(hcd);
}
-static void ehci_fsl_setup_phy(struct usb_hcd *hcd,
+static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
enum fsl_usb2_phy_modes phy_mode,
unsigned int port_offset)
{
- u32 portsc, temp;
+ u32 portsc;
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
void __iomem *non_ehci = hcd->regs;
struct device *dev = hcd->self.controller;
@@ -232,9 +232,15 @@ static void ehci_fsl_setup_phy(struct usb_hcd *hcd,
case FSL_USB2_PHY_ULPI:
if (pdata->controller_ver) {
/* controller version 1.6 or above */
- temp = in_be32(non_ehci + FSL_SOC_USB_CTRL);
- out_be32(non_ehci + FSL_SOC_USB_CTRL, temp |
- USB_CTRL_USB_EN | ULPI_PHY_CLK_SEL);
+ setbits32(non_ehci + FSL_SOC_USB_CTRL,
+ ULPI_PHY_CLK_SEL);
+ /*
+ * Due to controller issue of PHY_CLK_VALID in ULPI
+ * mode, we set USB_CTRL_USB_EN before checking
+ * PHY_CLK_VALID, otherwise PHY_CLK_VALID doesn't work.
+ */
+ clrsetbits_be32(non_ehci + FSL_SOC_USB_CTRL,
+ UTMI_PHY_EN, USB_CTRL_USB_EN);
}
portsc |= PORT_PTS_ULPI;
break;
@@ -247,9 +253,7 @@ static void ehci_fsl_setup_phy(struct usb_hcd *hcd,
case FSL_USB2_PHY_UTMI:
if (pdata->controller_ver) {
/* controller version 1.6 or above */
- temp = in_be32(non_ehci + FSL_SOC_USB_CTRL);
- out_be32(non_ehci + FSL_SOC_USB_CTRL, temp |
- UTMI_PHY_EN | USB_CTRL_USB_EN);
+ setbits32(non_ehci + FSL_SOC_USB_CTRL, UTMI_PHY_EN);
mdelay(FSL_UTMI_PHY_DLY); /* Delay for UTMI PHY CLK to
become stable - 10ms*/
}
@@ -262,23 +266,33 @@ static void ehci_fsl_setup_phy(struct usb_hcd *hcd,
case FSL_USB2_PHY_NONE:
break;
}
+
+ if (pdata->controller_ver && (phy_mode == FSL_USB2_PHY_ULPI)) {
+ /* check PHY_CLK_VALID to get phy clk valid */
+ if (!spin_event_timeout(in_be32(non_ehci + FSL_SOC_USB_CTRL) &
+ PHY_CLK_VALID, FSL_USB_PHY_CLK_TIMEOUT, 0)) {
+ printk(KERN_WARNING "fsl-ehci: USB PHY clock invalid\n");
+ return -EINVAL;
+ }
+ }
+
ehci_writel(ehci, portsc, &ehci->regs->port_status[port_offset]);
+
+ if (phy_mode != FSL_USB2_PHY_ULPI)
+ setbits32(non_ehci + FSL_SOC_USB_CTRL, USB_CTRL_USB_EN);
+
+ return 0;
}
-static void ehci_fsl_usb_setup(struct ehci_hcd *ehci)
+static int ehci_fsl_usb_setup(struct ehci_hcd *ehci)
{
struct usb_hcd *hcd = ehci_to_hcd(ehci);
struct fsl_usb2_platform_data *pdata;
void __iomem *non_ehci = hcd->regs;
- u32 temp;
pdata = hcd->self.controller->platform_data;
- /* Enable PHY interface in the control reg. */
if (pdata->have_sysif_regs) {
- temp = in_be32(non_ehci + FSL_SOC_USB_CTRL);
- out_be32(non_ehci + FSL_SOC_USB_CTRL, temp | 0x00000004);
-
/*
* Turn on cache snooping hardware, since some PowerPC platforms
* wholly rely on hardware to deal with cache coherent
@@ -293,7 +307,8 @@ static void ehci_fsl_usb_setup(struct ehci_hcd *ehci)
if ((pdata->operating_mode == FSL_USB2_DR_HOST) ||
(pdata->operating_mode == FSL_USB2_DR_OTG))
- ehci_fsl_setup_phy(hcd, pdata->phy_mode, 0);
+ if (ehci_fsl_setup_phy(hcd, pdata->phy_mode, 0))
+ return -EINVAL;
if (pdata->operating_mode == FSL_USB2_MPH_HOST) {
unsigned int chip, rev, svr;
@@ -307,9 +322,12 @@ static void ehci_fsl_usb_setup(struct ehci_hcd *ehci)
ehci->has_fsl_port_bug = 1;
if (pdata->port_enables & FSL_USB2_PORT0_ENABLED)
- ehci_fsl_setup_phy(hcd, pdata->phy_mode, 0);
+ if (ehci_fsl_setup_phy(hcd, pdata->phy_mode, 0))
+ return -EINVAL;
+
if (pdata->port_enables & FSL_USB2_PORT1_ENABLED)
- ehci_fsl_setup_phy(hcd, pdata->phy_mode, 1);
+ if (ehci_fsl_setup_phy(hcd, pdata->phy_mode, 1))
+ return -EINVAL;
}
if (pdata->have_sysif_regs) {
@@ -322,12 +340,15 @@ static void ehci_fsl_usb_setup(struct ehci_hcd *ehci)
#endif
out_be32(non_ehci + FSL_SOC_USB_SICTRL, 0x00000001);
}
+
+ return 0;
}
/* called after powerup, by probe or system-pm "wakeup" */
static int ehci_fsl_reinit(struct ehci_hcd *ehci)
{
- ehci_fsl_usb_setup(ehci);
+ if (ehci_fsl_usb_setup(ehci))
+ return -EINVAL;
ehci_port_power(ehci, 0);
return 0;
diff --git a/drivers/usb/host/ehci-fsl.h b/drivers/usb/host/ehci-fsl.h
index 8840368..dbd292e 100644
--- a/drivers/usb/host/ehci-fsl.h
+++ b/drivers/usb/host/ehci-fsl.h
@@ -61,4 +61,5 @@
#define PLL_RESET (1<<8)
#define UTMI_PHY_EN (1<<9)
#define ULPI_PHY_CLK_SEL (1<<10)
+#define PHY_CLK_VALID (1<<17)
#endif /* _EHCI_FSL_H */
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 15be561..700bf31 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -19,6 +19,7 @@
#define FSL_UTMI_PHY_DLY 10 /*As per P1010RM, delay for UTMI
PHY CLK to become stable - 10ms*/
+#define FSL_USB_PHY_CLK_TIMEOUT 10000 /* uSec */
#define FSL_USB_VER_OLD 0
#define FSL_USB_VER_1_6 1
#define FSL_USB_VER_2_2 2
--
1.6.4
^ permalink raw reply related
* [PATCH v4 3/5] dt/powerpc/sysdev: Use of_get_child_by_name to get a named child
From: Srinivas KANDAGATLA @ 2012-09-18 7:10 UTC (permalink / raw)
To: benh
Cc: kgene.kim, srinivas.kandagatla, devicetree-discuss, broonie,
robherring2, ben-linux, linuxppc-dev
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
As follow-up to "dt: introduce of_get_child_by_name to get child node by
name." patch, This patch removes some of the code duplication in the
driver by replacing it with of_get_child_by_name instead.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
arch/powerpc/sysdev/qe_lib/qe.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index b043675..d094e51 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -568,10 +568,7 @@ struct qe_firmware_info *qe_get_firmware_info(void)
}
/* Find the 'firmware' child node */
- for_each_child_of_node(qe, fw) {
- if (strcmp(fw->name, "firmware") == 0)
- break;
- }
+ fw = of_get_child_by_name(qe, "firmware");
of_node_put(qe);
--
1.7.0.4
^ permalink raw reply related
* [PATCH v4 2/5] dt/powerpc/powernv: Use of_get_child_by_name to get a named child
From: Srinivas KANDAGATLA @ 2012-09-18 7:10 UTC (permalink / raw)
To: benh
Cc: kgene.kim, srinivas.kandagatla, devicetree-discuss, broonie,
robherring2, ben-linux, linuxppc-dev
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
As follow-up to "dt: introduce of_get_child_by_name to get child node by
name." patch, This patch removes some of the code duplication in the
driver by replacing it with of_get_child_by_name instead.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
arch/powerpc/platforms/powernv/opal.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index aaa0dba..f4a5567 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -294,10 +294,10 @@ static int __init opal_init(void)
consoles = of_node_get(opal_node);
/* Register serial ports */
- for_each_child_of_node(consoles, np) {
- if (strcmp(np->name, "serial"))
- continue;
+ np = of_get_child_by_name(consoles, "serial");
+ if (np) {
of_platform_device_create(np, NULL, NULL);
+ of_node_put(np);
}
of_node_put(consoles);
--
1.7.0.4
^ permalink raw reply related
* [PATCH v4 1/5] dt: introduce of_get_child_by_name to get child node by name
From: Srinivas KANDAGATLA @ 2012-09-18 7:10 UTC (permalink / raw)
To: robherring2, bergner, devicetree-discuss
Cc: kgene.kim, srinivas.kandagatla, broonie, afleming, ben-linux,
linuxppc-dev
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch introduces of_get_child_by_name function to get a child node
by its name in a given parent node.
Without this patch each driver code has to iterate the parent and do
a string compare, However having of_get_child_by_name libary function would
avoid code duplication, errors and is more convenient.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/of/base.c | 23 +++++++++++++++++++++++
include/linux/of.h | 2 ++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d4a1c9a..af3b22a 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -391,6 +391,29 @@ struct device_node *of_get_next_available_child(const struct device_node *node,
EXPORT_SYMBOL(of_get_next_available_child);
/**
+ * of_get_child_by_name - Find the child node by name for a given parent
+ * @node: parent node
+ * @name: child name to look for.
+ *
+ * This function looks for child node for given matching name
+ *
+ * Returns a node pointer if found, with refcount incremented, use
+ * of_node_put() on it when done.
+ * Returns NULL if node is not found.
+ */
+struct device_node *of_get_child_by_name(const struct device_node *node,
+ const char *name)
+{
+ struct device_node *child;
+
+ for_each_child_of_node(node, child)
+ if (child->name && (of_node_cmp(child->name, name) == 0))
+ break;
+ return child;
+}
+EXPORT_SYMBOL(of_get_child_by_name);
+
+/**
* of_find_node_by_path - Find a node matching a full OF path
* @path: The full path to match
*
diff --git a/include/linux/of.h b/include/linux/of.h
index 1b11632..7b8e3cd 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -192,6 +192,8 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
struct device_node *prev);
extern struct device_node *of_get_next_available_child(
const struct device_node *node, struct device_node *prev);
+extern struct device_node *of_get_child_by_name(const struct device_node *node,
+ const char *name);
#define for_each_child_of_node(parent, child) \
for (child = of_get_next_child(parent, NULL); child != NULL; \
--
1.7.0.4
^ permalink raw reply related
* [PATCH v4 0/5] Introduce of_get_child_by_name
From: Srinivas KANDAGATLA @ 2012-09-18 7:10 UTC (permalink / raw)
To: robherring2, bergner, devicetree-discuss
Cc: kgene.kim, srinivas.kandagatla, broonie, afleming, ben-linux,
linuxppc-dev
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch series introduces of_get_child_by_name function to get a
child node by its name in a given parent node and also removes code
duplication in some of the existing driver code by using of_get_child_by_name.
Normally if a driver want to get a child node it would iterate all the nodes
of parent and compare its name and then get it.
This use case is becoming common as device trees are used more, so moving this
functionality to a libary function makes sense.
Having of_get_child_by_name libary function would avoid code duplication,
errors, proper reference counting and is more convenient.
Changes from v3:
- Removed extra of_get_node from of_get_child_by_name.
- reordered of_put_node in hvc_opal.c
Changes from v2:
- Fixed typo errors.
- Removed bogus patches which used "type" instead of "name"
- Fixed reference counting in follow-up patches.
Changes from v1:
-rename of_get_child to of_get_child_by_name.
-remove read lock in of_get_child_by_name.
-make use of of_get_child_by_name in the existing kernel code.
Srinivas Kandagatla (5):
dt: introduce of_get_child_by_name to get child node by name
dt/powerpc/powernv: Use of_get_child_by_name to get a named child
dt/powerpc/sysdev: Use of_get_child_by_name to get a named child
dt/s3c64xx/spi: Use of_get_child_by_name to get a named child
dt/tty/opal: Use of_get_child_by_name to get a named child
arch/powerpc/platforms/powernv/opal.c | 6 +++---
arch/powerpc/sysdev/qe_lib/qe.c | 5 +----
drivers/of/base.c | 23 +++++++++++++++++++++++
drivers/spi/spi-s3c64xx.c | 7 ++++---
drivers/tty/hvc/hvc_opal.c | 9 ++-------
include/linux/of.h | 2 ++
6 files changed, 35 insertions(+), 17 deletions(-)
^ permalink raw reply
* [RESEND PATCH v3 0/5] Introduce of_get_child_by_name
From: Srinivas KANDAGATLA @ 2012-09-18 7:08 UTC (permalink / raw)
To: robherring2, bergner, devicetree-discuss
Cc: kgene.kim, srinivas.kandagatla, broonie, afleming, ben-linux,
linuxppc-dev
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch series introduces of_get_child_by_name function to get a
child node by its name in a given parent node and also removes code
duplication in some of the existing driver code by using of_get_child_by_name.
Normally if a driver want to get a child node it would iterate all the nodes
of parent and compare its name and then get it.
This use case is becoming common as device trees are used more, so moving this
functionality to a libary function makes sense.
Having of_get_child_by_name libary function would avoid code duplication,
errors, proper reference counting and is more convenient.
Changes from v3:
- Removed extra of_get_node from of_get_child_by_name.
- reordered of_put_node in hvc_opal.c
Changes from v2:
- Fixed typo errors.
- Removed bogus patches which used "type" instead of "name"
- Fixed reference counting in follow-up patches.
Changes from v1:
-rename of_get_child to of_get_child_by_name.
-remove read lock in of_get_child_by_name.
-make use of of_get_child_by_name in the existing kernel code.
Srinivas Kandagatla (5):
dt: introduce of_get_child_by_name to get child node by name
dt/powerpc/powernv: Use of_get_child_by_name to get a named child
dt/powerpc/sysdev: Use of_get_child_by_name to get a named child
dt/s3c64xx/spi: Use of_get_child_by_name to get a named child
dt/tty/opal: Use of_get_child_by_name to get a named child
arch/powerpc/platforms/powernv/opal.c | 6 +++---
arch/powerpc/sysdev/qe_lib/qe.c | 5 +----
drivers/of/base.c | 23 +++++++++++++++++++++++
drivers/spi/spi-s3c64xx.c | 7 ++++---
drivers/tty/hvc/hvc_opal.c | 9 ++-------
include/linux/of.h | 2 ++
6 files changed, 35 insertions(+), 17 deletions(-)
^ permalink raw reply
* Re: [v5][PATCH 2/3] powerpc/kprobe: complete kprobe and migrate exception frame
From: tiejun.chen @ 2012-09-18 6:13 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1347944998.2386.44.camel@pasglop>
On 09/18/2012 01:09 PM, Benjamin Herrenschmidt wrote:
> On Tue, 2012-09-18 at 15:05 +1000, Benjamin Herrenschmidt wrote:
>> On Mon, 2012-09-17 at 17:54 +0800, Tiejun Chen wrote:
>>> -#ifdef CONFIG_PREEMPT
>>> b restore
>>>
>>> /* N.B. the only way to get here is from the beq following ret_from_except. */
>>> resume_kernel:
>>> - /* check current_thread_info->preempt_count */
>>> + /* check current_thread_info, _TIF_EMULATE_STACK_STORE */
>>> CURRENT_THREAD_INFO(r9, r1)
>>> + lwz r8,TI_FLAGS(r9)
>>> + andis. r8,r8,_TIF_EMULATE_STACK_STORE@h
>>> + beq+ 1f
>>> +
>>> + addi r8,r1,INT_FRAME_SIZE /* Get the kprobed function entry */
>>> +
>>> + lwz r3,GPR1(r1)
>>> + subi r3,r3,INT_FRAME_SIZE /* dst: Allocate a trampoline exception frame */
>>> + mr r4,r1 /* src: current exception frame */
>>> + li r5,INT_FRAME_SIZE /* size: INT_FRAME_SIZE */
>>> + li r6,0 /* start offset: 0 */
>>> + mr r1,r3 /* Reroute the trampoline frame to r1 */
>>> +
>>> + /* Copy from the original to the trampoline. */
>>> + li r6,0
>>
>> You just did that li r6,0 2 lines above :-) I'll fix it up manually
>> while applying.
>
> In fact the srwi can be dropped completely, we can just load r5 with the
> divided value. Committed, will push later today, please test.
I retest to kprobe do_fork() and show_interrupts() with/without enabling
CONFIG_PREEMPT, separately, looks still work.
For 32-bit:
------------
+ /* Copy from the original to the trampoline. */
+ lwz r3,GPR1(r1)
+ subi r3,r3,INT_FRAME_SIZE /* dst: Allocate a trampoline exception
frame */
+ mr r4,r1 /* src: current exception frame */
+ li r5,INT_FRAME_SIZE/4 /* size: INT_FRAME_SIZE */
+ li r6,0 /* start offset: 0 */
+ mr r1,r3 /* Reroute the trampoline frame to r1 */
+ mtctr r5
+2: lwzx r0,r6,r4
+ stwx r0,r6,r3
+ addi r6,r6,4
+ bdnz 2b
And for 64-bit:
---------------
+ /* Copy from the original to the trampoline. */
+ lwz r3,GPR1(r1)
+ subi r3,r3,INT_FRAME_SIZE /* dst: Allocate a trampoline exception
frame */
+ mr r4,r1 /* src: current exception frame */
+ li r5,INT_FRAME_SIZE/8 /* size: INT_FRAME_SIZE */
+ li r6,0 /* start offset: 0 */
+ mr r1,r3 /* Reroute the trampoline frame to r1 */
+ mtctr r5
+2: ldx r0,r6,r4
+ stdx r0,r6,r3
+ addi r6,r6,8
+ bdnz 2b
Thanks
Tiejun
^ permalink raw reply
* Re: [PATCH v2] powerpc/usb: fix bug of CPU hang when missing USB PHY clock
From: Kumar Gala @ 2012-09-18 5:35 UTC (permalink / raw)
To: Greg KH; +Cc: linux-usb, linuxppc-dev@lists.ozlabs.org list, Shengzhou Liu
In-Reply-To: <1345630620-32070-1-git-send-email-Shengzhou.Liu@freescale.com>
On Aug 22, 2012, at 5:17 AM, Shengzhou Liu wrote:
> when missing USB PHY clock, kernel booting up will hang during USB
> initialization. We should check USBGP[PHY_CLK_VALID] bit to avoid
> CPU hanging in this case.
>=20
> Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> ---
> v2 changes: use spin_event_timeout() instead.
>=20
> drivers/usb/host/ehci-fsl.c | 58 =
+++++++++++++++++++++++++++++-------------
> drivers/usb/host/ehci-fsl.h | 1 +
> include/linux/fsl_devices.h | 1 +
> 3 files changed, 42 insertions(+), 18 deletions(-)
Greg,
Any issues picking this fix up for v3.6 inclusion?
- k
>=20
> diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
> index b7451b2..11ff4b4 100644
> --- a/drivers/usb/host/ehci-fsl.c
> +++ b/drivers/usb/host/ehci-fsl.c
> @@ -210,11 +210,11 @@ static void usb_hcd_fsl_remove(struct usb_hcd =
*hcd,
> usb_put_hcd(hcd);
> }
>=20
> -static void ehci_fsl_setup_phy(struct usb_hcd *hcd,
> +static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
> enum fsl_usb2_phy_modes phy_mode,
> unsigned int port_offset)
> {
> - u32 portsc, temp;
> + u32 portsc;
> struct ehci_hcd *ehci =3D hcd_to_ehci(hcd);
> void __iomem *non_ehci =3D hcd->regs;
> struct device *dev =3D hcd->self.controller;
> @@ -232,9 +232,15 @@ static void ehci_fsl_setup_phy(struct usb_hcd =
*hcd,
> case FSL_USB2_PHY_ULPI:
> if (pdata->controller_ver) {
> /* controller version 1.6 or above */
> - temp =3D in_be32(non_ehci + FSL_SOC_USB_CTRL);
> - out_be32(non_ehci + FSL_SOC_USB_CTRL, temp |
> - USB_CTRL_USB_EN | ULPI_PHY_CLK_SEL);
> + setbits32(non_ehci + FSL_SOC_USB_CTRL,
> + ULPI_PHY_CLK_SEL);
> + /*
> + * Due to controller issue of PHY_CLK_VALID in =
ULPI
> + * mode, we set USB_CTRL_USB_EN before checking
> + * PHY_CLK_VALID, otherwise PHY_CLK_VALID =
doesn't work.
> + */
> + clrsetbits_be32(non_ehci + FSL_SOC_USB_CTRL,
> + UTMI_PHY_EN, USB_CTRL_USB_EN);
> }
> portsc |=3D PORT_PTS_ULPI;
> break;
> @@ -247,9 +253,7 @@ static void ehci_fsl_setup_phy(struct usb_hcd =
*hcd,
> case FSL_USB2_PHY_UTMI:
> if (pdata->controller_ver) {
> /* controller version 1.6 or above */
> - temp =3D in_be32(non_ehci + FSL_SOC_USB_CTRL);
> - out_be32(non_ehci + FSL_SOC_USB_CTRL, temp |
> - UTMI_PHY_EN | USB_CTRL_USB_EN);
> + setbits32(non_ehci + FSL_SOC_USB_CTRL, =
UTMI_PHY_EN);
> mdelay(FSL_UTMI_PHY_DLY); /* Delay for UTMI PHY =
CLK to
> become stable - 10ms*/
> }
> @@ -262,23 +266,34 @@ static void ehci_fsl_setup_phy(struct usb_hcd =
*hcd,
> case FSL_USB2_PHY_NONE:
> break;
> }
> +
> + if ((pdata->controller_ver) && ((phy_mode =3D=3D =
FSL_USB2_PHY_ULPI) ||
> + (phy_mode =3D=3D FSL_USB2_PHY_UTMI))) {
> + /* check PHY_CLK_VALID to get phy clk valid */
> + if (!spin_event_timeout(in_be32(non_ehci + =
FSL_SOC_USB_CTRL) &
> + PHY_CLK_VALID, FSL_USB_PHY_CLK_TIMEOUT, =
0)) {
> + printk(KERN_WARNING "fsl-ehci: USB PHY clock =
invalid\n");
> + return -EINVAL;
> + }
> + }
> +
> ehci_writel(ehci, portsc, =
&ehci->regs->port_status[port_offset]);
> +
> + if (phy_mode !=3D FSL_USB2_PHY_ULPI)
> + setbits32(non_ehci + FSL_SOC_USB_CTRL, USB_CTRL_USB_EN);
> +
> + return 0;
> }
>=20
> -static void ehci_fsl_usb_setup(struct ehci_hcd *ehci)
> +static int ehci_fsl_usb_setup(struct ehci_hcd *ehci)
> {
> struct usb_hcd *hcd =3D ehci_to_hcd(ehci);
> struct fsl_usb2_platform_data *pdata;
> void __iomem *non_ehci =3D hcd->regs;
> - u32 temp;
>=20
> pdata =3D hcd->self.controller->platform_data;
>=20
> - /* Enable PHY interface in the control reg. */
> if (pdata->have_sysif_regs) {
> - temp =3D in_be32(non_ehci + FSL_SOC_USB_CTRL);
> - out_be32(non_ehci + FSL_SOC_USB_CTRL, temp | =
0x00000004);
> -
> /*
> * Turn on cache snooping hardware, since some PowerPC =
platforms
> * wholly rely on hardware to deal with cache coherent
> @@ -293,7 +308,8 @@ static void ehci_fsl_usb_setup(struct ehci_hcd =
*ehci)
>=20
> if ((pdata->operating_mode =3D=3D FSL_USB2_DR_HOST) ||
> (pdata->operating_mode =3D=3D FSL_USB2_DR_OTG))
> - ehci_fsl_setup_phy(hcd, pdata->phy_mode, 0);
> + if (ehci_fsl_setup_phy(hcd, pdata->phy_mode, 0))
> + return -EINVAL;
>=20
> if (pdata->operating_mode =3D=3D FSL_USB2_MPH_HOST) {
> unsigned int chip, rev, svr;
> @@ -307,9 +323,12 @@ static void ehci_fsl_usb_setup(struct ehci_hcd =
*ehci)
> ehci->has_fsl_port_bug =3D 1;
>=20
> if (pdata->port_enables & FSL_USB2_PORT0_ENABLED)
> - ehci_fsl_setup_phy(hcd, pdata->phy_mode, 0);
> + if (ehci_fsl_setup_phy(hcd, pdata->phy_mode, 0))
> + return -EINVAL;
> +
> if (pdata->port_enables & FSL_USB2_PORT1_ENABLED)
> - ehci_fsl_setup_phy(hcd, pdata->phy_mode, 1);
> + if (ehci_fsl_setup_phy(hcd, pdata->phy_mode, 1))
> + return -EINVAL;
> }
>=20
> if (pdata->have_sysif_regs) {
> @@ -322,12 +341,15 @@ static void ehci_fsl_usb_setup(struct ehci_hcd =
*ehci)
> #endif
> out_be32(non_ehci + FSL_SOC_USB_SICTRL, 0x00000001);
> }
> +
> + return 0;
> }
>=20
> /* called after powerup, by probe or system-pm "wakeup" */
> static int ehci_fsl_reinit(struct ehci_hcd *ehci)
> {
> - ehci_fsl_usb_setup(ehci);
> + if (ehci_fsl_usb_setup(ehci))
> + return -EINVAL;
> ehci_port_power(ehci, 0);
>=20
> return 0;
> diff --git a/drivers/usb/host/ehci-fsl.h b/drivers/usb/host/ehci-fsl.h
> index 8840368..dbd292e 100644
> --- a/drivers/usb/host/ehci-fsl.h
> +++ b/drivers/usb/host/ehci-fsl.h
> @@ -61,4 +61,5 @@
> #define PLL_RESET (1<<8)
> #define UTMI_PHY_EN (1<<9)
> #define ULPI_PHY_CLK_SEL (1<<10)
> +#define PHY_CLK_VALID (1<<17)
> #endif /* _EHCI_FSL_H */
> diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
> index 15be561..ccfc4bb 100644
> --- a/include/linux/fsl_devices.h
> +++ b/include/linux/fsl_devices.h
> @@ -19,6 +19,7 @@
>=20
> #define FSL_UTMI_PHY_DLY 10 /*As per P1010RM, delay for UTMI
> PHY CLK to become stable - 10ms*/
> +#define FSL_USB_PHY_CLK_TIMEOUT 1000 /* uSec */
> #define FSL_USB_VER_OLD 0
> #define FSL_USB_VER_1_6 1
> #define FSL_USB_VER_2_2 2
> --=20
> 1.6.4
>=20
^ permalink raw reply
* Re: [v5][PATCH 2/3] powerpc/kprobe: complete kprobe and migrate exception frame
From: Benjamin Herrenschmidt @ 2012-09-18 5:09 UTC (permalink / raw)
To: Tiejun Chen; +Cc: linuxppc-dev
In-Reply-To: <1347944755.2386.43.camel@pasglop>
On Tue, 2012-09-18 at 15:05 +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2012-09-17 at 17:54 +0800, Tiejun Chen wrote:
> > -#ifdef CONFIG_PREEMPT
> > b restore
> >
> > /* N.B. the only way to get here is from the beq following ret_from_except. */
> > resume_kernel:
> > - /* check current_thread_info->preempt_count */
> > + /* check current_thread_info, _TIF_EMULATE_STACK_STORE */
> > CURRENT_THREAD_INFO(r9, r1)
> > + lwz r8,TI_FLAGS(r9)
> > + andis. r8,r8,_TIF_EMULATE_STACK_STORE@h
> > + beq+ 1f
> > +
> > + addi r8,r1,INT_FRAME_SIZE /* Get the kprobed function entry */
> > +
> > + lwz r3,GPR1(r1)
> > + subi r3,r3,INT_FRAME_SIZE /* dst: Allocate a trampoline exception frame */
> > + mr r4,r1 /* src: current exception frame */
> > + li r5,INT_FRAME_SIZE /* size: INT_FRAME_SIZE */
> > + li r6,0 /* start offset: 0 */
> > + mr r1,r3 /* Reroute the trampoline frame to r1 */
> > +
> > + /* Copy from the original to the trampoline. */
> > + li r6,0
>
> You just did that li r6,0 2 lines above :-) I'll fix it up manually
> while applying.
In fact the srwi can be dropped completely, we can just load r5 with the
divided value. Committed, will push later today, please test.
Cheers,
Ben.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox