diff options
| author | Vitaly Bordug <vbordug@ru.mvista.com> | 2006-09-21 14:38:05 -0400 |
|---|---|---|
| committer | Vitaly Bordug <vbordug@ru.mvista.com> | 2006-09-21 14:38:05 -0400 |
| commit | 611a15afcdaacec6efba984c7eb089b853564bdf (patch) | |
| tree | 6d33fdbb9354d4548fa44e5115de7186f38ac8c0 /include | |
| parent | d3465c921f79cfef0a4a8ceeeef9a3721bbbb57d (diff) | |
POWERPC: Bring the fs_no calculation to the relevant SoC enumeration
The fs_no mean used to be fs_enet driver driven, hence it was an
enumeration across all the possible fs_enet "users" in the SoC. Now, with
QE on the pipeline, and to make DTS descriptions more clear, fs_no features
relevant SoC part number, with additional field to describe the SoC type.
Another reason for that is now not only fs_enet is going to utilize those
stuff. There might be UART, HLDC, and even USB, so to prevent confusion and
be ready for upcoming OF_device transfer, fs_enet and cpm_uart drivers were
updated in that concern, as well as the relevant DTS.
Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/fs_enet_pd.h | 37 | ||||
| -rw-r--r-- | include/linux/fs_uart_pd.h | 10 |
2 files changed, 47 insertions, 0 deletions
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h index 932223550aca..543cd3cd9e77 100644 --- a/include/linux/fs_enet_pd.h +++ b/include/linux/fs_enet_pd.h | |||
| @@ -55,6 +55,30 @@ static inline int fs_get_scc_index(enum fs_id id) | |||
| 55 | return -1; | 55 | return -1; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | static inline int fs_fec_index2id(int index) | ||
| 59 | { | ||
| 60 | int id = fsid_fec1 + index - 1; | ||
| 61 | if (id >= fsid_fec1 && id <= fsid_fec2) | ||
| 62 | return id; | ||
| 63 | return FS_MAX_INDEX; | ||
| 64 | } | ||
| 65 | |||
| 66 | static inline int fs_fcc_index2id(int index) | ||
| 67 | { | ||
| 68 | int id = fsid_fcc1 + index - 1; | ||
| 69 | if (id >= fsid_fcc1 && id <= fsid_fcc3) | ||
| 70 | return id; | ||
| 71 | return FS_MAX_INDEX; | ||
| 72 | } | ||
| 73 | |||
| 74 | static inline int fs_scc_index2id(int index) | ||
| 75 | { | ||
| 76 | int id = fsid_scc1 + index - 1; | ||
| 77 | if (id >= fsid_scc1 && id <= fsid_scc4) | ||
| 78 | return id; | ||
| 79 | return FS_MAX_INDEX; | ||
| 80 | } | ||
| 81 | |||
| 58 | enum fs_mii_method { | 82 | enum fs_mii_method { |
| 59 | fsmii_fixed, | 83 | fsmii_fixed, |
| 60 | fsmii_fec, | 84 | fsmii_fec, |
| @@ -91,6 +115,7 @@ struct fs_platform_info { | |||
| 91 | void(*init_ioports)(struct fs_platform_info *); | 115 | void(*init_ioports)(struct fs_platform_info *); |
| 92 | /* device specific information */ | 116 | /* device specific information */ |
| 93 | int fs_no; /* controller index */ | 117 | int fs_no; /* controller index */ |
| 118 | char fs_type[4]; /* controller type */ | ||
| 94 | 119 | ||
| 95 | u32 cp_page; /* CPM page */ | 120 | u32 cp_page; /* CPM page */ |
| 96 | u32 cp_block; /* CPM sblock */ | 121 | u32 cp_block; /* CPM sblock */ |
| @@ -126,4 +151,16 @@ struct fs_mii_fec_platform_info { | |||
| 126 | u32 irq[32]; | 151 | u32 irq[32]; |
| 127 | u32 mii_speed; | 152 | u32 mii_speed; |
| 128 | }; | 153 | }; |
| 154 | |||
| 155 | static inline int fs_get_id(struct fs_platform_info *fpi) | ||
| 156 | { | ||
| 157 | if(strstr(fpi->fs_type, "SCC")) | ||
| 158 | return fs_scc_index2id(fpi->fs_no); | ||
| 159 | if(strstr(fpi->fs_type, "FCC")) | ||
| 160 | return fs_fcc_index2id(fpi->fs_no); | ||
| 161 | if(strstr(fpi->fs_type, "FEC")) | ||
| 162 | return fs_fec_index2id(fpi->fs_no); | ||
| 163 | return fpi->fs_no; | ||
| 164 | } | ||
| 165 | |||
| 129 | #endif | 166 | #endif |
diff --git a/include/linux/fs_uart_pd.h b/include/linux/fs_uart_pd.h index a99a020f95c2..809bb9ffc788 100644 --- a/include/linux/fs_uart_pd.h +++ b/include/linux/fs_uart_pd.h | |||
| @@ -49,6 +49,7 @@ struct fs_uart_platform_info { | |||
| 49 | void(*init_ioports)(struct fs_uart_platform_info *); | 49 | void(*init_ioports)(struct fs_uart_platform_info *); |
| 50 | /* device specific information */ | 50 | /* device specific information */ |
| 51 | int fs_no; /* controller index */ | 51 | int fs_no; /* controller index */ |
| 52 | char fs_type[4]; /* controller type */ | ||
| 52 | u32 uart_clk; | 53 | u32 uart_clk; |
| 53 | u8 tx_num_fifo; | 54 | u8 tx_num_fifo; |
| 54 | u8 tx_buf_size; | 55 | u8 tx_buf_size; |
| @@ -59,4 +60,13 @@ struct fs_uart_platform_info { | |||
| 59 | u8 clk_tx; | 60 | u8 clk_tx; |
| 60 | }; | 61 | }; |
| 61 | 62 | ||
| 63 | static inline int fs_uart_get_id(struct fs_uart_platform_info *fpi) | ||
| 64 | { | ||
| 65 | if(strstr(fpi->fs_type, "SMC")) | ||
| 66 | return fs_uart_id_smc2fsid(fpi->fs_no); | ||
| 67 | if(strstr(fpi->fs_type, "SCC")) | ||
| 68 | return fs_uart_id_scc2fsid(fpi->fs_no); | ||
| 69 | return fpi->fs_no; | ||
| 70 | } | ||
| 71 | |||
| 62 | #endif | 72 | #endif |
