diff --git a/recipes-kernel/linux/linux-yocto/0051-Add-ACPI-support-for-MCP251x-CAN-controller.patch b/recipes-kernel/linux/linux-yocto/0051-Add-ACPI-support-for-MCP251x-CAN-controller.patch index a074242..1bc363f 100644 --- a/recipes-kernel/linux/linux-yocto/0051-Add-ACPI-support-for-MCP251x-CAN-controller.patch +++ b/recipes-kernel/linux/linux-yocto/0051-Add-ACPI-support-for-MCP251x-CAN-controller.patch @@ -1,17 +1,17 @@ -From 99ccc44129455c49d65097ca1db73dc28055e446 Mon Sep 17 00:00:00 2001 +From bc3f60cf8fd787ed4c222323fb9a3aaa20aa129e Mon Sep 17 00:00:00 2001 From: Sugnan Prabhu S Date: Wed, 20 Sep 2017 10:54:32 +0530 -Subject: [PATCH 1/2] Add ACPI support for MCP251x CAN controller +Subject: [PATCH] Add ACPI support for MCP251x CAN controller This patch adds ACPI support for mcp251x can controller. Signed-off-by: Sugnan Prabhu S --- - drivers/net/can/spi/mcp251x.c | 21 +++++++++++++++++++++ - 1 file changed, 21 insertions(+) + drivers/net/can/spi/mcp251x.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c -index 575790e..3882e8d 100644 +index 575790e..8dd154c 100644 --- a/drivers/net/can/spi/mcp251x.c +++ b/drivers/net/can/spi/mcp251x.c @@ -54,6 +54,7 @@ @@ -35,7 +35,7 @@ index 575790e..3882e8d 100644 static int mcp251x_can_probe(struct spi_device *spi) { const struct of_device_id *of_id = of_match_device(mcp251x_of_match, -@@ -1032,6 +1039,16 @@ static int mcp251x_can_probe(struct spi_device *spi) +@@ -1032,11 +1039,23 @@ static int mcp251x_can_probe(struct spi_device *spi) struct mcp251x_priv *priv; struct clk *clk; int freq, ret; @@ -52,7 +52,14 @@ index 575790e..3882e8d 100644 clk = devm_clk_get(&spi->dev, NULL); if (IS_ERR(clk)) { -@@ -1069,8 +1086,11 @@ static int mcp251x_can_probe(struct spi_device *spi) + if (pdata) + freq = pdata->oscillator_frequency; ++ else if (has_acpi_companion(&spi->dev) && !device_property_read_u32(&spi->dev, "clock-frequency", &freq)) ++ dev_dbg(&spi->dev, "source clock frequency %d", freq); + else + return PTR_ERR(clk); + } else { +@@ -1069,8 +1088,11 @@ static int mcp251x_can_probe(struct spi_device *spi) CAN_CTRLMODE_LOOPBACK | CAN_CTRLMODE_LISTENONLY; if (of_id) priv->model = (enum mcp251x_model)of_id->data; @@ -64,7 +71,7 @@ index 575790e..3882e8d 100644 priv->net = net; priv->clk = clk; -@@ -1244,6 +1264,7 @@ static struct spi_driver mcp251x_can_driver = { +@@ -1244,6 +1266,7 @@ static struct spi_driver mcp251x_can_driver = { .driver = { .name = DEVICE_NAME, .of_match_table = mcp251x_of_match, diff --git a/recipes-kernel/linux/linux-yocto/0052-workaround-for-wrong-ACPI-configuration-passed-for-mcp251x.patch b/recipes-kernel/linux/linux-yocto/0052-workaround-for-wrong-ACPI-configuration-passed-for-mcp251x.patch deleted file mode 100644 index 478c4a8..0000000 --- a/recipes-kernel/linux/linux-yocto/0052-workaround-for-wrong-ACPI-configuration-passed-for-mcp251x.patch +++ /dev/null @@ -1,55 +0,0 @@ -From d1e3c0150b802daf3078036bb8c8d540716036d4 Mon Sep 17 00:00:00 2001 -From: Sugnan Prabhu S -Date: Tue, 26 Sep 2017 12:37:14 +0530 -Subject: [PATCH 2/2] workaround for wrong ACPI configuration passed for - mcp251x - -This is a temporary patch to override the wrong configuration -values passed for the mcp251x CAN controller. -- spi mode supported by mcp251x as per datasheet is either 0,0 or 1,1 - but the mode passed in the ACPI table is 0,1 -- IRQ number passed in ACPI table is 231, which is not working. - Correct irq number is found by trying a range of supported irq numbers - for which cpu receives an interrupt from mcp251x on receiving CAN data - from another CAN controller. -- Aero provides 25MHz clock for the mcp251x oscillator input. - -Signed-off-by: Sugnan Prabhu S ---- - drivers/net/can/spi/mcp251x.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c -index 442386cf..815419a 100644 ---- a/drivers/net/can/spi/mcp251x.c -+++ b/drivers/net/can/spi/mcp251x.c -@@ -220,6 +220,9 @@ - - #define DEVICE_NAME "mcp251x" - -+#define DEFAULT_OSC_CLK_FREQ (25 * 1000 * 1000) -+#define CPU_IN_MCP2515_IRQ 157 -+ - static int mcp251x_enable_dma; /* Enable SPI DMA. Default: 0 (Off) */ - module_param(mcp251x_enable_dma, int, S_IRUGO); - MODULE_PARM_DESC(mcp251x_enable_dma, "Enable SPI DMA. Default: 0 (Off)"); -@@ -1048,12 +1051,16 @@ static int mcp251x_can_probe(struct spi_device *spi) - spi->irq = acpi_dev_gpio_irq_get(ACPI_COMPANION(&spi->dev), 0); - if (spi->irq < 0) - return -EINVAL; -+ spi->mode = SPI_MODE_0; -+ spi->irq = CPU_IN_MCP2515_IRQ; - } - - clk = devm_clk_get(&spi->dev, NULL); - if (IS_ERR(clk)) { - if (pdata) - freq = pdata->oscillator_frequency; -+ else if (has_acpi_companion(&spi->dev)) -+ freq = DEFAULT_OSC_CLK_FREQ; - else - return PTR_ERR(clk); - } else { --- -2.7.4 - diff --git a/recipes-kernel/linux/linux-yocto_4.4.bbappend b/recipes-kernel/linux/linux-yocto_4.4.bbappend index 5045790..63d648a 100644 --- a/recipes-kernel/linux/linux-yocto_4.4.bbappend +++ b/recipes-kernel/linux/linux-yocto_4.4.bbappend @@ -60,7 +60,6 @@ SRC_URI += " \ file://0049-drivers-media-ov7251-Enable-set-exposure-and-gain.patch \ file://0050-drivers-media-atomisp-Allow-user-set-exposure-and-ga.patch \ file://0051-Add-ACPI-support-for-MCP251x-CAN-controller.patch \ - file://0052-workaround-for-wrong-ACPI-configuration-passed-for-mcp251x.patch \ " do_install_append() {