Angel Pons | ae59387 | 2020-04-04 18:50:57 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Chris Ching | 6fc39d4 | 2017-12-20 16:06:03 -0700 | [diff] [blame] | 2 | |
Marshall Dawson | f42344a | 2019-05-02 12:53:00 -0600 | [diff] [blame] | 3 | #include <amdblocks/acpimmio.h> |
Karthikeyan Ramasubramanian | 0dbea48 | 2021-03-08 23:23:50 -0700 | [diff] [blame] | 4 | #include <amdblocks/i2c.h> |
Chris Ching | 6fc39d4 | 2017-12-20 16:06:03 -0700 | [diff] [blame] | 5 | #include <soc/iomap.h> |
Marshall Dawson | f42344a | 2019-05-02 12:53:00 -0600 | [diff] [blame] | 6 | #include <soc/i2c.h> |
Justin TerAvest | 13101a7 | 2018-01-24 14:23:12 -0700 | [diff] [blame] | 7 | #include "chip.h" |
Zheng Bao | 533fc4d | 2021-10-30 21:31:04 +0800 | [diff] [blame] | 8 | #include <drivers/i2c/designware/dw_i2c.h> |
Justin TerAvest | 13101a7 | 2018-01-24 14:23:12 -0700 | [diff] [blame] | 9 | |
Karthikeyan Ramasubramanian | 4f87ae1 | 2021-03-18 23:16:29 -0600 | [diff] [blame] | 10 | static const struct soc_i2c_ctrlr_info i2c_ctrlr[] = { |
Felix Held | d1da957 | 2021-10-15 16:29:22 +0200 | [diff] [blame] | 11 | { I2C_MASTER_MODE, APU_I2C0_BASE, "I2CA" }, |
| 12 | { I2C_MASTER_MODE, APU_I2C1_BASE, "I2CB" }, |
| 13 | { I2C_MASTER_MODE, APU_I2C2_BASE, "I2CC" }, |
| 14 | { I2C_MASTER_MODE, APU_I2C3_BASE, "I2CD" }, |
Aaron Durbin | 2b2c65c | 2018-01-08 10:48:05 -0700 | [diff] [blame] | 15 | }; |
Chris Ching | 6fc39d4 | 2017-12-20 16:06:03 -0700 | [diff] [blame] | 16 | |
Karthikeyan Ramasubramanian | 4f87ae1 | 2021-03-18 23:16:29 -0600 | [diff] [blame] | 17 | const struct soc_i2c_ctrlr_info *soc_get_i2c_ctrlr_info(size_t *num_ctrlrs) |
Chris Ching | 6fc39d4 | 2017-12-20 16:06:03 -0700 | [diff] [blame] | 18 | { |
Karthikeyan Ramasubramanian | 4f87ae1 | 2021-03-18 23:16:29 -0600 | [diff] [blame] | 19 | *num_ctrlrs = ARRAY_SIZE(i2c_ctrlr); |
| 20 | return i2c_ctrlr; |
Chris Ching | 6fc39d4 | 2017-12-20 16:06:03 -0700 | [diff] [blame] | 21 | } |
Justin TerAvest | 13101a7 | 2018-01-24 14:23:12 -0700 | [diff] [blame] | 22 | |
Karthikeyan Ramasubramanian | 4f87ae1 | 2021-03-18 23:16:29 -0600 | [diff] [blame] | 23 | const struct dw_i2c_bus_config *soc_get_i2c_bus_config(size_t *num_buses) |
Aaron Durbin | de3e84c | 2018-01-29 17:44:58 -0700 | [diff] [blame] | 24 | { |
Karthikeyan Ramasubramanian | 4f87ae1 | 2021-03-18 23:16:29 -0600 | [diff] [blame] | 25 | const struct soc_amd_stoneyridge_config *config = config_of_soc(); |
Aaron Durbin | de3e84c | 2018-01-29 17:44:58 -0700 | [diff] [blame] | 26 | |
Karthikeyan Ramasubramanian | 4f87ae1 | 2021-03-18 23:16:29 -0600 | [diff] [blame] | 27 | *num_buses = ARRAY_SIZE(config->i2c); |
| 28 | return config->i2c; |
Justin TerAvest | 13101a7 | 2018-01-24 14:23:12 -0700 | [diff] [blame] | 29 | } |
Zheng Bao | 533fc4d | 2021-10-30 21:31:04 +0800 | [diff] [blame] | 30 | |
| 31 | void soc_i2c_misc_init(unsigned int bus, const struct dw_i2c_bus_config *cfg) |
| 32 | { |
| 33 | /* Do nothing. */ |
| 34 | } |