1
0
Fork 0

soc: Amlogic updates for v5.2

- socinfo: support new SoCs / packages
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEe4dGDhaSf6n1v/EMWTcYmtP7xmUFAlyei14ACgkQWTcYmtP7
 xmWvfg/+P+s9EJF9w9iSMWc6DCfwvufJRfPBO6T8MGoTSHzR8vPoCRDnwFtIhzh5
 ZOMbGWeutXv7cQynbbqWsSTi+qY9ye7JjEW142Abxa2bMc51hxWsR9Y3Sxt/tUam
 KbikqYuyv7svSPoxpucLi30ykcti2BFdHMrfuNhM+Ml6IuFVvOJ1bJA5scQXVB7l
 49blLz9VTtAkoPRD8XBd+otDntb/8XZxfUyD2FANZhauXNiriQxAzOaauru7iMz0
 V1Nd5MzwW3q+SQ4Qn1iohCfAVmPdgqFmq1DItJXm0iaaYF/fxPRj7Sql5NVx+M2O
 iL6bozt/aAJRVcleGiS78jTawQh2FTE1h8NuVGDmGU2bg43E75DhbBeU1M95zZyM
 uMH96ofjejF2SKPFT5jl67qDCrOj0QwInM5Nivoa0lYDNhS+2ZXN/S7Bw8XF3KfO
 Igxub9/TKzSAVdB04V6CvT+v0YZW/f2exB0/KnIcmQC0tFiEf/CEfZb5QM4W5l5b
 BGGH+VyJaHNXobmzhaVOCapy2TlEIjOk5aVKu52B7Q7XsPuRs7guVWuIdqAt1tH8
 lclXq3tju9shqfXJPtZiTvZzQbhElQZdNlcyDl1kSCMjCdqSR5lW8hfmEF//lU2F
 qPI5W3w73xkNCSFwCgbC1DYw8/N5aum8dIe28bz6ZKvsNyY+jV4=
 =rHNh
 -----END PGP SIGNATURE-----

Merge tag 'amlogic-drivers' of https://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic into arm/drivers

soc: Amlogic updates for v5.2
- socinfo: support new SoCs / packages

* tag 'amlogic-drivers' of https://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic:
  meson-gx-socinfo: add missing of_node_put after of_device_is_available
  soc: amlogic: gx-socinfo: Add new SoC IDs and Packages IDs
  soc: amlogic: gx-socinfo: Add mask for each SoC packages

Signed-off-by: Olof Johansson <olof@lixom.net>
hifive-unleashed-5.2
Olof Johansson 2019-04-28 12:07:53 -07:00
commit 424adc176a
1 changed files with 27 additions and 16 deletions

View File

@ -37,26 +37,34 @@ static const struct meson_gx_soc_id {
{ "AXG", 0x25 },
{ "GXLX", 0x26 },
{ "TXHD", 0x27 },
{ "G12A", 0x28 },
{ "G12B", 0x29 },
};
static const struct meson_gx_package_id {
const char *name;
unsigned int major_id;
unsigned int pack_id;
unsigned int pack_mask;
} soc_packages[] = {
{ "S905", 0x1f, 0 },
{ "S905H", 0x1f, 0x13 },
{ "S905M", 0x1f, 0x20 },
{ "S905D", 0x21, 0 },
{ "S905X", 0x21, 0x80 },
{ "S905W", 0x21, 0xa0 },
{ "S905L", 0x21, 0xc0 },
{ "S905M2", 0x21, 0xe0 },
{ "S912", 0x22, 0 },
{ "962X", 0x24, 0x10 },
{ "962E", 0x24, 0x20 },
{ "A113X", 0x25, 0x37 },
{ "A113D", 0x25, 0x22 },
{ "S905", 0x1f, 0, 0x20 }, /* pack_id != 0x20 */
{ "S905H", 0x1f, 0x3, 0xf }, /* pack_id & 0xf == 0x3 */
{ "S905M", 0x1f, 0x20, 0xf0 }, /* pack_id == 0x20 */
{ "S905D", 0x21, 0, 0xf0 },
{ "S905X", 0x21, 0x80, 0xf0 },
{ "S905W", 0x21, 0xa0, 0xf0 },
{ "S905L", 0x21, 0xc0, 0xf0 },
{ "S905M2", 0x21, 0xe0, 0xf0 },
{ "S805X", 0x21, 0x30, 0xf0 },
{ "S805Y", 0x21, 0xb0, 0xf0 },
{ "S912", 0x22, 0, 0x0 }, /* Only S912 is known for GXM */
{ "962X", 0x24, 0x10, 0xf0 },
{ "962E", 0x24, 0x20, 0xf0 },
{ "A113X", 0x25, 0x37, 0xff },
{ "A113D", 0x25, 0x22, 0xff },
{ "S905D2", 0x28, 0x10, 0xf0 },
{ "S905X2", 0x28, 0x40, 0xf0 },
{ "S922X", 0x29, 0x40, 0xf0 },
};
static inline unsigned int socinfo_to_major(u32 socinfo)
@ -81,13 +89,14 @@ static inline unsigned int socinfo_to_misc(u32 socinfo)
static const char *socinfo_to_package_id(u32 socinfo)
{
unsigned int pack = socinfo_to_pack(socinfo) & 0xf0;
unsigned int pack = socinfo_to_pack(socinfo);
unsigned int major = socinfo_to_major(socinfo);
int i;
for (i = 0 ; i < ARRAY_SIZE(soc_packages) ; ++i) {
if (soc_packages[i].major_id == major &&
soc_packages[i].pack_id == pack)
soc_packages[i].pack_id ==
(pack & soc_packages[i].pack_mask))
return soc_packages[i].name;
}
@ -123,8 +132,10 @@ static int __init meson_gx_socinfo_init(void)
return -ENODEV;
/* check if interface is enabled */
if (!of_device_is_available(np))
if (!of_device_is_available(np)) {
of_node_put(np);
return -ENODEV;
}
/* check if chip-id is available */
if (!of_property_read_bool(np, "amlogic,has-chip-id"))