forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request torvalds#152 from zandrey/5.4-2.2.x-imx
Update 5.4-2.2.x-imx to v5.4.71 from stable
- Loading branch information
Showing
106 changed files
with
812 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,6 +155,7 @@ | |
}; | ||
|
||
&qspi { | ||
status = "okay"; | ||
flash@0 { | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* Copyright (C) 2014 Beniamino Galvani <[email protected]> | ||
*/ | ||
|
||
#include <linux/bitfield.h> | ||
#include <linux/clk.h> | ||
#include <linux/completion.h> | ||
#include <linux/i2c.h> | ||
|
@@ -32,12 +33,17 @@ | |
#define REG_CTRL_ACK_IGNORE BIT(1) | ||
#define REG_CTRL_STATUS BIT(2) | ||
#define REG_CTRL_ERROR BIT(3) | ||
#define REG_CTRL_CLKDIV_SHIFT 12 | ||
#define REG_CTRL_CLKDIV_MASK GENMASK(21, 12) | ||
#define REG_CTRL_CLKDIVEXT_SHIFT 28 | ||
#define REG_CTRL_CLKDIVEXT_MASK GENMASK(29, 28) | ||
#define REG_CTRL_CLKDIV GENMASK(21, 12) | ||
#define REG_CTRL_CLKDIVEXT GENMASK(29, 28) | ||
|
||
#define REG_SLV_ADDR GENMASK(7, 0) | ||
#define REG_SLV_SDA_FILTER GENMASK(10, 8) | ||
#define REG_SLV_SCL_FILTER GENMASK(13, 11) | ||
#define REG_SLV_SCL_LOW GENMASK(27, 16) | ||
#define REG_SLV_SCL_LOW_EN BIT(28) | ||
|
||
#define I2C_TIMEOUT_MS 500 | ||
#define FILTER_DELAY 15 | ||
|
||
enum { | ||
TOKEN_END = 0, | ||
|
@@ -132,19 +138,24 @@ static void meson_i2c_set_clk_div(struct meson_i2c *i2c, unsigned int freq) | |
unsigned long clk_rate = clk_get_rate(i2c->clk); | ||
unsigned int div; | ||
|
||
div = DIV_ROUND_UP(clk_rate, freq * i2c->data->div_factor); | ||
div = DIV_ROUND_UP(clk_rate, freq); | ||
div -= FILTER_DELAY; | ||
div = DIV_ROUND_UP(div, i2c->data->div_factor); | ||
|
||
/* clock divider has 12 bits */ | ||
if (div >= (1 << 12)) { | ||
if (div > GENMASK(11, 0)) { | ||
dev_err(i2c->dev, "requested bus frequency too low\n"); | ||
div = (1 << 12) - 1; | ||
div = GENMASK(11, 0); | ||
} | ||
|
||
meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_CLKDIV_MASK, | ||
(div & GENMASK(9, 0)) << REG_CTRL_CLKDIV_SHIFT); | ||
meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_CLKDIV, | ||
FIELD_PREP(REG_CTRL_CLKDIV, div & GENMASK(9, 0))); | ||
|
||
meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_CLKDIVEXT, | ||
FIELD_PREP(REG_CTRL_CLKDIVEXT, div >> 10)); | ||
|
||
meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_CLKDIVEXT_MASK, | ||
(div >> 10) << REG_CTRL_CLKDIVEXT_SHIFT); | ||
/* Disable HIGH/LOW mode */ | ||
meson_i2c_set_mask(i2c, REG_SLAVE_ADDR, REG_SLV_SCL_LOW_EN, 0); | ||
|
||
dev_dbg(i2c->dev, "%s: clk %lu, freq %u, div %u\n", __func__, | ||
clk_rate, freq, div); | ||
|
@@ -273,7 +284,10 @@ static void meson_i2c_do_start(struct meson_i2c *i2c, struct i2c_msg *msg) | |
token = (msg->flags & I2C_M_RD) ? TOKEN_SLAVE_ADDR_READ : | ||
TOKEN_SLAVE_ADDR_WRITE; | ||
|
||
writel(msg->addr << 1, i2c->regs + REG_SLAVE_ADDR); | ||
|
||
meson_i2c_set_mask(i2c, REG_SLAVE_ADDR, REG_SLV_ADDR, | ||
FIELD_PREP(REG_SLV_ADDR, msg->addr << 1)); | ||
|
||
meson_i2c_add_token(i2c, TOKEN_START); | ||
meson_i2c_add_token(i2c, token); | ||
} | ||
|
@@ -432,6 +446,10 @@ static int meson_i2c_probe(struct platform_device *pdev) | |
return ret; | ||
} | ||
|
||
/* Disable filtering */ | ||
meson_i2c_set_mask(i2c, REG_SLAVE_ADDR, | ||
REG_SLV_SDA_FILTER | REG_SLV_SCL_FILTER, 0); | ||
|
||
meson_i2c_set_clk_div(i2c, timings.bus_freq_hz); | ||
|
||
return 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.