[PATCH V3] powerpc/85xx: workaround for chips with MSI hardware errata
From: Hongtao Jia The MPIC version 2.0 has a MSI errata (errata PIC1 of mpc8544), It causes that neither MSI nor MSI-X can work fine. This is a workaround to allow MSI-X to function properly. Signed-off-by: Liu Shuo Signed-off-by: Li Yang Signed-off-by: Jia Hongtao --- Changes for V3: * remove mpic_has_erratum_pic1() function. Test erratum directly. * rebase on latest kernel update. Changes for V2: * change the name of function mpic_has_errata() to mpic_has_erratum_pic1(). * move MSI_HW_ERRATA_ENDIAN define to fsl_msi.h with all other defines. arch/powerpc/sysdev/fsl_msi.c | 29 ++--- arch/powerpc/sysdev/fsl_msi.h | 2 ++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c index 4bbb4b8..f086c6f 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c @@ -162,7 +162,17 @@ static void fsl_compose_msi_msg(struct pci_dev *pdev, int hwirq, msg->address_lo = lower_32_bits(address); msg->address_hi = upper_32_bits(address); - msg->data = hwirq; + /* +* MPIC version 2.0 has erratum PIC1. It causes +* that neither MSI nor MSI-X can work fine. +* This is a workaround to allow MSI-X to function +* properly. It only works for MSI-X, we prevent +* MSI on buggy chips in fsl_setup_msi_irqs(). +*/ + if (msi_data->feature & MSI_HW_ERRATA_ENDIAN) + msg->data = __swab32(hwirq); + else + msg->data = hwirq; pr_debug("%s: allocated srs: %d, ibs: %d\n", __func__, (hwirq >> msi_data->srs_shift) & MSI_SRS_MASK, @@ -180,8 +190,16 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) struct msi_msg msg; struct fsl_msi *msi_data; - if (type == PCI_CAP_ID_MSIX) - pr_debug("fslmsi: MSI-X untested, trying anyway.\n"); + if (type == PCI_CAP_ID_MSI) { + /* +* MPIC version 2.0 has erratum PIC1. For now MSI +* could not work. So check to prevent MSI from +* being used on the board with this erratum. +*/ + list_for_each_entry(msi_data, &msi_head, list) + if (msi_data->feature & MSI_HW_ERRATA_ENDIAN) + return -EINVAL; + } /* * If the PCI node has an fsl,msi property, then we need to use it @@ -446,6 +464,11 @@ static int fsl_of_msi_probe(struct platform_device *dev) msi->feature = features->fsl_pic_ip; + /* For erratum PIC1 on MPIC version 2.0*/ + if ((features->fsl_pic_ip & FSL_PIC_IP_MASK) == FSL_PIC_IP_MPIC + && (fsl_mpic_primary_get_version() == 0x0200)) + msi->feature |= MSI_HW_ERRATA_ENDIAN; + /* * Remember the phandle, so that we can match with any PCI nodes * that have an "fsl,msi" property. diff --git a/arch/powerpc/sysdev/fsl_msi.h b/arch/powerpc/sysdev/fsl_msi.h index 420cfcb..a67359d 100644 --- a/arch/powerpc/sysdev/fsl_msi.h +++ b/arch/powerpc/sysdev/fsl_msi.h @@ -27,6 +27,8 @@ #define FSL_PIC_IP_IPIC 0x0002 #define FSL_PIC_IP_VMPIC 0x0003 +#define MSI_HW_ERRATA_ENDIAN 0x0010 + struct fsl_msi_cascade_data; struct fsl_msi { -- 2.1.0.27.g96db324 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [3/3] powerpc/dma: Remove ZONE_DMA completely
On Fri, 2015-20-02 at 08:35:44 UTC, Benjamin Herrenschmidt wrote: > We don't initialize it, we don't use it, remove it. > > We can bring it back if we ever wish to have support for devices > who have smaller than 32-bit DMA limitations but I don't think > we care much anymore. > > Signed-off-by: Benjamin Herrenschmidt > --- > arch/powerpc/Kconfig |2 +- > arch/powerpc/kernel/dma.c | 10 +- > 2 files changed, 2 insertions(+), 10 deletions(-) > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > index 22b0940..4efbfba 100644 > --- a/arch/powerpc/Kconfig > +++ b/arch/powerpc/Kconfig > @@ -712,7 +712,7 @@ config ISA > > config ZONE_DMA > bool > - default y > + default n > > config NEED_DMA_MAP_STATE > def_bool (PPC64 || NOT_COHERENT_CACHE) > diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c > index e24e0ae..6306d4e 100644 > --- a/arch/powerpc/kernel/dma.c > +++ b/arch/powerpc/kernel/dma.c > @@ -63,16 +63,8 @@ void *dma_direct_alloc_coherent(struct device *dev, size_t > size, > return NULL; > } > > - switch (zone) { > - case ZONE_DMA: > - flag |= GFP_DMA; > - break; > -#ifdef CONFIG_ZONE_DMA32 > - case ZONE_DMA32: > + if (zone == ZONE_DMA32) > flag |= GFP_DMA32; > - break; > -#endif > - }; You still need the ifdef, else eg. ppc6xx_defconfig: arch/powerpc/kernel/dma.c:66:14: error: 'ZONE_DMA32' undeclared (first use in this function) cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 4/4] powerpc/mpic: remove unused functions
On Wed, 2015-02-25 at 20:39 -0600, Jia Hongtao-B38951 wrote: > Hi Scott, > > I'm really sorry for leave this patch like a zombie. > Now I have plan to revisit this patch. > > From the previous comments the compile error was fixed. > But beyond that I have had no plan to update it. > > Could you please comment on why it's still on hold? > Kumar had some comments. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH 4/4] powerpc/mpic: remove unused functions
Hi Scott, I'm really sorry for leave this patch like a zombie. Now I have plan to revisit this patch. From the previous comments the compile error was fixed. But beyond that I have had no plan to update it. Could you please comment on why it's still on hold? Thanks. > -Original Message- > From: Wood Scott-B07421 > Sent: Tuesday, February 24, 2015 5:32 AM > To: Arseny Solokha > Cc: Michael Ellerman; Benjamin Herrenschmidt; Paul Mackerras; linuxppc- > d...@lists.ozlabs.org; linux-ker...@vger.kernel.org; Jia Hongtao-B38951 > Subject: Re: [PATCH 4/4] powerpc/mpic: remove unused functions > > On Thu, 2015-02-19 at 19:26 +0700, Arseny Solokha wrote: > > + fsl_mpic_primary_get_version() is just a safe wrapper around > > fsl_mpic_get_version() for SMP configurations. While the latter is > > called explicitly for handling PIC initialization and setting up error > > interrupt vector depending on PIC hardware version, the former isn't > > used for anything. > > It was meant to be used by http://patchwork.ozlabs.org/patch/233211/ > which never got respun. Hongtao, do you plan to revisit that patch? > > -Scott > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v3 18/30] PCI/powerpc: Use pci_scan_root_bridge() for simplicity
Now we could use pci_scan_root_bridge() to scan pci buses, provide powerpc specific pci_host_bridge_ops. Suggested-by: Arnd Bergmann Signed-off-by: Yijing Wang CC: Benjamin Herrenschmidt CC: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/include/asm/machdep.h |2 +- arch/powerpc/kernel/pci-common.c | 63 +- arch/powerpc/platforms/pseries/pci.c |8 ++-- arch/powerpc/platforms/pseries/pseries.h |2 +- 4 files changed, 42 insertions(+), 33 deletions(-) diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h index 8e7f2a8..b811d12 100644 --- a/arch/powerpc/include/asm/machdep.h +++ b/arch/powerpc/include/asm/machdep.h @@ -129,7 +129,7 @@ struct machdep_calls { void(*pcibios_fixup)(void); int (*pci_probe_mode)(struct pci_bus *); void(*pci_irq_fixup)(struct pci_dev *dev); - int (*pcibios_set_root_bus_speed)(struct pci_host_bridge + void(*pcibios_set_root_bus_speed)(struct pci_host_bridge *bridge); /* To setup PHBs when using automatic OF platform driver for PCI */ diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 4401b6a..48a6cff 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -767,14 +767,33 @@ int pci_proc_domain(struct pci_bus *bus) return 1; } -int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) +static void pci_host_bridge_set_root_bus_speed( + struct pci_host_bridge *bridge) { if (ppc_md.pcibios_set_root_bus_speed) - return ppc_md.pcibios_set_root_bus_speed(bridge); - - return 0; + ppc_md.pcibios_set_root_bus_speed(bridge); } +static void pci_host_bridge_of_scan_bus(struct pci_host_bridge *host) +{ + int mode = PCI_PROBE_NORMAL; + struct pci_bus *bus = host->bus; + struct pci_controller *hose = dev_get_drvdata(&host->dev); + + /* Get probe mode and perform scan */ + if (hose->dn && ppc_md.pci_probe_mode) + mode = ppc_md.pci_probe_mode(bus); + + pr_debug("probe mode: %d\n", mode); + if (mode == PCI_PROBE_DEVTREE) + of_scan_bus(hose->dn, bus); + + if (mode == PCI_PROBE_NORMAL) { + pci_bus_update_busn_res_end(bus, 255); + hose->last_busno = pci_scan_child_bus(bus); + pci_bus_update_busn_res_end(bus, hose->last_busno); + } +} /* This header fixup will do the resource fixup for all devices as they are * probed, but not for bridge ranges */ @@ -1587,6 +1606,11 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus) return of_node_get(hose->dn); } +static struct pci_host_bridge_ops phb_ops = { + .phb_set_root_bus_speed = pci_host_bridge_set_root_bus_speed, + .phb_of_scan_bus = pci_host_bridge_of_scan_bus, +}; + /** * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus * @hose: Pointer to the PCI host controller instance structure @@ -1594,9 +1618,8 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus) void pcibios_scan_phb(struct pci_controller *hose) { LIST_HEAD(resources); - struct pci_bus *bus; + struct pci_host_bridge *host; struct device_node *node = hose->dn; - int mode; pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node)); @@ -1612,30 +1635,16 @@ void pcibios_scan_phb(struct pci_controller *hose) pci_add_resource(&resources, &hose->busn); /* Create an empty bus for the toplevel */ - bus = pci_create_root_bus(hose->parent, + host = pci_scan_root_bridge(hose->parent, PCI_DOMBUS(hose->global_number, hose->first_busno), - hose->ops, hose, &resources); - if (bus == NULL) { - pr_err("Failed to create bus for PCI domain %04x\n", + hose->ops, hose, &resources, &phb_ops); + if (host == NULL) { + pr_err("Failed to create host bridge for PCI domain %04x\n", hose->global_number); pci_free_resource_list(&resources); return; } - hose->bus = bus; - - /* Get probe mode and perform scan */ - mode = PCI_PROBE_NORMAL; - if (node && ppc_md.pci_probe_mode) - mode = ppc_md.pci_probe_mode(bus); - pr_debug("probe mode: %d\n", mode); - if (mode == PCI_PROBE_DEVTREE) - of_scan_bus(node, bus); - - if (mode == PCI_PROBE_NORMAL) { - pci_bus_update_busn_res_end(bus, 255); - hose->last_busno = pci_scan_child_bus(bus); - pci_bus_update_busn_res_end(bus, hose->last_busno); - } + hose->bus = host->bus; /* Platform gets a chance to do some global fixups before
[PATCH v3 17/30] PCI/powerpc: Rename pcibios_root_bridge_prepare()
Pcibios_root_bridge_prepare() in powerpc is used to set root bus speed. Rename it to pcibios_set_root_bus_speed() for better readability. Signed-off-by: Yijing Wang CC: Benjamin Herrenschmidt CC: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/include/asm/machdep.h |2 +- arch/powerpc/kernel/pci-common.c |6 +++--- arch/powerpc/platforms/pseries/pci.c |2 +- arch/powerpc/platforms/pseries/pseries.h |2 +- arch/powerpc/platforms/pseries/setup.c |2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h index c8175a3..8e7f2a8 100644 --- a/arch/powerpc/include/asm/machdep.h +++ b/arch/powerpc/include/asm/machdep.h @@ -129,7 +129,7 @@ struct machdep_calls { void(*pcibios_fixup)(void); int (*pci_probe_mode)(struct pci_bus *); void(*pci_irq_fixup)(struct pci_dev *dev); - int (*pcibios_root_bridge_prepare)(struct pci_host_bridge + int (*pcibios_set_root_bus_speed)(struct pci_host_bridge *bridge); /* To setup PHBs when using automatic OF platform driver for PCI */ diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 78cd41b..4401b6a 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -769,9 +769,9 @@ int pci_proc_domain(struct pci_bus *bus) int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) { - if (ppc_md.pcibios_root_bridge_prepare) - return ppc_md.pcibios_root_bridge_prepare(bridge); - + if (ppc_md.pcibios_set_root_bus_speed) + return ppc_md.pcibios_set_root_bus_speed(bridge); + return 0; } diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c index fe16a50..af685d6 100644 --- a/arch/powerpc/platforms/pseries/pci.c +++ b/arch/powerpc/platforms/pseries/pci.c @@ -110,7 +110,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev) DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, fixup_winbond_82c105); -int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) +int pseries_set_root_bus_speed(struct pci_host_bridge *bridge) { struct device_node *dn, *pdn; struct pci_bus *bus; diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h index 1796c54..5d0be3a 100644 --- a/arch/powerpc/platforms/pseries/pseries.h +++ b/arch/powerpc/platforms/pseries/pseries.h @@ -63,7 +63,7 @@ extern int dlpar_detach_node(struct device_node *); /* PCI root bridge prepare function override for pseries */ struct pci_host_bridge; -int pseries_root_bridge_prepare(struct pci_host_bridge *bridge); +int pseries_set_root_bus_speed(struct pci_host_bridge *bridge); unsigned long pseries_memory_block_size(void); diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index e445b67..b196c0d 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -496,7 +496,7 @@ static void __init pSeries_setup_arch(void) ppc_md.enable_pmcs = power4_enable_pmcs; } - ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare; + ppc_md.pcibios_set_root_bus_speed = pseries_set_root_bus_speed; if (firmware_has_feature(FW_FEATURE_SET_MODE)) { long rc; -- 1.7.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v3 07/30] PCI: Pass PCI domain number combined with root bus number
Now we could pass PCI domain combined with bus number in u32 argu. Because in arm/arm64, PCI domain number is assigned by pci_bus_assign_domain_nr(). So we leave pci_scan_root_bus() and pci_create_root_bus() in arm/arm64 unchanged. A new function pci_host_assign_domain_nr() will be introduced for arm/arm64 to assign domain number in later patch. Signed-off-by: Yijing Wang CC: Richard Henderson CC: Ivan Kokshaysky CC: Matt Turner CC: Tony Luck CC: Fenghua Yu CC: Michal Simek CC: Ralf Baechle CC: Benjamin Herrenschmidt CC: Paul Mackerras CC: Michael Ellerman CC: Sebastian Ott CC: Gerald Schaefer CC: "David S. Miller" CC: Chris Metcalf CC: Thomas Gleixner CC: Konrad Rzeszutek Wilk CC: linux-al...@vger.kernel.org CC: linux-ker...@vger.kernel.org CC: linux-i...@vger.kernel.org CC: linux-m...@linux-mips.org CC: linuxppc-dev@lists.ozlabs.org CC: linux-s...@vger.kernel.org CC: linux...@vger.kernel.org CC: sparcli...@vger.kernel.org CC: xen-de...@lists.xenproject.org --- arch/alpha/kernel/pci.c |5 +++-- arch/alpha/kernel/sys_nautilus.c |3 ++- arch/ia64/pci/pci.c |4 ++-- arch/ia64/sn/kernel/io_init.c|5 +++-- arch/microblaze/pci/pci-common.c |5 +++-- arch/mips/pci/pci.c |4 ++-- arch/powerpc/kernel/pci-common.c |5 +++-- arch/s390/pci/pci.c |5 +++-- arch/sh/drivers/pci/pci.c|5 +++-- arch/sparc/kernel/pci.c |5 +++-- arch/tile/kernel/pci.c |4 ++-- arch/tile/kernel/pci_gx.c|5 +++-- arch/x86/pci/acpi.c |6 +++--- arch/x86/pci/common.c|3 ++- drivers/pci/xen-pcifront.c |5 +++-- 15 files changed, 40 insertions(+), 29 deletions(-) diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c index 518b767..b053888 100644 --- a/arch/alpha/kernel/pci.c +++ b/arch/alpha/kernel/pci.c @@ -336,8 +336,9 @@ common_init_pci(void) pci_add_resource_offset(&resources, hose->mem_space, hose->mem_space->start); - bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops, - hose, &resources); + bus = pci_scan_root_bus(NULL, + PCI_DOMBUS(hose->index, next_busno), alpha_mv.pci_ops, + hose, &resources); if (bus) pci_bus_add_devices(bus); hose->bus = bus; diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c index 2c864bb..f7bfdf3 100644 --- a/arch/alpha/kernel/sys_nautilus.c +++ b/arch/alpha/kernel/sys_nautilus.c @@ -206,7 +206,8 @@ nautilus_init_pci(void) unsigned long memtop = max_low_pfn << PAGE_SHIFT; /* Scan our single hose. */ - bus = pci_scan_bus_legacy(0, alpha_mv.pci_ops, hose); + bus = pci_scan_bus_legacy(PCI_DOMBUS(hose->index, 0), + alpha_mv.pci_ops, hose); hose->bus = bus; pcibios_claim_one_bus(bus); diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 48cc657..e4cda61 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -465,8 +465,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) * should handle the case here, but it appears that IA64 hasn't * such quirk. So we just ignore the case now. */ - pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller, - &info->resources); + pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus), + &pci_root_ops, controller, &info->resources); if (!pbus) { pci_free_resource_list(&info->resources); __release_pci_root_info(info); diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c index 63b43a6..bcdc5b8 100644 --- a/arch/ia64/sn/kernel/io_init.c +++ b/arch/ia64/sn/kernel/io_init.c @@ -266,8 +266,9 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus) pci_add_resource_offset(&resources, &res[1], prom_bussoft_ptr->bs_legacy_mem); - bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller, - &resources); + bus = pci_scan_root_bus(NULL, + PCI_DOMBUS(controller->segment, busnum), + &pci_root_ops, controller, &resources); if (bus == NULL) { kfree(res); kfree(controller); diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index d8bbad9..5c332c0 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c @@ -1350,8 +1350,9 @@ static void pcibios_scan_phb(struct pci_controller *hose) pcibios_setup_phb_resources(hose, &resources); - bus = pci_scan_root_bus(hose->parent, hose->first_busno, -
[PATCH] ibmveth: Add function to enable live MAC address changes
Add a function that will enable changing the MAC address of an ibmveth interface while it is still running. Signed-off-by: Thomas Falcon --- drivers/net/ethernet/ibm/ibmveth.c | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 21978cc..6e44357 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c @@ -1327,6 +1327,24 @@ static unsigned long ibmveth_get_desired_dma(struct vio_dev *vdev) return ret; } +static int ibmveth_set_mac_addr(struct net_device *dev, void *p) +{ + struct ibmveth_adapter *adapter = netdev_priv(dev); + struct sockaddr *addr = p; + u64 mac_address; + int rc; + + if (!is_valid_ether_addr(addr->sa_data)) + return -EADDRNOTAVAIL; + + ether_addr_copy(dev->dev_addr, addr->sa_data); + + mac_address = ibmveth_encode_mac_addr(dev->dev_addr); + rc = h_change_logical_lan_mac(adapter->vdev->unit_address, mac_address); + + return rc; +} + static const struct net_device_ops ibmveth_netdev_ops = { .ndo_open = ibmveth_open, .ndo_stop = ibmveth_close, @@ -1337,7 +1355,7 @@ static const struct net_device_ops ibmveth_netdev_ops = { .ndo_fix_features = ibmveth_fix_features, .ndo_set_features = ibmveth_set_features, .ndo_validate_addr = eth_validate_addr, - .ndo_set_mac_address= eth_mac_addr, + .ndo_set_mac_address= ibmveth_set_mac_addr, #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller= ibmveth_poll_controller, #endif -- 1.9.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v3] Fix missing L2 cache size in /sys/devices/system/cpu
From: Dave Olson This problem appears to have been introduced in 2.6.29 by 93197a36a9c16a85fb24cf5a8639f7bf9af838a3. This caused lscpu to error out on e500v2 devices, and probably others error: cannot open /sys/devices/system/cpu/cpu0/cache/index2/size: No such file or directory Some embedded powerpc systems use cache-size in DTS for the unified L2 cache size, not d-cache-size, so we need to allow for both DTS names. Added a new CACHE_TYPE_UNIFIED_D cache_type_info structure to handle this. This patch is against git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git next branch. It is the same as the v2 patch, but against next, rather than master. I can rebase, if desired. Signed-off-by: Dave Olson --- arch/powerpc/kernel/cacheinfo.c | 38 ++ 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c index ae77b7e..860ed54 100644 --- a/arch/powerpc/kernel/cacheinfo.c +++ b/arch/powerpc/kernel/cacheinfo.c @@ -61,12 +61,22 @@ struct cache_type_info { }; /* These are used to index the cache_type_info array. */ -#define CACHE_TYPE_UNIFIED 0 -#define CACHE_TYPE_INSTRUCTION 1 -#define CACHE_TYPE_DATA2 +#define CACHE_TYPE_UNIFIED 0 /* cache-size, cache-block-size, etc. */ +#define CACHE_TYPE_UNIFIED_D 1 /* d-cache-size, d-cache-block-size, etc */ +#define CACHE_TYPE_INSTRUCTION 2 +#define CACHE_TYPE_DATA3 static const struct cache_type_info cache_type_info[] = { { + /* Embedded systems that use cache-size, cache-block-size, +* etc. for the Unified (typically L2) cache. */ + .name= "Unified", + .size_prop = "cache-size", + .line_size_props = { "cache-line-size", +"cache-block-size", }, + .nr_sets_prop= "cache-sets", + }, + { /* PowerPC Processor binding says the [di]-cache-* * must be equal on unified caches, so just use * d-cache properties. */ @@ -293,7 +303,8 @@ static struct cache *cache_find_first_sibling(struct cache *cache) { struct cache *iter; - if (cache->type == CACHE_TYPE_UNIFIED) + if (cache->type == CACHE_TYPE_UNIFIED || + cache->type == CACHE_TYPE_UNIFIED_D) return cache; list_for_each_entry(iter, &cache_list, list) @@ -324,14 +335,33 @@ static bool cache_node_is_unified(const struct device_node *np) return of_get_property(np, "cache-unified", NULL); } +/* + * Handle unified caches that have two different types of tags. Most embedded + * use cache-size, etc. for the unified cache size, but open firmware systems + * use d-cache-size, etc. Since they all appear to be consistent, check on + * initialization for which type we are, and use the appropriate structure. + */ static struct cache *cache_do_one_devnode_unified(struct device_node *node, int level) { struct cache *cache; + int ucache; pr_debug("creating L%d ucache for %s\n", level, node->full_name); cache = new_cache(CACHE_TYPE_UNIFIED, level, node); + if (of_get_property(node, + cache_type_info[CACHE_TYPE_UNIFIED_D].size_prop, NULL)) { + ucache = CACHE_TYPE_UNIFIED_D; + } else { + ucache = CACHE_TYPE_UNIFIED; /* assume embedded */ + if (of_get_property(node, + cache_type_info[CACHE_TYPE_UNIFIED].size_prop, NULL) == + NULL) + printk(KERN_WARNING "Unified cache property missing\n"); + } + + cache = new_cache(ucache, level, node); return cache; } -- 1.7.10.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] clk: ppc-corenet: Add support for the FMD clock
On Tue, 2015-01-20 at 14:03 +0200, Igal.Liberman wrote: > +static u8 get_fm_clk_parent(struct clk_hw *hw) > +{ > + struct ccsr_guts __iomem *guts_regs = NULL; > + struct device_node *guts; > + uint32_t reg = 0; > + int clk_src = 0; > + int fm_clk_select = -EINVAL; > + int fm_id = 0; > + > + guts = of_find_matching_node(NULL, guts_device_ids); > + if (!guts) { > + pr_err("could not find GUTS node\n"); > + return -EINVAL; > + } Error message lacks context (here and elsewhere). Why are you going this on demand rather than in an init function (specifically, a CLK_OF_DECLARE)? You should not register this clock handler in the first place if the hardware doesn't exist. -EINVAL doesn't fit in u8. Neither would the more appropriate -ENODEV. > + guts_regs = of_iomap(guts, 0); > + of_node_put(guts); > + if (!guts_regs) { > + pr_err("ioremap of GUTS node failed\n"); > + return -EINVAL; > + } > + > + if (!strcmp(__clk_get_name(hw->clk), "fm1-clk")) > + fm_id = 1; > + > + /* The FM clock provider is SoC dependent and it's determened by the determined > + * reset configuration word (RCW). We need to map the RCW options to > + * the order of the providers in the device tree. > + * This code makes assumptions about the clock provider order: > + * In the P family: > + * 0 - platform clock/2 > + * 1 - PLLx /2 > + * 2 - PLLx /4 (if possible). > + * In B/T family: > + * The same order in which the clock providers are described in > + * the Reference Manual, starting from 0. This belongs in a device tree binding document and should not incorporate portions of the reference manual by reference -- what if a new version of the reference manual changes the order in which clock providers are described? Or do you mean that the order corresponds to a register value? > + * > + * In a case of only one possible provider, the index is 0. > + */ > + > + if (of_device_is_compatible(guts, "fsl,p1023-guts") || > + of_device_is_compatible(guts, "fsl,t1040-device-config")) > + /* P1023 and T1040 have only one optional clock source */ > + fm_clk_select = 0; > + else if (of_device_is_compatible(guts, "fsl,p2041-device-config") || > + of_device_is_compatible(guts, "fsl,p3041-device-config") || > + of_device_is_compatible(guts, "fsl,p4080-device-config")) { > + /* Read RCW*/ /* Read RCW */ > @@ -352,3 +601,4 @@ CLK_OF_DECLARE(qoriq_core_mux_1, > "fsl,qoriq-core-mux-1.0", core_mux_init); > CLK_OF_DECLARE(qoriq_core_mux_2, "fsl,qoriq-core-mux-2.0", core_mux_init); > CLK_OF_DECLARE(qoriq_pltfrm_pll_1, "fsl,qoriq-platform-pll-1.0", > pltfrm_pll_init); > CLK_OF_DECLARE(qoriq_pltfrm_pll_2, "fsl,qoriq-platform-pll-2.0", > pltfrm_pll_init); > +CLK_OF_DECLARE(qoriq_fm_mux, "fsl,fman-clk-mux", fm_mux_init); Where is the binding for this node? -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc: Export __spin_yield
Export __spin_yield so that the arch_spin_unlock() function can be invoked from a module. This will be required for modules where we want to take a lock that is also is acquired in hypervisor real mode. Because we want to avoid running any lockdep code (which may not be safe in real mode), this lock needs to be an arch_spinlock_t instead of a normal spinlock. Signed-off-by: Suresh Warrier --- Replaced export to EXPORT_SYMBOL_GPL Updated commit log to explain what kind of modules will need to use the arch_spin_unlock() function arch/powerpc/lib/locks.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c index bb7cfec..f31bcee 100644 --- a/arch/powerpc/lib/locks.c +++ b/arch/powerpc/lib/locks.c @@ -41,6 +41,7 @@ void __spin_yield(arch_spinlock_t *lock) plpar_hcall_norets(H_CONFER, get_hard_smp_processor_id(holder_cpu), yield_count); } +EXPORT_SYMBOL_GPL(__spin_yield); /* * Waiting for a read lock or a write lock on a rwlock... -- 1.8.3.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/smp: Wait until secondaries are active & online
Michael Ellerman writes: > Anton has a busy ppc64le KVM box where guests sometimes hit the infamous > "kernel BUG at kernel/smpboot.c:134!" issue during boot: > > BUG_ON(td->cpu != smp_processor_id()); > > Basically a per CPU hotplug thread scheduled on the wrong CPU. The oops > output confirms it: > > CPU: 0 > Comm: watchdog/130 > > The problem is that we aren't ensuring the CPU active bit is set for the > secondary before allowing the master to continue on. The master unparks > the secondary CPU's kthreads and the scheduler looks for a CPU to run > on. It calls select_task_rq() and realises the suggested CPU is not in > the cpus_allowed mask. It then ends up in select_fallback_rq(), and > since the active bit isnt't set we choose some other CPU to run on. > > This seems to have been introduced by 6acbfb96976f "sched: Fix hotplug > vs. set_cpus_allowed_ptr()", which changed from setting active before > online to setting active after online. However that was in turn fixing a > bug where other code assumed an active CPU was also online, so we can't > just revert that fix. > > The simplest fix is just to spin waiting for both active & online to be > set. We already have a barrier prior to set_cpu_online() (which also > sets active), to ensure all other setup is completed before online & > active are set. > > Fixes: 6acbfb96976f ("sched: Fix hotplug vs. set_cpus_allowed_ptr()") > Signed-off-by: Michael Ellerman > Signed-off-by: Anton Blanchard By building a gcov enabled skiboot, which makes OPAL_START_CPU a whole bunch slower (because gcov), I could really *really* reliably reproduce this. With this patch, I cannot. Tested-by: Stewart Smith ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 3/3] powerpc/oprofile: reduce mmap_sem hold for exe_file
In the future mm->exe_file will be done without mmap_sem serialization, thus isolate and reorganize the related code to make the transition easier. Good users will, make use of the more standard get_mm_exe_file(), requiring only holding the mmap_sem to read the value, and relying on reference counting to make sure that the exe file won't dissappear underneath us while getting the dcookie. Cc: Arnd Bergmann Cc: Robert Richter Cc: linuxppc-dev@lists.ozlabs.org Cc: cbe-oss-...@lists.ozlabs.org Cc: oprofile-l...@lists.sourceforge.net Signed-off-by: Davidlohr Bueso --- Completely untested. arch/powerpc/oprofile/cell/spu_task_sync.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/oprofile/cell/spu_task_sync.c b/arch/powerpc/oprofile/cell/spu_task_sync.c index 1c27831..ed7b097 100644 --- a/arch/powerpc/oprofile/cell/spu_task_sync.c +++ b/arch/powerpc/oprofile/cell/spu_task_sync.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -322,18 +323,20 @@ get_exec_dcookie_and_offset(struct spu *spu, unsigned int *offsetp, unsigned long app_cookie = 0; unsigned int my_offset = 0; struct vm_area_struct *vma; + struct file *exe_file; struct mm_struct *mm = spu->mm; if (!mm) goto out; - down_read(&mm->mmap_sem); - - if (mm->exe_file) { - app_cookie = fast_get_dcookie(&mm->exe_file->f_path); - pr_debug("got dcookie for %pD\n", mm->exe_file); + exe_file = get_mm_exe_file(mm); + if (exe_file) { + app_cookie = fast_get_dcookie(&exe_file->f_path); + pr_debug("got dcookie for %pD\n", exe_file); + fput(exe_file); } + down_read(&mm->mmap_sem); for (vma = mm->mmap; vma; vma = vma->vm_next) { if (vma->vm_start > spu_ref || vma->vm_end <= spu_ref) continue; -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/powernv: check OPAL_REGISTER_DUMP_REGION calls exist
Cedric Le Goater writes: > On 02/25/2015 10:16 PM, Stewart Smith wrote: >> Cédric Le Goater writes: >>> On Open Power systems, such call fails in OPAL : >>> >>>OPAL: Called with bad token 101 ! >>> >>> The check on the OPAL_UNREGISTER_DUMP_REGION call is added for >>> symmetry. I did not see any errors for it. >> >> I've already put in a patch to squash this: >> Message-Id: >> <1423718729-17992-2-git-send-email-stew...@linux.vnet.ibm.com> >> >> Just waiting on mpe to merge :) > > ok fine, I missed it :) > > I am also tempted to fix OPAL_READ_TPO but the proper way to do this > would be to move the lowlevel OPAL code from drivers/rtc/rtc-opal.c to > a new file under arch/powerpc/platforms/powernv/. How does that sound ? shouldn't we be detecting things from DT and acting on it? From a quick glance perhaps we're not quite doing the checks in all the right places? ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/smp: Wait until secondaries are active & online
Michael Ellerman writes: > Anton has a busy ppc64le KVM box where guests sometimes hit the infamous > "kernel BUG at kernel/smpboot.c:134!" issue during boot: > > BUG_ON(td->cpu != smp_processor_id()); > > Basically a per CPU hotplug thread scheduled on the wrong CPU. The oops > output confirms it: > > CPU: 0 > Comm: watchdog/130 Has anyone seen this on powernv before? I seem to be able to very reliably get such crashes with my (experimental) gcov enabled skiboot on P7 (and P8, but I've had more time on P7 than P8). Hoping to try the patch later today. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/powernv: check OPAL_REGISTER_DUMP_REGION calls exist
On 02/25/2015 10:16 PM, Stewart Smith wrote: > Cédric Le Goater writes: >> On Open Power systems, such call fails in OPAL : >> >>OPAL: Called with bad token 101 ! >> >> The check on the OPAL_UNREGISTER_DUMP_REGION call is added for >> symmetry. I did not see any errors for it. > > I've already put in a patch to squash this: > Message-Id: > <1423718729-17992-2-git-send-email-stew...@linux.vnet.ibm.com> > > Just waiting on mpe to merge :) ok fine, I missed it :) I am also tempted to fix OPAL_READ_TPO but the proper way to do this would be to move the lowlevel OPAL code from drivers/rtc/rtc-opal.c to a new file under arch/powerpc/platforms/powernv/. How does that sound ? Cheers, C. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/powernv: check OPAL_REGISTER_DUMP_REGION calls exist
Cédric Le Goater writes: > On Open Power systems, such call fails in OPAL : > >OPAL: Called with bad token 101 ! > > The check on the OPAL_UNREGISTER_DUMP_REGION call is added for > symmetry. I did not see any errors for it. I've already put in a patch to squash this: Message-Id: <1423718729-17992-2-git-send-email-stew...@linux.vnet.ibm.com> Just waiting on mpe to merge :) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/1]: thermal driver therm_adt746.c
On Wed, 2015-02-25 at 12:24 +0100, Thomas Haschka wrote: > Hi, > > Thanks for your comments. Here's a new patch taking them into account. Thanks. Note that this legalese boilerplate is not useful, the Signed-off-by: is enough to indicate your acceptance of the Linux licencing terms. However I do need a properly formatted changeset comment. Cheers, Ben. > Cheers, > > > (a) The contribution was created in whole or in part by me and I > have the right to submit it under the GPL v2 > (Gnu Public License Version 2) > > (b) The contribution is based upon previous work that, to the best > of my knowledge, is covered under an appropriate open source > license and I have the right under that license to submit that > work with modifications, whether created in whole or in part > by me, under the same open source license (unless I am > permitted to submit under a different license), as indicated > in the file; or > > (c) I understand and agree that this project and the contribution > are public and that a record of the contribution (including all > personal information I submit with it, including my sign-off) is > maintained indefinitely and may be redistributed consistent with > this project or the open source license(s) involved. > > Signed-off-by: Thomas Haschka > > --- linux/drivers/macintosh/therm_adt746x.c.orig 2015-02-25 > 11:26:43.16400 +0100 > +++ linux/drivers/macintosh/therm_adt746x.c 2015-02-25 11:40:54.24000 > +0100 > @@ -1,7 +1,8 @@ > /* > * Device driver for the i2c thermostat found on the iBook G4, Albook G4 > * > - * Copyright (C) 2003, 2004 Colin Leroy, Rasmus Rohde, Benjamin Herrenschmidt > + * Copyright (C) 2003, 2004, 2015 > + * Colin Leroy, Rasmus Rohde, Benjamin Herrenschmidt, Thomas Haschka > * > * Documentation from 115254175ADT7467_pra.pdf and 3686221171167ADT7460_b.pdf > * http://www.onsemi.com/PowerSolutions/product.do?id=ADT7467 > @@ -45,8 +46,10 @@ static u8 REM_CONTROL[2] = {0x00, 0x40}; > static u8 FAN_SPEED[2] = {0x28, 0x2a}; > static u8 FAN_SPD_SET[2] = {0x30, 0x31}; > > -static u8 default_limits_local[3] = {70, 50, 70};/* local, sensor1, > sensor2 */ > -static u8 default_limits_chip[3] = {80, 65, 80};/* local, sensor1, > sensor2 */ > +/* Local sensor is down to 45 in order to assure stable harddrive and > + * components temperature on single fan machines */ > +static u8 default_limits_local[3] = {45, 50, 70}; /* local, sensor1, sensor2 > */ > +static u8 default_limits_chip[3] = {80, 65, 80}; /* local, sensor1, sensor2 > */ > static const char *sensor_location[3] = { "?", "?", "?" }; > > static int limit_adjust; > @@ -223,7 +226,7 @@ static void display_stats(struct thermos > } > #endif > > -static void update_fans_speed (struct thermostat *th) > +static void update_fans_speed_multifan (struct thermostat *th) > { > int lastvar = 0; /* last variation, for iBook */ > int i = 0; > @@ -278,6 +281,83 @@ static void update_fans_speed (struct th > } > } > > +static void update_fans_speed_singlefan (struct thermostat *th) { > + > + /* Single Fan Laptops i.e. 12 inch Powerbook, Ibook etc. > + * Necessites the readout of all three thermal sensors > + * in order to avoid the harddisk and other components to overheat > + * in the case of cold CPU. */ > + > + int lastvar = 0; /* last variation, for iBook */ > + int i = 0; > + int var = 0; > + int var_sensor[3]; > + int started = 0; > + int fan_number = 0; > + for (i = 0; i < 3; i++) { > + var_sensor[i] = th->temps[i] - th->limits[i]; > + } > + var = var_sensor[0]; > + for (i = 1; i < 3; i++) { > + if (var_sensor[i] > var) { > + var = var_sensor[i]; > + } > + } > + if (var > -1) { > + int step = (255 - fan_speed) / 7; > + int new_speed = 0; > + /* hysteresis : change fan speed only if variation is > + * more than two degrees */ > + if (abs(var - th->last_var[fan_number]) > 2) { > + > + started = 1; > + new_speed = fan_speed + ((var-1)*step); > + > + if (new_speed < fan_speed) > + new_speed = fan_speed; > + if (new_speed > 255) > + new_speed = 255; > + > + if (verbose) > + printk(KERN_DEBUG "adt746x:" > +" Setting fans speed to %d " > +"(limit exceeded by %d on %s)\n", > +new_speed, var, > +sensor_location[fan_number+1]); > + write_both_fan_speed(th, new_spee
Re: Problems with Kernels 3.17-rc1 and onwards on Acube Sam460 AMCC 460ex board
Verified that the problems with the radeon: ring 0 test failed error go back to at least Kernel 3.0.1 On 2/24/2015 4:26 PM, Julian Margetson wrote: Thanks after skipping several times : git bisect skip There are only 'skip'ped commits left to test. The first bad commit could be any of: b486e0e6d599b9ca8667fb9a7d49b7383ee963c7 eab3bbeffd152125ae0f90863b8e9bc8eef49423 960cd9d4fef6dd9e235c0e5c0d4ed027f8a48025 f02ad907cd9e7fe3a6405d2d005840912f1ed258 6a425c2a9b37ca3d2c37e3c1cdf973dba53eaa79 ee0a89cf3c2c550e6d877dda21dd2947afb90cb6 92890583627ee2a0518e55b063fcff86826fef96 95d6eb3b134e1826ed04cc92b224d93de13e281f 9469244d869623e8b54d9f3d4d00737e377af273 We cannot bisect more! On 2/24/2015 3:14 PM, Gerhard Pircher wrote: Am 2015-02-24 um 12:08 schrieb Julian Margetson: Problems with the Gib bisect Kernel wont compile after 10th bisect . You can try "git bisect skip" to select another commit for testing. Hopefully that one compiles fine then. Gerhard drivers/built-in.o: In function `drm_mode_atomic_ioctl': (.text+0x865dc): undefined reference to `__get_user_bad' make: *** [vmlinux] Error 1 root@julian-VirtualBox:/usr/src/linux# git bisect log git bisect start # bad: [c517d838eb7d07bbe9507871fab3931deccff539] Linux 4.0-rc1 git bisect bad c517d838eb7d07bbe9507871fab3931deccff539 # good: [bfa76d49576599a4b9f9b7a71f23d73d6dcff735] Linux 3.19 git bisect good bfa76d49576599a4b9f9b7a71f23d73d6dcff735 # good: [02f1f2170d2831b3233e91091c60a66622f29e82] kernel.h: remove ancient __FUNCTION__ hack git bisect good 02f1f2170d2831b3233e91091c60a66622f29e82 # bad: [796e1c55717e9a6ff5c81b12289ffa1ffd919b6f] Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux git bisect bad 796e1c55717e9a6ff5c81b12289ffa1ffd919b6f # good: [9682ec9692e5ac11c6caebd079324e727b19e7ce] Merge tag 'driver-core-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core git bisect good 9682ec9692e5ac11c6caebd079324e727b19e7ce # good: [a9724125ad014decf008d782e60447c811391326] Merge tag 'tty-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty git bisect good a9724125ad014decf008d782e60447c811391326 # good: [f43dff0ee00a259f524ce17ba4f8030553c66590] Merge tag 'drm-amdkfd-next-fixes-2015-01-25' of git://people.freedesktop.org/~gabbayo/linux into drm-next git bisect good f43dff0ee00a259f524ce17ba4f8030553c66590 # bad: [cffe1e89dc9bf541a39d9287ced7c5addff07084] drm: sti: HDMI add audio infoframe git bisect bad cffe1e89dc9bf541a39d9287ced7c5addff07084 # good: [2f5b4ef15c60bc5292a3f006c018acb3da53737b] Merge tag 'drm/tegra/for-3.20-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next git bisect good 2f5b4ef15c60bc5292a3f006c018acb3da53737b # bad: [86588ce80ccd714793e9ba4140d7ae214229] drm/udl: optimize udl_compress_hline16 (v2) git bisect bad 86588ce80ccd714793e9ba4140d7ae214229 # bad: [d47df63393ed81977e0f6435988d9cbd70c867f7] drm/panel: simple: Add AVIC TM070DDH03 panel support git bisect bad d47df63393ed81977e0f6435988d9cbd70c867f7 # bad: [9469244d869623e8b54d9f3d4d00737e377af273] drm/atomic: Fix potential use of state after free git bisect bad 9469244d869623e8b54d9f3d4d00737e377af273 root@julian-VirtualBox:/usr/src/linux# On 02/24/2015, you wrote: On Fri, 2015-02-20 at 15:25 -0400, Julian Margetson wrote: On 2/18/2015 11:25 PM, Julian Margetson wrote: re PPC4XX PCI(E) MSI support. https://lists.ozlabs.org/pipermail/linuxppc-dev/2010-November/087273.html Hmm, I think all those comments were addressed before it was merged. I tried to get a 4xx board going here last week, but it doesn't seem happy. I can get a bit of uboot but then it hangs, might be overheating. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: Problems with Kernels 3.17-rc1 and onwards on Acube Sam460 AMCC 460ex board
Problem also seems to exist with P1022 based board as well . https://community.freescale.com/thread/339022 On 2/25/2015 9:26 AM, Julian Margetson wrote: Verified that the problems with the radeon: ring 0 test failed error go back to at least Kernel 3.0.1 On 2/24/2015 4:26 PM, Julian Margetson wrote: Thanks after skipping several times : git bisect skip There are only 'skip'ped commits left to test. The first bad commit could be any of: b486e0e6d599b9ca8667fb9a7d49b7383ee963c7 eab3bbeffd152125ae0f90863b8e9bc8eef49423 960cd9d4fef6dd9e235c0e5c0d4ed027f8a48025 f02ad907cd9e7fe3a6405d2d005840912f1ed258 6a425c2a9b37ca3d2c37e3c1cdf973dba53eaa79 ee0a89cf3c2c550e6d877dda21dd2947afb90cb6 92890583627ee2a0518e55b063fcff86826fef96 95d6eb3b134e1826ed04cc92b224d93de13e281f 9469244d869623e8b54d9f3d4d00737e377af273 We cannot bisect more! On 2/24/2015 3:14 PM, Gerhard Pircher wrote: Am 2015-02-24 um 12:08 schrieb Julian Margetson: Problems with the Gib bisect Kernel wont compile after 10th bisect . You can try "git bisect skip" to select another commit for testing. Hopefully that one compiles fine then. Gerhard drivers/built-in.o: In function `drm_mode_atomic_ioctl': (.text+0x865dc): undefined reference to `__get_user_bad' make: *** [vmlinux] Error 1 root@julian-VirtualBox:/usr/src/linux# git bisect log git bisect start # bad: [c517d838eb7d07bbe9507871fab3931deccff539] Linux 4.0-rc1 git bisect bad c517d838eb7d07bbe9507871fab3931deccff539 # good: [bfa76d49576599a4b9f9b7a71f23d73d6dcff735] Linux 3.19 git bisect good bfa76d49576599a4b9f9b7a71f23d73d6dcff735 # good: [02f1f2170d2831b3233e91091c60a66622f29e82] kernel.h: remove ancient __FUNCTION__ hack git bisect good 02f1f2170d2831b3233e91091c60a66622f29e82 # bad: [796e1c55717e9a6ff5c81b12289ffa1ffd919b6f] Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux git bisect bad 796e1c55717e9a6ff5c81b12289ffa1ffd919b6f # good: [9682ec9692e5ac11c6caebd079324e727b19e7ce] Merge tag 'driver-core-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core git bisect good 9682ec9692e5ac11c6caebd079324e727b19e7ce # good: [a9724125ad014decf008d782e60447c811391326] Merge tag 'tty-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty git bisect good a9724125ad014decf008d782e60447c811391326 # good: [f43dff0ee00a259f524ce17ba4f8030553c66590] Merge tag 'drm-amdkfd-next-fixes-2015-01-25' of git://people.freedesktop.org/~gabbayo/linux into drm-next git bisect good f43dff0ee00a259f524ce17ba4f8030553c66590 # bad: [cffe1e89dc9bf541a39d9287ced7c5addff07084] drm: sti: HDMI add audio infoframe git bisect bad cffe1e89dc9bf541a39d9287ced7c5addff07084 # good: [2f5b4ef15c60bc5292a3f006c018acb3da53737b] Merge tag 'drm/tegra/for-3.20-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next git bisect good 2f5b4ef15c60bc5292a3f006c018acb3da53737b # bad: [86588ce80ccd714793e9ba4140d7ae214229] drm/udl: optimize udl_compress_hline16 (v2) git bisect bad 86588ce80ccd714793e9ba4140d7ae214229 # bad: [d47df63393ed81977e0f6435988d9cbd70c867f7] drm/panel: simple: Add AVIC TM070DDH03 panel support git bisect bad d47df63393ed81977e0f6435988d9cbd70c867f7 # bad: [9469244d869623e8b54d9f3d4d00737e377af273] drm/atomic: Fix potential use of state after free git bisect bad 9469244d869623e8b54d9f3d4d00737e377af273 root@julian-VirtualBox:/usr/src/linux# On 02/24/2015, you wrote: On Fri, 2015-02-20 at 15:25 -0400, Julian Margetson wrote: On 2/18/2015 11:25 PM, Julian Margetson wrote: re PPC4XX PCI(E) MSI support. https://lists.ozlabs.org/pipermail/linuxppc-dev/2010-November/087273.html Hmm, I think all those comments were addressed before it was merged. I tried to get a 4xx board going here last week, but it doesn't seem happy. I can get a bit of uboot but then it hangs, might be overheating. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/powernv: check OPAL_REGISTER_DUMP_REGION calls exist
On Open Power systems, such call fails in OPAL : OPAL: Called with bad token 101 ! The check on the OPAL_UNREGISTER_DUMP_REGION call is added for symmetry. I did not see any errors for it. Signed-off-by: Cédric Le Goater --- arch/powerpc/platforms/powernv/opal.c |8 1 file changed, 8 insertions(+) Index: linux.git/arch/powerpc/platforms/powernv/opal.c === --- linux.git.orig/arch/powerpc/platforms/powernv/opal.c +++ linux.git/arch/powerpc/platforms/powernv/opal.c @@ -665,6 +665,11 @@ static void __init opal_dump_region_init uint64_t size; int rc; + if (!opal_check_token(OPAL_REGISTER_DUMP_REGION)) { + pr_warn("Firmware doesn't support dump region buffers\n"); + return; + } + /* Register kernel log buffer */ addr = log_buf_addr_get(); size = log_buf_len_get(); @@ -794,6 +799,9 @@ void opal_shutdown(void) mdelay(10); } + if (!opal_check_token(OPAL_UNREGISTER_DUMP_REGION)) + return; + /* Unregister memory dump region */ opal_unregister_dump_region(OPAL_DUMP_REGION_LOG_BUF); } ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC PATCH 1/3] powerpc/powernv: Check OPAL sensor calls exist
On 02/24/2015 05:54 AM, Michael Ellerman wrote: > On Fri, 2015-02-20 at 16:07 +0100, Cédric Le Goater wrote: >> Signed-off-by: Cédric Le Goater >> --- >> arch/powerpc/platforms/powernv/opal-sensor.c |3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/arch/powerpc/platforms/powernv/opal-sensor.c >> b/arch/powerpc/platforms/powernv/opal-sensor.c >> index 4ab67ef7abc9..544292f2020f 100644 >> --- a/arch/powerpc/platforms/powernv/opal-sensor.c >> +++ b/arch/powerpc/platforms/powernv/opal-sensor.c >> @@ -72,6 +72,9 @@ static __init int opal_sensor_init(void) >> struct platform_device *pdev; >> struct device_node *sensor; >> >> +if (!opal_check_token(OPAL_SENSOR_READ)) >> +return -ENODEV; >> + >> sensor = of_find_node_by_path("/ibm,opal/sensors"); >> if (!sensor) { >> pr_err("Opal node 'sensors' not found\n"); > > Are you actually seeing this in practice? No. Not this one. I have seen others though. I will send you patches. > It's a bit annoying that we have to check for the token, and then also check > the device tree. It would be nice if one implied the presence of the other. Should we expose the OPAL call token in the device tree ? Cheers, C. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 0/2] powerpc/kvm: Enable running guests on RT Linux
* Scott Wood | 2015-02-23 17:27:31 [-0600]: >This isn't a host PIC driver. It's guest PIC emulation, some of which >is indeed not suitable for a rawlock (in particular, openpic_update_irq >which loops on the number of vcpus, with a loop body that calls >IRQ_check() which loops over all pending IRQs). The vcpu limits are a >temporary bandaid to avoid the worst latencies, but I'm still skeptical >about this being upstream material. Okay. >-Scott Sebastian ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC V2 11/12] i2c: pmcmsp: make use of the new infrastructure for quirks
From: Wolfram Sang Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-pmcmsp.c | 42 - 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/drivers/i2c/busses/i2c-pmcmsp.c b/drivers/i2c/busses/i2c-pmcmsp.c index d37d9db6681e7b..2c40edbf6224eb 100644 --- a/drivers/i2c/busses/i2c-pmcmsp.c +++ b/drivers/i2c/busses/i2c-pmcmsp.c @@ -456,14 +456,6 @@ static enum pmcmsptwi_xfer_result pmcmsptwi_xfer_cmd( return -EINVAL; } - if (cmd->read_len > MSP_MAX_BYTES_PER_RW || - cmd->write_len > MSP_MAX_BYTES_PER_RW) { - dev_err(&pmcmsptwi_adapter.dev, - "%s: Cannot transfer more than %d bytes\n", - __func__, MSP_MAX_BYTES_PER_RW); - return -EINVAL; - } - mutex_lock(&data->lock); dev_dbg(&pmcmsptwi_adapter.dev, "Setting address to 0x%04x\n", cmd->addr); @@ -520,25 +512,14 @@ static int pmcmsptwi_master_xfer(struct i2c_adapter *adap, struct pmcmsptwi_cfg oldcfg, newcfg; int ret; - if (num > 2) { - dev_dbg(&adap->dev, "%d messages unsupported\n", num); - return -EINVAL; - } else if (num == 2) { - /* Check for a dual write-then-read command */ + if (num == 2) { struct i2c_msg *nextmsg = msg + 1; - if (!(msg->flags & I2C_M_RD) && - (nextmsg->flags & I2C_M_RD) && - msg->addr == nextmsg->addr) { - cmd.type = MSP_TWI_CMD_WRITE_READ; - cmd.write_len = msg->len; - cmd.write_data = msg->buf; - cmd.read_len = nextmsg->len; - cmd.read_data = nextmsg->buf; - } else { - dev_dbg(&adap->dev, - "Non write-read dual messages unsupported\n"); - return -EINVAL; - } + + cmd.type = MSP_TWI_CMD_WRITE_READ; + cmd.write_len = msg->len; + cmd.write_data = msg->buf; + cmd.read_len = nextmsg->len; + cmd.read_data = nextmsg->buf; } else if (msg->flags & I2C_M_RD) { cmd.type = MSP_TWI_CMD_READ; cmd.read_len = msg->len; @@ -598,6 +579,14 @@ static u32 pmcmsptwi_i2c_func(struct i2c_adapter *adapter) I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_PROC_CALL; } +static struct i2c_adapter_quirks pmcmsptwi_i2c_quirks = { + .flags = I2C_AQ_COMB_WRITE_THEN_READ, + .max_write_len = MSP_MAX_BYTES_PER_RW, + .max_read_len = MSP_MAX_BYTES_PER_RW, + .max_comb_1st_msg_len = MSP_MAX_BYTES_PER_RW, + .max_comb_2nd_msg_len = MSP_MAX_BYTES_PER_RW, +}; + /* -- Initialization -- */ static struct i2c_algorithm pmcmsptwi_algo = { @@ -609,6 +598,7 @@ static struct i2c_adapter pmcmsptwi_adapter = { .owner = THIS_MODULE, .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, .algo = &pmcmsptwi_algo, + .quirks = &pmcmsptwi_i2c_quirks, .name = DRV_NAME, }; -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC V2 12/12] i2c: bcm-iproc: make use of the new infrastructure for quirks
From: Wolfram Sang Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-bcm-iproc.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index d3c89157b33774..f9f2c2082151e2 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -160,14 +160,6 @@ static int bcm_iproc_i2c_xfer_single_msg(struct bcm_iproc_i2c_dev *iproc_i2c, u32 val; unsigned long time_left = msecs_to_jiffies(I2C_TIMEOUT_MESC); - /* need to reserve one byte in the FIFO for the slave address */ - if (msg->len > M_TX_RX_FIFO_SIZE - 1) { - dev_err(iproc_i2c->device, - "only support data length up to %u bytes\n", - M_TX_RX_FIFO_SIZE - 1); - return -EOPNOTSUPP; - } - /* check if bus is busy */ if (!!(readl(iproc_i2c->base + M_CMD_OFFSET) & BIT(M_CMD_START_BUSY_SHIFT))) { @@ -287,6 +279,12 @@ static const struct i2c_algorithm bcm_iproc_algo = { .functionality = bcm_iproc_i2c_functionality, }; +static struct i2c_adapter_quirks bcm_iproc_i2c_quirks = { + /* need to reserve one byte in the FIFO for the slave address */ + .max_read_len = M_TX_RX_FIFO_SIZE - 1, + .max_write_len = M_TX_RX_FIFO_SIZE - 1, +}; + static int bcm_iproc_i2c_cfg_speed(struct bcm_iproc_i2c_dev *iproc_i2c) { unsigned int bus_speed; @@ -413,6 +411,7 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev) i2c_set_adapdata(adap, iproc_i2c); strlcpy(adap->name, "Broadcom iProc I2C adapter", sizeof(adap->name)); adap->algo = &bcm_iproc_algo; + adap->quirks = &bcm_iproc_i2c_quirks; adap->dev.parent = &pdev->dev; adap->dev.of_node = pdev->dev.of_node; -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC V2 08/12] i2c: dln2: make use of the new infrastructure for quirks
From: Wolfram Sang Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-dln2.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-dln2.c b/drivers/i2c/busses/i2c-dln2.c index b3fb86af4cbb14..b6f9ba7eb17564 100644 --- a/drivers/i2c/busses/i2c-dln2.c +++ b/drivers/i2c/busses/i2c-dln2.c @@ -144,7 +144,6 @@ static int dln2_i2c_xfer(struct i2c_adapter *adapter, { struct dln2_i2c *dln2 = i2c_get_adapdata(adapter); struct i2c_msg *pmsg; - struct device *dev = &dln2->adapter.dev; int i; for (i = 0; i < num; i++) { @@ -152,11 +151,6 @@ static int dln2_i2c_xfer(struct i2c_adapter *adapter, pmsg = &msgs[i]; - if (pmsg->len > DLN2_I2C_MAX_XFER_SIZE) { - dev_warn(dev, "maximum transfer size exceeded\n"); - return -EOPNOTSUPP; - } - if (pmsg->flags & I2C_M_RD) { ret = dln2_i2c_read(dln2, pmsg->addr, pmsg->buf, pmsg->len); @@ -187,6 +181,11 @@ static const struct i2c_algorithm dln2_i2c_usb_algorithm = { .functionality = dln2_i2c_func, }; +static struct i2c_adapter_quirks dln2_i2c_quirks = { + .max_read_len = DLN2_I2C_MAX_XFER_SIZE, + .max_write_len = DLN2_I2C_MAX_XFER_SIZE, +}; + static int dln2_i2c_probe(struct platform_device *pdev) { int ret; @@ -209,6 +208,7 @@ static int dln2_i2c_probe(struct platform_device *pdev) dln2->adapter.owner = THIS_MODULE; dln2->adapter.class = I2C_CLASS_HWMON; dln2->adapter.algo = &dln2_i2c_usb_algorithm; + dln2->adapter.quirks = &dln2_i2c_quirks; dln2->adapter.dev.parent = dev; i2c_set_adapdata(&dln2->adapter, dln2); snprintf(dln2->adapter.name, sizeof(dln2->adapter.name), "%s-%s-%d", -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC V2 09/12] i2c: powermac: make use of the new infrastructure for quirks
From: Wolfram Sang Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-powermac.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index 60a53c169ed2b3..6abcf696e3594b 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c @@ -153,12 +153,6 @@ static int i2c_powermac_master_xfer( struct i2c_adapter *adap, int read; int addrdir; - if (num != 1) { - dev_err(&adap->dev, - "Multi-message I2C transactions not supported\n"); - return -EOPNOTSUPP; - } - if (msgs->flags & I2C_M_TEN) return -EINVAL; read = (msgs->flags & I2C_M_RD) != 0; @@ -205,6 +199,9 @@ static const struct i2c_algorithm i2c_powermac_algorithm = { .functionality = i2c_powermac_func, }; +static struct i2c_adapter_quirks i2c_powermac_quirks = { + .max_num_msgs = 1, +}; static int i2c_powermac_remove(struct platform_device *dev) { @@ -434,6 +431,7 @@ static int i2c_powermac_probe(struct platform_device *dev) platform_set_drvdata(dev, adapter); adapter->algo = &i2c_powermac_algorithm; + adapter->quirks = &i2c_powermac_quirks; i2c_set_adapdata(adapter, bus); adapter->dev.parent = &dev->dev; -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC V2 07/12] i2c: axxia: make use of the new infrastructure for quirks
From: Wolfram Sang Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-axxia.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-axxia.c b/drivers/i2c/busses/i2c-axxia.c index 768a598d8d03ad..488c5d3bf9dba7 100644 --- a/drivers/i2c/busses/i2c-axxia.c +++ b/drivers/i2c/busses/i2c-axxia.c @@ -336,11 +336,6 @@ static int axxia_i2c_xfer_msg(struct axxia_i2c_dev *idev, struct i2c_msg *msg) u32 addr_1, addr_2; int ret; - if (msg->len > 255) { - dev_warn(idev->dev, "unsupported length %u\n", msg->len); - return -EINVAL; - } - idev->msg = msg; idev->msg_xfrd = 0; idev->msg_err = 0; @@ -454,6 +449,11 @@ static const struct i2c_algorithm axxia_i2c_algo = { .functionality = axxia_i2c_func, }; +static struct i2c_adapter_quirks axxia_i2c_quirks = { + .max_read_len = 255, + .max_write_len = 255, +}; + static int axxia_i2c_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -511,6 +511,7 @@ static int axxia_i2c_probe(struct platform_device *pdev) strlcpy(idev->adapter.name, pdev->name, sizeof(idev->adapter.name)); idev->adapter.owner = THIS_MODULE; idev->adapter.algo = &axxia_i2c_algo; + idev->adapter.quirks = &axxia_i2c_quirks; idev->adapter.dev.parent = &pdev->dev; idev->adapter.dev.of_node = pdev->dev.of_node; -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC V2 10/12] i2c: viperboard: make use of the new infrastructure for quirks
From: Wolfram Sang Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-viperboard.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-viperboard.c b/drivers/i2c/busses/i2c-viperboard.c index 7533fa34d73711..47e88adf2011e1 100644 --- a/drivers/i2c/busses/i2c-viperboard.c +++ b/drivers/i2c/busses/i2c-viperboard.c @@ -288,10 +288,6 @@ static int vprbrd_i2c_xfer(struct i2c_adapter *i2c, struct i2c_msg *msgs, i, pmsg->flags & I2C_M_RD ? "read" : "write", pmsg->flags, pmsg->len, pmsg->addr); - /* msgs longer than 2048 bytes are not supported by adapter */ - if (pmsg->len > 2048) - return -EINVAL; - mutex_lock(&vb->lock); /* directly send the message */ if (pmsg->flags & I2C_M_RD) { @@ -358,6 +354,11 @@ static const struct i2c_algorithm vprbrd_algorithm = { .functionality = vprbrd_i2c_func, }; +static struct i2c_adapter_quirks vprbrd_quirks = { + .max_read_len = 2048, + .max_write_len = 2048, +}; + static int vprbrd_i2c_probe(struct platform_device *pdev) { struct vprbrd *vb = dev_get_drvdata(pdev->dev.parent); @@ -373,6 +374,7 @@ static int vprbrd_i2c_probe(struct platform_device *pdev) vb_i2c->i2c.owner = THIS_MODULE; vb_i2c->i2c.class = I2C_CLASS_HWMON; vb_i2c->i2c.algo = &vprbrd_algorithm; + vb_i2c->i2c.quirks = &vprbrd_quirks; vb_i2c->i2c.algo_data = vb; /* save the param in usb capabable memory */ vb_i2c->bus_freq_param = i2c_bus_param; -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC V2 06/12] i2c: cpm: make use of the new infrastructure for quirks
From: Wolfram Sang Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-cpm.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index 2d466538b2e2c9..714bdc837769fd 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c @@ -308,22 +308,12 @@ static int cpm_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) struct i2c_reg __iomem *i2c_reg = cpm->i2c_reg; struct i2c_ram __iomem *i2c_ram = cpm->i2c_ram; struct i2c_msg *pmsg; - int ret, i; + int ret; int tptr; int rptr; cbd_t __iomem *tbdf; cbd_t __iomem *rbdf; - if (num > CPM_MAXBD) - return -EINVAL; - - /* Check if we have any oversized READ requests */ - for (i = 0; i < num; i++) { - pmsg = &msgs[i]; - if (pmsg->len >= CPM_MAX_READ) - return -EINVAL; - } - /* Reset to use first buffer */ out_be16(&i2c_ram->rbptr, in_be16(&i2c_ram->rbase)); out_be16(&i2c_ram->tbptr, in_be16(&i2c_ram->tbase)); @@ -424,10 +414,18 @@ static const struct i2c_algorithm cpm_i2c_algo = { .functionality = cpm_i2c_func, }; +/* CPM_MAX_READ is also limiting writes according to the code! */ +static struct i2c_adapter_quirks cpm_i2c_quirks = { + .max_num_msgs = CPM_MAXBD, + .max_read_len = CPM_MAX_READ, + .max_write_len = CPM_MAX_READ, +}; + static const struct i2c_adapter cpm_ops = { .owner = THIS_MODULE, .name = "i2c-cpm", .algo = &cpm_i2c_algo, + .quirks = &cpm_i2c_quirks, }; static int cpm_i2c_setup(struct cpm_i2c *cpm) -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC V2 01/12] i2c: add quirk structure to describe adapter flaws
From: Wolfram Sang The number of I2C adapters which are not fully I2C compatible is rising, sadly. Drivers usually do handle the flaws, still the user receives only some errno for a transfer which normally can be expected to work. This patch introduces a formal description of flaws. One advantage is that the core can check before the actual transfer if the messages could be transferred at all. This is done in the next patch. Another advantage is that we can pass this information to the user so the restrictions are exactly known and further actions can be based on that. This will be done later after some stabilization period for this description. Signed-off-by: Wolfram Sang --- include/linux/i2c.h | 43 +++ 1 file changed, 43 insertions(+) diff --git a/include/linux/i2c.h b/include/linux/i2c.h index f17da50402a4da..243d1a1d78b248 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -449,6 +449,48 @@ int i2c_recover_bus(struct i2c_adapter *adap); int i2c_generic_gpio_recovery(struct i2c_adapter *adap); int i2c_generic_scl_recovery(struct i2c_adapter *adap); +/** + * struct i2c_adapter_quirks - describe flaws of an i2c adapter + * @flags: see I2C_AQ_* for possible flags and read below + * @max_num_msgs: maximum number of messages per transfer + * @max_write_len: maximum length of a write message + * @max_read_len: maximum length of a read message + * @max_comb_1st_msg_len: maximum length of the first msg in a combined message + * @max_comb_2nd_msg_len: maximum length of the second msg in a combined message + * + * Note about combined messages: Some I2C controllers can only send one message + * per transfer, plus something called combined message or write-then-read. + * This is (usually) a small write message followed by a read message and + * barely enough to access register based devices like EEPROMs. There is a flag + * to support this mode. It implies max_num_msg = 2 and does the length checks + * with max_comb_*_len because combined message mode usually has its own + * limitations. Because of HW implementations, some controllers can actually do + * write-then-anything or other variants. To support that, write-then-read has + * been broken out into smaller bits like write-first and read-second which can + * be combined as needed. + */ + +struct i2c_adapter_quirks { + u64 flags; + int max_num_msgs; + u16 max_write_len; + u16 max_read_len; + u16 max_comb_1st_msg_len; + u16 max_comb_2nd_msg_len; +}; + +/* enforce max_num_msgs = 2 and use max_comb_*_len for length checks */ +#define I2C_AQ_COMBBIT(0) +/* first combined message must be write */ +#define I2C_AQ_COMB_WRITE_FIRSTBIT(1) +/* second combined message must be read */ +#define I2C_AQ_COMB_READ_SECONDBIT(2) +/* both combined messages must have the same target address */ +#define I2C_AQ_COMB_SAME_ADDR BIT(3) +/* convenience macro for typical write-then read case */ +#define I2C_AQ_COMB_WRITE_THEN_READ(I2C_AQ_COMB | I2C_AQ_COMB_WRITE_FIRST | \ +I2C_AQ_COMB_READ_SECOND | I2C_AQ_COMB_SAME_ADDR) + /* * i2c_adapter is the structure used to identify a physical i2c bus along * with the access algorithms necessary to access it. @@ -474,6 +516,7 @@ struct i2c_adapter { struct list_head userspace_clients; struct i2c_bus_recovery_info *bus_recovery_info; + const struct i2c_adapter_quirks *quirks; }; #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC V2 05/12] i2c: qup: make use of the new infrastructure for quirks
From: Wolfram Sang Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-qup.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index 4dad23bdffbe90..fdcbdab808e9fc 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -412,17 +412,6 @@ static int qup_i2c_read_one(struct qup_i2c_dev *qup, struct i2c_msg *msg) unsigned long left; int ret; - /* -* The QUP block will issue a NACK and STOP on the bus when reaching -* the end of the read, the length of the read is specified as one byte -* which limits the possible read to 256 (QUP_READ_LIMIT) bytes. -*/ - if (msg->len > QUP_READ_LIMIT) { - dev_err(qup->dev, "HW not capable of reads over %d bytes\n", - QUP_READ_LIMIT); - return -EINVAL; - } - qup->msg = msg; qup->pos = 0; @@ -534,6 +523,15 @@ static const struct i2c_algorithm qup_i2c_algo = { .functionality = qup_i2c_func, }; +/* + * The QUP block will issue a NACK and STOP on the bus when reaching + * the end of the read, the length of the read is specified as one byte + * which limits the possible read to 256 (QUP_READ_LIMIT) bytes. + */ +static struct i2c_adapter_quirks qup_i2c_quirks = { + .max_read_len = QUP_READ_LIMIT, +}; + static void qup_i2c_enable_clocks(struct qup_i2c_dev *qup) { clk_prepare_enable(qup->clk); @@ -670,6 +668,7 @@ static int qup_i2c_probe(struct platform_device *pdev) i2c_set_adapdata(&qup->adap, qup); qup->adap.algo = &qup_i2c_algo; + qup->adap.quirks = &qup_i2c_quirks; qup->adap.dev.parent = qup->dev; qup->adap.dev.of_node = pdev->dev.of_node; strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name)); -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC V2 02/12] i2c: add quirk checks to core
From: Wolfram Sang Let the core do the checks if HW quirks prevent a transfer. Saves code from drivers and adds consistency. Signed-off-by: Wolfram Sang --- drivers/i2c/i2c-core.c | 62 ++ 1 file changed, 62 insertions(+) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 210cf4874cb7ea..c5ca0e4006edb7 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -1929,6 +1929,65 @@ module_exit(i2c_exit); * */ +/* Check if val is exceeding the quirk IFF quirk is non 0 */ +#define i2c_quirk_exceeded(val, quirk) ((quirk) && ((val) > (quirk))) + +static int i2c_quirk_error(struct i2c_adapter *adap, struct i2c_msg *msg, char *err_msg) +{ + dev_err_ratelimited(&adap->dev, "quirk: %s (addr 0x%04x, size %u, %s)\n", + err_msg, msg->addr, msg->len, + msg->flags & I2C_M_RD ? "read" : "write"); + return -EOPNOTSUPP; +} + +static int i2c_check_for_quirks(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) +{ + const struct i2c_adapter_quirks *q = adap->quirks; + int max_num = q->max_num_msgs, i; + bool do_len_check = true; + + if (q->flags & I2C_AQ_COMB) { + max_num = 2; + + /* special checks for combined messages */ + if (num == 2) { + if (q->flags & I2C_AQ_COMB_WRITE_FIRST && msgs[0].flags & I2C_M_RD) + return i2c_quirk_error(adap, &msgs[0], "1st comb msg not write"); + + if (q->flags & I2C_AQ_COMB_READ_SECOND && !(msgs[1].flags & I2C_M_RD)) + return i2c_quirk_error(adap, &msgs[1], "2nd comb msg not read"); + + if (q->flags & I2C_AQ_COMB_SAME_ADDR && msgs[0].addr != msgs[1].addr) + return i2c_quirk_error(adap, &msgs[0], "addresses do not match"); + + if (i2c_quirk_exceeded(msgs[0].len, q->max_comb_1st_msg_len)) + return i2c_quirk_error(adap, &msgs[0], "msg too long"); + + if (i2c_quirk_exceeded(msgs[1].len, q->max_comb_2nd_msg_len)) + return i2c_quirk_error(adap, &msgs[1], "msg too long"); + + do_len_check = false; + } + } + + if (i2c_quirk_exceeded(num, max_num)) + return i2c_quirk_error(adap, &msgs[0], "too many messages"); + + for (i = 0; i < num; i++) { + u16 len = msgs[i].len; + + if (msgs[i].flags & I2C_M_RD) { + if (do_len_check && i2c_quirk_exceeded(len, q->max_read_len)) + return i2c_quirk_error(adap, &msgs[i], "msg too long"); + } else { + if (do_len_check && i2c_quirk_exceeded(len, q->max_write_len)) + return i2c_quirk_error(adap, &msgs[i], "msg too long"); + } + } + + return 0; +} + /** * __i2c_transfer - unlocked flavor of i2c_transfer * @adap: Handle to I2C bus @@ -1946,6 +2005,9 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) unsigned long orig_jiffies; int ret, try; + if (adap->quirks && i2c_check_for_quirks(adap, msgs, num)) + return -EOPNOTSUPP; + /* i2c_trace_msg gets enabled when tracepoint i2c_transfer gets * enabled. This is an efficient way of keeping the for-loop from * being executed when not needed. -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC V2 04/12] i2c: opal: make use of the new infrastructure for quirks
From: Wolfram Sang Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-opal.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/busses/i2c-opal.c b/drivers/i2c/busses/i2c-opal.c index 16f90b1a750894..b2788ecad5b3cb 100644 --- a/drivers/i2c/busses/i2c-opal.c +++ b/drivers/i2c/busses/i2c-opal.c @@ -104,17 +104,6 @@ static int i2c_opal_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, req.buffer_ra = cpu_to_be64(__pa(msgs[0].buf)); break; case 2: - /* For two messages, we basically support only simple -* smbus transactions of a write plus a read. We might -* want to allow also two writes but we'd have to bounce -* the data into a single buffer. -*/ - if ((msgs[0].flags & I2C_M_RD) || !(msgs[1].flags & I2C_M_RD)) - return -EOPNOTSUPP; - if (msgs[0].len > 4) - return -EOPNOTSUPP; - if (msgs[0].addr != msgs[1].addr) - return -EOPNOTSUPP; req.type = OPAL_I2C_SM_READ; req.addr = cpu_to_be16(msgs[0].addr); req.subaddr_sz = msgs[0].len; @@ -210,6 +199,16 @@ static const struct i2c_algorithm i2c_opal_algo = { .functionality = i2c_opal_func, }; +/* For two messages, we basically support only simple + * smbus transactions of a write plus a read. We might + * want to allow also two writes but we'd have to bounce + * the data into a single buffer. + */ +static struct i2c_adapter_quirks i2c_opal_quirks = { + .flags = I2C_AQ_COMB_WRITE_THEN_READ, + .max_comb_1st_msg_len = 4, +}; + static int i2c_opal_probe(struct platform_device *pdev) { struct i2c_adapter *adapter; @@ -232,6 +231,7 @@ static int i2c_opal_probe(struct platform_device *pdev) adapter->algo = &i2c_opal_algo; adapter->algo_data = (void *)(unsigned long)opal_id; + adapter->quirks = &i2c_opal_quirks; adapter->dev.parent = &pdev->dev; adapter->dev.of_node = of_node_get(pdev->dev.of_node); pname = of_get_property(pdev->dev.of_node, "ibm,port-name", NULL); -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC V2 03/12] i2c: at91: make use of the new infrastructure for quirks
From: Wolfram Sang Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-at91.c | 32 +++- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 636fd2efad8850..b3a70e8fc653c5 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c @@ -487,30 +487,10 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num) if (ret < 0) goto out; - /* -* The hardware can handle at most two messages concatenated by a -* repeated start via it's internal address feature. -*/ - if (num > 2) { - dev_err(dev->dev, - "cannot handle more than two concatenated messages.\n"); - ret = 0; - goto out; - } else if (num == 2) { + if (num == 2) { int internal_address = 0; int i; - if (msg->flags & I2C_M_RD) { - dev_err(dev->dev, "first transfer must be write.\n"); - ret = -EINVAL; - goto out; - } - if (msg->len > 3) { - dev_err(dev->dev, "first message size must be <= 3.\n"); - ret = -EINVAL; - goto out; - } - /* 1st msg is put into the internal address, start with 2nd */ m_start = &msg[1]; for (i = 0; i < msg->len; ++i) { @@ -540,6 +520,15 @@ out: return ret; } +/* + * The hardware can handle at most two messages concatenated by a + * repeated start via it's internal address feature. + */ +static struct i2c_adapter_quirks at91_twi_quirks = { + .flags = I2C_AQ_COMB | I2C_AQ_COMB_WRITE_FIRST | I2C_AQ_COMB_SAME_ADDR, + .max_comb_1st_msg_len = 3, +}; + static u32 at91_twi_func(struct i2c_adapter *adapter) { return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL @@ -777,6 +766,7 @@ static int at91_twi_probe(struct platform_device *pdev) dev->adapter.owner = THIS_MODULE; dev->adapter.class = I2C_CLASS_DEPRECATED; dev->adapter.algo = &at91_twi_algorithm; + dev->adapter.quirks = &at91_twi_quirks; dev->adapter.dev.parent = dev->dev; dev->adapter.nr = pdev->id; dev->adapter.timeout = AT91_I2C_TIMEOUT; -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC V2 00/12] i2c: describe adapter quirks in a generic way
From: Wolfram Sang Here is the second version of the patch series to describe i2c adapter quirks in a generic way. For the motivation, please read description of patch 1. This is still RFC because I would like to do some more tests on my own, but I need to write a tool for that. However, I'd really like to have the driver authors to have a look already. Actual testing is very much appreciated. Thanks to the Mediatek guys for rebasing their new driver to this framework. That helps, too! The branch is also here: git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/quirks Thanks, Wolfram Major changes since V1: * more fine-grained options to describe modes with combined messages. This should also cover the Mediatek HW now as well as all other permutations I can think of. * the core code and at91 driver had to be refactored to reflect the above change * added the bcm-iproc driver which came to mainline recently Wolfram Sang (12): i2c: add quirk structure to describe adapter flaws i2c: add quirk checks to core i2c: at91: make use of the new infrastructure for quirks i2c: opal: make use of the new infrastructure for quirks i2c: qup: make use of the new infrastructure for quirks i2c: cpm: make use of the new infrastructure for quirks i2c: axxia: make use of the new infrastructure for quirks i2c: dln2: make use of the new infrastructure for quirks i2c: powermac: make use of the new infrastructure for quirks i2c: viperboard: make use of the new infrastructure for quirks i2c: pmcmsp: make use of the new infrastructure for quirks i2c: bcm-iproc: make use of the new infrastructure for quirks drivers/i2c/busses/i2c-at91.c | 32 +++ drivers/i2c/busses/i2c-axxia.c | 11 --- drivers/i2c/busses/i2c-bcm-iproc.c | 15 + drivers/i2c/busses/i2c-cpm.c| 20 ++-- drivers/i2c/busses/i2c-dln2.c | 12 +++ drivers/i2c/busses/i2c-opal.c | 22 ++--- drivers/i2c/busses/i2c-pmcmsp.c | 42 ++--- drivers/i2c/busses/i2c-powermac.c | 10 +++--- drivers/i2c/busses/i2c-qup.c| 21 ++--- drivers/i2c/busses/i2c-viperboard.c | 10 +++--- drivers/i2c/i2c-core.c | 62 + include/linux/i2c.h | 43 + 12 files changed, 191 insertions(+), 109 deletions(-) -- 2.1.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
AW: [PATCH v1 1/3] SHA1 for PPC/SPE - assembler
> Von: David Laight [david.lai...@aculab.com] > Gesendet: Mittwoch, 25. Februar 2015 13:01 > An: Markus Stockhausen; linux-cry...@vger.kernel.org > Cc: linuxppc-dev@lists.ozlabs.org > Betreff: RE: [PATCH v1 1/3] SHA1 for PPC/SPE - assembler > > From: Markus Stockhausen > > [PATCH v1 1/3] SHA1 for PPC/SPE - assembler > > > > This is the assembler code for SHA1 implementation with > > the SIMD SPE instruction set. With the enhanced instruction > > set we can operate on 2 32 bit words in parallel. That helps > > reducing the time to calculate W16-W79. For increasing > > performance even more the assembler function can compute > > hashes for more than one 64 byte input block. > > > > The state of the used SPE registers is preserved via the > > stack so we can run from interrupt context > > Does the ppc use the same kind of delayed state save for the SPE > resisters that x86 uses (at least on the BSDs) for its FP (etc) regs. > > That would mean that the registers might contain values for > a different process, and that the cpu could receive an IPI > requesting they be written to the processes normal save area > so that they can be reloaded onto a different cpu. Indeed SPE registers are lazy switched. enable_kernel_spe() will take care of that. Additionally I had some discussions about interrupt context and its limitations. So 1) I implemented register saving in all patches (see AES & SHA256). This is because I know which registers I will overwrite. One should remember that SPE registers are shared with normal registers. So no big impact to save 32 bit or 64 bit of the non-volatile PPC registers. 2) And used disabling of preemption. But in contrast to other crypto algorithm implementations only for reasonable time intervals Markus Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. Ãber das Internet versandte E-Mails können unter fremden Namen erstellt oder manipuliert werden. Deshalb ist diese als E-Mail verschickte Nachricht keine rechtsverbindliche Willenserklärung. Collogia Unternehmensberatung AG Ubierring 11 D-50678 Köln Vorstand: Kadir Akin Dr. Michael Höhnerbach Vorsitzender des Aufsichtsrates: Hans Kristian Langva Registergericht: Amtsgericht Köln Registernummer: HRB 52 497 This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. e-mails sent over the internet may have been written under a wrong name or been manipulated. That is why this message sent as an e-mail is not a legally binding declaration of intention. Collogia Unternehmensberatung AG Ubierring 11 D-50678 Köln executive board: Kadir Akin Dr. Michael Höhnerbach President of the supervisory board: Hans Kristian Langva Registry office: district court Cologne Register number: HRB 52 497 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH v1 1/3] SHA1 for PPC/SPE - assembler
From: Markus Stockhausen > [PATCH v1 1/3] SHA1 for PPC/SPE - assembler > > This is the assembler code for SHA1 implementation with > the SIMD SPE instruction set. With the enhanced instruction > set we can operate on 2 32 bit words in parallel. That helps > reducing the time to calculate W16-W79. For increasing > performance even more the assembler function can compute > hashes for more than one 64 byte input block. > > The state of the used SPE registers is preserved via the > stack so we can run from interrupt context Does the ppc use the same kind of delayed state save for the SPE resisters that x86 uses (at least on the BSDs) for its FP (etc) regs. That would mean that the registers might contain values for a different process, and that the cpu could receive an IPI requesting they be written to the processes normal save area so that they can be reloaded onto a different cpu. David ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/1]: thermal driver therm_adt746.c
Hi, Thanks for your comments. Here's a new patch taking them into account. Cheers, (a) The contribution was created in whole or in part by me and I have the right to submit it under the GPL v2 (Gnu Public License Version 2) (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. Signed-off-by: Thomas Haschka --- linux/drivers/macintosh/therm_adt746x.c.orig2015-02-25 11:26:43.16400 +0100 +++ linux/drivers/macintosh/therm_adt746x.c 2015-02-25 11:40:54.24000 +0100 @@ -1,7 +1,8 @@ /* * Device driver for the i2c thermostat found on the iBook G4, Albook G4 * - * Copyright (C) 2003, 2004 Colin Leroy, Rasmus Rohde, Benjamin Herrenschmidt + * Copyright (C) 2003, 2004, 2015 + * Colin Leroy, Rasmus Rohde, Benjamin Herrenschmidt, Thomas Haschka * * Documentation from 115254175ADT7467_pra.pdf and 3686221171167ADT7460_b.pdf * http://www.onsemi.com/PowerSolutions/product.do?id=ADT7467 @@ -45,8 +46,10 @@ static u8 REM_CONTROL[2] = {0x00, 0x40}; static u8 FAN_SPEED[2] = {0x28, 0x2a}; static u8 FAN_SPD_SET[2] = {0x30, 0x31}; -static u8 default_limits_local[3] = {70, 50, 70};/* local, sensor1, sensor2 */ -static u8 default_limits_chip[3] = {80, 65, 80};/* local, sensor1, sensor2 */ +/* Local sensor is down to 45 in order to assure stable harddrive and + * components temperature on single fan machines */ +static u8 default_limits_local[3] = {45, 50, 70}; /* local, sensor1, sensor2 */ +static u8 default_limits_chip[3] = {80, 65, 80}; /* local, sensor1, sensor2 */ static const char *sensor_location[3] = { "?", "?", "?" }; static int limit_adjust; @@ -223,7 +226,7 @@ static void display_stats(struct thermos } #endif -static void update_fans_speed (struct thermostat *th) +static void update_fans_speed_multifan (struct thermostat *th) { int lastvar = 0; /* last variation, for iBook */ int i = 0; @@ -278,6 +281,83 @@ static void update_fans_speed (struct th } } +static void update_fans_speed_singlefan (struct thermostat *th) { + + /* Single Fan Laptops i.e. 12 inch Powerbook, Ibook etc. +* Necessites the readout of all three thermal sensors +* in order to avoid the harddisk and other components to overheat +* in the case of cold CPU. */ + + int lastvar = 0; /* last variation, for iBook */ + int i = 0; + int var = 0; + int var_sensor[3]; + int started = 0; + int fan_number = 0; + for (i = 0; i < 3; i++) { + var_sensor[i] = th->temps[i] - th->limits[i]; + } + var = var_sensor[0]; + for (i = 1; i < 3; i++) { + if (var_sensor[i] > var) { + var = var_sensor[i]; + } + } + if (var > -1) { + int step = (255 - fan_speed) / 7; + int new_speed = 0; + /* hysteresis : change fan speed only if variation is +* more than two degrees */ + if (abs(var - th->last_var[fan_number]) > 2) { + + started = 1; + new_speed = fan_speed + ((var-1)*step); + + if (new_speed < fan_speed) + new_speed = fan_speed; + if (new_speed > 255) + new_speed = 255; + + if (verbose) + printk(KERN_DEBUG "adt746x:" + " Setting fans speed to %d " + "(limit exceeded by %d on %s)\n", + new_speed, var, + sensor_location[fan_number+1]); + write_both_fan_speed(th, new_speed); + th->last_var[fan_number] = var; + } + } else if (var < -2) { + /* don't stop fan if sensor2 is cold and sensor1 is not +* so cold (lastvar >= -1) */ + if (i == 2 && lastvar < -1) { + if (th->last_speed[fan_number] != 0) + if (verbose) +