Commit 4f79a8b0 authored by Arnd Bergmann's avatar Arnd Bergmann

Merge tag 'aspeed-5.12-soc' of...

Merge tag 'aspeed-5.12-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/joel/aspeed into arm/drivers

ASPEED soc driver updates for 5.12

 - Clock control logic for LPC snoop driver
 - New system ids for AST2600 variants

* tag 'aspeed-5.12-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/joel/aspeed:
  soc: aspeed: socinfo: Add new systems
  soc: aspeed: snoop: Add clock control logic

Link: https://lore.kernel.org/r/CACPK8Xf+4VkWC6rkHhsWdwhaLjy2Az=GAHaEe=SvOiUc_OGKSQ@mail.gmail.comSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents f4642521 d0e72be7
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
*/ */
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/clk.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/kfifo.h> #include <linux/kfifo.h>
...@@ -67,6 +68,7 @@ struct aspeed_lpc_snoop_channel { ...@@ -67,6 +68,7 @@ struct aspeed_lpc_snoop_channel {
struct aspeed_lpc_snoop { struct aspeed_lpc_snoop {
struct regmap *regmap; struct regmap *regmap;
int irq; int irq;
struct clk *clk;
struct aspeed_lpc_snoop_channel chan[NUM_SNOOP_CHANNELS]; struct aspeed_lpc_snoop_channel chan[NUM_SNOOP_CHANNELS];
}; };
...@@ -282,22 +284,42 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev) ...@@ -282,22 +284,42 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
lpc_snoop->clk = devm_clk_get(dev, NULL);
if (IS_ERR(lpc_snoop->clk)) {
rc = PTR_ERR(lpc_snoop->clk);
if (rc != -EPROBE_DEFER)
dev_err(dev, "couldn't get clock\n");
return rc;
}
rc = clk_prepare_enable(lpc_snoop->clk);
if (rc) {
dev_err(dev, "couldn't enable clock\n");
return rc;
}
rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev); rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev);
if (rc) if (rc)
return rc; goto err;
rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 0, port); rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 0, port);
if (rc) if (rc)
return rc; goto err;
/* Configuration of 2nd snoop channel port is optional */ /* Configuration of 2nd snoop channel port is optional */
if (of_property_read_u32_index(dev->of_node, "snoop-ports", if (of_property_read_u32_index(dev->of_node, "snoop-ports",
1, &port) == 0) { 1, &port) == 0) {
rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 1, port); rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 1, port);
if (rc) if (rc) {
aspeed_lpc_disable_snoop(lpc_snoop, 0); aspeed_lpc_disable_snoop(lpc_snoop, 0);
goto err;
}
} }
return 0;
err:
clk_disable_unprepare(lpc_snoop->clk);
return rc; return rc;
} }
...@@ -309,6 +331,8 @@ static int aspeed_lpc_snoop_remove(struct platform_device *pdev) ...@@ -309,6 +331,8 @@ static int aspeed_lpc_snoop_remove(struct platform_device *pdev)
aspeed_lpc_disable_snoop(lpc_snoop, 0); aspeed_lpc_disable_snoop(lpc_snoop, 0);
aspeed_lpc_disable_snoop(lpc_snoop, 1); aspeed_lpc_disable_snoop(lpc_snoop, 1);
clk_disable_unprepare(lpc_snoop->clk);
return 0; return 0;
} }
......
...@@ -25,6 +25,7 @@ static struct { ...@@ -25,6 +25,7 @@ static struct {
/* AST2600 */ /* AST2600 */
{ "AST2600", 0x05000303 }, { "AST2600", 0x05000303 },
{ "AST2620", 0x05010203 }, { "AST2620", 0x05010203 },
{ "AST2605", 0x05030103 },
}; };
static const char *siliconid_to_name(u32 siliconid) static const char *siliconid_to_name(u32 siliconid)
...@@ -43,7 +44,10 @@ static const char *siliconid_to_name(u32 siliconid) ...@@ -43,7 +44,10 @@ static const char *siliconid_to_name(u32 siliconid)
static const char *siliconid_to_rev(u32 siliconid) static const char *siliconid_to_rev(u32 siliconid)
{ {
unsigned int rev = (siliconid >> 16) & 0xff; unsigned int rev = (siliconid >> 16) & 0xff;
unsigned int gen = (siliconid >> 24) & 0xff;
if (gen < 0x5) {
/* AST2500 and below */
switch (rev) { switch (rev) {
case 0: case 0:
return "A0"; return "A0";
...@@ -52,6 +56,19 @@ static const char *siliconid_to_rev(u32 siliconid) ...@@ -52,6 +56,19 @@ static const char *siliconid_to_rev(u32 siliconid)
case 3: case 3:
return "A2"; return "A2";
} }
} else {
/* AST2600 */
switch (rev) {
case 0:
return "A0";
case 1:
return "A1";
case 2:
return "A2";
case 3:
return "A3";
}
}
return "??"; return "??";
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment