* [PATCH 2/3] add MPC837x USB platform support
From: Li Yang @ 2008-01-07 12:03 UTC (permalink / raw)
To: galak, linuxppc-dev; +Cc: Li Yang, paulus
In-Reply-To: <1199707400-23588-1-git-send-email-leoli@freescale.com>
Add chip specific and board specific initialization for MPC837x USB.
Signed-off-by: Li Yang <leoli@freescale.com>
---
arch/powerpc/platforms/83xx/mpc837x_mds.c | 48 +++++++++++++++++++++++++++++
arch/powerpc/platforms/83xx/mpc83xx.h | 3 ++
arch/powerpc/platforms/83xx/usb.c | 39 +++++++++++++++++++++++
3 files changed, 90 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c b/arch/powerpc/platforms/83xx/mpc837x_mds.c
index 166c111..de60872 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_mds.c
@@ -27,6 +27,53 @@ unsigned long isa_io_base = 0;
unsigned long isa_mem_base = 0;
#endif
+#define BCSR12_USB_SER_MASK 0x8a
+#define BCSR12_USB_SER_PIN 0x80
+#define BCSR12_USB_SER_DEVICE 0x02
+extern int mpc837x_usb_cfg(void);
+
+static int mpc837xmds_usb_cfg(void)
+{
+ struct device_node *np;
+ const void *phy_type, *mode;
+ void __iomem *bcsr_regs = NULL;
+ u8 bcsr12;
+ int ret;
+
+ ret = mpc837x_usb_cfg();
+ if (ret)
+ return ret;
+ /* Map BCSR area */
+ np = of_find_node_by_name(NULL, "bcsr");
+ if (np) {
+ struct resource res;
+
+ of_address_to_resource(np, 0, &res);
+ bcsr_regs = ioremap(res.start, res.end - res.start + 1);
+ of_node_put(np);
+ }
+ if (!bcsr_regs)
+ return -1;
+
+ np = of_find_node_by_name(NULL, "usb");
+ phy_type = of_get_property(np, "phy_type", NULL);
+ if (phy_type && !strcmp(phy_type, "ulpi")) {
+ clrbits8(bcsr_regs + 12, BCSR12_USB_SER_PIN);
+ } else if (phy_type && !strcmp(phy_type, "serial")) {
+ mode = of_get_property(np, "dr_mode", NULL);
+ bcsr12 = in_8(bcsr_regs + 12) & ~BCSR12_USB_SER_MASK;
+ bcsr12 |= BCSR12_USB_SER_PIN;
+ if (mode && !strcmp(mode, "peripheral"))
+ bcsr12 |= BCSR12_USB_SER_DEVICE;
+ out_8(bcsr_regs + 12, bcsr12);
+ } else {
+ printk(KERN_ERR "USB DR: unsupported PHY\n");
+ }
+
+ iounmap(bcsr_regs);
+ return 0;
+}
+
/* ************************************************************************
*
* Setup the architecture
@@ -45,6 +92,7 @@ static void __init mpc837x_mds_setup_arch(void)
for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np);
#endif
+ mpc837xmds_usb_cfg();
}
static struct of_device_id mpc837x_ids[] = {
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index b778cb4..88bb748 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -14,6 +14,7 @@
#define MPC83XX_SCCR_USB_DRCM_11 0x00300000
#define MPC83XX_SCCR_USB_DRCM_01 0x00100000
#define MPC83XX_SCCR_USB_DRCM_10 0x00200000
+#define MPC837X_SCCR_USB_DRCM_11 0x00c00000
/* system i/o configuration register low */
#define MPC83XX_SICRL_OFFS 0x114
@@ -22,6 +23,8 @@
#define MPC834X_SICRL_USB1 0x20000000
#define MPC831X_SICRL_USB_MASK 0x00000c00
#define MPC831X_SICRL_USB_ULPI 0x00000800
+#define MPC837X_SICRL_USB_MASK 0xf0000000
+#define MPC837X_SICRL_USB_ULPI 0x50000000
/* system i/o configuration register high */
#define MPC83XX_SICRH_OFFS 0x118
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index b45160f..2985c9c 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -179,3 +179,42 @@ int mpc831x_usb_cfg(void)
return ret;
}
#endif /* CONFIG_PPC_MPC831x */
+
+#ifdef CONFIG_PPC_MPC837x
+int mpc837x_usb_cfg(void)
+{
+ void __iomem *immap;
+ struct device_node *np = NULL;
+ const void *prop;
+ int ret = 0;
+
+ np = of_find_compatible_node(NULL, "usb", "fsl-usb2-dr");
+ if (!np)
+ return -ENODEV;
+ prop = of_get_property(np, "phy_type", NULL);
+
+ if (strcmp(prop, "ulpi") && strcmp(prop, "serial")) {
+ printk(KERN_WARNING "837x USB PHY type not supported\n");
+ return -EINVAL;
+ }
+
+ /* Map IMMR space for pin and clock settings */
+ immap = ioremap(get_immrbase(), 0x1000);
+ if (!immap) {
+ of_node_put(np);
+ return -ENOMEM;
+ }
+
+ /* Configure clock */
+ clrsetbits_be32(immap + MPC83XX_SCCR_OFFS, MPC837X_SCCR_USB_DRCM_11,
+ MPC837X_SCCR_USB_DRCM_11);
+
+ /* Configure pin mux for ULPI/serial */
+ clrsetbits_be32(immap + MPC83XX_SICRL_OFFS, MPC837X_SICRL_USB_MASK,
+ MPC837X_SICRL_USB_ULPI);
+
+ iounmap(immap);
+ of_node_put(np);
+ return ret;
+}
+#endif /* CONFIG_PPC_MPC837x */
--
1.5.3.5.643.g40e25
^ permalink raw reply related
* [PATCH 1/3] add default device trees for MPC837x MDS board
From: Li Yang @ 2008-01-07 12:03 UTC (permalink / raw)
To: galak, linuxppc-dev; +Cc: Li Yang, paulus
Signed-off-by: Li Yang <leoli@freescale.com>
---
address comments and use new dts spec.
arch/powerpc/boot/dts/mpc8377_mds.dts | 277 +++++++++++++++++++++++++++++++
arch/powerpc/boot/dts/mpc8378_mds.dts | 263 +++++++++++++++++++++++++++++
arch/powerpc/boot/dts/mpc8379_mds.dts | 291 +++++++++++++++++++++++++++++++++
3 files changed, 831 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts
new file mode 100644
index 0000000..b50b5f9
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -0,0 +1,277 @@
+/*
+ * MPC8377E MDS Device Tree Source
+ *
+ * Copyright 2007 Freescale Semiconductor 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.
+ */
+
+/ {
+ model = "fsl,mpc8377emds";
+ compatible = "fsl,mpc8377emds","fsl,mpc837xmds";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ aliases {
+ ethernet0 = &enet0;
+ ethernet1 = &enet1;
+ serial0 = &serial0;
+ serial1 = &serial1;
+ pci0 = &pci0;
+ };
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ PowerPC,8377@0 {
+ device_type = "cpu";
+ reg = <0>;
+ d-cache-line-size = <20>;
+ i-cache-line-size = <20>;
+ d-cache-size = <8000>; // L1, 32K
+ i-cache-size = <8000>; // L1, 32K
+ timebase-frequency = <0>;
+ bus-frequency = <0>;
+ clock-frequency = <0>;
+ };
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <00000000 20000000>; // 512MB at 0
+ };
+
+ soc@e0000000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ device_type = "soc";
+ ranges = <0 e0000000 00100000>;
+ reg = <e0000000 00000200>;
+ bus-frequency = <0>;
+
+ wdt@200 {
+ compatible = "mpc83xx_wdt";
+ reg = <200 100>;
+ };
+
+ i2c@3000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ cell-index = <0>;
+ compatible = "fsl-i2c";
+ reg = <3000 100>;
+ interrupts = <e 8>;
+ interrupt-parent = < &ipic >;
+ dfsrr;
+ };
+
+ i2c@3100 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ cell-index = <1>;
+ compatible = "fsl-i2c";
+ reg = <3100 100>;
+ interrupts = <f 8>;
+ interrupt-parent = < &ipic >;
+ dfsrr;
+ };
+
+ spi@7000 {
+ compatible = "fsl_spi";
+ reg = <7000 1000>;
+ interrupts = <10 8>;
+ interrupt-parent = < &ipic >;
+ mode = "cpu";
+ };
+
+ /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
+ usb@23000 {
+ compatible = "fsl-usb2-dr";
+ reg = <23000 1000>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ interrupt-parent = < &ipic >;
+ interrupts = <26 8>;
+ phy_type = "utmi_wide";
+ };
+
+ mdio@24520 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,gianfar-mdio";
+ reg = <24520 20>;
+ phy2: ethernet-phy@2 {
+ interrupt-parent = < &ipic >;
+ interrupts = <11 8>;
+ reg = <2>;
+ device_type = "ethernet-phy";
+ };
+ phy3: ethernet-phy@3 {
+ interrupt-parent = < &ipic >;
+ interrupts = <12 8>;
+ reg = <3>;
+ device_type = "ethernet-phy";
+ };
+ };
+
+ enet0: ethernet@24000 {
+ cell-index = <0>;
+ device_type = "network";
+ model = "eTSEC";
+ compatible = "gianfar";
+ reg = <24000 1000>;
+ local-mac-address = [ 00 00 00 00 00 00 ];
+ interrupts = <20 8 21 8 22 8>;
+ phy-connection-type = "mii";
+ interrupt-parent = < &ipic >;
+ phy-handle = < &phy2 >;
+ };
+
+ enet1: ethernet@25000 {
+ cell-index = <1>;
+ device_type = "network";
+ model = "eTSEC";
+ compatible = "gianfar";
+ reg = <25000 1000>;
+ local-mac-address = [ 00 00 00 00 00 00 ];
+ interrupts = <23 8 24 8 25 8>;
+ phy-connection-type = "mii";
+ interrupt-parent = < &ipic >;
+ phy-handle = < &phy3 >;
+ };
+
+ serial0: serial@4500 {
+ cell-index = <0>;
+ device_type = "serial";
+ compatible = "ns16550";
+ reg = <4500 100>;
+ clock-frequency = <0>;
+ interrupts = <9 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ serial1: serial@4600 {
+ cell-index = <1>;
+ device_type = "serial";
+ compatible = "ns16550";
+ reg = <4600 100>;
+ clock-frequency = <0>;
+ interrupts = <a 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ crypto@30000 {
+ model = "SEC3";
+ compatible = "talitos";
+ reg = <30000 10000>;
+ interrupts = <b 8>;
+ interrupt-parent = < &ipic >;
+ /* Rev. 3.0 geometry */
+ num-channels = <4>;
+ channel-fifo-len = <18>;
+ exec-units-mask = <000001fe>;
+ descriptor-types-mask = <03ab0ebf>;
+ };
+
+ sdhc@2e000 {
+ model = "eSDHC";
+ compatible = "fsl,esdhc";
+ reg = <2e000 1000>;
+ interrupts = <2a 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ sata@18000 {
+ compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
+ reg = <18000 1000>;
+ interrupts = <2c 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ sata@19000 {
+ compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
+ reg = <19000 1000>;
+ interrupts = <2d 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ /* IPIC
+ * interrupts cell = <intr #, sense>
+ * sense values match linux IORESOURCE_IRQ_* defines:
+ * sense == 8: Level, low assertion
+ * sense == 2: Edge, high-to-low change
+ */
+ ipic: pic@700 {
+ compatible = "fsl,ipic";
+ interrupt-controller;
+ #address-cells = <0>;
+ #interrupt-cells = <2>;
+ reg = <700 100>;
+ };
+ };
+
+ pci0: pci@e0008500 {
+ cell-index = <0>;
+ interrupt-map-mask = <f800 0 0 7>;
+ interrupt-map = <
+
+ /* IDSEL 0x11 */
+ 8800 0 0 1 &ipic 14 8
+ 8800 0 0 2 &ipic 15 8
+ 8800 0 0 3 &ipic 16 8
+ 8800 0 0 4 &ipic 17 8
+
+ /* IDSEL 0x12 */
+ 9000 0 0 1 &ipic 16 8
+ 9000 0 0 2 &ipic 17 8
+ 9000 0 0 3 &ipic 14 8
+ 9000 0 0 4 &ipic 15 8
+
+ /* IDSEL 0x13 */
+ 9800 0 0 1 &ipic 17 8
+ 9800 0 0 2 &ipic 14 8
+ 9800 0 0 3 &ipic 15 8
+ 9800 0 0 4 &ipic 16 8
+
+ /* IDSEL 0x15 */
+ a800 0 0 1 &ipic 14 8
+ a800 0 0 2 &ipic 15 8
+ a800 0 0 3 &ipic 16 8
+ a800 0 0 4 &ipic 17 8
+
+ /* IDSEL 0x16 */
+ b000 0 0 1 &ipic 17 8
+ b000 0 0 2 &ipic 14 8
+ b000 0 0 3 &ipic 15 8
+ b000 0 0 4 &ipic 16 8
+
+ /* IDSEL 0x17 */
+ b800 0 0 1 &ipic 16 8
+ b800 0 0 2 &ipic 17 8
+ b800 0 0 3 &ipic 14 8
+ b800 0 0 4 &ipic 15 8
+
+ /* IDSEL 0x18 */
+ c000 0 0 1 &ipic 15 8
+ c000 0 0 2 &ipic 16 8
+ c000 0 0 3 &ipic 17 8
+ c000 0 0 4 &ipic 14 8>;
+ interrupt-parent = < &ipic >;
+ interrupts = <42 8>;
+ bus-range = <0 0>;
+ ranges = <02000000 0 90000000 90000000 0 10000000
+ 42000000 0 80000000 80000000 0 10000000
+ 01000000 0 00000000 e0300000 0 00100000>;
+ clock-frequency = <0>;
+ #interrupt-cells = <1>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ reg = <e0008500 100>;
+ compatible = "fsl,mpc8349-pci";
+ device_type = "pci";
+ };
+};
diff --git a/arch/powerpc/boot/dts/mpc8378_mds.dts b/arch/powerpc/boot/dts/mpc8378_mds.dts
new file mode 100644
index 0000000..bd9545d
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc8378_mds.dts
@@ -0,0 +1,263 @@
+/*
+ * MPC8378E MDS Device Tree Source
+ *
+ * Copyright 2007 Freescale Semiconductor 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.
+ */
+
+/ {
+ model = "fsl,mpc8378emds";
+ compatible = "fsl,mpc8378emds","fsl,mpc837xmds";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ aliases {
+ ethernet0 = &enet0;
+ ethernet1 = &enet1;
+ serial0 = &serial0;
+ serial1 = &serial1;
+ pci0 = &pci0;
+ };
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ PowerPC,8378@0 {
+ device_type = "cpu";
+ reg = <0>;
+ d-cache-line-size = <20>;
+ i-cache-line-size = <20>;
+ d-cache-size = <8000>; // L1, 32K
+ i-cache-size = <8000>; // L1, 32K
+ timebase-frequency = <0>;
+ bus-frequency = <0>;
+ clock-frequency = <0>;
+ };
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <00000000 20000000>; // 512MB at 0
+ };
+
+ soc@e0000000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ device_type = "soc";
+ ranges = <0 e0000000 00100000>;
+ reg = <e0000000 00000200>;
+ bus-frequency = <0>;
+
+ wdt@200 {
+ compatible = "mpc83xx_wdt";
+ reg = <200 100>;
+ };
+
+ i2c@3000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ cell-index = <0>;
+ compatible = "fsl-i2c";
+ reg = <3000 100>;
+ interrupts = <e 8>;
+ interrupt-parent = < &ipic >;
+ dfsrr;
+ };
+
+ i2c@3100 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ cell-index = <1>;
+ compatible = "fsl-i2c";
+ reg = <3100 100>;
+ interrupts = <f 8>;
+ interrupt-parent = < &ipic >;
+ dfsrr;
+ };
+
+ spi@7000 {
+ compatible = "fsl_spi";
+ reg = <7000 1000>;
+ interrupts = <10 8>;
+ interrupt-parent = < &ipic >;
+ mode = "cpu";
+ };
+
+ /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
+ usb@23000 {
+ compatible = "fsl-usb2-dr";
+ reg = <23000 1000>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ interrupt-parent = < &ipic >;
+ interrupts = <26 8>;
+ phy_type = "utmi_wide";
+ };
+
+ mdio@24520 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,gianfar-mdio";
+ reg = <24520 20>;
+ phy2: ethernet-phy@2 {
+ interrupt-parent = < &ipic >;
+ interrupts = <11 8>;
+ reg = <2>;
+ device_type = "ethernet-phy";
+ };
+ phy3: ethernet-phy@3 {
+ interrupt-parent = < &ipic >;
+ interrupts = <12 8>;
+ reg = <3>;
+ device_type = "ethernet-phy";
+ };
+ };
+
+ enet0: ethernet@24000 {
+ cell-index = <0>;
+ device_type = "network";
+ model = "eTSEC";
+ compatible = "gianfar";
+ reg = <24000 1000>;
+ local-mac-address = [ 00 00 00 00 00 00 ];
+ interrupts = <20 8 21 8 22 8>;
+ phy-connection-type = "mii";
+ interrupt-parent = < &ipic >;
+ phy-handle = < &phy2 >;
+ };
+
+ enet1: ethernet@25000 {
+ cell-index = <1>;
+ device_type = "network";
+ model = "eTSEC";
+ compatible = "gianfar";
+ reg = <25000 1000>;
+ local-mac-address = [ 00 00 00 00 00 00 ];
+ interrupts = <23 8 24 8 25 8>;
+ phy-connection-type = "mii";
+ interrupt-parent = < &ipic >;
+ phy-handle = < &phy3 >;
+ };
+
+ serial0: serial@4500 {
+ cell-index = <0>;
+ device_type = "serial";
+ compatible = "ns16550";
+ reg = <4500 100>;
+ clock-frequency = <0>;
+ interrupts = <9 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ serial1: serial@4600 {
+ cell-index = <1>;
+ device_type = "serial";
+ compatible = "ns16550";
+ reg = <4600 100>;
+ clock-frequency = <0>;
+ interrupts = <a 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ crypto@30000 {
+ model = "SEC3";
+ compatible = "talitos";
+ reg = <30000 10000>;
+ interrupts = <b 8>;
+ interrupt-parent = < &ipic >;
+ /* Rev. 3.0 geometry */
+ num-channels = <4>;
+ channel-fifo-len = <18>;
+ exec-units-mask = <000001fe>;
+ descriptor-types-mask = <03ab0ebf>;
+ };
+
+ sdhc@2e000 {
+ model = "eSDHC";
+ compatible = "fsl,esdhc";
+ reg = <2e000 1000>;
+ interrupts = <2a 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ /* IPIC
+ * interrupts cell = <intr #, sense>
+ * sense values match linux IORESOURCE_IRQ_* defines:
+ * sense == 8: Level, low assertion
+ * sense == 2: Edge, high-to-low change
+ */
+ ipic: pic@700 {
+ compatible = "fsl,ipic";
+ interrupt-controller;
+ #address-cells = <0>;
+ #interrupt-cells = <2>;
+ reg = <700 100>;
+ };
+ };
+
+ pci0: pci@e0008500 {
+ cell-index = <0>;
+ interrupt-map-mask = <f800 0 0 7>;
+ interrupt-map = <
+
+ /* IDSEL 0x11 */
+ 8800 0 0 1 &ipic 14 8
+ 8800 0 0 2 &ipic 15 8
+ 8800 0 0 3 &ipic 16 8
+ 8800 0 0 4 &ipic 17 8
+
+ /* IDSEL 0x12 */
+ 9000 0 0 1 &ipic 16 8
+ 9000 0 0 2 &ipic 17 8
+ 9000 0 0 3 &ipic 14 8
+ 9000 0 0 4 &ipic 15 8
+
+ /* IDSEL 0x13 */
+ 9800 0 0 1 &ipic 17 8
+ 9800 0 0 2 &ipic 14 8
+ 9800 0 0 3 &ipic 15 8
+ 9800 0 0 4 &ipic 16 8
+
+ /* IDSEL 0x15 */
+ a800 0 0 1 &ipic 14 8
+ a800 0 0 2 &ipic 15 8
+ a800 0 0 3 &ipic 16 8
+ a800 0 0 4 &ipic 17 8
+
+ /* IDSEL 0x16 */
+ b000 0 0 1 &ipic 17 8
+ b000 0 0 2 &ipic 14 8
+ b000 0 0 3 &ipic 15 8
+ b000 0 0 4 &ipic 16 8
+
+ /* IDSEL 0x17 */
+ b800 0 0 1 &ipic 16 8
+ b800 0 0 2 &ipic 17 8
+ b800 0 0 3 &ipic 14 8
+ b800 0 0 4 &ipic 15 8
+
+ /* IDSEL 0x18 */
+ c000 0 0 1 &ipic 15 8
+ c000 0 0 2 &ipic 16 8
+ c000 0 0 3 &ipic 17 8
+ c000 0 0 4 &ipic 14 8>;
+ interrupt-parent = < &ipic >;
+ interrupts = <42 8>;
+ bus-range = <0 0>;
+ ranges = <02000000 0 90000000 90000000 0 10000000
+ 42000000 0 80000000 80000000 0 10000000
+ 01000000 0 00000000 e0300000 0 00100000>;
+ clock-frequency = <0>;
+ #interrupt-cells = <1>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ reg = <e0008500 100>;
+ compatible = "fsl,mpc8349-pci";
+ device_type = "pci";
+ };
+};
diff --git a/arch/powerpc/boot/dts/mpc8379_mds.dts b/arch/powerpc/boot/dts/mpc8379_mds.dts
new file mode 100644
index 0000000..4d651a3
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc8379_mds.dts
@@ -0,0 +1,291 @@
+/*
+ * MPC8379E MDS Device Tree Source
+ *
+ * Copyright 2007 Freescale Semiconductor 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.
+ */
+
+/ {
+ model = "fsl,mpc8379emds";
+ compatible = "fsl,mpc8379emds","fsl,mpc837xmds";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ aliases {
+ ethernet0 = &enet0;
+ ethernet1 = &enet1;
+ serial0 = &serial0;
+ serial1 = &serial1;
+ pci0 = &pci0;
+ };
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ PowerPC,8379@0 {
+ device_type = "cpu";
+ reg = <0>;
+ d-cache-line-size = <20>;
+ i-cache-line-size = <20>;
+ d-cache-size = <8000>; // L1, 32K
+ i-cache-size = <8000>; // L1, 32K
+ timebase-frequency = <0>;
+ bus-frequency = <0>;
+ clock-frequency = <0>;
+ };
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <00000000 20000000>; // 512MB at 0
+ };
+
+ soc@e0000000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ device_type = "soc";
+ ranges = <0 e0000000 00100000>;
+ reg = <e0000000 00000200>;
+ bus-frequency = <0>;
+
+ wdt@200 {
+ compatible = "mpc83xx_wdt";
+ reg = <200 100>;
+ };
+
+ i2c@3000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ cell-index = <0>;
+ compatible = "fsl-i2c";
+ reg = <3000 100>;
+ interrupts = <e 8>;
+ interrupt-parent = < &ipic >;
+ dfsrr;
+ };
+
+ i2c@3100 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ cell-index = <1>;
+ compatible = "fsl-i2c";
+ reg = <3100 100>;
+ interrupts = <f 8>;
+ interrupt-parent = < &ipic >;
+ dfsrr;
+ };
+
+ spi@7000 {
+ compatible = "fsl_spi";
+ reg = <7000 1000>;
+ interrupts = <10 8>;
+ interrupt-parent = < &ipic >;
+ mode = "cpu";
+ };
+
+ /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
+ usb@23000 {
+ compatible = "fsl-usb2-dr";
+ reg = <23000 1000>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ interrupt-parent = < &ipic >;
+ interrupts = <26 8>;
+ phy_type = "utmi_wide";
+ };
+
+ mdio@24520 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,gianfar-mdio";
+ reg = <24520 20>;
+ phy2: ethernet-phy@2 {
+ interrupt-parent = < &ipic >;
+ interrupts = <11 8>;
+ reg = <2>;
+ device_type = "ethernet-phy";
+ };
+ phy3: ethernet-phy@3 {
+ interrupt-parent = < &ipic >;
+ interrupts = <12 8>;
+ reg = <3>;
+ device_type = "ethernet-phy";
+ };
+ };
+
+ enet0: ethernet@24000 {
+ cell-index = <0>;
+ device_type = "network";
+ model = "eTSEC";
+ compatible = "gianfar";
+ reg = <24000 1000>;
+ local-mac-address = [ 00 00 00 00 00 00 ];
+ interrupts = <20 8 21 8 22 8>;
+ phy-connection-type = "mii";
+ interrupt-parent = < &ipic >;
+ phy-handle = < &phy2 >;
+ };
+
+ enet1: ethernet@25000 {
+ cell-index = <1>;
+ device_type = "network";
+ model = "eTSEC";
+ compatible = "gianfar";
+ reg = <25000 1000>;
+ local-mac-address = [ 00 00 00 00 00 00 ];
+ interrupts = <23 8 24 8 25 8>;
+ phy-connection-type = "mii";
+ interrupt-parent = < &ipic >;
+ phy-handle = < &phy3 >;
+ };
+
+ serial0: serial@4500 {
+ cell-index = <0>;
+ device_type = "serial";
+ compatible = "ns16550";
+ reg = <4500 100>;
+ clock-frequency = <0>;
+ interrupts = <9 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ serial1: serial@4600 {
+ cell-index = <1>;
+ device_type = "serial";
+ compatible = "ns16550";
+ reg = <4600 100>;
+ clock-frequency = <0>;
+ interrupts = <a 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ crypto@30000 {
+ model = "SEC3";
+ compatible = "talitos";
+ reg = <30000 10000>;
+ interrupts = <b 8>;
+ interrupt-parent = < &ipic >;
+ /* Rev. 3.0 geometry */
+ num-channels = <4>;
+ channel-fifo-len = <18>;
+ exec-units-mask = <000001fe>;
+ descriptor-types-mask = <03ab0ebf>;
+ };
+
+ sdhc@2e000 {
+ model = "eSDHC";
+ compatible = "fsl,esdhc";
+ reg = <2e000 1000>;
+ interrupts = <2a 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ sata@18000 {
+ compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
+ reg = <18000 1000>;
+ interrupts = <2c 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ sata@19000 {
+ compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
+ reg = <19000 1000>;
+ interrupts = <2d 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ sata@1a000 {
+ compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
+ reg = <1a000 1000>;
+ interrupts = <2e 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ sata@1b000 {
+ compatible = "fsl,mpc8379-sata", "fsl,pq2pro-sata";
+ reg = <1b000 1000>;
+ interrupts = <2f 8>;
+ interrupt-parent = < &ipic >;
+ };
+
+ /* IPIC
+ * interrupts cell = <intr #, sense>
+ * sense values match linux IORESOURCE_IRQ_* defines:
+ * sense == 8: Level, low assertion
+ * sense == 2: Edge, high-to-low change
+ */
+ ipic: pic@700 {
+ compatible = "fsl,ipic";
+ interrupt-controller;
+ #address-cells = <0>;
+ #interrupt-cells = <2>;
+ reg = <700 100>;
+ };
+ };
+
+ pci0: pci@e0008500 {
+ cell-index = <0>;
+ interrupt-map-mask = <f800 0 0 7>;
+ interrupt-map = <
+
+ /* IDSEL 0x11 */
+ 8800 0 0 1 &ipic 14 8
+ 8800 0 0 2 &ipic 15 8
+ 8800 0 0 3 &ipic 16 8
+ 8800 0 0 4 &ipic 17 8
+
+ /* IDSEL 0x12 */
+ 9000 0 0 1 &ipic 16 8
+ 9000 0 0 2 &ipic 17 8
+ 9000 0 0 3 &ipic 14 8
+ 9000 0 0 4 &ipic 15 8
+
+ /* IDSEL 0x13 */
+ 9800 0 0 1 &ipic 17 8
+ 9800 0 0 2 &ipic 14 8
+ 9800 0 0 3 &ipic 15 8
+ 9800 0 0 4 &ipic 16 8
+
+ /* IDSEL 0x15 */
+ a800 0 0 1 &ipic 14 8
+ a800 0 0 2 &ipic 15 8
+ a800 0 0 3 &ipic 16 8
+ a800 0 0 4 &ipic 17 8
+
+ /* IDSEL 0x16 */
+ b000 0 0 1 &ipic 17 8
+ b000 0 0 2 &ipic 14 8
+ b000 0 0 3 &ipic 15 8
+ b000 0 0 4 &ipic 16 8
+
+ /* IDSEL 0x17 */
+ b800 0 0 1 &ipic 16 8
+ b800 0 0 2 &ipic 17 8
+ b800 0 0 3 &ipic 14 8
+ b800 0 0 4 &ipic 15 8
+
+ /* IDSEL 0x18 */
+ c000 0 0 1 &ipic 15 8
+ c000 0 0 2 &ipic 16 8
+ c000 0 0 3 &ipic 17 8
+ c000 0 0 4 &ipic 14 8>;
+ interrupt-parent = < &ipic >;
+ interrupts = <42 8>;
+ bus-range = <0 0>;
+ ranges = <02000000 0 90000000 90000000 0 10000000
+ 42000000 0 80000000 80000000 0 10000000
+ 01000000 0 00000000 e0300000 0 00100000>;
+ clock-frequency = <0>;
+ #interrupt-cells = <1>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ reg = <e0008500 100>;
+ compatible = "fsl,mpc8349-pci";
+ device_type = "pci";
+ };
+};
^ permalink raw reply related
* Re: Howto use PPC4xx memory to memory DMA
From: padmanabha @ 2008-01-07 10:57 UTC (permalink / raw)
To: linuxppc-embedded
Hi,
I am using 2.6.23 kernel for ppc 440spe based board. When i tried
memory to memory
DMA ( example code taken from earlier posting, & used DMA channel
zero ), DMA is
not happening.
Can any one help me. Any hints would be appreciated.
Thanks and Regards,
Padmanabha.s
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
^ permalink raw reply
* Re: 83xx, ucc_geth, kernel 2.6.23, IP-Config: No network devices
From: Jochen Friedrich @ 2008-01-07 11:17 UTC (permalink / raw)
To: rmcguire; +Cc: linuxppc-embedded
In-Reply-To: <000001c8511b$bc0c03d0$6405a8c0@absolut>
Hi Russell,
> I would appear all the appropriate entries are in the .dts file
> for each the different parts (mdio, ucc_geth, ucc_geth_mdio, phy0).
>
> And yet still no probe functions get called for any of those drivers?
Do you export the subtree using of_platform_bus_probe()?
Thanks,
Jochen
^ permalink raw reply
* RE: How to write a device driver in such a fashion .????
From: Jenkins, Clive @ 2008-01-07 10:55 UTC (permalink / raw)
To: Misbah khan, linuxppc-dev
In-Reply-To: <14660018.post@talk.nabble.com>
=20
> On Initiation by the application of which key is pressed
> driver should perform the task accordingly. There are 7
> keys so seven different task the driver will perform.=20
This is not clear to me.
> 1 . I do not want to use any entry point such as
> read/write/ioctl. In such a case how to access the driver.
> 2. We dont want to implement this as a chracrter driver.
> 3. The driver shall look pretty much like an application
> where in asscssing the H/W memory map .
>
> Hence no entry point and no registeration but an
> application could be able to communicate ....
I think you want the application to directly access
memory-mapped hardware. For this you will need to open
/dev/mem and use the mmap() system call to get a virtual
address of your h/w.
Clive
^ permalink raw reply
* 83xx, ucc_geth, kernel 2.6.23, IP-Config: No network devices
From: Russell McGuire @ 2008-01-07 10:54 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <20071231111443.4c6d8691@kernel.crashing.org>
Ok, I am still stuck on this.
Why isn't probe being called on any of the Freescale network device drivers?
I can see the Generic MII PHY Driver being registered.
The UCC_GETH and UCC_GETH_MDIO both being registered.
An for fun, I even modified the Marvell PHY driver devices ID's to correctly
identify a National part that I am using, and I see this registering.
I would appear all the appropriate entries are in the .dts file
for each the different parts (mdio, ucc_geth, ucc_geth_mdio, phy0).
And yet still no probe functions get called for any of those drivers?
I need this to NFS boot, into the ELDK 4.1 file system.
Does anyone have an example of the 2.6.23 kernel working DTS files for a
Freescale 8360 that they are using NFS Booting for? Has anyone proofed this
out, or is everyone else using this as a module or driver that doesn't kick
until after the root file system is loaded?
Alternatively is there something specific perhaps U-boot is populating in
the OF structure that is preventing my Ethernet phy from being recognized in
the linux kernel? Why are none of the probe functions being called?
-Russ
> -----Original Message-----
> From: Vitaly Bordug [mailto:vitb@kernel.crashing.org]
> Sent: Monday, December 31, 2007 12:15 AM
> To: rmcguire@videopresence.com
> Cc: linuxppc-embedded@ozlabs.org
> Subject: Re: 83xx, ELDK 2.6.23, IP-Config: No network devices
>
> On Sun, 30 Dec 2007 16:51:44 -0800
> Russell McGuire wrote:
>
> > 1) Is there some basic kernel feature I am missing? I have enabled
> > the GIGE UEC GETH driver in the kernel. Perhaps a PHY LIB? Isn't
> > generic MII supported by default?
> >
> yes you will need phylib
>
> > 2) Is there something in the startup board files, that I need to add
> > to register my PHY like an of_put_node()? Again I have pretty much
> > copied the MPC8360E MDS board and it is starting, and defining the
> > par_io port already, except that my PHY ID <on the iC2 bus, is using
> > dev ID 0x01>. However, I don't see the probe function being called,
> > so I don't think this is a concern yet.
> I think you will need to write a driver for your specific PHY access to
> get it covered by phy abstraction layer.
> Generic mii thing is useful when it has access to phy regs somehow (live
> examples are some BCM phys that do not have specs
> available but the thing works using generic mii and standard phy regs).
^ permalink raw reply
* How to write a device driver in such a fashion .????
From: Misbah khan @ 2008-01-07 7:07 UTC (permalink / raw)
To: linuxppc-dev
Hi all ....
I need your suggession to write a driver with such requirements :-
On Initiation by the application of which key is pressed driver should
perform the task accordingly. There are 7 keys so seven different task the
driver will perform.
1 . I do not want to use any entry point such as read/write/ioctl. In such a
case how to access the driver.
2. We dont want to implement this as a chracrter driver.
3. The driver shall look pretty much like an application where in asscssing
the H/W memory map .
Hence no entry point and no registeration but an application could be able
to communicate ....
I need your suggession in this regard .....
-----Misbah
--
View this message in context: http://www.nabble.com/How-to-write-a-device-driver-in-such-a-fashion-.-----tp14660018p14660018.html
Sent from the linuxppc-dev mailing list archive at Nabble.com.
^ permalink raw reply
* Concatenation of MTD devices
From: Sekhar Pedamallu @ 2008-01-07 5:40 UTC (permalink / raw)
To: linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]
Hi dudes,
Had any one worked on the concatenation of MTD devices on ppc . I need to
concatenate two MTD devices. I have a found an option in Kernel
configuration. Apart from could u help me in finding out such driver codes
which involves concatenation ???
Thanks in advance :-)
Thanks & Regards ,
Sekhar Pedamallu
http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________
This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at netadmin@patni.com and delete this mail.
_____________________________________________________________________
[-- Attachment #2: Type: text/html, Size: 3807 bytes --]
^ permalink raw reply
* [PATCH update -mm 16/43] powerpc user_regset compat
From: Roland McGrath @ 2008-01-07 5:40 UTC (permalink / raw)
To: Andrew Morton, Linus Torvalds
Cc: linux-arch, linuxppc-dev, Paul Mackerras, linux-kernel
In-Reply-To: <20071220115808.015F626F98D@magilla.localdomain>
This patch replaces my 2007-12-20 patch by the same title, and has to take
its place in the order of applying that whole series.
Further testing revealed a bug that resulted in regset-based core dumps of
32-bit processes on 64-bit kernels having r0..r3 cleared to zero. The fix
(interdiff from original patch) is a trivial pair of lines in two places.
Thanks,
Roland
---
This extends task_user_regset_view CONFIG_PPC64 with support for the 32-bit
view of register state, compatible with what a CONFIG_PPC32 kernel provides.
This will enable generic machine-independent code to access user-mode
threads' registers for debugging and dumping.
Signed-off-by: Roland McGrath <roland@redhat.com>
---
arch/powerpc/kernel/ptrace.c | 162 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 162 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index eb00274..60de9ee 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -501,8 +501,170 @@ static const struct user_regset_view user_ppc_native_view = {
.regsets = native_regsets, .n = ARRAY_SIZE(native_regsets)
};
+#ifdef CONFIG_PPC64
+#include <linux/compat.h>
+
+static int gpr32_get(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ void *kbuf, void __user *ubuf)
+{
+ const unsigned long *regs = &target->thread.regs->gpr[0];
+ compat_ulong_t *k = kbuf;
+ compat_ulong_t __user *u = ubuf;
+ compat_ulong_t reg;
+
+ if (target->thread.regs == NULL)
+ return -EIO;
+
+ CHECK_FULL_REGS(target->thread.regs);
+
+ pos /= sizeof(reg);
+ count /= sizeof(reg);
+
+ if (kbuf)
+ for (; count > 0 && pos < PT_MSR; --count)
+ *k++ = regs[pos++];
+ else
+ for (; count > 0 && pos < PT_MSR; --count)
+ if (__put_user((compat_ulong_t) regs[pos++], u++))
+ return -EFAULT;
+
+ if (count > 0 && pos == PT_MSR) {
+ reg = get_user_msr(target);
+ if (kbuf)
+ *k++ = reg;
+ else if (__put_user(reg, u++))
+ return -EFAULT;
+ ++pos;
+ --count;
+ }
+
+ if (kbuf)
+ for (; count > 0 && pos < PT_REGS_COUNT; --count)
+ *k++ = regs[pos++];
+ else
+ for (; count > 0 && pos < PT_REGS_COUNT; --count)
+ if (__put_user((compat_ulong_t) regs[pos++], u++))
+ return -EFAULT;
+
+ kbuf = k;
+ ubuf = u;
+ pos *= sizeof(reg);
+ count *= sizeof(reg);
+ return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
+ PT_REGS_COUNT * sizeof(reg), -1);
+}
+
+static int gpr32_set(struct task_struct *target,
+ const struct user_regset *regset,
+ unsigned int pos, unsigned int count,
+ const void *kbuf, const void __user *ubuf)
+{
+ unsigned long *regs = &target->thread.regs->gpr[0];
+ const compat_ulong_t *k = kbuf;
+ const compat_ulong_t __user *u = ubuf;
+ compat_ulong_t reg;
+
+ if (target->thread.regs == NULL)
+ return -EIO;
+
+ CHECK_FULL_REGS(target->thread.regs);
+
+ pos /= sizeof(reg);
+ count /= sizeof(reg);
+
+ if (kbuf)
+ for (; count > 0 && pos < PT_MSR; --count)
+ regs[pos++] = *k++;
+ else
+ for (; count > 0 && pos < PT_MSR; --count) {
+ if (__get_user(reg, u++))
+ return -EFAULT;
+ regs[pos++] = reg;
+ }
+
+
+ if (count > 0 && pos == PT_MSR) {
+ if (kbuf)
+ reg = *k++;
+ else if (__get_user(reg, u++))
+ return -EFAULT;
+ set_user_msr(target, reg);
+ ++pos;
+ --count;
+ }
+
+ if (kbuf)
+ for (; count > 0 && pos <= PT_MAX_PUT_REG; --count)
+ regs[pos++] = *k++;
+ else
+ for (; count > 0 && pos <= PT_MAX_PUT_REG; --count) {
+ if (__get_user(reg, u++))
+ return -EFAULT;
+ regs[pos++] = reg;
+ }
+
+ if (count > 0 && pos == PT_TRAP) {
+ if (kbuf)
+ reg = *k++;
+ else if (__get_user(reg, u++))
+ return -EFAULT;
+ set_user_trap(target, reg);
+ ++pos;
+ --count;
+ }
+
+ kbuf = k;
+ ubuf = u;
+ pos *= sizeof(reg);
+ count *= sizeof(reg);
+ return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
+ (PT_TRAP + 1) * sizeof(reg), -1);
+}
+
+/*
+ * These are the regset flavors matching the CONFIG_PPC32 native set.
+ */
+static const struct user_regset compat_regsets[] = {
+ [REGSET_GPR] = {
+ .core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
+ .size = sizeof(compat_long_t), .align = sizeof(compat_long_t),
+ .get = gpr32_get, .set = gpr32_set
+ },
+ [REGSET_FPR] = {
+ .core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
+ .size = sizeof(double), .align = sizeof(double),
+ .get = fpr_get, .set = fpr_set
+ },
+#ifdef CONFIG_ALTIVEC
+ [REGSET_VMX] = {
+ .core_note_type = NT_PPC_VMX, .n = 34,
+ .size = sizeof(vector128), .align = sizeof(vector128),
+ .active = vr_active, .get = vr_get, .set = vr_set
+ },
+#endif
+#ifdef CONFIG_SPE
+ [REGSET_SPE] = {
+ .n = 35,
+ .size = sizeof(u32), .align = sizeof(u32),
+ .active = evr_active, .get = evr_get, .set = evr_set
+ },
+#endif
+};
+
+static const struct user_regset_view user_ppc_compat_view = {
+ .name = "ppc", .e_machine = EM_PPC, .ei_osabi = ELF_OSABI,
+ .regsets = compat_regsets, .n = ARRAY_SIZE(compat_regsets)
+};
+#endif /* CONFIG_PPC64 */
+
const struct user_regset_view *task_user_regset_view(struct task_struct *task)
{
+#ifdef CONFIG_PPC64
+ if (test_tsk_thread_flag(task, TIF_32BIT))
+ return &user_ppc_compat_view;
+#endif
return &user_ppc_native_view;
}
^ permalink raw reply related
* [PATCH] [POWERPC] Check that the syscall table matches the syscall numbers
From: Stephen Rothwell @ 2008-01-07 5:12 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev, Milton Miller
In-Reply-To: <20080103164141.8faa9f27.sfr@canb.auug.org.au>
Also check that __NR_syscalls has been updated appropriately.
Hopefully this will catch any out of order additions to the
table in the future.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/Makefile | 10 ++++++
arch/powerpc/kernel/systbl_chk.c | 58 +++++++++++++++++++++++++++++++++++++
arch/powerpc/kernel/systbl_chk.sh | 33 +++++++++++++++++++++
3 files changed, 101 insertions(+), 0 deletions(-)
create mode 100644 arch/powerpc/kernel/systbl_chk.c
create mode 100644 arch/powerpc/kernel/systbl_chk.sh
This version does not modify the current code for generating the syscall
tables and does more checking.
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 9374bc9..d9b3770 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -91,3 +91,13 @@ obj-$(CONFIG_PPC64) += $(obj64-y)
extra-$(CONFIG_PPC_FPU) += fpu.o
extra-$(CONFIG_PPC64) += entry_64.o
+
+extra-y += systbl_chk.i
+$(obj)/systbl.o: systbl_chk
+
+quiet_cmd_systbl_chk = CALL $<
+ cmd_systbl_chk = $(CONFIG_SHELL) $< $(obj)/systbl_chk.i
+
+PHONY += systbl_chk
+systbl_chk: $(src)/systbl_chk.sh $(obj)/systbl_chk.i
+ $(call cmd,systbl_chk)
diff --git a/arch/powerpc/kernel/systbl_chk.c b/arch/powerpc/kernel/systbl_chk.c
new file mode 100644
index 0000000..238aa63
--- /dev/null
+++ b/arch/powerpc/kernel/systbl_chk.c
@@ -0,0 +1,58 @@
+/*
+ * This file, when run through CPP produces a list of syscall numbers
+ * in the order of systbl.h. That way we can check for gaps and syscalls
+ * that are out of order.
+ *
+ * Unfortunately, we cannot check for the correct ordering of entries
+ * using SYSX().
+ *
+ * Copyright © IBM Corporation
+ *
+ * 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 <asm/unistd.h>
+
+#define SYSCALL(func) __NR_##func
+#define COMPAT_SYS(func) __NR_##func
+#define PPC_SYS(func) __NR_##func
+#ifdef CONFIG_PPC64
+#define OLDSYS(func) -1
+#define SYS32ONLY(func) -1
+#else
+#define OLDSYS(func) __NR_old##func
+#define SYS32ONLY(func) __NR_##func
+#endif
+#define SYSX(f, f3264, f32) -1
+
+#define SYSCALL_SPU(func) SYSCALL(func)
+#define COMPAT_SYS_SPU(func) COMPAT_SYS(func)
+#define PPC_SYS_SPU(func) PPC_SYS(func)
+#define SYSX_SPU(f, f3264, f32) SYSX(f, f3264, f32)
+
+/* Just insert a marker for ni_syscalls */
+#define __NR_ni_syscall -1
+
+/*
+ * These are the known exceptions.
+ * Hopefully, there will be no more.
+ */
+#define __NR_llseek __NR__llseek
+#undef __NR_umount
+#define __NR_umount __NR_umount2
+#define __NR_old_getrlimit __NR_getrlimit
+#define __NR_newstat __NR_stat
+#define __NR_newlstat __NR_lstat
+#define __NR_newfstat __NR_fstat
+#define __NR_newuname __NR_uname
+#define __NR_sysctl __NR__sysctl
+#define __NR_olddebug_setcontext __NR_sys_debug_setcontext
+
+/* We call sys_ugetrlimit for syscall number __NR_getrlimit */
+#define getrlimit ugetrlimit
+
+START_TABLE
+#include <asm/systbl.h>
+END_TABLE __NR_syscalls
diff --git a/arch/powerpc/kernel/systbl_chk.sh b/arch/powerpc/kernel/systbl_chk.sh
new file mode 100644
index 0000000..19415e7
--- /dev/null
+++ b/arch/powerpc/kernel/systbl_chk.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Just process the CPP output from systbl_chk.c and complain
+# if anything is out of order.
+#
+# Copyright © 2008 IBM Corporation
+#
+# 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.
+
+awk 'BEGIN { num = -1; } # Ignore the beginning of the file
+ /^#/ { next; }
+ /^[ \t]*$/ { next; }
+ /^START_TABLE/ { num = 0; next; }
+ /^END_TABLE/ {
+ if (num != $2) {
+ printf "__NR_syscalls (%s) is not one more than the last syscall (%s)\n",
+ $2, num - 1;
+ exit(1);
+ }
+ num = -1; # Ignore the rest of the file
+ }
+ {
+ if (num == -1) next;
+ if (($1 != -1) && ($1 != num)) {
+ printf "Syscall %s out of order (expected %s)\n",
+ $1, num;
+ exit(1);
+ };
+ num++;
+ }' "$1"
--
1.5.3.7
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
^ permalink raw reply related
* Re: [PATCH] Fix remainder calculating bug in single floating point division
From: Josh Boyer @ 2008-01-07 1:09 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1199652574.7291.85.camel@pasglop>
On Mon, 07 Jan 2008 07:49:33 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
> On Sun, 2008-01-06 at 12:44 -0800, Dan Malek wrote:
> > While it's convenient, I still don't think kernel float
> > emulation should be a solution. The tools should
> > generate soft-float for the applications and libraries.
>
> I agree, for deployement, it's definitely not a solution, though it's
> very convenient for us hackers :-)
Hacks have a way of becoming solutions... ;)
josh
^ permalink raw reply
* Re: OProfile callgraph support not working correctly on PPC processors
From: Anton Blanchard @ 2008-01-07 0:11 UTC (permalink / raw)
To: Bob Nelson; +Cc: linuxppc
In-Reply-To: <200712211115.33238.rrnelson@linux.vnet.ibm.com>
Hi,
> I have been investigating why I have not been able to get callgraph code for
> OProfile on Cell to work correctly and I am pretty sure that I have run into
> a problem that is common across all the Power platforms. (At least the other
> ones I have looked at.) I have a simple test program that is attached
> below. It has a main, that calls function1, which calls function2. Each of
> the functions has some type of loop in it so that I can catch it spending
> some CPU time with OProfile. I have also attached the objdump -d output for
> the program cut down to the three pertinent functions that shows what is
> happening. In a nutshell when a terminal function (calls no other function)
> is called the compiler is making an optimization that seems to break the ABI
> convention as far as I can tell. It does not store the Link Register on the
> stack like any other function. It just leaves the return address in LR,
> knowing that nothing should change it. (You can see at the top of both main
> and function1 the first thing it does is "mflr r0" to copy the link register
> to R0 to be saved. It does not do that in function2.) When OProfile takes
> an interrupt and needs to gather the callgraph information it does so by
> grabbing the process' stack pointer (R1) and follows the chain back up the
> stack to gather all the caller's addresses. This works for most functions,
> except for terminal functions for the reason noted above.
Sounds like a standard tail call optimisation. You would have a similar
problem on a normal function if you took a PMU exception in the function
prolog before the LR had been saved to the stack.
> Looking at the assembly listing I drew myself a diagram of the stack while
> function2 is active to convince myself of what was wrong and here is what I
> see it as... When the interrupt is handled OProfile grabs a copy of R1, it
> ignores the first frame on the stack because there should be no address
> stored. In the second frame it expects to find function2's caller but since
> function2 doesn't store it, it grabs some random data and proceeds. The stack
> chain is all ok so it doesn't go off into neverland trying to follow a bad
> chain, but it grabs an invalid address for the caller. And that is why
> OProfile thinks terminal functions have no callers on PPC...
>
> Any suggestions on how this can be fixed? I am guessing that changing the
> compiler and recompiling every program is probably not the answer. I assume
> the link register has to be saved in the interrupt routine when it runs, or
> else it couldn't call anything else without crashing the program that was
> interrupted. Is there a safe place to find it?
You could make use of the LR itself, but you would need to work out if
the LR was in the same function as the stack saved LR, or worse still if
someone uses the LR for an indirect branch it could be completely wrong.
To do a better job you would probably have to parse the dwarf debug
info. Maybe we could always dump the LR and stack LR and decide what one
to use when oprofile userspace parses it.
Anton
^ permalink raw reply
* Re: [PATCH 3/3] Return a non-zero exit code if an error occurs during dts parsing.
From: Scott Wood @ 2008-01-06 22:55 UTC (permalink / raw)
To: jdl, linuxppc-dev
In-Reply-To: <20080104043033.GD4326@localhost.localdomain>
On Fri, Jan 04, 2008 at 03:30:33PM +1100, David Gibson wrote:
> This is unequivocally wrong. boot_info should have information about
> the contents of the blob, not state information like the error.
"This blob is invalid" *is* information about the contents of the blob.
> If you're going to use an ugly global, then use it everywhere.
Why go out of our way to make the code even less library-able/thread-safe?
-Scott
^ permalink raw reply
* Re: [PATCH 2/3] Look for include files in the directory of the including file.
From: Scott Wood @ 2008-01-06 22:52 UTC (permalink / raw)
To: jdl, linuxppc-dev
In-Reply-To: <20080104042739.GC4326@localhost.localdomain>
On Fri, Jan 04, 2008 at 03:27:39PM +1100, David Gibson wrote:
> > + newfile = dtc_open_file(filename, searchptr);
> > + if (!newfile) {
> > + yyerrorf("Couldn't open \"%s\": %s",
> > + filename, strerror(errno));
> > + exit(1);
>
> Use die() here, that's what it's for.
die() doesn't print file and line information.
> > + while (search) {
> > + if (dtc_open_one(file, search->dir, fname))
> > + return file;
>
> Don't we need a different case here somewhere for if someone specifies
> an include file as an absolute path? Have I missed something?
Yeah, I forgot about that, and sent another patch to fix it when I
noticed (jdl had already pulled, so I didn't send an amended patch).
> [snip]
> > +struct search_path {
> > + const char *dir; /* NULL for current directory */
> > + struct search_path *prev, *next;
> > +};
>
> I wouldn't suggest a doubly linked list here. Or at least not without
> converting our many existing singly linked lists at the same time.
The doubly-linked list is intended to make it easier to construct search
path lists one-at-a-time from arguments in the proper order, without
needing to reverse the list at the end.
-Scott
^ permalink raw reply
* Re: [PATCH 2/3] Handle absolute pathnames correctly in dtc_open_file.
From: Scott Wood @ 2008-01-06 22:46 UTC (permalink / raw)
To: jdl, linuxppc-dev
In-Reply-To: <20080106033716.GL4326@localhost.localdomain>
On Sun, Jan 06, 2008 at 02:37:16PM +1100, David Gibson wrote:
> > out:
> > + free((void *)file->dir);
>
> That cast shouldn't be there.
It generates a constness warning otherwise. I was on the fence over
whether to just remove the constness (even though the data is never
modified during its lifetime); would that be preferable?
-Scott
^ permalink raw reply
* Re: [patch 3/3] PS3: Add logical performance monitor driver support
From: Arnd Bergmann @ 2008-01-06 21:56 UTC (permalink / raw)
To: Geoff Levand; +Cc: linuxppc-dev, paulus, Takashi Yamamoto
In-Reply-To: <47813CA4.8000203@am.sony.com>
On Sunday 06 January 2008, Geoff Levand wrote:
>
> > This mutex is documented as the 'open/close' mutex and you use it
> > to prevent concurrent execution of the open and close functions.
> > However, it's unclear what data structures are actually protected
> > by it.
> >
> > I think this is the result of unusual lifetime rules for the lpm_priv
> > object, which I already mentioned above.
>
> Yes, we really just need to use the mutex to allow only a single instance,
> and so do a mutex_trylock() in ps3_lpm_open() and return -EBUSY on fail,
> and then a mutex_unlock() in ps3_lpm_close().
A simple atomic_test_and_set in open() should do the job just as well then.
Arnd <><
^ permalink raw reply
* Re: [PATCH] Fix remainder calculating bug in single floating point division
From: Dan Malek @ 2008-01-06 20:44 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, Liu Yu
In-Reply-To: <1199650065.7291.81.camel@pasglop>
On Jan 6, 2008, at 12:07 PM, Benjamin Herrenschmidt wrote:
> It's nice to see somebody digging in that scary math emu stuff. If you
> could also get rid of the warnings, it would be perfect :-)
Yes, it is :-) I didn't think it would have a life beyond MPC8xx.
> .... that this code was lifted from
> somewhere else (glibc ? gcc soft-float ?),
It seems like a lifetime ago.... I copied the framework
from Sparc, and the internals from gcc soft-float. I didn't
change any of the internal emulation functions (hence,
some of the warnings), just the calling interface.
While it's convenient, I still don't think kernel float
emulation should be a solution. The tools should
generate soft-float for the applications and libraries.
Thanks.
-- Dan
^ permalink raw reply
* Re: [PATCH] Fix remainder calculating bug in single floating point division
From: Benjamin Herrenschmidt @ 2008-01-06 20:49 UTC (permalink / raw)
To: Dan Malek; +Cc: linuxppc-dev, Liu Yu
In-Reply-To: <66F0B96A-5B53-48D3-BB90-07841F3EA1EE@embeddedalley.com>
On Sun, 2008-01-06 at 12:44 -0800, Dan Malek wrote:
> While it's convenient, I still don't think kernel float
> emulation should be a solution. The tools should
> generate soft-float for the applications and libraries.
I agree, for deployement, it's definitely not a solution, though it's
very convenient for us hackers :-)
Ben.
^ permalink raw reply
* Re: [patch 3/3] PS3: Add logical performance monitor driver support
From: Geoff Levand @ 2008-01-06 20:40 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linuxppc-dev, paulus, Takashi Yamamoto
In-Reply-To: <200801051256.22732.arnd@arndb.de>
On 01/05/2008 03:56 AM, Arnd Bergmann wrote:
> On Saturday 05 January 2008, Geoff Levand wrote:
>> From: Takashi Yamamoto <Takashi02_Yamamoto@hq.scei.sony.co.jp>
>>
>> Add PS3 logical performance monitor (lpm) device driver.
>>
>> The PS3's LV1 hypervisor provides a Logical Performance Monitor that
>> abstarcts the Cell processor's performance monitor features for use
>> by guest operating systems.
>>
>> Signed-off-by: Takashi Yamamoto <Takashi02_Yamamoto@hq.scei.sony.co.jp>
>> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
>
> Wow, great stuff!
>
> One bit of information I'm missing in the description is what the users
> of this code are. Your Kconfig text mentions that can be used for both
> perfmon and oprofile. Are these, or one of them, currently under
> work as well?
Yes, perfmon2 support is somewhat working, but still under development.
I added the perfmon2 patches into ps3-linux.git, so the easy way would
be to use those kernel sources. This info written before I merged
perfmon2 into ps3-linux.git, but does give some info on how to use
it:
http://www.kernel.org/pub/linux/kernel/people/geoff/cell/CELL-Linux-CL_20071220-ADDON/doc/ApplicationProgrammingEnvironment.html
I just started to work on the kernel oprofile support, but it is not
usable yet. Any contributions would be welcome. Currently the patch
is just something hacked up to use for testing:
http://git.kernel.org/?p=linux/kernel/git/geoff/ps3-linux-patches.git;a=blob;f=ps3-wip/ps3-oprofile.patch;hb=HEAD
>> --- a/arch/powerpc/platforms/ps3/Kconfig
>> +++ b/arch/powerpc/platforms/ps3/Kconfig
>> @@ -138,4 +138,18 @@ config PS3_FLASH
>> be disabled on the kernel command line using "ps3flash=off", to
>> not allocate this fixed buffer.
>>
>> +config PS3_LPM
>> + tristate "PS3 Logical Performance Monitor support"
>> + depends on PPC_PS3
>> + default n
>
> 'default n' is redundant.
>
>> + help
>> + Include support for the PS3 Logical Performance Monitor.
>> +
>> + This support is required to use the logical performance monitor
>> + of the PS3's LV1 hypervisor.
>> +
>> + If you intend to use the advanced performance monitoring and
>> + profiling support of the Cell processor with programs like
>> + oprofile and perfmon, then say Y or M, otherwise say N.
>> +
>
> Should that be perfmon2 instead of perfmon?
Yes.
> I think once they high-level drivers are merged, it would make sense
> to autoselected by these, so the user doesn't have to read through
> the help text.
Yes, many things can be improved.
>> +/**
>> + * struct ps3_lpm_priv - private lpm device data.
>> + *
>> + * @mutex: Open/close mutex.
>> + * @rights: The lpm rigths granted by the system policy module.
>> + * @pu_id: The lv1 id of the BE prosessor for this lpm instance.
>> + * @lpm_id: The lv1 id of this lpm instance.
>> + * @outlet_id: The outlet created by lv1 for this lpm instance.
>> + * @constructed: A flag indicating the lpm driver has been opened -- can we just use (lpm_id == ???)
>> + * @tb_size: The lv1 trace buffer size
>> + * @tb_cache: Trace buffer cache
>> + * @tb_cache_internal: A flag indicating the trace buffer cache was allocated
>> + * by the driver.
>> + * @tb_cache: Trace buffer cache
>> + * @sizeof_traced_data: Traced data size
>> + * @sbd: the struct ps3_system_bus_device attached to this driver
>> + */
>> +
>> +struct ps3_lpm_priv {
>> + struct mutex mutex;
>> + u64 rights;
>> + u64 pu_id;
>> + u64 lpm_id;
>> + u64 outlet_id;
>> + int constructed;
>> + u64 tb_size;
>> + void *tb_cache;
>> + u64 tb_cache_size;
>> + int tb_cache_internal;
>> + u64 sizeof_traced_data;
>> + u64 sizeof_total_copied_data;
>> + u64 shadow_pm_control;
>> + u64 shadow_pm_start_stop;
>> + u64 shadow_pm_interval;
>> + u64 shadow_group_control;
>> + u64 shadow_debug_bus_control;
>> + struct ps3_system_bus_device *sbd;
>> +};
>
> Some of the members in this struct are not present in the comment,
> which is somewhat confusing.
I'll add those in for the next post.
>> +
>> +/**
>> + * lpm_priv - Static instance of the lpm data.
>> + *
>> + * Since the exported routines don't support the notion of a device
>> + * instance we need to hold the instance in this static variable
>> + * and only allow at most one instance to be created.
>> + */
>> +
>> +static struct ps3_lpm_priv *lpm_priv;
>
> Hmmm, my gut feeling about this is that it would be better to actually
> pass this around through the exported functions.
Yes, I feel the same way. In general, I think we need to make a
better platform abstraction of the processor's pm functions. That
would include support for platform specific instance data, RTAS
for blade, lpm for ps3.
> That would also
> provide some arbitration between the possible users, e.g. oprofile
> would get -EBUSY when asking for the ps3_lpm while perfmon2 is
> already active.
That already happens in ps3_lpm_open(), using the lpm_priv.constructed
variable.
>> +inline u32 ps3_get_hw_thread_id(int cpu)
>> +{
>> + return cpu;
>> +}
>> +EXPORT_SYMBOL_GPL(ps3_get_hw_thread_id);
>
> The 'inline' is bogus, as that doesn't work across exported functions
> and you are not using the function in this file.
>
> Should you perhaps return hard_smp_processor_id(cpu) instead of cpu
> here?
Yes, good point.
>> +/**
>> + * _ps3_copy_trace_buffer - Copy the trace buffer.
>> + */
>> +
>> +static u64 _ps3_copy_trace_buffer(u64 offset, u64 size, u64 *to, int to_user)
>> +{
>> + int result;
>> + u64 sizeof_copied_data;
>> +
>> + if (offset >= lpm_priv->sizeof_traced_data)
>> + return 0;
>> +
>> + result = lv1_copy_lpm_trace_buffer(lpm_priv->lpm_id, offset, size,
>> + &sizeof_copied_data);
>> + if (result) {
>> + dev_err(sbd_core(), "%s:%u: lv1_copy_lpm_trace_buffer failed: "
>> + "offset 0x%lx, size 0x%lx: %s\n", __func__, __LINE__,
>> + offset, size, ps3_result(result));
>> + return 0;
>> + }
>> +
>> + if (to_user) {
>> + result = copy_to_user((void __user *)to, lpm_priv->tb_cache,
>> + sizeof_copied_data);
>> + if (result) {
>> + dev_err(sbd_core(), "%s:%u: copy_to_user() error. "
>> + "offset:0x%lx size:0x%lx dest:0x%p src:0x%p\n",
>> + __func__, __LINE__, offset, sizeof_copied_data,
>> + to, lpm_priv->tb_cache);
>> + return 0;
>> + }
>> + } else
>> + memcpy(to, lpm_priv->tb_cache, sizeof_copied_data);
>> +
>> + return sizeof_copied_data;
>> +}
>
> I don't like how this functions uses the same argument for kernel and user
> pointers, this will cause sparse warnings in the code using it. How about
> making this two separate functions?
OK, good point, I'll consider it.
>> +int ps3_lpm_open(void *tb_cache, u64 tb_cache_size, u64 tb_type)
>> +{
>> + int result;
>> + u64 cbe_node_id;
>> + u64 tb_size;
>> + u64 ctrl_opt;
>> + u64 tb_cache_lpar_addr;
>> + u64 lpm_id;
>> + u64 outlet_id;
>> + u64 used_tb_size;
>> +
>> + if (!lpm_priv) {
>> + BUG();
>> + return -ENODEV;
>> + }
>> +
>> + mutex_lock(&lpm_priv->mutex);
>
> This mutex is documented as the 'open/close' mutex and you use it
> to prevent concurrent execution of the open and close functions.
> However, it's unclear what data structures are actually protected
> by it.
>
> I think this is the result of unusual lifetime rules for the lpm_priv
> object, which I already mentioned above.
Yes, we really just need to use the mutex to allow only a single instance,
and so do a mutex_trylock() in ps3_lpm_open() and return -EBUSY on fail,
and then a mutex_unlock() in ps3_lpm_close().
-Geoff
^ permalink raw reply
* Re: [patch 2/3] PS3: Add logical performance monitor device support
From: Geoff Levand @ 2008-01-06 20:39 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linuxppc-dev, paulus
In-Reply-To: <200801051229.33099.arnd@arndb.de>
On 01/05/2008 03:29 AM, Arnd Bergmann wrote:
> On Saturday 05 January 2008, Geoff Levand wrote:
>> + struct layout {
>> + struct ps3_system_bus_device dev;
>> + } *p;
>
> What's the point of this data structure? You don't use the
> struct anywhere, and it only has one member, so you could
> just declare that directly.
Yes, this code was just cut and pasted from a device that
had more members.
>> + if (tmp1 != tmp2) {
>> + pr_debug("%s:%d: wrong lpar\n",
>> + __func__, __LINE__);
>> + result = -1;
>> + goto fail_rights;
>> + }
>> +
>> + if (!(p->dev.lpm.rights & PS3_LPM_RIGHTS_USE_LPM)) {
>> + pr_debug("%s:%d: don't have rights to use lpm\n",
>> + __func__, __LINE__);
>> + result = -1;
>> + goto fail_rights;
>> + }
>> +
>
> I think __init functions should return error codes like -EPERM or
> -EINVAL, not numeric -1.
I'll fix it in the next post.
-Geoff
^ permalink raw reply
* Re: Enable RTC for Ebony and Walnut
From: Olof Johansson @ 2008-01-06 20:48 UTC (permalink / raw)
To: Josh Boyer, Paul Mackerras, linuxppc-dev
In-Reply-To: <20080102114208.GD23168@localhost.localdomain>
On Wed, Jan 02, 2008 at 10:42:08PM +1100, David Gibson wrote:
> On Fri, Dec 21, 2007 at 03:29:22PM -0600, Olof Johansson wrote:
> > Hi,
> >
> > On Fri, Dec 21, 2007 at 01:21:30PM +1100, David Gibson wrote:
> > > Index: working-2.6/arch/powerpc/platforms/Kconfig
> > > ===================================================================
> > > --- working-2.6.orig/arch/powerpc/platforms/Kconfig 2007-12-10 10:52:44.000000000 +1100
> > > +++ working-2.6/arch/powerpc/platforms/Kconfig 2007-12-21 13:11:34.000000000 +1100
> > > @@ -315,6 +315,9 @@ config FSL_ULI1575
> > > config CPM
> > > bool
> > >
> > > +config OF_RTC
> > > + bool
> > > +
> >
> > New config options should have descriptions, even if they're silent
> > ones.
>
> Uh.. but if there's a description, won't kconfig prompt for the
> option? This one should only ever be selected by the platform
> options.
Sorry, should have said "should have help texts to describe them". Yes,
the one-line description will trigger a question, but adding a short
help text describing what the config option is for does not.
-Olof
^ permalink raw reply
* Re: [PATCH] Fix remainder calculating bug in single floating point division
From: Benjamin Herrenschmidt @ 2008-01-06 20:07 UTC (permalink / raw)
To: Liu Yu; +Cc: linuxppc-dev
In-Reply-To: <11996296134110-git-send-email-Yu.Liu@freescale.com>
On Sun, 2008-01-06 at 22:26 +0800, Liu Yu wrote:
> This bug exists in the emulation of floating point division for powerpc.
>
> The original code cannot count the remainder correctly.
> I can provide a test case to trigger this bug.
> When use fdiv to count 1.1754941e-38f / 0.9999999f,
> the result is expected to be 1.175494e-38f,
> but we will get 1.174921e-38f in the original case.
It's nice to see somebody digging in that scary math emu stuff. If you
could also get rid of the warnings, it would be perfect :-)
Now, appart from that, I seem to remember Dan telling me at some point
in the past (I think it was Dan... ) that this code was lifted from
somewhere else (glibc ? gcc soft-float ?), in which case it might be
worth to fix that somewhere else as well, or if it's already been fixed,
maybe resync.
Cheers,
Ben.
^ permalink raw reply
* [PATCH] Fix remainder calculating bug in single floating point division
From: Liu Yu @ 2008-01-06 14:26 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Liu Yu
This bug exists in the emulation of floating point division for powerpc.
The original code cannot count the remainder correctly.
I can provide a test case to trigger this bug.
When use fdiv to count 1.1754941e-38f / 0.9999999f,
the result is expected to be 1.175494e-38f,
but we will get 1.174921e-38f in the original case.
Comments are always welcomed!
Signed-off-by: Liu Yu <Yu.Liu@freescale.com>
---
arch/powerpc/math-emu/sfp-machine.h | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/math-emu/sfp-machine.h b/arch/powerpc/math-emu/sfp-machine.h
index 4b17d83..644cee2 100644
--- a/arch/powerpc/math-emu/sfp-machine.h
+++ b/arch/powerpc/math-emu/sfp-machine.h
@@ -324,10 +324,10 @@ extern int fp_pack_ds(void *, long, unsigned long, unsigned long, long, long);
__r1 = __r1 * __ll_B | __ll_highpart (n0); \
if (__r1 < __m) \
{ \
- __q1--, __r1 += (d); \
- if (__r1 >= (d)) /* we didn't get carry when adding to __r1 */ \
- if (__r1 < __m) \
+ do { \
__q1--, __r1 += (d); \
+ /* we didn't get carry when adding to __r1 */ \
+ } while (__r1 >= (d) && __r1 < __m); \
} \
__r1 -= __m; \
\
@@ -337,10 +337,9 @@ extern int fp_pack_ds(void *, long, unsigned long, unsigned long, long, long);
__r0 = __r0 * __ll_B | __ll_lowpart (n0); \
if (__r0 < __m) \
{ \
- __q0--, __r0 += (d); \
- if (__r0 >= (d)) \
- if (__r0 < __m) \
+ do { \
__q0--, __r0 += (d); \
+ } while (__r0 >= (d) && __r0 < __m); \
} \
__r0 -= __m; \
\
--
1.5.2
^ permalink raw reply related
* [PATCH] Fix carry bug in 128-bit unsigned integer adding
From: Liu Yu @ 2008-01-06 14:26 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Liu Yu
This bug exists in math emulation for powerpc.
The macro define are mainly used by multiplication.
When adding two unsigned operands ( r = x + y ),
the carry bit can be counted by whether r is less than x.
However, when adding three unsigned operands, this method does not work.
The original code below uses this method to count carry,
it apparently overlook the case of three operands.
Assume all the operands is 32-bit wide,
( r = x + y + last_carry , x = 0, y = 0xffffffff, last_carry = 1),
then r is no less than x but it actually gets a carry.
I tried to fix this bug, but this patch seems not that pretty.
Are there any better ideas?
Comments are always welcomed!
Signed-off-by: Liu Yu <Yu.Liu@freescale.com>
---
arch/powerpc/math-emu/op-4.h | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/math-emu/op-4.h b/arch/powerpc/math-emu/op-4.h
index fcdd6d0..93c7390 100644
--- a/arch/powerpc/math-emu/op-4.h
+++ b/arch/powerpc/math-emu/op-4.h
@@ -195,18 +195,24 @@
#ifndef __FP_FRAC_ADD_4
#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
- (r0 = x0 + y0, \
- r1 = x1 + y1 + (r0 < x0), \
- r2 = x2 + y2 + (r1 < x1), \
- r3 = x3 + y3 + (r2 < x2))
+ do { \
+ _FP_W_TYPE _x0 = x0, _x1 = x1, _x2 = x2, _y1 = y1, _y2 = y2; \
+ r0 = x0 + y0; \
+ r1 = x1 + y1 + (r0 < _x0); \
+ r2 = x2 + y2 + (r1 < _x1 || (r1 == _x1 && !(_y1 + 1))); \
+ r3 = x3 + y3 + (r2 < _x2 || (r2 == _x2 && !(_y2 + 1))); \
+ } while(0)
#endif
#ifndef __FP_FRAC_SUB_4
#define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
- (r0 = x0 - y0, \
- r1 = x1 - y1 - (r0 > x0), \
- r2 = x2 - y2 - (r1 > x1), \
- r3 = x3 - y3 - (r2 > x2))
+ do { \
+ _FP_W_TYPE _x0 = x0, _x1 = x1, _x2 = x2, _y1 = y1, _y2 = y2; \
+ r0 = x0 - y0; \
+ r1 = x1 - y1 - (r0 > _x0); \
+ r2 = x2 - y2 - (r1 > _x1 || (r1 == _x1 && !(_y1 + 1))); \
+ r3 = x3 - y3 - (r2 > _x2 || (r2 == _x2 && !(_y2 + 1))); \
+ } while(0)
#endif
#ifndef __FP_FRAC_ADDI_4
--
^ permalink raw reply related
* Re: [PATCH] MTD for Taco
From: David Gibson @ 2008-01-06 3:44 UTC (permalink / raw)
To: Sean MacLennan; +Cc: linuxppc-dev, Stefan Roese
In-Reply-To: <4780491A.8080006@pikatech.com>
On Sat, Jan 05, 2008 at 10:20:58PM -0500, Sean MacLennan wrote:
> David Gibson wrote:
> >> I'm pretty sure that you don't need a board specific mapping driver
> >> for NOR flash. physmap_of should be exactly what you need. You just need
> >> to fill the device tree properties correctly.
> >>
> >
> > Absolutely. We should not be using C-coded maps in arch/powerpc
>
> Ok a couple of questions. How do I find out the size of the NOR flash?
> It was in a global in the ppc arch.
The flash size goes in the "reg" property of the flash node.
> Also, where is the best place to fixup the partitions? We have paritions
> that must be at the top and ones that must be at the bottom, so we
> dynamically setup the partitions based on the NOR size. The NOR size is
> variable.
Ok, you can fix this up in the bootwrapper.
> And is it ok the name the paritions in the dts based on an index? I
> notice others use an address, but since I don't know the address up
> front I just used index numbers.
No, the node name must match the node's "reg" property, which is the
partition's offset. If you're creating the partition nodess on the
fly in the bootwrapper you can get that right there. I'm also hoping
soon to add a function to fixup node names to libfdt, which will then
be usable in the wrapper.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ 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