Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 2806b4f9 authored by derfelot's avatar derfelot
Browse files

Merge Linux 4.4.273 kernel

Changes in 4.4.273: (36 commits)
        proc: Track /proc/$pid/attr/ opener mm_struct
        net/nfc/rawsock.c: fix a permission check bug
        ASoC: sti-sas: add missing MODULE_DEVICE_TABLE
        isdn: mISDN: netjet: Fix crash in nj_probe:
        bonding: init notify_work earlier to avoid uninitialized use
        netlink: disable IRQs for netlink_lock_table()
        net: mdiobus: get rid of a BUG_ON()
        net/qla3xxx: fix schedule while atomic in ql_sem_spinlock
        scsi: vmw_pvscsi: Set correct residual data length
        scsi: target: qla2xxx: Wait for stop_phase1 at WWN removal
        net: macb: ensure the device is available before accessing GEMGXL control registers
        net: appletalk: cops: Fix data race in cops_probe1
        MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER
        bnx2x: Fix missing error code in bnx2x_iov_init_one()
        powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P2041 i2c controllers
        powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P1010 i2c controllers
        i2c: mpc: Make use of i2c_recover_bus()
        i2c: mpc: implement erratum A-004447 workaround
        kvm: avoid speculation-based attacks from out-of-range memslot accesses
        btrfs: return value from btrfs_mark_extent_written() in case of error
        cgroup1: don't allow '\n' in renaming
        USB: f_ncm: ncm_bitrate (speed) is unsigned
        usb: dwc3: ep0: fix NULL pointer exception
        USB: serial: ftdi_sio: add NovaTech OrionMX product ID
        USB: serial: omninet: add device id for Zyxel Omni 56K Plus
        USB: serial: quatech2: fix control-request directions
        usb: gadget: eem: fix wrong eem header operation
        perf: Fix data race between pin_count increment/decrement
        NFS: Fix a potential NULL dereference in nfs_get_client()
        perf session: Correct buffer copying when peeking events
        kvm: fix previous commit for 32-bit builds
        NFSv4: nfs4_proc_set_acl needs to restore NFS_CAP_UIDGID_NOMAP on error.
        scsi: core: Only put parent device if host state differs from SHOST_CREATED
        ftrace: Do not blindly read the ip address in ftrace_bug()
        proc: only require mm_struct for writing
        Linux 4.4.273
parents 4be01178 78fba064
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
VERSION = 4
PATCHLEVEL = 4
SUBLEVEL = 272
SUBLEVEL = 273
EXTRAVERSION =
NAME = Blurry Fish Butt

+6 −6
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@
 */
notrace void arch_local_irq_disable(void)
{
	preempt_disable();
	preempt_disable_notrace();

	__asm__ __volatile__(
	"	.set	push						\n"
@@ -53,7 +53,7 @@ notrace void arch_local_irq_disable(void)
	: /* no inputs */
	: "memory");

	preempt_enable();
	preempt_enable_notrace();
}
EXPORT_SYMBOL(arch_local_irq_disable);

@@ -62,7 +62,7 @@ notrace unsigned long arch_local_irq_save(void)
{
	unsigned long flags;

	preempt_disable();
	preempt_disable_notrace();

	__asm__ __volatile__(
	"	.set	push						\n"
@@ -79,7 +79,7 @@ notrace unsigned long arch_local_irq_save(void)
	: /* no inputs */
	: "memory");

	preempt_enable();
	preempt_enable_notrace();

	return flags;
}
@@ -89,7 +89,7 @@ notrace void arch_local_irq_restore(unsigned long flags)
{
	unsigned long __tmp1;

	preempt_disable();
	preempt_disable_notrace();

	__asm__ __volatile__(
	"	.set	push						\n"
@@ -107,7 +107,7 @@ notrace void arch_local_irq_restore(unsigned long flags)
	: "0" (flags)
	: "memory");

	preempt_enable();
	preempt_enable_notrace();
}
EXPORT_SYMBOL(arch_local_irq_restore);

+8 −0
Original line number Diff line number Diff line
@@ -122,7 +122,15 @@
	};

/include/ "pq3-i2c-0.dtsi"
	i2c@3000 {
		fsl,i2c-erratum-a004447;
	};

/include/ "pq3-i2c-1.dtsi"
	i2c@3100 {
		fsl,i2c-erratum-a004447;
	};

/include/ "pq3-duart-0.dtsi"
/include/ "pq3-espi-0.dtsi"
	spi0: spi@7000 {
+16 −0
Original line number Diff line number Diff line
@@ -389,7 +389,23 @@
	};

/include/ "qoriq-i2c-0.dtsi"
	i2c@118000 {
		fsl,i2c-erratum-a004447;
	};

	i2c@118100 {
		fsl,i2c-erratum-a004447;
	};

/include/ "qoriq-i2c-1.dtsi"
	i2c@119000 {
		fsl,i2c-erratum-a004447;
	};

	i2c@119100 {
		fsl,i2c-erratum-a004447;
	};

/include/ "qoriq-duart-0.dtsi"
/include/ "qoriq-duart-1.dtsi"
/include/ "qoriq-gpio-0.dtsi"
+93 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@

#include <linux/clk.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/fsl_devices.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
@@ -49,6 +50,7 @@
#define CCR_MTX  0x10
#define CCR_TXAK 0x08
#define CCR_RSTA 0x04
#define CCR_RSVD 0x02

#define CSR_MCF  0x80
#define CSR_MAAS 0x40
@@ -70,6 +72,7 @@ struct mpc_i2c {
	u8 fdr, dfsrr;
#endif
	struct clk *clk_per;
	bool has_errata_A004447;
};

struct mpc_i2c_divider {
@@ -178,6 +181,75 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
	return 0;
}

static int i2c_mpc_wait_sr(struct mpc_i2c *i2c, int mask)
{
	void __iomem *addr = i2c->base + MPC_I2C_SR;
	u8 val;

	return readb_poll_timeout(addr, val, val & mask, 0, 100);
}

/*
 * Workaround for Erratum A004447. From the P2040CE Rev Q
 *
 * 1.  Set up the frequency divider and sampling rate.
 * 2.  I2CCR - a0h
 * 3.  Poll for I2CSR[MBB] to get set.
 * 4.  If I2CSR[MAL] is set (an indication that SDA is stuck low), then go to
 *     step 5. If MAL is not set, then go to step 13.
 * 5.  I2CCR - 00h
 * 6.  I2CCR - 22h
 * 7.  I2CCR - a2h
 * 8.  Poll for I2CSR[MBB] to get set.
 * 9.  Issue read to I2CDR.
 * 10. Poll for I2CSR[MIF] to be set.
 * 11. I2CCR - 82h
 * 12. Workaround complete. Skip the next steps.
 * 13. Issue read to I2CDR.
 * 14. Poll for I2CSR[MIF] to be set.
 * 15. I2CCR - 80h
 */
static void mpc_i2c_fixup_A004447(struct mpc_i2c *i2c)
{
	int ret;
	u32 val;

	writeccr(i2c, CCR_MEN | CCR_MSTA);
	ret = i2c_mpc_wait_sr(i2c, CSR_MBB);
	if (ret) {
		dev_err(i2c->dev, "timeout waiting for CSR_MBB\n");
		return;
	}

	val = readb(i2c->base + MPC_I2C_SR);

	if (val & CSR_MAL) {
		writeccr(i2c, 0x00);
		writeccr(i2c, CCR_MSTA | CCR_RSVD);
		writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSVD);
		ret = i2c_mpc_wait_sr(i2c, CSR_MBB);
		if (ret) {
			dev_err(i2c->dev, "timeout waiting for CSR_MBB\n");
			return;
		}
		val = readb(i2c->base + MPC_I2C_DR);
		ret = i2c_mpc_wait_sr(i2c, CSR_MIF);
		if (ret) {
			dev_err(i2c->dev, "timeout waiting for CSR_MIF\n");
			return;
		}
		writeccr(i2c, CCR_MEN | CCR_RSVD);
	} else {
		val = readb(i2c->base + MPC_I2C_DR);
		ret = i2c_mpc_wait_sr(i2c, CSR_MIF);
		if (ret) {
			dev_err(i2c->dev, "timeout waiting for CSR_MIF\n");
			return;
		}
		writeccr(i2c, CCR_MEN);
	}
}

#if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x)
static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = {
	{20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23},
@@ -581,7 +653,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
			if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) {
				writeb(status & ~CSR_MAL,
				       i2c->base + MPC_I2C_SR);
				mpc_i2c_fixup(i2c);
				i2c_recover_bus(&i2c->adap);
			}
			return -EIO;
		}
@@ -617,7 +689,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
			if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) {
				writeb(status & ~CSR_MAL,
				       i2c->base + MPC_I2C_SR);
				mpc_i2c_fixup(i2c);
				i2c_recover_bus(&i2c->adap);
			}
			return -EIO;
		}
@@ -632,6 +704,18 @@ static u32 mpc_functionality(struct i2c_adapter *adap)
	  | I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_PROC_CALL;
}

static int fsl_i2c_bus_recovery(struct i2c_adapter *adap)
{
	struct mpc_i2c *i2c = i2c_get_adapdata(adap);

	if (i2c->has_errata_A004447)
		mpc_i2c_fixup_A004447(i2c);
	else
		mpc_i2c_fixup(i2c);

	return 0;
}

static const struct i2c_algorithm mpc_algo = {
	.master_xfer = mpc_xfer,
	.functionality = mpc_functionality,
@@ -643,6 +727,10 @@ static struct i2c_adapter mpc_ops = {
	.timeout = HZ,
};

static struct i2c_bus_recovery_info fsl_i2c_recovery_info = {
	.recover_bus = fsl_i2c_bus_recovery,
};

static const struct of_device_id mpc_i2c_of_match[];
static int fsl_i2c_probe(struct platform_device *op)
{
@@ -727,6 +815,8 @@ static int fsl_i2c_probe(struct platform_device *op)
	dev_info(i2c->dev, "timeout %u us\n", mpc_ops.timeout * 1000000 / HZ);

	platform_set_drvdata(op, i2c);
	if (of_property_read_bool(op->dev.of_node, "fsl,i2c-erratum-a004447"))
		i2c->has_errata_A004447 = true;

	i2c->adap = mpc_ops;
	of_address_to_resource(op->dev.of_node, 0, &res);
@@ -735,6 +825,7 @@ static int fsl_i2c_probe(struct platform_device *op)
	i2c_set_adapdata(&i2c->adap, i2c);
	i2c->adap.dev.parent = &op->dev;
	i2c->adap.dev.of_node = of_node_get(op->dev.of_node);
	i2c->adap.bus_recovery_info = &fsl_i2c_recovery_info;

	result = i2c_add_adapter(&i2c->adap);
	if (result < 0) {
Loading